mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 04:08:19 +00:00
Update region when desugaring ! in Task mode
This commit is contained in:
parent
46e808dc3a
commit
a0f4b38ee9
23 changed files with 115 additions and 115 deletions
|
@ -421,7 +421,7 @@ pub fn desugar_expr<'a>(
|
|||
Var { module_name, ident } => {
|
||||
if env.fx_mode == FxMode::Task && ident.ends_with('!') {
|
||||
env.arena.alloc(Loc::at(
|
||||
loc_expr.region,
|
||||
Region::new(loc_expr.region.start(), loc_expr.region.end().sub(1)),
|
||||
TrySuffix {
|
||||
expr: env.arena.alloc(Var {
|
||||
module_name,
|
||||
|
|
|
@ -30,13 +30,13 @@ Defs {
|
|||
ident: "await",
|
||||
},
|
||||
[
|
||||
@17-19 Var {
|
||||
@17-18 Var {
|
||||
module_name: "",
|
||||
ident: "a",
|
||||
},
|
||||
@15-22 Closure(
|
||||
[
|
||||
@17-19 Identifier {
|
||||
@17-18 Identifier {
|
||||
ident: "#!0_arg",
|
||||
},
|
||||
],
|
||||
|
@ -46,13 +46,13 @@ Defs {
|
|||
ident: "await",
|
||||
},
|
||||
[
|
||||
@20-22 Var {
|
||||
@20-21 Var {
|
||||
module_name: "",
|
||||
ident: "x",
|
||||
},
|
||||
@15-22 Closure(
|
||||
[
|
||||
@20-22 Identifier {
|
||||
@20-21 Identifier {
|
||||
ident: "#!1_arg",
|
||||
},
|
||||
],
|
||||
|
@ -83,11 +83,11 @@ Defs {
|
|||
ident: "b",
|
||||
},
|
||||
[
|
||||
@17-19 Var {
|
||||
@17-18 Var {
|
||||
module_name: "",
|
||||
ident: "#!0_arg",
|
||||
},
|
||||
@20-22 Var {
|
||||
@20-21 Var {
|
||||
module_name: "",
|
||||
ident: "#!1_arg",
|
||||
},
|
||||
|
|
|
@ -30,13 +30,13 @@ Defs {
|
|||
ident: "await",
|
||||
},
|
||||
[
|
||||
@17-19 Var {
|
||||
@17-18 Var {
|
||||
module_name: "",
|
||||
ident: "a",
|
||||
},
|
||||
@15-19 Closure(
|
||||
[
|
||||
@17-19 Identifier {
|
||||
@17-18 Identifier {
|
||||
ident: "#!0_arg",
|
||||
},
|
||||
],
|
||||
|
@ -67,7 +67,7 @@ Defs {
|
|||
ident: "b",
|
||||
},
|
||||
[
|
||||
@17-19 Var {
|
||||
@17-18 Var {
|
||||
module_name: "",
|
||||
ident: "#!0_arg",
|
||||
},
|
||||
|
|
|
@ -30,13 +30,13 @@ Defs {
|
|||
ident: "await",
|
||||
},
|
||||
[
|
||||
@15-17 Var {
|
||||
@15-16 Var {
|
||||
module_name: "",
|
||||
ident: "a",
|
||||
},
|
||||
@15-22 Closure(
|
||||
[
|
||||
@15-17 Identifier {
|
||||
@15-16 Identifier {
|
||||
ident: "#!0_arg",
|
||||
},
|
||||
],
|
||||
|
@ -67,7 +67,7 @@ Defs {
|
|||
ident: "b",
|
||||
},
|
||||
[
|
||||
@15-17 Var {
|
||||
@15-16 Var {
|
||||
module_name: "",
|
||||
ident: "#!0_arg",
|
||||
},
|
||||
|
|
|
@ -24,19 +24,19 @@ Defs {
|
|||
@0-4 Identifier {
|
||||
ident: "main",
|
||||
},
|
||||
@11-15 Apply(
|
||||
@11-15 Var {
|
||||
@11-14 Apply(
|
||||
@11-14 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@11-15 Defs(
|
||||
@11-14 Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
EitherIndex(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@11-15,
|
||||
@11-14,
|
||||
],
|
||||
space_before: [
|
||||
Slice { start: 0, length: 0 },
|
||||
|
@ -66,19 +66,19 @@ Defs {
|
|||
body_pattern: @11-15 Identifier {
|
||||
ident: "#!0_stmt",
|
||||
},
|
||||
body_expr: @11-15 Var {
|
||||
body_expr: @11-14 Var {
|
||||
module_name: "",
|
||||
ident: "foo",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
@11-15 Var {
|
||||
@11-14 Var {
|
||||
module_name: "",
|
||||
ident: "#!0_stmt",
|
||||
},
|
||||
),
|
||||
@11-15 Closure(
|
||||
@11-14 Closure(
|
||||
[
|
||||
@11-15 Underscore(
|
||||
"#!stmt",
|
||||
|
|
|
@ -51,19 +51,19 @@ Defs {
|
|||
ident: "msg",
|
||||
},
|
||||
],
|
||||
@31-43 Apply(
|
||||
@31-43 Var {
|
||||
@31-42 Apply(
|
||||
@31-42 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@31-43 Defs(
|
||||
@31-42 Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
EitherIndex(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@31-43,
|
||||
@31-42,
|
||||
],
|
||||
space_before: [
|
||||
Slice { start: 0, length: 0 },
|
||||
|
@ -93,8 +93,8 @@ Defs {
|
|||
body_pattern: @31-43 Identifier {
|
||||
ident: "#!0_stmt",
|
||||
},
|
||||
body_expr: @31-43 Apply(
|
||||
@31-43 Var {
|
||||
body_expr: @31-42 Apply(
|
||||
@31-42 Var {
|
||||
module_name: "",
|
||||
ident: "line",
|
||||
},
|
||||
|
@ -111,12 +111,12 @@ Defs {
|
|||
},
|
||||
],
|
||||
},
|
||||
@31-43 Var {
|
||||
@31-42 Var {
|
||||
module_name: "",
|
||||
ident: "#!0_stmt",
|
||||
},
|
||||
),
|
||||
@31-43 Closure(
|
||||
@31-42 Closure(
|
||||
[
|
||||
@31-43 Underscore(
|
||||
"#!stmt",
|
||||
|
|
|
@ -24,17 +24,17 @@ Defs {
|
|||
@0-4 Identifier {
|
||||
ident: "main",
|
||||
},
|
||||
@17-24 Apply(
|
||||
@17-24 Var {
|
||||
@17-23 Apply(
|
||||
@17-23 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@17-24 Var {
|
||||
@17-23 Var {
|
||||
module_name: "",
|
||||
ident: "getFoo",
|
||||
},
|
||||
@17-24 Closure(
|
||||
@17-23 Closure(
|
||||
[
|
||||
@11-14 Identifier {
|
||||
ident: "foo",
|
||||
|
|
|
@ -30,28 +30,28 @@ Defs {
|
|||
ident: "await",
|
||||
},
|
||||
[
|
||||
@15-17 Var {
|
||||
@15-16 Var {
|
||||
module_name: "",
|
||||
ident: "a",
|
||||
},
|
||||
@11-17 Closure(
|
||||
[
|
||||
@15-17 Identifier {
|
||||
@15-16 Identifier {
|
||||
ident: "#!0_arg",
|
||||
},
|
||||
],
|
||||
@11-17 LowLevelDbg(
|
||||
(
|
||||
"test.roc:2",
|
||||
"in",
|
||||
"i",
|
||||
),
|
||||
@15-17 Apply(
|
||||
@15-17 Var {
|
||||
@15-16 Apply(
|
||||
@15-16 Var {
|
||||
module_name: "Inspect",
|
||||
ident: "toStr",
|
||||
},
|
||||
[
|
||||
@15-17 Var {
|
||||
@15-16 Var {
|
||||
module_name: "",
|
||||
ident: "#!0_arg",
|
||||
},
|
||||
|
|
|
@ -48,7 +48,7 @@ Defs {
|
|||
"1",
|
||||
),
|
||||
],
|
||||
value: @97-99 Var {
|
||||
value: @97-98 Var {
|
||||
module_name: "",
|
||||
ident: "c",
|
||||
},
|
||||
|
|
|
@ -128,7 +128,7 @@ Defs {
|
|||
"#!stmt",
|
||||
),
|
||||
],
|
||||
@45-54 Var {
|
||||
@45-53 Var {
|
||||
module_name: "",
|
||||
ident: "printBar",
|
||||
},
|
||||
|
|
|
@ -70,13 +70,13 @@ Defs {
|
|||
module_name: "",
|
||||
ident: "a",
|
||||
},
|
||||
@92-94 Var {
|
||||
@92-93 Var {
|
||||
module_name: "",
|
||||
ident: "b",
|
||||
},
|
||||
),
|
||||
],
|
||||
final_else: @128-130 Var {
|
||||
final_else: @128-129 Var {
|
||||
module_name: "",
|
||||
ident: "c",
|
||||
},
|
||||
|
@ -91,7 +91,7 @@ Defs {
|
|||
"B",
|
||||
),
|
||||
],
|
||||
value: @156-158 Var {
|
||||
value: @156-157 Var {
|
||||
module_name: "",
|
||||
ident: "d",
|
||||
},
|
||||
|
|
|
@ -63,7 +63,7 @@ Defs {
|
|||
},
|
||||
],
|
||||
},
|
||||
@29-31 Var {
|
||||
@29-30 Var {
|
||||
module_name: "",
|
||||
ident: "x",
|
||||
},
|
||||
|
|
|
@ -85,26 +85,26 @@ Defs {
|
|||
),
|
||||
],
|
||||
},
|
||||
@79-87 Apply(
|
||||
@79-87 Var {
|
||||
@79-86 Apply(
|
||||
@79-86 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@79-87 Var {
|
||||
@79-86 Var {
|
||||
module_name: "",
|
||||
ident: "isFalse",
|
||||
},
|
||||
@79-87 Closure(
|
||||
@79-86 Closure(
|
||||
[
|
||||
@79-87 Identifier {
|
||||
@79-86 Identifier {
|
||||
ident: "#!0_arg",
|
||||
},
|
||||
],
|
||||
@76-189 If {
|
||||
if_thens: [
|
||||
(
|
||||
@79-87 Var {
|
||||
@79-86 Var {
|
||||
module_name: "",
|
||||
ident: "#!0_arg",
|
||||
},
|
||||
|
@ -124,26 +124,26 @@ Defs {
|
|||
),
|
||||
),
|
||||
],
|
||||
final_else: @125-132 Apply(
|
||||
@125-132 Var {
|
||||
final_else: @125-131 Apply(
|
||||
@125-131 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@125-132 Var {
|
||||
@125-131 Var {
|
||||
module_name: "",
|
||||
ident: "isTrue",
|
||||
},
|
||||
@125-132 Closure(
|
||||
@125-131 Closure(
|
||||
[
|
||||
@125-132 Identifier {
|
||||
@125-131 Identifier {
|
||||
ident: "#!1_arg",
|
||||
},
|
||||
],
|
||||
@76-189 If {
|
||||
if_thens: [
|
||||
(
|
||||
@125-132 Var {
|
||||
@125-131 Var {
|
||||
module_name: "",
|
||||
ident: "#!1_arg",
|
||||
},
|
||||
|
|
|
@ -57,13 +57,13 @@ Defs {
|
|||
ident: "await",
|
||||
},
|
||||
[
|
||||
@24-26 Var {
|
||||
@24-25 Var {
|
||||
module_name: "",
|
||||
ident: "b",
|
||||
},
|
||||
@11-26 Closure(
|
||||
[
|
||||
@24-26 Identifier {
|
||||
@24-25 Identifier {
|
||||
ident: "#!0_arg",
|
||||
},
|
||||
],
|
||||
|
@ -73,7 +73,7 @@ Defs {
|
|||
ident: "a",
|
||||
},
|
||||
[
|
||||
@24-26 Var {
|
||||
@24-25 Var {
|
||||
module_name: "",
|
||||
ident: "#!0_arg",
|
||||
},
|
||||
|
|
|
@ -24,19 +24,19 @@ Defs {
|
|||
@0-4 Identifier {
|
||||
ident: "main",
|
||||
},
|
||||
@11-15 Apply(
|
||||
@11-15 Var {
|
||||
@11-14 Apply(
|
||||
@11-14 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@11-15 Defs(
|
||||
@11-14 Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
EitherIndex(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@11-15,
|
||||
@11-14,
|
||||
],
|
||||
space_before: [
|
||||
Slice { start: 0, length: 0 },
|
||||
|
@ -66,37 +66,37 @@ Defs {
|
|||
body_pattern: @11-15 Identifier {
|
||||
ident: "#!2_stmt",
|
||||
},
|
||||
body_expr: @11-15 Var {
|
||||
body_expr: @11-14 Var {
|
||||
module_name: "",
|
||||
ident: "foo",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
@11-15 Var {
|
||||
@11-14 Var {
|
||||
module_name: "",
|
||||
ident: "#!2_stmt",
|
||||
},
|
||||
),
|
||||
@11-15 Closure(
|
||||
@11-14 Closure(
|
||||
[
|
||||
@11-15 Underscore(
|
||||
"#!stmt",
|
||||
),
|
||||
],
|
||||
@20-24 Apply(
|
||||
@20-24 Var {
|
||||
@20-23 Apply(
|
||||
@20-23 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@20-24 Defs(
|
||||
@20-23 Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
EitherIndex(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@20-24,
|
||||
@20-23,
|
||||
],
|
||||
space_before: [
|
||||
Slice { start: 0, length: 0 },
|
||||
|
@ -126,25 +126,25 @@ Defs {
|
|||
body_pattern: @20-24 Identifier {
|
||||
ident: "#!1_stmt",
|
||||
},
|
||||
body_expr: @20-24 Var {
|
||||
body_expr: @20-23 Var {
|
||||
module_name: "",
|
||||
ident: "bar",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
@20-24 Var {
|
||||
@20-23 Var {
|
||||
module_name: "",
|
||||
ident: "#!1_stmt",
|
||||
},
|
||||
),
|
||||
@20-24 Closure(
|
||||
@20-23 Closure(
|
||||
[
|
||||
@20-24 Underscore(
|
||||
"#!stmt",
|
||||
),
|
||||
],
|
||||
@29-33 Var {
|
||||
@29-32 Var {
|
||||
module_name: "",
|
||||
ident: "baz",
|
||||
},
|
||||
|
|
|
@ -94,14 +94,14 @@ Defs {
|
|||
"#!stmt",
|
||||
),
|
||||
],
|
||||
@33-56 Apply(
|
||||
@33-56 Var {
|
||||
@33-55 Apply(
|
||||
@33-55 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@33-56 Apply(
|
||||
@33-56 Var {
|
||||
@33-55 Apply(
|
||||
@33-55 Var {
|
||||
module_name: "Stdout",
|
||||
ident: "line",
|
||||
},
|
||||
|
@ -116,7 +116,7 @@ Defs {
|
|||
Pizza,
|
||||
),
|
||||
),
|
||||
@33-56 Closure(
|
||||
@33-55 Closure(
|
||||
[
|
||||
@28-30 RecordDestructure(
|
||||
[],
|
||||
|
|
|
@ -45,17 +45,17 @@ Defs {
|
|||
@11-12 Identifier {
|
||||
ident: "x",
|
||||
},
|
||||
@27-29 Apply(
|
||||
@27-29 Var {
|
||||
@27-28 Apply(
|
||||
@27-28 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@27-29 Var {
|
||||
@27-28 Var {
|
||||
module_name: "",
|
||||
ident: "b",
|
||||
},
|
||||
@27-29 Closure(
|
||||
@27-28 Closure(
|
||||
[
|
||||
@23-24 Identifier {
|
||||
ident: "a",
|
||||
|
|
|
@ -24,19 +24,19 @@ Defs {
|
|||
@0-4 Identifier {
|
||||
ident: "main",
|
||||
},
|
||||
@11-57 Apply(
|
||||
@11-57 Var {
|
||||
@11-56 Apply(
|
||||
@11-56 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@11-57 Defs(
|
||||
@11-56 Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
EitherIndex(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@11-57,
|
||||
@11-56,
|
||||
],
|
||||
space_before: [
|
||||
Slice { start: 0, length: 0 },
|
||||
|
@ -66,8 +66,8 @@ Defs {
|
|||
body_pattern: @11-57 Identifier {
|
||||
ident: "#!0_stmt",
|
||||
},
|
||||
body_expr: @11-57 Apply(
|
||||
@11-57 Var {
|
||||
body_expr: @11-56 Apply(
|
||||
@11-56 Var {
|
||||
module_name: "",
|
||||
ident: "line",
|
||||
},
|
||||
|
@ -101,12 +101,12 @@ Defs {
|
|||
},
|
||||
],
|
||||
},
|
||||
@11-57 Var {
|
||||
@11-56 Var {
|
||||
module_name: "",
|
||||
ident: "#!0_stmt",
|
||||
},
|
||||
),
|
||||
@11-57 Closure(
|
||||
@11-56 Closure(
|
||||
[
|
||||
@11-57 Underscore(
|
||||
"#!stmt",
|
||||
|
|
|
@ -24,17 +24,17 @@ Defs {
|
|||
@0-4 Identifier {
|
||||
ident: "main",
|
||||
},
|
||||
@20-31 Apply(
|
||||
@20-31 Var {
|
||||
@20-30 Apply(
|
||||
@20-30 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@20-31 Var {
|
||||
@20-30 Var {
|
||||
module_name: "Stdin",
|
||||
ident: "line",
|
||||
},
|
||||
@20-31 Closure(
|
||||
@20-30 Closure(
|
||||
[
|
||||
@11-17 Identifier {
|
||||
ident: "result",
|
||||
|
|
|
@ -30,19 +30,19 @@ Defs {
|
|||
ident: "x",
|
||||
},
|
||||
],
|
||||
@28-30 Apply(
|
||||
@28-30 Var {
|
||||
@28-29 Apply(
|
||||
@28-29 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@14-30 Defs(
|
||||
@14-29 Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
EitherIndex(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@28-30,
|
||||
@28-29,
|
||||
],
|
||||
space_before: [
|
||||
Slice { start: 0, length: 0 },
|
||||
|
@ -73,19 +73,19 @@ Defs {
|
|||
body_pattern: @24-25 Identifier {
|
||||
ident: "#!0_expr",
|
||||
},
|
||||
body_expr: @28-30 Var {
|
||||
body_expr: @28-29 Var {
|
||||
module_name: "",
|
||||
ident: "x",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
@28-30 Var {
|
||||
@28-29 Var {
|
||||
module_name: "",
|
||||
ident: "#!0_expr",
|
||||
},
|
||||
),
|
||||
@28-30 Closure(
|
||||
@28-29 Closure(
|
||||
[
|
||||
@24-25 Identifier {
|
||||
ident: "r",
|
||||
|
|
|
@ -24,24 +24,24 @@ Defs {
|
|||
@0-4 Identifier {
|
||||
ident: "main",
|
||||
},
|
||||
@15-19 Apply(
|
||||
@15-19 Var {
|
||||
@15-18 Apply(
|
||||
@15-18 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
[
|
||||
@15-19 Var {
|
||||
@15-18 Var {
|
||||
module_name: "",
|
||||
ident: "foo",
|
||||
},
|
||||
@15-19 Closure(
|
||||
@15-18 Closure(
|
||||
[
|
||||
@11-12 Identifier {
|
||||
ident: "a",
|
||||
},
|
||||
],
|
||||
@15-19 Apply(
|
||||
@15-19 Var {
|
||||
@15-18 Apply(
|
||||
@15-18 Var {
|
||||
module_name: "Task",
|
||||
ident: "await",
|
||||
},
|
||||
|
@ -50,7 +50,7 @@ Defs {
|
|||
module_name: "",
|
||||
ident: "bar",
|
||||
},
|
||||
@15-19 Closure(
|
||||
@15-18 Closure(
|
||||
[
|
||||
@28-33 Identifier {
|
||||
ident: "#!0_arg",
|
||||
|
|
|
@ -30,18 +30,18 @@ Defs {
|
|||
ident: "await",
|
||||
},
|
||||
[
|
||||
@16-24 Var {
|
||||
@16-23 Var {
|
||||
module_name: "",
|
||||
ident: "getList",
|
||||
},
|
||||
@11-120 Closure(
|
||||
[
|
||||
@16-24 Identifier {
|
||||
@16-23 Identifier {
|
||||
ident: "#!2_arg",
|
||||
},
|
||||
],
|
||||
@11-120 When(
|
||||
@16-24 Var {
|
||||
@16-23 Var {
|
||||
module_name: "",
|
||||
ident: "#!2_arg",
|
||||
},
|
||||
|
|
|
@ -30,18 +30,18 @@ Defs {
|
|||
ident: "await",
|
||||
},
|
||||
[
|
||||
@16-24 Var {
|
||||
@16-23 Var {
|
||||
module_name: "",
|
||||
ident: "getList",
|
||||
},
|
||||
@11-74 Closure(
|
||||
[
|
||||
@16-24 Identifier {
|
||||
@16-23 Identifier {
|
||||
ident: "#!0_arg",
|
||||
},
|
||||
],
|
||||
@11-74 When(
|
||||
@16-24 Var {
|
||||
@16-23 Var {
|
||||
module_name: "",
|
||||
ident: "#!0_arg",
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue