[FIR] Fix unexpected primary constructor scope in secondary constructor
^KTIJ-23720 ^KT-56353 Fixed
This commit is contained in:
committed by
Space Team
parent
c25a5bc9c1
commit
7db32f6430
+6
@@ -1663,6 +1663,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/notASupertype.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("primaryConstructorParametersInSecondaryConstructor.kt")
|
||||
public void testPrimaryConstructorParametersInSecondaryConstructor() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/primaryConstructorParametersInSecondaryConstructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("primaryConstructorRequiredForDataClass.kt")
|
||||
public void testPrimaryConstructorRequiredForDataClass() throws Exception {
|
||||
|
||||
+5
@@ -1449,6 +1449,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/notASupertype.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("primaryConstructorParametersInSecondaryConstructor.kt")
|
||||
public void testPrimaryConstructorParametersInSecondaryConstructor() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/primaryConstructorParametersInSecondaryConstructor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("primaryConstructorRequiredForDataClass.kt")
|
||||
public void testPrimaryConstructorRequiredForDataClass() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/primaryConstructorRequiredForDataClass.kt");
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
FILE: primaryConstructorParametersInSecondaryConstructor.kt
|
||||
public final class A : R|kotlin/Any| {
|
||||
public constructor(x: R|kotlin/Int|): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public constructor(y: R|kotlin/String|, z: R|kotlin/Int| = <Unresolved name: x>#): R|A| {
|
||||
this<R|A|>(R|<local>/z|)
|
||||
}
|
||||
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
class A(x: Int) {
|
||||
constructor(y: String, z: Int = <!UNRESOLVED_REFERENCE!>x<!>): this(z)
|
||||
}
|
||||
+6
@@ -1663,6 +1663,12 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/notASupertype.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("primaryConstructorParametersInSecondaryConstructor.kt")
|
||||
public void testPrimaryConstructorParametersInSecondaryConstructor() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/primaryConstructorParametersInSecondaryConstructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("primaryConstructorRequiredForDataClass.kt")
|
||||
public void testPrimaryConstructorRequiredForDataClass() throws Exception {
|
||||
|
||||
+6
@@ -1663,6 +1663,12 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/notASupertype.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("primaryConstructorParametersInSecondaryConstructor.kt")
|
||||
public void testPrimaryConstructorParametersInSecondaryConstructor() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/primaryConstructorParametersInSecondaryConstructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("primaryConstructorRequiredForDataClass.kt")
|
||||
public void testPrimaryConstructorRequiredForDataClass() throws Exception {
|
||||
|
||||
+4
-2
@@ -631,8 +631,10 @@ class BodyResolveContext(
|
||||
* special towerDataContext
|
||||
*/
|
||||
withTowerDataMode(FirTowerDataMode.CONSTRUCTOR_HEADER) {
|
||||
getPrimaryConstructorAllParametersScope()?.let { addLocalScope(it) }
|
||||
f()
|
||||
withTowerDataCleanup {
|
||||
getPrimaryConstructorAllParametersScope()?.let { addLocalScope(it) }
|
||||
f()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
withTowerDataCleanup {
|
||||
|
||||
Reference in New Issue
Block a user