Extract diagnostics about class literals with empty LHS
^KT-59152
This commit is contained in:
committed by
Space Team
parent
1153238fd7
commit
060f3fa7c4
+6
@@ -4579,6 +4579,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/unsupported/callableReferenceToLocalVariable.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("classLiteralsWithEmptyLHS.kt")
|
||||
public void testClassLiteralsWithEmptyLHS() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/unsupported/classLiteralsWithEmptyLHS.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("javaOverridesKotlinProperty.kt")
|
||||
public void testJavaOverridesKotlinProperty() throws Exception {
|
||||
|
||||
+6
@@ -4579,6 +4579,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/unsupported/callableReferenceToLocalVariable.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("classLiteralsWithEmptyLHS.kt")
|
||||
public void testClassLiteralsWithEmptyLHS() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/unsupported/classLiteralsWithEmptyLHS.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("javaOverridesKotlinProperty.kt")
|
||||
public void testJavaOverridesKotlinProperty() throws Exception {
|
||||
|
||||
+6
@@ -4579,6 +4579,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/unsupported/callableReferenceToLocalVariable.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("classLiteralsWithEmptyLHS.kt")
|
||||
public void testClassLiteralsWithEmptyLHS() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/unsupported/classLiteralsWithEmptyLHS.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("javaOverridesKotlinProperty.kt")
|
||||
public void testJavaOverridesKotlinProperty() throws Exception {
|
||||
|
||||
+6
@@ -4585,6 +4585,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/unsupported/callableReferenceToLocalVariable.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("classLiteralsWithEmptyLHS.kt")
|
||||
public void testClassLiteralsWithEmptyLHS() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/unsupported/classLiteralsWithEmptyLHS.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("javaOverridesKotlinProperty.kt")
|
||||
public void testJavaOverridesKotlinProperty() throws Exception {
|
||||
|
||||
@@ -82,6 +82,7 @@ public interface Errors {
|
||||
DiagnosticFactory0<PsiElement> UNSUPPORTED_SEALED_FUN_INTERFACE = DiagnosticFactory0.create(ERROR);
|
||||
DiagnosticFactory0<PsiElement> UNSUPPORTED_SUSPEND_TEST = DiagnosticFactory0.create(ERROR);
|
||||
DiagnosticFactory0<PsiElement> UNSUPPORTED_REFERENCES_TO_VARIABLES_AND_PARAMETERS = DiagnosticFactory0.create(ERROR);
|
||||
DiagnosticFactory0<PsiElement> UNSUPPORTED_CLASS_LITERALS_WITH_EMPTY_LHS = DiagnosticFactory0.create(ERROR);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
+1
@@ -830,6 +830,7 @@ public class DefaultErrorMessages {
|
||||
MAP.put(UNSUPPORTED_SEALED_FUN_INTERFACE, "'sealed fun interface' is unsupported");
|
||||
MAP.put(UNSUPPORTED_SUSPEND_TEST, "'suspend' functions annotated with @kotlin.test.Test are unsupported");
|
||||
MAP.put(UNSUPPORTED_REFERENCES_TO_VARIABLES_AND_PARAMETERS, "References to variables and parameters are unsupported");
|
||||
MAP.put(UNSUPPORTED_CLASS_LITERALS_WITH_EMPTY_LHS, "Class literals with empty left hand side are unsupported");
|
||||
|
||||
MAP.put(EXCEPTION_FROM_ANALYZER, "Internal Error occurred while analyzing this expression:\n{0}", THROWABLE);
|
||||
MAP.put(MISSING_STDLIB, "{0}. Ensure you have the standard Kotlin library in dependencies", STRING);
|
||||
|
||||
+1
-1
@@ -106,7 +106,7 @@ class DoubleColonExpressionResolver(
|
||||
fun visitClassLiteralExpression(expression: KtClassLiteralExpression, c: ExpressionTypingContext): KotlinTypeInfo {
|
||||
if (expression.isEmptyLHS) {
|
||||
// "::class" will maybe mean "this::class", a class of "this" instance
|
||||
c.trace.report(UNSUPPORTED.on(expression, "Class literals with empty left hand side are not yet supported"))
|
||||
c.trace.report(UNSUPPORTED_CLASS_LITERALS_WITH_EMPTY_LHS.on(expression))
|
||||
} else {
|
||||
val result = resolveDoubleColonLHS(expression, c)
|
||||
|
||||
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
fun regular() {
|
||||
::class
|
||||
|
||||
with(Any()) {
|
||||
::class
|
||||
}
|
||||
}
|
||||
|
||||
fun Any.extension() {
|
||||
::class
|
||||
}
|
||||
|
||||
class A {
|
||||
fun member() {
|
||||
::class
|
||||
}
|
||||
}
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
fun regular() {
|
||||
<!UNSUPPORTED_CLASS_LITERALS_WITH_EMPTY_LHS!>::class<!>
|
||||
|
||||
with(Any()) {
|
||||
<!UNSUPPORTED_CLASS_LITERALS_WITH_EMPTY_LHS!>::class<!>
|
||||
}
|
||||
}
|
||||
|
||||
fun Any.extension() {
|
||||
<!UNSUPPORTED_CLASS_LITERALS_WITH_EMPTY_LHS!>::class<!>
|
||||
}
|
||||
|
||||
class A {
|
||||
fun member() {
|
||||
<!UNSUPPORTED_CLASS_LITERALS_WITH_EMPTY_LHS!>::class<!>
|
||||
}
|
||||
}
|
||||
Generated
+6
@@ -4585,6 +4585,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/unsupported/callableReferenceToLocalVariable.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("classLiteralsWithEmptyLHS.kt")
|
||||
public void testClassLiteralsWithEmptyLHS() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/callableReference/unsupported/classLiteralsWithEmptyLHS.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("javaOverridesKotlinProperty.kt")
|
||||
public void testJavaOverridesKotlinProperty() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user