-
Notifications
You must be signed in to change notification settings - Fork 375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP fix(gnovm): correct map key persistence #3127
base: master
Are you sure you want to change the base?
WIP fix(gnovm): correct map key persistence #3127
Conversation
another bug identified: // PKGPATH: gno.land/r/ptr_map
package ptr_map
import "fmt"
type MyStruct struct {
Name string
}
var (
m = map[[1]*MyStruct]string{}
i1 = &MyStruct{Name: "alice"}
key1 = [1]*MyStruct{i1}
)
func init() {
m[key1] = "first key"
}
func main() {
fmt.Println("Value for key1:", m[key1])
}
// Error:
// interface conversion: gnolang.Value is gnolang.RefValue, not *gnolang.ArrayValue this if fixed. |
also this, is it counterintuitive? // PKGPATH: gno.land/r/ptr_map
package ptr_map
type MyStruct struct {
Name string
}
var (
m = map[[1]*MyStruct]string{}
i1 = &MyStruct{Name: "alice"}
)
func main() {
// Create an array of pointers to MyStruct
key1 := [1]*MyStruct{i1}
m[key1] = "first key"
}
// Error:
// unexpected unreal object this is fixed but should consider the side effects on storage. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3127 +/- ##
=======================================
Coverage 63.34% 63.34%
=======================================
Files 548 548
Lines 78680 78655 -25
=======================================
- Hits 49836 49826 -10
+ Misses 25482 25466 -16
- Partials 3362 3363 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
closes: #2060
Contributors' checklist...
BREAKING CHANGE: xxx
message was included in the description