mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
Capture import params def
This commit is contained in:
parent
0bf833dae9
commit
b667753a32
6 changed files with 27 additions and 9 deletions
|
@ -22,6 +22,7 @@ use crate::pattern::{canonicalize_def_header_pattern, BindingsFromPattern, Patte
|
|||
use crate::procedure::QualifiedReference;
|
||||
use crate::procedure::References;
|
||||
use crate::scope::create_alias;
|
||||
use crate::scope::SymbolLookup;
|
||||
use crate::scope::{PendingAbilitiesInScope, Scope};
|
||||
use roc_collections::ReferenceMatrix;
|
||||
use roc_collections::VecMap;
|
||||
|
@ -2427,9 +2428,10 @@ fn canonicalize_pending_value_def<'a>(
|
|||
} => {
|
||||
// Insert a reference to the record so that we don't report it as unused
|
||||
// If the whole module is unused, we'll report that separately
|
||||
output
|
||||
.references
|
||||
.insert_value_lookup(symbol, QualifiedReference::Unqualified);
|
||||
output.references.insert_value_lookup(
|
||||
SymbolLookup::no_params(symbol),
|
||||
QualifiedReference::Unqualified,
|
||||
);
|
||||
|
||||
let (opt_var_record, references) = match opt_provided {
|
||||
Some(params) => {
|
||||
|
|
|
@ -1920,7 +1920,7 @@ fn canonicalize_var_lookup(
|
|||
Ok(lookup) => {
|
||||
output
|
||||
.references
|
||||
.insert_value_lookup(lookup.symbol, QualifiedReference::Unqualified);
|
||||
.insert_value_lookup(lookup, QualifiedReference::Unqualified);
|
||||
|
||||
if scope.abilities_store.is_ability_member_name(lookup.symbol) {
|
||||
AbilityMember(
|
||||
|
@ -1945,7 +1945,7 @@ fn canonicalize_var_lookup(
|
|||
Ok(lookup) => {
|
||||
output
|
||||
.references
|
||||
.insert_value_lookup(lookup.symbol, QualifiedReference::Qualified);
|
||||
.insert_value_lookup(lookup, QualifiedReference::Qualified);
|
||||
|
||||
if scope.abilities_store.is_ability_member_name(lookup.symbol) {
|
||||
AbilityMember(
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::expr::Expr;
|
||||
use crate::pattern::Pattern;
|
||||
use crate::{expr::Expr, scope::SymbolLookup};
|
||||
use roc_module::symbol::{ModuleId, Symbol};
|
||||
use roc_region::all::{Loc, Region};
|
||||
use roc_types::subs::Variable;
|
||||
|
@ -125,8 +125,18 @@ impl References {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn insert_value_lookup(&mut self, symbol: Symbol, qualified: QualifiedReference) {
|
||||
self.insert(symbol, qualified.flags(ReferencesBitflags::VALUE_LOOKUP));
|
||||
pub fn insert_value_lookup(&mut self, lookup: SymbolLookup, qualified: QualifiedReference) {
|
||||
self.insert(
|
||||
lookup.symbol,
|
||||
qualified.flags(ReferencesBitflags::VALUE_LOOKUP),
|
||||
);
|
||||
|
||||
if let Some((_, params_symbol)) = lookup.module_params {
|
||||
self.insert(
|
||||
params_symbol,
|
||||
qualified.flags(ReferencesBitflags::VALUE_LOOKUP),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn insert_type_lookup(&mut self, symbol: Symbol, qualified: QualifiedReference) {
|
||||
|
|
|
@ -774,7 +774,7 @@ impl ScopeModules {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct SymbolLookup {
|
||||
pub symbol: Symbol,
|
||||
pub module_params: Option<(Variable, Symbol)>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue