[JS IR] Fix unsgined integer default arguemtns (KT-44180)

Const lowering didn't exprect null constants with unsigned number
types and crashed with NPE. This commit fixes that.
This commit is contained in:
Svyatoslav Kuzmich
2021-01-11 17:00:05 +03:00
parent 0110b4e4b4
commit 2d88ff6fb2
10 changed files with 61 additions and 1 deletions
@@ -0,0 +1,20 @@
// WITH_RUNTIME
// Case of KT-44180
fun foo(
p0: UByte = 1u,
p1: UShort = 1u,
p2: UInt = 1u,
p4: ULong = 1uL,
): ULong {
return p0.toULong() + p1.toUShort() + p2.toUInt() + p4
}
fun box(): String {
if (foo() != 4uL) return "Fail 1"
if (foo(p2 = 10u) != 13uL) return "Fail 2"
if (foo(10u, 10u, 10u, 10uL) != 40uL) return "Fail 3"
return "OK"
}