Make unit assignment optional for suffixed defs

This commit is contained in:
Luke Boswell 2024-03-23 14:40:28 +11:00
parent 237bd942ed
commit 42fdcb7ff1
No known key found for this signature in database
GPG key ID: F6DB3C9DB47377B0
15 changed files with 208 additions and 7 deletions

View file

@ -0,0 +1,2 @@
A.x! "Foo" []
B.y! "Bar" \a -> x + y

View file

@ -0,0 +1,91 @@
Defs {
tags: [
Index(2147483648),
Index(2147483649),
],
regions: [
@0-19,
@20-45,
],
space_before: [
Slice(start = 0, length = 0),
Slice(start = 0, length = 1),
],
space_after: [
Slice(start = 0, length = 0),
Slice(start = 1, length = 0),
],
spaces: [
Newline,
],
type_defs: [],
value_defs: [
Body(
@0-4 RecordDestructure(
[],
),
@0-19 Apply(
@0-4 Suffixed(
Var {
module_name: "A",
ident: "x",
},
),
[
@8-13 Str(
PlainLine(
"Foo",
),
),
@17-19 List(
[],
),
],
Space,
),
),
Body(
@20-24 RecordDestructure(
[],
),
@20-45 Apply(
@20-24 Suffixed(
Var {
module_name: "B",
ident: "y",
},
),
[
@27-32 Str(
PlainLine(
"Bar",
),
),
@34-45 Closure(
[
@35-36 Identifier(
"a",
),
],
@40-45 BinOps(
[
(
@40-41 Var {
module_name: "",
ident: "x",
},
@42-43 Plus,
),
],
@44-45 Var {
module_name: "",
ident: "y",
},
),
),
],
Space,
),
),
],
}

View file

@ -0,0 +1,2 @@
A.x! "Foo" []
B.y! "Bar" \a -> x + y

View file

@ -442,6 +442,7 @@ mod test_snapshots {
pass/sub_var_with_spaces.expr,
pass/sub_with_spaces.expr,
pass/suffixed.expr,
pass/suffixed_def_optional_bang.moduledefs,
pass/suffixed_nested.expr,
pass/tag_pattern.expr,
pass/ten_times_eleven.expr,