KT-12846 Forbid vararg of type 'Nothing' and 'Nothing?'

This commit is contained in:
Dmitry Petrov
2017-01-20 14:12:06 +03:00
parent 1f573bb115
commit 6e2ebaa300
6 changed files with 46 additions and 9 deletions
@@ -0,0 +1,15 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun testVarargOfNothing(<!FORBIDDEN_VARARG_PARAMETER_TYPE!>vararg<!> v: Nothing) {}
fun testVarargOfNNothing(<!FORBIDDEN_VARARG_PARAMETER_TYPE!>vararg<!> v: Nothing?) {}
fun <T : Nothing?> testVarargOfT(<!FORBIDDEN_VARARG_PARAMETER_TYPE!>vararg<!> v: T) {}
fun outer() {
fun testVarargOfNothing(<!FORBIDDEN_VARARG_PARAMETER_TYPE!>vararg<!> v: Nothing) {}
fun testVarargOfNNothing(<!FORBIDDEN_VARARG_PARAMETER_TYPE!>vararg<!> v: Nothing?) {}
fun <T : Nothing?> testVarargOfT(<!FORBIDDEN_VARARG_PARAMETER_TYPE!>vararg<!> v: T) {}
}
@@ -0,0 +1,6 @@
package
public fun outer(): kotlin.Unit
public fun testVarargOfNNothing(/*0*/ vararg v: kotlin.Nothing? /*kotlin.Array<out kotlin.Nothing?>*/): kotlin.Unit
public fun testVarargOfNothing(/*0*/ vararg v: kotlin.Nothing /*kotlin.Array<out kotlin.Nothing>*/): kotlin.Unit
public fun </*0*/ T : kotlin.Nothing?> testVarargOfT(/*0*/ vararg v: T /*kotlin.Array<out T>*/): kotlin.Unit