Skip to content

Commit fd9887b

Browse files
authored
Merge branch 'master' into added-monocle
2 parents 4e5dce1 + 086d1a8 commit fd9887b

File tree

358 files changed

+5420
-1918
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

358 files changed

+5420
-1918
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ jobs:
283283
run: cp -vf .github/workflows/repositories /root/.sbt/ ; true
284284

285285
- name: Test
286-
run: ./project/scripts/sbt sbt-dotty/scripted
286+
run: ./project/scripts/sbt "sbt-dotty/scripted; sbt-community-build/scripted"
287287

288288
test_java8:
289289
runs-on: [self-hosted, Linux]

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ vscode-dotty/.vscode-test
8484
community-build/scala3-bootstrapped.version
8585
community-build/sbt-dotty-sbt
8686
community-build/sbt-scalajs-sbt
87+
community-build/dotty-community-build-deps
8788

8889
# Vulpix output files
8990
*.check.out

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,3 +187,6 @@
187187
[submodule "community-build/community-projects/Monocle"]
188188
path = community-build/community-projects/Monocle
189189
url = https://github.com/optics-dev/Monocle.git
190+
[submodule "community-build/community-projects/protoquill"]
191+
path = community-build/community-projects/protoquill
192+
url = https://github.com/dotty-staging/protoquill.git

build.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ val `scaladoc-js` = Build.`scaladoc-js`
2626
val `scala3-bench-run` = Build.`scala3-bench-run`
2727
val dist = Build.dist
2828
val `community-build` = Build.`community-build`
29+
val `sbt-community-build` = Build.`sbt-community-build`
2930

3031
val sjsSandbox = Build.sjsSandbox
3132
val sjsJUnitTests = Build.sjsJUnitTests
Submodule Lucre updated 297 files
Submodule Serial updated 30 files
Submodule protoquill added at 5246493
Submodule sconfig updated 50 files

community-build/src/scala/dotty/communitybuild/projects.scala

Lines changed: 29 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -39,26 +39,6 @@ def exec(projectDir: Path, binary: String, arguments: String*): Int =
3939
exitCode
4040

4141

42-
/** Versions of published projects, needs to be updated when a project in the build is updated.
43-
*
44-
* TODO: instead of harcoding these numbers, we could get them from the
45-
* projects themselves. This likely requires injecting a custom task in the
46-
* projects to output the version number to a file.
47-
*/
48-
object Versions:
49-
val cats = "2.3.1-SNAPSHOT"
50-
val catsMtl = "1.1+DOTTY-SNAPSHOT"
51-
val coop = "1.0+DOTTY-SNAPSHOT"
52-
val discipline = "1.1.3-SNAPSHOT"
53-
val disciplineMunit = "1.0.3+DOTTY-SNAPSHOT"
54-
val disciplineSpecs2 = "1.1.3-SNAPSHOT"
55-
val izumiReflect = "1.0.0-SNAPSHOT"
56-
val scalacheck = "1.15.2-SNAPSHOT"
57-
val scalatest = "3.2.3"
58-
val munit = "0.7.19+DOTTY-SNAPSHOT"
59-
val scodecBits = "1.1+DOTTY-SNAPSHOT"
60-
val simulacrumScalafix = "0.5.1-SNAPSHOT"
61-
6242
sealed trait CommunityProject:
6343
private var published = false
6444

@@ -122,58 +102,17 @@ final case class SbtCommunityProject(
122102
extraSbtArgs: List[String] = Nil,
123103
dependencies: List[CommunityProject] = Nil,
124104
sbtPublishCommand: String = null,
125-
sbtDocCommand: String = null
105+
sbtDocCommand: String = null,
106+
scalacOptions: List[String] = List("-Ycheck-init")
126107
) extends CommunityProject:
127108
override val binaryName: String = "sbt"
128109

129-
// A project in the community build can depend on an arbitrary version of
130-
// another project in the build, so we force the use of the version that is
131-
// actually in the community build.
132-
val dependencyOverrides = List(
133-
// dependencyOverrides doesn't seem to understand `%%%`
134-
s""""org.scalacheck" %% "scalacheck" % "${Versions.scalacheck}"""",
135-
s""""org.scalacheck" %% "scalacheck_sjs1" % "${Versions.scalacheck}"""",
136-
s""""org.scalatest" %% "scalatest" % "${Versions.scalatest}"""",
137-
s""""org.scalatest" %% "scalatest_sjs1" % "${Versions.scalatest}"""",
138-
s""""org.scalameta" %% "munit" % "${Versions.munit}"""",
139-
s""""org.scalameta" %% "munit_sjs1" % "${Versions.munit}"""",
140-
s""""org.scalameta" %% "munit-scalacheck" % "${Versions.munit}"""",
141-
s""""org.scalameta" %% "munit-scalacheck_sjs1" % "${Versions.munit}"""",
142-
s""""org.scalameta" %% "junit-interface" % "${Versions.munit}"""",
143-
s""""org.scodec" %% "scodec-bits" % "${Versions.scodecBits}"""",
144-
s""""org.scodec" %% "scodec-bits_sjs1" % "${Versions.scodecBits}"""",
145-
s""""org.typelevel" %% "discipline-core" % "${Versions.discipline}"""",
146-
s""""org.typelevel" %% "discipline-core_sjs1" % "${Versions.discipline}"""",
147-
s""""org.typelevel" %% "discipline-munit" % "${Versions.disciplineMunit}"""",
148-
s""""org.typelevel" %% "discipline-munit_sjs1" % "${Versions.disciplineMunit}"""",
149-
s""""org.typelevel" %% "discipline-specs2" % "${Versions.disciplineSpecs2}"""",
150-
s""""org.typelevel" %% "discipline-specs2_sjs1" % "${Versions.disciplineSpecs2}"""",
151-
s""""org.typelevel" %% "simulacrum-scalafix-annotations" % "${Versions.simulacrumScalafix}"""",
152-
s""""org.typelevel" %% "simulacrum-scalafix-annotations_sjs1" % "${Versions.simulacrumScalafix}"""",
153-
s""""org.typelevel" %% "cats-core" % "${Versions.cats}"""",
154-
s""""org.typelevel" %% "cats-core_sjs1" % "${Versions.cats}"""",
155-
s""""org.typelevel" %% "cats-free" % "${Versions.cats}"""",
156-
s""""org.typelevel" %% "cats-free_sjs1" % "${Versions.cats}"""",
157-
s""""org.typelevel" %% "cats-kernel" % "${Versions.cats}"""",
158-
s""""org.typelevel" %% "cats-kernel_sjs1" % "${Versions.cats}"""",
159-
s""""org.typelevel" %% "cats-kernel-laws" % "${Versions.cats}"""",
160-
s""""org.typelevel" %% "cats-kernel-laws_sjs1" % "${Versions.cats}"""",
161-
s""""org.typelevel" %% "cats-laws" % "${Versions.cats}"""",
162-
s""""org.typelevel" %% "cats-laws_sjs1" % "${Versions.cats}"""",
163-
s""""org.typelevel" %% "cats-testkit" % "${Versions.cats}"""",
164-
s""""org.typelevel" %% "cats-testkit_sjs1" % "${Versions.cats}"""",
165-
s""""org.typelevel" %% "cats-mtl" % "${Versions.catsMtl}"""",
166-
s""""org.typelevel" %% "cats-mtl_sjs1" % "${Versions.catsMtl}"""",
167-
s""""org.typelevel" %% "cats-mtl-laws" % "${Versions.catsMtl}"""",
168-
s""""org.typelevel" %% "cats-mtl-laws_sjs1" % "${Versions.catsMtl}"""",
169-
s""""org.typelevel" %% "coop" % "${Versions.coop}"""",
170-
s""""org.typelevel" %% "coop_sjs1" % "${Versions.coop}"""",
171-
s""""dev.zio" %% "izumi-reflect" % "${Versions.izumiReflect}"""",
172-
)
110+
private def scalacOptionsString: String =
111+
scalacOptions.map("\"" + _ + "\"").mkString("List(", ",", ")")
173112

174113
private val baseCommand =
175114
"clean; set logLevel in Global := Level.Error; set updateOptions in Global ~= (_.withLatestSnapshots(false)); "
176-
++ s"""set dependencyOverrides in ThisBuild ++= ${dependencyOverrides.mkString("Seq(", ", ", ")")}; """
115+
++ (if scalacOptions.isEmpty then "" else s"""set scalacOptions in Global ++= $scalacOptionsString;""")
177116
++ s"++$compilerVersion!; "
178117

179118
override val testCommand =
@@ -195,7 +134,8 @@ final case class SbtCommunityProject(
195134
case _ => Nil
196135
extraSbtArgs ++ sbtProps ++ List(
197136
"-sbt-version", "1.4.7",
198-
"-Dsbt.supershell=false",
137+
"-Dsbt.supershell=false",
138+
s"-Ddotty.communitybuild.dir=$communitybuildDir",
199139
s"--addPluginSbtFile=$sbtPluginFilePath"
200140
)
201141

@@ -384,7 +324,8 @@ object projects:
384324
lazy val shapeless = SbtCommunityProject(
385325
project = "shapeless",
386326
sbtTestCommand = "test",
387-
sbtDocCommand = forceDoc("typeable", "deriving", "data")
327+
sbtDocCommand = forceDoc("typeable", "deriving", "data"),
328+
scalacOptions = Nil // disable -Ycheck-init, due to -Xfatal-warnings
388329
)
389330

390331
lazy val xmlInterpolator = SbtCommunityProject(
@@ -419,6 +360,7 @@ object projects:
419360
project = "sconfig",
420361
sbtTestCommand = "sconfigJVM/test",
421362
sbtDocCommand = "sconfigJVM/doc",
363+
dependencies = List(scalaCollectionCompat)
422364
)
423365

424366
lazy val zio = SbtCommunityProject(
@@ -431,17 +373,15 @@ object projects:
431373
lazy val munit = SbtCommunityProject(
432374
project = "munit",
433375
sbtTestCommand = "testsJVM/test;testsJS/test;",
434-
// Hardcode the version to avoid having to deal with something set by sbt-dynver
435-
sbtPublishCommand = s"""set every version := "${Versions.munit}"; munitJVM/publishLocal; munitJS/publishLocal; munitScalacheckJVM/publishLocal; munitScalacheckJS/publishLocal; junit/publishLocal""",
376+
sbtPublishCommand = "munitJVM/publishLocal; munitJS/publishLocal; munitScalacheckJVM/publishLocal; munitScalacheckJS/publishLocal; junit/publishLocal",
436377
sbtDocCommand = "junit/doc; munitJVM/doc",
437378
dependencies = List(scalacheck)
438379
)
439380

440381
lazy val scodecBits = SbtCommunityProject(
441382
project = "scodec-bits",
442383
sbtTestCommand = "coreJVM/test;coreJS/test",
443-
// Hardcode the version to avoid having to deal with something set by sbt-git
444-
sbtPublishCommand = s"""set every version := "${Versions.scodecBits}"; coreJVM/publishLocal;coreJS/publishLocal""",
384+
sbtPublishCommand = "coreJVM/publishLocal;coreJS/publishLocal",
445385
sbtDocCommand = "coreJVM/doc",
446386
dependencies = List(munit)
447387
)
@@ -517,6 +457,7 @@ object projects:
517457
lazy val scalaCollectionCompat = SbtCommunityProject(
518458
project = "scala-collection-compat",
519459
sbtTestCommand = "compat30/test",
460+
sbtPublishCommand = "compat30/publishLocal",
520461
)
521462

522463
lazy val verify = SbtCommunityProject(
@@ -535,15 +476,16 @@ object projects:
535476
lazy val disciplineMunit = SbtCommunityProject(
536477
project = "discipline-munit",
537478
sbtTestCommand = "test",
538-
sbtPublishCommand = s"""set every version := "${Versions.disciplineMunit}";coreJVM/publishLocal;coreJS/publishLocal""",
479+
sbtPublishCommand = "coreJVM/publishLocal;coreJS/publishLocal",
539480
dependencies = List(discipline, munit)
540481
)
541482

542483
lazy val disciplineSpecs2 = SbtCommunityProject(
543484
project = "discipline-specs2",
544485
sbtTestCommand = "test",
545486
sbtPublishCommand = "coreJVM/publishLocal;coreJS/publishLocal",
546-
dependencies = List(discipline)
487+
dependencies = List(discipline),
488+
scalacOptions = Nil // disable -Ycheck-init
547489
)
548490

549491
lazy val simulacrumScalafixAnnotations = SbtCommunityProject(
@@ -556,20 +498,21 @@ object projects:
556498
project = "cats",
557499
sbtTestCommand = "set scalaJSStage in Global := FastOptStage;buildJVM;validateAllJS",
558500
sbtPublishCommand = "catsJVM/publishLocal;catsJS/publishLocal",
559-
dependencies = List(discipline, disciplineMunit, scalacheck, simulacrumScalafixAnnotations)
501+
dependencies = List(discipline, disciplineMunit, scalacheck, simulacrumScalafixAnnotations),
502+
scalacOptions = Nil // disable -Ycheck-init, due to -Xfatal-warning
560503
)
561504

562505
lazy val catsMtl = SbtCommunityProject(
563506
project = "cats-mtl",
564507
sbtTestCommand = "testsJVM/test;testsJS/test",
565-
sbtPublishCommand = s"""set every version := "${Versions.catsMtl}";coreJVM/publishLocal;coreJS/publishLocal;lawsJVM/publishLocal;lawsJS/publishLocal""",
508+
sbtPublishCommand = "coreJVM/publishLocal;coreJS/publishLocal;lawsJVM/publishLocal;lawsJS/publishLocal",
566509
dependencies = List(cats, disciplineMunit)
567510
)
568511

569512
lazy val coop = SbtCommunityProject(
570513
project = "coop",
571514
sbtTestCommand = "test",
572-
sbtPublishCommand = s"""set every version := "${Versions.coop}";coreJVM/publishLocal;coreJS/publishLocal""",
515+
sbtPublishCommand = "coreJVM/publishLocal;coreJS/publishLocal",
573516
dependencies = List(cats, catsMtl)
574517
)
575518

@@ -673,6 +616,14 @@ object projects:
673616
dependencies = List(cats, munit, discipline, disciplineMunit)
674617
)
675618

619+
lazy val protoquill = SbtCommunityProject(
620+
project = "protoquill",
621+
sbtTestCommand = "test",
622+
sbtPublishCommand = "publishLocal",
623+
dependencies = List(), // TODO add scalatest and pprint (see protoquill/build.sbt)
624+
scalacOptions = List("-language:implicitConversions"), // disabled -Ycheck-init, due to bug in macro
625+
)
626+
676627
end projects
677628

678629
def allProjects = List(
@@ -739,6 +690,7 @@ def allProjects = List(
739690
projects.perspective,
740691
projects.akka,
741692
projects.monocle,
693+
projects.protoquill,
742694
)
743695

744696
lazy val projectMap = allProjects.groupBy(_.project)

community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ class CommunityBuildTestA extends CommunityBuildTest:
110110
@Test def upickle = projects.upickle.run()
111111
@Test def utest = projects.utest.run()
112112
@Test def zio = projects.zio.run()
113+
@Test def protoquill = projects.protoquill.run()
113114

114115
// 'scala-stm' and 'Sciss/Lucre':
115116
// @Test def scissEqual = projects.scissEqual .run()
@@ -121,7 +122,7 @@ class CommunityBuildTestA extends CommunityBuildTest:
121122
// @Test def scissAsyncFile = projects.scissAsyncFile .run()
122123
// @Test def scissSpan = projects.scissSpan .run()
123124
@Test def scalaSTM = projects.scalaSTM .run()
124-
// @Test def scissLucre = projects.scissLucre .run()
125+
@Test def scissLucre = projects.scissLucre .run()
125126

126127
end CommunityBuildTestA
127128

compiler/src/dotty/tools/backend/jvm/BCodeHelpers.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,14 @@ trait BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
335335
emitAssocs(av, assocs, BCodeHelpers.this)(this)
336336
}
337337

338+
/*
339+
* must-single-thread
340+
*/
341+
def emitParamNames(jmethod: asm.MethodVisitor, params: List[Symbol]) =
342+
for param <- params do
343+
var access = asm.Opcodes.ACC_FINAL
344+
jmethod.visitParameter(param.name.mangledString, access)
345+
338346
/*
339347
* must-single-thread
340348
*/

compiler/src/dotty/tools/backend/jvm/BCodeSkelBuilder.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ trait BCodeSkelBuilder extends BCodeHelpers {
615615
/*
616616
* must-single-thread
617617
*/
618-
def initJMethod(flags: Int, paramAnnotations: List[List[Annotation]]): Unit = {
618+
def initJMethod(flags: Int, params: List[Symbol]): Unit = {
619619

620620
val jgensig = getGenericSignature(methSymbol, claszSymbol)
621621
val (excs, others) = methSymbol.annotations.partition(_.symbol eq defn.ThrowsAnnot)
@@ -637,7 +637,8 @@ trait BCodeSkelBuilder extends BCodeHelpers {
637637
// TODO param names: (m.params map (p => javaName(p.sym)))
638638

639639
emitAnnotations(mnode, others)
640-
emitParamAnnotations(mnode, paramAnnotations)
640+
emitParamNames(mnode, params)
641+
emitParamAnnotations(mnode, params.map(_.annotations))
641642

642643
} // end of method initJMethod
643644

@@ -749,7 +750,7 @@ trait BCodeSkelBuilder extends BCodeHelpers {
749750
.addFlagIf(isNative, asm.Opcodes.ACC_NATIVE) // native methods of objects are generated in mirror classes
750751

751752
// TODO needed? for(ann <- m.symbol.annotations) { ann.symbol.initialize }
752-
initJMethod(flags, params.map(p => p.symbol.annotations))
753+
initJMethod(flags, params.map(_.symbol))
753754

754755

755756
if (!isAbstractMethod && !isNative) {

compiler/src/dotty/tools/dotc/Compiler.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ class Compiler {
4242
List(new semanticdb.ExtractSemanticDB) :: // Extract info into .semanticdb files
4343
List(new PostTyper) :: // Additional checks and cleanups after type checking
4444
List(new sjs.PrepJSInterop) :: // Additional checks and transformations for Scala.js (Scala.js only)
45-
List(new Staging) :: // Check PCP, heal quoted types and expand macros
4645
List(new sbt.ExtractAPI) :: // Sends a representation of the API of classes to sbt via callbacks
4746
List(new SetRootTree) :: // Set the `rootTreeOrProvider` on class symbols
4847
Nil
@@ -51,6 +50,7 @@ class Compiler {
5150
protected def picklerPhases: List[List[Phase]] =
5251
List(new Pickler) :: // Generate TASTY info
5352
List(new Inlining) :: // Inline and execute macros
53+
List(new Staging) :: // Check staging levels and heal staged types
5454
List(new PickleQuotes) :: // Turn quoted trees into explicit run-time data structures
5555
Nil
5656

0 commit comments

Comments
 (0)