Add new test for destructuring param with id collision#1765
Add new test for destructuring param with id collision#1765chicoxyzzy merged 3 commits intocompat-table:gh-pagesfrom
Conversation
Safari 15 has issue with destructuring parameters when a function expression's id collides with a destructured parameter identifier. https://bugs.webkit.org/show_bug.cgi?id=220517
| try { | ||
| eval('var f = function f([id, id]) { return id }'); | ||
| return false; | ||
| } catch (e) { | ||
| return e instanceof SyntaxError; | ||
| } |
There was a problem hiding this comment.
i wonder if we could make this test pass when destructuring isn't supported? that way the only false values will be those that implemented destructuring incorrectly
There was a problem hiding this comment.
I can wrap everything in evals, add a check for basic destructuring, and early exit.
But, I think what's really needed is a "bug" check on top of another test. Failures would be listed, and absence would imply that it's supported (or explicitly listed as supported, as I imagine 15.1 will need).
There was a problem hiding this comment.
interesting, that sounds like a larger refactor.
I think for now this is fine, but it feels like the false results for engines that don't have destructuring in the first place (like opera) are a bit useless :-)
There was a problem hiding this comment.
Removed the extra false results.
data-es6.js
Outdated
| var d = function d([d]) { return d }; | ||
| if (!d([true])) return false; |
There was a problem hiding this comment.
| var d = function d([d]) { return d }; | |
| if (!d([true])) return false; | |
| if(!(function d([d]) {})) return false; |
Golf down the reproducing example a bit.
There was a problem hiding this comment.
I was actually checking that it returned the not-function binding, but I see I forgot the check explicitly for !== true.
…1765) * Add new test for destructuring param with id collision Safari 15 has issue with destructuring parameters when a function expression's id collides with a destructured parameter identifier. https://bugs.webkit.org/show_bug.cgi?id=220517 * Remove false values * Fix test case
Safari 15 has issue with destructuring parameters when a function expression's id collides with a destructured parameter identifier.
https://bugs.webkit.org/show_bug.cgi?id=220517