803abfeba8
* `return` should only be added to the last statement if the return type is not Unit * If there is a `return` without an argument, then the expected return type is Unit and the last expression is not a return argument (unless it's an incomplete call, in which case it is inferred to return Unit; this behavior is questionable, but inherited from K1) * There should be a constraint on return arguments even if the expected type is Unit, otherwise errors will be missed * When the expected type is known, using the call completion results writer is pointless (and probably subtly wrong). ^KT-54742 Fixed
115 lines
4.1 KiB
Plaintext
Vendored
115 lines
4.1 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|<R|kotlin/Any|, R|kotlin/Unit|>(R|<local>/a|, <L> = wa@fun R|kotlin/Any|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=EXACTLY_ONCE> {
|
|
R|kotlin/with|<R|kotlin/Any|, R|kotlin/Unit|>(R|<local>/b|, <L> = wb@fun R|kotlin/Any|.<anonymous>(): R|kotlin/Unit| <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|.R|/A.foo|()
|
|
this@R|special/anonymous|.R|/A.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>#()
|
|
}
|
|
(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|
|
|
}
|