Minor. Report reified-related diagnostics on arguments if possible

This commit is contained in:
Denis Zharkov
2016-01-19 10:16:22 +03:00
parent 5baa0ed4bb
commit ae6c62ddff
8 changed files with 17 additions and 13 deletions
@@ -38,8 +38,8 @@ fun test4(
) {}
fun test5() {
<!UNSUPPORTED!><!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>arrayOf<!><Nothing>()<!>
<!UNSUPPORTED!><!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>Array<!><Nothing>(10) { throw Exception() }<!>
<!UNSUPPORTED!>arrayOf<<!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>Nothing<!>>()<!>
<!UNSUPPORTED!>Array<<!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>Nothing<!>>(10) { throw Exception() }<!>
}
fun <T> foo(): Array<T> = (object {} as Any) as Array<T>
@@ -4,7 +4,7 @@ fun <T> ok1(block: () -> Array<T>): Array<T> = block()
inline fun <reified T> ok2(): Array<T> = Array(1) { null!! }
fun <T> fail2(): Array<T> = ok1 { <!TYPE_PARAMETER_AS_REIFIED!>Array<!><T>(1) { null!! } }
fun <T> fail2(): Array<T> = ok1 { Array<<!TYPE_PARAMETER_AS_REIFIED!>T<!>>(1) { null!! } }
fun <T> ok3(block: () -> Array<T>): Array<T> = ok1 { block() }
inline fun <reified T> ok4(): Array<T> = ok1 { Array<T>(1) { null!! } }
@@ -1,7 +1,7 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE
fun <T> foo() {
val x = <!TYPE_PARAMETER_AS_REIFIED!>arrayOfNulls<!><T>(5)
val x = arrayOfNulls<<!TYPE_PARAMETER_AS_REIFIED!>T<!>>(5)
}
inline fun <reified T> bar() {
@@ -6,11 +6,11 @@ inline fun <reified T: Any> javaClass(): Class<T> = T::class.java
fun box() {
val a = <!UNSUPPORTED!><!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>arrayOf<!>(null!!)<!>
val b = <!UNSUPPORTED!><!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>Array<!><Nothing?>(5) { null!! }<!>
val b = <!UNSUPPORTED!>Array<<!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>Nothing?<!>>(5) { null!! }<!>
val c = <!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>foo<!>() { null!! }
val d = foo<Any> { null!! }
val e = <!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>foo<!> { "1" as Nothing }
val e1 = <!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>foo<!> { "1" as Nothing? }
val f = <!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>javaClass<!><Nothing>()
val f = javaClass<<!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>Nothing<!>>()
}