Add module_path to can env instead of threading it through

This commit is contained in:
Agus Zubiaga 2024-04-21 10:30:34 -03:00
parent e5789158e5
commit 5112e064e5
No known key found for this signature in database
7 changed files with 76 additions and 194 deletions

View file

@ -57,6 +57,7 @@ use roc_types::types::{Alias, Type};
use std::fmt::Debug;
use std::fs;
use std::io;
use std::path::PathBuf;
#[derive(Clone, Debug)]
pub struct Def {
@ -940,7 +941,6 @@ pub(crate) fn canonicalize_defs<'a>(
scope: &mut Scope,
loc_defs: &'a mut roc_parse::ast::Defs<'a>,
pattern_type: PatternType,
module_path: &str,
) -> (
CanDefs,
Output,
@ -1001,7 +1001,6 @@ pub(crate) fn canonicalize_defs<'a>(
&pending_abilities_in_scope,
&mut output,
pattern_type,
module_path,
);
pending_value_defs.push(Loc::at(region, pending));
@ -1041,7 +1040,6 @@ pub(crate) fn canonicalize_defs<'a>(
pattern_type,
aliases,
symbols_introduced,
module_path,
)
}
@ -1055,7 +1053,6 @@ fn canonicalize_value_defs<'a>(
pattern_type: PatternType,
mut aliases: VecMap<Symbol, Alias>,
mut symbols_introduced: MutMap<Symbol, Region>,
module_path: &str,
) -> (
CanDefs,
Output,
@ -1141,7 +1138,6 @@ fn canonicalize_value_defs<'a>(
var_store,
pattern_type,
&mut aliases,
module_path,
);
output = temp_output.output;
@ -1162,7 +1158,6 @@ fn canonicalize_value_defs<'a>(
scope,
pending.condition.region,
&pending.condition.value,
module_path,
);
dbgs.push(loc_can_condition, pending.preceding_comment);
@ -1177,7 +1172,6 @@ fn canonicalize_value_defs<'a>(
scope,
pending.condition.region,
&pending.condition.value,
module_path,
);
expects.push(loc_can_condition, pending.preceding_comment);
@ -1192,7 +1186,6 @@ fn canonicalize_value_defs<'a>(
scope,
pending.condition.region,
&pending.condition.value,
module_path,
);
expects_fx.push(loc_can_condition, pending.preceding_comment);
@ -2187,7 +2180,6 @@ fn canonicalize_pending_value_def<'a>(
var_store: &mut VarStore,
pattern_type: PatternType,
aliases: &mut VecMap<Symbol, Alias>,
module_path: &str,
) -> DefOutput {
use PendingValueDef::*;
@ -2327,7 +2319,6 @@ fn canonicalize_pending_value_def<'a>(
loc_can_pattern,
loc_expr,
Some(Loc::at(loc_ann.region, type_annotation)),
module_path,
)
}
Body(loc_can_pattern, loc_expr) => {
@ -2340,7 +2331,6 @@ fn canonicalize_pending_value_def<'a>(
loc_can_pattern,
loc_expr,
None,
module_path,
)
}
};
@ -2373,7 +2363,6 @@ fn canonicalize_pending_body<'a>(
loc_expr: &'a Loc<ast::Expr>,
opt_loc_annotation: Option<Loc<crate::annotation::Annotation>>,
module_path: &str,
) -> DefOutput {
let mut loc_value = &loc_expr.value;
@ -2406,7 +2395,6 @@ fn canonicalize_pending_body<'a>(
arguments,
body,
Some(*defined_symbol),
module_path,
);
// reset the tailcallable_symbol
@ -2464,14 +2452,8 @@ fn canonicalize_pending_body<'a>(
}
_ => {
let (loc_can_expr, can_output) = canonicalize_expr(
env,
var_store,
scope,
loc_expr.region,
&loc_expr.value,
module_path,
);
let (loc_can_expr, can_output) =
canonicalize_expr(env, var_store, scope, loc_expr.region, &loc_expr.value);
let def_references = DefReferences::Value(can_output.references.clone());
output.union(can_output);
@ -2508,7 +2490,6 @@ pub fn can_defs_with_return<'a>(
scope: &mut Scope,
loc_defs: &'a mut Defs<'a>,
loc_ret: &'a Loc<ast::Expr<'a>>,
module_path: &str,
) -> (Expr, Output) {
let (unsorted, defs_output, symbols_introduced, imports_introduced) = canonicalize_defs(
env,
@ -2517,19 +2498,12 @@ pub fn can_defs_with_return<'a>(
scope,
loc_defs,
PatternType::DefExpr,
module_path,
);
// The def as a whole is a tail call iff its return expression is a tail call.
// Use its output as a starting point because its tail_call already has the right answer!
let (ret_expr, mut output) = canonicalize_expr(
env,
var_store,
scope,
loc_ret.region,
&loc_ret.value,
module_path,
);
let (ret_expr, mut output) =
canonicalize_expr(env, var_store, scope, loc_ret.region, &loc_ret.value);
output
.introduced_variables
@ -2858,7 +2832,6 @@ fn to_pending_value_def<'a>(
pending_abilities_in_scope: &PendingAbilitiesInScope,
output: &mut Output,
pattern_type: PatternType,
module_path: &str,
) -> PendingValue<'a> {
use ast::ValueDef::*;
@ -2874,7 +2847,6 @@ fn to_pending_value_def<'a>(
pattern_type,
&loc_pattern.value,
loc_pattern.region,
module_path,
);
PendingValue::Def(PendingValueDef::AnnotationOnly(
@ -2894,7 +2866,6 @@ fn to_pending_value_def<'a>(
pattern_type,
&loc_pattern.value,
loc_pattern.region,
module_path,
);
PendingValue::Def(PendingValueDef::Body(loc_can_pattern, loc_expr))
@ -2924,7 +2895,6 @@ fn to_pending_value_def<'a>(
pattern_type,
&body_pattern.value,
body_pattern.region,
module_path,
);
PendingValue::Def(PendingValueDef::TypedBody(
@ -3089,7 +3059,7 @@ fn to_pending_value_def<'a>(
IngestedFileImport(ingested_file) => {
let file_path =
if let ast::StrLiteral::PlainLine(ingested_path) = ingested_file.path.value {
let mut file_path = std::path::PathBuf::from(module_path);
let mut file_path: PathBuf = env.module_path.into();
// Remove the header file name and push the new path.
file_path.pop();
file_path.push(ingested_path);
@ -3144,7 +3114,6 @@ fn to_pending_value_def<'a>(
pattern_type,
&body_pattern.value,
region,
module_path,
);
PendingValue::Def(PendingValueDef::TypedBody(

View file

@ -1,3 +1,5 @@
use std::path::Path;
use crate::procedure::References;
use crate::scope::Scope;
use bumpalo::Bump;
@ -13,6 +15,8 @@ pub struct Env<'a> {
/// are assumed to be relative to this path.
pub home: ModuleId,
pub module_path: &'a Path,
pub dep_idents: &'a IdentIdsByModule,
pub qualified_module_ids: &'a PackageModuleIds<'a>,
@ -43,6 +47,7 @@ impl<'a> Env<'a> {
pub fn new(
arena: &'a Bump,
home: ModuleId,
module_path: &'a Path,
dep_idents: &'a IdentIdsByModule,
qualified_module_ids: &'a PackageModuleIds<'a>,
opt_shorthand: Option<&'a str>,
@ -50,6 +55,7 @@ impl<'a> Env<'a> {
Env {
arena,
home,
module_path,
dep_idents,
qualified_module_ids,
problems: Vec::new(),

View file

@ -619,7 +619,6 @@ pub fn canonicalize_expr<'a>(
scope: &mut Scope,
region: Region,
expr: &'a ast::Expr<'a>,
module_path: &str,
) -> (Loc<Expr>, Output) {
use Expr::*;
@ -641,8 +640,7 @@ pub fn canonicalize_expr<'a>(
if fields.is_empty() {
(EmptyRecord, Output::default())
} else {
match canonicalize_fields(env, var_store, scope, region, fields.items, module_path)
{
match canonicalize_fields(env, var_store, scope, region, fields.items) {
Ok((can_fields, output)) => (
Record {
record_var: var_store.fresh(),
@ -670,17 +668,10 @@ pub fn canonicalize_expr<'a>(
fields,
update: loc_update,
} => {
let (can_update, update_out) = canonicalize_expr(
env,
var_store,
scope,
loc_update.region,
&loc_update.value,
module_path,
);
let (can_update, update_out) =
canonicalize_expr(env, var_store, scope, loc_update.region, &loc_update.value);
if let Var(symbol, _) = &can_update.value {
match canonicalize_fields(env, var_store, scope, region, fields.items, module_path)
{
match canonicalize_fields(env, var_store, scope, region, fields.items) {
Ok((can_fields, mut output)) => {
output.references.union_mut(&update_out.references);
@ -726,14 +717,8 @@ pub fn canonicalize_expr<'a>(
let mut references = References::new();
for loc_elem in fields.iter() {
let (can_expr, elem_out) = canonicalize_expr(
env,
var_store,
scope,
loc_elem.region,
&loc_elem.value,
module_path,
);
let (can_expr, elem_out) =
canonicalize_expr(env, var_store, scope, loc_elem.region, &loc_elem.value);
references.union_mut(&elem_out.references);
@ -755,7 +740,7 @@ pub fn canonicalize_expr<'a>(
)
}
ast::Expr::Str(literal) => flatten_str_literal(env, var_store, scope, literal, module_path),
ast::Expr::Str(literal) => flatten_str_literal(env, var_store, scope, literal),
ast::Expr::IngestedFile(file_path, _) => match File::open(file_path) {
Ok(mut file) => {
@ -842,14 +827,8 @@ pub fn canonicalize_expr<'a>(
let mut references = References::new();
for loc_elem in loc_elems.iter() {
let (can_expr, elem_out) = canonicalize_expr(
env,
var_store,
scope,
loc_elem.region,
&loc_elem.value,
module_path,
);
let (can_expr, elem_out) =
canonicalize_expr(env, var_store, scope, loc_elem.region, &loc_elem.value);
references.union_mut(&elem_out.references);
@ -881,14 +860,8 @@ pub fn canonicalize_expr<'a>(
let mut output = Output::default();
for loc_arg in loc_args.iter() {
let (arg_expr, arg_out) = canonicalize_expr(
env,
var_store,
scope,
loc_arg.region,
&loc_arg.value,
module_path,
);
let (arg_expr, arg_out) =
canonicalize_expr(env, var_store, scope, loc_arg.region, &loc_arg.value);
args.push((var_store.fresh(), arg_expr));
output.references.union_mut(&arg_out.references);
@ -941,14 +914,8 @@ pub fn canonicalize_expr<'a>(
let mut output = Output::default();
for loc_arg in loc_args.iter() {
let (arg_expr, arg_out) = canonicalize_expr(
env,
var_store,
scope,
loc_arg.region,
&loc_arg.value,
module_path,
);
let (arg_expr, arg_out) =
canonicalize_expr(env, var_store, scope, loc_arg.region, &loc_arg.value);
args.push(arg_expr);
output.references.union_mut(&arg_out.references);
@ -982,7 +949,7 @@ pub fn canonicalize_expr<'a>(
} else {
// Canonicalize the function expression and its arguments
let (fn_expr, fn_expr_output) =
canonicalize_expr(env, var_store, scope, fn_region, &loc_fn.value, module_path);
canonicalize_expr(env, var_store, scope, fn_region, &loc_fn.value);
output.union(fn_expr_output);
@ -1100,14 +1067,7 @@ pub fn canonicalize_expr<'a>(
// The body expression gets a new scope for canonicalization,
scope.inner_scope(|inner_scope| {
let defs: Defs = (*loc_defs).clone();
can_defs_with_return(
env,
var_store,
inner_scope,
env.arena.alloc(defs),
loc_ret,
module_path,
)
can_defs_with_return(env, var_store, inner_scope, env.arena.alloc(defs), loc_ret)
})
}
ast::Expr::RecordBuilder(_) => {
@ -1117,29 +1077,16 @@ pub fn canonicalize_expr<'a>(
internal_error!("Backpassing should have been desugared by now")
}
ast::Expr::Closure(loc_arg_patterns, loc_body_expr) => {
let (closure_data, output) = canonicalize_closure(
env,
var_store,
scope,
loc_arg_patterns,
loc_body_expr,
None,
module_path,
);
let (closure_data, output) =
canonicalize_closure(env, var_store, scope, loc_arg_patterns, loc_body_expr, None);
(Closure(closure_data), output)
}
ast::Expr::When(loc_cond, branches) => {
// Infer the condition expression's type.
let cond_var = var_store.fresh();
let (can_cond, mut output) = canonicalize_expr(
env,
var_store,
scope,
loc_cond.region,
&loc_cond.value,
module_path,
);
let (can_cond, mut output) =
canonicalize_expr(env, var_store, scope, loc_cond.region, &loc_cond.value);
// the condition can never be a tail-call
output.tail_call = None;
@ -1155,7 +1102,6 @@ pub fn canonicalize_expr<'a>(
region,
branch,
&mut output,
module_path,
)
});
@ -1185,8 +1131,7 @@ pub fn canonicalize_expr<'a>(
(expr, output)
}
ast::Expr::RecordAccess(record_expr, field) => {
let (loc_expr, output) =
canonicalize_expr(env, var_store, scope, region, record_expr, module_path);
let (loc_expr, output) = canonicalize_expr(env, var_store, scope, region, record_expr);
(
RecordAccess {
@ -1215,8 +1160,7 @@ pub fn canonicalize_expr<'a>(
Output::default(),
),
ast::Expr::TupleAccess(tuple_expr, field) => {
let (loc_expr, output) =
canonicalize_expr(env, var_store, scope, region, tuple_expr, module_path);
let (loc_expr, output) = canonicalize_expr(env, var_store, scope, region, tuple_expr);
(
TupleAccess {
@ -1286,14 +1230,8 @@ pub fn canonicalize_expr<'a>(
ast::Expr::Expect(condition, continuation) => {
let mut output = Output::default();
let (loc_condition, output1) = canonicalize_expr(
env,
var_store,
scope,
condition.region,
&condition.value,
module_path,
);
let (loc_condition, output1) =
canonicalize_expr(env, var_store, scope, condition.region, &condition.value);
// Get all the lookups that were referenced in the condition,
// so we can print their values later.
@ -1305,7 +1243,6 @@ pub fn canonicalize_expr<'a>(
scope,
continuation.region,
&continuation.value,
module_path,
);
output.union(output1);
@ -1326,14 +1263,8 @@ pub fn canonicalize_expr<'a>(
ast::Expr::LowLevelDbg((source_location, source), message, continuation) => {
let mut output = Output::default();
let (loc_message, output1) = canonicalize_expr(
env,
var_store,
scope,
message.region,
&message.value,
module_path,
);
let (loc_message, output1) =
canonicalize_expr(env, var_store, scope, message.region, &message.value);
let (loc_continuation, output2) = canonicalize_expr(
env,
@ -1341,7 +1272,6 @@ pub fn canonicalize_expr<'a>(
scope,
continuation.region,
&continuation.value,
module_path,
);
output.union(output1);
@ -1372,14 +1302,8 @@ pub fn canonicalize_expr<'a>(
let mut output = Output::default();
for (condition, then_branch) in if_thens.iter() {
let (loc_cond, cond_output) = canonicalize_expr(
env,
var_store,
scope,
condition.region,
&condition.value,
module_path,
);
let (loc_cond, cond_output) =
canonicalize_expr(env, var_store, scope, condition.region, &condition.value);
let (loc_then, then_output) = canonicalize_expr(
env,
@ -1387,7 +1311,6 @@ pub fn canonicalize_expr<'a>(
scope,
then_branch.region,
&then_branch.value,
module_path,
);
branches.push((loc_cond, loc_then));
@ -1402,7 +1325,6 @@ pub fn canonicalize_expr<'a>(
scope,
final_else_branch.region,
&final_else_branch.value,
module_path,
);
output.references.union_mut(&else_output.references);
@ -1502,8 +1424,7 @@ pub fn canonicalize_expr<'a>(
(answer, Output::default())
}
&ast::Expr::ParensAround(sub_expr) => {
let (loc_expr, output) =
canonicalize_expr(env, var_store, scope, region, sub_expr, module_path);
let (loc_expr, output) = canonicalize_expr(env, var_store, scope, region, sub_expr);
(loc_expr.value, output)
}
@ -1558,7 +1479,6 @@ pub fn canonicalize_closure<'a>(
loc_arg_patterns: &'a [Loc<ast::Pattern<'a>>],
loc_body_expr: &'a Loc<ast::Expr<'a>>,
opt_def_name: Option<Symbol>,
module_path: &str,
) -> (ClosureData, Output) {
scope.inner_scope(|inner_scope| {
canonicalize_closure_body(
@ -1568,7 +1488,6 @@ pub fn canonicalize_closure<'a>(
loc_arg_patterns,
loc_body_expr,
opt_def_name,
module_path,
)
})
}
@ -1580,7 +1499,6 @@ fn canonicalize_closure_body<'a>(
loc_arg_patterns: &'a [Loc<ast::Pattern<'a>>],
loc_body_expr: &'a Loc<ast::Expr<'a>>,
opt_def_name: Option<Symbol>,
module_path: &str,
) -> (ClosureData, Output) {
// The globally unique symbol that will refer to this closure once it gets converted
// into a top-level procedure for code gen.
@ -1602,7 +1520,6 @@ fn canonicalize_closure_body<'a>(
&loc_pattern.value,
loc_pattern.region,
PermitShadows(false),
module_path,
);
can_args.push((
@ -1621,7 +1538,6 @@ fn canonicalize_closure_body<'a>(
scope,
loc_body_expr.region,
&loc_body_expr.value,
module_path,
);
let mut captured_symbols: Vec<_> = new_output
@ -1759,7 +1675,6 @@ fn canonicalize_when_branch<'a>(
_region: Region,
branch: &'a ast::WhenBranch<'a>,
output: &mut Output,
module_path: &str,
) -> (WhenBranch, References) {
let mut patterns = Vec::with_capacity(branch.patterns.len());
let mut multi_pattern_variables = MultiPatternVariables::new(branch.patterns.len());
@ -1776,7 +1691,6 @@ fn canonicalize_when_branch<'a>(
&loc_pattern.value,
loc_pattern.region,
permit_shadows,
module_path,
);
multi_pattern_variables.add_pattern(&can_pattern);
@ -1802,20 +1716,13 @@ fn canonicalize_when_branch<'a>(
scope,
branch.value.region,
&branch.value.value,
module_path,
);
let guard = match &branch.guard {
None => None,
Some(loc_expr) => {
let (can_guard, guard_branch_output) = canonicalize_expr(
env,
var_store,
scope,
loc_expr.region,
&loc_expr.value,
module_path,
);
let (can_guard, guard_branch_output) =
canonicalize_expr(env, var_store, scope, loc_expr.region, &loc_expr.value);
branch_output.union(guard_branch_output);
Some(can_guard)
@ -1878,13 +1785,12 @@ fn canonicalize_fields<'a>(
scope: &mut Scope,
region: Region,
fields: &'a [Loc<ast::AssignedField<'a, ast::Expr<'a>>>],
module_path: &str,
) -> Result<(SendMap<Lowercase, Field>, Output), CanonicalizeRecordProblem> {
let mut can_fields = SendMap::default();
let mut output = Output::default();
for loc_field in fields.iter() {
match canonicalize_field(env, var_store, scope, &loc_field.value, module_path) {
match canonicalize_field(env, var_store, scope, &loc_field.value) {
Ok((label, field_expr, field_out, field_var)) => {
let field = Field {
var: field_var,
@ -1937,7 +1843,6 @@ fn canonicalize_field<'a>(
var_store: &mut VarStore,
scope: &mut Scope,
field: &'a ast::AssignedField<'a, ast::Expr<'a>>,
module_path: &str,
) -> Result<(Lowercase, Loc<Expr>, Output, Variable), CanonicalizeFieldProblem> {
use roc_parse::ast::AssignedField::*;
@ -1945,14 +1850,8 @@ fn canonicalize_field<'a>(
// Both a label and a value, e.g. `{ name: "blah" }`
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,
module_path,
);
let (loc_can_expr, output) =
canonicalize_expr(env, var_store, scope, loc_expr.region, &loc_expr.value);
Ok((
Lowercase::from(label.value),
@ -1973,7 +1872,7 @@ fn canonicalize_field<'a>(
}
SpaceBefore(sub_field, _) | SpaceAfter(sub_field, _) => {
canonicalize_field(env, var_store, scope, sub_field, module_path)
canonicalize_field(env, var_store, scope, sub_field)
}
Malformed(_string) => {
@ -2502,14 +2401,13 @@ fn flatten_str_literal<'a>(
var_store: &mut VarStore,
scope: &mut Scope,
literal: &StrLiteral<'a>,
module_path: &str,
) -> (Expr, Output) {
use ast::StrLiteral::*;
match literal {
PlainLine(str_slice) => (Expr::Str((*str_slice).into()), Output::default()),
Line(segments) => flatten_str_lines(env, var_store, scope, &[segments], module_path),
Block(lines) => flatten_str_lines(env, var_store, scope, lines, module_path),
Line(segments) => flatten_str_lines(env, var_store, scope, &[segments]),
Block(lines) => flatten_str_lines(env, var_store, scope, lines),
}
}
@ -2640,7 +2538,6 @@ fn flatten_str_lines<'a>(
var_store: &mut VarStore,
scope: &mut Scope,
lines: &[&[ast::StrSegment<'a>]],
module_path: &str,
) -> (Expr, Output) {
use ast::StrSegment::*;
@ -2698,7 +2595,6 @@ fn flatten_str_lines<'a>(
scope,
loc_expr.region,
loc_expr.value,
module_path,
);
output.union(new_output);

View file

@ -1,3 +1,5 @@
use std::path::Path;
use crate::abilities::{AbilitiesStore, ImplKey, PendingAbilitiesStore, ResolvedImpl};
use crate::annotation::{canonicalize_annotation, AnnotationFor, AnnotationReferences};
use crate::def::{canonicalize_defs, report_unused_imports, Def};
@ -273,7 +275,7 @@ pub fn canonicalize_module_defs<'a>(
loc_defs: &'a mut Defs<'a>,
header_type: &roc_parse::header::HeaderType,
home: ModuleId,
module_path: &str,
module_path: &'a str,
src: &'a str,
qualified_module_ids: &'a PackageModuleIds<'a>,
exposed_ident_ids: IdentIds,
@ -297,7 +299,14 @@ pub fn canonicalize_module_defs<'a>(
exposed_ident_ids,
imported_abilities_state,
);
let mut env = Env::new(arena, home, dep_idents, qualified_module_ids, opt_shorthand);
let mut env = Env::new(
arena,
home,
arena.alloc(Path::new(module_path)),
dep_idents,
qualified_module_ids,
opt_shorthand,
);
for (name, alias) in aliases.into_iter() {
scope.add_alias(
@ -379,7 +388,6 @@ pub fn canonicalize_module_defs<'a>(
&mut scope,
loc_defs,
PatternType::TopLevelDef,
module_path,
);
let pending_derives = output.pending_derives;

View file

@ -260,7 +260,6 @@ pub fn canonicalize_def_header_pattern<'a>(
pattern_type: PatternType,
pattern: &ast::Pattern<'a>,
region: Region,
module_path: &str,
) -> Loc<Pattern> {
use roc_parse::ast::Pattern::*;
@ -315,7 +314,6 @@ pub fn canonicalize_def_header_pattern<'a>(
pattern,
region,
PermitShadows(false),
module_path,
),
}
}
@ -373,7 +371,6 @@ pub fn canonicalize_pattern<'a>(
pattern: &ast::Pattern<'a>,
region: Region,
permit_shadows: PermitShadows,
module_path: &str,
) -> Loc<Pattern> {
use roc_parse::ast::Pattern::*;
use PatternType::*;
@ -421,7 +418,6 @@ pub fn canonicalize_pattern<'a>(
&loc_pattern.value,
loc_pattern.region,
permit_shadows,
module_path,
);
can_patterns.push((var_store.fresh(), can_pattern));
@ -594,7 +590,6 @@ pub fn canonicalize_pattern<'a>(
sub_pattern,
region,
permit_shadows,
module_path,
)
}
@ -613,7 +608,6 @@ pub fn canonicalize_pattern<'a>(
&loc_pattern.value,
loc_pattern.region,
permit_shadows,
module_path,
);
destructs.push(Loc {
@ -692,7 +686,6 @@ pub fn canonicalize_pattern<'a>(
&loc_guard.value,
loc_guard.region,
permit_shadows,
module_path,
);
destructs.push(Loc {
@ -715,7 +708,6 @@ pub fn canonicalize_pattern<'a>(
scope,
loc_default.region,
&loc_default.value,
module_path,
);
// an optional field binds the symbol!
@ -837,7 +829,6 @@ pub fn canonicalize_pattern<'a>(
pattern,
loc_pattern.region,
permit_shadows,
module_path,
);
can_pats.push(pat);
}
@ -872,7 +863,6 @@ pub fn canonicalize_pattern<'a>(
&loc_pattern.value,
loc_pattern.region,
permit_shadows,
module_path,
);
match canonicalize_pattern_symbol(