-
Notifications
You must be signed in to change notification settings - Fork 470
Switch on uncurried #6864
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Switch on uncurried #6864
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
6a6a9f7
Fix issues with the arity of externals.
cristianoc 11d5787
Audit what files are compiled in curried mode.
cristianoc 3e4dd91
Remove `@uncurry` needed to turn on uncurried for `others`.
cristianoc 651888d
Don't rely on Curry in unit tests.
cristianoc d1854ba
Switch the compiler to build in uncurried mode.
cristianoc 6f1f563
Update compiler artifacts.
cristianoc 2175004
Remove temporary `-curried` option.
cristianoc 49ac039
Update CHANGELOG.md
cristianoc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,28 +0,0 @@ | ||
|
||
[1;31mWe've found a bug for you![0m | ||
[36m/.../fixtures/c_for_u_in_c_mode.res[0m:[2m3:5-5:1[0m | ||
|
||
1 [2m│[0m module Foo: { | ||
2 [2m│[0m let add: (. int, int) => int | ||
[1;31m3[0m [2m│[0m } = [1;31m{[0m | ||
[1;31m4[0m [2m│[0m [1;31m let add = (a, b) => a + b[0m | ||
[1;31m5[0m [2m│[0m [1;31m}[0m | ||
6 [2m│[0m | ||
|
||
Signature mismatch: | ||
Modules do not match: | ||
{ | ||
let add: (int, int) => int | ||
} | ||
is not included in | ||
{ | ||
let add: (. int, int) => int | ||
} | ||
Values do not match: | ||
let add: (int, int) => int (curried) | ||
is not included in | ||
let add: (. int, int) => int (uncurried) | ||
[36m/.../fixtures/c_for_u_in_c_mode.res[0m:[2m2:3-30[0m: | ||
Expected declaration | ||
[36m/.../fixtures/c_for_u_in_c_mode.res[0m:[2m4:7-9[0m: | ||
Actual declaration | ||
This file contains hidden or 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 hidden or 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 +0,0 @@ | ||
|
||
[1;31mWe've found a bug for you![0m | ||
[36m/.../fixtures/curry_in_uncurry.res[0m:[2m3:1[0m | ||
|
||
1 [2m│[0m let f = (a, b) => a + b | ||
2 [2m│[0m | ||
[1;31m3[0m [2m│[0m [1;31mf[0m(. 2, 2)->Js.log | ||
4 [2m│[0m | ||
|
||
This function is a curried function where an uncurried function is expected | ||
This file contains hidden or 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
7 changes: 4 additions & 3 deletions
7
jscomp/build_tests/super_errors/expected/missing_label.res.expected
This file contains hidden or 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,11 @@ | ||
|
||
[1;31mWe've found a bug for you![0m | ||
[36m/.../fixtures/missing_label.res[0m:[2m3:9[0m | ||
[36m/.../fixtures/missing_label.res[0m:[2m3:11-12[0m | ||
|
||
1 [2m│[0m let f = (~a) => a ++ "" | ||
2 [2m│[0m | ||
[1;31m3[0m [2m│[0m let _ = [1;31mf[0m("") | ||
[1;31m3[0m [2m│[0m let _ = f([1;31m""[0m) | ||
4 [2m│[0m | ||
|
||
Label ~a was omitted in the application of this labeled function. | ||
The function applied to this argument has type (~a: string) => string | ||
This argument cannot be applied without label |
8 changes: 5 additions & 3 deletions
8
jscomp/build_tests/super_errors/expected/missing_labels.res.expected
This file contains hidden or 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,12 @@ | ||
|
||
[1;31mWe've found a bug for you![0m | ||
[36m/.../fixtures/missing_labels.res[0m:[2m3:9[0m | ||
[36m/.../fixtures/missing_labels.res[0m:[2m3:11-12[0m | ||
|
||
1 [2m│[0m let f = (~a, ~b) => a ++ b | ||
2 [2m│[0m | ||
[1;31m3[0m [2m│[0m let _ = [1;31mf[0m("", "") | ||
[1;31m3[0m [2m│[0m let _ = f([1;31m""[0m, "") | ||
4 [2m│[0m | ||
|
||
Labels ~a, ~b were omitted in the application of this labeled function. | ||
The function applied to this argument has type | ||
(~a: string, ~b: string) => string | ||
This argument cannot be applied without label |
7 changes: 4 additions & 3 deletions
7
jscomp/build_tests/super_errors/expected/moreArguments1.res.expected
This file contains hidden or 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,9 +1,10 @@ | ||
|
||
[1;31mWe've found a bug for you![0m | ||
[36m/.../fixtures/moreArguments1.res[0m:[2m2:9-15[0m | ||
[36m/.../fixtures/moreArguments1.res[0m:[2m2:9[0m | ||
|
||
1 [2m│[0m let x = (~a, ~b) => a + b | ||
[1;31m2[0m [2m│[0m let y = [1;31mx(~a=2)[0m + 2 | ||
[1;31m2[0m [2m│[0m let y = [1;31mx[0m(~a=2) + 2 | ||
3 [2m│[0m | ||
|
||
[1;33mThis call is missing an argument[0m of type (~b: int) | ||
This uncurried function has type (~a: int, ~b: int) => int | ||
It is applied with [1;31m1[0m arguments but it requires [1;33m2[0m. |
7 changes: 4 additions & 3 deletions
7
jscomp/build_tests/super_errors/expected/moreArguments2.res.expected
This file contains hidden or 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,9 +1,10 @@ | ||
|
||
[1;31mWe've found a bug for you![0m | ||
[36m/.../fixtures/moreArguments2.res[0m:[2m2:9-12[0m | ||
[36m/.../fixtures/moreArguments2.res[0m:[2m2:9[0m | ||
|
||
1 [2m│[0m let x = (a, b) => a + b | ||
[1;31m2[0m [2m│[0m let y = [1;31mx(2)[0m + 2 | ||
[1;31m2[0m [2m│[0m let y = [1;31mx[0m(2) + 2 | ||
3 [2m│[0m | ||
|
||
[1;33mThis call is missing an argument[0m of type int | ||
This uncurried function has type (int, int) => int | ||
It is applied with [1;31m1[0m arguments but it requires [1;33m2[0m. |
7 changes: 4 additions & 3 deletions
7
jscomp/build_tests/super_errors/expected/moreArguments3.res.expected
This file contains hidden or 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,9 +1,10 @@ | ||
|
||
[1;31mWe've found a bug for you![0m | ||
[36m/.../fixtures/moreArguments3.res[0m:[2m2:9-12[0m | ||
[36m/.../fixtures/moreArguments3.res[0m:[2m2:9[0m | ||
|
||
1 [2m│[0m let x = (a, b, c, d) => a + b | ||
[1;31m2[0m [2m│[0m let y = [1;31mx(2)[0m + 2 | ||
[1;31m2[0m [2m│[0m let y = [1;31mx[0m(2) + 2 | ||
3 [2m│[0m | ||
|
||
[1;33mThis call is missing arguments[0m of type: int, 'a, 'b | ||
This uncurried function has type (int, int, 'a, 'b) => int | ||
It is applied with [1;31m1[0m arguments but it requires [1;33m4[0m. |
7 changes: 4 additions & 3 deletions
7
jscomp/build_tests/super_errors/expected/moreArguments4.res.expected
This file contains hidden or 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,9 +1,10 @@ | ||
|
||
[1;31mWe've found a bug for you![0m | ||
[36m/.../fixtures/moreArguments4.res[0m:[2m2:9-12[0m | ||
[36m/.../fixtures/moreArguments4.res[0m:[2m2:9[0m | ||
|
||
1 [2m│[0m let x = (a, ~b, ~c, ~d) => a + b | ||
[1;31m2[0m [2m│[0m let y = [1;31mx(2)[0m + 2 | ||
[1;31m2[0m [2m│[0m let y = [1;31mx[0m(2) + 2 | ||
3 [2m│[0m | ||
|
||
[1;33mThis call is missing arguments[0m of type: (~b: int), (~c: 'a), (~d: 'b) | ||
This uncurried function has type (int, ~b: int, ~c: 'a, ~d: 'b) => int | ||
It is applied with [1;31m1[0m arguments but it requires [1;33m4[0m. |
7 changes: 4 additions & 3 deletions
7
jscomp/build_tests/super_errors/expected/moreArguments5.res.expected
This file contains hidden or 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,11 @@ | ||
|
||
[1;31mWe've found a bug for you![0m | ||
[36m/.../fixtures/moreArguments5.res[0m:[2m5:9-12[0m | ||
[36m/.../fixtures/moreArguments5.res[0m:[2m5:9[0m | ||
|
||
3 [2m│[0m } | ||
4 [2m│[0m let x = (a, b, c, d) => {Sub.a: 2} | ||
[1;31m5[0m [2m│[0m let y = [1;31mx(2)[0m.Sub.a | ||
[1;31m5[0m [2m│[0m let y = [1;31mx[0m(2).Sub.a | ||
6 [2m│[0m | ||
|
||
[1;33mThis call is missing arguments[0m of type: 'a, 'b, 'c | ||
This uncurried function has type (int, 'a, 'b, 'c) => Sub.a | ||
It is applied with [1;31m1[0m arguments but it requires [1;33m4[0m. |
15 changes: 5 additions & 10 deletions
15
jscomp/build_tests/super_errors/expected/partial_app.res.expected
This file contains hidden or 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,16 +1,11 @@ | ||
|
||
[1;31mWarning number 109[0m (configured as error) | ||
[36m/.../fixtures/partial_app.res[0m:[2m5:1-7[0m | ||
[1;31mWe've found a bug for you![0m | ||
[36m/.../fixtures/partial_app.res[0m:[2m5:1[0m | ||
|
||
3 [2m│[0m } | ||
4 [2m│[0m | ||
[1;31m5[0m [2m│[0m [1;31mf(1, 2)[0m | ||
[1;31m5[0m [2m│[0m [1;31mf[0m(1, 2) | ||
6 [2m│[0m | ||
|
||
This function call is at the top level and is expected to return `unit`. But it's returning `int => int`. | ||
|
||
In ReScript, anything at the top level must evaluate to `unit`. You can fix this by assigning the expression to a value, or piping it into the `ignore` function. | ||
|
||
Possible solutions: | ||
- Assigning to a value that is then ignored: `let _ = yourFunctionCall()` | ||
- Piping into the built-in ignore function to ignore the result: `yourFunctionCall()->ignore` | ||
This uncurried function has type (int, int, int) => int | ||
It is applied with [1;31m2[0m arguments but it requires [1;33m3[0m. |
This file contains hidden or 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 hidden or 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,28 +0,0 @@ | ||
|
||
[1;31mWe've found a bug for you![0m | ||
[36m/.../fixtures/u_for_c_in_c_mode.res[0m:[2m3:5-5:1[0m | ||
|
||
1 [2m│[0m module Foo: { | ||
2 [2m│[0m let add: (int, int) => int | ||
[1;31m3[0m [2m│[0m } = [1;31m{[0m | ||
[1;31m4[0m [2m│[0m [1;31m let add = (. a, b) => a + b[0m | ||
[1;31m5[0m [2m│[0m [1;31m}[0m | ||
6 [2m│[0m | ||
|
||
Signature mismatch: | ||
Modules do not match: | ||
{ | ||
let add: (. int, int) => int | ||
} | ||
is not included in | ||
{ | ||
let add: (int, int) => int | ||
} | ||
Values do not match: | ||
let add: (. int, int) => int (uncurried) | ||
is not included in | ||
let add: (int, int) => int (curried) | ||
[36m/.../fixtures/u_for_c_in_c_mode.res[0m:[2m2:3-28[0m: | ||
Expected declaration | ||
[36m/.../fixtures/u_for_c_in_c_mode.res[0m:[2m4:7-9[0m: | ||
Actual declaration | ||
This file contains hidden or 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,9 +0,0 @@ | ||
|
||
[1;31mWe've found a bug for you![0m | ||
[36m/.../fixtures/uncurried_expected.res[0m:[2m2:15-22[0m | ||
|
||
1 [2m│[0m let apply = (f) => f(. 1) | ||
[1;31m2[0m [2m│[0m let z = apply([1;31mx => x+1[0m) | ||
3 [2m│[0m | ||
|
||
This expression is expected to have an uncurried function | ||
This file contains hidden or 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
jscomp/build_tests/super_errors/expected/warnings1.res.expected
This file contains hidden or 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,12 +1,12 @@ | ||
|
||
[1;31mWe've found a bug for you![0m | ||
[36m/.../fixtures/warnings1.res[0m:[2m3:3-7[0m | ||
[36m/.../fixtures/warnings1.res[0m:[2m3:3[0m | ||
|
||
1 [2m│[0m let x = (a, b) => a + b | ||
2 [2m│[0m let z = () => { | ||
[1;31m3[0m [2m│[0m [1;31mx(10)[0m | ||
[1;31m3[0m [2m│[0m [1;31mx[0m(10) | ||
4 [2m│[0m 10 | ||
5 [2m│[0m } | ||
|
||
This function call returns: [1;31mint => int[0m | ||
But it's expected to return: [1;33munit[0m | ||
This uncurried function has type (int, int) => int | ||
It is applied with [1;31m1[0m arguments but it requires [1;33m2[0m. |
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a separate PR, we should change "This uncurried function has ..." to "This function has ...".