FE: avoid stack overflow on star projection of enhanced type parameter
#KT-47846 Fixed
This commit is contained in:
+11
@@ -0,0 +1,11 @@
|
|||||||
|
// SKIP_TXT
|
||||||
|
// FILE: I1.java
|
||||||
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
|
public interface I1<@NonNull T> { }
|
||||||
|
|
||||||
|
// FILE: I2.java
|
||||||
|
public interface I2<T extends I1<T>> { }
|
||||||
|
|
||||||
|
// FILE: main.kt
|
||||||
|
fun foo(): I2<*> = TODO()
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
// SKIP_TXT
|
||||||
|
// FILE: I1.java
|
||||||
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
|
public interface I1<@NonNull T> { }
|
||||||
|
|
||||||
|
// FILE: I2.java
|
||||||
|
public interface I2<T extends I1<T>> { }
|
||||||
|
|
||||||
|
// FILE: main.kt
|
||||||
|
fun foo(): I2<*> = TODO()
|
||||||
+12
@@ -955,6 +955,18 @@ public class ForeignAnnotationsCompiledJavaTestGenerated extends AbstractForeign
|
|||||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/classTypeParameterBound.fir.kt");
|
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/classTypeParameterBound.fir.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("enhancedRecursiveStarProjection.kt")
|
||||||
|
public void testEnhancedRecursiveStarProjection() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/enhancedRecursiveStarProjection.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("enhancedRecursiveStarProjection.fir.kt")
|
||||||
|
public void testEnhancedRecursiveStarProjection_fir() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/enhancedRecursiveStarProjection.fir.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("methodWithTypeParameter.kt")
|
@TestMetadata("methodWithTypeParameter.kt")
|
||||||
public void testMethodWithTypeParameter() throws Exception {
|
public void testMethodWithTypeParameter() throws Exception {
|
||||||
|
|||||||
+12
@@ -955,6 +955,18 @@ public class ForeignAnnotationsCompiledJavaWithPsiClassReadingTestGenerated exte
|
|||||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/classTypeParameterBound.fir.kt");
|
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/classTypeParameterBound.fir.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("enhancedRecursiveStarProjection.kt")
|
||||||
|
public void testEnhancedRecursiveStarProjection() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/enhancedRecursiveStarProjection.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("enhancedRecursiveStarProjection.fir.kt")
|
||||||
|
public void testEnhancedRecursiveStarProjection_fir() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/enhancedRecursiveStarProjection.fir.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("methodWithTypeParameter.kt")
|
@TestMetadata("methodWithTypeParameter.kt")
|
||||||
public void testMethodWithTypeParameter() throws Exception {
|
public void testMethodWithTypeParameter() throws Exception {
|
||||||
|
|||||||
+12
@@ -955,6 +955,18 @@ public class ForeignAnnotationsSourceJavaTestGenerated extends AbstractForeignAn
|
|||||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/classTypeParameterBound.fir.kt");
|
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/classTypeParameterBound.fir.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("enhancedRecursiveStarProjection.kt")
|
||||||
|
public void testEnhancedRecursiveStarProjection() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/enhancedRecursiveStarProjection.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("enhancedRecursiveStarProjection.fir.kt")
|
||||||
|
public void testEnhancedRecursiveStarProjection_fir() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/java8Tests/misc/enhancedRecursiveStarProjection.fir.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("methodWithTypeParameter.kt")
|
@TestMetadata("methodWithTypeParameter.kt")
|
||||||
public void testMethodWithTypeParameter() throws Exception {
|
public void testMethodWithTypeParameter() throws Exception {
|
||||||
|
|||||||
@@ -186,6 +186,7 @@ public class TypeSubstitutor implements TypeSubstitutorMarker {
|
|||||||
typeParameter,
|
typeParameter,
|
||||||
recursionDepth + 1
|
recursionDepth + 1
|
||||||
);
|
);
|
||||||
|
if (substitution.isStarProjection()) return substitution;
|
||||||
|
|
||||||
KotlinType substitutedEnhancement = substitute(enhancement, originalProjection.getProjectionKind());
|
KotlinType substitutedEnhancement = substitute(enhancement, originalProjection.getProjectionKind());
|
||||||
KotlinType resultingType = TypeWithEnhancementKt.wrapEnhancement(
|
KotlinType resultingType = TypeWithEnhancementKt.wrapEnhancement(
|
||||||
|
|||||||
Reference in New Issue
Block a user