Skip to content
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions docs/cvl/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,20 @@ Child.ParentFileType invalid2; // user-defined types are not inherited
Parent.ChildFileType invalid3; // ChildFileType is not visible in Parent
```

```{note}
If two user-defined types in the {term}`scene` share the same qualified name but
have **different** definitions — for example two vendored libraries both named
Comment thread
shellygr marked this conversation as resolved.
Outdated
`Math`, one declaring `enum Rounding { Floor, Ceil, Trunc, Expand }` and the other
`enum Rounding { Down, Up, Zero }` — then `Math.Rounding` is ambiguous and is
rejected. (Same-named types with *identical* definitions are treated as one type
and remain usable.) To disambiguate, qualify the type by a contract that *imports*
the definition you want, rather than by the duplicated declaring library: if `Vault`
imports the first `Math`, then `Vault.Rounding` names that library's `Rounding`, and you can refer to fields using `Vault.Rounding.Floor`.
Solidity forbids importing two same-named libraries into one file except under
aliases, so a disambiguating contract normally imports just one of them; a contract
that (via aliases) imports both is itself ambiguous.
```

Additional CVL types
--------------------

Expand Down
Loading