mirror of
https://github.com/roc-lang/roc.git
synced 2024-10-04 22:27:55 +03:00
desugar no args correctly e.g. Stdin.line!
This commit is contained in:
parent
5e2fc1c3fd
commit
4035221dac
@ -339,6 +339,7 @@ fn unwrap_suffixed_def_and_pattern<'a>(
|
||||
) {
|
||||
match value_def {
|
||||
ValueDef::Body(pattern, suffixed_expression) => match suffixed_expression.value {
|
||||
// The Suffixed has arguments applied e.g. `Stdout.line! "Hello World"`
|
||||
Apply(sub_loc, suffixed_args, called_via) => match sub_loc.value {
|
||||
Suffixed(sub_expr) => (
|
||||
Apply(
|
||||
@ -350,6 +351,8 @@ fn unwrap_suffixed_def_and_pattern<'a>(
|
||||
),
|
||||
_ => unreachable!("should have a suffixed Apply inside Body def"),
|
||||
},
|
||||
// The Suffixed has NIL arguments applied e.g. `Stdin.line!`
|
||||
Suffixed(sub_expr) => (*sub_expr, pattern),
|
||||
_ => {
|
||||
unreachable!("should have a suffixed Apply inside Body def")
|
||||
}
|
||||
|
@ -601,11 +601,17 @@ impl<'a> Defs<'a> {
|
||||
let index = value_index.index();
|
||||
|
||||
if let ValueDef::Body(_, expr) = &self.value_defs[index] {
|
||||
// The Suffixed has arguments applied e.g. `Stdout.line! "Hello World"`
|
||||
if let Expr::Apply(sub_expr, _, _) = expr.value {
|
||||
if let Expr::Suffixed(_) = sub_expr.value {
|
||||
return Some((tag_index, index));
|
||||
}
|
||||
}
|
||||
|
||||
// The Suffixed has NO arguments applied e.g. `Stdin.line!`
|
||||
if let Expr::Suffixed(_) = expr.value {
|
||||
return Some((tag_index, index));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user