FIR: Fix resolution for type-alias based SAM
This commit is contained in:
@@ -0,0 +1,10 @@
|
|||||||
|
// FULL_JDK
|
||||||
|
|
||||||
|
fun foo(x: Comparator<in CharSequence>) {}
|
||||||
|
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
foo { x, y ->
|
||||||
|
x.length - y.length
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
FILE: samForComparator.kt
|
||||||
|
public final fun foo(x: R|kotlin/Comparator<in kotlin/CharSequence>|): R|kotlin/Unit| {
|
||||||
|
}
|
||||||
|
public final fun main(): R|kotlin/Unit| {
|
||||||
|
R|/foo|(<L> = foo@fun <anonymous>(x: R|ft<kotlin/CharSequence, kotlin/CharSequence?>!|, y: R|ft<kotlin/CharSequence, kotlin/CharSequence?>!|): R|kotlin/Int| {
|
||||||
|
^ R|<local>/x|.R|kotlin/CharSequence.length|.R|kotlin/Int.minus|(R|<local>/y|.R|kotlin/CharSequence.length|)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
+5
@@ -243,6 +243,11 @@ public class FirDiagnosticsWithStdlibTestGenerated extends AbstractFirDiagnostic
|
|||||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/runOnIntegerLiteral.kt");
|
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/runOnIntegerLiteral.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("samForComparator.kt")
|
||||||
|
public void testSamForComparator() throws Exception {
|
||||||
|
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/samForComparator.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("simpleLazy.kt")
|
@TestMetadata("simpleLazy.kt")
|
||||||
public void testSimpleLazy() throws Exception {
|
public void testSimpleLazy() throws Exception {
|
||||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/simpleLazy.kt");
|
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/simpleLazy.kt");
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class FirSamResolverImpl(
|
|||||||
|
|
||||||
override fun getFunctionTypeForPossibleSamType(type: ConeKotlinType): ConeKotlinType? {
|
override fun getFunctionTypeForPossibleSamType(type: ConeKotlinType): ConeKotlinType? {
|
||||||
return when (type) {
|
return when (type) {
|
||||||
is ConeClassLikeType -> getFunctionTypeForPossibleSamType(type)
|
is ConeClassLikeType -> getFunctionTypeForPossibleSamType(type.fullyExpandedType(firSession))
|
||||||
is ConeFlexibleType -> ConeFlexibleType(
|
is ConeFlexibleType -> ConeFlexibleType(
|
||||||
getFunctionTypeForPossibleSamType(type.lowerBound) ?: return null,
|
getFunctionTypeForPossibleSamType(type.lowerBound) ?: return null,
|
||||||
getFunctionTypeForPossibleSamType(type.upperBound) ?: return null,
|
getFunctionTypeForPossibleSamType(type.upperBound) ?: return null,
|
||||||
|
|||||||
Reference in New Issue
Block a user