commit | 7d9af952e06df550f088b37e4a4872e7da8861ad | [log] [tgz] |
---|---|---|
author | Mikhail Glukhikh <mikhail.glukhikh@jetbrains.com> | Wed Apr 17 15:55:50 2024 +0200 |
committer | Space Team <noreply@jetbrains.team> | Fri Apr 19 07:22:14 2024 +0000 |
tree | 762425b480c7bf0f83a715273af63558360a8dc5 | |
parent | 08532cd7bee11bfdeb0387a2e51eac67960c0a1c [diff] |
K2: unwrap flexible types while determining function type kind #KT-67264 Fixed (cherry picked from commit 9863d7534e3638d10b5d7d12d7c2770642902eab)
diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/ConeInferenceContext.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/ConeInferenceContext.kt index ca07a87..acc17d6 100644 --- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/ConeInferenceContext.kt +++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/types/ConeInferenceContext.kt
@@ -569,7 +569,7 @@ override fun KotlinTypeMarker.functionTypeKind(): FunctionTypeKind? { require(this is ConeKotlinType) - return this.functionTypeKind(session) + return (this.lowerBoundIfFlexible() as ConeClassLikeType).functionTypeKind(session) } override fun getNonReflectFunctionTypeConstructor(parametersNumber: Int, kind: FunctionTypeKind): TypeConstructorMarker {
diff --git a/compiler/testData/diagnostics/tests/suspendConversion/suspendConversionForLambdaList.fir.kt b/compiler/testData/diagnostics/tests/suspendConversion/suspendConversionForLambdaList.fir.kt deleted file mode 100644 index 43a2e99..0000000 --- a/compiler/testData/diagnostics/tests/suspendConversion/suspendConversionForLambdaList.fir.kt +++ /dev/null
@@ -1,20 +0,0 @@ -// ISSUE: KT-67264 -// WITH_STDLIB - -// FILE: MyList.java -public class MyList<T> { - void addAll(Iterable<? extends T> elements) { - } -} - -// FILE: main.kt -fun foo() { - val anys = listOf(Any(), Any(), Any()) - MyList<suspend () -> Any>().addAll( - anys.map { any -> - <!ARGUMENT_TYPE_MISMATCH!>{ - any - }<!> - } - ) -}
diff --git a/compiler/testData/diagnostics/tests/suspendConversion/suspendConversionForLambdaList.kt b/compiler/testData/diagnostics/tests/suspendConversion/suspendConversionForLambdaList.kt index 1a67556..10d2d12 100644 --- a/compiler/testData/diagnostics/tests/suspendConversion/suspendConversionForLambdaList.kt +++ b/compiler/testData/diagnostics/tests/suspendConversion/suspendConversionForLambdaList.kt
@@ -1,3 +1,4 @@ +// FIR_IDENTICAL // ISSUE: KT-67264 // WITH_STDLIB