diff --git a/compiler/go.mod b/compiler/go.mod index 01c2b18d..9e24daab 100644 --- a/compiler/go.mod +++ b/compiler/go.mod @@ -1,6 +1,6 @@ module github.com/goplus/llgo/compiler -go 1.23 +go 1.22.0 require ( github.com/goplus/gogen v1.16.4 diff --git a/compiler/ssa/package.go b/compiler/ssa/package.go index e8d8ed71..abc6a291 100644 --- a/compiler/ssa/package.go +++ b/compiler/ssa/package.go @@ -283,7 +283,7 @@ func (p Program) rtNamed(name string) *types.Named { t := p.runtime().Scope().Lookup(name).Type() for { if alias, ok := t.(*types.Alias); ok { - t = alias.Rhs() + t = types.Unalias(alias) } else { break } diff --git a/compiler/ssa/type.go b/compiler/ssa/type.go index 60a39d7a..900fa542 100644 --- a/compiler/ssa/type.go +++ b/compiler/ssa/type.go @@ -388,6 +388,8 @@ func (p Program) toType(raw types.Type) Type { return &aType{llvm.ArrayType(elem.ll, int(t.Len())), typ, vkArray} case *types.Chan: return &aType{llvm.PointerType(p.rtChan(), 0), typ, vkChan} + case *types.Alias: + return p.toType(types.Unalias(t)) } panic(fmt.Sprintf("toLLVMType: todo - %T\n", raw)) } diff --git a/compiler/ssa/type_cvt.go b/compiler/ssa/type_cvt.go index eb347cae..454266a7 100644 --- a/compiler/ssa/type_cvt.go +++ b/compiler/ssa/type_cvt.go @@ -115,6 +115,8 @@ func (p goTypes) cvtType(typ types.Type) (raw types.Type, cvt bool) { return p.cvtTuple(t) case *types.TypeParam: return typ.Underlying(), false + case *types.Alias: + return types.Unalias(t), true default: panic(fmt.Sprintf("cvtType: unexpected type - %T", typ)) }