K2: disable compatibility mode for new inference
#KT-64306 Fixed #KT-64307 Fixed #KT-64308 Fixed
This commit is contained in:
+2
-2
@@ -15,7 +15,7 @@ object Scope {
|
||||
fun test() {
|
||||
// Despite the fact ::bar is resolved with compatibility warning, it's important not to propagate it to the outer call
|
||||
val result = <!DEBUG_INFO_CALL("fqName: Scope.foo; typeCall: function")!>foo(::bar)<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit")!>result<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>result<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+3
-3
@@ -9,7 +9,7 @@ object Test1 {
|
||||
|
||||
fun test() {
|
||||
val result = foo(::bar)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!>result<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>result<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,7 +36,7 @@ object Test3 {
|
||||
|
||||
fun test() {
|
||||
val result = foo(::bar)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!>result<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>result<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -54,4 +54,4 @@ object Test4 {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>result<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
compiler/testData/diagnostics/tests/callableReference/unitAdaptationForReferenceCompatibility.fir.kt
Vendored
+1
-1
@@ -20,6 +20,6 @@ public interface Executor {
|
||||
fun f(): String = "test"
|
||||
|
||||
class A {
|
||||
fun schedule1(e: Executor): Future<String> = e.submit(::f)
|
||||
fun schedule1(e: Executor): Future<String> = <!RETURN_TYPE_MISMATCH!>e.submit(::f)<!>
|
||||
fun schedule2(e: Executor): Future<String> = <!RETURN_TYPE_MISMATCH!>e.submit { f() }<!>
|
||||
}
|
||||
|
||||
+5
-5
@@ -18,7 +18,7 @@ object Test1 {
|
||||
fun foo(r: Runnable) {}
|
||||
|
||||
fun test(f: () -> Unit) {
|
||||
<!DEBUG_INFO_CALL("fqName: Test1.foo; typeCall: function")!>foo(f)<!>
|
||||
<!DEBUG_INFO_CALL("fqName: Test1.Scope.foo; typeCall: function")!>foo(f)<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ object Test3 {
|
||||
|
||||
fun test(f: () -> Unit) {
|
||||
val result = foo(1, f)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>result<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!>result<!>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ object Test4 {
|
||||
|
||||
fun test() {
|
||||
val result = foo(1, ::bar)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>result<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!>result<!>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ object Test5 {
|
||||
fun foo(r: Runnable) {}
|
||||
|
||||
fun test() {
|
||||
<!DEBUG_INFO_CALL("fqName: Test5.foo; typeCall: function")!>foo { }<!>
|
||||
<!DEBUG_INFO_CALL("fqName: Test5.Scope.foo; typeCall: function")!>foo { }<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// SKIP_TXT
|
||||
// FULL_JDK
|
||||
|
||||
fun <T> bar(action: () -> T): T = action()
|
||||
fun bar(action: java.lang.Runnable) { }
|
||||
|
||||
fun foo(): String = ""
|
||||
|
||||
fun main() {
|
||||
val x = bar() { foo() } // OK with default current 1.5/1.6, Error with DisableCompatibilityModeForNewInference enabled
|
||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
// SKIP_TXT
|
||||
// FIR_IDENTICAL
|
||||
// FULL_JDK
|
||||
|
||||
fun <T> bar(action: () -> T): T = action()
|
||||
|
||||
Vendored
+2
-2
@@ -22,7 +22,7 @@ object Test2 {
|
||||
|
||||
fun test() {
|
||||
val result = foo(::bar)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!>result<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>result<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@ object Test3 {
|
||||
|
||||
fun test() {
|
||||
val result = foo(::bar)
|
||||
result
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>result<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -29,8 +29,8 @@ object Test2 {
|
||||
|
||||
fun test() {
|
||||
val result = foo(::bar)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!>result<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>result<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user