IR Scripting: allow to specify nullable types for provided props...

but only explicitly. This does not fix a breaking change described in
#KT-52120, because it seems the correct behavior, but it allows
to "workaround" the problem by specifying nullability explicitly.
Also improve handling of nullable bindings in JSR-223.
#KT-49173 fixed
#KT-51213 fixed
This commit is contained in:
Ilya Chernikov
2022-04-22 15:02:18 +02:00
committed by teamcity
parent 4a66cd0c69
commit 49902bb851
8 changed files with 82 additions and 16 deletions
@@ -261,6 +261,10 @@ obj
put("boundValue", 100)
})
Assert.assertEquals(111, result2)
engine.put("nullable", null)
val result3 = engine.eval("bindings[\"nullable\"]?.let { it as Int } ?: -1")
Assert.assertEquals(-1, result3)
}
@Test
@@ -280,6 +284,10 @@ obj
put("boundValue", 100)
})
Assert.assertEquals(111, result2)
engine.put("nullable", null)
val result3 = engine.eval("nullable?.let { it as Int } ?: -1")
Assert.assertEquals(-1, result3)
}
@Test