mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 11:52:19 +00:00
generate snapshots
This commit is contained in:
parent
8949fc710b
commit
8b95816797
33 changed files with 3583 additions and 0 deletions
|
@ -0,0 +1,116 @@
|
|||
---
|
||||
source: crates/compiler/can/tests/test_suffixed.rs
|
||||
expression: snapshot
|
||||
---
|
||||
main = Task.await a \#!a0 -> Task.await x \#!a1 -> c = b #!a0 #!a1
|
||||
c
|
||||
---
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-28,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@0-4 Identifier {
|
||||
ident: "main",
|
||||
},
|
||||
@15-22 Apply(
|
||||
@15-22 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@17-18 Var {
|
||||
module_name: "",
|
||||
ident: "a",
|
||||
},
|
||||
@15-22 Closure(
|
||||
[
|
||||
@17-18 Identifier {
|
||||
ident: "#!a0",
|
||||
},
|
||||
],
|
||||
@15-22 Apply(
|
||||
@15-22 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@20-21 Var {
|
||||
module_name: "",
|
||||
ident: "x",
|
||||
},
|
||||
@15-22 Closure(
|
||||
[
|
||||
@20-21 Identifier {
|
||||
ident: "#!a1",
|
||||
},
|
||||
],
|
||||
@15-22 Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@15-22,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@11-12 Identifier {
|
||||
ident: "c",
|
||||
},
|
||||
@15-22 Apply(
|
||||
@15-16 Var {
|
||||
module_name: "",
|
||||
ident: "b",
|
||||
},
|
||||
[
|
||||
@17-18 Var {
|
||||
module_name: "",
|
||||
ident: "#!a0",
|
||||
},
|
||||
@20-21 Var {
|
||||
module_name: "",
|
||||
ident: "#!a1",
|
||||
},
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
],
|
||||
},
|
||||
@27-28 Var {
|
||||
module_name: "",
|
||||
ident: "c",
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
],
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
---
|
||||
source: crates/compiler/can/tests/test_suffixed.rs
|
||||
expression: snapshot
|
||||
---
|
||||
main = Task.await a \#!a0 -> c = b #!a0
|
||||
c
|
||||
---
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-25,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@0-4 Identifier {
|
||||
ident: "main",
|
||||
},
|
||||
@15-19 Apply(
|
||||
@15-19 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@17-18 Var {
|
||||
module_name: "",
|
||||
ident: "a",
|
||||
},
|
||||
@15-19 Closure(
|
||||
[
|
||||
@17-18 Identifier {
|
||||
ident: "#!a0",
|
||||
},
|
||||
],
|
||||
@15-19 Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@15-19,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@11-12 Identifier {
|
||||
ident: "c",
|
||||
},
|
||||
@15-19 Apply(
|
||||
@15-16 Var {
|
||||
module_name: "",
|
||||
ident: "b",
|
||||
},
|
||||
[
|
||||
@17-18 Var {
|
||||
module_name: "",
|
||||
ident: "#!a0",
|
||||
},
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
],
|
||||
},
|
||||
@24-25 Var {
|
||||
module_name: "",
|
||||
ident: "c",
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
],
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
---
|
||||
source: crates/compiler/can/tests/test_suffixed.rs
|
||||
expression: snapshot
|
||||
---
|
||||
main = Task.await (foo "hello") \#!a0 -> x = bar (#!a0)
|
||||
baz x
|
||||
---
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-43,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@0-4 Identifier {
|
||||
ident: "main",
|
||||
},
|
||||
@15-33 Apply(
|
||||
@15-33 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
Apply(
|
||||
Var {
|
||||
module_name: "",
|
||||
ident: "foo",
|
||||
},
|
||||
[
|
||||
@25-32 Str(
|
||||
PlainLine(
|
||||
"hello",
|
||||
),
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
@15-33 Closure(
|
||||
[
|
||||
Identifier {
|
||||
ident: "#!a0",
|
||||
},
|
||||
],
|
||||
@15-33 Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@15-33,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@11-12 Identifier {
|
||||
ident: "x",
|
||||
},
|
||||
@15-33 Apply(
|
||||
@15-18 Var {
|
||||
module_name: "",
|
||||
ident: "bar",
|
||||
},
|
||||
[
|
||||
@20-32 ParensAround(
|
||||
Var {
|
||||
module_name: "",
|
||||
ident: "#!a0",
|
||||
},
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
],
|
||||
},
|
||||
@38-43 Apply(
|
||||
@38-41 Var {
|
||||
module_name: "",
|
||||
ident: "baz",
|
||||
},
|
||||
[
|
||||
@42-43 Var {
|
||||
module_name: "",
|
||||
ident: "x",
|
||||
},
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
],
|
||||
}
|
|
@ -0,0 +1,114 @@
|
|||
---
|
||||
source: crates/compiler/can/tests/test_suffixed.rs
|
||||
expression: snapshot
|
||||
---
|
||||
main = Task.await (foo "bar") \#!a0 -> x = (#!a0) "hello"
|
||||
baz x
|
||||
---
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-45,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@0-4 Identifier {
|
||||
ident: "main",
|
||||
},
|
||||
@15-35 Apply(
|
||||
@15-35 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
Apply(
|
||||
Var {
|
||||
module_name: "",
|
||||
ident: "foo",
|
||||
},
|
||||
[
|
||||
@21-26 Str(
|
||||
PlainLine(
|
||||
"bar",
|
||||
),
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
@15-35 Closure(
|
||||
[
|
||||
Identifier {
|
||||
ident: "#!a0",
|
||||
},
|
||||
],
|
||||
@15-35 Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@15-35,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@11-12 Identifier {
|
||||
ident: "x",
|
||||
},
|
||||
@15-35 Apply(
|
||||
@16-26 ParensAround(
|
||||
Var {
|
||||
module_name: "",
|
||||
ident: "#!a0",
|
||||
},
|
||||
),
|
||||
[
|
||||
@28-35 Str(
|
||||
PlainLine(
|
||||
"hello",
|
||||
),
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
],
|
||||
},
|
||||
@40-45 Apply(
|
||||
@40-43 Var {
|
||||
module_name: "",
|
||||
ident: "baz",
|
||||
},
|
||||
[
|
||||
@44-45 Var {
|
||||
module_name: "",
|
||||
ident: "x",
|
||||
},
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
],
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
---
|
||||
source: crates/compiler/can/tests/test_suffixed.rs
|
||||
expression: snapshot
|
||||
---
|
||||
main = Task.await a \#!a0 -> c = b #!a0
|
||||
c
|
||||
---
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-28,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@0-4 Identifier {
|
||||
ident: "main",
|
||||
},
|
||||
@15-22 Apply(
|
||||
@15-22 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@15-16 Var {
|
||||
module_name: "",
|
||||
ident: "a",
|
||||
},
|
||||
@15-22 Closure(
|
||||
[
|
||||
@15-16 Identifier {
|
||||
ident: "#!a0",
|
||||
},
|
||||
],
|
||||
@15-22 Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@15-22,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@11-12 Identifier {
|
||||
ident: "c",
|
||||
},
|
||||
@15-22 Apply(
|
||||
@21-22 Var {
|
||||
module_name: "",
|
||||
ident: "b",
|
||||
},
|
||||
[
|
||||
@15-16 Var {
|
||||
module_name: "",
|
||||
ident: "#!a0",
|
||||
},
|
||||
],
|
||||
BinOp(
|
||||
Pizza,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
},
|
||||
@27-28 Var {
|
||||
module_name: "",
|
||||
ident: "c",
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
],
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
---
|
||||
source: crates/compiler/can/tests/test_suffixed.rs
|
||||
expression: snapshot
|
||||
---
|
||||
main = Task.await foo \{} -> ok {}
|
||||
---
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-26,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@0-4 Identifier {
|
||||
ident: "main",
|
||||
},
|
||||
@11-15 Apply(
|
||||
@11-15 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@11-15 Var {
|
||||
module_name: "",
|
||||
ident: "foo",
|
||||
},
|
||||
@11-15 Closure(
|
||||
[
|
||||
@11-15 RecordDestructure(
|
||||
[],
|
||||
),
|
||||
],
|
||||
@21-26 Apply(
|
||||
@21-23 Var {
|
||||
module_name: "",
|
||||
ident: "ok",
|
||||
},
|
||||
[
|
||||
@24-26 Record(
|
||||
[],
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
],
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
---
|
||||
source: crates/compiler/can/tests/test_suffixed.rs
|
||||
expression: snapshot
|
||||
---
|
||||
main = Task.await sayMultiple \#!a0 -> do = (#!a0) "hi"
|
||||
do
|
||||
---
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-42,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@0-4 Identifier {
|
||||
ident: "main",
|
||||
},
|
||||
@16-35 Apply(
|
||||
@16-35 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
Var {
|
||||
module_name: "",
|
||||
ident: "sayMultiple",
|
||||
},
|
||||
@16-35 Closure(
|
||||
[
|
||||
Identifier {
|
||||
ident: "#!a0",
|
||||
},
|
||||
],
|
||||
@16-35 Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@16-35,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@11-13 Identifier {
|
||||
ident: "do",
|
||||
},
|
||||
@16-35 Apply(
|
||||
@17-29 ParensAround(
|
||||
Var {
|
||||
module_name: "",
|
||||
ident: "#!a0",
|
||||
},
|
||||
),
|
||||
[
|
||||
@31-35 Str(
|
||||
PlainLine(
|
||||
"hi",
|
||||
),
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
],
|
||||
},
|
||||
@40-42 Var {
|
||||
module_name: "",
|
||||
ident: "do",
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
],
|
||||
}
|
|
@ -0,0 +1,120 @@
|
|||
---
|
||||
source: crates/compiler/can/tests/test_suffixed.rs
|
||||
expression: snapshot
|
||||
---
|
||||
main =
|
||||
x = \msg -> Task.await (line msg) \{} -> ok {}
|
||||
x "hi"
|
||||
---
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-69,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@0-4 Identifier {
|
||||
ident: "main",
|
||||
},
|
||||
@11-69 Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@15-57,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@11-12 Identifier {
|
||||
ident: "x",
|
||||
},
|
||||
@15-57 Closure(
|
||||
[
|
||||
@16-19 Identifier {
|
||||
ident: "msg",
|
||||
},
|
||||
],
|
||||
@31-42 Apply(
|
||||
@31-42 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@31-42 Apply(
|
||||
@31-42 Var {
|
||||
module_name: "",
|
||||
ident: "line",
|
||||
},
|
||||
[
|
||||
@31-34 Var {
|
||||
module_name: "",
|
||||
ident: "msg",
|
||||
},
|
||||
],
|
||||
BinOp(
|
||||
Pizza,
|
||||
),
|
||||
),
|
||||
@31-42 Closure(
|
||||
[
|
||||
@31-42 RecordDestructure(
|
||||
[],
|
||||
),
|
||||
],
|
||||
@52-57 Apply(
|
||||
@52-54 Var {
|
||||
module_name: "",
|
||||
ident: "ok",
|
||||
},
|
||||
[
|
||||
@55-57 Record(
|
||||
[],
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
},
|
||||
@63-69 Apply(
|
||||
@63-64 Var {
|
||||
module_name: "",
|
||||
ident: "x",
|
||||
},
|
||||
[
|
||||
@65-69 Str(
|
||||
PlainLine(
|
||||
"hi",
|
||||
),
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
}
|
|
@ -0,0 +1,132 @@
|
|||
---
|
||||
source: crates/compiler/can/tests/test_suffixed.rs
|
||||
expression: snapshot
|
||||
---
|
||||
main =
|
||||
x : Str -> Task _ _
|
||||
x = \msg -> Task.await (line msg) \y -> y
|
||||
x "foo"
|
||||
---
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-114,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@0-4 Identifier {
|
||||
ident: "main",
|
||||
},
|
||||
@11-114 Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@39-101,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
AnnotatedBody {
|
||||
ann_pattern: @11-12 Identifier {
|
||||
ident: "x",
|
||||
},
|
||||
ann_type: @15-30 Function(
|
||||
[
|
||||
@15-18 Apply(
|
||||
"",
|
||||
"Str",
|
||||
[],
|
||||
),
|
||||
],
|
||||
@22-30 Apply(
|
||||
"",
|
||||
"Task",
|
||||
[
|
||||
@27-28 Inferred,
|
||||
@29-30 Inferred,
|
||||
],
|
||||
),
|
||||
),
|
||||
comment: None,
|
||||
body_pattern: @35-36 Identifier {
|
||||
ident: "x",
|
||||
},
|
||||
body_expr: @39-101 Closure(
|
||||
[
|
||||
@40-43 Identifier {
|
||||
ident: "msg",
|
||||
},
|
||||
],
|
||||
@78-91 Apply(
|
||||
@78-91 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@78-91 Apply(
|
||||
@78-91 Var {
|
||||
module_name: "",
|
||||
ident: "line",
|
||||
},
|
||||
[
|
||||
@88-91 Var {
|
||||
module_name: "",
|
||||
ident: "msg",
|
||||
},
|
||||
],
|
||||
Space,
|
||||
),
|
||||
@78-91 Closure(
|
||||
[
|
||||
@78-79 Identifier {
|
||||
ident: "y",
|
||||
},
|
||||
],
|
||||
@100-101 Var {
|
||||
module_name: "",
|
||||
ident: "y",
|
||||
},
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
},
|
||||
],
|
||||
},
|
||||
@107-114 Apply(
|
||||
@107-108 Var {
|
||||
module_name: "",
|
||||
ident: "x",
|
||||
},
|
||||
[
|
||||
@109-114 Str(
|
||||
PlainLine(
|
||||
"foo",
|
||||
),
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
}
|
|
@ -0,0 +1,199 @@
|
|||
---
|
||||
source: crates/compiler/can/tests/test_suffixed.rs
|
||||
expression: snapshot
|
||||
---
|
||||
main =
|
||||
foo : Str, {}, Str -> Task {} I32
|
||||
foo = \a, _, b -> Task.await (line a) \{} -> Task.await (line b) \{} -> Task.ok {}
|
||||
foo "bar" {} "baz"
|
||||
---
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-143,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@0-4 Identifier {
|
||||
ident: "main",
|
||||
},
|
||||
@12-143 Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@56-119,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
AnnotatedBody {
|
||||
ann_pattern: @12-15 Identifier {
|
||||
ident: "foo",
|
||||
},
|
||||
ann_type: @18-45 Function(
|
||||
[
|
||||
@18-21 Apply(
|
||||
"",
|
||||
"Str",
|
||||
[],
|
||||
),
|
||||
@23-25 Record {
|
||||
fields: [],
|
||||
ext: None,
|
||||
},
|
||||
@27-30 Apply(
|
||||
"",
|
||||
"Str",
|
||||
[],
|
||||
),
|
||||
],
|
||||
@34-45 Apply(
|
||||
"",
|
||||
"Task",
|
||||
[
|
||||
@39-41 Record {
|
||||
fields: [],
|
||||
ext: None,
|
||||
},
|
||||
@42-45 Apply(
|
||||
"",
|
||||
"I32",
|
||||
[],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
comment: None,
|
||||
body_pattern: @50-53 Identifier {
|
||||
ident: "foo",
|
||||
},
|
||||
body_expr: @56-119 Closure(
|
||||
[
|
||||
@57-58 Identifier {
|
||||
ident: "a",
|
||||
},
|
||||
@60-61 Underscore(
|
||||
"",
|
||||
),
|
||||
@63-64 Identifier {
|
||||
ident: "b",
|
||||
},
|
||||
],
|
||||
@76-83 Apply(
|
||||
@76-83 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@76-83 Apply(
|
||||
@76-83 Var {
|
||||
module_name: "",
|
||||
ident: "line",
|
||||
},
|
||||
[
|
||||
@82-83 Var {
|
||||
module_name: "",
|
||||
ident: "a",
|
||||
},
|
||||
],
|
||||
Space,
|
||||
),
|
||||
@76-83 Closure(
|
||||
[
|
||||
@76-83 RecordDestructure(
|
||||
[],
|
||||
),
|
||||
],
|
||||
@92-99 Apply(
|
||||
@92-99 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@92-99 Apply(
|
||||
@92-99 Var {
|
||||
module_name: "",
|
||||
ident: "line",
|
||||
},
|
||||
[
|
||||
@98-99 Var {
|
||||
module_name: "",
|
||||
ident: "b",
|
||||
},
|
||||
],
|
||||
Space,
|
||||
),
|
||||
@92-99 Closure(
|
||||
[
|
||||
@92-99 RecordDestructure(
|
||||
[],
|
||||
),
|
||||
],
|
||||
@109-119 Apply(
|
||||
@109-116 Var {
|
||||
module_name: "Task",
|
||||
ident: "ok",
|
||||
},
|
||||
[
|
||||
@117-119 Record(
|
||||
[],
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
},
|
||||
],
|
||||
},
|
||||
@125-143 Apply(
|
||||
@125-128 Var {
|
||||
module_name: "",
|
||||
ident: "foo",
|
||||
},
|
||||
[
|
||||
@129-134 Str(
|
||||
PlainLine(
|
||||
"bar",
|
||||
),
|
||||
),
|
||||
@135-137 Record(
|
||||
[],
|
||||
),
|
||||
@138-143 Str(
|
||||
PlainLine(
|
||||
"baz",
|
||||
),
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
---
|
||||
source: crates/compiler/can/tests/test_suffixed.rs
|
||||
expression: snapshot
|
||||
---
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-49,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@0-4 Identifier {
|
||||
ident: "main",
|
||||
},
|
||||
@17-24 Apply(
|
||||
@17-24 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@17-24 Var {
|
||||
module_name: "",
|
||||
ident: "getFoo",
|
||||
},
|
||||
@17-24 Closure(
|
||||
[
|
||||
@11-14 Identifier {
|
||||
ident: "foo",
|
||||
},
|
||||
],
|
||||
@29-49 LowLevelDbg(
|
||||
(
|
||||
"test.roc:3",
|
||||
" ",
|
||||
),
|
||||
@33-36 Apply(
|
||||
@33-36 Var {
|
||||
module_name: "Inspect",
|
||||
ident: "toStr",
|
||||
},
|
||||
[
|
||||
@33-36 Var {
|
||||
module_name: "",
|
||||
ident: "foo",
|
||||
},
|
||||
],
|
||||
Space,
|
||||
),
|
||||
@41-49 Apply(
|
||||
@41-49 Var {
|
||||
module_name: "",
|
||||
ident: "bar",
|
||||
},
|
||||
[
|
||||
@46-49 Var {
|
||||
module_name: "",
|
||||
ident: "foo",
|
||||
},
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
],
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
---
|
||||
source: crates/compiler/can/tests/test_suffixed.rs
|
||||
expression: snapshot
|
||||
---
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-24,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@0-4 Identifier {
|
||||
ident: "main",
|
||||
},
|
||||
@11-24 Apply(
|
||||
@11-24 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@15-17 Var {
|
||||
module_name: "",
|
||||
ident: "a",
|
||||
},
|
||||
@11-24 Closure(
|
||||
[
|
||||
@15-17 Identifier {
|
||||
ident: "#!a0",
|
||||
},
|
||||
],
|
||||
@11-24 LowLevelDbg(
|
||||
(
|
||||
"test.roc:2",
|
||||
"in",
|
||||
),
|
||||
@15-17 Apply(
|
||||
@15-17 Var {
|
||||
module_name: "Inspect",
|
||||
ident: "toStr",
|
||||
},
|
||||
[
|
||||
@15-17 Var {
|
||||
module_name: "",
|
||||
ident: "#!a0",
|
||||
},
|
||||
],
|
||||
Space,
|
||||
),
|
||||
@23-24 Var {
|
||||
module_name: "",
|
||||
ident: "b",
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
],
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
---
|
||||
source: crates/compiler/can/tests/test_suffixed.rs
|
||||
expression: snapshot
|
||||
---
|
||||
main =
|
||||
when a is
|
||||
0 ->
|
||||
when b is
|
||||
1 -> c
|
||||
---
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-99,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@0-4 Identifier {
|
||||
ident: "main",
|
||||
},
|
||||
@11-99 When(
|
||||
@16-17 Var {
|
||||
module_name: "",
|
||||
ident: "a",
|
||||
},
|
||||
[
|
||||
WhenBranch {
|
||||
patterns: [
|
||||
@29-30 NumLiteral(
|
||||
"0",
|
||||
),
|
||||
],
|
||||
value: @46-99 When(
|
||||
@51-52 Var {
|
||||
module_name: "",
|
||||
ident: "b",
|
||||
},
|
||||
[
|
||||
WhenBranch {
|
||||
patterns: [
|
||||
@72-73 NumLiteral(
|
||||
"1",
|
||||
),
|
||||
],
|
||||
value: @97-99 Var {
|
||||
module_name: "",
|
||||
ident: "c",
|
||||
},
|
||||
guard: None,
|
||||
},
|
||||
],
|
||||
),
|
||||
guard: None,
|
||||
},
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
}
|
|
@ -0,0 +1,153 @@
|
|||
---
|
||||
source: crates/compiler/can/tests/test_suffixed.rs
|
||||
expression: snapshot
|
||||
---
|
||||
main =
|
||||
a = "Foo"
|
||||
Task.await (Stdout.line a) \{} -> printBar
|
||||
|
||||
printBar =
|
||||
b = "Bar"
|
||||
Stdout.line b
|
||||
---
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
Index(2147483649),
|
||||
],
|
||||
regions: [
|
||||
@0-54,
|
||||
@56-98,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
Slice(start = 0, length = 2),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
Slice(start = 2, length = 0),
|
||||
],
|
||||
spaces: [
|
||||
Newline,
|
||||
Newline,
|
||||
],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@0-4 Identifier {
|
||||
ident: "main",
|
||||
},
|
||||
@11-54 Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@15-20,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@11-12 Identifier {
|
||||
ident: "a",
|
||||
},
|
||||
@15-20 Str(
|
||||
PlainLine(
|
||||
"Foo",
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
},
|
||||
@11-54 Apply(
|
||||
@11-54 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@25-39 Apply(
|
||||
@25-39 Var {
|
||||
module_name: "Stdout",
|
||||
ident: "line",
|
||||
},
|
||||
[
|
||||
@38-39 Var {
|
||||
module_name: "",
|
||||
ident: "a",
|
||||
},
|
||||
],
|
||||
Space,
|
||||
),
|
||||
@11-54 Closure(
|
||||
[
|
||||
@25-39 RecordDestructure(
|
||||
[],
|
||||
),
|
||||
],
|
||||
@45-54 Var {
|
||||
module_name: "",
|
||||
ident: "printBar",
|
||||
},
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
),
|
||||
Body(
|
||||
@56-64 Identifier {
|
||||
ident: "printBar",
|
||||
},
|
||||
@71-98 Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@75-80,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@71-72 Identifier {
|
||||
ident: "b",
|
||||
},
|
||||
@75-80 Str(
|
||||
PlainLine(
|
||||
"Bar",
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
},
|
||||
@85-98 Apply(
|
||||
@85-96 Var {
|
||||
module_name: "Stdout",
|
||||
ident: "line",
|
||||
},
|
||||
[
|
||||
@97-98 Var {
|
||||
module_name: "",
|
||||
ident: "b",
|
||||
},
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
}
|
|
@ -0,0 +1,109 @@
|
|||
---
|
||||
source: crates/compiler/can/tests/test_suffixed.rs
|
||||
expression: snapshot
|
||||
---
|
||||
main =
|
||||
when x is
|
||||
A ->
|
||||
y = 42
|
||||
if a then b else c
|
||||
|
||||
B -> d
|
||||
---
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-158,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@0-4 Identifier {
|
||||
ident: "main",
|
||||
},
|
||||
@11-158 When(
|
||||
@16-17 Var {
|
||||
module_name: "",
|
||||
ident: "x",
|
||||
},
|
||||
[
|
||||
WhenBranch {
|
||||
patterns: [
|
||||
@29-30 Tag(
|
||||
"A",
|
||||
),
|
||||
],
|
||||
value: @46-130 Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@50-52,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@46-47 Identifier {
|
||||
ident: "y",
|
||||
},
|
||||
@50-52 Num(
|
||||
"42",
|
||||
),
|
||||
),
|
||||
],
|
||||
},
|
||||
@66-130 If(
|
||||
[
|
||||
(
|
||||
@69-70 Var {
|
||||
module_name: "",
|
||||
ident: "a",
|
||||
},
|
||||
@92-94 Var {
|
||||
module_name: "",
|
||||
ident: "b",
|
||||
},
|
||||
),
|
||||
],
|
||||
@128-130 Var {
|
||||
module_name: "",
|
||||
ident: "c",
|
||||
},
|
||||
),
|
||||
),
|
||||
guard: None,
|
||||
},
|
||||
WhenBranch {
|
||||
patterns: [
|
||||
@139-140 Tag(
|
||||
"B",
|
||||
),
|
||||
],
|
||||
value: @156-158 Var {
|
||||
module_name: "",
|
||||
ident: "d",
|
||||
},
|
||||
guard: None,
|
||||
},
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
---
|
||||
source: crates/compiler/can/tests/test_suffixed.rs
|
||||
expression: snapshot
|
||||
---
|
||||
main =
|
||||
expect Bool.isEq 1 2
|
||||
|
||||
x
|
||||
---
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-31,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@0-4 Identifier {
|
||||
ident: "main",
|
||||
},
|
||||
@11-31 Expect(
|
||||
@18-24 Apply(
|
||||
@20-22 Var {
|
||||
module_name: "Bool",
|
||||
ident: "isEq",
|
||||
},
|
||||
[
|
||||
@18-19 Num(
|
||||
"1",
|
||||
),
|
||||
@23-24 Num(
|
||||
"2",
|
||||
),
|
||||
],
|
||||
BinOp(
|
||||
Equals,
|
||||
),
|
||||
),
|
||||
@29-31 Var {
|
||||
module_name: "",
|
||||
ident: "x",
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
}
|
|
@ -0,0 +1,318 @@
|
|||
---
|
||||
source: crates/compiler/can/tests/test_suffixed.rs
|
||||
expression: snapshot
|
||||
---
|
||||
main =
|
||||
isTrue = Task.ok Bool.true
|
||||
isFalsey = \x -> Task.ok x
|
||||
msg : Task {} I32
|
||||
msg = Task.await isTrue \#!a0 -> if Bool.not (#!a0) then Task.await (line "fail") \{} -> err 1 else Task.await (isFalsey Bool.false) \#!a1 -> if #!a1 then Task.await (line "nope") \{} -> ok {} else line "success"
|
||||
msg
|
||||
---
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-307,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@0-4 Identifier {
|
||||
ident: "main",
|
||||
},
|
||||
@11-307 Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
Index(2147483649),
|
||||
Index(2147483650),
|
||||
],
|
||||
regions: [
|
||||
@20-37,
|
||||
@53-68,
|
||||
@109-298,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
Slice(start = 0, length = 1),
|
||||
Slice(start = 1, length = 1),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
Slice(start = 1, length = 0),
|
||||
Slice(start = 2, length = 0),
|
||||
],
|
||||
spaces: [
|
||||
Newline,
|
||||
Newline,
|
||||
],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@11-17 Identifier {
|
||||
ident: "isTrue",
|
||||
},
|
||||
@20-37 Apply(
|
||||
@20-27 Var {
|
||||
module_name: "Task",
|
||||
ident: "ok",
|
||||
},
|
||||
[
|
||||
@28-37 Var {
|
||||
module_name: "Bool",
|
||||
ident: "true",
|
||||
},
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
Body(
|
||||
@42-50 Identifier {
|
||||
ident: "isFalsey",
|
||||
},
|
||||
@53-68 Closure(
|
||||
[
|
||||
@54-55 Identifier {
|
||||
ident: "x",
|
||||
},
|
||||
],
|
||||
@59-68 Apply(
|
||||
@59-66 Var {
|
||||
module_name: "Task",
|
||||
ident: "ok",
|
||||
},
|
||||
[
|
||||
@67-68 Var {
|
||||
module_name: "",
|
||||
ident: "x",
|
||||
},
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
),
|
||||
AnnotatedBody {
|
||||
ann_pattern: @73-76 Identifier {
|
||||
ident: "msg",
|
||||
},
|
||||
ann_type: @79-90 Apply(
|
||||
"",
|
||||
"Task",
|
||||
[
|
||||
@84-86 Record {
|
||||
fields: [],
|
||||
ext: None,
|
||||
},
|
||||
@87-90 Apply(
|
||||
"",
|
||||
"I32",
|
||||
[],
|
||||
),
|
||||
],
|
||||
),
|
||||
comment: None,
|
||||
body_pattern: @95-98 Identifier {
|
||||
ident: "msg",
|
||||
},
|
||||
body_expr: Apply(
|
||||
Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
Var {
|
||||
module_name: "",
|
||||
ident: "isTrue",
|
||||
},
|
||||
Closure(
|
||||
[
|
||||
Identifier {
|
||||
ident: "#!a0",
|
||||
},
|
||||
],
|
||||
@109-298 If(
|
||||
[
|
||||
(
|
||||
@112-122 Apply(
|
||||
@112-113 Var {
|
||||
module_name: "Bool",
|
||||
ident: "not",
|
||||
},
|
||||
[
|
||||
@114-121 ParensAround(
|
||||
Var {
|
||||
module_name: "",
|
||||
ident: "#!a0",
|
||||
},
|
||||
),
|
||||
],
|
||||
UnaryOp(
|
||||
Not,
|
||||
),
|
||||
),
|
||||
@140-152 Apply(
|
||||
@140-152 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@140-152 Apply(
|
||||
@140-152 Var {
|
||||
module_name: "",
|
||||
ident: "line",
|
||||
},
|
||||
[
|
||||
@146-152 Str(
|
||||
PlainLine(
|
||||
"fail",
|
||||
),
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
@140-152 Closure(
|
||||
[
|
||||
@140-152 RecordDestructure(
|
||||
[],
|
||||
),
|
||||
],
|
||||
@165-170 Apply(
|
||||
@165-168 Var {
|
||||
module_name: "",
|
||||
ident: "err",
|
||||
},
|
||||
[
|
||||
@169-170 Num(
|
||||
"1",
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
],
|
||||
Apply(
|
||||
Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
Apply(
|
||||
Var {
|
||||
module_name: "",
|
||||
ident: "isFalsey",
|
||||
},
|
||||
[
|
||||
@198-208 Var {
|
||||
module_name: "Bool",
|
||||
ident: "false",
|
||||
},
|
||||
],
|
||||
Space,
|
||||
),
|
||||
Closure(
|
||||
[
|
||||
Identifier {
|
||||
ident: "#!a1",
|
||||
},
|
||||
],
|
||||
@109-298 If(
|
||||
[
|
||||
(
|
||||
@187-209 ParensAround(
|
||||
Var {
|
||||
module_name: "",
|
||||
ident: "#!a1",
|
||||
},
|
||||
),
|
||||
@227-239 Apply(
|
||||
@227-239 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@227-239 Apply(
|
||||
@227-239 Var {
|
||||
module_name: "",
|
||||
ident: "line",
|
||||
},
|
||||
[
|
||||
@233-239 Str(
|
||||
PlainLine(
|
||||
"nope",
|
||||
),
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
@227-239 Closure(
|
||||
[
|
||||
@227-239 RecordDestructure(
|
||||
[],
|
||||
),
|
||||
],
|
||||
@252-257 Apply(
|
||||
@252-254 Var {
|
||||
module_name: "",
|
||||
ident: "ok",
|
||||
},
|
||||
[
|
||||
@255-257 Record(
|
||||
[],
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
],
|
||||
@283-298 Apply(
|
||||
@283-298 Var {
|
||||
module_name: "",
|
||||
ident: "line",
|
||||
},
|
||||
[
|
||||
@289-298 Str(
|
||||
PlainLine(
|
||||
"success",
|
||||
),
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
},
|
||||
],
|
||||
},
|
||||
@304-307 Var {
|
||||
module_name: "",
|
||||
ident: "msg",
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
}
|
|
@ -0,0 +1,196 @@
|
|||
---
|
||||
source: crates/compiler/can/tests/test_suffixed.rs
|
||||
expression: snapshot
|
||||
---
|
||||
main =
|
||||
isTrue = Task.ok Bool.true
|
||||
isFalse = Task.ok Bool.false
|
||||
Task.await isFalse \#!a0 -> if #!a0 then line "fail" else Task.await isTrue \#!a1 -> if #!a1 then line "success" else line "fail"
|
||||
---
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-189,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@0-4 Identifier {
|
||||
ident: "main",
|
||||
},
|
||||
@11-189 Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
Index(2147483649),
|
||||
],
|
||||
regions: [
|
||||
@20-37,
|
||||
@52-70,
|
||||
],
|
||||
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(
|
||||
@11-17 Identifier {
|
||||
ident: "isTrue",
|
||||
},
|
||||
@20-37 Apply(
|
||||
@20-27 Var {
|
||||
module_name: "Task",
|
||||
ident: "ok",
|
||||
},
|
||||
[
|
||||
@28-37 Var {
|
||||
module_name: "Bool",
|
||||
ident: "true",
|
||||
},
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
Body(
|
||||
@42-49 Identifier {
|
||||
ident: "isFalse",
|
||||
},
|
||||
@52-70 Apply(
|
||||
@52-59 Var {
|
||||
module_name: "Task",
|
||||
ident: "ok",
|
||||
},
|
||||
[
|
||||
@60-70 Var {
|
||||
module_name: "Bool",
|
||||
ident: "false",
|
||||
},
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
],
|
||||
},
|
||||
@79-87 Apply(
|
||||
@79-87 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@79-87 Var {
|
||||
module_name: "",
|
||||
ident: "isFalse",
|
||||
},
|
||||
@79-87 Closure(
|
||||
[
|
||||
@79-87 Identifier {
|
||||
ident: "#!a0",
|
||||
},
|
||||
],
|
||||
@76-189 If(
|
||||
[
|
||||
(
|
||||
@79-87 Var {
|
||||
module_name: "",
|
||||
ident: "#!a0",
|
||||
},
|
||||
@101-112 Apply(
|
||||
@101-105 Var {
|
||||
module_name: "",
|
||||
ident: "line",
|
||||
},
|
||||
[
|
||||
@106-112 Str(
|
||||
PlainLine(
|
||||
"fail",
|
||||
),
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
],
|
||||
@125-132 Apply(
|
||||
@125-132 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@125-132 Var {
|
||||
module_name: "",
|
||||
ident: "isTrue",
|
||||
},
|
||||
@125-132 Closure(
|
||||
[
|
||||
@125-132 Identifier {
|
||||
ident: "#!a1",
|
||||
},
|
||||
],
|
||||
@76-189 If(
|
||||
[
|
||||
(
|
||||
@125-132 Var {
|
||||
module_name: "",
|
||||
ident: "#!a1",
|
||||
},
|
||||
@146-160 Apply(
|
||||
@146-150 Var {
|
||||
module_name: "",
|
||||
ident: "line",
|
||||
},
|
||||
[
|
||||
@151-160 Str(
|
||||
PlainLine(
|
||||
"success",
|
||||
),
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
],
|
||||
@178-189 Apply(
|
||||
@178-182 Var {
|
||||
module_name: "",
|
||||
ident: "line",
|
||||
},
|
||||
[
|
||||
@183-189 Str(
|
||||
PlainLine(
|
||||
"fail",
|
||||
),
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
---
|
||||
source: crates/compiler/can/tests/test_suffixed.rs
|
||||
expression: snapshot
|
||||
---
|
||||
main =
|
||||
x = 42
|
||||
Task.await b \#!a0 -> a #!a0
|
||||
---
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-26,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@0-4 Identifier {
|
||||
ident: "main",
|
||||
},
|
||||
@11-26 Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@15-17,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@11-12 Identifier {
|
||||
ident: "x",
|
||||
},
|
||||
@15-17 Num(
|
||||
"42",
|
||||
),
|
||||
),
|
||||
],
|
||||
},
|
||||
@11-26 Apply(
|
||||
@11-26 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@24-25 Var {
|
||||
module_name: "",
|
||||
ident: "b",
|
||||
},
|
||||
@11-26 Closure(
|
||||
[
|
||||
@24-25 Identifier {
|
||||
ident: "#!a0",
|
||||
},
|
||||
],
|
||||
@22-26 Apply(
|
||||
@22-23 Var {
|
||||
module_name: "",
|
||||
ident: "a",
|
||||
},
|
||||
[
|
||||
@24-25 Var {
|
||||
module_name: "",
|
||||
ident: "#!a0",
|
||||
},
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
---
|
||||
source: crates/compiler/can/tests/test_suffixed.rs
|
||||
expression: snapshot
|
||||
---
|
||||
main = Task.await foo \{} -> Task.await bar \{} -> baz
|
||||
---
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-33,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@0-4 Identifier {
|
||||
ident: "main",
|
||||
},
|
||||
@11-15 Apply(
|
||||
@11-15 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@11-15 Var {
|
||||
module_name: "",
|
||||
ident: "foo",
|
||||
},
|
||||
@11-15 Closure(
|
||||
[
|
||||
@11-15 RecordDestructure(
|
||||
[],
|
||||
),
|
||||
],
|
||||
@20-24 Apply(
|
||||
@20-24 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@20-24 Var {
|
||||
module_name: "",
|
||||
ident: "bar",
|
||||
},
|
||||
@20-24 Closure(
|
||||
[
|
||||
@20-24 RecordDestructure(
|
||||
[],
|
||||
),
|
||||
],
|
||||
@29-33 Var {
|
||||
module_name: "",
|
||||
ident: "baz",
|
||||
},
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
],
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
---
|
||||
source: crates/compiler/can/tests/test_suffixed.rs
|
||||
expression: snapshot
|
||||
---
|
||||
main = foo "bar" {} "baz"
|
||||
---
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-26,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@0-4 Identifier {
|
||||
ident: "main",
|
||||
},
|
||||
@0-26 Apply(
|
||||
@0-26 Var {
|
||||
module_name: "",
|
||||
ident: "foo",
|
||||
},
|
||||
[
|
||||
@12-17 Str(
|
||||
PlainLine(
|
||||
"bar",
|
||||
),
|
||||
),
|
||||
@18-20 Record(
|
||||
[],
|
||||
),
|
||||
@21-26 Str(
|
||||
PlainLine(
|
||||
"baz",
|
||||
),
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
],
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
---
|
||||
source: crates/compiler/can/tests/test_suffixed.rs
|
||||
expression: snapshot
|
||||
---
|
||||
main = Task.await (line "Ahoy") \{} -> Task.await (Stdout.line "There") \{} -> Task.ok {}
|
||||
---
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-72,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@0-4 Identifier {
|
||||
ident: "main",
|
||||
},
|
||||
@11-23 Apply(
|
||||
@11-23 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@11-23 Apply(
|
||||
@11-23 Var {
|
||||
module_name: "",
|
||||
ident: "line",
|
||||
},
|
||||
[
|
||||
@17-23 Str(
|
||||
PlainLine(
|
||||
"Ahoy",
|
||||
),
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
@11-23 Closure(
|
||||
[
|
||||
@11-23 RecordDestructure(
|
||||
[],
|
||||
),
|
||||
],
|
||||
@33-55 Apply(
|
||||
@33-55 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@33-55 Apply(
|
||||
@33-55 Var {
|
||||
module_name: "Stdout",
|
||||
ident: "line",
|
||||
},
|
||||
[
|
||||
@33-40 Str(
|
||||
PlainLine(
|
||||
"There",
|
||||
),
|
||||
),
|
||||
],
|
||||
BinOp(
|
||||
Pizza,
|
||||
),
|
||||
),
|
||||
@33-55 Closure(
|
||||
[
|
||||
@28-30 RecordDestructure(
|
||||
[],
|
||||
),
|
||||
],
|
||||
@62-72 Apply(
|
||||
@62-69 Var {
|
||||
module_name: "Task",
|
||||
ident: "ok",
|
||||
},
|
||||
[
|
||||
@70-72 Record(
|
||||
[],
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
],
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
---
|
||||
source: crates/compiler/can/tests/test_suffixed.rs
|
||||
expression: snapshot
|
||||
---
|
||||
main =
|
||||
msg = "hello"
|
||||
Task.await (foo msg) \x -> bar x
|
||||
---
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-51,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@0-4 Identifier {
|
||||
ident: "main",
|
||||
},
|
||||
@11-51 Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@17-24,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@11-14 Identifier {
|
||||
ident: "msg",
|
||||
},
|
||||
@17-24 Str(
|
||||
PlainLine(
|
||||
"hello",
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
},
|
||||
@11-51 Apply(
|
||||
@11-51 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@29-41 Apply(
|
||||
@29-41 Var {
|
||||
module_name: "",
|
||||
ident: "foo",
|
||||
},
|
||||
[
|
||||
@38-41 Var {
|
||||
module_name: "",
|
||||
ident: "msg",
|
||||
},
|
||||
],
|
||||
Space,
|
||||
),
|
||||
@11-51 Closure(
|
||||
[
|
||||
@29-30 Identifier {
|
||||
ident: "x",
|
||||
},
|
||||
],
|
||||
@46-51 Apply(
|
||||
@46-49 Var {
|
||||
module_name: "",
|
||||
ident: "bar",
|
||||
},
|
||||
[
|
||||
@50-51 Var {
|
||||
module_name: "",
|
||||
ident: "x",
|
||||
},
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
---
|
||||
source: crates/compiler/can/tests/test_suffixed.rs
|
||||
expression: snapshot
|
||||
---
|
||||
main = Task.await foo \#!a0 -> Task.await #!a0 \{} -> bar
|
||||
---
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-24,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@0-4 Identifier {
|
||||
ident: "main",
|
||||
},
|
||||
@11-24 Apply(
|
||||
@11-24 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@11-16 Var {
|
||||
module_name: "",
|
||||
ident: "foo",
|
||||
},
|
||||
@11-24 Closure(
|
||||
[
|
||||
@11-16 Identifier {
|
||||
ident: "#!a0",
|
||||
},
|
||||
],
|
||||
@11-16 Apply(
|
||||
@11-16 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@11-16 Var {
|
||||
module_name: "",
|
||||
ident: "#!a0",
|
||||
},
|
||||
@11-16 Closure(
|
||||
[
|
||||
@11-16 RecordDestructure(
|
||||
[],
|
||||
),
|
||||
],
|
||||
@21-24 Var {
|
||||
module_name: "",
|
||||
ident: "bar",
|
||||
},
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
],
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
---
|
||||
source: crates/compiler/can/tests/test_suffixed.rs
|
||||
expression: snapshot
|
||||
---
|
||||
main = Task.await (bar baz) \#!a0 -> Task.await (foo (#!a0) (blah stuff)) \z -> doSomething z
|
||||
---
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-61,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@0-4 Identifier {
|
||||
ident: "main",
|
||||
},
|
||||
@15-43 Apply(
|
||||
@15-43 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
Apply(
|
||||
Var {
|
||||
module_name: "",
|
||||
ident: "bar",
|
||||
},
|
||||
[
|
||||
@26-29 Var {
|
||||
module_name: "",
|
||||
ident: "baz",
|
||||
},
|
||||
],
|
||||
Space,
|
||||
),
|
||||
@15-43 Closure(
|
||||
[
|
||||
Identifier {
|
||||
ident: "#!a0",
|
||||
},
|
||||
],
|
||||
@15-43 Apply(
|
||||
@15-43 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@15-43 Apply(
|
||||
@15-43 Var {
|
||||
module_name: "",
|
||||
ident: "foo",
|
||||
},
|
||||
[
|
||||
@21-29 ParensAround(
|
||||
Var {
|
||||
module_name: "",
|
||||
ident: "#!a0",
|
||||
},
|
||||
),
|
||||
@32-42 ParensAround(
|
||||
Apply(
|
||||
@32-36 Var {
|
||||
module_name: "",
|
||||
ident: "blah",
|
||||
},
|
||||
[
|
||||
@37-42 Var {
|
||||
module_name: "",
|
||||
ident: "stuff",
|
||||
},
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
@15-43 Closure(
|
||||
[
|
||||
@11-12 Identifier {
|
||||
ident: "z",
|
||||
},
|
||||
],
|
||||
@48-61 Apply(
|
||||
@48-59 Var {
|
||||
module_name: "",
|
||||
ident: "doSomething",
|
||||
},
|
||||
[
|
||||
@60-61 Var {
|
||||
module_name: "",
|
||||
ident: "z",
|
||||
},
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
],
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
---
|
||||
source: crates/compiler/can/tests/test_suffixed.rs
|
||||
expression: snapshot
|
||||
---
|
||||
main =
|
||||
x = Task.await b \a -> c a
|
||||
x
|
||||
---
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-49,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@0-4 Identifier {
|
||||
ident: "main",
|
||||
},
|
||||
@11-49 Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@23-42,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@11-12 Identifier {
|
||||
ident: "x",
|
||||
},
|
||||
@27-29 Apply(
|
||||
@27-29 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@27-29 Var {
|
||||
module_name: "",
|
||||
ident: "b",
|
||||
},
|
||||
@27-29 Closure(
|
||||
[
|
||||
@23-24 Identifier {
|
||||
ident: "a",
|
||||
},
|
||||
],
|
||||
@38-42 Apply(
|
||||
@38-42 Var {
|
||||
module_name: "",
|
||||
ident: "c",
|
||||
},
|
||||
[
|
||||
@41-42 Var {
|
||||
module_name: "",
|
||||
ident: "a",
|
||||
},
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
],
|
||||
},
|
||||
@48-49 Var {
|
||||
module_name: "",
|
||||
ident: "x",
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
---
|
||||
source: crates/compiler/can/tests/test_suffixed.rs
|
||||
expression: snapshot
|
||||
---
|
||||
run = Task.await nextMsg \#!a0 -> line (#!a0)
|
||||
---
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-22,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@0-3 Identifier {
|
||||
ident: "run",
|
||||
},
|
||||
@0-22 Apply(
|
||||
@0-22 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
Var {
|
||||
module_name: "",
|
||||
ident: "nextMsg",
|
||||
},
|
||||
@0-22 Closure(
|
||||
[
|
||||
Identifier {
|
||||
ident: "#!a0",
|
||||
},
|
||||
],
|
||||
@0-22 Apply(
|
||||
@0-22 Var {
|
||||
module_name: "",
|
||||
ident: "line",
|
||||
},
|
||||
[
|
||||
@13-21 ParensAround(
|
||||
Var {
|
||||
module_name: "",
|
||||
ident: "#!a0",
|
||||
},
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
],
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
---
|
||||
source: crates/compiler/can/tests/test_suffixed.rs
|
||||
expression: snapshot
|
||||
---
|
||||
main = Task.await (line (Str.concat "hello" "world")) \{} -> Task.ok {}
|
||||
---
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-73,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@0-4 Identifier {
|
||||
ident: "main",
|
||||
},
|
||||
@11-56 Apply(
|
||||
@11-56 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@11-56 Apply(
|
||||
@11-56 Var {
|
||||
module_name: "",
|
||||
ident: "line",
|
||||
},
|
||||
[
|
||||
@11-44 Apply(
|
||||
@26-36 Var {
|
||||
module_name: "Str",
|
||||
ident: "concat",
|
||||
},
|
||||
[
|
||||
@11-18 Str(
|
||||
PlainLine(
|
||||
"hello",
|
||||
),
|
||||
),
|
||||
@37-44 Str(
|
||||
PlainLine(
|
||||
"world",
|
||||
),
|
||||
),
|
||||
],
|
||||
BinOp(
|
||||
Pizza,
|
||||
),
|
||||
),
|
||||
],
|
||||
BinOp(
|
||||
Pizza,
|
||||
),
|
||||
),
|
||||
@11-56 Closure(
|
||||
[
|
||||
@26-56 RecordDestructure(
|
||||
[],
|
||||
),
|
||||
],
|
||||
@63-73 Apply(
|
||||
@63-70 Var {
|
||||
module_name: "Task",
|
||||
ident: "ok",
|
||||
},
|
||||
[
|
||||
@71-73 Record(
|
||||
[],
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
],
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
---
|
||||
source: crates/compiler/can/tests/test_suffixed.rs
|
||||
expression: snapshot
|
||||
---
|
||||
copy = \a, b -> Task.await (line "FOO") \{} -> mapErr (CMD.new "cp") ERR
|
||||
---
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-67,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@0-4 Identifier {
|
||||
ident: "copy",
|
||||
},
|
||||
@7-67 Closure(
|
||||
[
|
||||
@8-9 Identifier {
|
||||
ident: "a",
|
||||
},
|
||||
@10-11 Identifier {
|
||||
ident: "b",
|
||||
},
|
||||
],
|
||||
@19-30 Apply(
|
||||
@19-30 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@19-30 Apply(
|
||||
@19-30 Var {
|
||||
module_name: "",
|
||||
ident: "line",
|
||||
},
|
||||
[
|
||||
@25-30 Str(
|
||||
PlainLine(
|
||||
"FOO",
|
||||
),
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
@19-30 Closure(
|
||||
[
|
||||
@19-30 RecordDestructure(
|
||||
[],
|
||||
),
|
||||
],
|
||||
@36-67 Apply(
|
||||
@36-67 Var {
|
||||
module_name: "",
|
||||
ident: "mapErr",
|
||||
},
|
||||
[
|
||||
@36-48 Apply(
|
||||
@36-43 Var {
|
||||
module_name: "CMD",
|
||||
ident: "new",
|
||||
},
|
||||
[
|
||||
@44-48 Str(
|
||||
PlainLine(
|
||||
"cp",
|
||||
),
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
@64-67 Tag(
|
||||
"ERR",
|
||||
),
|
||||
],
|
||||
BinOp(
|
||||
Pizza,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
}
|
|
@ -0,0 +1,119 @@
|
|||
---
|
||||
source: crates/compiler/can/tests/test_suffixed.rs
|
||||
expression: snapshot
|
||||
---
|
||||
main = Task.await Stdin.line \result ->
|
||||
when result is
|
||||
End -> Task.ok {}
|
||||
Input name -> Stdout.line "Hello, $(name)"
|
||||
---
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-154,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@0-4 Identifier {
|
||||
ident: "main",
|
||||
},
|
||||
@20-31 Apply(
|
||||
@20-31 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@20-31 Var {
|
||||
module_name: "Stdin",
|
||||
ident: "line",
|
||||
},
|
||||
@20-31 Closure(
|
||||
[
|
||||
@11-17 Identifier {
|
||||
ident: "result",
|
||||
},
|
||||
],
|
||||
@37-154 When(
|
||||
@42-48 Var {
|
||||
module_name: "",
|
||||
ident: "result",
|
||||
},
|
||||
[
|
||||
WhenBranch {
|
||||
patterns: [
|
||||
@60-63 Tag(
|
||||
"End",
|
||||
),
|
||||
],
|
||||
value: @79-89 Apply(
|
||||
@79-86 Var {
|
||||
module_name: "Task",
|
||||
ident: "ok",
|
||||
},
|
||||
[
|
||||
@87-89 Record(
|
||||
[],
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
guard: None,
|
||||
},
|
||||
WhenBranch {
|
||||
patterns: [
|
||||
@99-109 Apply(
|
||||
@99-104 Tag(
|
||||
"Input",
|
||||
),
|
||||
[
|
||||
@105-109 Identifier {
|
||||
ident: "name",
|
||||
},
|
||||
],
|
||||
),
|
||||
],
|
||||
value: @125-154 Apply(
|
||||
@125-154 Var {
|
||||
module_name: "Stdout",
|
||||
ident: "line",
|
||||
},
|
||||
[
|
||||
@138-154 Str(
|
||||
Line(
|
||||
[
|
||||
Plaintext(
|
||||
"Hello, ",
|
||||
),
|
||||
Interpolated(
|
||||
@148-152 Var {
|
||||
module_name: "",
|
||||
ident: "name",
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
guard: None,
|
||||
},
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
],
|
||||
}
|
|
@ -0,0 +1,106 @@
|
|||
---
|
||||
source: crates/compiler/can/tests/test_suffixed.rs
|
||||
expression: snapshot
|
||||
---
|
||||
main = Task.await foo \a -> Task.await bar \#!a0 -> Task.await #!a0 \b -> baz a b
|
||||
---
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-45,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@0-4 Identifier {
|
||||
ident: "main",
|
||||
},
|
||||
@15-19 Apply(
|
||||
@15-19 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@15-19 Var {
|
||||
module_name: "",
|
||||
ident: "foo",
|
||||
},
|
||||
@15-19 Closure(
|
||||
[
|
||||
@11-12 Identifier {
|
||||
ident: "a",
|
||||
},
|
||||
],
|
||||
@15-19 Apply(
|
||||
@15-19 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@24-33 Var {
|
||||
module_name: "",
|
||||
ident: "bar",
|
||||
},
|
||||
@15-19 Closure(
|
||||
[
|
||||
@24-33 Identifier {
|
||||
ident: "#!a0",
|
||||
},
|
||||
],
|
||||
@24-33 Apply(
|
||||
@24-33 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@24-33 Var {
|
||||
module_name: "",
|
||||
ident: "#!a0",
|
||||
},
|
||||
@24-33 Closure(
|
||||
[
|
||||
@24-25 Identifier {
|
||||
ident: "b",
|
||||
},
|
||||
],
|
||||
@38-45 Apply(
|
||||
@38-41 Var {
|
||||
module_name: "",
|
||||
ident: "baz",
|
||||
},
|
||||
[
|
||||
@42-43 Var {
|
||||
module_name: "",
|
||||
ident: "a",
|
||||
},
|
||||
@44-45 Var {
|
||||
module_name: "",
|
||||
ident: "b",
|
||||
},
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
],
|
||||
}
|
|
@ -0,0 +1,132 @@
|
|||
---
|
||||
source: crates/compiler/can/tests/test_suffixed.rs
|
||||
expression: snapshot
|
||||
---
|
||||
list = Task.await getList \#!a1 ->
|
||||
when #!a1 is
|
||||
[] -> Task.await (line "foo") \{} -> line "bar"
|
||||
_ -> ok {}
|
||||
---
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-120,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@0-4 Identifier {
|
||||
ident: "list",
|
||||
},
|
||||
@11-120 Apply(
|
||||
@11-120 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@16-24 Var {
|
||||
module_name: "",
|
||||
ident: "getList",
|
||||
},
|
||||
@11-120 Closure(
|
||||
[
|
||||
@16-24 Identifier {
|
||||
ident: "#!a1",
|
||||
},
|
||||
],
|
||||
@11-120 When(
|
||||
@16-24 Var {
|
||||
module_name: "",
|
||||
ident: "#!a1",
|
||||
},
|
||||
[
|
||||
WhenBranch {
|
||||
patterns: [
|
||||
@36-38 List(
|
||||
[],
|
||||
),
|
||||
],
|
||||
value: @54-65 Apply(
|
||||
@54-65 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@54-65 Apply(
|
||||
@54-65 Var {
|
||||
module_name: "",
|
||||
ident: "line",
|
||||
},
|
||||
[
|
||||
@60-65 Str(
|
||||
PlainLine(
|
||||
"foo",
|
||||
),
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
@54-65 Closure(
|
||||
[
|
||||
@54-65 RecordDestructure(
|
||||
[],
|
||||
),
|
||||
],
|
||||
@78-89 Apply(
|
||||
@78-89 Var {
|
||||
module_name: "",
|
||||
ident: "line",
|
||||
},
|
||||
[
|
||||
@84-89 Str(
|
||||
PlainLine(
|
||||
"bar",
|
||||
),
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
guard: None,
|
||||
},
|
||||
WhenBranch {
|
||||
patterns: [
|
||||
@98-99 Underscore(
|
||||
"",
|
||||
),
|
||||
],
|
||||
value: @115-120 Apply(
|
||||
@115-117 Var {
|
||||
module_name: "",
|
||||
ident: "ok",
|
||||
},
|
||||
[
|
||||
@118-120 Record(
|
||||
[],
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
guard: None,
|
||||
},
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
],
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
---
|
||||
source: crates/compiler/can/tests/test_suffixed.rs
|
||||
expression: snapshot
|
||||
---
|
||||
list = Task.await getList \#!a0 ->
|
||||
when #!a0 is
|
||||
[] -> "empty"
|
||||
_ -> "non-empty"
|
||||
---
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-74,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@0-4 Identifier {
|
||||
ident: "list",
|
||||
},
|
||||
@11-74 Apply(
|
||||
@11-74 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@16-24 Var {
|
||||
module_name: "",
|
||||
ident: "getList",
|
||||
},
|
||||
@11-74 Closure(
|
||||
[
|
||||
@16-24 Identifier {
|
||||
ident: "#!a0",
|
||||
},
|
||||
],
|
||||
@11-74 When(
|
||||
@16-24 Var {
|
||||
module_name: "",
|
||||
ident: "#!a0",
|
||||
},
|
||||
[
|
||||
WhenBranch {
|
||||
patterns: [
|
||||
@36-38 List(
|
||||
[],
|
||||
),
|
||||
],
|
||||
value: @42-49 Str(
|
||||
PlainLine(
|
||||
"empty",
|
||||
),
|
||||
),
|
||||
guard: None,
|
||||
},
|
||||
WhenBranch {
|
||||
patterns: [
|
||||
@58-59 Underscore(
|
||||
"",
|
||||
),
|
||||
],
|
||||
value: @63-74 Str(
|
||||
PlainLine(
|
||||
"non-empty",
|
||||
),
|
||||
),
|
||||
guard: None,
|
||||
},
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
BangSuffix,
|
||||
),
|
||||
),
|
||||
],
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue