From 808355d817e072f102dc3a30c5719db8c2c04ad0 Mon Sep 17 00:00:00 2001 From: Denis Zharkov Date: Thu, 7 May 2020 10:10:33 +0300 Subject: [PATCH] FIR: Fix test data for secondary constructor delegation calls They appeared, after the changes in previous commits at org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirExpressionsResolveTransformer#transformDelegatedConstructorCall The idea is that dispatch receiver is available there in old FE, but additional diagnostic should be reported on it (see KT-38813) This change was not made intentionaly but it was the easiest way to support new tower data elements structure and on the other side it's the correct behavior as for old FE. Also, if we once would prefer the previous behavior it's still not very hard to support it --- .../tests/scopes/classHeader/constructors.fir.kt | 4 ++-- ...superConstructorArgumentsInSecondaryConstructor.fir.kt | 4 ++-- .../accessBaseGenericFromInnerExtendingSameBase.fir.kt | 2 +- .../accessBaseGenericFromInnerExtendingSameBase2.fir.kt | 2 +- .../headerCallChecker/accessBaseWithSameExtension.fir.kt | 2 +- .../accessGenericBaseWithSameExtension.fir.kt | 4 ++-- .../headerCallChecker/innerInstanceCreation.fir.kt | 2 +- .../headerCallChecker/lambdaAsArgument.fir.kt | 8 ++++---- .../headerCallChecker/memberFunAccess.fir.kt | 2 +- .../headerCallChecker/objectLiteralAsArgument.fir.kt | 4 ++-- .../headerCallChecker/operatorCall.fir.kt | 4 ++-- .../headerCallChecker/propertyAccess.fir.kt | 2 +- .../headerCallChecker/propertyAccessUnitialized.fir.kt | 2 +- .../headerCallChecker/superFunAccess.fir.kt | 2 +- .../headerCallChecker/superFunAccessOverriden.fir.kt | 2 +- .../headerCallChecker/superPropertyAccess.fir.kt | 2 +- .../headerCallChecker/thisAsExtensionReceiver.fir.kt | 6 +++--- 17 files changed, 27 insertions(+), 27 deletions(-) diff --git a/compiler/testData/diagnostics/tests/scopes/classHeader/constructors.fir.kt b/compiler/testData/diagnostics/tests/scopes/classHeader/constructors.fir.kt index b0b1ba41a3b..886c5b062cf 100644 --- a/compiler/testData/diagnostics/tests/scopes/classHeader/constructors.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/classHeader/constructors.fir.kt @@ -37,8 +37,8 @@ class A( Companion.CONST, Nested.CONST, Interface.CONST, - a, - b() + a, + b() ) class Nested { diff --git a/compiler/testData/diagnostics/tests/scopes/classHeader/superConstructorArgumentsInSecondaryConstructor.fir.kt b/compiler/testData/diagnostics/tests/scopes/classHeader/superConstructorArgumentsInSecondaryConstructor.fir.kt index 065b7f95d9c..a80d7a560de 100644 --- a/compiler/testData/diagnostics/tests/scopes/classHeader/superConstructorArgumentsInSecondaryConstructor.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/classHeader/superConstructorArgumentsInSecondaryConstructor.fir.kt @@ -22,8 +22,8 @@ class A : S { Companion.CONST, Nested.CONST, Interface.CONST, - a, - b() + a, + b() ) class Nested { diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/accessBaseGenericFromInnerExtendingSameBase.fir.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/accessBaseGenericFromInnerExtendingSameBase.fir.kt index d3a39f171e3..84fbd66adf9 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/accessBaseGenericFromInnerExtendingSameBase.fir.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/accessBaseGenericFromInnerExtendingSameBase.fir.kt @@ -6,7 +6,7 @@ open class Base(p: Any?) { class D: Base("") { inner class B : Base { - constructor() : super(foo1("")) + constructor() : super(foo1("")) constructor(x: Int) : super(foo1(1)) } } diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/accessBaseGenericFromInnerExtendingSameBase2.fir.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/accessBaseGenericFromInnerExtendingSameBase2.fir.kt index c4abe4fc710..4e0acde4f71 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/accessBaseGenericFromInnerExtendingSameBase2.fir.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/accessBaseGenericFromInnerExtendingSameBase2.fir.kt @@ -7,7 +7,7 @@ open class Base(p: Any?) { class D: Base(1) { inner class B : Base { constructor() : super(foo1(1)) - constructor(x: Int) : super(this@B.foo1(1)) + constructor(x: Int) : super(this@B.foo1(1)) constructor(x: Int, y: Int) : super(this@D.foo1(1)) } } diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/accessBaseWithSameExtension.fir.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/accessBaseWithSameExtension.fir.kt index ee862c5320e..c5340674800 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/accessBaseWithSameExtension.fir.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/accessBaseWithSameExtension.fir.kt @@ -7,6 +7,6 @@ fun Base.foo() { class B : Base { constructor() : super(foo1()) constructor(x: Int) : super(this@foo.foo1()) - constructor(x: Int, y: Int) : super(this@B.foo1()) + constructor(x: Int, y: Int) : super(this@B.foo1()) } } diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/accessGenericBaseWithSameExtension.fir.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/accessGenericBaseWithSameExtension.fir.kt index ac7c5402a2d..a45e891e7e1 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/accessGenericBaseWithSameExtension.fir.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/accessGenericBaseWithSameExtension.fir.kt @@ -5,9 +5,9 @@ open class Base(p: Any?) { fun Base.foo() { class B : Base { - constructor() : super(foo1("")) + constructor() : super(foo1("")) constructor(x: Int) : super(foo1(1)) constructor(x: Int, y: Int) : super(this@foo.foo1(12)) - constructor(x: Int, y: Int, z: Int) : super(this@B.foo1("")) + constructor(x: Int, y: Int, z: Int) : super(this@B.foo1("")) } } diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/innerInstanceCreation.fir.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/innerInstanceCreation.fir.kt index 8752e827de7..76c24c1b31d 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/innerInstanceCreation.fir.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/innerInstanceCreation.fir.kt @@ -7,5 +7,5 @@ class Outer { constructor(x: Int) constructor(x: Int, y: Int, z: Int = x + Inner().prop + this.Inner().prop) : - this(x + Inner().prop + this.Inner().prop) + this(x + Inner().prop + this.Inner().prop) } diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/lambdaAsArgument.fir.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/lambdaAsArgument.fir.kt index 5d7ae9d4aff..1a01acc6fb0 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/lambdaAsArgument.fir.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/lambdaAsArgument.fir.kt @@ -7,9 +7,9 @@ class A { constructor(x: () -> Int) constructor() : this( { - foo() + - this.foo() + - this@A.foo() + - foobar() + foo() + + this.foo() + + this@A.foo() + + foobar() }) } diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/memberFunAccess.fir.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/memberFunAccess.fir.kt index 9768c7fc02b..f67d2a5ec49 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/memberFunAccess.fir.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/memberFunAccess.fir.kt @@ -3,5 +3,5 @@ class A { fun foo() = 1 constructor(x: Int) constructor(x: Int, y: Int, z: Int = x + foo() + this.foo()) : - this(x + foo() + this.foo()) + this(x + foo() + this.foo()) } diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/objectLiteralAsArgument.fir.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/objectLiteralAsArgument.fir.kt index 594f816ce77..dd0522dc156 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/objectLiteralAsArgument.fir.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/objectLiteralAsArgument.fir.kt @@ -6,7 +6,7 @@ class A { fun foo() = 1 constructor(x: Any?) constructor() : this(object { - fun bar() = foo() + this@A.foo() + - foobar() + super@A.hashCode() + fun bar() = foo() + this@A.foo() + + foobar() + super@A.hashCode() }) } diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/operatorCall.fir.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/operatorCall.fir.kt index 6f999a9d56c..adc3dd248dc 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/operatorCall.fir.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/operatorCall.fir.kt @@ -4,8 +4,8 @@ class D : C { constructor() : super( { val s = "" - s() - ""() + s() + ""() 42 }()) diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/propertyAccess.fir.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/propertyAccess.fir.kt index 0a85c195b37..73c5b28e651 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/propertyAccess.fir.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/propertyAccess.fir.kt @@ -3,5 +3,5 @@ class A { val prop = 1 constructor(x: Int) constructor(x: Int, y: Int, z: Int = x + prop + this.prop) : - this(x + prop + this.prop) + this(x + prop + this.prop) } diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/propertyAccessUnitialized.fir.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/propertyAccessUnitialized.fir.kt index 54ad148dc47..e85a92ea072 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/propertyAccessUnitialized.fir.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/propertyAccessUnitialized.fir.kt @@ -3,5 +3,5 @@ open class B(x: Int) class A : B { val prop = 1 constructor(x: Int, y: Int = x + prop + this.prop) : - super(x + prop + this.prop) + super(x + prop + this.prop) } diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/superFunAccess.fir.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/superFunAccess.fir.kt index 9b66f0d54a6..af51338bb5b 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/superFunAccess.fir.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/superFunAccess.fir.kt @@ -4,5 +4,5 @@ open class B(x: Int) { } class A : B { constructor(x: Int, y: Int = x + foo() + this.foo() + super.foo()) : - super(x + foo() + this.foo() + super.foo()) + super(x + foo() + this.foo() + super.foo()) } diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/superFunAccessOverriden.fir.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/superFunAccessOverriden.fir.kt index adb40bd6f57..91357903eec 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/superFunAccessOverriden.fir.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/superFunAccessOverriden.fir.kt @@ -5,5 +5,5 @@ open class B(x: Int) { class A : B { override fun foo() = 2 constructor(x: Int, y: Int = x + foo() + this.foo() + super.foo()) : - super(x + foo() + this.foo() + super.foo()) + super(x + foo() + this.foo() + super.foo()) } diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/superPropertyAccess.fir.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/superPropertyAccess.fir.kt index 4d07dbcfcd7..26f4a1a157c 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/superPropertyAccess.fir.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/superPropertyAccess.fir.kt @@ -2,5 +2,5 @@ open class B(val prop: Int) class A : B { constructor(x: Int, y: Int = x + prop + this.prop + super.prop) : - super(x + prop + this.prop + super.prop) + super(x + prop + this.prop + super.prop) } diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/thisAsExtensionReceiver.fir.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/thisAsExtensionReceiver.fir.kt index 4b99f10c2bc..67d31be0d8a 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/thisAsExtensionReceiver.fir.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/headerCallChecker/thisAsExtensionReceiver.fir.kt @@ -5,10 +5,10 @@ val A.prop: Int get() = 2 class A { constructor(x: Int) - constructor() : this( - foobar() + + constructor() : this( + foobar() + this.foobar() + - prop + + prop + this.prop + this@A.prop )