[FIR] Add more tests for RESERVED_SYNTAX_IN_CALLABLE_REFERENCE_LHS
It's a bit hard to reason about how different diagnostics correspond to one another from the existing tests. ^KT-59835
This commit is contained in:
committed by
Space Team
parent
c8fb0d4574
commit
4fed4b6640
+6
@@ -4859,6 +4859,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
|||||||
runTest("compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax3.kt");
|
runTest("compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax3.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("reservedExpressionSyntax4.kt")
|
||||||
|
public void testReservedExpressionSyntax4() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax4.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("syntheticExtensionOnLHS.kt")
|
@TestMetadata("syntheticExtensionOnLHS.kt")
|
||||||
public void testSyntheticExtensionOnLHS() throws Exception {
|
public void testSyntheticExtensionOnLHS() throws Exception {
|
||||||
|
|||||||
+6
@@ -4859,6 +4859,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
|||||||
runTest("compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax3.kt");
|
runTest("compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax3.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("reservedExpressionSyntax4.kt")
|
||||||
|
public void testReservedExpressionSyntax4() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax4.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("syntheticExtensionOnLHS.kt")
|
@TestMetadata("syntheticExtensionOnLHS.kt")
|
||||||
public void testSyntheticExtensionOnLHS() throws Exception {
|
public void testSyntheticExtensionOnLHS() throws Exception {
|
||||||
|
|||||||
+6
@@ -4853,6 +4853,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
|||||||
runTest("compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax3.kt");
|
runTest("compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax3.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("reservedExpressionSyntax4.kt")
|
||||||
|
public void testReservedExpressionSyntax4() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax4.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("syntheticExtensionOnLHS.kt")
|
@TestMetadata("syntheticExtensionOnLHS.kt")
|
||||||
public void testSyntheticExtensionOnLHS() throws Exception {
|
public void testSyntheticExtensionOnLHS() throws Exception {
|
||||||
|
|||||||
+6
@@ -4859,6 +4859,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
|||||||
runTest("compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax3.kt");
|
runTest("compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax3.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("reservedExpressionSyntax4.kt")
|
||||||
|
public void testReservedExpressionSyntax4() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax4.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("syntheticExtensionOnLHS.kt")
|
@TestMetadata("syntheticExtensionOnLHS.kt")
|
||||||
public void testSyntheticExtensionOnLHS() throws Exception {
|
public void testSyntheticExtensionOnLHS() throws Exception {
|
||||||
|
|||||||
Vendored
+74
@@ -0,0 +1,74 @@
|
|||||||
|
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||||
|
// WITH_STDLIB
|
||||||
|
|
||||||
|
class A {
|
||||||
|
class B<T> {
|
||||||
|
class C {
|
||||||
|
fun foo() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
inner class InnerC {
|
||||||
|
fun foo() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ParametricC<K> {
|
||||||
|
fun foo() {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun goodClassifiers() {
|
||||||
|
A.B.C::class
|
||||||
|
A.B.C::foo
|
||||||
|
|
||||||
|
A.B.InnerC::class
|
||||||
|
A.B<Int>.InnerC::foo
|
||||||
|
}
|
||||||
|
|
||||||
|
fun nullableClassifiers() {
|
||||||
|
<!NULLABLE_TYPE_IN_CLASS_LITERAL_LHS!>A.B.C?::class<!>
|
||||||
|
A.B.C?::<!UNSAFE_CALL!>foo<!>
|
||||||
|
|
||||||
|
<!NULLABLE_TYPE_IN_CLASS_LITERAL_LHS!>A.B.InnerC?::class<!>
|
||||||
|
A.B<Int>.InnerC?::<!UNSAFE_CALL!>foo<!>
|
||||||
|
}
|
||||||
|
|
||||||
|
fun classifiersWithTA() {
|
||||||
|
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A.B<Int>.C<!>::class
|
||||||
|
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A.B<Int>.C<!>::foo
|
||||||
|
|
||||||
|
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A.B<Int>.InnerC<!>::class
|
||||||
|
// A.B<Int>.InnerC::foo // correct
|
||||||
|
|
||||||
|
<!CLASS_LITERAL_LHS_NOT_A_CLASS!>A.B.ParametricC<Int>::class<!>
|
||||||
|
A.B.ParametricC<Int>::foo
|
||||||
|
}
|
||||||
|
|
||||||
|
val a get() = listOf(10)
|
||||||
|
val <T> List<T>.b get() = first()
|
||||||
|
val <T> List<T>.maybeB get() = firstOrNull()
|
||||||
|
val Int.c get() = A.B.C()
|
||||||
|
val Int.maybeC: A.B.C? get() = A.B.C()
|
||||||
|
|
||||||
|
fun rain() {
|
||||||
|
a.b.c::class
|
||||||
|
a.b.c::foo
|
||||||
|
|
||||||
|
<!EXPRESSION_OF_NULLABLE_TYPE_IN_CLASS_LITERAL_LHS!>a.b.c<!>?::class
|
||||||
|
a.b.c?::foo
|
||||||
|
|
||||||
|
<!EXPRESSION_OF_NULLABLE_TYPE_IN_CLASS_LITERAL_LHS!>a.b<!UNNECESSARY_SAFE_CALL!>?.<!>c<!>::class
|
||||||
|
a.b<!UNNECESSARY_SAFE_CALL!>?.<!>c::<!UNSAFE_CALL!>foo<!>
|
||||||
|
|
||||||
|
<!EXPRESSION_OF_NULLABLE_TYPE_IN_CLASS_LITERAL_LHS!>a.maybeB?.c<!>::class
|
||||||
|
a.maybeB?.c::<!UNSAFE_CALL!>foo<!>
|
||||||
|
|
||||||
|
a.<!EXPLICIT_TYPE_ARGUMENTS_IN_PROPERTY_ACCESS!>b<!><Int>.c::class
|
||||||
|
a.<!EXPLICIT_TYPE_ARGUMENTS_IN_PROPERTY_ACCESS!>b<!><Int>.c::foo
|
||||||
|
|
||||||
|
<!EXPRESSION_OF_NULLABLE_TYPE_IN_CLASS_LITERAL_LHS!>a.b.maybeC<!>::class
|
||||||
|
a.b.maybeC::<!UNSAFE_CALL!>foo<!>
|
||||||
|
|
||||||
|
<!EXPRESSION_OF_NULLABLE_TYPE_IN_CLASS_LITERAL_LHS!>a.b.maybeC<!>?::class
|
||||||
|
a.b.maybeC?::<!UNSAFE_CALL!>foo<!>
|
||||||
|
}
|
||||||
+74
@@ -0,0 +1,74 @@
|
|||||||
|
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||||
|
// WITH_STDLIB
|
||||||
|
|
||||||
|
class A {
|
||||||
|
class B<T> {
|
||||||
|
class C {
|
||||||
|
fun foo() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
inner class InnerC {
|
||||||
|
fun foo() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ParametricC<K> {
|
||||||
|
fun foo() {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun goodClassifiers() {
|
||||||
|
A.B.C::class
|
||||||
|
A.B.C::foo
|
||||||
|
|
||||||
|
A.B.InnerC::class
|
||||||
|
A.B<Int>.InnerC::foo
|
||||||
|
}
|
||||||
|
|
||||||
|
fun nullableClassifiers() {
|
||||||
|
<!NULLABLE_TYPE_IN_CLASS_LITERAL_LHS!>A.B.C?::class<!>
|
||||||
|
A.B.C?::<!TYPE_MISMATCH, UNSAFE_CALL!>foo<!>
|
||||||
|
|
||||||
|
<!NULLABLE_TYPE_IN_CLASS_LITERAL_LHS!>A.B.InnerC?::class<!>
|
||||||
|
A.B<Int>.InnerC?::<!TYPE_MISMATCH, UNSAFE_CALL!>foo<!>
|
||||||
|
}
|
||||||
|
|
||||||
|
fun classifiersWithTA() {
|
||||||
|
A.B<!TYPE_ARGUMENTS_FOR_OUTER_CLASS_WHEN_NESTED_REFERENCED!><Int><!>.C::class
|
||||||
|
A.B<!TYPE_ARGUMENTS_FOR_OUTER_CLASS_WHEN_NESTED_REFERENCED!><Int><!>.C::<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!>
|
||||||
|
|
||||||
|
<!CLASS_LITERAL_LHS_NOT_A_CLASS!>A.B<Int>.InnerC::class<!>
|
||||||
|
// A.B<Int>.InnerC::foo // correct
|
||||||
|
|
||||||
|
<!CLASS_LITERAL_LHS_NOT_A_CLASS!>A.B.ParametricC<Int>::class<!>
|
||||||
|
A.B.ParametricC<Int>::foo
|
||||||
|
}
|
||||||
|
|
||||||
|
val a get() = listOf(10)
|
||||||
|
val <T> List<T>.b get() = first()
|
||||||
|
val <T> List<T>.maybeB get() = firstOrNull()
|
||||||
|
val Int.c get() = A.B.C()
|
||||||
|
val Int.maybeC: A.B.C? get() = A.B.C()
|
||||||
|
|
||||||
|
fun rain() {
|
||||||
|
a.b.c::class
|
||||||
|
a.b.c::foo
|
||||||
|
|
||||||
|
<!RESERVED_SYNTAX_IN_CALLABLE_REFERENCE_LHS!>a.b.c<!>?::class
|
||||||
|
<!RESERVED_SYNTAX_IN_CALLABLE_REFERENCE_LHS!>a.b.c<!>?::foo
|
||||||
|
|
||||||
|
<!EXPRESSION_OF_NULLABLE_TYPE_IN_CLASS_LITERAL_LHS!>a.b<!UNNECESSARY_SAFE_CALL!>?.<!>c<!>::class
|
||||||
|
a.b<!UNNECESSARY_SAFE_CALL!>?.<!>c::<!TYPE_MISMATCH, UNSAFE_CALL!>foo<!>
|
||||||
|
|
||||||
|
<!EXPRESSION_OF_NULLABLE_TYPE_IN_CLASS_LITERAL_LHS!>a.maybeB?.c<!>::class
|
||||||
|
a.maybeB?.c::<!TYPE_MISMATCH, UNSAFE_CALL!>foo<!>
|
||||||
|
|
||||||
|
<!RESERVED_SYNTAX_IN_CALLABLE_REFERENCE_LHS!><!DEBUG_INFO_MISSING_UNRESOLVED!>a<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>b<!><<!DEBUG_INFO_MISSING_UNRESOLVED!>Int<!>>.<!DEBUG_INFO_MISSING_UNRESOLVED!>c<!><!>::class
|
||||||
|
<!RESERVED_SYNTAX_IN_CALLABLE_REFERENCE_LHS!><!DEBUG_INFO_MISSING_UNRESOLVED!>a<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>b<!><<!DEBUG_INFO_MISSING_UNRESOLVED!>Int<!>>.<!DEBUG_INFO_MISSING_UNRESOLVED!>c<!><!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>foo<!>
|
||||||
|
|
||||||
|
<!EXPRESSION_OF_NULLABLE_TYPE_IN_CLASS_LITERAL_LHS!>a.b.maybeC<!>::class
|
||||||
|
a.b.maybeC::<!TYPE_MISMATCH, UNSAFE_CALL!>foo<!>
|
||||||
|
|
||||||
|
<!EXPRESSION_OF_NULLABLE_TYPE_IN_CLASS_LITERAL_LHS, RESERVED_SYNTAX_IN_CALLABLE_REFERENCE_LHS!>a.b.maybeC<!>?::class
|
||||||
|
<!RESERVED_SYNTAX_IN_CALLABLE_REFERENCE_LHS!>a.b.maybeC<!>?::<!TYPE_MISMATCH, UNSAFE_CALL!>foo<!>
|
||||||
|
}
|
||||||
Generated
+6
@@ -4859,6 +4859,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
|||||||
runTest("compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax3.kt");
|
runTest("compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax3.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("reservedExpressionSyntax4.kt")
|
||||||
|
public void testReservedExpressionSyntax4() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax4.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("syntheticExtensionOnLHS.kt")
|
@TestMetadata("syntheticExtensionOnLHS.kt")
|
||||||
public void testSyntheticExtensionOnLHS() throws Exception {
|
public void testSyntheticExtensionOnLHS() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user