-
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(parser): fixing row/col computation while backtracking in the par…
…ser, leading to finally correct symbol underlined in errors
- Loading branch information
Showing
31 changed files
with
54 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
tests/unittests/resources/DiagnosticsSuite/compileTime/append_in_place.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
At a @ 2:12 | ||
At a @ 2:10 | ||
1 | (let a []) | ||
2 | (append! a 5) | ||
| ^ | ||
| ^ | ||
3 | | ||
MutabilityError: Can not modify the constant list `a' using `append!' |
4 changes: 2 additions & 2 deletions
4
tests/unittests/resources/DiagnosticsSuite/compileTime/argcount_unknown_arg.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
At test_func1!2 @ 13:41 | ||
At test_func1!2 @ 13:28 | ||
10 | | ||
11 | (let test_func (fun (a b c) (* a b c))) | ||
12 | (let test_func1 (partial test_func 1)) | ||
13 | (let test_func1_2 (partial test_func1!2)) | ||
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| ^~~~~~~~~~~~ | ||
14 | | ||
When expanding `$argcount', expected a known function name, got unbound variable test_func1!2 |
4 changes: 2 additions & 2 deletions
4
tests/unittests/resources/DiagnosticsSuite/compileTime/capture_out_of_scope.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
At &cap @ 2:17 | ||
At &cap @ 2:16 | ||
1 | (let bar (fun () (let cap 0))) | ||
2 | (let foo (fun (&cap) ())) | ||
| ^~~~ | ||
| ^~~~ | ||
3 | (print foo bar) | ||
4 | | ||
Can not capture cap because it is referencing a variable defined in an unreachable scope. |
4 changes: 2 additions & 2 deletions
4
tests/unittests/resources/DiagnosticsSuite/compileTime/concat_in_place.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
At a @ 2:12 | ||
At a @ 2:10 | ||
1 | (let a []) | ||
2 | (concat! a [5]) | ||
| ^ | ||
| ^ | ||
3 | | ||
MutabilityError: Can not modify the constant list `a' using `concat!' |
4 changes: 2 additions & 2 deletions
4
tests/unittests/resources/DiagnosticsSuite/compileTime/freestanding.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
At nil? @ 2:15 | ||
At nil? @ 2:10 | ||
1 | (let ba0 (fun (a b) ())) | ||
2 | (ba0 0 0 nil?) | ||
| ^~~~~~~~~~~~~~ | ||
| ^~~~ | ||
3 | | ||
Found a free standing operator: `nil?` |
2 changes: 1 addition & 1 deletion
2
tests/unittests/resources/DiagnosticsSuite/compileTime/invalid_node_in_call.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
At (foo (begin)) @ 2:3 | ||
At (foo (begin)) @ 2:2 | ||
1 | (let foo (fun (a) ())) | ||
2 | (foo {}) | ||
| ^~~~~~~~ | ||
|
4 changes: 2 additions & 2 deletions
4
tests/unittests/resources/DiagnosticsSuite/compileTime/invalid_sym_func_def.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
At 0 @ 2:10 | ||
At 0 @ 2:8 | ||
1 | ($ defun (name args body) (let name (fun args body))) | ||
2 | (defun 0 (a b) (+ a b)) | ||
| ^ | ||
| ^ | ||
3 | | ||
Can not use a Number to define a variable |
4 changes: 2 additions & 2 deletions
4
tests/unittests/resources/DiagnosticsSuite/compileTime/let_no_sym.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
At ( @ 2:7 | ||
At ( @ 2:6 | ||
1 | (let foo (fun () ())) | ||
2 | (let (foo a b) 5) | ||
| ^ | ||
| ^ | ||
3 | | ||
let needs a symbol |
2 changes: 1 addition & 1 deletion
2
tests/unittests/resources/DiagnosticsSuite/compileTime/macro_empty_arity_error.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
At (empty? 1 2) @ 2:10 | ||
At (empty? 1 2) @ 2:8 | ||
1 | ($ a (empty? 1 2)) | ||
2 | (print a) | ||
| ^~~~~~~~~ | ||
|
3 changes: 1 addition & 2 deletions
3
tests/unittests/resources/DiagnosticsSuite/compileTime/macro_head_arity_error.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
At (head 1 2) @ 2:10 | ||
At (head 1 2) @ 2:8 | ||
1 | ($ a (head 1 2)) | ||
2 | (print a) | ||
| ^~~~~~~~~ | ||
3 | | ||
| ^ | ||
When expanding `head' inside a macro, got 2 arguments, expected 1 |
3 changes: 1 addition & 2 deletions
3
tests/unittests/resources/DiagnosticsSuite/compileTime/macro_len_arity_error.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
At (len 1 2) @ 2:10 | ||
At (len 1 2) @ 2:8 | ||
1 | ($ a (len 1 2)) | ||
2 | (print a) | ||
| ^~~~~~~~~ | ||
3 | | ||
| ^ | ||
When expanding `len' inside a macro, got 2 arguments, expected 1 |
2 changes: 1 addition & 1 deletion
2
tests/unittests/resources/DiagnosticsSuite/compileTime/macro_paste_arity_error.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
At ($paste b (list)) @ 2:10 | ||
At ($paste b (list)) @ 2:8 | ||
1 | ($ a ($paste b [])) | ||
2 | (print a) | ||
| ^~~~~~~~~ | ||
|
2 changes: 1 addition & 1 deletion
2
tests/unittests/resources/DiagnosticsSuite/compileTime/macro_spread_not_enough_args.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
At (foo 1 2) @ 4:3 | ||
At (foo 1 2) @ 4:2 | ||
1 | ($ foo (a b c ...d) | ||
2 | (+ a b c ...d)) | ||
3 | | ||
|
2 changes: 1 addition & 1 deletion
2
tests/unittests/resources/DiagnosticsSuite/compileTime/macro_symcat_type_error.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
At ($symcat 5 2) @ 2:10 | ||
At ($symcat 5 2) @ 2:8 | ||
1 | ($ a ($symcat 5 2)) | ||
2 | (print a) | ||
| ^~~~~~~~~ | ||
|
3 changes: 1 addition & 2 deletions
3
tests/unittests/resources/DiagnosticsSuite/compileTime/macro_tail_arity_error.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
At (tail 1 2) @ 2:10 | ||
At (tail 1 2) @ 2:8 | ||
1 | ($ a (tail 1 2)) | ||
2 | (print a) | ||
| ^~~~~~~~~ | ||
3 | | ||
| ^ | ||
When expanding `tail' inside a macro, got 2 arguments, expected 1 |
4 changes: 2 additions & 2 deletions
4
tests/unittests/resources/DiagnosticsSuite/compileTime/max_unification_depth.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
At ($ partial (func ...defargs) (begin ($ bloc (suffix-dup a (len defargs))) (fun (bloc) (func ...defargs bloc)) ($undef bloc))) @ 17:18 | ||
At ($ partial (func ...defargs) (begin ($ bloc (suffix-dup a (len defargs))) (fun (bloc) (func ...defargs bloc)) ($undef bloc))) @ 17:17 | ||
14 | (* a b) | ||
15 | (let inner (partial te t_func 0)) | ||
16 | (let est_func | ||
17 | ($ partial (func ...defargs) { | ||
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
18 | ($ bloc (suffix-dup a (len defargs))) | ||
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
19 | (fun (bloc) (func ...defargs bloc)) | ||
Max macro unification depth reached (256). You may have a macro trying to evaluate itself, try splitting your code in multiple nodes. |
2 changes: 1 addition & 1 deletion
2
tests/unittests/resources/DiagnosticsSuite/compileTime/not_enough_args.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
At (foo 1 2) @ 4:3 | ||
At (foo 1 2) @ 4:2 | ||
1 | ($ foo (a b c) | ||
2 | (+ a b c)) | ||
3 | | ||
|
4 changes: 2 additions & 2 deletions
4
tests/unittests/resources/DiagnosticsSuite/compileTime/pop_in_place.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
At a @ 2:9 | ||
At a @ 2:7 | ||
1 | (let a []) | ||
2 | (pop! a 1) | ||
| ^ | ||
| ^ | ||
3 | | ||
MutabilityError: Can not modify the constant list `a' using `pop!' |
4 changes: 2 additions & 2 deletions
4
tests/unittests/resources/DiagnosticsSuite/compileTime/self_append_in_place.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
At d @ 2:12 | ||
At d @ 2:10 | ||
1 | (mut d [4 5 6]) | ||
2 | (append! d d) | ||
| ^ | ||
| ^ | ||
3 | | ||
MutabilityError: Can not append! the list `d' to itself |
4 changes: 2 additions & 2 deletions
4
tests/unittests/resources/DiagnosticsSuite/compileTime/self_concat.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
At d @ 2:12 | ||
At d @ 2:10 | ||
1 | (mut d [4 5 6]) | ||
2 | (concat! d d) | ||
| ^ | ||
| ^ | ||
3 | | ||
MutabilityError: Can not concat! the list `d' to itself |
2 changes: 1 addition & 1 deletion
2
tests/unittests/resources/DiagnosticsSuite/compileTime/too_many_args.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
At (foo 1 2 3 4) @ 4:3 | ||
At (foo 1 2 3 4) @ 4:2 | ||
1 | ($ foo (a b c) | ||
2 | (+ a b c)) | ||
3 | | ||
|
4 changes: 2 additions & 2 deletions
4
tests/unittests/resources/DiagnosticsSuite/compileTime/unbound_but_namespace.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
At bar @ 3:12 | ||
At bar @ 3:8 | ||
1 | (import package.b) | ||
2 | | ||
3 | (print bar) | ||
| ^~~~~~~~~~~ | ||
| ^~~ | ||
4 | | ||
Unbound variable "bar". However, it exists in a namespace as "b:bar", did you forget to prefix it with its namespace? |
4 changes: 2 additions & 2 deletions
4
tests/unittests/resources/DiagnosticsSuite/compileTime/unbound_var.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
At b @ 1:9 | ||
At b @ 1:8 | ||
1 | (let a b) | ||
| ^~~~~~~~~ | ||
| ^ | ||
2 | | ||
Unbound variable error "b" (variable is used but not defined) |
4 changes: 2 additions & 2 deletions
4
tests/unittests/resources/DiagnosticsSuite/compileTime/unbound_var_suggestion.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
At ber @ 2:12 | ||
At ber @ 2:8 | ||
1 | (let bar 12) | ||
2 | (let a ber) | ||
| ^~~~~~~~~~~ | ||
| ^~~ | ||
3 | | ||
Unbound variable error "ber" (did you mean "bar"?) |
4 changes: 2 additions & 2 deletions
4
tests/unittests/resources/DiagnosticsSuite/compileTime/undef_macro_number.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
At 1 @ 1:10 | ||
At 1 @ 1:9 | ||
1 | ($undef 1) | ||
| ^~~~~~~~~~ | ||
| ^ | ||
2 | | ||
When expanding `$undef', got a Number. Can not un-define a macro without a valid name |
4 changes: 2 additions & 2 deletions
4
tests/unittests/resources/DiagnosticsSuite/compileTime/unevaluated_spread.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
At ...defargs @ 2:29 | ||
At ...defargs @ 2:18 | ||
1 | ($ partial { | ||
2 | (fun (a) (func ...defargs)) }) | ||
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| ^~~~~~~~~~ | ||
3 | | ||
4 | (let b (partial)) | ||
Found an unevaluated spread: `defargs' |
4 changes: 2 additions & 2 deletions
4
tests/unittests/resources/DiagnosticsSuite/compileTime/use_not_in_import_list.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
At abs @ 3:10 | ||
At abs @ 3:9 | ||
1 | (import package.c :odd) | ||
2 | | ||
3 | (print (abs 2)) | ||
| ^~~ | ||
| ^~~ | ||
4 | | ||
Unbound variable "abs". However, it exists in a namespace as "c:abs", did you forget to add it to the symbol list while importing? |
4 changes: 2 additions & 2 deletions
4
tests/unittests/resources/DiagnosticsSuite/compileTime/well_formed_args.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
At args @ 1:29 | ||
At args @ 1:25 | ||
1 | ($ defun (let name (fun args nil))) | ||
| ^~~~ | ||
| ^~~~ | ||
2 | (let foo 1) | ||
3 | (let a 2) | ||
Expected a well formed argument(s) list, got a Symbol |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
|
||
(fun (a) { | ||
a }) | ||
|
||
(call me maybe) | ||
(call | ||
(fun () { | ||
|