From 69140c240be087be699511c8492b2e37621b2ee3 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Wed, 25 Apr 2018 19:49:54 +0200 Subject: [PATCH] Implement named binop types --- tgo.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tgo.go b/tgo.go index e2b51805..21762965 100644 --- a/tgo.go +++ b/tgo.go @@ -848,7 +848,11 @@ func (c *Compiler) parseBinOp(frame *Frame, binop *ssa.BinOp) (llvm.Value, error if err != nil { return llvm.Value{}, err } - signed := binop.X.Type().(*types.Basic).Info() & types.IsUnsigned == 0 + typ := binop.X.Type() + if typNamed, ok := typ.(*types.Named); ok { + typ = typNamed.Underlying() + } + signed := typ.(*types.Basic).Info() & types.IsUnsigned == 0 switch binop.Op { case token.ADD: // + return c.builder.CreateAdd(x, y, ""), nil