Skip to content

Commit 0dbeadd

Browse files
committedNov 25, 2022
Add inlining tests for curried/uncurried normal/async functions.
1 parent 79a5e09 commit 0dbeadd

File tree

3 files changed

+43
-1
lines changed

3 files changed

+43
-1
lines changed
 

‎CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ subset of the arguments, and return a curried type with the remaining ones https
2222
- Add support for uncurried externals https://github.com/rescript-lang/rescript-compiler/pull/5815 https://github.com/rescript-lang/rescript-compiler/pull/5819 https://github.com/rescript-lang/rescript-compiler/pull/5830
2323
- Parser/Printer: unify uncurried functions of arity 0, and of arity 1 taking unit. There's now only arity 1 in the source language. https://github.com/rescript-lang/rescript-compiler/pull/5825
2424
- Add support for default arguments in uncurried functions https://github.com/rescript-lang/rescript-compiler/pull/5835
25-
- Inline uncurried application when it is safe
25+
- Inline uncurried application when it is safe https://github.com/rescript-lang/rescript-compiler/pull/5847
2626

2727
#### :boom: Breaking Change
2828

‎jscomp/test/async_inline.js

+32
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,41 @@ async function broken$1(someAsyncFunction) {
3131

3232
var broken$2 = broken$1;
3333

34+
function curriedId(x) {
35+
return x;
36+
}
37+
38+
async function curriedIdAsync(x) {
39+
return x;
40+
}
41+
42+
function uncurriedId(x) {
43+
return x;
44+
}
45+
46+
async function uncurriedIdAsync(x) {
47+
return x;
48+
}
49+
50+
var tcia = curriedIdAsync(3);
51+
52+
var tui = 3;
53+
54+
var tuia = uncurriedIdAsync(3);
55+
56+
var tci = 3;
57+
3458
exports.willBeInlined = willBeInlined;
3559
exports.inlined = inlined;
3660
exports.wrapSomethingAsync = wrapSomethingAsync;
3761
exports.M = M;
3862
exports.broken = broken$2;
63+
exports.curriedId = curriedId;
64+
exports.curriedIdAsync = curriedIdAsync;
65+
exports.uncurriedId = uncurriedId;
66+
exports.uncurriedIdAsync = uncurriedIdAsync;
67+
exports.tci = tci;
68+
exports.tcia = tcia;
69+
exports.tui = tui;
70+
exports.tuia = tuia;
3971
/* inlined Not a pure module */

‎jscomp/test/async_inline.res

+10
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,13 @@ let broken = async (someAsyncFunction) => {
2626
}
2727

2828
let broken = someAsyncFunction => broken(someAsyncFunction)
29+
30+
let curriedId = x => x
31+
let curriedIdAsync = async x => x
32+
let uncurriedId = (.x ) => x
33+
let uncurriedIdAsync = async (.x ) => x
34+
35+
let tci = curriedId(3)
36+
let tcia = curriedIdAsync(3)
37+
let tui = uncurriedId(. 3)
38+
let tuia = uncurriedIdAsync(. 3)

0 commit comments

Comments
 (0)