mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-04 02:57:46 +00:00
compiler: fix binops on named types in struct fields
This commit is contained in:
@@ -2225,7 +2225,7 @@ func (c *Compiler) parseExpr(frame *Frame, expr ssa.Value) (llvm.Value, error) {
|
||||
if err != nil {
|
||||
return llvm.Value{}, err
|
||||
}
|
||||
return c.parseBinOp(expr.Op, expr.X.Type().Underlying(), x, y)
|
||||
return c.parseBinOp(expr.Op, expr.X.Type(), x, y)
|
||||
case *ssa.Call:
|
||||
// Passing the current task here to the subroutine. It is only used when
|
||||
// the subroutine is blocking.
|
||||
@@ -2711,7 +2711,7 @@ func (c *Compiler) parseExpr(frame *Frame, expr ssa.Value) (llvm.Value, error) {
|
||||
}
|
||||
|
||||
func (c *Compiler) parseBinOp(op token.Token, typ types.Type, x, y llvm.Value) (llvm.Value, error) {
|
||||
switch typ := typ.(type) {
|
||||
switch typ := typ.Underlying().(type) {
|
||||
case *types.Basic:
|
||||
if typ.Info()&types.IsInteger != 0 {
|
||||
// Operations on integers
|
||||
|
||||
Vendored
+3
-1
@@ -58,8 +58,10 @@ var s2 = Struct2{"foo", 0.0, 5}
|
||||
|
||||
var a1 = [2]int{1, 2}
|
||||
|
||||
type Int int
|
||||
|
||||
type Struct1 struct {
|
||||
i int
|
||||
i Int
|
||||
b bool
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user