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

allow literan enum const assertions #30700

Merged
merged 3 commits into from Apr 25, 2019

Conversation

Kingwl
Copy link
Contributor

@Kingwl Kingwl commented Apr 2, 2019

Fixes #30690

@@ -1023,7 +1023,7 @@
"category": "Error",
"code": 1354
},
"A 'const' assertion can only be applied to a string, number, boolean, array, or object literal.": {
"A 'const' assertion can only be applied to a string, number, boolean, array, literal enum, or object literal.": {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe "enum member" instead of "literal enum"? I don't think most people would think of A.b as a "literal" of some kind, much as we often treat it like one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What about "member of literal enum"? "enum member" is also weird and cannot explain that why some enum cannot be used

BTW: Honestly, I don't know the kind of enum before.

Copy link
Member

Choose a reason for hiding this comment

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

Paging @DanielRosenwasser for error message wording

Copy link
Member

Choose a reason for hiding this comment

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

'const' assertions can only be applied to references to enum members, or string, number, boolean, array, or object literals.

@RyanCavanaugh RyanCavanaugh merged commit bc46c77 into microsoft:master Apr 25, 2019
@RyanCavanaugh
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow const assertion to be use on enum types
4 participants