Skip to content

Commit

Permalink
fixup from merge
Browse files Browse the repository at this point in the history
  • Loading branch information
thehowl committed Feb 18, 2025
1 parent dc5c8fc commit 72ae6d1
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 13 deletions.
9 changes: 1 addition & 8 deletions gnovm/pkg/gnolang/preprocess.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion gnovm/tests/files/convert4.gno
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion gnovm/tests/files/convert5.gno
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion gnovm/tests/files/types/typed_nil_a.gno
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion gnovm/tests/files/types/typed_nil_b.gno
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion gnovm/tests/files/types/typed_nil_c.gno
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 72ae6d1

Please sign in to comment.