-
Notifications
You must be signed in to change notification settings - Fork 60
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
scalafmt failing #1680
Comments
@som-snytt not obvious me to what the cause might be. I'll keep digging. |
I think this is our first time seeing Java since. Nice comment is cold comfort:
It turns out that Scalameta has (where
Probably that is just a bug in Scalameta, and the additional bug in Scalafmt is not to assume non-empty tokens (see added filter):
or what have you. For a while, I assumed the problem would be brittle inheritance in
|
Jenkins is currently chewing on the sbt 1.9.1->2 upgrade. after that, #1681 should get us to where we would be able to pull in a Scalameta fix fyi @kitbellew |
@lrytz does this give you cold feet about scala/scala#10392 ? while you ponder that, I'll try making Som's suggested changes in scalacommunitybuild forks of scalameta and scalafmt. |
@SethTisue revealing bugs in library code is a good thing. I'm using "good thing" in its generic, non-trademarked sense. |
ah, @som-snytt is way ahead of me... I'm just now seeing scalameta/scalameta#3235 and scalameta/scalafmt#3581. I'll give those a try |
yup that did it 🎉 , thx @som-snytt |
What do I need to do to get around this with Scala 3.3.3 and SBT 1.10 ? |
@alexander-klimov александр, scalafmt не собирается под scala3 (но может форматировать scala3, если собран под 2.12/2.13). в этом был вопрос? |
I've just installed Scalafmt using Coursier as described here, and when running it to format my Scala 3 repository, this error - Note: |
in that case, can you please submit a reproducible bug report in the appropriate repository? |
Sure thing. |
As it turns out, we're using a very old version of Scalafmt that breaks completely: ```txt ERROR: rules_scala/test/scalafmt/BUILD:43:20: ScalaFmt test/scalafmt/test/scalafmt/formatted/formatted-test.scala.fmt.output failed: (Exit 1): scalafmt failed: error executing ScalaFmt command (from target //test/scalafmt:formatted-test) bazel-out/darwin_arm64-opt-exec-ST-d57f47055a04/bin/scala/scalafmt/scalafmt '--jvm_flag=-Dfile.encoding=UTF-8' ... (remaining 1 argument skipped) java.util.NoSuchElementException: last of empty IndexedSeq ``` This matches: - scala/community-build#1680 Which mentions apparent fixes in: - scalameta/scalameta#3235 - scalameta/scalafmt#3581 So the fix is to update Scalafmt, but given how we don't use rules_jvm_external, that means a lot of manual updates to third_party/repositories/scala_*.bzl. There doesn't appear to be a way to automate this; there's no indication that the most recent update was automated in any way: - bazelbuild#1543 So I'll plow through all the JARs and make the necessary changes: - https://mvnrepository.com/artifact/org.scalameta/scalafmt-core I can't update scala_2_11, since there's not a more recent compatible version. But the changes to scala_2_12 and scala_2_13 should be similar, and the changes to 2_13 should apply to 3_{1,2,3,4} as well. I had to hack .scalafmt.conf and ScalafmtWorker.scala a bit. This may make it incompatible with 2.11.
after #1677
Bisecting shows the problem to have started with scala/scala#10392 ("IndexedSeq.head throws NoSuchElementException")
https://scala-ci.typesafe.com/job/scala-2.13.x-jdk17-integrate-community-build/1239/artifact/logs/scalafmt-build.log
The text was updated successfully, but these errors were encountered: