mirror of
https://github.com/traefik/yaegi.git
synced 2026-06-01 18:37:56 +00:00
When a const is late binding and specified with a type, the GTA defineStmt was creating the symbol with the current scopes `iota` which is incorrect. The symbol should be created with the source nodes `rval`. Related to #1158
29 lines
285 B
Go
29 lines
285 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
func init() {
|
|
fmt.Println(constString)
|
|
fmt.Println(const2)
|
|
fmt.Println(varString)
|
|
}
|
|
|
|
const constString string = "hello"
|
|
|
|
const (
|
|
const1 = iota + 10
|
|
const2
|
|
const3
|
|
)
|
|
|
|
var varString string = "test"
|
|
|
|
func main() {}
|
|
|
|
// Output:
|
|
// hello
|
|
// 11
|
|
// test
|