Make List/Set += and -= element-type aware

This commit is contained in:
sergeych committed 2026-03-12 19:13:17 +03:00
1 parent 3bfb80a7c1
commit c9021eb9cf
3 files changed
+81 -8

No files matched your search

@@ -416,6 +416,23 @@ class TypesTest {
""".trimIndent())
}
@Test
fun testListTyped() = runTest {
eval("""
var l = List<String>()
val typed: List<String> = l
assertEquals(List(), typed)
l += "foo"
assertEquals(List("foo"), l)
l -= "foo"
assertEquals(List(), l)
l += ["foo", "bar"]
assertEquals(List("foo", "bar"), l)
""".trimIndent())
}
// @Test
// fun testAliasesInGenerics1() = runTest {
// val scope = Script.newScope()