-
Notifications
You must be signed in to change notification settings - Fork 471
Move Option stdlib optimizations into typed pipeline #7921
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
base: options-stdlib-opt
Are you sure you want to change the base?
Conversation
return category.name; | ||
let __res_option_opt; | ||
if (incidentId !== undefined) { | ||
let incidentId$1 = Primitive_option.valFromOption(incidentId); |
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.
Output looks worse than the Parsetree version.
These Primitive_option.valFromOption
should not be needed.
function testPrimitive() { | ||
console.log(42); | ||
let value = 42; | ||
console.log(value); |
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.
Why did we lose the optimization here?
As we are doing the transformation on the typed level now, shouldn't we add some type checking tests, too? |
```rescript | ||
Js.String.charCodeAt(0, `😺`) == 0xd83d->Belt.Int.toFloat | ||
Js.String.codePointAt(0, `😺`) == Some(0x1f63a) |
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.
Are you removing this because it's not really an example for charCodeAt
or because the test failed? (Actually this should be correct / the test should work.)
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.
Don't know it failed before already. Not sure.
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.
You may need to remove tests/docstring_tests/generated_mocha_test.res and re-run the tests.
9202879
to
fd1a69d
Compare
let category = categoryId !== undefined ? Belt_MapString.get(categories, categoryId) : undefined; | ||
if (category !== undefined) { | ||
return category.name; | ||
let __res_option_opt = incidentId !== undefined ? Belt_MapString.get(incidents, incidentId) : undefined; |
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.
Now the output is the same except for worse variable naming. 🙂
Can we produce the identical output?
f1692ff
to
4496782
Compare
97812a7
to
5ac5fc9
Compare
4496782
to
50dbc3c
Compare
# Conflicts: # packages/@rescript/runtime/Stdlib_DataView.resi
5ac5fc9
to
5171806
Compare
Rebased after the Docstring test fixes |
Summary
Testing