Skip to content

typeswitch of an expression #1444

@mvertes

Description

@mvertes

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions