Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StaticSuperPropReplacer not compatible with static inheritance #3240

Open
ChadKillingsworth opened this issue Feb 28, 2019 · 1 comment
Open
Labels
internal-issue-created An internal Google issue has been created to track this GitHub issue triage-done Has been reviewed by someone on triage rotation.

Comments

@ChadKillingsworth
Copy link
Collaborator

ChadKillingsworth commented Feb 28, 2019

The StaticSuperPropReplacer pass does not properly account for static inheritance. The following case demonstrates code that is broken by the pass.

class Base {
  static foo() {
    console.log('base foo');
  }

  static bar() {
    this.foo();
  }
}

class Intermediate extends Base {
  static baz() {
    super.bar(); // changing `super` to `Base` changes `this` in the super call.
  }
}

class Child extends Intermediate {
  static foo() {
    console.log('child foo');
  }
}

Child.baz(); // should log "child foo"

This pattern occurs in Polymer: https://github.com/Polymer/polymer/blob/d577c8c8755b3078da605889488e8988eb31c48d/lib/mixins/template-stamp.js#L348

@brad4d brad4d added the internal-issue-created An internal Google issue has been created to track this GitHub issue label Mar 1, 2019
@brad4d
Copy link
Contributor

brad4d commented Mar 1, 2019

Created internal issue http://b/126934458

@brad4d brad4d added the triage-done Has been reviewed by someone on triage rotation. label Apr 8, 2019
rictic added a commit to Polymer/polymer that referenced this issue Apr 22, 2019
Also add @nocollapse to all of our static methods and properties, because we never want static property collapsing on these methods.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal-issue-created An internal Google issue has been created to track this GitHub issue triage-done Has been reviewed by someone on triage rotation.
Projects
None yet
Development

No branches or pull requests

2 participants