Inherited type alias capturing type parameters of generic base class:

doesn't work partially due to KT-11123.
This commit is contained in:
Dmitry Petrov
2016-06-10 14:09:42 +03:00
parent bee1762b0e
commit 7b6c1c092c
3 changed files with 69 additions and 0 deletions
@@ -0,0 +1,20 @@
interface ICell<T> {
val x: T
}
class Cell<T>(override val x: T): ICell<T>
open class Base<T> {
typealias CT = Cell<T>
inner class InnerCell(override val x: T): ICell<T>
}
class Derived : Base<Int>() {
// TODO KT-11123
val x1: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>InnerCell<!> = InnerCell(42)
val x2: Base<Int>.InnerCell = InnerCell(42)
val test1: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>CT<!> = Cell(42)
val test2: Base<Int>.CT = Cell(42)
}
@@ -0,0 +1,43 @@
package
public open class Base</*0*/ T> {
public typealias CT /*captured type parameters: /*0*/ T*/ = Cell<T>
public constructor Base</*0*/ 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 inner class InnerCell /*captured type parameters: /*0*/ T*/ : ICell<T> {
public constructor InnerCell(/*0*/ x: T)
public open override /*1*/ val 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 Cell</*0*/ T> : ICell<T> {
public constructor Cell</*0*/ T>(/*0*/ x: T)
public open override /*1*/ val 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 Derived : Base<kotlin.Int> {
public constructor Derived()
public final val test1: [ERROR : CT]
public final val test2: Base<kotlin.Int>.CT [= Cell<kotlin.Int>]
public final val x1: [ERROR : InnerCell]
public final val x2: Base<kotlin.Int>.InnerCell
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 interface ICell</*0*/ T> {
public abstract val 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
}
@@ -19533,6 +19533,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
doTest(fileName);
}
@TestMetadata("inheritedNestedTypeAlias.kt")
public void testInheritedNestedTypeAlias() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/typealias/inheritedNestedTypeAlias.kt");
doTest(fileName);
}
@TestMetadata("isAsWithTypeAlias.kt")
public void testIsAsWithTypeAlias() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/typealias/isAsWithTypeAlias.kt");