Skip to content

Commit

Permalink
fix: Corrected the comparison between an untyped constant and an inte…
Browse files Browse the repository at this point in the history
…rface (gnolang#1732)

This error is identified by gnolang#1426, here is a quick fix.
It can also be seen as the beginning of a refactoring effort on gnolang#1426 to
break it down into smaller ones.

Reproduction of this issue:
```go
package main

func foo() uint64 {
	return 100
}

func bar() interface{} {
	return foo()
}

func main() {
	println(100 == bar())

	println(100 == foo())

	println(uint64(100) == bar())

}
```
https://go.dev/play/p/ftkZeNziwdM

Co-authored-by: Miloš Živković <[email protected]>
  • Loading branch information
ltzmaxwell and zivkovicmilos authored Mar 27, 2024
1 parent bfc9e2c commit 55056c5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions examples/gno.land/r/demo/foo1155/foo1155_test.gno
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ func TestFoo721(t *testing.T) {
expected interface{}
fn func() interface{}
}{
{"BalanceOf(admin, tid1)", 100, func() interface{} { return BalanceOf(admin, tid1) }},
{"BalanceOf(bob, tid1)", 0, func() interface{} { return BalanceOf(bob, tid1) }},
{"BalanceOf(admin, tid1)", uint64(100), func() interface{} { return BalanceOf(admin, tid1) }},
{"BalanceOf(bob, tid1)", uint64(0), func() interface{} { return BalanceOf(bob, tid1) }},
{"IsApprovedForAll(admin, bob)", false, func() interface{} { return IsApprovedForAll(admin, bob) }},
} {
t.Run(tc.name, func(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions examples/gno.land/r/demo/foo721/foo721_test.gno
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ func TestFoo721(t *testing.T) {
expected interface{}
fn func() interface{}
}{
{"BalanceOf(admin)", 10, func() interface{} { return BalanceOf(admin) }},
{"BalanceOf(hariom)", 5, func() interface{} { return BalanceOf(hariom) }},
{"BalanceOf(admin)", uint64(10), func() interface{} { return BalanceOf(admin) }},
{"BalanceOf(hariom)", uint64(5), func() interface{} { return BalanceOf(hariom) }},
{"OwnerOf(0)", users.Resolve(admin), func() interface{} { return OwnerOf(grc721.TokenID("0")) }},
{"IsApprovedForAll(admin, hariom)", false, func() interface{} { return IsApprovedForAll(admin, hariom) }},
} {
Expand Down

0 comments on commit 55056c5

Please sign in to comment.