Forbid Foo<T>.Bar

This commit is contained in:
Yan Zhulanow
2015-10-05 17:50:23 +03:00
parent 937d1913b8
commit fd3c28c950
11 changed files with 94 additions and 8 deletions
@@ -15,12 +15,12 @@ val n1 = A.Nested::class
val n2 = <!CLASS_LITERAL_LHS_NOT_A_CLASS!>A.Nested<*>::class<!>
val i1 = A.Inner::class
val i2 = <!CLASS_LITERAL_LHS_NOT_A_CLASS!>A<*>.Inner<*>::class<!>
val i3 = <!CLASS_LITERAL_LHS_NOT_A_CLASS!>A<Int>.Inner<CharSequence>::class<!>
val i2 = <!CLASS_LITERAL_LHS_NOT_A_CLASS!><!GENERICS_IN_CONTAINING_TYPE_NOT_ALLOWED!>A<*>.Inner<*><!>::class<!>
val i3 = <!CLASS_LITERAL_LHS_NOT_A_CLASS!><!GENERICS_IN_CONTAINING_TYPE_NOT_ALLOWED!>A<Int>.Inner<CharSequence><!>::class<!>
val m1 = Map::class
val m2 = <!CLASS_LITERAL_LHS_NOT_A_CLASS!>Map<Int, *>::class<!>
val m3 = Map.Entry::class
val b1 = Int::class
val b2 = Nothing::class
val b2 = Nothing::class
@@ -0,0 +1,36 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION
class Foo<T> {
class Bar<X> {
class Baz {
}
}
}
fun <T> a() {}
fun test() {
Foo::class
Foo.Bar::class
Foo.Bar.Baz::class
a<Foo.Bar<String>>()
a<Foo.Bar.Baz>()
<!GENERICS_IN_CONTAINING_TYPE_NOT_ALLOWED!>Foo<String>.Bar<!>::class
<!GENERICS_IN_CONTAINING_TYPE_NOT_ALLOWED!>Foo<<!DEBUG_INFO_MISSING_UNRESOLVED!>String<!>>.Bar.Baz<!>::class
a<<!GENERICS_IN_CONTAINING_TYPE_NOT_ALLOWED, WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Foo<String>.Bar<!>>()
a<<!GENERICS_IN_CONTAINING_TYPE_NOT_ALLOWED!>Foo<<!DEBUG_INFO_MISSING_UNRESOLVED!>String<!>>.Bar.Baz<!>>()
a<Foo.Bar<Int>>()
a<<!GENERICS_IN_CONTAINING_TYPE_NOT_ALLOWED!>Foo.Bar<Int>.Baz<!>>()
}
fun <T: Foo<String.<!UNRESOLVED_REFERENCE!>Bar<!>>> x() {}
fun <!GENERICS_IN_CONTAINING_TYPE_NOT_ALLOWED, WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Foo<String>.Bar<!>.ext() {}
fun ex1(<!UNUSED_PARAMETER!>a<!>: <!GENERICS_IN_CONTAINING_TYPE_NOT_ALLOWED!>Foo<String>.Bar<String><!>): <!GENERICS_IN_CONTAINING_TYPE_NOT_ALLOWED!>Foo<String>.Bar<String><!> {
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
@@ -0,0 +1,28 @@
package
public fun </*0*/ T> a(): kotlin.Unit
public fun ex1(/*0*/ a: Foo.Bar<kotlin.String>): Foo.Bar<kotlin.String>
public fun test(): kotlin.Unit
public fun </*0*/ T : Foo<[ERROR : String.Bar]>> x(): kotlin.Unit
public fun [ERROR : Bar].ext(): kotlin.Unit
public final class Foo</*0*/ T> {
public constructor Foo</*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 class Bar</*0*/ X> {
public constructor Bar</*0*/ X>()
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 Baz {
public constructor Baz()
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
}
}
}
@@ -30,7 +30,7 @@ fun test(ab_c: c) {
ab_c3.ab_c()
}
fun test2(a_bc: a.b<Int>.c) {
fun test2(a_bc: a.b.c) {
a_bc.<!UNRESOLVED_REFERENCE!>a_bc<!>() // todo
a_bc.ab_c() // todo
}
@@ -69,7 +69,7 @@ fun test(a_b: b) {
_ab2.<!UNRESOLVED_REFERENCE!>_ab<!>() // todo
}
fun test2(_ab: a<Int>.b) {
fun test2(_ab: a.b) {
_ab._ab()
_ab.<!UNRESOLVED_REFERENCE!>a_b<!>()
}