Skip to content

Commit 4716247

Browse files
committed
2 parents 31acfd7 + 0273336 commit 4716247

File tree

163 files changed

+1761
-13926
lines changed

Some content is hidden

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

163 files changed

+1761
-13926
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ jobs:
100100
- name: Add SBT proxy repositories
101101
run: cp -vf .github/workflows/repositories /root/.sbt/ ; true
102102

103-
- name: Test
103+
- name: Cmd Tests
104104
run: |
105105
./project/scripts/sbt ";scala3-bootstrapped/compile ;scala3-bootstrapped/test;sjsSandbox/run;sjsSandbox/test;sjsJUnitTests/test;sjsCompilerTests/test ;sbt-dotty/scripted scala2-compat/* ;configureIDE ;stdlib-bootstrapped/test:run ;stdlib-bootstrapped-tasty-tests/test"
106106
./project/scripts/bootstrapCmdTests

.github/workflows/scaladoc.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
DOC_DEST=pr-${PR_NUMBER:-${GITHUB_REF##*/}}
7070
echo uplading docs to https://scala3doc.virtuslab.com/$DOC_DEST
7171
az storage container create --name $DOC_DEST --account-name scala3docstorage --public-access container
72-
az storage blob sync -s scaladoc/output -c $DOC_DEST --account-name scala3docstorage
72+
az storage blob upload-batch -s scaladoc/output -d $DOC_DEST --account-name scala3docstorage
7373
7474
community-docs:
7575
env:
@@ -108,4 +108,4 @@ jobs:
108108
DOC_DEST=pr-${PR_NUMBER:-${GITHUB_REF##*/}}-docs
109109
echo uplading docs to https://scala3doc.virtuslab.com/$DOC_DEST
110110
az storage container create --name $DOC_DEST --account-name scala3docstorage --public-access container
111-
az storage blob sync -s community-build/docsOutput -c $DOC_DEST --account-name scala3docstorage
111+
az storage blob upload-batch -s community-build/docsOutput -d $DOC_DEST --account-name scala3docstorage

bin/scalad renamed to bin/scaladoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" >& /dev/null && pwd)/.."
44

5-
"$ROOT/bin/common" "$ROOT/dist/target/pack/bin/scalad" "$@"
5+
"$ROOT/bin/common" "$ROOT/dist/target/pack/bin/scaladoc" "$@"

build.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
val scala3 = Build.scala3
22
val `scala3-bootstrapped` = Build.`scala3-bootstrapped`
33
val `scala3-interfaces` = Build.`scala3-interfaces`
4-
val `scala3-doc` = Build.`scala3-doc`
5-
val `scala3-doc-bootstrapped` = Build.`scala3-doc-bootstrapped`
64
val `scala3-compiler` = Build.`scala3-compiler`
75
val `scala3-compiler-bootstrapped` = Build.`scala3-compiler-bootstrapped`
86
val `scala3-library` = Build.`scala3-library`
@@ -12,6 +10,7 @@ val `scala3-sbt-bridge` = Build.`scala3-sbt-bridge`
1210
val `scala3-sbt-bridge-tests` = Build.`scala3-sbt-bridge-tests`
1311
val `scala3-staging` = Build.`scala3-staging`
1412
val `scala3-tasty-inspector` = Build.`scala3-tasty-inspector`
13+
val `scala3-tasty-inspector-nonbootstrapped` = Build.`scala3-tasty-inspector-nonbootstrapped`
1514
val `scala3-language-server` = Build.`scala3-language-server`
1615
val `scala3-bench` = Build.`scala3-bench`
1716
val `scala3-bench-bootstrapped` = Build.`scala3-bench-bootstrapped`
@@ -21,6 +20,7 @@ val `tasty-core` = Build.`tasty-core`
2120
val `tasty-core-bootstrapped` = Build.`tasty-core-bootstrapped`
2221
val `tasty-core-scala2` = Build.`tasty-core-scala2`
2322
val scaladoc = Build.scaladoc
23+
val `scaladoc-nonBootstrapped` = Build.`scaladoc-nonBootstrapped`
2424
val `scaladoc-testcases` = Build.`scaladoc-testcases`
2525
val `scaladoc-js` = Build.`scaladoc-js`
2626
val `scala3-bench-run` = Build.`scala3-bench-run`
Submodule geny updated 1 file
Submodule upickle updated 1 file

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

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,36 @@ object Main:
1919
e.printStackTrace()
2020
Nil
2121

22+
def withProjects[T](names: Seq[String], opName: String)(op: CommunityProject => T): Seq[T] =
23+
val missing = names.filterNot(projectMap.contains)
24+
if missing.nonEmpty then
25+
val allNames = allProjects.map(_.project).mkString(", ")
26+
println(s"Missing projects: ${missing.mkString(", ")}. All projects: $allNames")
27+
sys.exit(1)
28+
29+
val (failed, completed) = names.flatMap(projectMap.apply).partitionMap( o =>
30+
try
31+
Right(op(o))
32+
catch case e: Throwable =>
33+
e.printStackTrace()
34+
Left(o)
35+
)
36+
37+
if failed.nonEmpty then
38+
println(s"$opName failed for ${failed.mkString(", ")}")
39+
sys.exit(1)
40+
41+
completed
42+
2243
/** Allows running various commands on community build projects. */
2344
def main(args: Array[String]): Unit =
2445
args.toList match
25-
case "publish" :: name :: Nil =>
46+
case "publish" :: names if names.nonEmpty =>
47+
withProjects(names, "Publishing")(_.publish())
48+
49+
case "build" :: names if names.nonEmpty =>
50+
withProjects(names, "Build")(_.build())
51+
2652
case "doc" :: "all" :: destStr :: Nil =>
2753
val dest = Paths.get(destStr)
2854
Seq("rm", "-rf", destStr).!
@@ -66,26 +92,23 @@ object Main:
6692
sys.exit(1)
6793

6894
case "doc" :: names if names.nonEmpty =>
69-
val missing = names.filterNot(projectMap.contains)
70-
if missing.nonEmpty then
71-
println(s"Missing projects: ${missing.mkString(", ")}. All projects: ${allProjects.mkString(", ")}")
72-
sys.exit(1)
73-
74-
val failed = names.filter{ p =>
75-
val docsRoots = generateDocs(projectMap(p))
95+
val failed = withProjects(names, "Documenting"){ p =>
96+
val docsRoots = generateDocs(p)
97+
println(docsRoots)
7698
if docsRoots.nonEmpty then println(s"Docs for $p generated in $docsRoots")
77-
docsRoots.isEmpty
78-
}
99+
if docsRoots.isEmpty then Some(p.project) else None
100+
}.flatten
101+
79102
if failed.nonEmpty then
80103
println(s"Documentation not found for ${failed.mkString(", ")}")
81104
sys.exit(1)
82105

83106
case args =>
84107
println("USAGE: <COMMAND> <PROJECT NAME>")
85-
println("COMMAND is one of: publish doc")
108+
println("COMMAND is one of: publish doc run")
86109
println("Available projects are:")
87110
allProjects.foreach { k =>
88-
println(s"\t$k")
111+
println(s"\t${k.project}")
89112
}
90113
sys.exit(1)
91114

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

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,24 @@ sealed trait CommunityProject:
8484
if exitCode != 0 then
8585
throw RuntimeException(s"Doc command exited with code $exitCode for project $project. Project details:\n$this")
8686

87+
final def build(): Int = exec(projectDir, binaryName, buildCommands: _*)
88+
89+
final def buildCommands = runCommandsArgs :+ testCommand
90+
8791
end CommunityProject
8892

8993
final case class MillCommunityProject(
9094
project: String,
9195
baseCommand: String,
92-
dependencies: List[CommunityProject] = Nil) extends CommunityProject:
96+
dependencies: List[CommunityProject] = Nil,
97+
ignoreDocs: Boolean = false,
98+
) extends CommunityProject:
9399
override val binaryName: String = "./mill"
94100
override val testCommand = s"$baseCommand.test"
95101
override val publishCommand = s"$baseCommand.publishLocal"
96102
override val docCommand = null
103+
// uncomment once mill is released
104+
// if ignoreDocs then null else s"$baseCommand.docJar"
97105
override val runCommandsArgs = List("-i", "-D", s"dottyVersion=$compilerVersion")
98106

99107
final case class SbtCommunityProject(
@@ -160,10 +168,9 @@ final case class SbtCommunityProject(
160168
"""set testOptions in Global += Tests.Argument(TestFramework("munit.Framework"), "+l"); """
161169
++ s"$baseCommand$sbtTestCommand"
162170

163-
override val publishCommand = if sbtPublishCommand eq null then null else
164-
val disableDocCommand =
165-
if sbtDocCommand eq null then "" else "set every useScaladoc := false;"
166-
s"$baseCommand$disableDocCommand$sbtPublishCommand"
171+
override val publishCommand =
172+
if sbtPublishCommand eq null then null else s"$baseCommand$sbtPublishCommand"
173+
167174
override val docCommand =
168175
if sbtDocCommand eq null then null else
169176
val cmd = if sbtDocCommand.startsWith(";") then sbtDocCommand else s";$sbtDocCommand"
@@ -175,7 +182,7 @@ final case class SbtCommunityProject(
175182
case Some(ivyHome) => List(s"-Dsbt.ivy.home=$ivyHome")
176183
case _ => Nil
177184
extraSbtArgs ++ sbtProps ++ List(
178-
"-sbt-version", "1.4.4",
185+
"-sbt-version", "1.4.7",
179186
"-Dsbt.supershell=false",
180187
s"--addPluginSbtFile=$sbtPluginFilePath"
181188
)
@@ -195,11 +202,13 @@ object projects:
195202
lazy val utest = MillCommunityProject(
196203
project = "utest",
197204
baseCommand = s"utest.jvm[$compilerVersion]",
205+
ignoreDocs = true
198206
)
199207

200208
lazy val sourcecode = MillCommunityProject(
201209
project = "sourcecode",
202210
baseCommand = s"sourcecode.jvm[$compilerVersion]",
211+
ignoreDocs = true
203212
)
204213

205214
lazy val oslib = MillCommunityProject(
@@ -211,7 +220,8 @@ object projects:
211220
lazy val oslibWatch = MillCommunityProject(
212221
project = "os-lib",
213222
baseCommand = s"os.watch[$compilerVersion]",
214-
dependencies = List(utest, sourcecode)
223+
dependencies = List(utest, sourcecode),
224+
ignoreDocs = true
215225
)
216226

217227
lazy val ujson = MillCommunityProject(
@@ -241,13 +251,15 @@ object projects:
241251
lazy val fansi = MillCommunityProject(
242252
project = "fansi",
243253
baseCommand = s"fansi.jvm[$compilerVersion]",
244-
dependencies = List(utest, sourcecode)
254+
dependencies = List(utest, sourcecode),
255+
ignoreDocs = true
245256
)
246257

247258
lazy val pprint = MillCommunityProject(
248259
project = "PPrint",
249260
baseCommand = s"pprint.jvm[$compilerVersion]",
250-
dependencies = List(fansi)
261+
dependencies = List(fansi),
262+
ignoreDocs = true
251263
)
252264

253265
lazy val requests = MillCommunityProject(
@@ -409,7 +421,7 @@ object projects:
409421
sbtTestCommand = "testsJVM/test;testsJS/test;",
410422
// Hardcode the version to avoid having to deal with something set by sbt-dynver
411423
sbtPublishCommand = s"""set every version := "${Versions.munit}"; munitJVM/publishLocal; munitJS/publishLocal; munitScalacheckJVM/publishLocal; munitScalacheckJS/publishLocal; junit/publishLocal""",
412-
sbtDocCommand = "munitJVM/doc",
424+
sbtDocCommand = "junit/doc; munitJVM/doc",
413425
dependencies = List(scalacheck)
414426
)
415427

@@ -627,7 +639,7 @@ object projects:
627639
sbtPublishCommand = "publishLocal",
628640
dependencies = List(scalatest)
629641
)
630-
642+
631643
lazy val perspective = SbtCommunityProject(
632644
project = "perspective",
633645
// No library with easy typeclasses to verify data against exist for Dotty, so no tests yet
@@ -702,4 +714,4 @@ def allProjects = List(
702714
projects.perspective,
703715
)
704716

705-
lazy val projectMap = allProjects.map(p => p.project -> p).toMap
717+
lazy val projectMap = allProjects.groupBy(_.project)

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ abstract class CommunityBuildTest:
2222
*/
2323
extension (self: CommunityProject) def run()(using suite: CommunityBuildTest) =
2424
self.dependencies.foreach(_.publish())
25-
suite.test(self.project, self.binaryName, self.runCommandsArgs :+ self.testCommand)
25+
suite.test(self)
2626

2727
/** Build the given project with the published local compiler and sbt plugin.
2828
*
@@ -34,10 +34,14 @@ abstract class CommunityBuildTest:
3434
* a build tool like SBT or Mill
3535
* @param arguments Arguments to pass to the testing program
3636
*/
37-
def test(project: String, command: String, arguments: Seq[String]): Unit = {
37+
def test(projectDef: CommunityProject): Unit = {
38+
val project = projectDef.project
39+
val command = projectDef.binaryName
40+
val arguments = projectDef.buildCommands
41+
3842
@annotation.tailrec
39-
def execTimes(task: => Int, timesToRerun: Int): Boolean =
40-
val exitCode = task
43+
def execTimes(task: () => Int, timesToRerun: Int): Boolean =
44+
val exitCode = task()
4145
if exitCode == 0
4246
then true
4347
else if timesToRerun == 0
@@ -60,7 +64,7 @@ abstract class CommunityBuildTest:
6064
|""".stripMargin)
6165
}
6266

63-
val testsCompletedSuccessfully = execTimes(exec(projectDir, command, arguments: _*), 3)
67+
val testsCompletedSuccessfully = execTimes(projectDef.build, 3)
6468

6569
if (!testsCompletedSuccessfully) {
6670
fail(s"""

compiler/src/dotty/tools/dotc/ast/Trees.scala

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ package ast
44

55
import core._
66
import Types._, Names._, NameOps._, Flags._, util.Spans._, Contexts._, Constants._
7-
import typer.ProtoTypes
7+
import typer.{ ConstFold, ProtoTypes }
88
import SymDenotations._, Symbols._, Denotations._, StdNames._, Comments._
99
import language.higherKinds
1010
import collection.mutable.ListBuffer
@@ -408,6 +408,13 @@ object Trees {
408408
case class Select[-T >: Untyped] private[ast] (qualifier: Tree[T], name: Name)(implicit @constructorOnly src: SourceFile)
409409
extends RefTree[T] {
410410
type ThisTree[-T >: Untyped] = Select[T]
411+
412+
override def denot(using Context): Denotation = typeOpt match
413+
case ConstantType(_) if ConstFold.foldedUnops.contains(name) =>
414+
// Recover the denotation of a constant-folded selection
415+
qualifier.typeOpt.member(name).atSignature(Signature.NotAMethod, name)
416+
case _ =>
417+
super.denot
411418
}
412419

413420
class SelectWithSig[-T >: Untyped] private[ast] (qualifier: Tree[T], name: Name, val sig: Signature)(implicit @constructorOnly src: SourceFile)

compiler/src/dotty/tools/dotc/config/Properties.scala

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,24 @@ trait PropertiesTrait {
6464
*/
6565
def versionNumberString: String = scalaPropOrEmpty("version.number")
6666

67-
/** The version number of the jar this was loaded from plus "version " prefix,
68-
* or "version (unknown)" if it cannot be determined.
67+
/** The version number of the jar this was loaded from,
68+
* or `"(unknown)"` if it cannot be determined.
6969
*/
70-
val versionString: String = {
70+
val simpleVersionString: String = {
7171
val v = scalaPropOrElse("version.number", "(unknown)")
72-
"version " + scalaPropOrElse("version.number", "(unknown)") + {
72+
v + (
7373
if (v.contains("SNAPSHOT") || v.contains("NIGHTLY"))
7474
"-git-" + scalaPropOrElse("git.hash", "(unknown)")
75-
else ""
76-
}
75+
else
76+
""
77+
)
7778
}
7879

80+
/** The version number of the jar this was loaded from plus `"version "` prefix,
81+
* or `"version (unknown)"` if it cannot be determined.
82+
*/
83+
val versionString: String = "version " + simpleVersionString
84+
7985
/** Whether the current version of compiler is experimental
8086
*
8187
* 1. Snapshot and nightly releases are experimental.

compiler/src/dotty/tools/dotc/core/tasty/TastyPickler.scala

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ import core.Symbols.{Symbol, ClassSymbol}
1212
import ast.tpd
1313
import Decorators._
1414

15+
object TastyPickler {
16+
17+
private val versionStringBytes = {
18+
val compilerString = s"Scala ${config.Properties.simpleVersionString}"
19+
compilerString.getBytes(java.nio.charset.StandardCharsets.UTF_8)
20+
}
21+
22+
}
23+
1524
class TastyPickler(val rootCls: ClassSymbol) {
1625

1726
private val sections = new mutable.ArrayBuffer[(NameRef, TastyBuffer)]
@@ -37,10 +46,13 @@ class TastyPickler(val rootCls: ClassSymbol) {
3746
val uuidHi: Long = otherSectionHashes.fold(0L)(_ ^ _)
3847

3948
val headerBuffer = {
40-
val buf = new TastyBuffer(header.length + 24)
49+
val buf = new TastyBuffer(header.length + TastyPickler.versionStringBytes.length + 32)
4150
for (ch <- header) buf.writeByte(ch.toByte)
4251
buf.writeNat(MajorVersion)
4352
buf.writeNat(MinorVersion)
53+
buf.writeNat(ExperimentalVersion)
54+
buf.writeNat(TastyPickler.versionStringBytes.length)
55+
buf.writeBytes(TastyPickler.versionStringBytes, TastyPickler.versionStringBytes.length)
4456
buf.writeUncompressedLong(uuidLow)
4557
buf.writeUncompressedLong(uuidHi)
4658
buf

0 commit comments

Comments
 (0)