Consequences of map/set specializations removal:
- NaNs are no longer usable as keys in maps or elements in sets. - Chars are stored as their underlying type string, and Longs are stored as objects. Opened #KT-13610
This commit is contained in:
@@ -23,11 +23,12 @@ fun box(): String {
|
||||
mapWithDoubleKeys[1.0] = 1
|
||||
assertEquals("number", jsTypeOf (mapWithDoubleKeys.keys.iterator().next()), "mapWithDoubleKeys")
|
||||
|
||||
mapWithDoubleKeys.clear()
|
||||
var dNaN = 0.0 / 0.0
|
||||
mapWithDoubleKeys[dNaN] = 100
|
||||
assertEquals(100, mapWithDoubleKeys[dNaN])
|
||||
assertEquals("number", jsTypeOf (mapWithDoubleKeys.keys.iterator().next()), "dNaN")
|
||||
// boxed NaNs are not equal, KT-13610
|
||||
// mapWithDoubleKeys.clear()
|
||||
// var dNaN = 0.0 / 0.0
|
||||
// mapWithDoubleKeys[dNaN] = 100
|
||||
// assertEquals(100, mapWithDoubleKeys[dNaN])
|
||||
// assertEquals("number", jsTypeOf (mapWithDoubleKeys.keys.iterator().next()), "dNaN")
|
||||
|
||||
mapWithDoubleKeys.clear()
|
||||
var dPositiveInfinity = +1.0 / 0.0
|
||||
@@ -45,11 +46,12 @@ fun box(): String {
|
||||
mapWithFloatKeys[1.0f] = 1
|
||||
assertEquals("number", jsTypeOf (mapWithFloatKeys.keys.iterator().next()), "mapWithFloatKeys")
|
||||
|
||||
mapWithFloatKeys.clear()
|
||||
var fNaN: Float = 0.0f / 0.0f
|
||||
mapWithFloatKeys[fNaN] = 100
|
||||
assertEquals(100, mapWithFloatKeys[fNaN])
|
||||
assertEquals("number", jsTypeOf (mapWithFloatKeys.keys.iterator().next()), "fNaN")
|
||||
// boxed NaNs are not equal, KT-13610
|
||||
// mapWithFloatKeys.clear()
|
||||
// var fNaN: Float = 0.0f / 0.0f
|
||||
// mapWithFloatKeys[fNaN] = 100
|
||||
// assertEquals(100, mapWithFloatKeys[fNaN])
|
||||
// assertEquals("number", jsTypeOf (mapWithFloatKeys.keys.iterator().next()), "fNaN")
|
||||
|
||||
mapWithFloatKeys.clear()
|
||||
var fPositiveInfinity = +1.0f / 0.0f
|
||||
@@ -65,11 +67,11 @@ fun box(): String {
|
||||
|
||||
val mapWithCharKeys = HashMap<Char, Int>()
|
||||
mapWithCharKeys['A'] = 1
|
||||
assertEquals("number", jsTypeOf (mapWithCharKeys.keys.iterator().next()), "mapWithCharKeys")
|
||||
assertEquals("string", jsTypeOf (mapWithCharKeys.keys.iterator().next()), "mapWithCharKeys")
|
||||
|
||||
val mapWithLongKeys = HashMap<Long, Int>()
|
||||
mapWithLongKeys[1L] = 1
|
||||
assertEquals("number", jsTypeOf (mapWithLongKeys.keys.iterator().next()), "mapWithLongKeys")
|
||||
assertEquals("object", jsTypeOf (mapWithLongKeys.keys.iterator().next()), "mapWithLongKeys")
|
||||
|
||||
val mapWithBooleanKeys = HashMap<Boolean, Int>()
|
||||
mapWithBooleanKeys[true] = 1
|
||||
|
||||
@@ -53,11 +53,11 @@ fun box(): String {
|
||||
|
||||
val charSet = HashSet<Char>()
|
||||
charSet.add('A')
|
||||
assertEquals("number", jsTypeOf (charSet.iterator().next()), "charSet")
|
||||
assertEquals("string", jsTypeOf (charSet.iterator().next()), "charSet")
|
||||
|
||||
val longSet = HashSet<Long>()
|
||||
longSet.add(1L)
|
||||
assertEquals("number", jsTypeOf (longSet.iterator().next()), "longSet")
|
||||
assertEquals("object", jsTypeOf (longSet.iterator().next()), "longSet")
|
||||
|
||||
val booleanSet = HashSet<Boolean>()
|
||||
booleanSet.add(true)
|
||||
|
||||
Reference in New Issue
Block a user