diff --git a/gnovm/pkg/gnolang/preprocess.go b/gnovm/pkg/gnolang/preprocess.go index ba60ead28f6..d7b52e3eed9 100644 --- a/gnovm/pkg/gnolang/preprocess.go +++ b/gnovm/pkg/gnolang/preprocess.go @@ -1207,6 +1207,9 @@ func Preprocess(store Store, ctx BlockNode, n Node) Node { "incompatible types in binary expression: %v %v %v", lt.TypeID(), n.Op, rt.TypeID())) } + // convert untyped to typed + checkOrConvertType(store, last, &n.Left, defaultTypeOf(lt), false) + checkOrConvertType(store, last, &n.Right, defaultTypeOf(rt), false) } else { // left untyped, right typed checkOrConvertType(store, last, &n.Left, rt, false) } diff --git a/gnovm/tests/files/types/eql_0f49.gno b/gnovm/tests/files/types/eql_0f49.gno new file mode 100644 index 00000000000..b5a4bf4ed05 --- /dev/null +++ b/gnovm/tests/files/types/eql_0f49.gno @@ -0,0 +1,21 @@ +package main + +func main() { + a := "1234" + b := "1234" + + cond := a == b + println(cond) + println(cond == (a == b)) + println((a == b) == cond) + println((a == b) == (a == b)) + println(cond && (a == b)) + println(cond || (a > b)) + +} + +// true +// true +// true +// true +// true