[FIR] Exclude class type arguments checks for type parameters from outer functions
#KT-63577
This commit is contained in:
committed by
Space Team
parent
ff76837d35
commit
dc578b1c5f
+6
@@ -16932,6 +16932,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
||||
runTest("compiler/testData/diagnostics/tests/inference/kt62609.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt63577.kt")
|
||||
public void testKt63577() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/kt63577.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt63982.kt")
|
||||
public void testKt63982() throws Exception {
|
||||
|
||||
+6
@@ -16932,6 +16932,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
||||
runTest("compiler/testData/diagnostics/tests/inference/kt62609.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt63577.kt")
|
||||
public void testKt63577() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/kt63577.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt63982.kt")
|
||||
public void testKt63982() throws Exception {
|
||||
|
||||
+6
@@ -16926,6 +16926,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
||||
runTest("compiler/testData/diagnostics/tests/inference/kt62609.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt63577.kt")
|
||||
public void testKt63577() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/kt63577.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt63982.kt")
|
||||
public void testKt63982() throws Exception {
|
||||
|
||||
+6
@@ -16932,6 +16932,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
||||
runTest("compiler/testData/diagnostics/tests/inference/kt62609.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt63577.kt")
|
||||
public void testKt63577() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/kt63577.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt63982.kt")
|
||||
public void testKt63982() throws Exception {
|
||||
|
||||
+2
-1
@@ -14,6 +14,7 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
|
||||
import org.jetbrains.kotlin.fir.expressions.FirCallableReferenceAccess
|
||||
import org.jetbrains.kotlin.fir.expressions.FirResolvedQualifier
|
||||
import org.jetbrains.kotlin.fir.resolve.fullyExpandedType
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirClassLikeSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirTypeAliasSymbol
|
||||
import org.jetbrains.kotlin.fir.types.constructType
|
||||
|
||||
@@ -23,7 +24,7 @@ object FirTypeArgumentsOfQualifierOfCallableReferenceChecker : FirCallableRefere
|
||||
val correspondingDeclaration = lhs.symbol ?: return
|
||||
|
||||
var typeArgumentsWithSourceInfo = lhs.typeArguments.toTypeArgumentsWithSourceInfo()
|
||||
var typeParameterSymbols = correspondingDeclaration.typeParameterSymbols
|
||||
var typeParameterSymbols = correspondingDeclaration.typeParameterSymbols.filter { it.containingDeclarationSymbol is FirClassLikeSymbol }
|
||||
if (typeParameterSymbols.size != typeArgumentsWithSourceInfo.size) {
|
||||
reporter.reportOn(
|
||||
lhs.source,
|
||||
|
||||
@@ -10,6 +10,9 @@ fun f2() = <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Map.Entry<!>::hashCode
|
||||
|
||||
class Outer<T> {
|
||||
inner class Inner
|
||||
class NotInner
|
||||
}
|
||||
|
||||
fun f3() = <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Outer.Inner<!>::hashCode
|
||||
|
||||
fun f4() = Outer.NotInner::hashCode
|
||||
|
||||
@@ -3,6 +3,7 @@ package
|
||||
public fun f1(): kotlin.reflect.KFunction1<kotlin.collections.Map<*, *>, kotlin.Int>
|
||||
public fun f2(): kotlin.reflect.KFunction1<kotlin.collections.Map.Entry<*, *>, kotlin.Int>
|
||||
public fun f3(): kotlin.reflect.KFunction1<Outer<*>.Inner, kotlin.Int>
|
||||
public fun f4(): kotlin.reflect.KFunction1<Outer.NotInner, kotlin.Int>
|
||||
|
||||
public final class Outer</*0*/ T> {
|
||||
public constructor Outer</*0*/ T>()
|
||||
@@ -16,4 +17,12 @@ public final class Outer</*0*/ T> {
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class NotInner {
|
||||
public constructor NotInner()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
// WITH_STDLIB
|
||||
// FULL_JDK
|
||||
|
||||
fun <ItemType> setupListSpeedSearch() {
|
||||
class MatchedItem(val item: ItemType)
|
||||
class MatchedItem1<T>(val item: ItemType)
|
||||
MatchedItem::class
|
||||
MatchedItem::item
|
||||
MatchedItem1::class
|
||||
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>MatchedItem1<!>::item
|
||||
<!CLASS_LITERAL_LHS_NOT_A_CLASS!>MatchedItem1<Int>::class<!>
|
||||
MatchedItem1<Int>::item
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// WITH_STDLIB
|
||||
// FULL_JDK
|
||||
|
||||
fun <ItemType> setupListSpeedSearch() {
|
||||
class MatchedItem(val item: ItemType)
|
||||
class MatchedItem1<T>(val item: ItemType)
|
||||
<!CLASS_LITERAL_LHS_NOT_A_CLASS!>MatchedItem::class<!>
|
||||
MatchedItem::item
|
||||
MatchedItem1::class
|
||||
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>MatchedItem1<!>::item
|
||||
<!CLASS_LITERAL_LHS_NOT_A_CLASS!>MatchedItem1<Int>::class<!>
|
||||
MatchedItem1<Int>::item
|
||||
}
|
||||
Generated
+6
@@ -16932,6 +16932,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/kt62609.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt63577.kt")
|
||||
public void testKt63577() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/kt63577.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt63982.kt")
|
||||
public void testKt63982() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user