-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3762 from mtzguido/imps
Tc: fix implicit vs explicit check
- Loading branch information
Showing
4 changed files
with
164 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
module ArgsMismatch | ||
|
||
(* Attributes on arguments don't matter at all for applications. *) | ||
|
||
let foo (#x:int) (y:int) = x+y | ||
|
||
[@@expect_failure] let _ = foo 1 2 | ||
[@@expect_failure] let _ = foo #1 #2 | ||
let _ = foo #1 2 | ||
[@@expect_failure] let _ = foo 1 #2 | ||
|
||
let bar (#[@@@1]x:int) (y:int) = x+y | ||
|
||
[@@expect_failure] let _ = bar 1 2 | ||
[@@expect_failure] let _ = bar #1 #2 | ||
let _ = bar #1 2 | ||
[@@expect_failure] let _ = bar 1 #2 | ||
|
||
let baz (#x:int) ([@@@2]y:int) = x+y | ||
|
||
[@@expect_failure] let _ = baz 1 2 | ||
[@@expect_failure] let _ = baz #1 #2 | ||
let _ = baz #1 2 | ||
[@@expect_failure] let _ = baz 1 #2 | ||
|
||
let qux (#[@@@1]x:int) ([@@@2]y:int) = x+y | ||
|
||
[@@expect_failure] let _ = qux 1 2 | ||
[@@expect_failure] let _ = qux #1 #2 | ||
let _ = qux #1 2 | ||
[@@expect_failure] let _ = qux 1 #2 |
36 changes: 36 additions & 0 deletions
36
tests/error-messages/ArgsMismatch.fst.json_output.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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
>> Got issues: [ | ||
{"msg":["Too many arguments to function of type y: Prims.int -> Prims.int","Got\n2\narguments","Remaining type is Prims.int"],"level":"Error","range":{"def":{"file_name":"ArgsMismatch.fst","start_pos":{"line":7,"col":33},"end_pos":{"line":7,"col":34}},"use":{"file_name":"ArgsMismatch.fst","start_pos":{"line":7,"col":33},"end_pos":{"line":7,"col":34}}},"number":173,"ctx":["While typechecking the top-level declaration `let uu___0`","While typechecking the top-level declaration `[@@expect_failure] let uu___0`"]} | ||
>>] | ||
>> Got issues: [ | ||
{"msg":["Inconsistent argument qualifiers.","Expected an implicit argument, got an explicit one."],"level":"Error","range":{"def":{"file_name":"ArgsMismatch.fst","start_pos":{"line":8,"col":35},"end_pos":{"line":8,"col":36}},"use":{"file_name":"ArgsMismatch.fst","start_pos":{"line":8,"col":35},"end_pos":{"line":8,"col":36}}},"number":92,"ctx":["While typechecking the top-level declaration `let uu___0`","While typechecking the top-level declaration `[@@expect_failure] let uu___0`"]} | ||
>>] | ||
>> Got issues: [ | ||
{"msg":["Too many arguments to function of type y: Prims.int -> Prims.int","Got\n2\narguments","Remaining type is Prims.int"],"level":"Error","range":{"def":{"file_name":"ArgsMismatch.fst","start_pos":{"line":10,"col":34},"end_pos":{"line":10,"col":35}},"use":{"file_name":"ArgsMismatch.fst","start_pos":{"line":10,"col":34},"end_pos":{"line":10,"col":35}}},"number":173,"ctx":["While typechecking the top-level declaration `let uu___1`","While typechecking the top-level declaration `[@@expect_failure] let uu___1`"]} | ||
>>] | ||
>> Got issues: [ | ||
{"msg":["Too many arguments to function of type y: Prims.int -> Prims.int","Got\n2\narguments","Remaining type is Prims.int"],"level":"Error","range":{"def":{"file_name":"ArgsMismatch.fst","start_pos":{"line":14,"col":33},"end_pos":{"line":14,"col":34}},"use":{"file_name":"ArgsMismatch.fst","start_pos":{"line":14,"col":33},"end_pos":{"line":14,"col":34}}},"number":173,"ctx":["While typechecking the top-level declaration `let uu___1`","While typechecking the top-level declaration `[@@expect_failure] let uu___1`"]} | ||
>>] | ||
>> Got issues: [ | ||
{"msg":["Inconsistent argument qualifiers.","Expected an implicit argument, got an explicit one."],"level":"Error","range":{"def":{"file_name":"ArgsMismatch.fst","start_pos":{"line":15,"col":35},"end_pos":{"line":15,"col":36}},"use":{"file_name":"ArgsMismatch.fst","start_pos":{"line":15,"col":35},"end_pos":{"line":15,"col":36}}},"number":92,"ctx":["While typechecking the top-level declaration `let uu___1`","While typechecking the top-level declaration `[@@expect_failure] let uu___1`"]} | ||
>>] | ||
>> Got issues: [ | ||
{"msg":["Too many arguments to function of type y: Prims.int -> Prims.int","Got\n2\narguments","Remaining type is Prims.int"],"level":"Error","range":{"def":{"file_name":"ArgsMismatch.fst","start_pos":{"line":17,"col":34},"end_pos":{"line":17,"col":35}},"use":{"file_name":"ArgsMismatch.fst","start_pos":{"line":17,"col":34},"end_pos":{"line":17,"col":35}}},"number":173,"ctx":["While typechecking the top-level declaration `let uu___2`","While typechecking the top-level declaration `[@@expect_failure] let uu___2`"]} | ||
>>] | ||
>> Got issues: [ | ||
{"msg":["Too many arguments to function of type [@@@ 2]y: Prims.int -> Prims.int","Got\n2\narguments","Remaining type is Prims.int"],"level":"Error","range":{"def":{"file_name":"ArgsMismatch.fst","start_pos":{"line":21,"col":33},"end_pos":{"line":21,"col":34}},"use":{"file_name":"ArgsMismatch.fst","start_pos":{"line":21,"col":33},"end_pos":{"line":21,"col":34}}},"number":173,"ctx":["While typechecking the top-level declaration `let uu___2`","While typechecking the top-level declaration `[@@expect_failure] let uu___2`"]} | ||
>>] | ||
>> Got issues: [ | ||
{"msg":["Inconsistent argument qualifiers.","Expected an implicit argument, got an explicit one."],"level":"Error","range":{"def":{"file_name":"ArgsMismatch.fst","start_pos":{"line":22,"col":35},"end_pos":{"line":22,"col":36}},"use":{"file_name":"ArgsMismatch.fst","start_pos":{"line":22,"col":35},"end_pos":{"line":22,"col":36}}},"number":92,"ctx":["While typechecking the top-level declaration `let uu___2`","While typechecking the top-level declaration `[@@expect_failure] let uu___2`"]} | ||
>>] | ||
>> Got issues: [ | ||
{"msg":["Too many arguments to function of type [@@@ 2]y: Prims.int -> Prims.int","Got\n2\narguments","Remaining type is Prims.int"],"level":"Error","range":{"def":{"file_name":"ArgsMismatch.fst","start_pos":{"line":24,"col":34},"end_pos":{"line":24,"col":35}},"use":{"file_name":"ArgsMismatch.fst","start_pos":{"line":24,"col":34},"end_pos":{"line":24,"col":35}}},"number":173,"ctx":["While typechecking the top-level declaration `let uu___3`","While typechecking the top-level declaration `[@@expect_failure] let uu___3`"]} | ||
>>] | ||
>> Got issues: [ | ||
{"msg":["Too many arguments to function of type [@@@ 2]y: Prims.int -> Prims.int","Got\n2\narguments","Remaining type is Prims.int"],"level":"Error","range":{"def":{"file_name":"ArgsMismatch.fst","start_pos":{"line":28,"col":33},"end_pos":{"line":28,"col":34}},"use":{"file_name":"ArgsMismatch.fst","start_pos":{"line":28,"col":33},"end_pos":{"line":28,"col":34}}},"number":173,"ctx":["While typechecking the top-level declaration `let uu___3`","While typechecking the top-level declaration `[@@expect_failure] let uu___3`"]} | ||
>>] | ||
>> Got issues: [ | ||
{"msg":["Inconsistent argument qualifiers.","Expected an implicit argument, got an explicit one."],"level":"Error","range":{"def":{"file_name":"ArgsMismatch.fst","start_pos":{"line":29,"col":35},"end_pos":{"line":29,"col":36}},"use":{"file_name":"ArgsMismatch.fst","start_pos":{"line":29,"col":35},"end_pos":{"line":29,"col":36}}},"number":92,"ctx":["While typechecking the top-level declaration `let uu___3`","While typechecking the top-level declaration `[@@expect_failure] let uu___3`"]} | ||
>>] | ||
>> Got issues: [ | ||
{"msg":["Too many arguments to function of type [@@@ 2]y: Prims.int -> Prims.int","Got\n2\narguments","Remaining type is Prims.int"],"level":"Error","range":{"def":{"file_name":"ArgsMismatch.fst","start_pos":{"line":31,"col":34},"end_pos":{"line":31,"col":35}},"use":{"file_name":"ArgsMismatch.fst","start_pos":{"line":31,"col":34},"end_pos":{"line":31,"col":35}}},"number":173,"ctx":["While typechecking the top-level declaration `let uu___4`","While typechecking the top-level declaration `[@@expect_failure] let uu___4`"]} | ||
>>] |
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,80 @@ | ||
>> Got issues: [ | ||
* Error 173 at ArgsMismatch.fst(7,33-7,34): | ||
- Too many arguments to function of type y: Prims.int -> Prims.int | ||
- Got 2 arguments | ||
- Remaining type is Prims.int | ||
|
||
>>] | ||
>> Got issues: [ | ||
* Error 92 at ArgsMismatch.fst(8,35-8,36): | ||
- Inconsistent argument qualifiers. | ||
- Expected an implicit argument, got an explicit one. | ||
|
||
>>] | ||
>> Got issues: [ | ||
* Error 173 at ArgsMismatch.fst(10,34-10,35): | ||
- Too many arguments to function of type y: Prims.int -> Prims.int | ||
- Got 2 arguments | ||
- Remaining type is Prims.int | ||
|
||
>>] | ||
>> Got issues: [ | ||
* Error 173 at ArgsMismatch.fst(14,33-14,34): | ||
- Too many arguments to function of type y: Prims.int -> Prims.int | ||
- Got 2 arguments | ||
- Remaining type is Prims.int | ||
|
||
>>] | ||
>> Got issues: [ | ||
* Error 92 at ArgsMismatch.fst(15,35-15,36): | ||
- Inconsistent argument qualifiers. | ||
- Expected an implicit argument, got an explicit one. | ||
|
||
>>] | ||
>> Got issues: [ | ||
* Error 173 at ArgsMismatch.fst(17,34-17,35): | ||
- Too many arguments to function of type y: Prims.int -> Prims.int | ||
- Got 2 arguments | ||
- Remaining type is Prims.int | ||
|
||
>>] | ||
>> Got issues: [ | ||
* Error 173 at ArgsMismatch.fst(21,33-21,34): | ||
- Too many arguments to function of type [@@@ 2]y: Prims.int -> Prims.int | ||
- Got 2 arguments | ||
- Remaining type is Prims.int | ||
|
||
>>] | ||
>> Got issues: [ | ||
* Error 92 at ArgsMismatch.fst(22,35-22,36): | ||
- Inconsistent argument qualifiers. | ||
- Expected an implicit argument, got an explicit one. | ||
|
||
>>] | ||
>> Got issues: [ | ||
* Error 173 at ArgsMismatch.fst(24,34-24,35): | ||
- Too many arguments to function of type [@@@ 2]y: Prims.int -> Prims.int | ||
- Got 2 arguments | ||
- Remaining type is Prims.int | ||
|
||
>>] | ||
>> Got issues: [ | ||
* Error 173 at ArgsMismatch.fst(28,33-28,34): | ||
- Too many arguments to function of type [@@@ 2]y: Prims.int -> Prims.int | ||
- Got 2 arguments | ||
- Remaining type is Prims.int | ||
|
||
>>] | ||
>> Got issues: [ | ||
* Error 92 at ArgsMismatch.fst(29,35-29,36): | ||
- Inconsistent argument qualifiers. | ||
- Expected an implicit argument, got an explicit one. | ||
|
||
>>] | ||
>> Got issues: [ | ||
* Error 173 at ArgsMismatch.fst(31,34-31,35): | ||
- Too many arguments to function of type [@@@ 2]y: Prims.int -> Prims.int | ||
- Got 2 arguments | ||
- Remaining type is Prims.int | ||
|
||
>>] |