swiftlang/swift-syntax

TokenKind.isKeyword

Closed this issue · 2 comments

Description

I noticed this property was present in 5.8, but not in the latest release. Is this intentional?

Steps to Reproduce

No response

Tracked in Apple’s issue tracker as rdar://119818186

Yes, the removal of TokenKind.isKeyword was intentional because in many cases its behaviour was misleading. For example in someStruct.public, public will get classified as an identifier, not a keyword because in that position it's used as an identifier and thus calling isKeyword on that token would return false, even though you would consider public a keyword in any other context.