Specificity supported for dynamic types
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
// !CHECK_TYPE
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
// MODULE[js]: m1
|
||||
// FILE: k.kt
|
||||
|
||||
fun dyn(d: dynamic) {}
|
||||
|
||||
fun foo(d: dynamic): String = ""
|
||||
fun foo(d: Int): Int = 1
|
||||
|
||||
fun nothing(d: dynamic): Int = 1
|
||||
fun nothing(d: Nothing): String = ""
|
||||
|
||||
fun test(d: dynamic) {
|
||||
dyn(1)
|
||||
dyn("")
|
||||
|
||||
foo(1).checkType { it : _<Int> }
|
||||
foo("").checkType { it : _<String> }
|
||||
|
||||
// Checking specificity of `dynamic` vs `Nothing`
|
||||
nothing(d).checkType { it : _<String> }
|
||||
nothing("").checkType { it : _<Int> }
|
||||
[suppress("UNREACHABLE_CODE")] nothing(null!!).checkType { it : _<String> }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package
|
||||
|
||||
internal fun dyn(/*0*/ d: (kotlin.Nothing..kotlin.Any?)): kotlin.Unit
|
||||
internal fun foo(/*0*/ d: (kotlin.Nothing..kotlin.Any?)): kotlin.String
|
||||
internal fun foo(/*0*/ d: kotlin.Int): kotlin.Int
|
||||
internal fun nothing(/*0*/ d: dynamic): kotlin.Int
|
||||
internal fun nothing(/*0*/ d: kotlin.Nothing): kotlin.String
|
||||
internal fun test(/*0*/ d: dynamic): kotlin.Unit
|
||||
Reference in New Issue
Block a user