[NI] Finish analysis for coerced last lambda expressions if needed
This commit is contained in:
+14
-6
@@ -209,23 +209,31 @@ class KotlinResolutionCallbacksImpl(
|
||||
}
|
||||
|
||||
val lastExpressionArgument = getLastDeparentesizedExpression(psiCallArgument)?.let { lastExpression ->
|
||||
if (expectedReturnType?.isUnit() == true || hasReturnWithoutExpression) return@let null // coercion to Unit
|
||||
|
||||
if (lambdaInfo.returnStatements.any { (expression, _) -> expression == lastExpression }) {
|
||||
return@let null
|
||||
}
|
||||
|
||||
// todo lastExpression can be if without else
|
||||
returnArgumentFound = true
|
||||
val lastExpressionType = trace.getType(lastExpression)
|
||||
val contextInfo = lambdaInfo.lastExpressionInfo
|
||||
val lastExpressionTypeInfo = KotlinTypeInfo(lastExpressionType, contextInfo.dataFlowInfoAfter ?: functionTypeInfo.dataFlowInfo)
|
||||
createCallArgument(lastExpression, lastExpressionTypeInfo, contextInfo.lexicalScope, contextInfo.trace)
|
||||
}
|
||||
|
||||
returnArguments.addIfNotNull(lastExpressionArgument)
|
||||
val lastExpressionCoercedToUnit = expectedReturnType?.isUnit() == true || hasReturnWithoutExpression
|
||||
if (!lastExpressionCoercedToUnit && lastExpressionArgument != null) {
|
||||
returnArgumentFound = true
|
||||
returnArguments += lastExpressionArgument
|
||||
}
|
||||
|
||||
return ReturnArgumentsAnalysisResult(ReturnArgumentsInfo(returnArguments, returnArgumentFound), coroutineSession)
|
||||
return ReturnArgumentsAnalysisResult(
|
||||
ReturnArgumentsInfo(
|
||||
returnArguments,
|
||||
lastExpressionArgument,
|
||||
lastExpressionCoercedToUnit,
|
||||
returnArgumentFound
|
||||
),
|
||||
coroutineSession
|
||||
)
|
||||
}
|
||||
|
||||
private fun getLastDeparentesizedExpression(psiCallArgument: PSIKotlinCallArgument): KtExpression? {
|
||||
|
||||
+2
@@ -47,6 +47,8 @@ interface KotlinResolutionStatelessCallbacks {
|
||||
|
||||
data class ReturnArgumentsInfo(
|
||||
val nonErrorArguments: List<KotlinCallArgument>,
|
||||
val lastExpression: KotlinCallArgument?,
|
||||
val lastExpressionCoercedToUnit: Boolean,
|
||||
val returnArgumentsExist: Boolean
|
||||
)
|
||||
|
||||
|
||||
+14
-3
@@ -13,7 +13,9 @@ import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.descriptors.annotations.FilteredAnnotations
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemBuilder
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.addSubsystemFromArgument
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.model.*
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.model.ConstraintStorage
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.model.CoroutinePosition
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.model.LambdaArgumentConstraintPosition
|
||||
import org.jetbrains.kotlin.resolve.calls.model.*
|
||||
import org.jetbrains.kotlin.types.UnwrappedType
|
||||
import org.jetbrains.kotlin.types.model.*
|
||||
@@ -128,9 +130,18 @@ class PostponedArgumentsAnalyzer(
|
||||
stubsForPostponedVariables.cast()
|
||||
)
|
||||
|
||||
returnArgumentsInfo.nonErrorArguments.forEach { c.addSubsystemFromArgument(it) }
|
||||
val returnArguments = returnArgumentsInfo.nonErrorArguments
|
||||
returnArguments.forEach { c.addSubsystemFromArgument(it) }
|
||||
|
||||
val subResolvedKtPrimitives = returnArgumentsInfo.nonErrorArguments.map {
|
||||
val lastExpression = returnArgumentsInfo.lastExpression
|
||||
val allReturnArguments =
|
||||
if (lastExpression != null && returnArgumentsInfo.lastExpressionCoercedToUnit && c.addSubsystemFromArgument(lastExpression)) {
|
||||
returnArguments + lastExpression
|
||||
} else {
|
||||
returnArguments
|
||||
}
|
||||
|
||||
val subResolvedKtPrimitives = allReturnArguments.map {
|
||||
resolveKtPrimitive(
|
||||
c.getBuilder(), it, lambda.returnType.let(::substitute), diagnosticHolder, ReceiverInfo.notReceiver, convertedType = null
|
||||
)
|
||||
|
||||
+9
-3
@@ -68,11 +68,17 @@ fun ConstraintSystemBuilder.addSubtypeConstraintIfCompatible(
|
||||
}
|
||||
|
||||
|
||||
fun PostponedArgumentsAnalyzer.Context.addSubsystemFromArgument(argument: KotlinCallArgument?) {
|
||||
when (argument) {
|
||||
is SubKotlinCallArgument -> addOtherSystem(argument.callResult.constraintSystem)
|
||||
fun PostponedArgumentsAnalyzer.Context.addSubsystemFromArgument(argument: KotlinCallArgument?): Boolean {
|
||||
return when (argument) {
|
||||
is SubKotlinCallArgument -> {
|
||||
addOtherSystem(argument.callResult.constraintSystem)
|
||||
true
|
||||
}
|
||||
|
||||
is CallableReferenceKotlinCallArgument -> {
|
||||
addSubsystemFromArgument(argument.lhsResult.safeAs<LHSResult.Expression>()?.lshCallArgument)
|
||||
}
|
||||
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// !LANGUAGE: -NormalizeConstructorCalls -NewInference
|
||||
// !LANGUAGE: -NormalizeConstructorCalls
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
fun <T> myRun(action: () -> T): T = action()
|
||||
fun foo(): String = "foo"
|
||||
|
||||
fun <K> materialize(): K {
|
||||
result += "K"
|
||||
return "str" as K
|
||||
}
|
||||
|
||||
var result = "fail"
|
||||
|
||||
fun test1(n: Number, b: Boolean) {
|
||||
n.let {
|
||||
if (b) return@let
|
||||
|
||||
myRun {
|
||||
result = "O"
|
||||
foo()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun test2(n: Number, b: Boolean) {
|
||||
n.let {
|
||||
if (b) return@let
|
||||
materialize()
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
test1(42, false)
|
||||
test2(42, false)
|
||||
return result
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -NewInference
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
fun <T> outer(command: () -> T) : T = command()
|
||||
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ fun text() {
|
||||
|
||||
bar2 <!NI;TYPE_MISMATCH!>{<!TYPE_MISMATCH!><!>}<!>
|
||||
bar2 {1}
|
||||
bar2 {<!UNRESOLVED_REFERENCE!>it<!>}
|
||||
bar2 <!NI;TYPE_MISMATCH!>{<!UNRESOLVED_REFERENCE!>it<!>}<!>
|
||||
bar2 <!NI;TYPE_MISMATCH!>{<!CANNOT_INFER_PARAMETER_TYPE, EXPECTED_PARAMETERS_NUMBER_MISMATCH!>it<!> -> <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>it<!>}<!>
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -7,8 +7,8 @@ fun test() {
|
||||
val x = fun <!ANONYMOUS_FUNCTION_WITH_NAME!>named1<!>(x: Int): Int { return 1 }
|
||||
x checkType { _<Function1<Int, Int>>() }
|
||||
|
||||
foo { <!EXPECTED_TYPE_MISMATCH("() -> Int")!>fun named2(): Int {return 1}<!> }
|
||||
foo({ <!EXPECTED_TYPE_MISMATCH!>fun named3() = 1<!> })
|
||||
foo <!NI;TYPE_MISMATCH!>{ <!EXPECTED_TYPE_MISMATCH("() -> Int")!>fun named2(): Int {return 1}<!> }<!>
|
||||
foo(<!NI;TYPE_MISMATCH!>{ <!EXPECTED_TYPE_MISMATCH!>fun named3() = 1<!> }<!>)
|
||||
|
||||
val x1 =
|
||||
<!INVALID_IF_AS_EXPRESSION!>if<!> (1 == 1)
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ class Foo {
|
||||
}
|
||||
|
||||
fun main() {
|
||||
<!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>with<!>("", {
|
||||
with("", {
|
||||
Foo.<!UNRESOLVED_REFERENCE!>findByName<!>("")
|
||||
})
|
||||
with(Foo) {
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
fun foo(<!UNUSED_PARAMETER!>f<!>: String.() -> Int) {}
|
||||
val test = foo(<!TYPE_MISMATCH!>fun <!NI;EXPECTED_PARAMETERS_NUMBER_MISMATCH!>()<!> = <!UNRESOLVED_REFERENCE!>length<!><!>)
|
||||
val test = foo(<!NI;TYPE_MISMATCH, TYPE_MISMATCH!>fun <!NI;EXPECTED_PARAMETERS_NUMBER_MISMATCH!>()<!> = <!UNRESOLVED_REFERENCE!>length<!><!>)
|
||||
Vendored
+2
-2
@@ -6,12 +6,12 @@ class A<T> {
|
||||
class Out<out E>
|
||||
|
||||
fun test(x: A<out CharSequence>, y: Out<CharSequence>) {
|
||||
<!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>with<!>(x) {
|
||||
with(x) {
|
||||
// TODO: this diagnostic could be replaced with TYPE_MISMATCH_DUE_TO_TYPE_PROJECTION
|
||||
"".<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>foo<!>()
|
||||
<!OI;TYPE_MISMATCH_DUE_TO_TYPE_PROJECTIONS!>y<!>.<!NI;UNRESOLVED_REFERENCE_WRONG_RECEIVER!>bar<!>()
|
||||
|
||||
<!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>with<!>(y) {
|
||||
with(y) {
|
||||
<!NI;UNRESOLVED_REFERENCE_WRONG_RECEIVER, OI;TYPE_MISMATCH_DUE_TO_TYPE_PROJECTIONS!>bar<!>()
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -52,7 +52,7 @@ fun testUnit() {
|
||||
fun testParameter() {
|
||||
takeFnToParameter { }
|
||||
takeFnToParameter { Unit }
|
||||
<!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>takeFnToParameter<!> { <!UNRESOLVED_REFERENCE!>unresolved<!>() }
|
||||
takeFnToParameter { <!UNRESOLVED_REFERENCE!>unresolved<!>() }
|
||||
takeFnToParameter { if (true) <!UNRESOLVED_REFERENCE!>unresolved<!>() }
|
||||
<!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>takeFnToParameter<!> {
|
||||
if (true) <!UNRESOLVED_REFERENCE!>unresolved<!>() else <!UNRESOLVED_REFERENCE!>unresolved<!>()
|
||||
@@ -66,7 +66,7 @@ fun testParameter() {
|
||||
takeFnToParameter(fun(): Unit { return Unit })
|
||||
takeFnToParameter(fun() { if (true) return })
|
||||
takeFnToParameter(fun() { if (true) return Unit })
|
||||
<!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>takeFnToParameter<!>(fun() = <!UNRESOLVED_REFERENCE!>unresolved<!>())
|
||||
takeFnToParameter(fun() = <!UNRESOLVED_REFERENCE!>unresolved<!>())
|
||||
takeFnToParameter(fun() { <!UNRESOLVED_REFERENCE!>unresolved<!>() })
|
||||
takeFnToParameter(fun(): Unit { <!UNRESOLVED_REFERENCE!>unresolved<!>() })
|
||||
takeFnToParameter(fun() { return <!UNRESOLVED_REFERENCE!>unresolved<!>() })
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ fun foo(): String? {
|
||||
|
||||
run {
|
||||
if (true) {
|
||||
<!IMPLICIT_CAST_TO_ANY!>Obj()<!>
|
||||
Obj()
|
||||
} else
|
||||
<!INVALID_IF_AS_EXPRESSION!>if<!> (true) return null // Error, coercion to Unit doesn't propagate inside nested lambdas
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ fun insideJob1() = doTheJob1()
|
||||
suspend fun insideJob2() = doTheJob2()
|
||||
suspend fun insideJob3() = doTheJob3()
|
||||
|
||||
fun doTheJob0() = <!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>simpleAsync0<!> { <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!><!DEBUG_INFO_MISSING_UNRESOLVED!>insideJob0<!>()<!> }
|
||||
fun doTheJob1() = <!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>simpleAsync1<!> { <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!><!DEBUG_INFO_MISSING_UNRESOLVED!>insideJob1<!>()<!> }
|
||||
suspend fun doTheJob2() = <!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>simpleAsync2<!> { <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!><!DEBUG_INFO_MISSING_UNRESOLVED!>insideJob2<!>()<!> }
|
||||
suspend fun doTheJob3() = <!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>simpleAsync3<!> { <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!><!DEBUG_INFO_MISSING_UNRESOLVED!>insideJob3<!>()<!> }
|
||||
fun doTheJob0() = simpleAsync0 { <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!><!DEBUG_INFO_MISSING_UNRESOLVED!>insideJob0<!>()<!> }
|
||||
fun doTheJob1() = simpleAsync1 { <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!><!DEBUG_INFO_MISSING_UNRESOLVED!>insideJob1<!>()<!> }
|
||||
suspend fun doTheJob2() = simpleAsync2 { <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!><!DEBUG_INFO_MISSING_UNRESOLVED!>insideJob2<!>()<!> }
|
||||
suspend fun doTheJob3() = simpleAsync3 { <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!><!DEBUG_INFO_MISSING_UNRESOLVED!>insideJob3<!>()<!> }
|
||||
|
||||
@@ -9,5 +9,5 @@ fun <T> _arrayList(vararg <!UNUSED_PARAMETER!>values<!>: T) : List<T> = throw Ex
|
||||
class _Pair<A>(val a: A)
|
||||
|
||||
fun test() {
|
||||
_arrayList(_Pair(1)).<!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>_sortBy<!> { <!UNUSED_ANONYMOUS_PARAMETER!>it<!> -> <!UNRESOLVED_REFERENCE!>xxx<!> }
|
||||
_arrayList(_Pair(1))._sortBy <!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH!>{ <!UNUSED_ANONYMOUS_PARAMETER!>it<!> -> <!UNRESOLVED_REFERENCE!>xxx<!> }<!>
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ public inline fun <T: Closeable, R> T.use1(block: (T)-> R) : R {
|
||||
}
|
||||
|
||||
fun main() {
|
||||
C().<!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>use1<!> {
|
||||
C().use1 {
|
||||
<!UNUSED_ANONYMOUS_PARAMETER!>w<!> -> // ERROR here
|
||||
<!UNRESOLVED_REFERENCE!>x<!>
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ public inline fun <T: Closeable, R> T.use(block: (t: T)-> R) : R {
|
||||
}
|
||||
|
||||
fun test() {
|
||||
C().<!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>use<!> {
|
||||
C().use {
|
||||
it.close()
|
||||
<!UNRESOLVED_REFERENCE!>x<!>
|
||||
}
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ public inline fun <T: Closeable, R> use(t: T, block: T.(T)-> R) : R {
|
||||
}
|
||||
|
||||
fun test() {
|
||||
<!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>use<!>(C()) {
|
||||
use(C()) {
|
||||
this.close()
|
||||
it.close()
|
||||
<!UNRESOLVED_REFERENCE!>xx<!>
|
||||
|
||||
@@ -13,7 +13,7 @@ public inline fun <T: Closeable, R> T.use(block: T.()-> R) : R {
|
||||
}
|
||||
|
||||
fun test() {
|
||||
C().<!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>use<!> {
|
||||
C().use {
|
||||
this.close()
|
||||
<!UNRESOLVED_REFERENCE!>x<!>
|
||||
}
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ fun <T: Closeable, R> T.foo(block: (T)-> R) = block
|
||||
fun <T: Closeable, R> T.foo(block: (T, T)-> R) = block
|
||||
|
||||
fun main() {
|
||||
C().<!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>foo<!> { // no ambiguity here
|
||||
C().foo { // no ambiguity here
|
||||
<!UNUSED_ANONYMOUS_PARAMETER!>www<!> ->
|
||||
<!UNRESOLVED_REFERENCE!>xs<!>
|
||||
}
|
||||
|
||||
@@ -78,8 +78,8 @@ fun test2() { // to extension lambda 1
|
||||
// val w27 = W2 { i, s: String -> i + s.length } // overload oi- ni-
|
||||
// val i27: E1 = id { i, s: String -> i + s.length } // overload oi- ni-
|
||||
|
||||
val w28 = W2 <!TYPE_MISMATCH!>{ <!EXPECTED_PARAMETERS_NUMBER_MISMATCH!><!EXPECTED_PARAMETER_TYPE_MISMATCH!>i: Int<!>, <!CANNOT_INFER_PARAMETER_TYPE!>s<!><!> -> i + <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>s<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>length<!> }<!> // oi- ni-
|
||||
val i28: E1 = id <!TYPE_MISMATCH!>{ <!EXPECTED_PARAMETERS_NUMBER_MISMATCH!><!EXPECTED_PARAMETER_TYPE_MISMATCH!>i: Int<!>, <!CANNOT_INFER_PARAMETER_TYPE!>s<!><!> -> i + <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>s<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>length<!> }<!> // oi- ni-
|
||||
val w28 = W2 <!TYPE_MISMATCH!>{ <!EXPECTED_PARAMETERS_NUMBER_MISMATCH!><!EXPECTED_PARAMETER_TYPE_MISMATCH, EXPECTED_PARAMETER_TYPE_MISMATCH!>i: Int<!>, <!CANNOT_INFER_PARAMETER_TYPE!>s<!><!> -> i + <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>s<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>length<!> }<!> // oi- ni-
|
||||
val i28: E1 = <!TYPE_MISMATCH!>id <!TYPE_MISMATCH, TYPE_MISMATCH!>{ <!EXPECTED_PARAMETERS_NUMBER_MISMATCH!><!EXPECTED_PARAMETER_TYPE_MISMATCH, EXPECTED_PARAMETER_TYPE_MISMATCH!>i: Int<!>, <!CANNOT_INFER_PARAMETER_TYPE!>s<!><!> -> i + <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>s<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>length<!> }<!><!> // oi- ni-
|
||||
val w29 = W2 <!TYPE_MISMATCH!>{ <!EXPECTED_PARAMETERS_NUMBER_MISMATCH!><!EXPECTED_PARAMETER_TYPE_MISMATCH!>i: Int<!>, s: String<!> -> i + s.length }<!> // oi- ni-
|
||||
val i29: E1 = id { i: Int, s: String -> i + s.length } // oi+ ni+
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ fun test(a: A, b: B) {
|
||||
|
||||
b.<!FUNCTION_EXPECTED!>(a)<!>()
|
||||
|
||||
<!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>with<!>(b) {
|
||||
with(b) {
|
||||
val <!UNUSED_VARIABLE!>y<!>: Int = a()
|
||||
<!FUNCTION_EXPECTED!>(a)<!>()
|
||||
}
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ fun test_2() {
|
||||
fun test_3() {
|
||||
sequence {
|
||||
yield(materialize<Int>())
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>materialize<!>()
|
||||
<!TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>materialize()<!>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ fun test(a: A) {
|
||||
|
||||
a.<!OVERLOAD_RESOLUTION_AMBIGUITY!>forEach<!>("")
|
||||
|
||||
<!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>with<!>(a) {
|
||||
with(a) {
|
||||
forEach() checkType { _<String>() }
|
||||
|
||||
forEach(1) checkType { _<Int>() }
|
||||
|
||||
@@ -37,7 +37,7 @@ fun test2(a: A) {
|
||||
a.forEach() checkType { _<String>() }
|
||||
a.<!OVERLOAD_RESOLUTION_AMBIGUITY!>forEach<!>(1)
|
||||
|
||||
<!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>with<!>(a) {
|
||||
with(a) {
|
||||
forEach() checkType { _<String>() }
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>forEach<!>(1)
|
||||
}
|
||||
|
||||
+7
-8
@@ -33,14 +33,13 @@ FILE fqName:<root> fileName:/nonLocalReturn.kt
|
||||
block: FUN_EXPR type=kotlin.Function0<kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||
CALL 'public final fun run <R> (block: kotlin.Function0<R of kotlin.run>): R of kotlin.run [inline] declared in kotlin' type=kotlin.Any? origin=null
|
||||
<R>: kotlin.Any?
|
||||
block: FUN_EXPR type=kotlin.Function0<kotlin.Nothing> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Nothing
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.Unit declared in <root>.test3'
|
||||
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
|
||||
CALL 'public final fun run <R> (block: kotlin.Function0<R of kotlin.run>): R of kotlin.run [inline] declared in kotlin' type=kotlin.Nothing origin=null
|
||||
<R>: kotlin.Nothing
|
||||
block: FUN_EXPR type=kotlin.Function0<kotlin.Nothing> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Nothing
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.Unit declared in <root>.test3'
|
||||
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
|
||||
FUN name:testLrmFoo1 visibility:public modality:FINAL <> (ints:kotlin.collections.List<kotlin.Int>) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:ints index:0 type:kotlin.collections.List<kotlin.Int>
|
||||
BLOCK_BODY
|
||||
|
||||
+2
-2
@@ -8,7 +8,7 @@ fun test() {
|
||||
Resolved call:
|
||||
|
||||
Candidate descriptor: fun <T> foo(f: () -> T): Unit defined in root package
|
||||
Resulting descriptor: fun <T> foo(f: () -> ???): Unit defined in root package
|
||||
Resulting descriptor: fun <T> foo(f: () -> Unit): Unit defined in root package
|
||||
|
||||
Explicit receiver kind = NO_EXPLICIT_RECEIVER
|
||||
Dispatch receiver = NO_RECEIVER
|
||||
@@ -16,4 +16,4 @@ Extension receiver = NO_RECEIVER
|
||||
|
||||
Value arguments mapping:
|
||||
|
||||
SUCCESS f : () -> ??? = { b }
|
||||
SUCCESS f : () -> Unit = { b }
|
||||
|
||||
+5
@@ -12697,6 +12697,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/inference/capturedStarProjection.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("coercionToUnitWithLastLambdaExpression.kt")
|
||||
public void testCoercionToUnitWithLastLambdaExpression() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/coercionToUnitWithLastLambdaExpression.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("integerLiteralTypeInLamdaReturnType.kt")
|
||||
public void testIntegerLiteralTypeInLamdaReturnType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/integerLiteralTypeInLamdaReturnType.kt");
|
||||
|
||||
+10
-5
@@ -12697,6 +12697,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/inference/capturedStarProjection.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("coercionToUnitWithLastLambdaExpression.kt")
|
||||
public void testCoercionToUnitWithLastLambdaExpression() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/coercionToUnitWithLastLambdaExpression.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("integerLiteralTypeInLamdaReturnType.kt")
|
||||
public void testIntegerLiteralTypeInLamdaReturnType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/integerLiteralTypeInLamdaReturnType.kt");
|
||||
@@ -19427,6 +19432,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/properties/augmentedAssignmentsAndIncrements.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("genericWithSameName.kt")
|
||||
public void ignoreGenericWithSameName() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/genericWithSameName.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("sideEffectInTopLevelInitializerMultiModule.kt")
|
||||
public void ignoreSideEffectInTopLevelInitializerMultiModule() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/sideEffectInTopLevelInitializerMultiModule.kt");
|
||||
@@ -19560,11 +19570,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/properties/genericPropertyMultiModule.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("genericWithSameName.kt")
|
||||
public void testGenericWithSameName() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/genericWithSameName.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("initOrderMultiModule.kt")
|
||||
public void testInitOrderMultiModule() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/properties/initOrderMultiModule.kt");
|
||||
|
||||
+5
@@ -11572,6 +11572,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/inference/capturedStarProjection.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("coercionToUnitWithLastLambdaExpression.kt")
|
||||
public void testCoercionToUnitWithLastLambdaExpression() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/coercionToUnitWithLastLambdaExpression.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("integerLiteralTypeInLamdaReturnType.kt")
|
||||
public void testIntegerLiteralTypeInLamdaReturnType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/integerLiteralTypeInLamdaReturnType.kt");
|
||||
|
||||
+5
@@ -11572,6 +11572,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/inference/capturedStarProjection.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("coercionToUnitWithLastLambdaExpression.kt")
|
||||
public void testCoercionToUnitWithLastLambdaExpression() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/coercionToUnitWithLastLambdaExpression.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("integerLiteralTypeInLamdaReturnType.kt")
|
||||
public void testIntegerLiteralTypeInLamdaReturnType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/integerLiteralTypeInLamdaReturnType.kt");
|
||||
|
||||
Generated
+5
@@ -9942,6 +9942,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/inference/capturedStarProjection.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("coercionToUnitWithLastLambdaExpression.kt")
|
||||
public void testCoercionToUnitWithLastLambdaExpression() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/coercionToUnitWithLastLambdaExpression.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("integerLiteralTypeInLamdaReturnType.kt")
|
||||
public void testIntegerLiteralTypeInLamdaReturnType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/integerLiteralTypeInLamdaReturnType.kt");
|
||||
|
||||
+5
@@ -10007,6 +10007,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/inference/capturedStarProjection.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("coercionToUnitWithLastLambdaExpression.kt")
|
||||
public void testCoercionToUnitWithLastLambdaExpression() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/coercionToUnitWithLastLambdaExpression.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("integerLiteralTypeInLamdaReturnType.kt")
|
||||
public void testIntegerLiteralTypeInLamdaReturnType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/integerLiteralTypeInLamdaReturnType.kt");
|
||||
|
||||
Reference in New Issue
Block a user