mirror of
https://github.com/burrowers/garble.git
synced 2025-12-24 12:58:05 +08:00
avoid panic when embedding a builtin alias
TypeName.Pkg is documented as:
Pkg returns the package to which the object belongs.
The result is nil for labels and objects in the Universe scope.
When a struct type embeds a builtin alias type, such as byte,
this would lead to a panic since we assumed we could use the Pkg method.
Fixes #798.
This commit is contained in:
committed by
Paul Scheduikat
parent
6f0e46f80b
commit
4271bc45ae
7
testdata/script/syntax.txtar
vendored
7
testdata/script/syntax.txtar
vendored
@@ -244,6 +244,13 @@ var _ = embeddingAliasSameName{
|
||||
Reader: nil,
|
||||
}
|
||||
|
||||
type embeddingBuiltinAlias struct {
|
||||
byte
|
||||
}
|
||||
|
||||
var _ = embeddingBuiltinAlias{3}
|
||||
var _ = embeddingBuiltinAlias{byte: 3}
|
||||
|
||||
-- external/external.go --
|
||||
package external
|
||||
|
||||
|
||||
Reference in New Issue
Block a user