From 72ae6d1f2e7e10e4e6cb80809890ac2da35de1d8 Mon Sep 17 00:00:00 2001 From: Morgan Bazalgette Date: Tue, 18 Feb 2025 18:51:37 +0100 Subject: [PATCH] fixup from merge --- gnovm/pkg/gnolang/preprocess.go | 9 +-------- gnovm/tests/files/convert4.gno | 2 +- gnovm/tests/files/convert5.gno | 2 +- gnovm/tests/files/types/typed_nil_a.gno | 2 +- gnovm/tests/files/types/typed_nil_b.gno | 2 +- gnovm/tests/files/types/typed_nil_c.gno | 2 +- 6 files changed, 6 insertions(+), 13 deletions(-) diff --git a/gnovm/pkg/gnolang/preprocess.go b/gnovm/pkg/gnolang/preprocess.go index 9b3d5b2c408..7a23bb35cdd 100644 --- a/gnovm/pkg/gnolang/preprocess.go +++ b/gnovm/pkg/gnolang/preprocess.go @@ -1407,7 +1407,7 @@ func preprocess1(store Store, ctx BlockNode, n Node) Node { if arg0.IsUndefined() { switch ct.Kind() { // special case for nil conversion check. case SliceKind, PointerKind, FuncKind, MapKind, InterfaceKind, ChanKind: - convertConst(store, last, arg0, ct) + convertConst(store, last, n, arg0, ct) default: panic(fmt.Sprintf( "cannot convert %v to %v", @@ -1710,13 +1710,6 @@ func preprocess1(store Store, ctx BlockNode, n Node) Node { checkOrConvertType(store, last, n, &n.X, dt, false) } - // if n.X is untyped, convert to corresponding type - t := evalStaticTypeOf(store, last, n.X) - if isUntyped(t) { - dt := defaultTypeOf(t) - checkOrConvertType(store, last, &n.X, dt, false) - } - // TRANS_LEAVE ----------------------- case *TypeAssertExpr: if n.Type == nil { diff --git a/gnovm/tests/files/convert4.gno b/gnovm/tests/files/convert4.gno index e03e1d07ce3..03c7d454b82 100644 --- a/gnovm/tests/files/convert4.gno +++ b/gnovm/tests/files/convert4.gno @@ -5,4 +5,4 @@ func main() { } // Error: -// main/files/convert4.gno:4:10: cannot convert (undefined) to int +// main/files/convert4.gno:4:10: cannot convert (const (undefined)) to IntKind diff --git a/gnovm/tests/files/convert5.gno b/gnovm/tests/files/convert5.gno index e2e16c5eb83..1e785abdd7b 100644 --- a/gnovm/tests/files/convert5.gno +++ b/gnovm/tests/files/convert5.gno @@ -7,4 +7,4 @@ func main() { } // Error: -// main/files/convert5.gno:3:1: cannot convert (undefined) to int +// main/files/convert5.gno:3:1: cannot convert (const (undefined)) to IntKind diff --git a/gnovm/tests/files/types/typed_nil_a.gno b/gnovm/tests/files/types/typed_nil_a.gno index 6452b432911..f212c677bab 100644 --- a/gnovm/tests/files/types/typed_nil_a.gno +++ b/gnovm/tests/files/types/typed_nil_a.gno @@ -15,4 +15,4 @@ func main() { } // Error: -// main/files/types/typed_nil_a.gno:10:5: cannot convert (undefined) to main.integer +// main/files/types/typed_nil_a.gno:10:5: cannot convert (const (undefined)) to IntKind diff --git a/gnovm/tests/files/types/typed_nil_b.gno b/gnovm/tests/files/types/typed_nil_b.gno index 9dabc54c7dd..fb1492dd02b 100644 --- a/gnovm/tests/files/types/typed_nil_b.gno +++ b/gnovm/tests/files/types/typed_nil_b.gno @@ -7,7 +7,7 @@ type integer *int func main() { println(integer(nil)) fmt.Println(integer(nil)) - fmt.Printf("%T \n", integer(nil)) + fmt.Printf("%T\n", integer(nil)) } // Output: diff --git a/gnovm/tests/files/types/typed_nil_c.gno b/gnovm/tests/files/types/typed_nil_c.gno index a08623ed03d..c8a556ea0c1 100644 --- a/gnovm/tests/files/types/typed_nil_c.gno +++ b/gnovm/tests/files/types/typed_nil_c.gno @@ -4,7 +4,7 @@ import "fmt" func main() { println(interface{}(nil) == (*int)(nil)) - fmt.Printf("%T \n", interface{}(nil)) + fmt.Printf("%T\n", interface{}(nil)) } // Output: