[FIR] KT-55503: Fix current behavior

This commit is contained in:
Nikolay Lunyak
2023-01-31 10:49:40 +02:00
committed by Space Team
parent 8b286577c7
commit 906b16b41e
10 changed files with 168 additions and 0 deletions
@@ -35473,6 +35473,18 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
runTest("compiler/testData/diagnostics/testsWithStdLib/kt54410.kt");
}
@Test
@TestMetadata("kt55503.kt")
public void testKt55503() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/kt55503.kt");
}
@Test
@TestMetadata("kt55503_2.kt")
public void testKt55503_2() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/kt55503_2.kt");
}
@Test
@TestMetadata("kt55747.kt")
public void testKt55747() throws Exception {
@@ -35569,6 +35569,18 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
runTest("compiler/testData/diagnostics/testsWithStdLib/kt54410.kt");
}
@Test
@TestMetadata("kt55503.kt")
public void testKt55503() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/kt55503.kt");
}
@Test
@TestMetadata("kt55503_2.kt")
public void testKt55503_2() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/kt55503_2.kt");
}
@Test
@TestMetadata("kt55747.kt")
public void testKt55747() throws Exception {
@@ -35473,6 +35473,18 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
runTest("compiler/testData/diagnostics/testsWithStdLib/kt54410.kt");
}
@Test
@TestMetadata("kt55503.kt")
public void testKt55503() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/kt55503.kt");
}
@Test
@TestMetadata("kt55503_2.kt")
public void testKt55503_2() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/kt55503_2.kt");
}
@Test
@TestMetadata("kt55747.kt")
public void testKt55747() throws Exception {
@@ -0,0 +1,12 @@
fun foo() = withIntList {
withStringSequence {
forEach { line ->
line.rem(1)
line.<!UNRESOLVED_REFERENCE!>length<!>
}
}
}
fun withIntList(x: List<Int>.() -> Unit) {}
fun <T> withStringSequence(action: Sequence<String>.() -> T): T = TODO()
@@ -0,0 +1,12 @@
fun foo() = withIntList {
withStringSequence {
forEach { line ->
line.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>rem<!>(1)
line.length
}
}
}
fun withIntList(x: List<Int>.() -> Unit) {}
fun <T> withStringSequence(action: Sequence<String>.() -> T): T = TODO()
@@ -0,0 +1,5 @@
package
public fun foo(): kotlin.Unit
public fun withIntList(/*0*/ x: kotlin.collections.List<kotlin.Int>.() -> kotlin.Unit): kotlin.Unit
public fun </*0*/ T> withStringSequence(/*0*/ action: kotlin.sequences.Sequence<kotlin.String>.() -> T): T
@@ -0,0 +1,34 @@
FILE: First.kt
package sample.pack
@R|kotlin/Suppress|(names = vararg(String(INVISIBLE_REFERENCE), String(INVISIBLE_MEMBER))) @<ERROR TYPE REF: HIDDEN: kotlin/internal/HidesMembers is invisible>() public final fun R|sample/pack/A|.forEach(): R|kotlin/String| {
^forEach String(::A.forEach)
}
public final class A : R|kotlin/Any| {
public constructor(): R|sample/pack/A| {
super<R|kotlin/Any|>()
}
public final fun R|sample/pack/B|.forEach(): R|kotlin/String| {
^forEach String(A::B.forEach)
}
}
public final class B : R|kotlin/Any| {
public constructor(): R|sample/pack/B| {
super<R|kotlin/Any|>()
}
}
FILE: Second.kt
package sample
public final fun box(): R|kotlin/Unit| {
^box R|kotlin/with|<R|sample/pack/A|, R|kotlin/Unit|>(R|sample/pack/A.A|(), <L> = with@fun R|sample/pack/A|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=EXACTLY_ONCE> {
R|kotlin/with|<R|sample/pack/B|, R|kotlin/Unit|>(R|sample/pack/B.B|(), <L> = with@fun R|sample/pack/B|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=EXACTLY_ONCE> {
this@R|special/anonymous|.R|sample/pack/forEach|()
}
)
}
)
}
@@ -0,0 +1,33 @@
// FIR_IDENTICAL
// WITH_STDLIB
// FIR_DUMP
// FILE: First.kt
package sample.pack
@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
@kotlin.internal.HidesMembers
fun A.forEach() = "::A.forEach"
class A {
fun B.forEach() = "A::B.forEach"
}
class B
// FILE: Second.kt
package sample
import sample.pack.*
fun box() {
return with(A()) {
with(B()) {
// K1 resolves to A::B.check
// K2 - to ::A.check
forEach()
}
}
}
@@ -0,0 +1,24 @@
package
package sample {
public fun box(): kotlin.Unit
package sample.pack {
@kotlin.Suppress(names = {"INVISIBLE_REFERENCE", "INVISIBLE_MEMBER"}) @kotlin.internal.HidesMembers public fun sample.pack.A.forEach(): kotlin.String
public final class A {
public constructor A()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public final fun sample.pack.B.forEach(): kotlin.String
}
public final class B {
public constructor B()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
}
@@ -35569,6 +35569,18 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/testsWithStdLib/kt54410.kt");
}
@Test
@TestMetadata("kt55503.kt")
public void testKt55503() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/kt55503.kt");
}
@Test
@TestMetadata("kt55503_2.kt")
public void testKt55503_2() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/kt55503_2.kt");
}
@Test
@TestMetadata("kt55747.kt")
public void testKt55747() throws Exception {