SyntaxFacts
's GetXXXKinds
methods can return nonexistent syntax kinds
#72300
Labels
Milestone
SyntaxFacts
's GetXXXKinds
methods can return nonexistent syntax kinds
#72300
Version Used:
Latest
main
Steps to Reproduce:
Simple code snippet:
Expected Behavior:
I get no "Nonexistent kind" outputs
Actual Behavior:
The actual output of the program is:
As we can see
GetKeywordKinds
andGetContextualKeywordKinds
return single nonexistent kind8441
andGetPunctuationKinds
returns a lot of nonexistent kindsAdditional info:
I think it is pretty safe to assume, that if there is a public API, that has an
enum
in its return type (singleenum
value, collection, part of returned object etc.), users of such API expect, that they get validenum
members as a result. I don't expect these APIs to be used often, but when they are used, such nonexistent kinds are most likely a source of potential bug, waiting to happen. E.g. I discovered it while working on an IDE feature fix. For me it was very straight forward to notice, but if this method was used somewhere in more complicated logic, the bug can be left unnoticed for quite a long timeThe text was updated successfully, but these errors were encountered: