Formatting
This commit is contained in:
@@ -487,7 +487,10 @@ impl Binder {
|
|||||||
},
|
},
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
_ => Err(format!("Invalid node in assignment pattern: {:?}", node.kind)),
|
_ => Err(format!(
|
||||||
|
"Invalid node in assignment pattern: {:?}",
|
||||||
|
node.kind
|
||||||
|
)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -103,17 +103,15 @@ impl Optimizer {
|
|||||||
BoundKind::DefGlobal { global_index, .. } => {
|
BoundKind::DefGlobal { global_index, .. } => {
|
||||||
info.assigned_globals.insert(*global_index);
|
info.assigned_globals.insert(*global_index);
|
||||||
}
|
}
|
||||||
BoundKind::Set { addr, .. } => {
|
BoundKind::Set { addr, .. } => match addr {
|
||||||
match addr {
|
Address::Local(slot) => {
|
||||||
Address::Local(slot) => {
|
info.assigned_locals.insert(*slot);
|
||||||
info.assigned_locals.insert(*slot);
|
|
||||||
}
|
|
||||||
Address::Global(idx) => {
|
|
||||||
info.assigned_globals.insert(*idx);
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
}
|
Address::Global(idx) => {
|
||||||
|
info.assigned_globals.insert(*idx);
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
},
|
||||||
BoundKind::Tuple { elements } => {
|
BoundKind::Tuple { elements } => {
|
||||||
for el in elements {
|
for el in elements {
|
||||||
self.collect_pattern_usage(el, info);
|
self.collect_pattern_usage(el, info);
|
||||||
|
|||||||
@@ -163,7 +163,10 @@ impl TypeChecker {
|
|||||||
specialized_ty.clone(),
|
specialized_ty.clone(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
BoundKind::Set { addr, value: _value } => {
|
BoundKind::Set {
|
||||||
|
addr,
|
||||||
|
value: _value,
|
||||||
|
} => {
|
||||||
// In an assignment pattern, 'value' is just a Nop placeholder from the Binder.
|
// In an assignment pattern, 'value' is just a Nop placeholder from the Binder.
|
||||||
// We update the type of the address (if it's a local or global) to match the specialized type.
|
// We update the type of the address (if it's a local or global) to match the specialized type.
|
||||||
// Note: For now, we assume assignments are compatible if types were already inferred,
|
// Note: For now, we assume assignments are compatible if types were already inferred,
|
||||||
|
|||||||
Reference in New Issue
Block a user