mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-21 11:09:50 +00:00
Merge remote-tracking branch 'origin/trunk' into list-unreachable
This commit is contained in:
commit
6095dcff66
107 changed files with 10287 additions and 9870 deletions
|
@ -1804,7 +1804,7 @@ fn str_from_utf8(symbol: Symbol, var_store: &mut VarStore) -> Def {
|
|||
// Ok arg_2.str
|
||||
// else
|
||||
// # problem
|
||||
// Err (BadUtf8 { byteIndex: arg_2.byteIndex, problem : arg_2.problem })
|
||||
// Err (BadUtf8 arg_2.problem arg_2.byteIndex)
|
||||
|
||||
let def = crate::def::Def {
|
||||
loc_pattern: no_region(Pattern::Identifier(Symbol::ARG_2)),
|
||||
|
@ -1906,7 +1906,7 @@ fn str_from_utf8_range(symbol: Symbol, var_store: &mut VarStore) -> Def {
|
|||
// if arg_3.a then
|
||||
// Ok arg_3.str
|
||||
// else
|
||||
// Err (BadUtf8 { byteIndex: arg_3.byteIndex, problem : arg_3.problem })
|
||||
// Err (BadUtf8 arg_3.problem arg_3.byteIndex)
|
||||
|
||||
let def = crate::def::Def {
|
||||
loc_pattern: no_region(Pattern::Identifier(Symbol::ARG_3)),
|
||||
|
|
|
@ -7,6 +7,7 @@ use crate::annotation::make_apply_symbol;
|
|||
use crate::annotation::IntroducedVariables;
|
||||
use crate::annotation::OwnedNamedOrAble;
|
||||
use crate::env::Env;
|
||||
use crate::expr::AccessorData;
|
||||
use crate::expr::AnnotatedMark;
|
||||
use crate::expr::ClosureData;
|
||||
use crate::expr::Declarations;
|
||||
|
@ -1554,7 +1555,10 @@ fn canonicalize_pending_value_def<'a>(
|
|||
region: loc_ann.region,
|
||||
}
|
||||
} else {
|
||||
let symbol = scope.gen_unique_symbol();
|
||||
let symbol = match &loc_can_pattern.value {
|
||||
Pattern::Identifier(symbol) => *symbol,
|
||||
_ => scope.gen_unique_symbol(),
|
||||
};
|
||||
|
||||
// generate a fake pattern for each argument. this makes signatures
|
||||
// that are functions only crash when they are applied.
|
||||
|
@ -1725,6 +1729,36 @@ fn canonicalize_pending_body<'a>(
|
|||
(loc_can_expr, def_references)
|
||||
}
|
||||
|
||||
// Turn f = .foo into f = \rcd -[f]-> rcd.foo
|
||||
(
|
||||
Pattern::Identifier(defined_symbol)
|
||||
| Pattern::AbilityMemberSpecialization {
|
||||
ident: defined_symbol,
|
||||
..
|
||||
},
|
||||
ast::Expr::AccessorFunction(field),
|
||||
) => {
|
||||
let (loc_can_expr, can_output) = (
|
||||
Loc::at(
|
||||
loc_expr.region,
|
||||
Accessor(AccessorData {
|
||||
name: *defined_symbol,
|
||||
function_var: var_store.fresh(),
|
||||
record_var: var_store.fresh(),
|
||||
ext_var: var_store.fresh(),
|
||||
closure_var: var_store.fresh(),
|
||||
field_var: var_store.fresh(),
|
||||
field: (*field).into(),
|
||||
}),
|
||||
),
|
||||
Output::default(),
|
||||
);
|
||||
let def_references = DefReferences::Value(can_output.references.clone());
|
||||
output.union(can_output);
|
||||
|
||||
(loc_can_expr, def_references)
|
||||
}
|
||||
|
||||
_ => {
|
||||
let (loc_can_expr, can_output) =
|
||||
canonicalize_expr(env, var_store, scope, loc_expr.region, &loc_expr.value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue