Fix inference for lambdas with with extension function expected type
^KT-49832 Fixed ^KT-49836 Fixed
This commit is contained in:
committed by
teamcityserver
parent
3fb17cfa9a
commit
0d9ad62d4a
+20
@@ -0,0 +1,20 @@
|
||||
// SKIP_TXT
|
||||
|
||||
typealias A = CharSequence.(Int) -> Unit
|
||||
|
||||
var w: Int = 1
|
||||
|
||||
fun myPrint(x: Int) {}
|
||||
|
||||
fun <T> select(vararg x: T) = x[0]
|
||||
|
||||
val a1: A = select(
|
||||
{ a: Int -> myPrint(a + this.length + 1) },
|
||||
{ a: Int -> myPrint(a + this.length + 2) }
|
||||
)
|
||||
|
||||
val a2 = select(
|
||||
{ a: Int -> myPrint(a + this.length + 1) },
|
||||
fun CharSequence.(a: Int) { myPrint(a + this.length + 2) },
|
||||
{ a: Int -> myPrint(a + this.length + 3) }
|
||||
)
|
||||
@@ -0,0 +1,20 @@
|
||||
// SKIP_TXT
|
||||
|
||||
typealias A = CharSequence.(Int) -> Unit
|
||||
|
||||
var w: Int = 1
|
||||
|
||||
fun myPrint(x: Int) {}
|
||||
|
||||
fun <T> select(vararg x: T) = x[0]
|
||||
|
||||
val a1: A = select(
|
||||
{ <!EXPECTED_PARAMETER_TYPE_MISMATCH!>a: Int<!> -> myPrint(a + this.length + 1) },
|
||||
{ a: Int -> myPrint(a + this.length + 2) }
|
||||
)
|
||||
|
||||
val a2 = select(
|
||||
{ a: Int -> myPrint(a + this.<!UNRESOLVED_REFERENCE!>length<!> <!DEBUG_INFO_MISSING_UNRESOLVED!>+<!> 1) },
|
||||
fun CharSequence.(a: Int) { myPrint(a + this.length + 2) },
|
||||
{ a: Int -> myPrint(a + this.<!UNRESOLVED_REFERENCE!>length<!> <!DEBUG_INFO_MISSING_UNRESOLVED!>+<!> 3) }
|
||||
)
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// !LANGUAGE: -ConsiderExtensionReceiverFromConstrainsInLambda
|
||||
// SKIP_TXT
|
||||
|
||||
typealias A = CharSequence.(Int) -> Unit
|
||||
|
||||
var w: Int = 1
|
||||
|
||||
fun myPrint(x: Int) {}
|
||||
|
||||
fun <T> select(vararg x: T) = x[0]
|
||||
|
||||
val a1: A = select(
|
||||
{ a: Int -> myPrint(a + this.length + 1) },
|
||||
{ a: Int -> myPrint(a + this.length + 2) }
|
||||
)
|
||||
|
||||
val a2 = select(
|
||||
{ a: Int -> myPrint(a + this.length + 1) },
|
||||
fun CharSequence.(a: Int) { myPrint(a + this.length + 2) },
|
||||
{ a: Int -> myPrint(a + this.length + 3) }
|
||||
)
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// !LANGUAGE: -ConsiderExtensionReceiverFromConstrainsInLambda
|
||||
// SKIP_TXT
|
||||
|
||||
typealias A = CharSequence.(Int) -> Unit
|
||||
|
||||
var w: Int = 1
|
||||
|
||||
fun myPrint(x: Int) {}
|
||||
|
||||
fun <T> select(vararg x: T) = x[0]
|
||||
|
||||
val a1: A = select(
|
||||
{ <!EXPECTED_PARAMETER_TYPE_MISMATCH!>a: Int<!> -> myPrint(a + this.length + 1) },
|
||||
{ a: Int -> myPrint(a + this.length + 2) }
|
||||
)
|
||||
|
||||
val a2 = select(
|
||||
{ a: Int -> myPrint(a + this.<!UNRESOLVED_REFERENCE!>length<!> <!DEBUG_INFO_MISSING_UNRESOLVED!>+<!> 1) },
|
||||
fun CharSequence.(a: Int) { myPrint(a + this.length + 2) },
|
||||
{ a: Int -> myPrint(a + this.<!UNRESOLVED_REFERENCE!>length<!> <!DEBUG_INFO_MISSING_UNRESOLVED!>+<!> 3) }
|
||||
)
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// !LANGUAGE: +ConsiderExtensionReceiverFromConstrainsInLambda
|
||||
// FIR_IDENTICAL
|
||||
// SKIP_TXT
|
||||
|
||||
typealias A = CharSequence.(Int) -> Unit
|
||||
|
||||
var w: Int = 1
|
||||
|
||||
fun myPrint(x: Int) {}
|
||||
|
||||
fun <T> select(vararg x: T) = x[0]
|
||||
|
||||
val a1: A = select(
|
||||
{ a: Int -> myPrint(a + this.length + 1) },
|
||||
{ a: Int -> myPrint(a + this.length + 2) }
|
||||
)
|
||||
|
||||
val a2 = select(
|
||||
{ a: Int -> myPrint(a + this.length + 1) },
|
||||
fun CharSequence.(a: Int) { myPrint(a + this.length + 2) },
|
||||
{ a: Int -> myPrint(a + this.length + 3) }
|
||||
)
|
||||
@@ -0,0 +1,19 @@
|
||||
// FIR_IDENTICAL
|
||||
// SKIP_TXT
|
||||
|
||||
typealias A = CharSequence.(Int) -> Unit
|
||||
|
||||
var w: Int = 1
|
||||
|
||||
fun myPrint(x: Int) {}
|
||||
|
||||
val a1: A = when (w) {
|
||||
1 -> { a: Int -> myPrint(a + this.length + 1) }
|
||||
else -> { a: Int -> myPrint(a + this.length + 2) }
|
||||
}
|
||||
|
||||
val a2: A = try {
|
||||
{ a: Int -> myPrint(a + this.length + 1) }
|
||||
} catch (t: Throwable) {
|
||||
{ a: Int -> myPrint(a + this.length + 2) }
|
||||
}
|
||||
Reference in New Issue
Block a user