Skip to content

Conversation

flofriday
Copy link

@flofriday flofriday commented Aug 25, 2025

Previously the parser for Kotlin reused the Java number parsing but there are significant differences in how the two languages express numbers causing false-negatives and false-positives.

Resolves #4305

Changes

Implemented a custom parser for Kotlin number literals since they are different enough from Java literals to justify their own parser.

My hunch is that the orginal implementor misinterpreted the release notes from Kotlin 1.1 which they referenced since this only applies to how seperators in Kotlin follow the same rules as Java 8 and not how all the number parsing is identical to Java 8.
Moreover, in the 9 years since Kotlin 1.1 the language has changed a lot and for example back then unsigned number literals surely weren't a thing.

Checklist

  • Added markup tests, or they don't apply here because...
  • Updated the changelog at CHANGES.md

@flofriday flofriday force-pushed the fix-kotlin-number-literals branch 2 times, most recently from cd48c9c to 24fcd0e Compare August 25, 2025 17:24
Previously kotlin resused the java number parsing but there are
significant differnces in how the two languages express numbers
causing false-negatives and false-positives.
@flofriday flofriday force-pushed the fix-kotlin-number-literals branch from 24fcd0e to d5aa057 Compare August 25, 2025 17:34
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.

(Kotlin) Invalid number literal highlighting
1 participant