Closed matthewhammer closed 3 years ago
Here is a small reproducer:
actor {
public func baz(b : Bool) : () {
ignore({b = b} : {})
};
}
It only happens if it is a shared function, so likely related to await/async translation.
I think the backend expects the exp.note.Note.typ
of a NewObjE Object
to be “tight”, and include every field (to find out whether it is mutable or not). But Check_ir
doesn’t enforce it, and the async/await translation breaks this.
Possible fixes:
We could change NewObjE
to include the mutability of fields in the source ast, so that the compiler doesn’t have to look at the type annotation (which, due to subtyping, is always a bit dodgy)
Given that NewObjE
behaves quite differently for immutable fiels (copy value) and mutable fiels (alias mutable values), this option seem to be the most robust.
@crusso what do you think?
Actually, there is an easier fix: Look at the type note on the field, not the object. Then not even subtyping can get into the way.
That branch has both fixes, one of them reverted. Claudio, do you have a hunch which one is preferable?
Taking a look
Some details here: https://github.com/dfinity/cancan/pull/70#issuecomment-774483364