Change guard to DestructType

This commit is contained in:
Richard Feldman 2020-07-18 12:42:04 -04:00
parent 85f51ef39d
commit 8b53ec15fe
4 changed files with 69 additions and 16 deletions

View file

@ -941,7 +941,7 @@ fn canonicalize_field<'a>(
match field {
// Both a label and a value, e.g. `{ name: "blah" }`
LabeledValue(label, _, loc_expr) => {
RequiredValue(label, _, loc_expr) => {
let field_var = var_store.fresh();
let (loc_can_expr, output) =
canonicalize_expr(env, var_store, scope, loc_expr.region, &loc_expr.value);
@ -954,6 +954,10 @@ fn canonicalize_field<'a>(
)
}
OptionalValue(_, _, _) => {
todo!("TODO gracefully handle an optional field being used in an Expr");
}
// A label with no value, e.g. `{ name }` (this is sugar for { name: name })
LabelOnly(_) => {
panic!("Somehow a LabelOnly record field was not desugared!");