more meaningful error for empty contract state #289
Loading…
x
Reference in New Issue
Block a user
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?
Created by: nikita-fuchs
Currently for
I'm getting
Not sure about the sense behind this exactly, but as this is not an unlikely constellation, could we tell people something more meaningful in return ?
Created by: thepiwo
In
record state = {}
you have to define your type of state instead of the actual value of empty map@nikita-fuchs At first look I would not expect your code to show any error, I think
{}
should either construct an empty record or an empty map, depending on the type, but I'm not sure if this was done on purpose, or if it's a bug.Do you think that your code should pass? Or just fail with a clearer error message?
Btw, this error happens not only for empty contract state, but for all empty record constructions.
@UlfNorell Could you tell why
{}
is used for empty map construction (and not for empty record construction)? Should it also be used for empty record construction? And if not, how is it possible to construct an empty record?Created by: UlfNorell
I don't think there are any deep reasons for why it's not also allowed for an empty record. Empty maps are important to be able to construct, whereas the empty record type is mostly a curiosity, so I think we didn't want to spend the effort on making the type checker handle the overloading.