Add test for stub type receiver and for KT-53639
This commit is contained in:
committed by
teamcity
parent
5cbecd276c
commit
f6ad6fb816
+21
@@ -0,0 +1,21 @@
|
||||
// WITH_STDLIB
|
||||
// FIR_DUMP
|
||||
// SKIP_TXT
|
||||
|
||||
fun Any?.test() {}
|
||||
|
||||
class Bar {
|
||||
fun test() {}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
|
||||
buildList {
|
||||
add(Bar())
|
||||
this.get(0).test() // resolved to Any?.test
|
||||
}
|
||||
buildList<Bar> {
|
||||
add(Bar())
|
||||
this.get(0).test() // resolved to Bar.test
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
FILE: errorOnStubReceiver.fir.kt
|
||||
public final fun R|kotlin/Any?|.test(): R|kotlin/Unit| {
|
||||
}
|
||||
public final class Bar : R|kotlin/Any| {
|
||||
public constructor(): R|Bar| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
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|()
|
||||
}
|
||||
)
|
||||
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|Bar|>|(Int(0)).R|/Bar.test|()
|
||||
}
|
||||
)
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// WITH_STDLIB
|
||||
// FIR_DUMP
|
||||
// SKIP_TXT
|
||||
|
||||
fun Any?.test() {}
|
||||
|
||||
class Bar {
|
||||
fun test() {}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
|
||||
buildList {
|
||||
add(Bar())
|
||||
this.get(0).test() // resolved to Any?.test
|
||||
}
|
||||
buildList<Bar> {
|
||||
add(Bar())
|
||||
this.get(0).test() // resolved to Bar.test
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// WITH_STDLIB
|
||||
// SKIP_TXT
|
||||
fun <From, To> InputWrapper<From>.doMapping(
|
||||
foo: (From) -> List<To>,
|
||||
bar: (List<To>) -> Boolean = { it.isNotEmpty() },
|
||||
) = InputWrapper(value = foo(value))
|
||||
|
||||
data class InputWrapper<TItem>(val value: TItem)
|
||||
|
||||
data class Output(val source: InputWrapper<List<String>>)
|
||||
|
||||
fun main2(input: InputWrapper<Unit>): Output {
|
||||
val output = input.doMapping(
|
||||
foo = { buildList { add("this is List<String>") } },
|
||||
bar = { it.isNotEmpty() },
|
||||
)
|
||||
|
||||
return Output(source = output)
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
// WITH_STDLIB
|
||||
// SKIP_TXT
|
||||
fun <From, To> InputWrapper<From>.doMapping(
|
||||
foo: (From) -> List<To>,
|
||||
bar: (List<To>) -> Boolean = { it.isNotEmpty() },
|
||||
) = InputWrapper(value = foo(value))
|
||||
|
||||
data class InputWrapper<TItem>(val value: TItem)
|
||||
|
||||
data class Output(val source: InputWrapper<List<String>>)
|
||||
|
||||
fun main2(input: InputWrapper<Unit>): Output {
|
||||
val output = input.<!INFERRED_INTO_DECLARED_UPPER_BOUNDS!>doMapping<!>(
|
||||
foo = { buildList { add("this is List<String>") } },
|
||||
bar = { it.isNotEmpty() },
|
||||
)
|
||||
|
||||
return Output(source = <!TYPE_MISMATCH!>output<!>)
|
||||
}
|
||||
Reference in New Issue
Block a user