mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-15 08:15:07 +00:00
Merge remote-tracking branch 'origin/main' into repl
This commit is contained in:
commit
c03dc17ab4
197 changed files with 5171 additions and 2946 deletions
|
@ -346,6 +346,7 @@ fn parse_expr_start<'a>(
|
|||
loc!(move |a, s, m| parse_expr_operator_chain(m, options, a, s)),
|
||||
fail_expr_start_e()
|
||||
]
|
||||
.trace("expr_start")
|
||||
.parse(arena, state, min_indent)
|
||||
}
|
||||
|
||||
|
@ -546,7 +547,7 @@ fn numeric_negate_expression<'a, T>(
|
|||
expr: Loc<Expr<'a>>,
|
||||
spaces: &'a [CommentOrNewline<'a>],
|
||||
) -> Loc<Expr<'a>> {
|
||||
debug_assert_eq!(state.bytes().get(0), Some(&b'-'));
|
||||
debug_assert_eq!(state.bytes().first(), Some(&b'-'));
|
||||
// for overflow reasons, we must make the unary minus part of the number literal.
|
||||
let start = state.pos();
|
||||
let region = Region::new(start, expr.region.end());
|
||||
|
@ -1933,7 +1934,7 @@ fn expr_to_pattern_help<'a>(arena: &'a Bump, expr: &Expr<'a>) -> Result<Pattern<
|
|||
| Expr::UnaryOp(_, _) => Err(()),
|
||||
|
||||
Expr::Str(string) => Ok(Pattern::StrLiteral(*string)),
|
||||
Expr::SingleQuote(string) => Ok(Pattern::SingleQuote(*string)),
|
||||
Expr::SingleQuote(string) => Ok(Pattern::SingleQuote(string)),
|
||||
Expr::MalformedIdent(string, _problem) => Ok(Pattern::Malformed(string)),
|
||||
}
|
||||
}
|
||||
|
@ -2105,10 +2106,10 @@ mod when {
|
|||
parser::keyword_e(keyword::IS, EWhen::Is)
|
||||
)
|
||||
),
|
||||
move |arena, state, progress, (case_indent, loc_condition), min_indent| {
|
||||
move |arena, state, _progress, (case_indent, loc_condition), min_indent| {
|
||||
if case_indent < min_indent {
|
||||
return Err((
|
||||
progress,
|
||||
MadeProgress,
|
||||
// TODO maybe pass case_indent here?
|
||||
EWhen::PatternAlignment(5, state.pos()),
|
||||
state,
|
||||
|
@ -2118,15 +2119,18 @@ mod when {
|
|||
// Everything in the branches must be indented at least as much as the case itself.
|
||||
let min_indent = case_indent;
|
||||
|
||||
let (p1, branches, state) = branches(options).parse(arena, state, min_indent)?;
|
||||
let (_p1, branches, state) = branches(options)
|
||||
.parse(arena, state, min_indent)
|
||||
.map_err(|(_p, e, s)| (MadeProgress, e, s))?;
|
||||
|
||||
Ok((
|
||||
progress.or(p1),
|
||||
MadeProgress,
|
||||
Expr::When(arena.alloc(loc_condition), branches.into_bump_slice()),
|
||||
state,
|
||||
))
|
||||
},
|
||||
)
|
||||
.trace("when")
|
||||
}
|
||||
|
||||
/// Parsing when with indentation.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue