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

Support type promotion on this #2319

Closed
sigmundch opened this issue Jun 28, 2022 · 1 comment
Closed

Support type promotion on this #2319

sigmundch opened this issue Jun 28, 2022 · 1 comment
Labels
feature Proposed language feature that solves one or more problems state-duplicate This issue or pull request already exists

Comments

@sigmundch
Copy link
Member

Quite possibly this was already discussed, but I couldn't find the issue or discussion that cover this topic.

Today we have this behavior:

class A {
  foo() {
    if (this is B) {
      this.bar(); // ERROR
    }

    var x = this;
    if (x is B) {
       x.bar();  // OK
    }
  }
}
class B extends A {
  bar() {}
}
main() => new B().foo();

Should type promotion also be available on the implicit this variable (making the the first example behave like the second example with the local variable)?

@sigmundch sigmundch added the feature Proposed language feature that solves one or more problems label Jun 28, 2022
@sigmundch
Copy link
Member Author

Closing, I found now the issue tracking this: #1397

@lrhn lrhn added the state-duplicate This issue or pull request already exists label Sep 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Proposed language feature that solves one or more problems state-duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants