super call in private instance method incorrectly calls overridden method #9788
Labels
i: bug
i: needs triage
outdated
A closed issue/PR that is archived due to age. Recommended to make a new issue
Bug Report
Current Behavior
Calling a
super
method from within a private instance method or accessor calls the overridden method instead of the superclass's method. Similarly, accessing asuper
property accesses the overridden property instead of the superclass's property.For reference: in #9580, I reported that
super
method calls and property accesses didn't work at all, which was fixed in #9704. This issue shows that although such asuper
call/access no longer throws, it can still call the wrong method/accessor.Input Code
REPL link
I still can't get the REPL link to include additional plugins, so you have to manually add these:
@babel/plugin-proposal-class-properties
@babel/plugin-proposal-private-methods
Expected behavior/code
The console logs a message:
Actual behavior/code
The console logs a message:
Generated code
Babel Configuration (.babelrc, package.json, cli command)
Environment
Possible Solution
The generated
_privateMethod2
is incorrect:_getPrototypeOf(this)
returnsSubClass.prototype
, so we callSubClass.prototype.someMethod
(which is incorrect).Instead, I would expect the generated code to look something like:
Additional context/Screenshots
N/A
The text was updated successfully, but these errors were encountered: