diff --git a/compiler/testData/diagnostics/tests/callableReference/referenceAdaptationCompatibility.fir.kt b/compiler/testData/diagnostics/tests/callableReference/referenceAdaptationCompatibility.fir.kt index c264f3a9b20..741358ea0ad 100644 --- a/compiler/testData/diagnostics/tests/callableReference/referenceAdaptationCompatibility.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/referenceAdaptationCompatibility.fir.kt @@ -55,3 +55,18 @@ object Test4 { } } } + +object Test5 { + fun foo(f: () -> T): T = f() + + object Scope { + fun bar(): Int = 0 + + fun bar(x: Int = 0): String = "" + + fun test() { + val result = foo(::bar) + result + } + } +} diff --git a/compiler/testData/diagnostics/tests/callableReference/referenceAdaptationCompatibility.kt b/compiler/testData/diagnostics/tests/callableReference/referenceAdaptationCompatibility.kt index 53db8897f9d..da1d84656b7 100644 --- a/compiler/testData/diagnostics/tests/callableReference/referenceAdaptationCompatibility.kt +++ b/compiler/testData/diagnostics/tests/callableReference/referenceAdaptationCompatibility.kt @@ -54,4 +54,19 @@ object Test4 { result } } -} \ No newline at end of file +} + +object Test5 { + fun foo(f: () -> T): T = f() + + object Scope { + fun bar(): Int = 0 + + fun bar(x: Int = 0): String = "" + + fun test() { + val result = foo(::bar) + result + } + } +} diff --git a/compiler/testData/diagnostics/tests/callableReference/referenceAdaptationCompatibility.txt b/compiler/testData/diagnostics/tests/callableReference/referenceAdaptationCompatibility.txt deleted file mode 100644 index c5c27282cc4..00000000000 --- a/compiler/testData/diagnostics/tests/callableReference/referenceAdaptationCompatibility.txt +++ /dev/null @@ -1,73 +0,0 @@ -package - -public object Test1 { - private constructor Test1() - public final fun bar(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun foo(/*0*/ f: () -> T): T - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - - public object Scope { - private constructor Scope() - public final fun bar(/*0*/ x: kotlin.Int = ...): kotlin.String - 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 final fun test(): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } -} - -public object Test2 { - private constructor Test2() - public final fun bar(): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun foo(/*0*/ f: () -> kotlin.Unit): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - - public object Scope { - private constructor Scope() - public final fun bar(): kotlin.String - 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 final fun test(): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } -} - -public object Test3 { - private constructor Test3() - public final fun bar(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int): kotlin.Int - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun foo(/*0*/ f: (kotlin.Int, kotlin.Int) -> T): T - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - - public object Scope { - private constructor Scope() - public final fun bar(/*0*/ vararg ints: kotlin.Int /*kotlin.IntArray*/): kotlin.String - 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 final fun test(): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } -} - -public object Test4 { - private constructor Test4() - public final fun bar(/*0*/ g: kotlin.Array): kotlin.Int - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun foo(/*0*/ f: (kotlin.Array) -> T): T - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - - public object Scope { - private constructor Scope() - public final fun bar(/*0*/ vararg g: kotlin.String /*kotlin.Array*/): kotlin.String - 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 final fun test(): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } -} diff --git a/compiler/testData/diagnostics/tests/j+k/sam/compatibilityResolveToOuterScopeForKotlinFunctions.fir.kt b/compiler/testData/diagnostics/tests/j+k/sam/compatibilityResolveToOuterScopeForKotlinFunctions.fir.kt index eb1fa1074ed..2b9883b393b 100644 --- a/compiler/testData/diagnostics/tests/j+k/sam/compatibilityResolveToOuterScopeForKotlinFunctions.fir.kt +++ b/compiler/testData/diagnostics/tests/j+k/sam/compatibilityResolveToOuterScopeForKotlinFunctions.fir.kt @@ -69,3 +69,14 @@ object Test5 { } } } + +object Test6 { + fun foo(x: Any) = 1 + fun foo(f: () -> Unit) = 2.0 + fun foo(r: Runnable) = "3" + + fun test() { + val result = foo { } + result + } +} diff --git a/compiler/testData/diagnostics/tests/j+k/sam/compatibilityResolveToOuterScopeForKotlinFunctions.kt b/compiler/testData/diagnostics/tests/j+k/sam/compatibilityResolveToOuterScopeForKotlinFunctions.kt index 377ba083957..d09cf1ee94c 100644 --- a/compiler/testData/diagnostics/tests/j+k/sam/compatibilityResolveToOuterScopeForKotlinFunctions.kt +++ b/compiler/testData/diagnostics/tests/j+k/sam/compatibilityResolveToOuterScopeForKotlinFunctions.kt @@ -68,4 +68,15 @@ object Test5 { foo { } } } +} + +object Test6 { + fun foo(x: Any) = 1 + fun foo(f: () -> Unit) = 2.0 + fun foo(r: Runnable) = "3" + + fun test() { + val result = foo { } + result + } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/j+k/sam/compatibilityResolveToOuterScopeForKotlinFunctions.txt b/compiler/testData/diagnostics/tests/j+k/sam/compatibilityResolveToOuterScopeForKotlinFunctions.txt deleted file mode 100644 index d68b901386c..00000000000 --- a/compiler/testData/diagnostics/tests/j+k/sam/compatibilityResolveToOuterScopeForKotlinFunctions.txt +++ /dev/null @@ -1,85 +0,0 @@ -package - -public object Test0 { - private constructor Test0() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun foo(/*0*/ x: () -> kotlin.String): kotlin.String - public final fun foo(/*0*/ f: java.lang.Runnable): kotlin.Int - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun test(/*0*/ f: () -> kotlin.Unit): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} - -public object Test1 { - private constructor Test1() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun foo(/*0*/ f: () -> kotlin.Unit): kotlin.Unit - public final fun foo(/*0*/ x: kotlin.Any): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - - public object Scope { - private constructor Scope() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun foo(/*0*/ r: java.lang.Runnable): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun test(/*0*/ f: () -> kotlin.Unit): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } -} - -public object Test2 { - private constructor Test2() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun foo(/*0*/ f: () -> kotlin.String): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - - public object Scope { - private constructor Scope() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun foo(/*0*/ r: java.lang.Runnable): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun test(/*0*/ f: () -> kotlin.Unit): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } -} - -public object Test3 { - private constructor Test3() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun foo(/*0*/ i: kotlin.Int, /*1*/ r: java.lang.Runnable): kotlin.Int - public final fun foo(/*0*/ n: kotlin.Number, /*1*/ f: () -> kotlin.Unit): kotlin.String - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun test(/*0*/ f: () -> kotlin.Unit): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} - -public object Test4 { - private constructor Test4() - public final fun bar(): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun foo(/*0*/ i: kotlin.Int, /*1*/ r: java.lang.Runnable): kotlin.Int - public final fun foo(/*0*/ n: kotlin.Number, /*1*/ f: () -> kotlin.Unit): kotlin.String - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun test(): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} - -public object Test5 { - private constructor Test5() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun foo(/*0*/ f: () -> kotlin.Unit): kotlin.Unit - public final fun foo(/*0*/ x: kotlin.Any): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - - public object Scope { - private constructor Scope() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun foo(/*0*/ r: java.lang.Runnable): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun test(): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } -} diff --git a/compiler/testData/diagnostics/tests/unitConversion/unitConversionCompatibility.fir.kt b/compiler/testData/diagnostics/tests/unitConversion/unitConversionCompatibility.fir.kt index 56e94efb353..ed2b32acca7 100644 --- a/compiler/testData/diagnostics/tests/unitConversion/unitConversionCompatibility.fir.kt +++ b/compiler/testData/diagnostics/tests/unitConversion/unitConversionCompatibility.fir.kt @@ -27,3 +27,14 @@ object Test2 { } } } + +object Test3 { + fun foo(f: () -> Int) = 1 + + fun foo(f: () -> Unit) = "2" + + fun test(f: () -> Int) { + val result = foo(f) + result + } +} diff --git a/compiler/testData/diagnostics/tests/unitConversion/unitConversionCompatibility.kt b/compiler/testData/diagnostics/tests/unitConversion/unitConversionCompatibility.kt index a10eec81b5f..a6925341c1a 100644 --- a/compiler/testData/diagnostics/tests/unitConversion/unitConversionCompatibility.kt +++ b/compiler/testData/diagnostics/tests/unitConversion/unitConversionCompatibility.kt @@ -27,3 +27,14 @@ object Test2 { } } } + +object Test3 { + fun foo(f: () -> Int) = 1 + + fun foo(f: () -> Unit) = "2" + + fun test(f: () -> Int) { + val result = foo(f) + result + } +} diff --git a/compiler/testData/diagnostics/tests/unitConversion/unitConversionCompatibility.txt b/compiler/testData/diagnostics/tests/unitConversion/unitConversionCompatibility.txt deleted file mode 100644 index 486102509b2..00000000000 --- a/compiler/testData/diagnostics/tests/unitConversion/unitConversionCompatibility.txt +++ /dev/null @@ -1,42 +0,0 @@ -package - -public object Test1 { - private constructor Test1() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun foo(/*0*/ f: () -> kotlin.Int): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - - public object Scope { - private constructor Scope() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun foo(/*0*/ f: () -> kotlin.Unit): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun test(/*0*/ f: () -> kotlin.Int): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } -} - -public object Test2 { - private constructor Test2() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun foo(/*0*/ f: () -> kotlin.Unit): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - - public fun interface KRunnable { - 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 abstract fun run(): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } - - public object Scope1 { - private constructor Scope1() - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun foo(/*0*/ f: Test2.KRunnable): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun test(/*0*/ f: () -> kotlin.Int): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - } -}