forked from gnolang/gno
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(gnovm): in op_binary, return typed booleans where appropriate (gn…
…olang#3298) bool8.gno was failing, because the result of the `==` expression is an untyped boolean, while the first value is a typed boolean. This PR ensures that if either of the values in a binary expression is typed, we return a typed bool instead of an untyped bool. --------- Co-authored-by: ltzmaxwell <[email protected]>
- Loading branch information
1 parent
c33cf67
commit 7185cef
Showing
2 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package main | ||
|
||
// results from comparisons should not be untyped bools | ||
|
||
var a interface{} = true | ||
|
||
func main() { | ||
buf := "hello=" | ||
isEqual(a, (buf[len(buf)-1] == '=')) | ||
} | ||
|
||
func isEqual(v1, v2 interface{}) { | ||
println("v1 == v2", v1 == v2) | ||
} | ||
|
||
// Output: | ||
// v1 == v2 true |