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

Make LocationMap return a line/col on EOF #286

Merged
merged 1 commit into from
Nov 1, 2021
Merged

Conversation

johnynek
Copy link
Collaborator

address the issue here:

#239 (comment)

cc @re-xyr @alissa-tung please take a look at review if you have time.

@johnynek
Copy link
Collaborator Author

note this slightly changes semantics (previously toLineCol returned None for EOF), but I think it is worth changing:

  1. we had no methods to directly get a character at a line and col (although we did have getLine and you could get the col from that without checking previously and now this will fail at runtime
  2. getLine works as you would expect.
  3. I added a few new laws that work as I would expect things.

It's always a bit dangerous to change semantics without the types, but I lean towards accepting it here.

@codecov-commenter
Copy link

codecov-commenter commented Oct 29, 2021

Codecov Report

Merging #286 (db53c73) into main (8d8da8b) will increase coverage by 0.34%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #286      +/-   ##
==========================================
+ Coverage   95.91%   96.26%   +0.34%     
==========================================
  Files           8        8              
  Lines         980      990      +10     
  Branches       93       92       -1     
==========================================
+ Hits          940      953      +13     
+ Misses         40       37       -3     
Impacted Files Coverage Δ
...shared/src/main/scala/cats/parse/LocationMap.scala 97.05% <100.00%> (+1.22%) ⬆️
core/shared/src/main/scala/cats/parse/Parser.scala 96.10% <0.00%> (+0.36%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8d8da8b...db53c73. Read the comment docs.

Copy link
Collaborator

@regadas regadas left a comment

Choose a reason for hiding this comment

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

Yeah, this makes sense! 👍

It's always a bit dangerous to change semantics without the types, but I lean towards accepting it here.

I agree

@johnynek johnynek merged commit c8a8d6b into main Nov 1, 2021
@johnynek johnynek deleted the oscar/locationmap_eof branch November 1, 2021 18:01
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.

3 participants