Fix stack overflow caused star projection

This commit is contained in:
Denis Zharkov
2016-01-26 19:22:19 +03:00
parent 6b33e3fb67
commit 5b0fdcb3fe
4 changed files with 28 additions and 0 deletions
@@ -0,0 +1,3 @@
class A<T : A<T>>
fun <T : A<*>> foo() {}
class B<T : A<*>>
@@ -0,0 +1,17 @@
package
public fun </*0*/ T : A<*>> foo(): kotlin.Unit
public final class A</*0*/ T : A<T>> {
public constructor A</*0*/ T : A<T>>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class B</*0*/ T : A<*>> {
public constructor B</*0*/ T : A<*>>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -7439,6 +7439,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/generics/starProjections"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("checkBounds.kt")
public void testCheckBounds() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/generics/starProjections/checkBounds.kt");
doTest(fileName);
}
@TestMetadata("collectionInheritedFromJava.kt")
public void testCollectionInheritedFromJava() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/generics/starProjections/collectionInheritedFromJava.kt");
@@ -171,6 +171,8 @@ public class TypeUtils {
for (int i = 0, parametersSize = parameters.size(); i < parametersSize; i++) {
TypeParameterDescriptor parameterDescriptor = parameters.get(i);
TypeProjection typeProjection = arguments.get(i);
if (typeProjection.isStarProjection()) return true;
Variance projectionKind = typeProjection.getProjectionKind();
KotlinType argument = typeProjection.getType();