mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
Parse effectful arrow in function annotations
This commit is contained in:
parent
1a5776653c
commit
ef4eeb5c1a
30 changed files with 178 additions and 19 deletions
|
@ -40,6 +40,7 @@ SpaceAfter(
|
|||
],
|
||||
),
|
||||
],
|
||||
Pure,
|
||||
@40-43 Apply(
|
||||
"",
|
||||
"U64",
|
||||
|
|
|
@ -35,6 +35,7 @@ SpaceAfter(
|
|||
"a",
|
||||
),
|
||||
],
|
||||
Pure,
|
||||
@30-33 Apply(
|
||||
"",
|
||||
"U64",
|
||||
|
@ -55,6 +56,7 @@ SpaceAfter(
|
|||
"a",
|
||||
),
|
||||
],
|
||||
Pure,
|
||||
@49-52 Apply(
|
||||
"",
|
||||
"U64",
|
||||
|
|
|
@ -31,6 +31,7 @@ SpaceAfter(
|
|||
"a",
|
||||
),
|
||||
],
|
||||
Pure,
|
||||
@28-31 Apply(
|
||||
"",
|
||||
"U64",
|
||||
|
|
|
@ -38,6 +38,7 @@ SpaceAfter(
|
|||
"a",
|
||||
),
|
||||
],
|
||||
Pure,
|
||||
@26-28 Record {
|
||||
fields: [],
|
||||
ext: None,
|
||||
|
@ -75,6 +76,7 @@ SpaceAfter(
|
|||
"a",
|
||||
),
|
||||
],
|
||||
Pure,
|
||||
@79-81 Record {
|
||||
fields: [],
|
||||
ext: None,
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
launchTheNukes : {} -> Result Bool LaunchNukeErr
|
||||
launchTheNukes = \{} ->
|
||||
crash "todo"
|
||||
|
||||
launchTheNukes
|
|
@ -0,0 +1,94 @@
|
|||
SpaceAfter(
|
||||
Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-89,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
AnnotatedBody {
|
||||
ann_pattern: @0-14 Identifier {
|
||||
ident: "launchTheNukes",
|
||||
},
|
||||
ann_type: @17-48 Function(
|
||||
[
|
||||
@17-19 Record {
|
||||
fields: [],
|
||||
ext: None,
|
||||
},
|
||||
],
|
||||
Effectful,
|
||||
@23-48 Apply(
|
||||
"",
|
||||
"Result",
|
||||
[
|
||||
@30-34 Apply(
|
||||
"",
|
||||
"Bool",
|
||||
[],
|
||||
),
|
||||
@35-48 Apply(
|
||||
"",
|
||||
"LaunchNukeErr",
|
||||
[],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
lines_between: [
|
||||
Newline,
|
||||
],
|
||||
body_pattern: @49-63 Identifier {
|
||||
ident: "launchTheNukes",
|
||||
},
|
||||
body_expr: @66-89 Closure(
|
||||
[
|
||||
@67-69 RecordDestructure(
|
||||
[],
|
||||
),
|
||||
],
|
||||
@77-89 SpaceBefore(
|
||||
Apply(
|
||||
@77-82 Crash,
|
||||
[
|
||||
@83-89 Str(
|
||||
PlainLine(
|
||||
"todo",
|
||||
),
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
),
|
||||
},
|
||||
],
|
||||
},
|
||||
@91-105 SpaceBefore(
|
||||
Var {
|
||||
module_name: "",
|
||||
ident: "launchTheNukes",
|
||||
},
|
||||
[
|
||||
Newline,
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
)
|
|
@ -0,0 +1,5 @@
|
|||
launchTheNukes : {} => Result Bool LaunchNukeErr
|
||||
launchTheNukes = \{} ->
|
||||
crash "todo"
|
||||
|
||||
launchTheNukes
|
|
@ -46,6 +46,7 @@ Defs(
|
|||
ext: None,
|
||||
},
|
||||
],
|
||||
Pure,
|
||||
@39-44 Apply(
|
||||
"",
|
||||
"Table",
|
||||
|
|
|
@ -37,6 +37,7 @@ SpaceAfter(
|
|||
),
|
||||
},
|
||||
],
|
||||
Pure,
|
||||
@14-20 Tuple {
|
||||
elems: [
|
||||
@15-18 Apply(
|
||||
|
|
|
@ -28,6 +28,7 @@ SpaceAfter(
|
|||
[],
|
||||
),
|
||||
],
|
||||
Pure,
|
||||
@11-21 Tuple {
|
||||
elems: [
|
||||
@12-15 Apply(
|
||||
|
|
|
@ -51,6 +51,7 @@ Defs {
|
|||
"a",
|
||||
),
|
||||
],
|
||||
Pure,
|
||||
@34-38 Apply(
|
||||
"",
|
||||
"Bool",
|
||||
|
|
|
@ -55,6 +55,7 @@ SpaceAfter(
|
|||
[],
|
||||
),
|
||||
],
|
||||
Pure,
|
||||
@65-75 Apply(
|
||||
"",
|
||||
"Effect",
|
||||
|
|
|
@ -32,6 +32,7 @@ SpaceAfter(
|
|||
ext: None,
|
||||
},
|
||||
],
|
||||
Pure,
|
||||
@19-24 Apply(
|
||||
"",
|
||||
"Model",
|
||||
|
@ -55,6 +56,7 @@ SpaceAfter(
|
|||
[],
|
||||
),
|
||||
],
|
||||
Pure,
|
||||
@49-54 Apply(
|
||||
"",
|
||||
"Model",
|
||||
|
@ -73,6 +75,7 @@ SpaceAfter(
|
|||
[],
|
||||
),
|
||||
],
|
||||
Pure,
|
||||
@72-75 Apply(
|
||||
"",
|
||||
"Str",
|
||||
|
|
|
@ -37,6 +37,7 @@ Defs(
|
|||
ext: None,
|
||||
},
|
||||
],
|
||||
Pure,
|
||||
@17-27 Tuple {
|
||||
elems: [
|
||||
@18-21 Apply(
|
||||
|
|
|
@ -41,6 +41,7 @@ Defs(
|
|||
),
|
||||
},
|
||||
],
|
||||
Pure,
|
||||
@18-29 Tuple {
|
||||
elems: [
|
||||
@19-22 Apply(
|
||||
|
|
|
@ -27,6 +27,7 @@ Defs(
|
|||
[],
|
||||
),
|
||||
],
|
||||
Pure,
|
||||
@20-30 Apply(
|
||||
"",
|
||||
"Task",
|
||||
|
|
|
@ -32,6 +32,7 @@ Defs(
|
|||
[],
|
||||
),
|
||||
],
|
||||
Pure,
|
||||
@20-24 Apply(
|
||||
"",
|
||||
"Bool",
|
||||
|
|
|
@ -27,12 +27,14 @@ SpaceAfter(
|
|||
"a",
|
||||
),
|
||||
],
|
||||
Pure,
|
||||
@10-16 Function(
|
||||
[
|
||||
@10-11 BoundVariable(
|
||||
"b",
|
||||
),
|
||||
],
|
||||
Pure,
|
||||
@15-16 BoundVariable(
|
||||
"c",
|
||||
),
|
||||
|
|
|
@ -34,6 +34,7 @@ SpaceAfter(
|
|||
"a",
|
||||
),
|
||||
],
|
||||
Pure,
|
||||
@9-10 BoundVariable(
|
||||
"b",
|
||||
),
|
||||
|
@ -89,6 +90,7 @@ SpaceAfter(
|
|||
"a",
|
||||
),
|
||||
],
|
||||
Pure,
|
||||
@84-85 BoundVariable(
|
||||
"b",
|
||||
),
|
||||
|
|
|
@ -27,12 +27,14 @@ SpaceAfter(
|
|||
"a",
|
||||
),
|
||||
],
|
||||
Pure,
|
||||
@10-16 Function(
|
||||
[
|
||||
@10-11 BoundVariable(
|
||||
"b",
|
||||
),
|
||||
],
|
||||
Pure,
|
||||
@15-16 BoundVariable(
|
||||
"c",
|
||||
),
|
||||
|
|
|
@ -28,12 +28,14 @@ SpaceAfter(
|
|||
"a",
|
||||
),
|
||||
],
|
||||
Pure,
|
||||
@10-16 Function(
|
||||
[
|
||||
@10-11 BoundVariable(
|
||||
"b",
|
||||
),
|
||||
],
|
||||
Pure,
|
||||
@15-16 BoundVariable(
|
||||
"c",
|
||||
),
|
||||
|
|
|
@ -28,6 +28,7 @@ SpaceAfter(
|
|||
"a",
|
||||
),
|
||||
],
|
||||
Pure,
|
||||
@9-12 Apply(
|
||||
"",
|
||||
"U64",
|
||||
|
|
|
@ -275,6 +275,7 @@ mod test_snapshots {
|
|||
pass/add_var_with_spaces.expr,
|
||||
pass/add_with_spaces.expr,
|
||||
pass/ann_closed_union.expr,
|
||||
pass/ann_effectful_fn.expr,
|
||||
pass/ann_open_union.expr,
|
||||
pass/annotated_record_destructure.expr,
|
||||
pass/annotated_tag_destructure.expr,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue