Skip to content

Commit

Permalink
Remove references to Task and CalledVia::BangSuffix
Browse files Browse the repository at this point in the history
  • Loading branch information
snobee committed Jan 16, 2025
1 parent 406cc6c commit bbe2d7c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
14 changes: 7 additions & 7 deletions crates/cli/src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -566,13 +566,13 @@ main =
let before = HEADER.to_string()
+ indoc! {r#"
main =
Task.ok {}"#};
"Hello, World!""#};

let after = HEADER.to_string()
+ indoc! {r#"
main : Task {} *
main : Str
main =
Task.ok {}
"Hello, World!"
"#};

let annotated = annotate_string(before);
Expand All @@ -593,16 +593,16 @@ main =
fn test_annotate_destructure() {
let before = HEADER.to_string()
+ indoc! {r#"
{a, b} = {a: Task.ok {}, b: (1, 2)}
{a, b} = {a: "zero", b: (1, 2)}
main = a"#};

let after = HEADER.to_string()
+ indoc! {r#"
{a, b} : { a : Task {} *, b : ( Num *, Num * )* }
{a, b} = {a: Task.ok {}, b: (1, 2)}
{a, b} : { a : Str, b : ( Num *, Num * )* }
{a, b} = {a: "zero", b: (1, 2)}
main : Task {} *
main : Str
main = a
"#};

Expand Down
3 changes: 1 addition & 2 deletions crates/language_server/src/analysis/annotation_visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ pub fn find_declaration_at(

fn visit_expr(&mut self, expr: &Expr, region: Region, var: Variable) {
if self.should_visit(region) {
if let Expr::Call(_, args, CalledVia::BangSuffix | CalledVia::QuestionSuffix) = expr
{
if let Expr::Call(_, args, CalledVia::QuestionSuffix) = expr {
let Expr::Closure(ClosureData { arguments, .. }) = &args[1].1.value else {
internal_error!("Suffixed expression did not contain a closure")
};
Expand Down
10 changes: 5 additions & 5 deletions crates/language_server/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ mod tests {
#[tokio::test]
async fn test_annotate_single() {
let edit = code_action_edits(
DOC_LIT.to_string() + "main = Task.ok {}",
DOC_LIT.to_string() + r#"main = "Hello, world!""#,
Position::new(3, 2),
"Add signature",
)
Expand All @@ -706,7 +706,7 @@ mod tests {
character: 0,
},
},
new_text: "main : Task {} *\n",
new_text: "main : Str\n",
},
]
"#]]
Expand All @@ -719,7 +719,7 @@ mod tests {
DOC_LIT.to_string()
+ indoc! {r#"
other = \_ ->
Task.ok {}
"Something else?"
main =
other {}
Expand All @@ -742,7 +742,7 @@ mod tests {
character: 0,
},
},
new_text: "other : * -> Task {} *\n",
new_text: "other : * -> Str\n",
},
TextEdit {
range: Range {
Expand All @@ -755,7 +755,7 @@ mod tests {
character: 0,
},
},
new_text: "main : Task {} *\n",
new_text: "main : Str\n",
},
]
"#]]
Expand Down

0 comments on commit bbe2d7c

Please sign in to comment.