Type alias shouldn't capture type parameters of inaccessible outer classes.

This commit is contained in:
Dmitry Petrov
2016-06-09 17:15:42 +03:00
parent 12710bec2f
commit d02785806d
3 changed files with 65 additions and 0 deletions
@@ -0,0 +1,29 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER
class Outer<TO> {
typealias LTO = List<TO>
class Nested<TN> {
typealias LTO = List<<!UNRESOLVED_REFERENCE!>TO<!>>
typealias LTN = List<TN>
inner class Inner<TI> {
typealias LTO = List<<!UNRESOLVED_REFERENCE!>TO<!>>
typealias LTN = List<TN>
typealias LTI = List<TI>
}
}
}
fun <TF> foo() {
class Local<TL> {
typealias LTF = List<TF>
typealias LTL = List<TL>
}
fun <TLF> localfun() =
object {
typealias LTF = List<TF>
typealias LTLF = List<TLF>
}
}
@@ -0,0 +1,30 @@
package
public fun </*0*/ TF> foo(): kotlin.Unit
public final class Outer</*0*/ TO> {
public typealias LTO /*captured type parameters: /*0*/ TO*/ = kotlin.collections.List<TO>
public constructor Outer</*0*/ TO>()
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 Nested</*0*/ TN> {
public typealias LTN /*captured type parameters: /*0*/ TN*/ = kotlin.collections.List<TN>
public typealias LTO /*captured type parameters: /*0*/ TN*/ = kotlin.collections.List<[ERROR : TO]>
public constructor Nested</*0*/ TN>()
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 Inner</*0*/ TI> /*captured type parameters: /*1*/ TN*/ {
public typealias LTI /*captured type parameters: /*0*/ TI, /*1*/ TN*/ = kotlin.collections.List<TI>
public typealias LTN /*captured type parameters: /*0*/ TI, /*1*/ TN*/ = kotlin.collections.List<TN>
public typealias LTO /*captured type parameters: /*0*/ TI, /*1*/ TN*/ = kotlin.collections.List<[ERROR : TO]>
public constructor Inner</*0*/ TI>()
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
}
}
}
@@ -19479,6 +19479,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
doTest(fileName);
}
@TestMetadata("capturingTypeParametersFromOuterClass.kt")
public void testCapturingTypeParametersFromOuterClass() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/typealias/capturingTypeParametersFromOuterClass.kt");
doTest(fileName);
}
@TestMetadata("conflictingProjections.kt")
public void testConflictingProjections() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/typealias/conflictingProjections.kt");