interp: support map literals with integer keys

This commit is contained in:
Konstantin Yegupov
2019-01-30 23:22:29 +10:00
committed by Ayke van Laethem
parent 0308c92e67
commit f8a1e5f449
4 changed files with 44 additions and 1 deletions
+4
View File
@@ -15,6 +15,7 @@ var testmap2 = map[string]int{
"eleven": 11,
"twelve": 12,
}
var testmapIntInt = map[int]int{1: 1, 2: 4, 3: 9}
func main() {
m := map[string]int{"answer": 42, "foo": 3}
@@ -31,6 +32,9 @@ func main() {
var nilmap map[string]int
println(m == nil, m != nil, len(m))
println(nilmap == nil, nilmap != nil, len(nilmap))
println(testmapIntInt[2])
testmapIntInt[2] = 42
println(testmapIntInt[2])
}
func readMap(m map[string]int, key string) {
+2
View File
@@ -50,3 +50,5 @@ lookup with comma-ok: eight 8 true
lookup with comma-ok: nokey 0 false
false true 2
true false 0
4
42