K2: reproduce KT-63377 (+ consider some more cases)

This commit is contained in:
Mikhail Glukhikh
2023-11-22 15:34:58 +01:00
committed by Space Team
parent 2d76c7b05d
commit 99234ef1c5
8 changed files with 109 additions and 0 deletions
@@ -37476,6 +37476,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/typeParameters/kt46186withEmptyIntersections.kt");
}
@Test
@TestMetadata("memberTypeParameterVsNestedClass.kt")
public void testMemberTypeParameterVsNestedClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass.kt");
}
@Test
@TestMetadata("misplacedConstraints.kt")
public void testMisplacedConstraints() throws Exception {
@@ -37476,6 +37476,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/typeParameters/kt46186withEmptyIntersections.kt");
}
@Test
@TestMetadata("memberTypeParameterVsNestedClass.kt")
public void testMemberTypeParameterVsNestedClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass.kt");
}
@Test
@TestMetadata("misplacedConstraints.kt")
public void testMisplacedConstraints() throws Exception {
@@ -35350,6 +35350,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
runTest("compiler/testData/diagnostics/tests/typeParameters/kt46186withEmptyIntersections.kt");
}
@Test
@TestMetadata("memberTypeParameterVsNestedClass.kt")
public void testMemberTypeParameterVsNestedClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass.kt");
}
@Test
@TestMetadata("misplacedConstraints.kt")
public void testMisplacedConstraints() throws Exception {
@@ -35470,6 +35470,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
runTest("compiler/testData/diagnostics/tests/typeParameters/kt46186withEmptyIntersections.kt");
}
@Test
@TestMetadata("memberTypeParameterVsNestedClass.kt")
public void testMemberTypeParameterVsNestedClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass.kt");
}
@Test
@TestMetadata("misplacedConstraints.kt")
public void testMisplacedConstraints() throws Exception {
@@ -0,0 +1,21 @@
// ISSUE: KT-63377
// FIR_DUMP
class OuterClass<OuterParam> {
class OuterParam
fun <NestedParam : OuterParam> foo(t: NestedParam) {
val k: OuterParam = <!INITIALIZER_TYPE_MISMATCH!>t<!>
val l: OuterParam = OuterParam()
}
inner class Inner<NestedParam : OuterParam>(t: NestedParam) {
val k: OuterParam = t
val l: OuterParam = <!INITIALIZER_TYPE_MISMATCH, TYPE_MISMATCH!>OuterParam()<!>
init {
val m: OuterParam = <!INITIALIZER_TYPE_MISMATCH!>t<!>
val n: OuterParam = OuterParam()
}
}
}
@@ -0,0 +1,37 @@
FILE: memberTypeParameterVsNestedClass.fir.kt
public final class OuterClass<OuterParam> : R|kotlin/Any| {
public constructor<OuterParam>(): R|OuterClass<OuterParam>| {
super<R|kotlin/Any|>()
}
public final class OuterParam : R|kotlin/Any| {
public constructor(): R|OuterClass.OuterParam| {
super<R|kotlin/Any|>()
}
}
public final fun <NestedParam : R|OuterParam|> foo(t: R|NestedParam|): R|kotlin/Unit| {
lval k: R|OuterClass.OuterParam| = R|<local>/t|
lval l: R|OuterClass.OuterParam| = R|/OuterClass.OuterParam.OuterParam|()
}
public final inner class Inner<NestedParam : R|OuterParam|, Outer(OuterParam)> : R|kotlin/Any| {
public OuterClass<OuterParam>.constructor<NestedParam : R|OuterParam|>(t: R|NestedParam|): R|OuterClass.Inner<NestedParam, OuterParam>| {
super<R|kotlin/Any|>()
}
public final val k: R|OuterParam| = R|<local>/t|
public get(): R|OuterParam|
public final val l: R|OuterParam| = R|/OuterClass.OuterParam.OuterParam<CS errors: /OuterClass.OuterParam.OuterParam>#|()
public get(): R|OuterParam|
init {
lval m: R|OuterClass.OuterParam| = R|<local>/t|
lval n: R|OuterClass.OuterParam| = R|/OuterClass.OuterParam.OuterParam|()
}
}
}
@@ -0,0 +1,21 @@
// ISSUE: KT-63377
// FIR_DUMP
class OuterClass<OuterParam> {
class OuterParam
fun <NestedParam : OuterParam> foo(t: NestedParam) {
val k: OuterParam = t
val l: OuterParam = <!TYPE_MISMATCH!>OuterParam()<!>
}
inner class Inner<NestedParam : OuterParam>(t: NestedParam) {
val k: OuterParam = t
val l: OuterParam = <!TYPE_MISMATCH!>OuterParam()<!>
init {
val m: OuterParam = t
val n: OuterParam = <!TYPE_MISMATCH!>OuterParam()<!>
}
}
}
@@ -37476,6 +37476,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/typeParameters/kt46186withEmptyIntersections.kt");
}
@Test
@TestMetadata("memberTypeParameterVsNestedClass.kt")
public void testMemberTypeParameterVsNestedClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/typeParameters/memberTypeParameterVsNestedClass.kt");
}
@Test
@TestMetadata("misplacedConstraints.kt")
public void testMisplacedConstraints() throws Exception {