Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/noirc_frontend/src/elaborator/patterns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ impl<'context> Elaborator<'context> {
HirPattern::Mutable(Box::new(pattern), location)
}
Pattern::Tuple(fields, span) => {
let field_types = match expected_type {
let field_types = match expected_type.follow_bindings() {
Type::Tuple(fields) => fields,
Type::Error => Vec::new(),
expected_type => {
Expand Down
10 changes: 6 additions & 4 deletions compiler/noirc_frontend/src/elaborator/statements.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,13 @@ impl<'context> Elaborator<'context> {

// To apply the changes from the fresh id created in elaborate_let to this global
// we need to change the definition kind and update the type.
let definition_id = self.interner.get_global(global_id).definition_id;
self.interner.definition_mut(definition_id).kind = DefinitionKind::Global(global_id);

assert_eq!(new_ids.len(), 1, "Globals should only define 1 value");
let definition_type = self.interner.definition_type(new_ids[0].id);
let new_id = new_ids[0].id;

self.interner.definition_mut(new_id).kind = DefinitionKind::Global(global_id);

let definition_id = self.interner.get_global(global_id).definition_id;
let definition_type = self.interner.definition_type(new_id);
self.interner.push_definition_type(definition_id, definition_type);

self.interner.replace_statement(statement_id, let_statement);
Expand Down