K2: Adjust test data after PCLA implementation [red-to-red]
^KT-59791 In Progress
This commit is contained in:
committed by
Space Team
parent
276f5b26d8
commit
6052e24626
@@ -4,7 +4,7 @@
|
||||
fun test() {
|
||||
val buildee = build {
|
||||
setTypeVariable(TargetType())
|
||||
letForTypeVariable { it.<!NONE_APPLICABLE!>extensionProduceConcreteType<!>() }
|
||||
letForTypeVariable { <!BUILDER_INFERENCE_STUB_RECEIVER!>it<!>.extensionProduceConcreteType() }
|
||||
}
|
||||
// exact type equality check — turns unexpected compile-time behavior into red code
|
||||
// considered to be non-user-reproducible code for the purposes of these tests
|
||||
|
||||
+2
-2
@@ -2,14 +2,14 @@
|
||||
// CHECK_TYPE_WITH_EXACT
|
||||
|
||||
fun test() {
|
||||
val buildee = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>build<!> {
|
||||
val buildee = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>build<!> {
|
||||
this as DerivedBuildee<*, *>
|
||||
getTypeVariableA()
|
||||
getTypeVariableB()
|
||||
}
|
||||
// exact type equality check — turns unexpected compile-time behavior into red code
|
||||
// considered to be non-user-reproducible code for the purposes of these tests
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>checkExactType<!><<!CANNOT_INFER_PARAMETER_TYPE!>Buildee<*, *><!>>(buildee)
|
||||
checkExactType<Buildee<*, *>>(<!ARGUMENT_TYPE_MISMATCH!>buildee<!>)
|
||||
}
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -2,13 +2,13 @@
|
||||
// CHECK_TYPE_WITH_EXACT
|
||||
|
||||
fun test() {
|
||||
val buildee = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>build<!> {
|
||||
val buildee = build {
|
||||
this as DerivedBuildee<*>
|
||||
getTypeVariable()
|
||||
}
|
||||
// exact type equality check — turns unexpected compile-time behavior into red code
|
||||
// considered to be non-user-reproducible code for the purposes of these tests
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>checkExactType<!><<!CANNOT_INFER_PARAMETER_TYPE!>Buildee<*><!>>(buildee)
|
||||
checkExactType<Buildee<*>>(<!ARGUMENT_TYPE_MISMATCH!>buildee<!>)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
fun test() {
|
||||
val buildee = build {
|
||||
setTypeVariable(TargetType())
|
||||
consumeDifferentTypeCallable(<!ARGUMENT_TYPE_MISMATCH!>this::getTypeVariable<!>)
|
||||
consumeDifferentTypeCallable(this::<!INAPPLICABLE_CANDIDATE!>getTypeVariable<!>)
|
||||
}
|
||||
// exact type equality check — turns unexpected compile-time behavior into red code
|
||||
// considered to be non-user-reproducible code for the purposes of these tests
|
||||
checkExactType<Buildee<TargetType>>(buildee)
|
||||
checkExactType<Buildee<TargetType>>(<!ARGUMENT_TYPE_MISMATCH!>buildee<!>)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// CHECK_TYPE_WITH_EXACT
|
||||
|
||||
fun test() {
|
||||
val buildee = <!NEW_INFERENCE_ERROR!>build {
|
||||
val buildee = build {
|
||||
setTypeVariable(TargetType())
|
||||
consumeDifferentType(extensionReplaceOutProjectedTypeVariable(DifferentType()))
|
||||
}<!>
|
||||
consumeDifferentType(<!ARGUMENT_TYPE_MISMATCH!>extensionReplaceOutProjectedTypeVariable(DifferentType())<!>)
|
||||
}
|
||||
// exact type equality check — turns unexpected compile-time behavior into red code
|
||||
// considered to be non-user-reproducible code for the purposes of these tests
|
||||
checkExactType<Buildee<TargetType>>(buildee)
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// CHECK_TYPE_WITH_EXACT
|
||||
|
||||
fun test() {
|
||||
val buildee = <!NEW_INFERENCE_ERROR!>build {
|
||||
val buildee = build {
|
||||
setTypeVariable(TargetType())
|
||||
consumeDifferentTypeSubtype(getTypeVariable())
|
||||
}<!>
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>consumeDifferentTypeSubtype<!>(<!ARGUMENT_TYPE_MISMATCH!>getTypeVariable()<!>)
|
||||
}
|
||||
// exact type equality check — turns unexpected compile-time behavior into red code
|
||||
// considered to be non-user-reproducible code for the purposes of these tests
|
||||
checkExactType<Buildee<TargetType>>(buildee)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
fun test() {
|
||||
val buildee = <!NEW_INFERENCE_ERROR!>build {
|
||||
setTypeVariable(DifferentType())
|
||||
consumeBuildeeReceiver()
|
||||
<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>consumeBuildeeReceiver<!>()
|
||||
}<!>
|
||||
// exact type equality check — turns unexpected compile-time behavior into red code
|
||||
// considered to be non-user-reproducible code for the purposes of these tests
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
// ISSUE: KT-59798
|
||||
// CHECK_TYPE_WITH_EXACT
|
||||
|
||||
fun test() {
|
||||
val buildee = build {
|
||||
setTypeVariable(TargetType())
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>getTypeVariable().let {}<!>
|
||||
}
|
||||
// exact type equality check — turns unexpected compile-time behavior into red code
|
||||
// considered to be non-user-reproducible code for the purposes of these tests
|
||||
checkExactType<Buildee<TargetType>>(buildee)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class TargetType
|
||||
|
||||
class Buildee<TV> {
|
||||
fun setTypeVariable(value: TV) { storage = value }
|
||||
fun getTypeVariable(): TV = storage
|
||||
private var storage: TV = null!!
|
||||
}
|
||||
|
||||
fun <PTV> build(instructions: Buildee<PTV>.() -> Unit): Buildee<PTV> {
|
||||
return Buildee<PTV>().apply(instructions)
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// ISSUE: KT-59798
|
||||
// CHECK_TYPE_WITH_EXACT
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
fun test() {
|
||||
val buildee = <!NEW_INFERENCE_ERROR!>build {
|
||||
setTypeVariable(TargetType())
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>getTypeVariable().consumeDifferentTypeReceiver()<!>
|
||||
getTypeVariable().<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>consumeDifferentTypeReceiver<!>()
|
||||
}<!>
|
||||
// exact type equality check — turns unexpected compile-time behavior into red code
|
||||
// considered to be non-user-reproducible code for the purposes of these tests
|
||||
|
||||
@@ -8,7 +8,7 @@ fun test() {
|
||||
val targetTypeBuildee = build {
|
||||
var variable = getTypeVariable()
|
||||
variable = TargetType()
|
||||
variable.targetTypeMemberFunction()
|
||||
variable.<!UNRESOLVED_REFERENCE!>targetTypeMemberFunction<!>()
|
||||
}
|
||||
// exact type equality check — turns unexpected compile-time behavior into red code
|
||||
// considered to be non-user-reproducible code for the purposes of these tests
|
||||
@@ -26,15 +26,15 @@ fun test() {
|
||||
val anyBuildee = build {
|
||||
var variable = getTypeVariable()
|
||||
variable = TargetType()
|
||||
variable.targetTypeMemberFunction()
|
||||
variable = DifferentType()
|
||||
variable.<!UNRESOLVED_REFERENCE!>targetTypeMemberFunction<!>()
|
||||
variable = <!ASSIGNMENT_TYPE_MISMATCH!>DifferentType()<!>
|
||||
variable.<!UNRESOLVED_REFERENCE!>targetTypeMemberFunction<!>()
|
||||
variable = TargetType()
|
||||
variable.targetTypeMemberFunction()
|
||||
variable.<!UNRESOLVED_REFERENCE!>targetTypeMemberFunction<!>()
|
||||
}
|
||||
// exact type equality check — turns unexpected compile-time behavior into red code
|
||||
// considered to be non-user-reproducible code for the purposes of these tests
|
||||
checkExactType<Buildee<Any>>(anyBuildee)
|
||||
checkExactType<Buildee<Any>>(<!ARGUMENT_TYPE_MISMATCH!>anyBuildee<!>)
|
||||
}
|
||||
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -5,7 +5,7 @@ fun foo(block: () -> (() -> Int)) {}
|
||||
|
||||
fun test() {
|
||||
val x = <!ANONYMOUS_FUNCTION_WITH_NAME!>fun named1(x: Int): Int { return 1 }<!>
|
||||
x <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { _<Function1<Int, Int>>() }
|
||||
x <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { <!INAPPLICABLE_CANDIDATE!>_<!><<!CANNOT_INFER_PARAMETER_TYPE!>Function1<Int, Int><!>>() }
|
||||
|
||||
foo { <!ARGUMENT_TYPE_MISMATCH!>fun named2(): Int {return 1}<!> }
|
||||
foo({ <!ARGUMENT_TYPE_MISMATCH!>fun named3() = 1<!> })
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// ISSUE: KT-61077
|
||||
|
||||
val test: Int by <!DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE, INFERRED_TYPE_VARIABLE_INTO_POSSIBLE_EMPTY_INTERSECTION!>materializeDelegate()<!>
|
||||
val test: Int by <!DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE!>materializeDelegate()<!>
|
||||
|
||||
fun <T: CharSequence> materializeDelegate(): Box<T> = TODO()
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -31,8 +31,8 @@ fun bar(aInstance: A, bInstance: B) {
|
||||
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>foo<!>(bInstance) {
|
||||
<!CANNOT_INFER_PARAMETER_TYPE, COMPONENT_FUNCTION_MISSING, COMPONENT_FUNCTION_MISSING!>(a, b)<!>, (c, d) ->
|
||||
a checkType { _<Int>() }
|
||||
b checkType { _<String>() }
|
||||
a checkType { <!INAPPLICABLE_CANDIDATE!>_<!><<!CANNOT_INFER_PARAMETER_TYPE!>Int<!>>() }
|
||||
b checkType { <!INAPPLICABLE_CANDIDATE!>_<!><<!CANNOT_INFER_PARAMETER_TYPE!>String<!>>() }
|
||||
c checkType { _<Double>() }
|
||||
d checkType { _<Short>() }
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -20,7 +20,7 @@ class A : Outer<Double, Short>() {
|
||||
|
||||
fun foo() {
|
||||
Derived().foo() checkType { _<Outer<String, Int>.Inner<Char>>() }
|
||||
Derived().baz() <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { _<Map<Char, String>>() }
|
||||
Derived().baz() <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { <!INAPPLICABLE_CANDIDATE!>_<!><<!CANNOT_INFER_PARAMETER_TYPE!>Map<Char, String><!>>() }
|
||||
A.B().bar() checkType { _<Outer<Float, Long>.Inner<String>>() }
|
||||
A.B().x() <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { _<Map<String, Float>>() }
|
||||
A.B().x() <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { <!INAPPLICABLE_CANDIDATE!>_<!><<!CANNOT_INFER_PARAMETER_TYPE!>Map<String, Float><!>>() }
|
||||
}
|
||||
|
||||
+2
-2
@@ -42,7 +42,7 @@ fun test() {
|
||||
x = foobar<String>()
|
||||
|
||||
x().foo().a() checkType { _<A<String, Double, Short, Long>>() }
|
||||
x().bar() <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { _<A<String, Double, Short, Char>>() }
|
||||
x().bar() <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { <!INAPPLICABLE_CANDIDATE!>_<!><<!CANNOT_INFER_PARAMETER_TYPE!>A<String, Double, Short, Char><!>>() }
|
||||
|
||||
x = <!ASSIGNMENT_TYPE_MISMATCH!>foobar<Int>()<!>
|
||||
|
||||
@@ -50,5 +50,5 @@ fun test() {
|
||||
y = noParameters()
|
||||
|
||||
y().foo().a() checkType { _<A<Any, Double, Short, Long>>() }
|
||||
y().bar() <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { _<A<Any, Double, Short, Char>>() }
|
||||
y().bar() <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { <!INAPPLICABLE_CANDIDATE!>_<!><<!CANNOT_INFER_PARAMETER_TYPE!>A<Any, Double, Short, Char><!>>() }
|
||||
}
|
||||
|
||||
+2
-2
@@ -43,7 +43,7 @@ class Outer<T> {
|
||||
x = foobar<String>()
|
||||
|
||||
x().foo().a() checkType { _<A<T, F, String, Double, Short, Long>>() }
|
||||
x().bar() <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { _<A<T, F, String, Double, Short, Char>>() }
|
||||
x().bar() <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { <!INAPPLICABLE_CANDIDATE!>_<!><<!CANNOT_INFER_PARAMETER_TYPE!>A<T, F, String, Double, Short, Char><!>>() }
|
||||
|
||||
x = <!ASSIGNMENT_TYPE_MISMATCH!>foobar<Int>()<!>
|
||||
x = <!ASSIGNMENT_TYPE_MISMATCH!>z.foobar<String>()<!>
|
||||
@@ -52,7 +52,7 @@ class Outer<T> {
|
||||
y = noParameters()
|
||||
|
||||
y().foo().a() checkType { _<A<T, F, Any, Double, Short, Long>>() }
|
||||
y().bar() <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { _<A<T, F, Any, Double, Short, Char>>() }
|
||||
y().bar() <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { <!INAPPLICABLE_CANDIDATE!>_<!><<!CANNOT_INFER_PARAMETER_TYPE!>A<T, F, Any, Double, Short, Char><!>>() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -15,5 +15,5 @@ class Derived : BaseDerived2<Int>() {
|
||||
|
||||
fun foo() {
|
||||
Derived().foo() checkType { _<Outer<Int, String>.Inner<Char>>() }
|
||||
Derived().baz() <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { _<Map<Char, Int>>() }
|
||||
Derived().baz() <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { <!INAPPLICABLE_CANDIDATE!>_<!><<!CANNOT_INFER_PARAMETER_TYPE!>Map<Char, Int><!>>() }
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -15,7 +15,7 @@ fun main() {
|
||||
}
|
||||
<!TYPE_MISMATCH!>buildList {
|
||||
add(3)
|
||||
val x: String = <!INITIALIZER_TYPE_MISMATCH!>get(0)<!>
|
||||
val x: String = <!INITIALIZER_TYPE_MISMATCH, TYPE_MISMATCH!>get(0)<!>
|
||||
}<!>
|
||||
buildList {
|
||||
add("3")
|
||||
@@ -28,6 +28,6 @@ fun main() {
|
||||
}
|
||||
<!TYPE_MISMATCH!>buildList {
|
||||
add("")
|
||||
val x: StringBuilder = <!INITIALIZER_TYPE_MISMATCH!>get(0)<!>
|
||||
val x: StringBuilder = <!INITIALIZER_TYPE_MISMATCH, TYPE_MISMATCH!>get(0)<!>
|
||||
}<!>
|
||||
}
|
||||
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
// WITH_STDLIB
|
||||
// FIR_DUMP
|
||||
// SKIP_TXT
|
||||
|
||||
fun Any?.test() {}
|
||||
|
||||
class Bar {
|
||||
fun test() {}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
|
||||
buildList {
|
||||
add(Bar())
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>this.get(0).test()<!> // resolved to Any?.test
|
||||
}
|
||||
buildList<Bar> {
|
||||
add(Bar())
|
||||
this.get(0).test() // resolved to Bar.test
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
FILE: errorOnStubReceiver.fir.kt
|
||||
FILE: errorOnStubReceiver.kt
|
||||
public final fun R|kotlin/Any?|.test(): R|kotlin/Unit| {
|
||||
}
|
||||
public final class Bar : R|kotlin/Any| {
|
||||
@@ -13,7 +13,7 @@ FILE: errorOnStubReceiver.fir.kt
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
R|kotlin/collections/buildList|<R|Bar|>(<L> = buildList@fun R|kotlin/collections/MutableList<Bar>|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=EXACTLY_ONCE> {
|
||||
this@R|special/anonymous|.R|SubstitutionOverride<kotlin/collections/MutableList.add: R|kotlin/Boolean|>|(R|/Bar.Bar|())
|
||||
this@R|special/anonymous|.R|SubstitutionOverride<kotlin/collections/MutableList.get: R|Stub (chain inference): TypeVariable(E)|>|(Int(0)).R|/test<Inapplicable(RESOLVED_WITH_ERROR): /test>#|()
|
||||
this@R|special/anonymous|.R|SubstitutionOverride<kotlin/collections/MutableList.get: R|Bar|>|(Int(0)).R|/test<Inapplicable(RESOLVED_WITH_ERROR): /test>#|()
|
||||
}
|
||||
)
|
||||
R|kotlin/collections/buildList|<R|Bar|>(<L> = buildList@fun R|kotlin/collections/MutableList<Bar>|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=EXACTLY_ONCE> {
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// WITH_STDLIB
|
||||
// FIR_DUMP
|
||||
// SKIP_TXT
|
||||
|
||||
+2
@@ -1 +1,3 @@
|
||||
/kt47986Default.fir.kt:(175,183): error: Not enough information to infer type argument for 'K'.
|
||||
|
||||
/kt47986Default.fir.kt:(194,197): error: Not enough information to infer type argument for 'K'.
|
||||
|
||||
+1
-1
@@ -7,6 +7,6 @@ fun <K> Foo<K>.bar(x: Int = 1) {}
|
||||
|
||||
fun main() {
|
||||
val x = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>buildFoo<!> {
|
||||
bar()
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>bar<!>()
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
@@ -1 +1,3 @@
|
||||
/kt47986Disabled.fir.kt:(249,257): error: Not enough information to infer type argument for 'K'.
|
||||
|
||||
/kt47986Disabled.fir.kt:(268,271): error: Not enough information to infer type argument for 'K'.
|
||||
|
||||
+1
-1
@@ -8,6 +8,6 @@ fun <K> Foo<K>.bar(x: Int = 1) {}
|
||||
|
||||
fun main() {
|
||||
val x = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>buildFoo<!> {
|
||||
bar()
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>bar<!>()
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// !LANGUAGE: +ForbidInferringPostponedTypeVariableIntoDeclaredUpperBound
|
||||
class Foo<K>
|
||||
|
||||
fun <K> buildFoo(builderAction: Foo<K>.() -> Unit): Foo<K> = Foo()
|
||||
|
||||
fun <K> Foo<K>.bar(x: Int = 1) {}
|
||||
|
||||
fun main() {
|
||||
val x = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>buildFoo<!> {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>bar<!>()
|
||||
}
|
||||
}
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +ForbidInferringPostponedTypeVariableIntoDeclaredUpperBound
|
||||
class Foo<K>
|
||||
|
||||
|
||||
+2
@@ -1 +1,3 @@
|
||||
/kt47986_2.fir.kt:(187,195): error: Not enough information to infer type argument for 'K'.
|
||||
|
||||
/kt47986_2.fir.kt:(234,237): error: Not enough information to infer type argument for 'L'.
|
||||
|
||||
+1
-1
@@ -9,6 +9,6 @@ fun <K> id(x: K) = x
|
||||
|
||||
fun main() {
|
||||
val x = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>buildFoo<!> { // can't infer
|
||||
val y = id(::bar)
|
||||
val y = id(::<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>bar<!>)
|
||||
}
|
||||
}
|
||||
|
||||
+4
@@ -1 +1,5 @@
|
||||
/kt47986_3.fir.kt:(181,189): error: Not enough information to infer type argument for 'K'.
|
||||
|
||||
/kt47986_3.fir.kt:(200,203): error: Not enough information to infer type argument for 'K'.
|
||||
|
||||
/kt47986_3.fir.kt:(200,203): error: Not enough information to infer type argument for 'N'.
|
||||
|
||||
+1
-1
@@ -7,6 +7,6 @@ fun <K: N, N> Foo<K>.bar(x: Int = 1) {}
|
||||
|
||||
fun main() {
|
||||
val x = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>buildFoo<!> {
|
||||
bar()
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>bar<!>()
|
||||
}
|
||||
}
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
class Foo<K>
|
||||
|
||||
fun <K> buildFoo(builderAction: Foo<K>.() -> Unit): Foo<K> = Foo()
|
||||
|
||||
class Bar<K>
|
||||
|
||||
fun <K: Bar<N>, N: Bar<K>> Foo<K>.bar(x: Int = 1) {}
|
||||
|
||||
fun main() {
|
||||
val x = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>buildFoo<!> {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>bar<!>()
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
class Foo<K>
|
||||
|
||||
fun <K> buildFoo(builderAction: Foo<K>.() -> Unit): Foo<K> = Foo()
|
||||
|
||||
+2
@@ -1 +1,3 @@
|
||||
/kt51464.fir.kt:(298,307): error: Not enough information to infer type argument for 'R'.
|
||||
|
||||
/kt51464.fir.kt:(310,316): error: Not enough information to infer type argument for 'T'.
|
||||
|
||||
+1
-1
@@ -9,5 +9,5 @@ fun <T, R> Flow<T>.transform(transform: FlowCollector<R>.(T) -> Unit): Flow<R> =
|
||||
|
||||
fun f() {
|
||||
fun <T> doEmit(collector: FlowCollector<T>) {}
|
||||
flowOf(1).<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>transform<!> { doEmit(this) }
|
||||
flowOf(1).<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>transform<!> { <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>doEmit<!>(this) }
|
||||
}
|
||||
|
||||
Vendored
+3
-3
@@ -19,13 +19,13 @@ fun <K> capture(x: Inv<K>): K = null as K
|
||||
fun <I> id(x: I): I = null as I
|
||||
|
||||
fun main() {
|
||||
<!NEW_INFERENCE_ERROR!>build {
|
||||
build {
|
||||
emit("")
|
||||
// K is fixed into CapturedType(out NotFixed: TypeVariable(R)
|
||||
capture(id(getOut())) // unexpected TYPE_MISMATCH (KT-63996)
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>capture<!>(<!ARGUMENT_TYPE_MISMATCH!>id(getOut())<!>) // unexpected TYPE_MISMATCH (KT-63996)
|
||||
// capture(getOut()) // OK!!!
|
||||
Unit
|
||||
}<!>
|
||||
}
|
||||
build<String> {
|
||||
emit("")
|
||||
// K is fixed into CapturedType(out NotFixed: TypeVariable(R)
|
||||
|
||||
+2
-2
@@ -31,7 +31,7 @@ fun <E> intersect(vararg x: In<E>): E = null as E
|
||||
fun test() {
|
||||
val ret = build {
|
||||
emit("1")
|
||||
intersect(getIn(), getIn())
|
||||
<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_ERROR!>intersect<!>(getIn(), getIn())
|
||||
intersect(getIn(), Test.foo(getIn()))
|
||||
intersect(Test.foo(getIn()), Test.foo(getIn()))
|
||||
intersect(Test.foo(getIn()), getIn())
|
||||
@@ -46,4 +46,4 @@ fun test() {
|
||||
}
|
||||
""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+72
-72
@@ -17,58 +17,58 @@ fun Any.test() {}
|
||||
fun Any?.test2() {}
|
||||
|
||||
fun test() {
|
||||
val ret1 = <!NEW_INFERENCE_ERROR!>build {
|
||||
val ret1 = build {
|
||||
emit(1)
|
||||
emit(null)
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>get()?.test()<!>
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>get()?.test2()<!>
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>get().test2()<!>
|
||||
get()?.hashCode()
|
||||
get()?.equals(1)
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>get()<!>?.test()
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>get()<!>?.test2()
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>get()<!>.test2()
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>get()<!>?.hashCode()
|
||||
get()?.<!NONE_APPLICABLE!>equals<!>(1)
|
||||
// there is `String?.equals` extension
|
||||
get().equals("")
|
||||
}<!>
|
||||
val ret2 = <!NEW_INFERENCE_ERROR!>build {
|
||||
get().<!NONE_APPLICABLE!>equals<!>("")
|
||||
}
|
||||
val ret2 = build {
|
||||
emit(1)
|
||||
emit(null)
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>get()?.test()<!>
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>get()?.test2()<!>
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>get().test2()<!>
|
||||
get()?.hashCode()
|
||||
get()?.equals(1)
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>get()<!>?.test()
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>get()<!>?.test2()
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>get()<!>.test2()
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>get()<!>?.hashCode()
|
||||
get()?.<!NONE_APPLICABLE!>equals<!>(1)
|
||||
val x = get()
|
||||
x?.hashCode()
|
||||
x?.equals(1)
|
||||
x.equals("")
|
||||
}<!>
|
||||
val ret3 = <!NEW_INFERENCE_ERROR!>build {
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>x<!>?.hashCode()
|
||||
x?.<!NONE_APPLICABLE!>equals<!>(1)
|
||||
x.<!NONE_APPLICABLE!>equals<!>("")
|
||||
}
|
||||
val ret3 = build {
|
||||
emit(1)
|
||||
emit(null)
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>get()?.test()<!>
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>get()?.test2()<!>
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>get().test2()<!>
|
||||
get()?.hashCode()
|
||||
get()?.equals(1)
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>get()<!>?.test()
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>get()<!>?.test2()
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>get()<!>.test2()
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>get()<!>?.hashCode()
|
||||
get()?.<!NONE_APPLICABLE!>equals<!>(1)
|
||||
val x = get()
|
||||
x?.hashCode()
|
||||
x?.equals(1)
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>x<!>?.hashCode()
|
||||
x?.<!NONE_APPLICABLE!>equals<!>(1)
|
||||
|
||||
if (get() == null) {}
|
||||
if (<!FORBIDDEN_IDENTITY_EQUALS_WARNING!>get() === null<!>) {}
|
||||
|
||||
if (x != null) {
|
||||
x<!UNNECESSARY_SAFE_CALL!>?.<!>hashCode()
|
||||
x<!UNNECESSARY_SAFE_CALL!>?.<!>equals(1)
|
||||
x.equals("")
|
||||
x.hashCode()
|
||||
x.toString()
|
||||
x.test()
|
||||
x<!UNNECESSARY_SAFE_CALL!>?.<!>test2()
|
||||
x.test2()
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>x<!><!UNNECESSARY_SAFE_CALL!>?.<!>hashCode()
|
||||
x<!UNNECESSARY_SAFE_CALL!>?.<!><!NONE_APPLICABLE!>equals<!>(1)
|
||||
x.<!NONE_APPLICABLE!>equals<!>("")
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>x<!>.hashCode()
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>x<!>.toString()
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>x<!>.test()
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>x<!><!UNNECESSARY_SAFE_CALL!>?.<!>test2()
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>x<!>.test2()
|
||||
}
|
||||
|
||||
""
|
||||
}<!>
|
||||
}
|
||||
val ret4 = build {
|
||||
emit(1)
|
||||
emit(null)
|
||||
@@ -104,7 +104,7 @@ fun test() {
|
||||
emit(null)
|
||||
val x = get()
|
||||
if (x == null) {
|
||||
x<!UNSAFE_CALL!>.<!>test()
|
||||
x.test()
|
||||
}
|
||||
|
||||
""
|
||||
@@ -144,44 +144,44 @@ fun test() {
|
||||
emit(null)
|
||||
val x = get()
|
||||
if (<!FORBIDDEN_IDENTITY_EQUALS_WARNING!>x === null<!>) {
|
||||
x<!UNSAFE_CALL!>.<!>test()
|
||||
x.test()
|
||||
}
|
||||
|
||||
""
|
||||
}
|
||||
val ret408 = <!NEW_INFERENCE_ERROR!>build {
|
||||
val ret408 = build {
|
||||
emit(1)
|
||||
emit(null)
|
||||
val x = get()
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>x.test()<!>
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>x<!><!UNSAFE_CALL!>.<!>test()
|
||||
|
||||
""
|
||||
}<!>
|
||||
val ret41 = <!NEW_INFERENCE_ERROR!>build {
|
||||
}
|
||||
val ret41 = build {
|
||||
emit(1)
|
||||
emit(null)
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>get()?.test()<!>
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>get()?.test2()<!>
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>get().test2()<!>
|
||||
get()?.hashCode()
|
||||
get()?.equals(1)
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>get()<!>?.test()
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>get()<!>?.test2()
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>get()<!>.test2()
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>get()<!>?.hashCode()
|
||||
get()?.<!NONE_APPLICABLE!>equals<!>(1)
|
||||
val x = get()
|
||||
x?.hashCode()
|
||||
x?.equals(1)
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>x<!>?.hashCode()
|
||||
x?.<!NONE_APPLICABLE!>equals<!>(1)
|
||||
|
||||
if (get() == null) {}
|
||||
if (<!FORBIDDEN_IDENTITY_EQUALS_WARNING!>get() === null<!>) {}
|
||||
|
||||
if (x == null) {
|
||||
x?.hashCode()
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>x<!><!UNNECESSARY_SAFE_CALL!>?.<!>hashCode()
|
||||
}
|
||||
|
||||
if (x == null) {
|
||||
x?.<!NONE_APPLICABLE!>equals<!>(1)
|
||||
x<!UNNECESSARY_SAFE_CALL!>?.<!><!NONE_APPLICABLE!>equals<!>(1)
|
||||
}
|
||||
|
||||
if (x == null) {
|
||||
x?.test2()
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>x<!><!UNNECESSARY_SAFE_CALL!>?.<!>test2()
|
||||
}
|
||||
|
||||
if (x == null) {
|
||||
@@ -189,15 +189,15 @@ fun test() {
|
||||
}
|
||||
|
||||
if (<!FORBIDDEN_IDENTITY_EQUALS_WARNING!>x === null<!>) {
|
||||
x?.hashCode()
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>x<!><!UNNECESSARY_SAFE_CALL!>?.<!>hashCode()
|
||||
}
|
||||
|
||||
if (<!FORBIDDEN_IDENTITY_EQUALS_WARNING!>x === null<!>) {
|
||||
x?.<!NONE_APPLICABLE!>equals<!>(1)
|
||||
x<!UNNECESSARY_SAFE_CALL!>?.<!><!NONE_APPLICABLE!>equals<!>(1)
|
||||
}
|
||||
|
||||
if (<!FORBIDDEN_IDENTITY_EQUALS_WARNING!>x === null<!>) {
|
||||
x?.test2()
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>x<!><!UNNECESSARY_SAFE_CALL!>?.<!>test2()
|
||||
}
|
||||
|
||||
if (<!FORBIDDEN_IDENTITY_EQUALS_WARNING!>x === null<!>) {
|
||||
@@ -205,7 +205,7 @@ fun test() {
|
||||
}
|
||||
|
||||
""
|
||||
}<!>
|
||||
}
|
||||
val ret5 = build {
|
||||
emit(1)
|
||||
emit(null)
|
||||
@@ -239,7 +239,7 @@ fun test() {
|
||||
emit(null)
|
||||
val x = get()
|
||||
if (x == null) {
|
||||
x<!UNSAFE_CALL!>.<!>test()
|
||||
x.test()
|
||||
}
|
||||
""
|
||||
}
|
||||
@@ -276,39 +276,39 @@ fun test() {
|
||||
emit(null)
|
||||
val x = get()
|
||||
if (<!FORBIDDEN_IDENTITY_EQUALS_WARNING!>x === null<!>) {
|
||||
x<!UNSAFE_CALL!>.<!>test()
|
||||
x.test()
|
||||
}
|
||||
""
|
||||
}
|
||||
val ret508 = <!NEW_INFERENCE_ERROR!>build {
|
||||
val ret508 = build {
|
||||
emit(1)
|
||||
emit(null)
|
||||
val x = get()
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>x.test()<!>
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>x<!><!UNSAFE_CALL!>.<!>test()
|
||||
""
|
||||
}<!>
|
||||
val ret51 = <!NEW_INFERENCE_ERROR!>build {
|
||||
}
|
||||
val ret51 = build {
|
||||
emit(1)
|
||||
emit(null)
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>get()?.test()<!>
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>get()?.test2()<!>
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>get().test2()<!>
|
||||
get()?.hashCode()
|
||||
get()?.equals(1)
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>get()<!>?.test()
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>get()<!>?.test2()
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>get()<!>.test2()
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>get()<!>?.hashCode()
|
||||
get()?.<!NONE_APPLICABLE!>equals<!>(1)
|
||||
val x = get()
|
||||
x?.hashCode()
|
||||
x?.equals(1)
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>x<!>?.hashCode()
|
||||
x?.<!NONE_APPLICABLE!>equals<!>(1)
|
||||
|
||||
if (get() == null) {}
|
||||
if (<!FORBIDDEN_IDENTITY_EQUALS_WARNING!>get() === null<!>) {}
|
||||
|
||||
if (x == null) {
|
||||
x?.hashCode()
|
||||
x?.<!NONE_APPLICABLE!>equals<!>(1)
|
||||
x?.test2()
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>x<!><!UNNECESSARY_SAFE_CALL!>?.<!>hashCode()
|
||||
x<!UNNECESSARY_SAFE_CALL!>?.<!><!NONE_APPLICABLE!>equals<!>(1)
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>x<!><!UNNECESSARY_SAFE_CALL!>?.<!>test2()
|
||||
x.test2()
|
||||
}
|
||||
|
||||
""
|
||||
}<!>
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+6
-6
@@ -25,27 +25,27 @@ fun <R1 : R2, R2> build4(x: R2, block: TestInterface<R1>.() -> Unit): R1 = TODO(
|
||||
fun test(a: String?) {
|
||||
val ret1 = build {
|
||||
emit(1)
|
||||
get()<!UNNECESSARY_SAFE_CALL!>?.<!>equals("")
|
||||
get()<!UNNECESSARY_SAFE_CALL!>?.<!><!NONE_APPLICABLE!>equals<!>("")
|
||||
val x = get()
|
||||
x<!UNNECESSARY_SAFE_CALL!>?.<!>equals("")
|
||||
x<!UNNECESSARY_SAFE_CALL!>?.<!><!NONE_APPLICABLE!>equals<!>("")
|
||||
x <!USELESS_ELVIS!>?: 1<!>
|
||||
x<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>
|
||||
""
|
||||
}
|
||||
val ret2 = build2 {
|
||||
emit(1)
|
||||
get()<!UNNECESSARY_SAFE_CALL!>?.<!>equals("")
|
||||
get()<!UNNECESSARY_SAFE_CALL!>?.<!><!NONE_APPLICABLE!>equals<!>("")
|
||||
val x = get()
|
||||
x<!UNNECESSARY_SAFE_CALL!>?.<!>equals("")
|
||||
x<!UNNECESSARY_SAFE_CALL!>?.<!><!NONE_APPLICABLE!>equals<!>("")
|
||||
x <!USELESS_ELVIS!>?: 1<!>
|
||||
x<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>
|
||||
""
|
||||
}
|
||||
val ret3 = build3 {
|
||||
emit(1)
|
||||
get()<!UNNECESSARY_SAFE_CALL!>?.<!>equals("")
|
||||
get()<!UNNECESSARY_SAFE_CALL!>?.<!><!NONE_APPLICABLE!>equals<!>("")
|
||||
val x = get()
|
||||
x<!UNNECESSARY_SAFE_CALL!>?.<!>equals("")
|
||||
x<!UNNECESSARY_SAFE_CALL!>?.<!><!NONE_APPLICABLE!>equals<!>("")
|
||||
x <!USELESS_ELVIS!>?: 1<!>
|
||||
x<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>
|
||||
""
|
||||
|
||||
+23
-23
@@ -9,9 +9,9 @@ fun use(p: Any?) {}
|
||||
|
||||
fun test1() {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>a<!> {
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>this.get(0).extension()<!>
|
||||
use(<!BUILDER_INFERENCE_STUB_RECEIVER!>this.get(0)::extension<!>)
|
||||
use(<!BUILDER_INFERENCE_STUB_RECEIVER!>it::extension<!>)
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>this.get(0)<!>.<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>extension<!>()
|
||||
use(<!BUILDER_INFERENCE_STUB_RECEIVER!>this.get(0)<!>::extension)
|
||||
use(it::extension)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,19 +19,19 @@ fun test1() {
|
||||
fun test2() {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>a<!> {
|
||||
val v = this.get(0)
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>v.extension()<!>
|
||||
use(<!BUILDER_INFERENCE_STUB_RECEIVER!>v::extension<!>)
|
||||
use(<!BUILDER_INFERENCE_STUB_RECEIVER!>it::extension<!>)
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>v<!>.<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>extension<!>()
|
||||
use(<!BUILDER_INFERENCE_STUB_RECEIVER!>v<!>::extension)
|
||||
use(it::extension)
|
||||
}
|
||||
}
|
||||
|
||||
fun test3() {
|
||||
operator fun <T> T.getValue(thisRef: Any?, prop: Any?): T = this
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>a<!> {
|
||||
val v by this.get(0)
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>v.extension()<!>
|
||||
use(<!BUILDER_INFERENCE_STUB_RECEIVER!>v::extension<!>)
|
||||
use(<!BUILDER_INFERENCE_STUB_RECEIVER!>it::extension<!>)
|
||||
val v by <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>this.get(0)<!>
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>v<!>.<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>extension<!>()
|
||||
use(<!BUILDER_INFERENCE_STUB_RECEIVER!>v<!>::extension)
|
||||
use(it::extension)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,10 +41,10 @@ fun test4() {
|
||||
operator fun <T> T.provideDelegate(thisRef: Any?, prop: Any?): Box<T> = Box(this)
|
||||
operator fun <T> Box<T>.getValue(thisRef: Any?, prop: Any?): T = this.t
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>a<!> {
|
||||
val v by this.get(0)
|
||||
v.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>extension<!>()
|
||||
use(v::extension)
|
||||
use(<!BUILDER_INFERENCE_STUB_RECEIVER!>it::extension<!>)
|
||||
val v by <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>this.get(0)<!>
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>v<!>.<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>extension<!>()
|
||||
use(<!BUILDER_INFERENCE_STUB_RECEIVER!>v<!>::extension)
|
||||
use(it::extension)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,20 +53,20 @@ fun <R> b(lambda: R.(List<R>) -> Unit) {}
|
||||
fun test5() {
|
||||
|
||||
operator fun <T> T.invoke(): T = this
|
||||
b {
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>extension()<!>
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!><!BUILDER_INFERENCE_STUB_RECEIVER!>this()<!>.extension()<!>
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>use(<!BUILDER_INFERENCE_STUB_RECEIVER!>::extension<!>)<!>
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>b<!> {
|
||||
extension()
|
||||
<!CANNOT_INFER_PARAMETER_TYPE!>this<!><!NO_VALUE_FOR_PARAMETER!>()<!>.<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>extension<!>()
|
||||
use(::extension)
|
||||
}
|
||||
}
|
||||
|
||||
val <T> T.genericLambda: T.((T) -> Unit) -> Unit get() = {}
|
||||
|
||||
fun test6() {
|
||||
b {
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>extension()<!>
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>genericLambda { }<!>
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>genericLambda { it.extension() }<!>
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>use(<!BUILDER_INFERENCE_STUB_RECEIVER!>::extension<!>)<!>
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>b<!> {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, UNRESOLVED_REFERENCE_WRONG_RECEIVER!>extension<!>()
|
||||
<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>genericLambda<!> { }
|
||||
<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>genericLambda<!> { it.extension() }
|
||||
use(::extension)
|
||||
}
|
||||
}
|
||||
|
||||
+14
-14
@@ -10,8 +10,8 @@ fun use(p: Any?) {}
|
||||
|
||||
fun test1() {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>a<!> {
|
||||
this.get(0).extension()
|
||||
use(this.get(0)::extension)
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>this.get(0)<!>.<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>extension<!>()
|
||||
use(<!BUILDER_INFERENCE_STUB_RECEIVER!>this.get(0)<!>::extension)
|
||||
use(it::extension)
|
||||
}
|
||||
}
|
||||
@@ -20,8 +20,8 @@ fun test1() {
|
||||
fun test2() {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>a<!> {
|
||||
val v = this.get(0)
|
||||
v.extension()
|
||||
use(v::extension)
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>v<!>.<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>extension<!>()
|
||||
use(<!BUILDER_INFERENCE_STUB_RECEIVER!>v<!>::extension)
|
||||
use(it::extension)
|
||||
}
|
||||
}
|
||||
@@ -29,9 +29,9 @@ fun test2() {
|
||||
fun test3() {
|
||||
operator fun <T> T.getValue(thisRef: Any?, prop: Any?): T = this
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>a<!> {
|
||||
val v by this.get(0)
|
||||
v.extension()
|
||||
use(v::extension)
|
||||
val v by <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>this.get(0)<!>
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>v<!>.<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>extension<!>()
|
||||
use(<!BUILDER_INFERENCE_STUB_RECEIVER!>v<!>::extension)
|
||||
use(it::extension)
|
||||
}
|
||||
}
|
||||
@@ -42,9 +42,9 @@ fun test4() {
|
||||
operator fun <T> T.provideDelegate(thisRef: Any?, prop: Any?): Box<T> = Box(this)
|
||||
operator fun <T> Box<T>.getValue(thisRef: Any?, prop: Any?): T = this.t
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>a<!> {
|
||||
val v by this.get(0)
|
||||
v.extension()
|
||||
use(v::extension)
|
||||
val v by <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>this.get(0)<!>
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>v<!>.<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>extension<!>()
|
||||
use(<!BUILDER_INFERENCE_STUB_RECEIVER!>v<!>::extension)
|
||||
use(it::extension)
|
||||
}
|
||||
}
|
||||
@@ -56,7 +56,7 @@ fun test5() {
|
||||
operator fun <T> T.invoke(): T = this
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>b<!> {
|
||||
extension()
|
||||
this().extension()
|
||||
<!CANNOT_INFER_PARAMETER_TYPE!>this<!><!NO_VALUE_FOR_PARAMETER!>()<!>.<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>extension<!>()
|
||||
use(::extension)
|
||||
}
|
||||
}
|
||||
@@ -65,9 +65,9 @@ val <T> T.genericLambda: T.((T) -> Unit) -> Unit get() = {}
|
||||
|
||||
fun test6() {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>b<!> {
|
||||
extension()
|
||||
genericLambda { }
|
||||
genericLambda { it.extension() }
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, UNRESOLVED_REFERENCE_WRONG_RECEIVER!>extension<!>()
|
||||
<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>genericLambda<!> { }
|
||||
<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>genericLambda<!> { it.extension() }
|
||||
use(::extension)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,4 +45,4 @@ fun test4() {
|
||||
}
|
||||
}
|
||||
|
||||
fun fail(): Nothing = throw Exception()
|
||||
fun fail(): Nothing = throw Exception()
|
||||
Vendored
+1
-1
@@ -33,7 +33,7 @@ fun foo() {
|
||||
val dates3 = <!NEW_INFERENCE_ERROR!>myRun {
|
||||
when {
|
||||
else -> return@myRun <!RETURN_TYPE_MISMATCH!>buildList {
|
||||
add(4)
|
||||
add(<!ARGUMENT_TYPE_MISMATCH!>4<!>)
|
||||
}<!>
|
||||
}
|
||||
}<!>
|
||||
|
||||
+4
-4
@@ -20,9 +20,9 @@ public abstract class CollectionWithSize implements java.util.Collection<String>
|
||||
// FILE: main.kt
|
||||
|
||||
fun main(c: CollectionWithSize) {
|
||||
CompressionType.ZIP.<!OVERLOAD_RESOLUTION_AMBIGUITY!>name<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { _<Double>() }
|
||||
c.<!OVERLOAD_RESOLUTION_AMBIGUITY!>size<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { _<String>() }
|
||||
CompressionType.ZIP.<!OVERLOAD_RESOLUTION_AMBIGUITY!>name<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { <!INAPPLICABLE_CANDIDATE!>_<!><<!CANNOT_INFER_PARAMETER_TYPE!>Double<!>>() }
|
||||
c.<!OVERLOAD_RESOLUTION_AMBIGUITY!>size<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { <!INAPPLICABLE_CANDIDATE!>_<!><<!CANNOT_INFER_PARAMETER_TYPE!>String<!>>() }
|
||||
|
||||
CompressionType.ZIP::<!OVERLOAD_RESOLUTION_AMBIGUITY!>name<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { _<kotlin.reflect.KProperty0<Double>>() }
|
||||
c::<!OVERLOAD_RESOLUTION_AMBIGUITY!>size<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { _<kotlin.reflect.KProperty0<String>>() }
|
||||
CompressionType.ZIP::<!OVERLOAD_RESOLUTION_AMBIGUITY!>name<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { <!INAPPLICABLE_CANDIDATE!>_<!><<!CANNOT_INFER_PARAMETER_TYPE!>kotlin.reflect.KProperty0<Double><!>>() }
|
||||
c::<!OVERLOAD_RESOLUTION_AMBIGUITY!>size<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { <!INAPPLICABLE_CANDIDATE!>_<!><<!CANNOT_INFER_PARAMETER_TYPE!>kotlin.reflect.KProperty0<String><!>>() }
|
||||
}
|
||||
|
||||
@@ -11,6 +11,6 @@ public class A {
|
||||
// FILE: main.kt
|
||||
|
||||
fun foo(a: A) {
|
||||
a.<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!>() <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { _<String>() }
|
||||
A.<!OVERLOAD_RESOLUTION_AMBIGUITY!>bar<!>() <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { _<String>() }
|
||||
a.<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!>() <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { <!INAPPLICABLE_CANDIDATE!>_<!><<!CANNOT_INFER_PARAMETER_TYPE!>String<!>>() }
|
||||
A.<!OVERLOAD_RESOLUTION_AMBIGUITY!>bar<!>() <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { <!INAPPLICABLE_CANDIDATE!>_<!><<!CANNOT_INFER_PARAMETER_TYPE!>String<!>>() }
|
||||
}
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ interface A : MutableCollection<String> {
|
||||
}
|
||||
|
||||
fun foo(x: MutableCollection<Int>, y: Collection<String>, z: A) {
|
||||
x.<!UNRESOLVED_REFERENCE!>nonExistingMethod<!>(1).<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { _<String>() }
|
||||
x.<!UNRESOLVED_REFERENCE!>nonExistingMethod<!>(1).<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { <!INAPPLICABLE_CANDIDATE!>_<!><<!CANNOT_INFER_PARAMETER_TYPE!>String<!>>() }
|
||||
y.<!UNRESOLVED_REFERENCE!>nonExistingMethod<!>("")
|
||||
z.<!UNRESOLVED_REFERENCE!>nonExistingMethod<!>("")
|
||||
}
|
||||
|
||||
@@ -7,6 +7,6 @@ fun interface ReadOnlyProperty<in T, out V> {
|
||||
}
|
||||
|
||||
class Problem {
|
||||
val variable: Int by <!DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE, INFERRED_TYPE_VARIABLE_INTO_POSSIBLE_EMPTY_INTERSECTION!>delegate()<!> // delegate returns `ReadOnlyProperty<Problem, {CharSequence & Int}>`
|
||||
val variable: Int by <!DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE!><!INFERRED_TYPE_VARIABLE_INTO_POSSIBLE_EMPTY_INTERSECTION!>delegate<!>()<!> // delegate returns `ReadOnlyProperty<Problem, {CharSequence & Int}>`
|
||||
fun <T : CharSequence> delegate() = null <!CAST_NEVER_SUCCEEDS!>as<!> ReadOnlyProperty<Problem, T>
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -4,7 +4,7 @@
|
||||
|
||||
fun box(): String {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>buildList<!> {
|
||||
val foo = { first() }
|
||||
val foo = { <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>first<!>() }
|
||||
add(0, foo)
|
||||
}
|
||||
return "OK"
|
||||
|
||||
compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBoundForbidden.fir.kt
Vendored
+1
-1
@@ -4,7 +4,7 @@
|
||||
|
||||
fun box(): String {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>buildList<!> {
|
||||
val foo = { first() }
|
||||
val foo = { <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>first<!>() }
|
||||
add(0, foo)
|
||||
}
|
||||
return "OK"
|
||||
|
||||
+3
-3
@@ -7,10 +7,10 @@ fun <T : Any> myBuilder(block: Foo<T>.() -> Unit) : Foo<T> = Foo<T>().apply(bloc
|
||||
|
||||
fun main(arg: Any) {
|
||||
val x = 57
|
||||
val value = <!TYPE_MISMATCH, TYPE_MISMATCH!>myBuilder {
|
||||
val value = myBuilder {
|
||||
doSmthng("one ")
|
||||
run { a; this }.a = 10
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>a += 1<!>
|
||||
a <!NONE_APPLICABLE!>+=<!> 1
|
||||
this.a = 57
|
||||
this.<!ILLEGAL_SELECTOR, VARIABLE_EXPECTED!>(a)<!> = 57
|
||||
a = x
|
||||
@@ -19,6 +19,6 @@ fun main(arg: Any) {
|
||||
if (arg is String) {
|
||||
a = arg
|
||||
}
|
||||
}<!>
|
||||
}
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(value.a?.<!UNRESOLVED_REFERENCE!>count<!> { <!UNRESOLVED_REFERENCE!>it<!> in 'l' .. 'q' })
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -62,8 +62,8 @@ fun main(arg: Any, condition: Boolean) {
|
||||
// See KT-54664
|
||||
val value3 = myBuilder {
|
||||
accept("")
|
||||
a = 45
|
||||
bar(<!ARGUMENT_TYPE_MISMATCH, ARGUMENT_TYPE_MISMATCH!>::a<!>)
|
||||
a = <!ASSIGNMENT_TYPE_MISMATCH!>45<!>
|
||||
bar(::<!INAPPLICABLE_CANDIDATE!>a<!>)
|
||||
}
|
||||
|
||||
fun baz(t: Int) {}
|
||||
|
||||
Vendored
+27
-27
@@ -28,84 +28,84 @@ FILE: unsafeAssignmentExtra.fir.kt
|
||||
}
|
||||
public final fun main(arg: R|kotlin/Any|, condition: R|kotlin/Boolean|): R|kotlin/Unit| {
|
||||
lval value: R|Foo<kotlin/Int>| = R|/myBuilder|<R|kotlin/Int|>(<L> = myBuilder@fun R|Foo<kotlin/Int>|.<anonymous>(): R|kotlin/Unit| <inline=NoInline> {
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.b: R|kotlin/Array<Stub (chain inference): TypeVariable(T)>|>|.R|SubstitutionOverride<kotlin/Array.set: R|kotlin/Unit|>|(Int(0), Int(123))
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.b: R|kotlin/Array<kotlin/Int>|>|.R|SubstitutionOverride<kotlin/Array.set: R|kotlin/Unit|>|(Int(0), Int(123))
|
||||
Unit
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>| = Int(45)
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|kotlin/Int|>| = Int(45)
|
||||
{
|
||||
lval <unary>: R|kotlin/Int| = this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>|
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>| = R|<local>/<unary>|.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#()
|
||||
lval <unary>: R|kotlin/Int| = this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|kotlin/Int|>|
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|kotlin/Int|>| = R|<local>/<unary>|.<Ambiguity: inc, [kotlin/inc, kotlin/inc]>#()
|
||||
R|<local>/<unary>|
|
||||
}
|
||||
|
||||
R|/bar|(::R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>|)
|
||||
R|/bar|(::R|SubstitutionOverride</Foo.a: R|TypeVariable(T)|>|)
|
||||
when () {
|
||||
(this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>| is R|kotlin/Int|) -> {
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>| = Int(67)
|
||||
(this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|kotlin/Int|>| is R|kotlin/Int|) -> {
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|kotlin/Int|>| = Int(67)
|
||||
{
|
||||
lval <unary>: R|kotlin/Int| = this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>|
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>| = R|<local>/<unary>|.<Ambiguity: dec, [kotlin/dec, kotlin/dec]>#()
|
||||
lval <unary>: R|kotlin/Int| = this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|kotlin/Int|>|
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|kotlin/Int|>| = R|<local>/<unary>|.<Ambiguity: dec, [kotlin/dec, kotlin/dec]>#()
|
||||
R|<local>/<unary>|
|
||||
}
|
||||
|
||||
R|/bar|(::R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>|)
|
||||
R|/bar|(::R|SubstitutionOverride</Foo.a: R|TypeVariable(T)|>|)
|
||||
}
|
||||
}
|
||||
|
||||
when (R|<local>/condition|) {
|
||||
==($subj$, Boolean(true)) -> {
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>| = Int(87)
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|kotlin/Int|>| = Int(87)
|
||||
}
|
||||
==($subj$, Boolean(false)) -> {
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>| = Int(65)
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|kotlin/Int|>| = Int(65)
|
||||
}
|
||||
}
|
||||
|
||||
lval x: <ERROR TYPE REF: Ambiguity: getValue, [kotlin/getValue, kotlin/getValue, kotlin/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>by this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>|
|
||||
lval x: <ERROR TYPE REF: Ambiguity: getValue, [kotlin/getValue, kotlin/getValue, kotlin/getValue, kotlin/collections/getValue]>by this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|kotlin/Int|>|
|
||||
this@R|special/anonymous|.R|/change|<R|kotlin/Int|>(<L> = change@fun R|Foo<kotlin/Int>|.<anonymous>(): R|kotlin/Unit| <inline=NoInline> {
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>| = Int(99)
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|kotlin/Int|>| = Int(99)
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
lval value2: R|Foo<kotlin/String>| = R|/myBuilder|<R|kotlin/String|>(<L> = myBuilder@fun R|Foo<kotlin/String>|.<anonymous>(): R|kotlin/Unit| <inline=NoInline> {
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.accept: R|kotlin/Unit|>|(String())
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>| = Int(45)
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|kotlin/String|>| = Int(45)
|
||||
when (R|<local>/condition|) {
|
||||
==($subj$, Boolean(true)) -> {
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>| = Int(87)
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|kotlin/String|>| = Int(87)
|
||||
}
|
||||
==($subj$, Boolean(false)) -> {
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>| = Int(65)
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|kotlin/String|>| = Int(65)
|
||||
}
|
||||
}
|
||||
|
||||
this@R|special/anonymous|.R|/change|<R|kotlin/String|>(<L> = change@fun R|Foo<kotlin/String>|.<anonymous>(): R|kotlin/Unit| <inline=NoInline> {
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>| = Int(99)
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|kotlin/String|>| = Int(99)
|
||||
}
|
||||
)
|
||||
when () {
|
||||
(this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>| is R|kotlin/Int|) -> {
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>| = Int(67)
|
||||
(this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|kotlin/String|>| is R|kotlin/Int|) -> {
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|kotlin/String|>| = Int(67)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
)
|
||||
lval value3: R|Foo<kotlin/Int>| = R|/myBuilder<CS errors: /myBuilder>#|<R|kotlin/Int|>(<L> = myBuilder@fun R|Foo<kotlin/Int>|.<anonymous>(): R|kotlin/Unit| <inline=NoInline> {
|
||||
lval value3: R|Foo<kotlin/String>| = R|/myBuilder|<R|kotlin/String|>(<L> = myBuilder@fun R|Foo<kotlin/String>|.<anonymous>(): R|kotlin/Unit| <inline=NoInline> {
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.accept: R|kotlin/Unit|>|(String())
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>| = Int(45)
|
||||
R|/bar|(::R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>|)
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|kotlin/String|>| = Int(45)
|
||||
R|/bar<Inapplicable(INAPPLICABLE): /bar>#|(::<Inapplicable(INAPPLICABLE): /Foo.a>#)
|
||||
}
|
||||
)
|
||||
local final fun baz(t: R|kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
lval value4: R|Foo<it(kotlin/Comparable<*> & java/io/Serializable)>| = R|/myBuilder<CS errors: /myBuilder>#|<R|it(kotlin/Comparable<*> & java/io/Serializable)|>(<L> = myBuilder@fun R|Foo<it(kotlin/Comparable<*> & java/io/Serializable)>|.<anonymous>(): R|kotlin/Unit| <inline=NoInline> {
|
||||
lval value4: R|Foo<it(kotlin/Comparable<*> & java/io/Serializable)>| = R|/myBuilder|<R|it(kotlin/Comparable<*> & java/io/Serializable)|>(<L> = myBuilder@fun R|Foo<it(kotlin/Comparable<*> & java/io/Serializable)>|.<anonymous>(): R|kotlin/Unit| <inline=NoInline> {
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.accept: R|kotlin/Unit|>|(String())
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>| = Int(45)
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.b: R|kotlin/Array<Stub (chain inference): TypeVariable(T)>|>|.R|SubstitutionOverride<kotlin/Array.set: R|kotlin/Unit|>|(Int(0), Int(123))
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|it(kotlin/Comparable<*> & java/io/Serializable)|>| = Int(45)
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</Foo.b: R|kotlin/Array<it(kotlin/Comparable<*> & java/io/Serializable)>|>|.R|SubstitutionOverride<kotlin/Array.set: R|kotlin/Unit|>|(Int(0), Int(123))
|
||||
Unit
|
||||
R|<local>/baz|(this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>|)
|
||||
R|<local>/baz<Inapplicable(INAPPLICABLE): <local>/baz>#|(this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|it(kotlin/Comparable<*> & java/io/Serializable)|>|)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
Vendored
+3
-1
@@ -1 +1,3 @@
|
||||
/upperBoundViolation.fir.kt:(150,260): error: New inference error [NewConstraintError at Incorporate TypeVariable(E) <: kotlin/Number from Incorporated builder inference constraint TypeVariable(T) <: kotlin/Number from DeclaredUpperBound into some call from position Incorporated builder inference constraint TypeVariable(T) <: kotlin/Number from DeclaredUpperBound into some call: kotlin/String <!: kotlin/Number].
|
||||
/upperBoundViolation.fir.kt:(227,245): error: Not enough information to infer type argument for 'T'.
|
||||
|
||||
/upperBoundViolation.fir.kt:(246,253): error: Argument type mismatch: actual type is 'kotlin.String', but 'kotlin.Number' was expected.
|
||||
|
||||
+3
-3
@@ -4,8 +4,8 @@
|
||||
fun <T : Number> printGenericNumber(t: T) = println("Number is $t")
|
||||
|
||||
fun main() {
|
||||
<!NEW_INFERENCE_ERROR!>buildList { // inferred into MutableList<String>
|
||||
buildList { // inferred into MutableList<String>
|
||||
add("Boom")
|
||||
printGenericNumber(this[0])
|
||||
}<!>
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>printGenericNumber<!>(<!ARGUMENT_TYPE_MISMATCH!>this[0]<!>)
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ FILE: upperBoundViolation.fir.kt
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
R|kotlin/collections/buildList<CS errors: kotlin/collections/buildList>#|<R|kotlin/String|>(<L> = buildList@fun R|kotlin/collections/MutableList<kotlin/String>|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=EXACTLY_ONCE> {
|
||||
this@R|special/anonymous|.R|SubstitutionOverride<kotlin/collections/MutableList.add: R|kotlin/Boolean|>|(String(Boom))
|
||||
R|/printGenericNumber|<R|kotlin/String|>(this@R|special/anonymous|.R|SubstitutionOverride<kotlin/collections/MutableList.get: R|Stub (chain inference): TypeVariable(E)|>|(Int(0)))
|
||||
R|/printGenericNumber<Inapplicable(INAPPLICABLE): /printGenericNumber>#|<<ERROR TYPE REF: Cannot infer argument for type parameter T>>(this@R|special/anonymous|.R|SubstitutionOverride<kotlin/collections/MutableList.get: R|kotlin/String|>|(Int(0)))
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ val test6 = generate {
|
||||
|
||||
val test7 = <!NEW_INFERENCE_ERROR!>generate {
|
||||
yield("baz")
|
||||
genericExtension<Int>()
|
||||
<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>genericExtension<!><Int>()
|
||||
}<!>
|
||||
|
||||
val test8 = generate {
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ fun test_1() {
|
||||
}
|
||||
|
||||
fun test_2() {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>sequence<!> {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>sequence<!> {
|
||||
yield(<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>materialize<!>())
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+3
-3
@@ -22,9 +22,9 @@ FILE: stubCallOnVariable.kt
|
||||
^ R|<local>/it|.R|kotlin/text/toInt|()
|
||||
}
|
||||
)
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</TypeDefinition.serialize: R|kotlin/Unit|>|(<L> = serialize@fun <anonymous>(it: R|kotlin/Int|): R|kotlin/Any?| <inline=NoInline> {
|
||||
lval i: R|kotlin/Int| = R|<local>/it|
|
||||
^ (R|<local>/i| as R|kotlin/Any|).R|kotlin/Any.toString|()
|
||||
this@R|special/anonymous|.R|SubstitutionOverride</TypeDefinition.serialize: R|kotlin/Unit|>|(<L> = serialize@fun <anonymous>(it: <ERROR TYPE REF: Cannot infer type for parameter it>): R|kotlin/Any?| <inline=NoInline> {
|
||||
lval i: <ERROR TYPE REF: Cannot infer type for parameter it> = R|<local>/it|
|
||||
^ R|<local>/i|.R|kotlin/toString|()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
+1
-1
@@ -7,6 +7,6 @@ class Controller<T : Number> {
|
||||
|
||||
fun <S : Number> generate(g: suspend Controller<S>.() -> Unit): S = TODO()
|
||||
|
||||
val test = generate {
|
||||
val test = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>generate<!> {
|
||||
yield(<!ARGUMENT_TYPE_MISMATCH!>"foo"<!>)
|
||||
}
|
||||
|
||||
+6
-6
@@ -12,10 +12,10 @@
|
||||
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1() {
|
||||
0<!WRONG_LONG_SUFFIX!>l<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { check<Long>() }
|
||||
10000000000000<!WRONG_LONG_SUFFIX!>l<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { check<Long>() }
|
||||
0X000Af10cD<!WRONG_LONG_SUFFIX!>l<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { check<Long>() }
|
||||
0x0_0<!WRONG_LONG_SUFFIX!>l<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { check<Long>() }
|
||||
0b100_000_111_111<!WRONG_LONG_SUFFIX!>l<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { check<Long>() }
|
||||
0b0<!WRONG_LONG_SUFFIX!>l<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { check<Long>() }
|
||||
0<!WRONG_LONG_SUFFIX!>l<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { <!INAPPLICABLE_CANDIDATE!>check<!><<!CANNOT_INFER_PARAMETER_TYPE!>Long<!>>() }
|
||||
10000000000000<!WRONG_LONG_SUFFIX!>l<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { <!INAPPLICABLE_CANDIDATE!>check<!><<!CANNOT_INFER_PARAMETER_TYPE!>Long<!>>() }
|
||||
0X000Af10cD<!WRONG_LONG_SUFFIX!>l<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { <!INAPPLICABLE_CANDIDATE!>check<!><<!CANNOT_INFER_PARAMETER_TYPE!>Long<!>>() }
|
||||
0x0_0<!WRONG_LONG_SUFFIX!>l<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { <!INAPPLICABLE_CANDIDATE!>check<!><<!CANNOT_INFER_PARAMETER_TYPE!>Long<!>>() }
|
||||
0b100_000_111_111<!WRONG_LONG_SUFFIX!>l<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { <!INAPPLICABLE_CANDIDATE!>check<!><<!CANNOT_INFER_PARAMETER_TYPE!>Long<!>>() }
|
||||
0b0<!WRONG_LONG_SUFFIX!>l<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { <!INAPPLICABLE_CANDIDATE!>check<!><<!CANNOT_INFER_PARAMETER_TYPE!>Long<!>>() }
|
||||
}
|
||||
|
||||
+4
-4
@@ -115,8 +115,8 @@ fun case_6() {
|
||||
checkSubtype<Short>(<!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000<!>)
|
||||
checkSubtype<Int>(<!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000<!>)
|
||||
checkSubtype<Long>(<!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000<!>)
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { check<Byte>() }
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { check<Short>() }
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { check<Int>() }
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { check<Long>() }
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { <!INAPPLICABLE_CANDIDATE!>check<!><<!CANNOT_INFER_PARAMETER_TYPE!>Byte<!>>() }
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { <!INAPPLICABLE_CANDIDATE!>check<!><<!CANNOT_INFER_PARAMETER_TYPE!>Short<!>>() }
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { <!INAPPLICABLE_CANDIDATE!>check<!><<!CANNOT_INFER_PARAMETER_TYPE!>Int<!>>() }
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { <!INAPPLICABLE_CANDIDATE!>check<!><<!CANNOT_INFER_PARAMETER_TYPE!>Long<!>>() }
|
||||
}
|
||||
|
||||
+6
-6
@@ -13,23 +13,23 @@
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1() {
|
||||
checkSubtype<Long>(<!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>9223372036854775808L<!>)
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>9223372036854775808L<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { check<Long>() }
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>9223372036854775808L<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { <!INAPPLICABLE_CANDIDATE!>check<!><<!CANNOT_INFER_PARAMETER_TYPE!>Long<!>>() }
|
||||
|
||||
checkSubtype<Long>(<!INT_LITERAL_OUT_OF_RANGE!>9223372036854775808L<!>)
|
||||
<!INT_LITERAL_OUT_OF_RANGE!>9223372036854775808L<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { check<Long>() }
|
||||
<!INT_LITERAL_OUT_OF_RANGE!>9223372036854775808L<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { <!INAPPLICABLE_CANDIDATE!>check<!><<!CANNOT_INFER_PARAMETER_TYPE!>Long<!>>() }
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2() {
|
||||
checkSubtype<Long>(<!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000L<!>)
|
||||
<!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000L<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { check<Long>() }
|
||||
<!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000L<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { <!INAPPLICABLE_CANDIDATE!>check<!><<!CANNOT_INFER_PARAMETER_TYPE!>Long<!>>() }
|
||||
|
||||
checkSubtype<Long>(<!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000l<!>)
|
||||
<!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000l<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { check<Long>() }
|
||||
<!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000l<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { <!INAPPLICABLE_CANDIDATE!>check<!><<!CANNOT_INFER_PARAMETER_TYPE!>Long<!>>() }
|
||||
|
||||
checkSubtype<Long>(<!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000L<!>)
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000L<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { check<Long>() }
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000L<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { <!INAPPLICABLE_CANDIDATE!>check<!><<!CANNOT_INFER_PARAMETER_TYPE!>Long<!>>() }
|
||||
|
||||
checkSubtype<Long>(<!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000l<!>)
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000l<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { check<Long>() }
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000l<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { <!INAPPLICABLE_CANDIDATE!>check<!><<!CANNOT_INFER_PARAMETER_TYPE!>Long<!>>() }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user