b4413776ab
This is necessary for inference to work like in K1 because we only add equality constraints from expected types on top-level `when`, not on nested ones. #KT-65882
120 lines
4.5 KiB
Plaintext
Vendored
120 lines
4.5 KiB
Plaintext
Vendored
FILE: implicitReceivers.kt
|
|
public final class A : R|kotlin/Any| {
|
|
public constructor(): R|A| {
|
|
super<R|kotlin/Any|>()
|
|
}
|
|
|
|
public final fun foo(): R|kotlin/Unit| {
|
|
}
|
|
|
|
}
|
|
public final class B : R|kotlin/Any| {
|
|
public constructor(): R|B| {
|
|
super<R|kotlin/Any|>()
|
|
}
|
|
|
|
public final fun bar(): R|kotlin/Unit| {
|
|
}
|
|
|
|
}
|
|
public final fun <T> R|T|.with(block: R|T.() -> kotlin/Unit|): R|kotlin/Unit| {
|
|
}
|
|
public final fun R|kotlin/Any?|.test_1(): R|kotlin/Unit| {
|
|
when () {
|
|
(this@R|/test_1| is R|A|) -> {
|
|
this@R|/test_1|.R|/A.foo|()
|
|
this@R|/test_1|.R|/A.foo|()
|
|
}
|
|
else -> {
|
|
this@R|/test_1|.<Unresolved name: foo>#()
|
|
<Unresolved name: foo>#()
|
|
}
|
|
}
|
|
|
|
this@R|/test_1|.<Unresolved name: foo>#()
|
|
<Unresolved name: foo>#()
|
|
}
|
|
public final fun R|kotlin/Any?|.test_2(): R|kotlin/Unit| {
|
|
when () {
|
|
(this@R|/test_2| !is R|A|) -> {
|
|
this@R|/test_2|.<Unresolved name: foo>#()
|
|
<Unresolved name: foo>#()
|
|
}
|
|
else -> {
|
|
this@R|/test_2|.R|/A.foo|()
|
|
this@R|/test_2|.R|/A.foo|()
|
|
}
|
|
}
|
|
|
|
this@R|/test_2|.<Unresolved name: foo>#()
|
|
<Unresolved name: foo>#()
|
|
}
|
|
public final fun test_3(a: R|kotlin/Any|, b: R|kotlin/Any|, c: R|kotlin/Any|): R|kotlin/Unit| {
|
|
R|kotlin/with<CS errors: kotlin/with>#|<R|kotlin/Any|, <ERROR TYPE REF: Cannot infer argument for type parameter R>>(R|<local>/a|, <L> = wa@fun R|kotlin/Any|.<anonymous>(): <ERROR TYPE REF: Cannot infer argument for type parameter R> <inline=Inline, kind=EXACTLY_ONCE> {
|
|
^ R|kotlin/with<Inapplicable(INAPPLICABLE): kotlin/with>#|<R|kotlin/Any|, <ERROR TYPE REF: Cannot infer argument for type parameter R>>(R|<local>/b|, <L> = wb@fun R|kotlin/Any|.<anonymous>(): <ERROR TYPE REF: Cannot infer argument for type parameter R> <inline=Inline, kind=EXACTLY_ONCE> {
|
|
R|kotlin/with|<R|kotlin/Any|, R|kotlin/Unit|>(R|<local>/c|, <L> = wc@fun R|kotlin/Any|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=EXACTLY_ONCE> {
|
|
(this@R|special/anonymous| as R|A|)
|
|
this@R|special/anonymous|.R|/A.foo|()
|
|
this@R|special/anonymous|.R|/A.foo|()
|
|
}
|
|
)
|
|
this@R|special/anonymous|.<Unresolved name: foo>#()
|
|
^ <Unresolved name: foo>#()
|
|
}
|
|
)
|
|
}
|
|
)
|
|
}
|
|
public final fun R|kotlin/Any?|.test_4(): R|kotlin/Unit| {
|
|
when () {
|
|
(this@R|/test_4| !is R|A|) -> {
|
|
this@R|/test_4|.<Unresolved name: foo>#()
|
|
<Unresolved name: foo>#()
|
|
this@R|/test_4|.<Unresolved name: bar>#()
|
|
<Unresolved name: bar>#()
|
|
}
|
|
else -> {
|
|
when () {
|
|
(this@R|/test_4| !is R|B|) -> {
|
|
this@R|/test_4|.<Unresolved name: bar>#()
|
|
<Unresolved name: bar>#()
|
|
this@R|/test_4|.R|/A.foo|()
|
|
this@R|/test_4|.R|/A.foo|()
|
|
}
|
|
else -> {
|
|
this@R|/test_4|.R|/A.foo|()
|
|
this@R|/test_4|.R|/A.foo|()
|
|
this@R|/test_4|.R|/B.bar|()
|
|
this@R|/test_4|.R|/B.bar|()
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
this@R|/test_4|.<Unresolved name: foo>#()
|
|
<Unresolved name: foo>#()
|
|
this@R|/test_4|.<Unresolved name: bar>#()
|
|
<Unresolved name: bar>#()
|
|
}
|
|
public final fun R|kotlin/Any|.test_5(): R|kotlin/Int| {
|
|
^test_5 when () {
|
|
(this@R|/test_5| is R|kotlin/collections/List<*>|) -> {
|
|
this@R|/test_5|.R|SubstitutionOverride<kotlin/collections/List.size: R|kotlin/Int|>|
|
|
}
|
|
(this@R|/test_5| is R|kotlin/String|) -> {
|
|
this@R|/test_5|.R|kotlin/String.length|
|
|
}
|
|
else -> {
|
|
Int(0)
|
|
}
|
|
}
|
|
|
|
}
|
|
public final fun R|kotlin/Any|.test_6(): R|kotlin/Unit| {
|
|
(this@R|/test_6| as R|kotlin/collections/List<*>|)
|
|
this@R|/test_6|.R|SubstitutionOverride<kotlin/collections/List.size: R|kotlin/Int|>|
|
|
(this@R|/test_6| as R|kotlin/String|)
|
|
this@R|/test_6|.R|kotlin/String.length|
|
|
}
|