mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2026-03-01 04:28:51 +00:00
Ensure star type assertion is handled properly #1228
Labels
No labels
I1
I2
I3
I4
S1
S2
S3
S4
U0
U1
U2
U3
U3
U4
blocked
bug
bug
cli
compiler
config
config
consensus
dependencies
discussion
documentation
enhancement
epic
feature
go
good first issue
help wanted
neotest
network
oracle
performance
question
rpc
security
smartcontract
task
task
task
test
vm
wallet
windows
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nspcc-dev/neo-go#1228
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @AnnaShaleva on GitHub (Dec 4, 2023).
Is your feature request related to a problem? Please describe.
Suppose we have a structure declared in the contract:
And suppose we have the following method:
The result of compilation is invalid script:
The wrong line is the conversion of structure got after
std.DeserializetoAny(which is the pointer toUserKey).Describe the solution you'd like
The desired result is to convert the structure got after
std.Deserializedirectly to theUserKeystructure if it's not nil. The case is that this code is very similar to the one that we have in our interop package:nspcc-dev/neo-go@9a270ae30c/pkg/interop/native/ledger/ledger.go (L42-L44)However, the interop API works fine.
@roman-khimov commented on GitHub (Dec 4, 2023):
Interops are inlined and IIRC there is some special code to handle interop data types, but in general your example should work, so it's just a bug in pointer handling.
@roman-khimov commented on GitHub (Sep 12, 2024):
The workaround from https://github.com/nspcc-dev/neo-go/issues/3580#issuecomment-2341916070 doesn't really work, btw (nothing is copied, NULLs are left in the struct). Field-by-field assignments do work.