You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An example of the error that happens when giving a type and function the same name is:
error[E0428]: the name `__SPEC_XDR_STATE` is defined multiple times
--> soroban-sdk/src/tests/contract_overlapping_type_fn_names.rs:12:1
|
5 | #[contracttype]
| --------------- previous definition of the value `__SPEC_XDR_STATE` here
...
12 | #[contractimpl]
| ^^^^^^^^^^^^^^^ `__SPEC_XDR_STATE` redefined here
### What
Change the names of the static variables that contain the spec XDR to
include a type or function qualifier for the kind of entry the spec
contains.
### Why
To allow same named types and functions in contracts. When a type and
function have the same name today they result in two static variables
that have the same names. Adding a qualifier to what they are to those
variables names will stop them from colliding.
Close#828
For example, if the getter method in https://github.com/stellar/soroban-examples/blob/main/custom_types/src/lib.rs were named
state
, you'd get an error. This seems like a common pattern people would hit (especially with the 10char limit for method names).The text was updated successfully, but these errors were encountered: