From 91214231cb5b31c13dd1bcb48715332598234309 Mon Sep 17 00:00:00 2001 From: greatroar <61184462+greatroar@users.noreply.github.com> Date: Fri, 17 Mar 2023 11:35:41 +0100 Subject: [PATCH] gotypes: Handle named types in Component.Resolve --- examples/args/args.go | 4 +++- gotypes/components.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/args/args.go b/examples/args/args.go index 679bc613..1de21e5b 100644 --- a/examples/args/args.go +++ b/examples/args/args.go @@ -6,7 +6,7 @@ type Struct struct { Int8 int8 Uint16 uint16 Int32 int32 - Uint64 uint64 + Uint64 NamedUint64 Float32 float32 Float64 float64 String string @@ -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 diff --git a/gotypes/components.go b/gotypes/components.go index 81524342..876467a2 100644 --- a/gotypes/components.go +++ b/gotypes/components.go @@ -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") }