forked from traefik/yaegi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
interp: types should not recover data for aliases
When `nodeType` recovers names and methods, it can overwrite the data if the type is an aliasT. When aliasing a type, do not recover the methods, this will be done in the GTA typeSpec pass. Related to traefik#1158
- Loading branch information
1 parent
1c7e3ca
commit de16837
Showing
4 changed files
with
43 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package main | ||
|
||
import "github.com/traefik/yaegi/_test/alias3" | ||
|
||
var globalT *T | ||
|
||
func init() { | ||
globalT = &T{A: "test"} | ||
} | ||
|
||
type T alias3.T | ||
|
||
func (t *T) PrintT() { | ||
(*alias3.T)(t).Print() | ||
} | ||
|
||
func main() { | ||
globalT.PrintT() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package alias3 | ||
|
||
type T struct { | ||
A string | ||
} | ||
|
||
func (t *T) Print() { | ||
println(t.A) | ||
} | ||
|
||
// Output: | ||
// test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters