[K/JS] Fix exportability of type parameter variances in usage positions
^KT-78169 Fixed
diff --git a/compiler/fir/checkers/checkers.js/src/org/jetbrains/kotlin/fir/analysis/js/checkers/declaration/FirJsExportDeclarationChecker.kt b/compiler/fir/checkers/checkers.js/src/org/jetbrains/kotlin/fir/analysis/js/checkers/declaration/FirJsExportDeclarationChecker.kt
index 292380d..6b711e7 100644
--- a/compiler/fir/checkers/checkers.js/src/org/jetbrains/kotlin/fir/analysis/js/checkers/declaration/FirJsExportDeclarationChecker.kt
+++ b/compiler/fir/checkers/checkers.js/src/org/jetbrains/kotlin/fir/analysis/js/checkers/declaration/FirJsExportDeclarationChecker.kt
@@ -229,15 +229,7 @@
currentlyProcessed: MutableSet<ConeKotlinType> = hashSetOf(),
): Boolean {
val typeFromProjection = when (kind) {
- ProjectionKind.INVARIANT -> type
- ProjectionKind.IN -> when (declarationSite.variance) {
- Variance.IN_VARIANCE -> type
- else -> null
- }
- ProjectionKind.OUT -> when (declarationSite.variance) {
- Variance.OUT_VARIANCE -> type
- else -> null
- }
+ ProjectionKind.INVARIANT, ProjectionKind.OUT, ProjectionKind.IN -> type
ProjectionKind.STAR -> when (declarationSite.variance) {
Variance.INVARIANT -> null
else -> declarationSite.getProjectionForRawType(session, makeNullable = false)
diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/inaccurateJsExportBehavior.fir.kt b/compiler/testData/diagnostics/testsWithJsStdLib/inaccurateJsExportBehavior.fir.kt
index 2da0e79..a9772d3 100644
--- a/compiler/testData/diagnostics/testsWithJsStdLib/inaccurateJsExportBehavior.fir.kt
+++ b/compiler/testData/diagnostics/testsWithJsStdLib/inaccurateJsExportBehavior.fir.kt
@@ -17,3 +17,7 @@
<!NON_EXPORTABLE_TYPE!>@JsExport
fun box(): Box<*><!> = null!!
+
+@JsExport
+fun <T> promisify(x: T): Box<out T> =
+ null!!
diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/inaccurateJsExportBehavior.kt b/compiler/testData/diagnostics/testsWithJsStdLib/inaccurateJsExportBehavior.kt
index fb2cfbd..fd586eb 100644
--- a/compiler/testData/diagnostics/testsWithJsStdLib/inaccurateJsExportBehavior.kt
+++ b/compiler/testData/diagnostics/testsWithJsStdLib/inaccurateJsExportBehavior.kt
@@ -17,3 +17,7 @@
@JsExport
fun box(): Box<*> = null!!
+
+@JsExport
+fun <T> promisify(<!UNUSED_PARAMETER!>x<!>: T): Box<out T> =
+ null!!
\ No newline at end of file