Type inference SHOULD NOT work for type alias constructor in supertypes list

(same as for classes: type arguments should be provided explicitly).
This commit is contained in:
Dmitry Petrov
2016-11-14 14:31:18 +03:00
parent cd8b5dcb00
commit f7203da2d6
3 changed files with 38 additions and 0 deletions
@@ -0,0 +1,7 @@
open class Ref<T>(var x: T)
typealias R<T> = Ref<T>
// Type inference SHOULD NOT work for type alias constructor in supertypes list
class Test1 : <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>R<!>(0)
class Test2 : R<Int>(0)
@@ -0,0 +1,25 @@
package
public open class Ref</*0*/ T> {
public constructor Ref</*0*/ T>(/*0*/ x: T)
public final var x: 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 Test1 {
public constructor Test1()
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 Test2 : R<kotlin.Int> /* = Ref<kotlin.Int> */ {
public constructor Test2()
public final override /*1*/ /*fake_override*/ var x: kotlin.Int
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 typealias R</*0*/ T> = Ref<T>
@@ -21154,6 +21154,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
doTest(fileName);
}
@TestMetadata("typeAliasConstructorInferenceInSupertypesList.kt")
public void testTypeAliasConstructorInferenceInSupertypesList() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/typealias/typeAliasConstructorInferenceInSupertypesList.kt");
doTest(fileName);
}
@TestMetadata("typeAliasConstructorTypeArgumentsInference.kt")
public void testTypeAliasConstructorTypeArgumentsInference() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/typealias/typeAliasConstructorTypeArgumentsInference.kt");