diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/FunInterfaceConstructorReferenceChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/FunInterfaceConstructorReferenceChecker.kt index 5ef80b8e106..9ab599f1035 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/FunInterfaceConstructorReferenceChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/FunInterfaceConstructorReferenceChecker.kt @@ -16,7 +16,7 @@ object FunInterfaceConstructorReferenceChecker : CallChecker { override fun check(resolvedCall: ResolvedCall<*>, reportOn: PsiElement, context: CallCheckerContext) { if (context.languageVersionSettings.supportsFeature(LanguageFeature.KotlinFunInterfaceConstructorReference)) return - val resultingDescriptor = resolvedCall.resultingDescriptor + val resultingDescriptor = resolvedCall.resultingDescriptor.original if (resultingDescriptor !is SamConstructorDescriptor || !resolvedCall.call.isCallableReference()) return if (resultingDescriptor.baseDescriptorForSynthetic.isFun) { @@ -25,4 +25,4 @@ object FunInterfaceConstructorReferenceChecker : CallChecker { ) } } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/funInterface/funInterfaceConstructorReferences_after.kt b/compiler/testData/diagnostics/tests/funInterface/funInterfaceConstructorReferences_after.kt index 1d358dcd273..ae33180158c 100644 --- a/compiler/testData/diagnostics/tests/funInterface/funInterfaceConstructorReferences_after.kt +++ b/compiler/testData/diagnostics/tests/funInterface/funInterfaceConstructorReferences_after.kt @@ -8,3 +8,6 @@ fun interface Foo { val x = ::Foo val y = Foo { } val z = ::Runnable +val w = id(::Foo) + +fun id(t: T): T = t diff --git a/compiler/testData/diagnostics/tests/funInterface/funInterfaceConstructorReferences_after.txt b/compiler/testData/diagnostics/tests/funInterface/funInterfaceConstructorReferences_after.txt index 4dc96ea4dd9..d10e079240d 100644 --- a/compiler/testData/diagnostics/tests/funInterface/funInterfaceConstructorReferences_after.txt +++ b/compiler/testData/diagnostics/tests/funInterface/funInterfaceConstructorReferences_after.txt @@ -1,8 +1,10 @@ package +public val w: kotlin.reflect.KFunction1<() -> kotlin.Unit, Foo> public val x: kotlin.reflect.KFunction1<() -> kotlin.Unit, Foo> public val y: Foo public val z: kotlin.reflect.KFunction1<() -> kotlin.Unit, java.lang.Runnable> +public fun id(/*0*/ t: T): T public fun interface Foo { public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean @@ -10,3 +12,4 @@ public fun interface Foo { public abstract fun run(): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } + diff --git a/compiler/testData/diagnostics/tests/funInterface/funInterfaceConstructorReferences_before.kt b/compiler/testData/diagnostics/tests/funInterface/funInterfaceConstructorReferences_before.kt index fc5132f6208..34b1afe3208 100644 --- a/compiler/testData/diagnostics/tests/funInterface/funInterfaceConstructorReferences_before.kt +++ b/compiler/testData/diagnostics/tests/funInterface/funInterfaceConstructorReferences_before.kt @@ -8,3 +8,6 @@ fun interface Foo { val x = ::Foo val y = Foo { } val z = ::Runnable +val w = id(::Foo) + +fun id(t: T): T = t diff --git a/compiler/testData/diagnostics/tests/funInterface/funInterfaceConstructorReferences_before.txt b/compiler/testData/diagnostics/tests/funInterface/funInterfaceConstructorReferences_before.txt index 4dc96ea4dd9..d10e079240d 100644 --- a/compiler/testData/diagnostics/tests/funInterface/funInterfaceConstructorReferences_before.txt +++ b/compiler/testData/diagnostics/tests/funInterface/funInterfaceConstructorReferences_before.txt @@ -1,8 +1,10 @@ package +public val w: kotlin.reflect.KFunction1<() -> kotlin.Unit, Foo> public val x: kotlin.reflect.KFunction1<() -> kotlin.Unit, Foo> public val y: Foo public val z: kotlin.reflect.KFunction1<() -> kotlin.Unit, java.lang.Runnable> +public fun id(/*0*/ t: T): T public fun interface Foo { public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean @@ -10,3 +12,4 @@ public fun interface Foo { public abstract fun run(): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } +