-
-
Notifications
You must be signed in to change notification settings - Fork 337
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
build.mill files compiled by Scala 3 #3369
base: main
Are you sure you want to change the base?
Conversation
Thanks @bishabosha ! Lets get your mainargs changes landed, that way we can cut a release and you can test your WIP in CI |
+1 for switching over to using directives! |
9d1a986
to
dc71022
Compare
[Edit: after switching to depending on mainargs 0.7.2] in https://github.com/com-lihaoyi/mill/actions/runs/10418081276/job/28853542122?pr=3369 you can see integration tests like |
729c575
to
e69f1bd
Compare
Rebased and included the new mill-moduledefs 0.11.0-M1 |
a06daca
to
37ba541
Compare
917a024
to
78beea1
Compare
@lihaoyi just recording here that the mockito third party test can be flaky (specifically as seen in the CI run https://github.com/com-lihaoyi/mill/actions/runs/10909315276/job/30277476457?pr=3369#step:9:4941 |
022c789
to
368fec9
Compare
@bishabosha got it. Could you open a discussion thread on https://github.com/scala/scala3 with your findings so far? If it turns out to be impossible to implement line-number/position fixing 100% correctly with Scala 3, then we don't have much of a choice, but we should make sure we have a discussion about it so that the upstream folks have a chance to add support for this use case in future |
Seems like Ammonite does the bytecode postprocessing approach and scalacli does as well https://github.com/com-lihaoyi/Ammonite/blob/main/amm/compiler/src/main/scala-3/ammonite/compiler/AsmPositionUpdater.scala |
If we can't access the full path from ASM, we could make the generated filename more special, e.g. by always appending a |
So an ASM rewrite could be done the same-time/after this would still mean semanticdb, tasty will be wrong. plugin could still handle rewriting Edit: Right, I guess you can propose a compiler plugin that does the correct position rewrite, so that all those things are correct, and then an Additional ASM post processor that has to correct the corrected-but-still-wrong class line numbers. |
My other solution: patch ASAP in compiler in backend the ability to trust positions in the code - I looked in the Scala 2 implementation and it accounts for "underlying" sourcefiles Edit: I quickly prototyped this fix to dotty in scala/scala3#21763, and used it in my linenumbers mill branch and it works - meaning that the linenumber plugin can be very simple - and no double remapping in the zinc reporter (still need one remapping for typing errors) Edit 2: added a test with a similar plugin design |
- use Scala 3.5.0 - add Scala 3 dialect to scalafmt.conf - synthesize Mirrors from macro - remove some warnings - run scalafmt on previous code - use scala 3 version of scalatags in test Note: scalatags brings in scala 2 version of sourcecode transitively, which then fails to summon sourcecode.Enclosing. - re-enable jmh, bsp and testkit modules in integration tests - fix giter8 module resolution with scala 3 - fix compilation of scalalib tests - derive ReadWriter for PomSettings - fix compilation of scalajslib tests - fix compilation of scalanativelib tests - move things-outside-top-level-module to integration.feature - resolve scala-library when mill scala version is 3.x - add given imports
- add import mill.given - fix summon of Discover in CodeGen
- fix scanning of Cross modules in Discover macro - improvement: check factory value matches crossValueN
enhancement to zinc reporter and avoid mangling ansi escapes
- update com-lihaoyi/sourcecode to use new macro implementation - fix callgraph 4-actors test: account for private[this] inferrence - fix - callgraph 8-linked-list-scala test: account for new override semantics - fix 5-parser codesig test to account for new expansion - use custom SAM type in lambda tests for scala (specialisation dropped in scala 3) - tweak CodeSig ignoreCall logic to account for Scala 3 lambdas - update some dependencies so invalidation tests actually run - fix indentation in codesig tests
- In Scala 3 an implicitly inserted else branch will not be implicitly converted to the type of the then branch, so use explicit else branch with NodeSeq.Empty
- create and load scala compiler worker from MillMain - splitScript (mill scripts are a compilation unit where top stats are a template stat sequence) - cached initCtx - tested concurrent parsing - bin-pack comma separated import clauses into one - extract ImportTree from import code snippets - extract ObjectData from object code snippets - patch end marker of wrapper object - splice millDiscover into wrapper object after last statement - add passing scala-3-syntax test - account for code splice offset in ZincWorkerImpl reporter
new bootstrap patch remake patch regenerate patch correct bootstrap patch new rebootstrap patch regen bootstrap regenerate bootstrap patch again regenerate patch
57665a0
to
e13550b
Compare
so the compiler backend fix was merged |
This is work in progress to fix #3152
Numerous fixes were also needed to com-lihaoyi/mainargs, com-lihaoyi/sourcecode, and com-lihaoyi/mill-moduledefs
With the current state, only 1 example/integration tests is still failing:
integration.feature[plugin-classpath].local
known TODOs:
Fix BSP reporter linenumbers for build scripts(Zinc reporter forwards to bsp)known incompatibilities:
ExplicitResultTypes
scalafix rule - need to upgrade mill-scalafixCross.scala
uses the new quoted type syntax which scalafmt crashes on, (and version is frozen) so skip the fileexample.thirdparty[mockito]
integration.feature[plugin-classpath]
due to third party plugin dep