Skip to content

Protected constructors accessible in subclass static methods - #9904

Merged
Nathan Shively-Sanders (sandersn) merged 3 commits into
masterfrom
protected-constructors-accessible-in-subclass-static-methods
Jul 25, 2016
Merged

Protected constructors accessible in subclass static methods#9904
Nathan Shively-Sanders (sandersn) merged 3 commits into
masterfrom
protected-constructors-accessible-in-subclass-static-methods

Conversation

@sandersn

Copy link
Copy Markdown
Member

Fixes#9734

in static methods of subclasses
Previously, it was an error to refer to a protected constructor from a
base class, even in a static method where the semantics work. Now it is
not an error in static methods.
Comment threadsrc/compiler/checker.ts Outdated
if (baseTypes.length) {
const baseType = baseTypes[0];
if (containingFunction &&
containingFunction.flags & NodeFlags.Static &&

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does it matter whether the function is static?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops. I wasn't paying attention and overfit to the example. I see that instance methods should be ok based on your constructor-with-super equivalence example.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@RyanCavanaugh

Copy link
Copy Markdown
Member

👍

@sandersn
Nathan Shively-Sanders (sandersn) deleted the protected-constructors-accessible-in-subclass-static-methods branch July 25, 2016 19:38
@microsoftMicrosoft (microsoft) locked and limited conversation to collaborators Jun 19, 2018
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@sandersn@RyanCavanaugh@msftclas