Parse effectful arrow in function annotations

This commit is contained in:
Agus Zubiaga 2024-09-17 20:41:14 -03:00
parent 1a5776653c
commit ef4eeb5c1a
No known key found for this signature in database
30 changed files with 178 additions and 19 deletions

View file

@ -40,6 +40,7 @@ SpaceAfter(
],
),
],
Pure,
@40-43 Apply(
"",
"U64",

View file

@ -35,6 +35,7 @@ SpaceAfter(
"a",
),
],
Pure,
@30-33 Apply(
"",
"U64",
@ -55,6 +56,7 @@ SpaceAfter(
"a",
),
],
Pure,
@49-52 Apply(
"",
"U64",

View file

@ -31,6 +31,7 @@ SpaceAfter(
"a",
),
],
Pure,
@28-31 Apply(
"",
"U64",

View file

@ -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,

View file

@ -0,0 +1,5 @@
launchTheNukes : {} -> Result Bool LaunchNukeErr
launchTheNukes = \{} ->
crash "todo"
launchTheNukes

View file

@ -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,
],
)

View file

@ -0,0 +1,5 @@
launchTheNukes : {} => Result Bool LaunchNukeErr
launchTheNukes = \{} ->
crash "todo"
launchTheNukes

View file

@ -46,6 +46,7 @@ Defs(
ext: None,
},
],
Pure,
@39-44 Apply(
"",
"Table",

View file

@ -37,6 +37,7 @@ SpaceAfter(
),
},
],
Pure,
@14-20 Tuple {
elems: [
@15-18 Apply(

View file

@ -28,6 +28,7 @@ SpaceAfter(
[],
),
],
Pure,
@11-21 Tuple {
elems: [
@12-15 Apply(

View file

@ -51,6 +51,7 @@ Defs {
"a",
),
],
Pure,
@34-38 Apply(
"",
"Bool",

View file

@ -55,6 +55,7 @@ SpaceAfter(
[],
),
],
Pure,
@65-75 Apply(
"",
"Effect",

View file

@ -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",

View file

@ -37,6 +37,7 @@ Defs(
ext: None,
},
],
Pure,
@17-27 Tuple {
elems: [
@18-21 Apply(

View file

@ -41,6 +41,7 @@ Defs(
),
},
],
Pure,
@18-29 Tuple {
elems: [
@19-22 Apply(

View file

@ -27,6 +27,7 @@ Defs(
[],
),
],
Pure,
@20-30 Apply(
"",
"Task",

View file

@ -32,6 +32,7 @@ Defs(
[],
),
],
Pure,
@20-24 Apply(
"",
"Bool",

View file

@ -27,12 +27,14 @@ SpaceAfter(
"a",
),
],
Pure,
@10-16 Function(
[
@10-11 BoundVariable(
"b",
),
],
Pure,
@15-16 BoundVariable(
"c",
),

View file

@ -34,6 +34,7 @@ SpaceAfter(
"a",
),
],
Pure,
@9-10 BoundVariable(
"b",
),
@ -89,6 +90,7 @@ SpaceAfter(
"a",
),
],
Pure,
@84-85 BoundVariable(
"b",
),

View file

@ -27,12 +27,14 @@ SpaceAfter(
"a",
),
],
Pure,
@10-16 Function(
[
@10-11 BoundVariable(
"b",
),
],
Pure,
@15-16 BoundVariable(
"c",
),

View file

@ -28,12 +28,14 @@ SpaceAfter(
"a",
),
],
Pure,
@10-16 Function(
[
@10-11 BoundVariable(
"b",
),
],
Pure,
@15-16 BoundVariable(
"c",
),

View file

@ -28,6 +28,7 @@ SpaceAfter(
"a",
),
],
Pure,
@9-12 Apply(
"",
"U64",

View file

@ -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,