Minifier sometimes chooses incorrect case clauses during evaluation. The selection logic of case clauses should be exactly same with Strict equal operator (===) due to CaseClauseIsSelected AO
Input code
"use strict";
const k = (function () {
switch (-0) {
case 0: console.log("hi"); break;
default: throw 0;
}
})();
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
Describe the bug
Minifier sometimes chooses incorrect case clauses during evaluation. The selection logic of case clauses should be exactly same with Strict equal operator (
===
) due toCaseClauseIsSelected
AOInput code
Config
Playground link (or link to the minimal reproduction)
https://play.swc.rs/?version=1.6.7&code=H4sIAAAAAAAAAyWLMQ7DIBAEe16xojqKRNRGeQy54ICMOAkOuYj8d8dJOaMZO0fC0F5YbTAsbSg2PEDrbKxFGsjhY4CxF%2BUMuvk%2FAxy%2Fq19wTVLTvcqbbC7WBTx7ilv4Va%2B0xll1geYuO%2FxlD3M4cuEE%2FNJuOnwAAAA%3D&config=H4sIAAAAAAAAA32UO5LbMAyG%2Bz2FR3WKjMscIF3OwKFJUKZDEhoC9Fqz47sHeviRNeROwocfIAEQXx%2B7XXci1%2F3afcmn%2FAy2EtT7v1hoLGwvYunAZUuuxoG7Hzd6ogkFmwhm03UhHdvaA88q2v%2Fc71dFlxAJborVlmOJYXzO6TAPFYiebGKVkC1DYfpfv7KKnxPg2p7tB8QEtrwhxpKJhaGHqgV2mJIdCMzZViXKdFJbI6GWYoKNwZuh4qDy4iNHLJLzlXqw3jj0oKBYwXE8gyaTXCIrJNdT7jNjD4fW93Ofv6nhbFOzrOSEy9wSOa0S9YiR2IRWtBIucKMGC1yL%2B10Zg6nArZZX3Qlj2ejJXwCpQLJExWbQ4s4eQeZpSx3eKmMJMrI8KlzmW7tlgV6KamIMSmWnykDlqHWzgm8Opso67Tgr3igfRQ8GQpBZUULTZ2R31JLyOAAGBUh%2FbdCmagHm%2Fgo3%2BPQg3uDfckvWB2z1yJaP25TGfMD0JkEGPqJ%2F4yCtYNzGVbbEZdjmrXiQ0QCvujSawesSkAfAaNK8L19mQ56HRDR9wsNjTawO1%2Fsezrb0j%2Fe%2BrOKP1aHL6NsM1yU%2F9XdazdKOjOVE3cPztorvp%2B8i%2FbnJl9jXf3MIldo2BgAA
SWC Info output
No response
Expected behavior
"use strict"; let k = function() { console.log("hi"); }();
Actual behavior
Version
1.6.7
Additional context
No response