Skip to content

Commit 62e8420

Browse files
hellovaiclaude
andcommitted
Update LSP test snapshots for literal union widening
Literal unions like `1 | 2 | 3` are now widened to their primitive type (e.g. `int`), so error messages and diagnostics reflect the widened types. Spurious operator errors on literal unions (Add, Mul) are now resolved. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 704ed82 commit 62e8420

7 files changed

Lines changed: 9 additions & 42 deletions

File tree

baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/for_loops.baml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,7 @@ function ForInLoop() -> int {
1616

1717
//----
1818
//- diagnostics
19-
// Error: operator `Add` cannot be applied to `int` and `1 | 2 | 3`
20-
// ╭─[ for_loops.baml:12:11 ]
21-
// │
22-
// 12 │ sum = sum + x;
23-
// │ ───┬───
24-
// │ ╰───── operator `Add` cannot be applied to `int` and `1 | 2 | 3`
25-
// │
26-
// │ Note: Error code: E0001
27-
// ────╯
19+
// <no-diagnostics-expected>
2820
//
2921
//- semantic_tokens
3022
// for_loops.baml:1:1 (keyword) len=8 "function"

baml_language/crates/baml_lsp2_actions_tests/test_files/syntax/headers/basic_if.baml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ function BasicIf() -> string {
1717

1818
//----
1919
//- diagnostics
20-
// Error: type mismatch: expected string, got 12 | 13
20+
// Error: type mismatch: expected string, got int
2121
// ╭─[ headers_basic_if.baml:14:5 ]
2222
// │
2323
// 14 │ z
2424
// │ ┬
25-
// │ ╰── type mismatch: expected string, got 12 | 13
25+
// │ ╰── type mismatch: expected string, got int
2626
// │
2727
// │ Note: Error code: E0001
2828
// ────╯

baml_language/crates/baml_lsp2_actions_tests/test_files/syntax/headers/complex_headers_test.baml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,3 @@ function ForLoopWithHeaders() -> int {
105105
// │
106106
// │ Note: Error code: E0001
107107
// ────╯
108-
// Error: operator `Mul` cannot be applied to `1 | 2 | 3 | 4 | 5` and `2`
109-
// ╭─[ headers_complex_headers_test.baml:54:25 ]
110-
// │
111-
// 54 │ let processed = item * 2;
112-
// │ ────┬───
113-
// │ ╰───── operator `Mul` cannot be applied to `1 | 2 | 3 | 4 | 5` and `2`
114-
// │
115-
// │ Note: Error code: E0001
116-
// ────╯

baml_language/crates/baml_lsp2_actions_tests/test_files/syntax/headers/for_loop_mermaid.baml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,4 @@ function ForLoopWithHeaders() -> int {
2020

2121
//----
2222
//- diagnostics
23-
// Error: operator `Mul` cannot be applied to `1 | 2 | 3 | 4 | 5` and `2`
24-
// ╭─[ headers_for_loop_mermaid.baml:9:25 ]
25-
// │
26-
// 9 │ let processed = item * 2;
27-
// │ ────┬───
28-
// │ ╰───── operator `Mul` cannot be applied to `1 | 2 | 3 | 4 | 5` and `2`
29-
// │
30-
// │ Note: Error code: E0001
31-
// ───╯
23+
// <no-diagnostics-expected>

baml_language/crates/baml_lsp2_actions_tests/test_files/syntax/headers/for_loops.baml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,4 @@ function ForLoopWithHeaders() -> int {
2727

2828
//----
2929
//- diagnostics
30-
// Error: operator `Mul` cannot be applied to `1 | 2 | 3 | 4 | 5` and `2`
31-
// ╭─[ headers_for_loops.baml:9:25 ]
32-
// │
33-
// 9 │ let processed = item * 2;
34-
// │ ────┬───
35-
// │ ╰───── operator `Mul` cannot be applied to `1 | 2 | 3 | 4 | 5` and `2`
36-
// │
37-
// │ Note: Error code: E0001
38-
// ───╯
30+
// <no-diagnostics-expected>

baml_language/crates/baml_lsp2_actions_tests/test_files/syntax/headers/nested_if_statements.baml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,12 @@ function NestedIfStatements() -> string {
9494
// │
9595
// │ Note: Error code: E0012
9696
// ────╯
97-
// Error: type mismatch: expected string, got 2 | 13
97+
// Error: type mismatch: expected string, got int
9898
// ╭─[ headers_nested_if_statements.baml:58:5 ]
9999
// │
100100
// 58 │ e
101101
// │ ┬
102-
// │ ╰── type mismatch: expected string, got 2 | 13
102+
// │ ╰── type mismatch: expected string, got int
103103
// │
104104
// │ Note: Error code: E0001
105105
// ────╯

baml_language/crates/baml_lsp2_actions_tests/test_files/syntax/loops/break.baml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ function Nested() -> int {
4646

4747
//----
4848
//- diagnostics
49-
// Error: type mismatch: expected 1 | 2 | 3, got string
49+
// Error: type mismatch: expected int, got string
5050
// ╭─[ loops_break.baml:6:14 ]
5151
// │
5252
// 6 │ res.push("hi");
5353
// │ ──┬─
54-
// │ ╰─── type mismatch: expected 1 | 2 | 3, got string
54+
// │ ╰─── type mismatch: expected int, got string
5555
// │
5656
// │ Note: Error code: E0001
5757
// ───╯

0 commit comments

Comments
 (0)