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

crasher with certain sources #525

Closed
paulp opened this issue Oct 22, 2016 · 3 comments
Closed

crasher with certain sources #525

paulp opened this issue Oct 22, 2016 · 3 comments

Comments

@paulp
Copy link

paulp commented Oct 22, 2016

Edit: somehow I thought it was the trailing newline, but it isn't. However it's definitely that source.

scala> parse("m50d/paperdoll/scalaz/src/main/scala/paperdoll/scalaz/StateLayer.scala") collect { case x: Name => x }
parsing(/s/github/m50d/paperdoll/scalaz/src/main/scala/paperdoll/scalaz/StateLayer.scala)
java.lang.IllegalArgumentException: [2353..2352) is not a valid range
  at scala.meta.inputs.Position$Range.<init>(Position.scala:26)
  at scala.meta.inputs.Position$Range$.apply(Position.scala:35)
  at scala.meta.internal.ast.InternalTree$class.pos(InternalTrees.scala:73)
  at scala.meta.Name$Anonymous$NameAnonymousImpl.pos(Trees.scala:41)
  at scala.meta.internal.prettyprinters.TreeSyntax$$anonfun$apply$37.apply(TreeSyntax.scala:555)
@paulp paulp changed the title positions assume a trailing newline crasher with certain sources Oct 22, 2016
@paulp
Copy link
Author

paulp commented Oct 22, 2016

If I wrap the Name toString in a Try we see...

Success(A)
Success(S)
Success(A)
Success(StateHandler)
Success(initialState)
Failure(java.lang.IllegalArgumentException: [2353..2352) is not a valid range)
Success(translateState)
Success(F)
Success(_)
Success(S)
Success(ms)
Success(MonadState)
Success(F)

@paulp
Copy link
Author

paulp commented Oct 23, 2016

So I think it's actually related to EOL conventions. That file has old school \r\n going on. Comparing string literals which parse to file slurped data which throws that exception, line endings are the only difference I detect.

@xeno-by
Copy link
Member

xeno-by commented Mar 3, 2017

Just checked now, and the file parses successfully with scala.meta 1.6.0.

@xeno-by xeno-by closed this as completed Mar 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants