mirror of
https://github.com/hanzoai/yaegi.git
synced 2026-10-01 00:49:47 +00:00
In [short variable declarations](https://go.dev/ref/spec#Short_variable_declarations), The reuse of existing symbols is possible only if a new variable is defined, otherwise a new symbol must be created, which was not the case in the issue. Search for new symbols and correctly ignore blank variables. Fixes #1434.
22 lines
311 B
Go
22 lines
311 B
Go
package main
|
|
|
|
func main() {
|
|
s := make([]map[string]string, 0)
|
|
m := make(map[string]string)
|
|
m["m1"] = "m1"
|
|
m["m2"] = "m2"
|
|
s = append(s, m)
|
|
tmpStr := "start"
|
|
println(tmpStr)
|
|
for _, v := range s {
|
|
tmpStr, ok := v["m1"]
|
|
println(tmpStr, ok)
|
|
}
|
|
println(tmpStr)
|
|
}
|
|
|
|
// Output:
|
|
// start
|
|
// m1 true
|
|
// start
|