[FIR JS] KT-57822: Don't report the diagnostic for non-qualifiers

^KT-57822 Fixed
This commit is contained in:
Nikolay Lunyak
2023-04-07 15:32:26 +03:00
committed by Space Team
parent 375116dcf5
commit 077f49f33b
4 changed files with 26 additions and 0 deletions
@@ -27,6 +27,10 @@ object FirJsNativeRttiChecker : FirBasicExpressionChecker() {
private fun checkGetClassCall(expression: FirGetClassCall, context: CheckerContext, reporter: DiagnosticReporter) {
val declarationToCheck = expression.argument.typeRef.toRegularClassSymbol(context.session) ?: return
if (expression.arguments.firstOrNull() !is FirResolvedQualifier) {
return
}
if (declarationToCheck.isNativeInterface(context)) {
reporter.reportOn(expression.source, FirJsErrors.EXTERNAL_INTERFACE_AS_CLASS_LITERAL, context)
}
@@ -0,0 +1,10 @@
// FIR_IDENTICAL
// ISSUE: KT-57822
external interface Foo
fun bar() {
foo()::class.simpleName
}
external fun foo(): Foo
@@ -30,6 +30,12 @@ public class DiagnosticsTestWithJsStdLibGenerated extends AbstractDiagnosticsTes
runTest("compiler/testData/diagnostics/testsWithJsStdLib/dynamicUnresolved.kt");
}
@Test
@TestMetadata("externalInterfaceClassLiteral.kt")
public void testExternalInterfaceClassLiteral() throws Exception {
runTest("compiler/testData/diagnostics/testsWithJsStdLib/externalInterfaceClassLiteral.kt");
}
@Test
@TestMetadata("funConstructorCallJS.kt")
public void testFunConstructorCallJS() throws Exception {
@@ -31,6 +31,12 @@ public class FirPsiJsOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiJ
runTest("compiler/testData/diagnostics/testsWithJsStdLib/dynamicUnresolved.kt");
}
@Test
@TestMetadata("externalInterfaceClassLiteral.kt")
public void testExternalInterfaceClassLiteral() throws Exception {
runTest("compiler/testData/diagnostics/testsWithJsStdLib/externalInterfaceClassLiteral.kt");
}
@Test
@TestMetadata("funConstructorCallJS.kt")
public void testFunConstructorCallJS() throws Exception {