Skip to content

Conversation

acutmore
Copy link
Contributor

@acutmore acutmore commented Oct 22, 2019

Emits a Property_0_is_used_before_being_assigned error when an Enum member has an initaliser that references itself.

I was not sure if this warranted added a new error message, or alternatively adapting ts(2651): A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.

enum E {
   a = E.a // error E.a will be undefined
}
  • There is an associated issue in the Backlog milestone (required)
  • Code is up-to-date with the master branch
  • You've successfully run gulp runtests locally
  • There are new or updated unit tests validating the change

Fixes #34606

@msftclas
Copy link

msftclas commented Oct 22, 2019

CLA assistant check
All CLA requirements met.

@sandersn sandersn added the For Backlog Bug PRs that fix a backlog bug label Feb 3, 2020
@elibarzilay elibarzilay merged commit 4538640 into microsoft:master Apr 14, 2020
@acutmore acutmore changed the title Added error when Enum member initaliser references itself Added error when Enum member initialiser references itself Aug 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Backlog Bug PRs that fix a backlog bug
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Shadowing an enum definition and referencing the outer definition in an initializer results in undefined enum value.
4 participants