Introduce compiler key to disable compatibility resolution mechanism
Enable it if one was using new inferene before 1.4 #KT-40128 Fixed #KT-40112 Fixed #KT-40113 Fixed
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
$TESTDATA_DIR$/newInferenceImpliesProgressiveModeForNI.kt
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-XXLanguage\:+NewInference
|
||||
@@ -0,0 +1,11 @@
|
||||
fun bar(): Int = 0
|
||||
|
||||
object Scope {
|
||||
fun <T> foo(f: () -> T): T = f()
|
||||
|
||||
fun bar(x: Int = 0): String = ""
|
||||
|
||||
fun test() {
|
||||
val r1 = foo(::bar)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
warning: ATTENTION!
|
||||
This build uses unsafe internal compiler arguments:
|
||||
|
||||
-XXLanguage:+NewInference
|
||||
|
||||
This mode is not recommended for production use,
|
||||
as no stability/compatibility guarantees are given on
|
||||
compiler or generated code. Use it at your own risk!
|
||||
|
||||
compiler/testData/cli/jvm/newInferenceImpliesProgressiveModeForNI.kt:6:13: warning: parameter 'x' is never used
|
||||
fun bar(x: Int = 0): String = ""
|
||||
^
|
||||
compiler/testData/cli/jvm/newInferenceImpliesProgressiveModeForNI.kt:9:13: warning: variable 'r1' is never used
|
||||
val r1 = foo(::bar)
|
||||
^
|
||||
OK
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +DisableCompatibilityModeForNewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
|
||||
|
||||
fun bar(): Int = 0
|
||||
|
||||
object Scope {
|
||||
fun <T> foo(f: () -> T): T = f()
|
||||
|
||||
fun bar(x: Int = 0): String = ""
|
||||
|
||||
fun test() {
|
||||
val r1 = foo(::bar)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>r1<!>
|
||||
|
||||
val r2 = foo(Scope::bar)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>r2<!>
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package
|
||||
|
||||
public fun bar(): kotlin.Int
|
||||
|
||||
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 final fun </*0*/ T> foo(/*0*/ f: () -> T): T
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user