[FIR] builder: add test on class with wrong super call

^KT-56543
^KT-57793
This commit is contained in:
Dmitrii Gridin
2023-04-04 20:42:54 +02:00
committed by Space Team
parent 332cdc514b
commit d0e801054c
10 changed files with 227 additions and 0 deletions
@@ -51,6 +51,12 @@ public class FirOutOfContentRootLazyBodiesCalculatorTestGenerated extends Abstra
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationsOnParenthesizedTypes.kt");
}
@Test
@TestMetadata("classWithWrongSuperCall.kt")
public void testClassWithWrongSuperCall() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/classWithWrongSuperCall.kt");
}
@Test
@TestMetadata("complexTypes.kt")
public void testComplexTypes() throws Exception {
@@ -51,6 +51,12 @@ public class FirSourceLazyBodiesCalculatorTestGenerated extends AbstractFirSourc
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationsOnParenthesizedTypes.kt");
}
@Test
@TestMetadata("classWithWrongSuperCall.kt")
public void testClassWithWrongSuperCall() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/classWithWrongSuperCall.kt");
}
@Test
@TestMetadata("complexTypes.kt")
public void testComplexTypes() throws Exception {
@@ -56,6 +56,11 @@ public class LightTree2FirConverterTestCaseGenerated extends AbstractLightTree2F
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationsOnParenthesizedTypes.kt");
}
@TestMetadata("classWithWrongSuperCall.kt")
public void testClassWithWrongSuperCall() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/classWithWrongSuperCall.kt");
}
@TestMetadata("complexTypes.kt")
public void testComplexTypes() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/complexTypes.kt");
@@ -0,0 +1,51 @@
open class A(init: A.() -> Unit) {
val prop: String = ""
}
object B : A({})
object C : A(
{
fun foo() = B.prop.toString()
}
)
class D : A(
{
fun foo() = B.prop.toString()
}
)
class E() : A(
{
fun foo() = B.prop.toString()
}
)
class F : A(
{
fun foo() = B.prop.toString()
}
) {
constructor()
}
class G : A(
{
fun foo() = B.prop.toString()
}
) {
constructor() : super(
{
fun foo() = C.prop.toString()
}
)
}
class H : A {
constructor() : super(
{
fun foo() = B.prop.toString()
}
)
}
@@ -0,0 +1,52 @@
FILE: classWithWrongSuperCall.kt
public? open class A : R|kotlin/Any| {
public? constructor(init: ( A.() -> Unit )): R|A| {
LAZY_super<R|kotlin/Any|>
}
public? final? val prop: String = LAZY_EXPRESSION
public? get(): String
}
public? final? object B : A {
private constructor(): R|B| {
LAZY_super<A>
}
}
public? final? object C : A {
private constructor(): R|C| {
LAZY_super<A>
}
}
public? final? class D : A {
public? constructor(): R|D| {
LAZY_super<A>
}
}
public? final? class E : A {
public? constructor(): R|E| {
LAZY_super<A>
}
}
public? final? class F : A {
public? constructor(): R|F| {
LAZY_super<A>
}
}
public? final? class G : A {
public? constructor(): R|G| {
LAZY_super<A>
}
}
public? final? class H : A {
public? constructor(): R|H| {
LAZY_super<<implicit>>
}
}
@@ -0,0 +1,85 @@
FILE: classWithWrongSuperCall.kt
public? open class A : R|kotlin/Any| {
public? [ContainingClassKey=A] constructor(init: ( A.() -> Unit )): R|A| {
super<R|kotlin/Any|>()
}
public? final? val prop: String = String()
public? [ContainingClassKey=A] get(): String
}
public? final? object B : A {
private [ContainingClassKey=B] constructor(): R|B| {
super<A>(fun <implicit>.<anonymous>(): <implicit> <inline=Unknown> {
^ Unit
}
)
}
}
public? final? object C : A {
private [ContainingClassKey=C] constructor(): R|C| {
super<A>(fun <implicit>.<anonymous>(): <implicit> <inline=Unknown> {
local final? fun foo(): <implicit> {
^foo B#.prop#.toString#()
}
}
)
}
}
public? final? class D : A {
public? [ContainingClassKey=D] constructor(): R|D| {
super<A>(fun <implicit>.<anonymous>(): <implicit> <inline=Unknown> {
local final? fun foo(): <implicit> {
^foo B#.prop#.toString#()
}
}
)
}
}
public? final? class E : A {
public? [ContainingClassKey=E] constructor(): R|E| {
super<A>(fun <implicit>.<anonymous>(): <implicit> <inline=Unknown> {
local final? fun foo(): <implicit> {
^foo B#.prop#.toString#()
}
}
)
}
}
public? final? class F : A {
public? [ContainingClassKey=F] constructor(): R|F| {
super<A>()
}
}
public? final? class G : A {
public? [ContainingClassKey=G] constructor(): R|G| {
super<A>(fun <implicit>.<anonymous>(): <implicit> <inline=Unknown> {
local final? fun foo(): <implicit> {
^foo C#.prop#.toString#()
}
}
)
}
}
public? final? class H : A {
public? [ContainingClassKey=H] constructor(): R|H| {
super<<implicit>>(fun <implicit>.<anonymous>(): <implicit> <inline=Unknown> {
local final? fun foo(): <implicit> {
^foo B#.prop#.toString#()
}
}
)
}
}
@@ -56,6 +56,11 @@ public class RawFirBuilderLazyBodiesTestCaseGenerated extends AbstractRawFirBuil
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationsOnParenthesizedTypes.kt");
}
@TestMetadata("classWithWrongSuperCall.kt")
public void testClassWithWrongSuperCall() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/classWithWrongSuperCall.kt");
}
@TestMetadata("complexTypes.kt")
public void testComplexTypes() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/complexTypes.kt");
@@ -56,6 +56,11 @@ public class RawFirBuilderTestCaseGenerated extends AbstractRawFirBuilderTestCas
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationsOnParenthesizedTypes.kt");
}
@TestMetadata("classWithWrongSuperCall.kt")
public void testClassWithWrongSuperCall() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/classWithWrongSuperCall.kt");
}
@TestMetadata("complexTypes.kt")
public void testComplexTypes() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/complexTypes.kt");
@@ -51,6 +51,12 @@ public class FirVisualizerForRawFirDataGenerated extends AbstractFirVisualizerTe
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationsOnParenthesizedTypes.kt");
}
@Test
@TestMetadata("classWithWrongSuperCall.kt")
public void testClassWithWrongSuperCall() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/classWithWrongSuperCall.kt");
}
@Test
@TestMetadata("complexTypes.kt")
public void testComplexTypes() throws Exception {
@@ -51,6 +51,12 @@ public class PsiVisualizerForRawFirDataGenerated extends AbstractPsiVisualizerTe
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationsOnParenthesizedTypes.kt");
}
@Test
@TestMetadata("classWithWrongSuperCall.kt")
public void testClassWithWrongSuperCall() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/classWithWrongSuperCall.kt");
}
@Test
@TestMetadata("complexTypes.kt")
public void testComplexTypes() throws Exception {