diff --git a/gnovm/pkg/gnolang/preprocess.go b/gnovm/pkg/gnolang/preprocess.go index a4e5eb33fda..f5a3287890b 100644 --- a/gnovm/pkg/gnolang/preprocess.go +++ b/gnovm/pkg/gnolang/preprocess.go @@ -896,7 +896,7 @@ func Preprocess(store Store, ctx BlockNode, n Node) Node { if lt.TypeID() != rt.TypeID() { panic(fmt.Sprintf( "incompatible types in binary expression: %v %v %v", - n.Left, n.Op, n.Right)) + lt.TypeID(), n.Op, rt.TypeID())) } pt := go2GnoBaseType(lnt.Type).(PrimitiveType) // convert n.Left to (gno) pt type, @@ -935,7 +935,7 @@ func Preprocess(store Store, ctx BlockNode, n Node) Node { if lt.TypeID() != rt.TypeID() { panic(fmt.Sprintf( "incompatible types in binary expression: %v %v %v", - n.Left, n.Op, n.Right)) + lt.TypeID(), n.Op, rt.TypeID())) } } else { checkOrConvertType(store, last, &n.Left, rt, false) @@ -948,7 +948,7 @@ func Preprocess(store Store, ctx BlockNode, n Node) Node { if lt.TypeID() != rt.TypeID() { panic(fmt.Sprintf( "incompatible types in binary expression: %v %v %v", - n.Left, n.Op, n.Right)) + lt.TypeID(), n.Op, rt.TypeID())) } } } diff --git a/gnovm/pkg/gnolang/preprocess_test.go b/gnovm/pkg/gnolang/preprocess_test.go index f577ce0d817..73dbb4dfc0e 100644 --- a/gnovm/pkg/gnolang/preprocess_test.go +++ b/gnovm/pkg/gnolang/preprocess_test.go @@ -30,11 +30,11 @@ func TestPrepocessBinaryExpressionPrimaryAndNative(t *testing.T) { import "time" func main() { var a int64 = 2 - println(a * time.Second) + println(time.Second * a) }` n := MustParseFile("main.go", c) - assert.Panics(t, func() { m.RunFiles(n) }, "should panic: invalid operation: int64 * time.Duration") + assert.Panics(t, func() { m.RunFiles(n) }) } func TestPrepocessBinaryExpressionNativeAndNative(t *testing.T) { @@ -62,5 +62,5 @@ func main() { }` n := MustParseFile("main.go", c) - assert.Panics(t, func() { m.RunFiles(n) }, "should panic: invalid operation: time.Month * time.Weekday") + assert.Panics(t, func() { m.RunFiles(n) }) } diff --git a/gnovm/tests/files/time16_native.gno b/gnovm/tests/files/time16_native.gno index 36fc7693d19..1789fcbef4f 100644 --- a/gnovm/tests/files/time16_native.gno +++ b/gnovm/tests/files/time16_native.gno @@ -11,4 +11,4 @@ func main() { } // Error: -// main/files/time16_native.gno:10: incompatible types in binary expression: time.Second MUL a +// main/files/time16_native.gno:10: incompatible types in binary expression: go:time.Duration MUL int64