[FIR] Test for KT-37431
This commit is contained in:
+40
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* UNEXPECTED BEHAVIOUR
|
||||
* ISSUES: KT-37431
|
||||
*/
|
||||
|
||||
class Case1() {
|
||||
|
||||
fun foo() {
|
||||
val x = sequence<String> {
|
||||
|
||||
val y = this
|
||||
//this is Case1 instead of SequenceScope<String>
|
||||
<!UNRESOLVED_REFERENCE!>yield<!>("") // UNRESOLVED_REFERENCE
|
||||
|
||||
this.<!UNRESOLVED_REFERENCE!>yield<!>("") //UNRESOLVED_REFERENCE
|
||||
|
||||
this as SequenceScope<String>
|
||||
|
||||
yield("") // resolved to SequenceScope.yield
|
||||
|
||||
this.yield("") // resolved to SequenceScope.yield
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun case2() {
|
||||
val x = sequence<String> {
|
||||
|
||||
val y = this
|
||||
<!UNRESOLVED_REFERENCE!>yield<!>("") // UNRESOLVED_REFERENCE
|
||||
|
||||
this.<!UNRESOLVED_REFERENCE!>yield<!>("") //UNRESOLVED_REFERENCE
|
||||
|
||||
this as SequenceScope<String>
|
||||
|
||||
<!UNRESOLVED_REFERENCE!>yield<!>("") // UNRESOLVED_REFERENCE
|
||||
|
||||
this.<!UNRESOLVED_REFERENCE!>yield<!>("") // UNRESOLVED_REFERENCE
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
FILE: receiverResolutionInLambda.kt
|
||||
public final class Case1 : R|kotlin/Any| {
|
||||
public constructor(): R|Case1| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
lval x: R|kotlin/sequences/Sequence<kotlin/String>| = R|kotlin/sequences/sequence|<R|kotlin/String|>(<L> = sequence@fun <anonymous>(): R|kotlin/Unit| {
|
||||
lval y: R|Case1| = this@R|/Case1|
|
||||
<Unresolved name: yield>#(String())
|
||||
this@R|/Case1|.<Unresolved name: yield>#(String())
|
||||
(this@R|/Case1| as R|kotlin/sequences/SequenceScope<kotlin/String>|)
|
||||
this@R|/Case1|.R|FakeOverride<kotlin/sequences/SequenceScope.yield: R|kotlin/Unit|>|(String())
|
||||
this@R|/Case1|.R|FakeOverride<kotlin/sequences/SequenceScope.yield: R|kotlin/Unit|>|(String())
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
public final fun case2(): R|kotlin/Unit| {
|
||||
lval x: R|kotlin/sequences/Sequence<kotlin/String>| = R|kotlin/sequences/sequence|<R|kotlin/String|>(<L> = sequence@fun <anonymous>(): <ERROR TYPE REF: Unresolved name: yield> {
|
||||
lval y: R|ERROR CLASS: Unresolved this@null| = this#
|
||||
<Unresolved name: yield>#(String())
|
||||
this#.<Unresolved name: yield>#(String())
|
||||
(this# as R|kotlin/sequences/SequenceScope<kotlin/String>|)
|
||||
<Unresolved name: yield>#(String())
|
||||
^ this#.<Unresolved name: yield>#(String())
|
||||
}
|
||||
)
|
||||
}
|
||||
Generated
+5
@@ -743,6 +743,11 @@ public class FirDiagnosticsWithStdlibTestGenerated extends AbstractFirDiagnostic
|
||||
runTest("compiler/fir/resolve/testData/resolveWithStdlib/problems/qualifierPriority.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("receiverResolutionInLambda.kt")
|
||||
public void testReceiverResolutionInLambda() throws Exception {
|
||||
runTest("compiler/fir/resolve/testData/resolveWithStdlib/problems/receiverResolutionInLambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("weakHashMap.kt")
|
||||
public void testWeakHashMap() throws Exception {
|
||||
runTest("compiler/fir/resolve/testData/resolveWithStdlib/problems/weakHashMap.kt");
|
||||
|
||||
Reference in New Issue
Block a user