K1/K2: add various tests for context receiver tower resolve priority
Related to KT-64531, KT-64488 #KT-64531 As Designed
This commit is contained in:
committed by
Space Team
parent
e88865e4c7
commit
6ed7c041b4
+6
@@ -13741,6 +13741,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
|||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/plusMatrix.kt");
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/plusMatrix.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("priorityInTower.kt")
|
||||||
|
public void testPriorityInTower() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/priorityInTower.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("subtypingBetweenContextReceivers.kt")
|
@TestMetadata("subtypingBetweenContextReceivers.kt")
|
||||||
public void testSubtypingBetweenContextReceivers() throws Exception {
|
public void testSubtypingBetweenContextReceivers() throws Exception {
|
||||||
|
|||||||
+6
@@ -13741,6 +13741,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
|||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/plusMatrix.kt");
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/plusMatrix.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("priorityInTower.kt")
|
||||||
|
public void testPriorityInTower() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/priorityInTower.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("subtypingBetweenContextReceivers.kt")
|
@TestMetadata("subtypingBetweenContextReceivers.kt")
|
||||||
public void testSubtypingBetweenContextReceivers() throws Exception {
|
public void testSubtypingBetweenContextReceivers() throws Exception {
|
||||||
|
|||||||
+6
@@ -13735,6 +13735,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
|||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/plusMatrix.kt");
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/plusMatrix.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("priorityInTower.kt")
|
||||||
|
public void testPriorityInTower() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/priorityInTower.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("subtypingBetweenContextReceivers.kt")
|
@TestMetadata("subtypingBetweenContextReceivers.kt")
|
||||||
public void testSubtypingBetweenContextReceivers() throws Exception {
|
public void testSubtypingBetweenContextReceivers() throws Exception {
|
||||||
|
|||||||
+6
@@ -13741,6 +13741,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
|||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/plusMatrix.kt");
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/plusMatrix.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("priorityInTower.kt")
|
||||||
|
public void testPriorityInTower() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/priorityInTower.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("subtypingBetweenContextReceivers.kt")
|
@TestMetadata("subtypingBetweenContextReceivers.kt")
|
||||||
public void testSubtypingBetweenContextReceivers() throws Exception {
|
public void testSubtypingBetweenContextReceivers() throws Exception {
|
||||||
|
|||||||
+47
@@ -0,0 +1,47 @@
|
|||||||
|
// !LANGUAGE: +ContextReceivers
|
||||||
|
// ISSUE: KT-64531, KT-64488
|
||||||
|
// FIR_DUMP
|
||||||
|
// WITH_STDLIB
|
||||||
|
|
||||||
|
// FILE: a.kt
|
||||||
|
|
||||||
|
package a
|
||||||
|
|
||||||
|
val y: Int = 0
|
||||||
|
|
||||||
|
// FILE: b.kt
|
||||||
|
|
||||||
|
package b
|
||||||
|
|
||||||
|
val z: Int = 0
|
||||||
|
|
||||||
|
// FILE: c.kt
|
||||||
|
|
||||||
|
package c
|
||||||
|
|
||||||
|
import a.y
|
||||||
|
import b.*
|
||||||
|
import c.Foo.*
|
||||||
|
|
||||||
|
val x: Int = 0
|
||||||
|
|
||||||
|
enum class Foo { A, B, C }
|
||||||
|
|
||||||
|
class Bar(val x: String, val y: String, val z: String, val w: String, val entries: String)
|
||||||
|
|
||||||
|
class Baz(val w: Int)
|
||||||
|
|
||||||
|
context(Bar)
|
||||||
|
fun test1() = x
|
||||||
|
|
||||||
|
context(Bar)
|
||||||
|
fun test2() = y
|
||||||
|
|
||||||
|
context(Bar)
|
||||||
|
fun test3() = z
|
||||||
|
|
||||||
|
context(Bar)
|
||||||
|
fun test4() = <!DEPRECATED_ACCESS_TO_ENTRY_PROPERTY_FROM_ENUM!>entries<!>
|
||||||
|
|
||||||
|
context(Bar)
|
||||||
|
fun Baz.test5() = w
|
||||||
+83
@@ -0,0 +1,83 @@
|
|||||||
|
FILE: a.kt
|
||||||
|
package a
|
||||||
|
|
||||||
|
public final val y: R|kotlin/Int| = Int(0)
|
||||||
|
public get(): R|kotlin/Int|
|
||||||
|
FILE: b.kt
|
||||||
|
package b
|
||||||
|
|
||||||
|
public final val z: R|kotlin/Int| = Int(0)
|
||||||
|
public get(): R|kotlin/Int|
|
||||||
|
FILE: c.kt
|
||||||
|
package c
|
||||||
|
|
||||||
|
public final val x: R|kotlin/Int| = Int(0)
|
||||||
|
public get(): R|kotlin/Int|
|
||||||
|
public final enum class Foo : R|kotlin/Enum<c/Foo>| {
|
||||||
|
private constructor(): R|c/Foo| {
|
||||||
|
super<R|kotlin/Enum<c/Foo>|>()
|
||||||
|
}
|
||||||
|
|
||||||
|
public final static enum entry A: R|c/Foo|
|
||||||
|
public final static enum entry B: R|c/Foo|
|
||||||
|
public final static enum entry C: R|c/Foo|
|
||||||
|
public final static fun values(): R|kotlin/Array<c/Foo>| {
|
||||||
|
}
|
||||||
|
|
||||||
|
public final static fun valueOf(value: R|kotlin/String|): R|c/Foo| {
|
||||||
|
}
|
||||||
|
|
||||||
|
public final static val entries: R|kotlin/enums/EnumEntries<c/Foo>|
|
||||||
|
public get(): R|kotlin/enums/EnumEntries<c/Foo>|
|
||||||
|
|
||||||
|
}
|
||||||
|
public final class Bar : R|kotlin/Any| {
|
||||||
|
public constructor(x: R|kotlin/String|, y: R|kotlin/String|, z: R|kotlin/String|, w: R|kotlin/String|, entries: R|kotlin/String|): R|c/Bar| {
|
||||||
|
super<R|kotlin/Any|>()
|
||||||
|
}
|
||||||
|
|
||||||
|
public final val x: R|kotlin/String| = R|<local>/x|
|
||||||
|
public get(): R|kotlin/String|
|
||||||
|
|
||||||
|
public final val y: R|kotlin/String| = R|<local>/y|
|
||||||
|
public get(): R|kotlin/String|
|
||||||
|
|
||||||
|
public final val z: R|kotlin/String| = R|<local>/z|
|
||||||
|
public get(): R|kotlin/String|
|
||||||
|
|
||||||
|
public final val w: R|kotlin/String| = R|<local>/w|
|
||||||
|
public get(): R|kotlin/String|
|
||||||
|
|
||||||
|
public final val entries: R|kotlin/String| = R|<local>/entries|
|
||||||
|
public get(): R|kotlin/String|
|
||||||
|
|
||||||
|
}
|
||||||
|
public final class Baz : R|kotlin/Any| {
|
||||||
|
public constructor(w: R|kotlin/Int|): R|c/Baz| {
|
||||||
|
super<R|kotlin/Any|>()
|
||||||
|
}
|
||||||
|
|
||||||
|
public final val w: R|kotlin/Int| = R|<local>/w|
|
||||||
|
public get(): R|kotlin/Int|
|
||||||
|
|
||||||
|
}
|
||||||
|
context(R|c/Bar|)
|
||||||
|
public final fun test1(): R|kotlin/Int| {
|
||||||
|
^test1 R|c/x|
|
||||||
|
}
|
||||||
|
context(R|c/Bar|)
|
||||||
|
public final fun test2(): R|kotlin/Int| {
|
||||||
|
^test2 R|a/y|
|
||||||
|
}
|
||||||
|
context(R|c/Bar|)
|
||||||
|
public final fun test3(): R|kotlin/Int| {
|
||||||
|
^test3 R|b/z|
|
||||||
|
}
|
||||||
|
context(R|c/Bar|)
|
||||||
|
public final fun test4(): R|kotlin/String| {
|
||||||
|
^test4 this@R|c/test4|.R|c/Bar.entries|
|
||||||
|
}
|
||||||
|
context(R|c/Bar|)
|
||||||
|
public final fun R|c/Baz|.test5(): R|kotlin/Int| {
|
||||||
|
^test5 this@R|c/test5|.R|c/Baz.w|
|
||||||
|
}
|
||||||
+47
@@ -0,0 +1,47 @@
|
|||||||
|
// !LANGUAGE: +ContextReceivers
|
||||||
|
// ISSUE: KT-64531, KT-64488
|
||||||
|
// FIR_DUMP
|
||||||
|
// WITH_STDLIB
|
||||||
|
|
||||||
|
// FILE: a.kt
|
||||||
|
|
||||||
|
package a
|
||||||
|
|
||||||
|
val y: Int = 0
|
||||||
|
|
||||||
|
// FILE: b.kt
|
||||||
|
|
||||||
|
package b
|
||||||
|
|
||||||
|
val z: Int = 0
|
||||||
|
|
||||||
|
// FILE: c.kt
|
||||||
|
|
||||||
|
package c
|
||||||
|
|
||||||
|
import a.y
|
||||||
|
import b.*
|
||||||
|
import c.Foo.*
|
||||||
|
|
||||||
|
val x: Int = 0
|
||||||
|
|
||||||
|
enum class Foo { A, B, C }
|
||||||
|
|
||||||
|
class Bar(val x: String, val y: String, val z: String, val w: String, val entries: String)
|
||||||
|
|
||||||
|
class Baz(val w: Int)
|
||||||
|
|
||||||
|
context(Bar)
|
||||||
|
fun test1() = x
|
||||||
|
|
||||||
|
context(Bar)
|
||||||
|
fun test2() = y
|
||||||
|
|
||||||
|
context(Bar)
|
||||||
|
fun test3() = z
|
||||||
|
|
||||||
|
context(Bar)
|
||||||
|
fun test4() = entries
|
||||||
|
|
||||||
|
context(Bar)
|
||||||
|
fun Baz.test5() = w
|
||||||
+63
@@ -0,0 +1,63 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
package a {
|
||||||
|
public val y: kotlin.Int = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
package b {
|
||||||
|
public val z: kotlin.Int = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
package c {
|
||||||
|
public val x: kotlin.Int = 0
|
||||||
|
context(c.Bar) public fun test1(): kotlin.String
|
||||||
|
context(c.Bar) public fun test2(): kotlin.String
|
||||||
|
context(c.Bar) public fun test3(): kotlin.String
|
||||||
|
context(c.Bar) public fun test4(): kotlin.String
|
||||||
|
context(c.Bar) public fun c.Baz.test5(): kotlin.Int
|
||||||
|
|
||||||
|
public final class Bar {
|
||||||
|
public constructor Bar(/*0*/ x: kotlin.String, /*1*/ y: kotlin.String, /*2*/ z: kotlin.String, /*3*/ w: kotlin.String, /*4*/ entries: kotlin.String)
|
||||||
|
public final val entries: kotlin.String
|
||||||
|
public final val w: kotlin.String
|
||||||
|
public final val x: kotlin.String
|
||||||
|
public final val y: kotlin.String
|
||||||
|
public final val z: kotlin.String
|
||||||
|
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 class Baz {
|
||||||
|
public constructor Baz(/*0*/ w: kotlin.Int)
|
||||||
|
public final val w: kotlin.Int
|
||||||
|
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 enum class Foo : kotlin.Enum<c.Foo> {
|
||||||
|
enum entry A
|
||||||
|
|
||||||
|
enum entry B
|
||||||
|
|
||||||
|
enum entry C
|
||||||
|
|
||||||
|
private constructor Foo()
|
||||||
|
@kotlin.internal.IntrinsicConstEvaluation public final override /*1*/ /*fake_override*/ val name: kotlin.String
|
||||||
|
public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int
|
||||||
|
protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any
|
||||||
|
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: c.Foo): kotlin.Int
|
||||||
|
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit
|
||||||
|
public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class<c.Foo!>!
|
||||||
|
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
// Static members
|
||||||
|
public final /*synthesized*/ val entries: kotlin.enums.EnumEntries<c.Foo>
|
||||||
|
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): c.Foo
|
||||||
|
public final /*synthesized*/ fun values(): kotlin.Array<c.Foo>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Generated
+6
@@ -13741,6 +13741,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
|||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/plusMatrix.kt");
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/plusMatrix.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("priorityInTower.kt")
|
||||||
|
public void testPriorityInTower() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/priorityInTower.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("subtypingBetweenContextReceivers.kt")
|
@TestMetadata("subtypingBetweenContextReceivers.kt")
|
||||||
public void testSubtypingBetweenContextReceivers() throws Exception {
|
public void testSubtypingBetweenContextReceivers() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user