pjrt/stags

scala.MatchError: 1 (of class scala.meta.Lit$LitImpl)

Closed this issue · 7 comments

git clone https://github.com/scalacenter/scalafix.git
cd scalafix
coursier launch co.pjrt:stags-cli_2.12:0.1.1 -- ./
Exception in thread "main" scala.MatchError: 1 (of class scala.meta.Lit$LitImpl)
	at co.pjrt.stags.TagGenerator$.getFromPats(TagGenerator.scala:127)
	at co.pjrt.stags.TagGenerator$.getFromPat$1(TagGenerator.scala:118)
	at co.pjrt.stags.TagGenerator$.$anonfun$getFromPats$2(TagGenerator.scala:124)
	at scala.collection.TraversableLike.$anonfun$flatMap$1(TraversableLike.scala:241)
	at scala.collection.immutable.List.foreach(List.scala:389)
	at scala.collection.TraversableLike.flatMap(TraversableLike.scala:241)
	at scala.collection.TraversableLike.flatMap$(TraversableLike.scala:238)
	at scala.collection.immutable.List.flatMap(List.scala:352)
	at co.pjrt.stags.TagGenerator$.getFromPats(TagGenerator.scala:124)
	at co.pjrt.stags.TagGenerator$.$anonfun$tagsForStatement$1(TagGenerator.scala:71)
	at scala.collection.TraversableLike.$anonfun$flatMap$1(TraversableLike.scala:241)
	at scala.collection.immutable.List.foreach(List.scala:389)
	at scala.collection.TraversableLike.flatMap(TraversableLike.scala:241)
	at scala.collection.TraversableLike.flatMap$(TraversableLike.scala:238)

Seems like

is missing a fallback.

pjrt commented

If you want a large corpus you can try https://github.com/olafurpg/scala-repos/

Alternatively, scalameta testkit provides a nice interface to run custom analysis on that same corpus https://github.com/scalameta/scalameta/blob/1bd511158352bd6375bdb1e0e28395e76513094f/scalameta/testkit/src/main/scala/scala/meta/testkit/SyntaxAnalysis.scala

pjrt commented

Nice, thanks! I'll see if I can integrate it into my tests.

pjrt commented

Fixed. I'll push to maven later today (or tomorrow. idk if I'll have time today).

Thanks for the fix! I'm slowly trying to move from IJ to vim and I hope to use stags to smoothen the transition 😄

pjrt commented

@olafurpg 0.2.1 is now on maven. I had to jump over 0.2.0 since I broke it :\

Awesome, just ran it on the scalafix repo with no problem 💯