mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-16 02:33:28 +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 {
|
if err != nil {
|
||||||
return llvm.Value{}, err
|
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:
|
case *ssa.Call:
|
||||||
// Passing the current task here to the subroutine. It is only used when
|
// Passing the current task here to the subroutine. It is only used when
|
||||||
// the subroutine is blocking.
|
// 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) {
|
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:
|
case *types.Basic:
|
||||||
if typ.Info()&types.IsInteger != 0 {
|
if typ.Info()&types.IsInteger != 0 {
|
||||||
// Operations on integers
|
// Operations on integers
|
||||||
|
|||||||
Vendored
+3
-1
@@ -58,8 +58,10 @@ var s2 = Struct2{"foo", 0.0, 5}
|
|||||||
|
|
||||||
var a1 = [2]int{1, 2}
|
var a1 = [2]int{1, 2}
|
||||||
|
|
||||||
|
type Int int
|
||||||
|
|
||||||
type Struct1 struct {
|
type Struct1 struct {
|
||||||
i int
|
i Int
|
||||||
b bool
|
b bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user