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

Correct handling of union types in expressions #1765

Merged
merged 5 commits into from
Jan 21, 2015
Merged

Conversation

ahejlsberg
Copy link
Member

Fixes #1715 (and others like it).

This PR corrects our handling of union types for certain expression operators. Specifically, where operators support operands of certain kinds of types we now also support unions of those kinds of types. For example, in an index access a[x] we now allow x to be a union type such as string | number or Enum1 | Enum2, and in an arithmetic operation such as x * y we allow the operands to be unions composed of enum types.

@JsonFreeman
Copy link
Contributor

👍
I will also incorporate this into my PR #1752, specifically commit 7192767

ahejlsberg added a commit that referenced this pull request Jan 21, 2015
Correct handling of union types in expressions
@ahejlsberg ahejlsberg merged commit 2052ac3 into master Jan 21, 2015
@ahejlsberg ahejlsberg deleted the unionTypeOperations branch January 21, 2015 23:44
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to 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.

Union types are not allowed in indexers
2 participants