Don't allow fibers as map keys.

I hacked in support for it for a misguided reason (trying to fake
"thread-local storage") and ended up not using it for that anyway.
This commit is contained in:
Bob Nystrom
2015-12-15 10:42:21 -08:00
parent 8d9feb4bc9
commit 873926915f
9 changed files with 9 additions and 24 deletions
+1 -1
View File
@@ -1 +1 @@
var result = {}.containsKey([]) // expect runtime error: Key must be a value type or fiber.
var result = {}.containsKey([]) // expect runtime error: Key must be a value type.
+3 -5
View File
@@ -8,8 +8,7 @@ var map = {
1.2: "1 point 2",
List: "list class",
"null": "string value",
(1..3): "1 to 3",
fiber: "fiber"
(1..3): "1 to 3"
}
System.print(map[null]) // expect: null value
@@ -20,9 +19,8 @@ System.print(map[1.2]) // expect: 1 point 2
System.print(map[List]) // expect: list class
System.print(map["null"]) // expect: string value
System.print(map[1..3]) // expect: 1 to 3
System.print(map[fiber]) // expect: fiber
System.print(map.count) // expect: 9
System.print(map.count) // expect: 8
// Use the same keys (but sometimes different objects) to ensure keys have the
// right equality semantics.
@@ -44,4 +42,4 @@ System.print(map[List]) // expect: new list class
System.print(map["null"]) // expect: new string value
System.print(map[1..3]) // expect: new 1 to 3
System.print(map.count) // expect: 9
System.print(map.count) // expect: 8
+1 -1
View File
@@ -1 +1 @@
var result = {}.remove([]) // expect runtime error: Key must be a value type or fiber.
var result = {}.remove([]) // expect runtime error: Key must be a value type.
+1 -1
View File
@@ -1 +1 @@
var result = {}[[]] // expect runtime error: Key must be a value type or fiber.
var result = {}[[]] // expect runtime error: Key must be a value type.
@@ -1 +1 @@
var result = {}[[]] = "value" // expect runtime error: Key must be a value type or fiber.
var result = {}[[]] = "value" // expect runtime error: Key must be a value type.