| 18:11 | <Aapo Alasuutari> | Does anyone know what's the intended way to pass the test In it we have a block that contains two function declarations with the same name, tested in noStrict to not cause a syntax error. https://tc39.es/ecma262/#sec-blockdeclarationinstantiation just says to go through lexically scoped declarations of the block and CreateMutableBinding or CreateImmutableBinding for each. That goes into https://tc39.es/ecma262/#sec-declarative-environment-records-createmutablebinding-n-d which asserts that the envRec doesn't already have a binding for the given name; this assertion is triggered by the two functions of the same name, best as I can tell anyway. Am I holding the spec wrong, or is this something of a spec bug? The Annex B Block-Level Function Declarations Web Legacy Compatibility Semantics of course changes this (though I haven't grokked how exactly), but assuming that extension is not applied, how should an implementation handle duplicate functions without asserting and crashing? |
| 18:12 | <bakkot> | I'm not sure we've actually reasoned through the non-Annex B semantics carefully, Annex B is the one ~all implementations actually use |
| 18:13 | <bakkot> | I assume that test is intended to run under an implementation which follows Annex B, given that it comes from SpiderMonkey, which is such an implementation |
| 18:24 | <Aapo Alasuutari> | Yeah, I phrased myself poorly: the test shouldn't pass without Annex B, but currently without Annex B it triggers a spec assertion. |
| 18:25 | <Aapo Alasuutari> | Or at least it does so in my implementation, and reading the spec that does seem to be the correct thing to do. |
| 18:29 | <bakkot> | ah, it's because https://tc39.es/ecma262/multipage/ecmascript-language-statements-and-declarations.html#sec-block-static-semantics-early-errors |
| 18:30 | <bakkot> | makes it a SyntaxError |
| 18:30 | <bakkot> | so the assertion is valid: you're not supposed to get to the runtime semantics at all |
| 18:30 | <bakkot> | also, oops, rendering's a bit weird there |
| 18:31 | <Aapo Alasuutari> | Yup, surprisingly hard to read. Right okay, so it seems my syntax checking (3rd party :) ) is assuming Annex B here. |
| 18:31 | <Aapo Alasuutari> | Thank you <3 |