diff --git a/compiler/can/src/def.rs b/compiler/can/src/def.rs index 9235cd32ca..3d18978806 100644 --- a/compiler/can/src/def.rs +++ b/compiler/can/src/def.rs @@ -1594,8 +1594,7 @@ pub fn can_defs_with_return<'a>( // Now that we've collected all the references, check to see if any of the new idents // we defined went unused by the return expression. If any were unused, report it. for (symbol, region) in symbols_introduced { - if !output.references.has_value_lookup(symbol) - && !output.references.has_type_lookup(symbol) + if !output.references.has_type_or_value_lookup(symbol) && !scope.abilities_store.is_specialization_name(symbol) { env.problem(Problem::UnusedDef(symbol, region)); diff --git a/compiler/can/src/expr.rs b/compiler/can/src/expr.rs index e8db25e794..be8dd26648 100644 --- a/compiler/can/src/expr.rs +++ b/compiler/can/src/expr.rs @@ -1072,10 +1072,8 @@ fn canonicalize_when_branch<'a>( for (symbol, region) in scope.symbols() { let symbol = *symbol; - if !output.references.has_value_lookup(symbol) - && !output.references.has_type_lookup(symbol) - && !branch_output.references.has_value_lookup(symbol) - && !branch_output.references.has_type_lookup(symbol) + if !output.references.has_type_or_value_lookup(symbol) + && !branch_output.references.has_type_or_value_lookup(symbol) && !original_scope.contains_symbol(symbol) && !scope.abilities_store.is_specialization_name(symbol) { diff --git a/compiler/can/src/module.rs b/compiler/can/src/module.rs index fa901a6cec..b34aba4fc5 100644 --- a/compiler/can/src/module.rs +++ b/compiler/can/src/module.rs @@ -302,8 +302,7 @@ pub fn canonicalize_module_defs<'a>( // See if any of the new idents we defined went unused. // If any were unused and also not exposed, report it. for (symbol, region) in symbols_introduced { - if !output.references.has_value_lookup(symbol) - && !output.references.has_type_lookup(symbol) + if !output.references.has_type_or_value_lookup(symbol) && !exposed_symbols.contains(&symbol) && !scope.abilities_store.is_specialization_name(symbol) { diff --git a/compiler/can/src/procedure.rs b/compiler/can/src/procedure.rs index 97cf8f762b..778688d74f 100644 --- a/compiler/can/src/procedure.rs +++ b/compiler/can/src/procedure.rs @@ -153,7 +153,7 @@ impl References { false } - pub fn has_type_lookup(&self, symbol: Symbol) -> bool { + fn has_type_lookup(&self, symbol: Symbol) -> bool { let it = self.symbols.iter().zip(self.bitflags.iter()); for (a, b) in it {