Closed jridgewell closed 7 years ago
Asserts in ECMAScript are not expected to fail on any program. They don't throw exceptions--if they are reached, that means the spec itself has a bug in it. See the definition of Assert.
Duplicate private method definitions are banned instead in Early Errors, the first of the two. If a private name is defined twice, it's an early error, unless it's a getter/setter pair.
You're right that we could add an additional assertion that other
has [[Set]] and not [[Get]], or vice versa. I think this is a pretty minor editorial issue; PRs welcome. There are probably lots of asserts we could add.
I specified coalescing more specifically in this patch. Hopefully that should clear up any ambiguity.
Summarizing https://github.com/tc39/proposal-private-methods/commit/f719e009ba629527fa0e935ef2d5312e952f8806:
other
other
has a setterother
has a getterThat means the following is fine:
But this throws: