Skip to content

Commit

Permalink
gotypes: Handle named types in Component.Resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
greatroar committed Mar 17, 2023
1 parent fc7bbb8 commit 9121423
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion examples/args/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type Struct struct {
Int8 int8
Uint16 uint16
Int32 int32
Uint64 uint64
Uint64 NamedUint64
Float32 float32
Float64 float64
String string
Expand All @@ -16,6 +16,8 @@ type Struct struct {
Complex128 complex128
}

type NamedUint64 uint64

// Sub is a sub-struct of Struct, to demonstrate nested datastructure accesses.
type Sub struct {
A uint64
Expand Down
2 changes: 1 addition & 1 deletion gotypes/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func NewComponent(t types.Type, addr operand.Mem) Component {
}

func (c *component) Resolve() (*Basic, error) {
b := toprimitive(c.typ)
b := toprimitive(c.typ.Underlying())
if b == nil {
return nil, errors.New("component is not primitive")
}
Expand Down

0 comments on commit 9121423

Please sign in to comment.