Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix records type inference rules to match implementations. (#3613)
If the context of a record literal is the same shape as the record literal, but the actual type of one or more fields is not a subtype of the corresponding field in the context type, and no coercion is possible, then the implementations do not necessarily issue an error. They only issue an error if the type mismatch leads to an assignability error during subsequent analysis. An example of a circumstance where the type mismatch doesn't lead to an assignability error is if the context resulted from assignment to a previously promoted local variable. For example: f(Object o) { if (o is (int,)) { o = ('',); // OK; demotes `o` back to `Object`. } } This change adjusts the spec to agree with what was implemented.
- Loading branch information