traefik / yaegi

Yaegi is Another Elegant Go Interpreter
https://pkg.go.dev/github.com/traefik/yaegi
Apache License 2.0
7.1k stars 351 forks source link

typeswitch of an expression #1444

Closed mvertes closed 2 years ago

mvertes commented 2 years ago

The following program sample.go triggers an unexpected result

package main

func f(params ...interface{}) {
    switch p0 := params[0].(type) {
    case string:
        println("string:", p0)
    default:
        println("not a string")
    }   
}   

func main() {
    f("Hello")
}

Expected result

$ go run ./sample.go
Hello

Got

$ yaegi ./sample.go
not a string

Yaegi Version

v0.14.1

Additional Notes

This issue is related to #1426.