Skip to content

Forward port CommandLineParser rewrite #7676

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

Merged
merged 2 commits into from
Apr 23, 2020

Conversation

som-snytt
Copy link
Contributor

@som-snytt som-snytt commented Dec 3, 2019

Tests to follow. (When I learn how to add tests.)

Bookmarking:
scala/scala#6622
scala/scala#5882

Copy link
Member

@dottybot dottybot left a comment

Choose a reason for hiding this comment

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

Hello, and thank you for opening this PR! 🎉

All contributors have signed the CLA, thank you! ❤️

Have an awesome day! ☀️

@smarter
Copy link
Member

smarter commented Dec 3, 2019

Can you add a link to the corresponding scala/scala PR or commit in the commit message ?

@nicolasstucki
Copy link
Contributor

Could you add the links to the commit message (not only the PR description). It is to make sure it is in the git history.

@som-snytt
Copy link
Contributor Author

Yes, I'll update. I just looked at this again, wondering whether to improve the quick'n'dirty code.

@som-snytt som-snytt force-pushed the issue/update-commandlineparser branch from 67b36f8 to 3963aa0 Compare January 29, 2020 11:51
@som-snytt som-snytt marked this pull request as ready for review January 29, 2020 11:52
@som-snytt
Copy link
Contributor Author

Added test and dependency on scala-testkit.

@som-snytt
Copy link
Contributor Author

Probably spurious?

[error] scala.reflect.internal.FatalError: package object runtime does not have a decl currentMirror

@som-snytt som-snytt force-pushed the issue/update-commandlineparser branch from 3963aa0 to cd642d0 Compare February 25, 2020 20:11
@som-snytt
Copy link
Contributor Author

I guess not spurious.

[error] error while loading package, class file '/root/.cache/coursier/v1/https/scala-webapps.epfl.ch/artifactory/central/org/scala-lang/scala-reflect/2.13.1/scala-reflect-2.13.1.jar(scala/reflect/macros/package.class)' is broken
[error] (class java.lang.RuntimeException/error reading Scala signature of package.class: Scala signature package has wrong version
[error]  expected: 5.0
[error]  found: 5.2 in package.class)

@som-snytt som-snytt force-pushed the issue/update-commandlineparser branch from cd642d0 to 0d69058 Compare March 27, 2020 11:22
@som-snytt
Copy link
Contributor Author

Removed testkit dependency, converted syntax, rebased.

@som-snytt som-snytt force-pushed the issue/update-commandlineparser branch from 0d69058 to bac75e5 Compare April 15, 2020 05:43
Copy link
Member

@smarter smarter left a comment

Choose a reason for hiding this comment

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

Otherwise LGTM!

var start = 0
val qpos = new ArrayBuffer[Int](16) // positions of paired quotes

inline def cur = if done then EOF else line.charAt(pos): Int
Copy link
Member

Choose a reason for hiding this comment

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

Why is that type ascription needed? Could it be moved to be the result type of cur instead?

Suggested change
inline def cur = if done then EOF else line.charAt(pos): Int
inline def cur: Int = if done then EOF else line.charAt(pos)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

charAt is a char. The benefits of this style choice are to point out the problematic expression; it looks more cool; in result type position, it's like having eyeglasses wrapped in tape where they broke. That's why implicits, the nerdiest feature, requires it.

Copy link
Member

Choose a reason for hiding this comment

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

ok, I guess that's fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a bit quirky, and it was so long ago, I had to reconstruct my thinking. On the up side, with all the talk about command line parsing support for main entry point, probably this code will be replaced anyway. It was mostly aimed at Process building.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also thanks, this was to get my feet wet with the repo and process, low benefit and low risk.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks to you for porting this! And sorry for the long delay before the review, it slipped my mind.

@smarter smarter assigned som-snytt and unassigned smarter Apr 23, 2020
@smarter smarter merged commit 38cb5e3 into scala:master Apr 23, 2020
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.

4 participants