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

Scala fix fails to run on test #1110

Closed
daddykotex opened this issue May 1, 2020 · 2 comments · Fixed by #1116
Closed

Scala fix fails to run on test #1110

daddykotex opened this issue May 1, 2020 · 2 comments · Fixed by #1116

Comments

@daddykotex
Copy link
Contributor

Hi, thanks for the project, it's truly helpful!

I'm working hard to add this as part of our CI but I can't figure out why I can't run it against our test sources. At first I thought it might be the dependency on scalatest, but it's not. A very dummy repo reproduces:

https://github.com/daddykotex/scalafix-issue-repro

sbt 1.3.10
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.15")
scala := 2.13.1

I'm getting a bunch of error when I run test:scalafix --check:

[info] Compiling 1 Scala source to /Users/david/workspace/scalafix-test/module1/target/scala-2.13/test-classes ...
[warn] there was one deprecation warning (since 2.13.0); re-run with -deprecation for details
[warn] one warning found
java.io.IOException: Scala signature package has wrong version
 expected: 5.0
 found: 5.2 in package.class
	at scala.reflect.internal.pickling.UnPickler$Scan.checkVersion(UnPickler.scala:124)
	at scala.reflect.internal.pickling.UnPickler$Scan.<init>(UnPickler.scala:66)
	at scala.reflect.internal.pickling.UnPickler.unpickle(UnPickler.scala:47)
	at scala.tools.nsc.symtab.classfile.ClassfileParser.unpickleOrParseInnerClasses(ClassfileParser.scala:1176)
  | => mat scala.tools.nsc.symtab.classfile.ClassfileParser.parseClass(ClassfileParser.scala:465)
	at scala.tools.nsc.symtab.classfile.ClassfileParser.$anonfun$parse$2(ClassfileParser.scala:161)
	at scala.tools.nsc.symtab.classfile.ClassfileParser.$anonfun$parse$1(ClassfileParser.scala:146)
	at scala.tools.nsc.symtab.classfile.ClassfileParser.parse(ClassfileParser.scala:129)
	at scala.tools.nsc.symtab.SymbolLoaders$ClassfileLoader.doComplete(SymbolLoaders.scala:329)
	at scala.tools.nsc.symtab.SymbolLoaders$SymbolLoader.complete(SymbolLoaders.scala:230)
	at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1539)
	at scala.reflect.internal.SymbolTable.openPackageModule(SymbolTable.scala:355)
	at scala.reflect.internal.SymbolTable.openPackageModule(SymbolTable.scala:410)
	at scala.tools.nsc.symtab.SymbolLoaders$PackageLoader.doComplete(SymbolLoaders.scala:299)
	at scala.tools.nsc.symtab.SymbolLoaders$SymbolLoader.complete(SymbolLoaders.scala:230)
	at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1539)
	at scala.reflect.internal.Types$TypeRef.baseClasses(Types.scala:2285)
	at scala.reflect.internal.tpe.FindMembers$FindMemberBase.init(FindMembers.scala:36)
	at scala.reflect.internal.tpe.FindMembers$FindMember.init(FindMembers.scala:255)
	at scala.reflect.internal.Types$Type.$anonfun$findMember$1(Types.scala:1040)
	at scala.reflect.internal.Types$Type.findMemberInternal$1(Types.scala:1039)
	at scala.reflect.internal.Types$Type.findMember(Types.scala:1044)
	at scala.reflect.internal.Types$Type.memberBasedOnName(Types.scala:673)
.....

MULTIPLE PAGES OF THAT

Any idea what I'm doing wrong?

Thanks, again

@bjaglin
Copy link
Collaborator

bjaglin commented May 9, 2020

I ran into something similar, thanks for the repro!

I narrowed down the problem: when a semanticdb compiler parameter is repeated (which happens for configuration with a parent - this is probably something to fix in https://github.com/sbt/sbt/blob/1.3.x/main/src/main/scala/sbt/plugins/SemanticdbPlugin.scala), scalafix picks the first occurrence, while the compiler picks the last.

sbt:hello-world> show module1/Test/scalacOptions
[info] * -Ywarn-unused
[info] * -Xplugin:/home/bjaglin/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scalameta/semanticdb-scalac_2.13.1/4.3.8/semanticdb-scalac_2.13.1-4.3.8.jar
[info] * -Yrangepos
[info] * -P:semanticdb:targetroot:/home/bjaglin/git/projects/scalafix-issue-repro/module1/target/scala-2.13/meta
[info] * -P:semanticdb:targetroot:/home/bjaglin/git/projects/scalafix-issue-repro/module1/target/scala-2.13/test-meta

I'll open a PR shortly.

@daddykotex
Copy link
Contributor Author

Ahh thank you very much.

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 a pull request may close this issue.

2 participants