scala / scala-dev

Scala 2 team issues. Not for user-facing bugs or directly actionable user-facing improvements. For build/test/infra and for longer-term planning and idea tracking. Our bug tracker is at https://github.com/scala/bug/issues
Apache License 2.0
130 stars 14 forks source link

Assess `-Xsource:3` using community build #769

Closed SethTisue closed 3 years ago

SethTisue commented 3 years ago

This came up with @smarter at https://gitter.im/typelevel/general?at=6086d87e81866c680c48df4f

I've recently added a bunch of Scala 3 syntax under that flag to allow us to deprecate and potentially repurpose some old syntax without harming cross-compatibility with Scala 2, but this hinges on people actually using that flag so it'd be good to know if there's any issues with it

We should at least try it and see what happens.

SethTisue commented 3 years ago

@smarter the behemoths are busy today with the sbt 1.5.1 upgrade, but I should be able to do this in the next few days

SethTisue commented 3 years ago

https://scala-ci.typesafe.com/job/scala-2.13.x-jdk11-integrate-community-build/2703/

42 green repos, but also lots of failures, most notably scalatest,kind-projector,utest,shapeless,scalatest-3-0; transitively, those prevent most of the build from running

sampling of failure causes:

fixes for these could easily be submitted upstream, and then we could re-run and get more results

this is one of those times where we don't primarily want a community build that rewires all the dependencies; we would primarily want to build each repo separately

it would not be super hard for me (or somebody) to write a script that glues all the proj/*.conf files together in an alternate why where each repo is built in its own space, with check-missing: false so that all dependencies would be retrieved from Maven Central et al. at least, I don't think I would run into a bunch of weird trouble doing that

on the other hand, I don't have any further time for this either this week or next, but I could probably return to it after that

smarter commented 3 years ago

fixes for these could easily be submitted upstream

I'll see if I can look into it. I think the compiler could also stop emitting errors on symbol sytnax since it's still supported in Scala 3 under a language feature. But for kind-projector at least, the error likely comes from a test exercising the ? syntax since it's still supported even if it's deprecated, and upstream might not want to get rid of it right now.

on the other hand, I don't have any further time for this either this week or next, but I could probably return to it after that

That would be great! No pressure though :).

smarter commented 3 years ago
smarter commented 3 years ago

@SethTisue do you think you could try running this again now that all the known issues are fixed?

SethTisue commented 3 years ago

@smarter sure, after https://github.com/scala/community-build/pull/1418 lands

SethTisue commented 3 years ago

queued: https://scala-ci.typesafe.com/job/scala-2.13.x-jdk11-integrate-community-build/2787/

smarter commented 3 years ago

https://scala-ci.typesafe.com/job/scala-2.13.x-jdk11-integrate-community-build/2787/artifact/logs/kind-projector-build.log

[kind-projector] [error] /home/jenkins/workspace/scala-2.13.x-jdk11-integrate-community-build/target-0.9.17/project-builds/kind-projector-b0a85b5f7bb05e14140d78d7b4b2515b9a3ab274/src/test/scala/test.scala:17:7: Either[Int, _] takes no type parameters, expected: 1
[kind-projector] [error]   bar[Either[Int, ?]]
[kind-projector] [error]       ^

Looks like kind-projector isn't up-to-date in the community build since that doesn't match the current sources: https://github.com/typelevel/kind-projector/blob/main/src/test/scala/test.scala#L17

SethTisue commented 3 years ago

~https://scala-ci.typesafe.com/job/scala-2.13.x-jdk11-integrate-community-build/2861/~ https://scala-ci.typesafe.com/job/scala-2.13.x-jdk11-integrate-community-build/2865/

smarter commented 3 years ago

Some observations:

So overall this is looking good (except the specs2 and utest failures prevent a lot of projects from compiling).

smarter commented 3 years ago

https://github.com/etorreborre/specs2/pull/953

smarter commented 3 years ago

https://github.com/com-lihaoyi/utest/pull/253

SethTisue commented 3 years ago

https://scala-ci.typesafe.com/job/scala-2.13.x-jdk11-integrate-community-build/2881/

SethTisue commented 3 years ago

new run with fixes for specs2, fastparse, fastparse-scalameta, scalameta:

https://scala-ci.typesafe.com/job/scala-2.13.x-jdk11-integrate-community-build/2887/

SethTisue commented 3 years ago

run 2887 shows: BLOCKING DOWNSTREAM: scalatest-3-0 (62), spray-json (53), wartremover (53), json4s (47), scodec-bits (45), fansi (22), akka-stream (21), acyclic (19), scalatags (11), http4s-parboiled2 (9), spire (7), scalamock (2), hasher (1), lift-json (1), decline (1), mainargs (1), tut (1)

for scalatest-3-0 we could just use a JAR from Maven Central instead

spray-json, wartremover, scodec-bits look to me like they probably just need trivial fixes

json4s situation isn't clear to me at a glance

smarter commented 3 years ago

[json4s] [error] def ~>*[B >: A, X2 >: X](f: => Rule[S, S, B => B, X2]) = for (a <- rule; fs <- f*) yield fs.foldLeft[B](a) { (b, f) => f(b) }

That f* is a postfix application of a * operator, which conflicts with the new varargs syntax, looks like this was recently fixed upstream: https://github.com/json4s/json4s/commit/b91c3ff0fce98cb17f2cd0fb2dc330760eeb4442

SethTisue commented 3 years ago

@smarter after https://github.com/scala/community-build/issues/1456 is done, doing this sort of experiment will become easier

SethTisue commented 3 years ago

after scala/community-build#1456 is done, doing this sort of experiment will become easier

that's done now, so I intend to return to this soon-ish

SethTisue commented 3 years ago

there is a new full run here: https://scala-ci.typesafe.com/view/scala-2.13.x/job/scala-2.13.x-jdk11-integrate-community-build/3190/artifact/report.html (scroll down for links to per-repo failure logs)

181 repos are green, so that's good

these are the failures where -Xsource:3 appears, offhand, to be functioning as intended:

we would need to dig deeper into the following failures to understand them:

smarter commented 3 years ago

type mismatch (* related?)

Likely the same as https://github.com/scala/scala-dev/issues/769#issuecomment-862725841, we should deprecate postfix * by default.

SethTisue commented 3 years ago

The easily-nerd-sniped side of my personality wants to investigate the failures, but I think I've concluded that wouldn't be an ideal use of my time.

Overall, the results of this experiment were good. I invite anyone disquieted by any of the failures to investigate and, if appropriate, open specific individual tickets on them in scala/bug.