-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve diagnostic messages for errors in elaborating fun apps
- Loading branch information
Showing
13 changed files
with
227 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
//~ exit-code = 1 | ||
|
||
let _ : Type = Type true; | ||
let _ : Type = Type true false; | ||
{} |
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,19 @@ | ||
stdout = '' | ||
stderr = ''' | ||
error: tried to apply argument to non-function expression | ||
┌─ tests/fail/elaboration/fun-app/head-not-fun.fathom:3:16 | ||
│ | ||
3 │ let _ : Type = Type true; | ||
│ ^^^^ ---- argument | ||
│ │ | ||
│ expression of type `Type` | ||
error: tried to apply arguments to non-function expression | ||
┌─ tests/fail/elaboration/fun-app/head-not-fun.fathom:4:16 | ||
│ | ||
4 │ let _ : Type = Type true false; | ||
│ ^^^^ ---------- arguments | ||
│ │ | ||
│ expression of type `Type` | ||
''' |
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,21 @@ | ||
//~ exit-code = 1 | ||
|
||
let id = fun (x : Bool) => x; | ||
let always = fun (x : Bool) (y : Bool) => y; | ||
|
||
let _ : Bool = id true false; | ||
let _ : Bool = id true false false; | ||
|
||
let _ : Bool = always true true false; | ||
let _ : Bool = always true true false false; | ||
|
||
let id_poly = fun (@A : Type) (a : A) => a; | ||
let always_poly = fun (@A : Type) (@B : Type) (a : A) (b: B) => B; | ||
|
||
let _ : Bool = id_poly true false; | ||
let _ : Bool = id_poly true false false; | ||
|
||
let _ : Bool = always_poly true true false; | ||
let _ : Bool = always_poly true true false false; | ||
|
||
{} |
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,83 @@ | ||
stdout = '' | ||
stderr = ''' | ||
error: tried to apply too many arguments to function | ||
┌─ tests/fail/elaboration/fun-app/too-many-args.fathom:6:16 | ||
│ | ||
6 │ let _ : Bool = id true false; | ||
│ ^^ ----- extra argument | ||
│ │ | ||
│ expression of type `Bool -> Bool` | ||
│ | ||
= help: function expects 1 argument, but recieved 2 arguments | ||
error: tried to apply too many arguments to function | ||
┌─ tests/fail/elaboration/fun-app/too-many-args.fathom:7:16 | ||
│ | ||
7 │ let _ : Bool = id true false false; | ||
│ ^^ ----------- extra arguments | ||
│ │ | ||
│ expression of type `Bool -> Bool` | ||
│ | ||
= help: function expects 1 argument, but recieved 3 arguments | ||
error: tried to apply too many arguments to function | ||
┌─ tests/fail/elaboration/fun-app/too-many-args.fathom:9:16 | ||
│ | ||
9 │ let _ : Bool = always true true false; | ||
│ ^^^^^^ ----- extra argument | ||
│ │ | ||
│ expression of type `Bool -> Bool -> Bool` | ||
│ | ||
= help: function expects 2 arguments, but recieved 3 arguments | ||
error: tried to apply too many arguments to function | ||
┌─ tests/fail/elaboration/fun-app/too-many-args.fathom:10:16 | ||
│ | ||
10 │ let _ : Bool = always true true false false; | ||
│ ^^^^^^ ----------- extra arguments | ||
│ │ | ||
│ expression of type `Bool -> Bool -> Bool` | ||
│ | ||
= help: function expects 2 arguments, but recieved 4 arguments | ||
error: tried to apply too many arguments to function | ||
┌─ tests/fail/elaboration/fun-app/too-many-args.fathom:15:16 | ||
│ | ||
15 │ let _ : Bool = id_poly true false; | ||
│ ^^^^^^^ ----- extra argument | ||
│ │ | ||
│ expression of type `fun (@A : Type) -> A -> A` | ||
│ | ||
= help: function expects 1 argument, but recieved 2 arguments | ||
error: tried to apply too many arguments to function | ||
┌─ tests/fail/elaboration/fun-app/too-many-args.fathom:16:16 | ||
│ | ||
16 │ let _ : Bool = id_poly true false false; | ||
│ ^^^^^^^ ----------- extra arguments | ||
│ │ | ||
│ expression of type `fun (@A : Type) -> A -> A` | ||
│ | ||
= help: function expects 1 argument, but recieved 3 arguments | ||
error: tried to apply too many arguments to function | ||
┌─ tests/fail/elaboration/fun-app/too-many-args.fathom:18:16 | ||
│ | ||
18 │ let _ : Bool = always_poly true true false; | ||
│ ^^^^^^^^^^^ ----- extra argument | ||
│ │ | ||
│ expression of type `fun (@A : Type) (@B : Type) -> A -> B -> Type` | ||
│ | ||
= help: function expects 2 arguments, but recieved 3 arguments | ||
error: tried to apply too many arguments to function | ||
┌─ tests/fail/elaboration/fun-app/too-many-args.fathom:19:16 | ||
│ | ||
19 │ let _ : Bool = always_poly true true false false; | ||
│ ^^^^^^^^^^^ ----------- extra arguments | ||
│ │ | ||
│ expression of type `fun (@A : Type) (@B : Type) -> A -> B -> Type` | ||
│ | ||
= help: function expects 2 arguments, but recieved 4 arguments | ||
''' |
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...n/unexpected-argument/unbound-head-1.snap → ...l/elaboration/fun-app/unbound-head-1.snap
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
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...n/unexpected-argument/unbound-head-2.snap → ...l/elaboration/fun-app/unbound-head-2.snap
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
8 changes: 4 additions & 4 deletions
8
tests/fail/elaboration/implicit-args/unexpected-argument.snap
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,11 +1,11 @@ | ||
stdout = '' | ||
stderr = ''' | ||
error: expression was applied to an unexpected argument | ||
┌─ tests/fail/elaboration/implicit-args/unexpected-argument.fathom:3:7 | ||
error: tried to apply argument to non-function expression | ||
┌─ tests/fail/elaboration/implicit-args/unexpected-argument.fathom:3:1 | ||
│ | ||
3 │ true @Bool | ||
│ ---- ^^^^ unexpected argument | ||
│ ^^^^ ---- argument | ||
│ │ | ||
│ expression of type Bool | ||
│ expression of type `Bool` | ||
''' |
3 changes: 0 additions & 3 deletions
3
tests/fail/elaboration/unexpected-argument/record-type.fathom
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
tests/fail/elaboration/unexpected-argument/record-type.snap
This file was deleted.
Oops, something went wrong.