rnix-parser
rnix-parser copied to clipboard
SyntaxKind::is_literal(): update to match usage
Summary & Motivation
SyntaxKind::is_literal()'s comment says that it "Returns true if this token is a literal, such as an integer or a string", but this isn't true -- it doesn't return true for string literals.
After examining how is_literal() is used, the fact that it returns true for path literals ~~is unused.~~ is barely used.
It appears that the intent of this function was to return true if parser.rs will parse the specified TokenKind into a NODE_LITERAL. Let's update the comment to indicate this, and then adjust the implementation to agree with the comment.
Backwards-incompatible changes
NODE_PATH::is_literal() now returns false.
Downstream which depended on the previous behavior was not likely getting the results they expected.
Further context
Noticed due to https://cl.tvl.fyi/c/depot/+/7030/