-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
select which kind of errors one wants to show
- Loading branch information
Showing
8 changed files
with
146 additions
and
11 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
(alias | ||
(name runtest) | ||
(deps (:t test.t) test.ml) | ||
(action | ||
(progn | ||
(setenv MERLIN %{dep:../merlin-wrapper} | ||
(run %{bin:mdx} test --syntax=cram %{t})) | ||
(diff? %{t} %{t}.corrected)))) |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
(* First a typing error *) | ||
|
||
let () = 3 | ||
|
||
(* Then a parsing error *) | ||
|
||
let () = | 3 | ||
|
||
(* Then a typing error again *) | ||
|
||
let () = 3 |
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 |
---|---|---|
@@ -0,0 +1,88 @@ | ||
First ask for all the errors: | ||
|
||
$ $MERLIN single errors -filename test.ml < test.ml | ||
{ | ||
"class": "return", | ||
"value": [ | ||
{ | ||
"start": { | ||
"line": 3, | ||
"col": 9 | ||
}, | ||
"end": { | ||
"line": 3, | ||
"col": 10 | ||
}, | ||
"type": "typer", | ||
"sub": [], | ||
"valid": true, | ||
"message": "This expression has type int but an expression was expected of type unit" | ||
}, | ||
{ | ||
"start": { | ||
"line": 7, | ||
"col": 9 | ||
}, | ||
"end": { | ||
"line": 7, | ||
"col": 10 | ||
}, | ||
"type": "parser", | ||
"sub": [], | ||
"valid": true, | ||
"message": "Syntax error, expecting expr" | ||
} | ||
], | ||
"notifications": [] | ||
} | ||
|
||
Notice that the second type error is not returned, as it happens after the first | ||
syntax error. | ||
|
||
Now let's just ask for typing errors: | ||
|
||
$ $MERLIN single errors -lexing false -parsing false -filename test.ml < test.ml | ||
{ | ||
"class": "return", | ||
"value": [ | ||
{ | ||
"start": { | ||
"line": 3, | ||
"col": 9 | ||
}, | ||
"end": { | ||
"line": 3, | ||
"col": 10 | ||
}, | ||
"type": "typer", | ||
"sub": [], | ||
"valid": true, | ||
"message": "This expression has type int but an expression was expected of type unit" | ||
} | ||
], | ||
"notifications": [] | ||
} | ||
|
||
And let's also try filtering out type errors: | ||
|
||
$ $MERLIN single errors -typing false -filename test.ml < test.ml | ||
{ | ||
"class": "return", | ||
"value": [ | ||
{ | ||
"start": { | ||
"line": 7, | ||
"col": 9 | ||
}, | ||
"end": { | ||
"line": 7, | ||
"col": 10 | ||
}, | ||
"type": "parser", | ||
"sub": [], | ||
"valid": true, | ||
"message": "Syntax error, expecting expr" | ||
} | ||
], | ||
"notifications": [] | ||
} |