yaegi icon indicating copy to clipboard operation
yaegi copied to clipboard

Method definition on aliased type

Open mpl opened this issue 2 years ago • 0 comments

The following program sample.go triggers an unexpected result

package main

type Number int32

type Number1 = Number

type Number2 = Number1

func (n Number2) IsValid() bool { return true }

func main() {
	a := Number(5)
	println(a.IsValid())
}

Expected result

% go run ./main.go 
true

Got

% yaegi run ./sample.go 
run: ./sample.go:9:1: cannot define new methods on non-local type int32

Yaegi Version

master

Additional Notes

Opposite situation of #1411

mpl avatar Jun 13 '22 13:06 mpl