-
Notifications
You must be signed in to change notification settings - Fork 455
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
Negation #7138
Negation #7138
Conversation
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.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Syntax Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.05
.
Benchmark suite | Current: e07ee33 | Previous: e1b7fb7 | Ratio |
---|---|---|---|
Print Napkinscript.res - time/run |
81.46559703999999 ms |
77.00100409999999 ms |
1.06 |
This comment was automatically generated by workflow using github-action-benchmark.
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.
So good! Seems you need to rebuild the Core tests since some generated code there changed as well here.
The change from the Core tests does not look correct though?
|
BTW, can we omit the |
Updating it. |
@cknitt please check again. |
Here: #7139 |
@@ -386,9 +386,9 @@ function check$1(s) { | |||
return; | |||
} | |||
let match = s[0]; | |||
if (match === undefined || match === null || match === true) { | |||
if (match === true) { | |||
let match$1 = s[1]; |
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.
Wasn't this actually incorrect before?
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.
yes it was incorrect
let match$1 = s[1]; | ||
if (match$1 === undefined || match$1 === null || match$1 === false) { | ||
if (match$1 === false) { | ||
let match$2 = s[2]; | ||
if (match$2 === undefined || match$2 === null || match$2 === false || match$2 === true) { | ||
console.log("Nope..."); |
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.
Can't comment further below for some reason, and probably out of scope of this PR, but
if (match$3 === undefined || match$3 === null || match$3 === false || match$3 === true) {
console.log("Nope...");
return;
}
if (typeof match$3 === "string" && match$3 === "My name is") {
could just be
if (match$3 === "My name is") {
?
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.
can you move this to an issue? after this PR
to keep things from growing too much
@cristianoc Couldn't we raise a compiler warning in such cases because the if guards are incorrect here? I have no idea of how feasible/complex this would be to implement though. |
It's just a trick to test logical simplifications. |
Better logic to simplify negation.
For comparison,
on latest playground generates:
while here it generates:
For reference, the code without untagged variants is the following: