KT-40235 null companion for stdlib external union types

This commit is contained in:
Victor Turansky
2021-01-18 03:58:30 +03:00
committed by Svyatoslav Kuzmich
parent 7523a5e97f
commit ba0d60853d
9 changed files with 57 additions and 9 deletions
@@ -3,6 +3,7 @@
// This hack is used in org.w3c.* part of standard library to represent unions of Strings
// Test that we are not actually trying to access nonexistent companion object
@JsName("null")
@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
public external interface I {
companion object
@@ -14,4 +15,4 @@ fun box(): String {
if (I.O != I.O) return "Fail 1"
if (I.O == I.K) return "Fail 2"
return I.O.unsafeCast<String>() + I.K.unsafeCast<String>()
}
}