Open yonadaaa opened 1 year ago
This is expected, see #677 and #698 for context. Unclear if we can work around this, since we can't import from the system file in the system interface. (I guess one possible workaround might be to let codegen duplicate the struct definitions into the interface files, but that seems not very clean and not sure if a better solution than just asking consumers to define structs in separate files, like a local Types.sol
)
We can probably log a better explanation, but yeah there isn't really a workaround. Duplicating the struct would be horrible devex for calling the system from World, unlike typescript solidity won't consider those structs interchangeable
asking consumers to define structs in separate files, like a local Types.sol
This isn't a bad idea! I wasn't sure where to put the struct instead.
We can probably log a better explanation
Yup, if the error was better I would have moved on and put it in another file, but I thought it was a bug.
This really should "just work" but as long as we document it, I'm happy to close this.
I want to define a struct and a function that returns that datatype in the same file like so:
However, codegen fails and seems to expect this struct to be imported, with:
MUDError: Function "sync" in contract "SyncSystem": Symbol "Record" has no explicit import
This does not occur if I define the struct in another local file.