Skip to content

Commit 708250c

Browse files
committed
Merge remote-tracking branch 'upstream/master' into dotty-explicit-nulls-only
2 parents 423ef59 + ccb7b13 commit 708250c

File tree

612 files changed

+19104
-249
lines changed

Some content is hidden

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

612 files changed

+19104
-249
lines changed

.gitignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,37 @@ community-build/sbt-dotty-sbt
8383

8484
# Vulpix output files
8585
*.check.out
86+
87+
tastydoc/report/report\.aux
88+
89+
tastydoc/report/report\.fdb_latexmk
90+
91+
tastydoc/report/report\.fls
92+
93+
tastydoc/report/report\.synctex\.gz
94+
95+
tastydoc/report/report\.toc
96+
97+
tastydoc/report/report\.out
98+
99+
tastydoc/report/presentation/presentation\.aux
100+
101+
tastydoc/report/presentation/presentation\.fdb_latexmk
102+
103+
tastydoc/report/presentation/presentation\.fls
104+
105+
tastydoc/report/presentation/presentation\.nav
106+
107+
tastydoc/report/presentation/presentation\.out
108+
109+
tastydoc/report/presentation/presentation\.snm
110+
111+
tastydoc/report/presentation/presentation\.synctex\.gz
112+
113+
tastydoc/report/presentation/presentation\.toc
114+
115+
tastydoc/dotty-0\.15\.0-RC1/
116+
117+
tastydoc/report/presentation/presentation\.vrb
118+
119+
tastydoc/dotty-0\.16\.0-RC3/

build.sbt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ val `dotty-staging` = Build.`dotty-staging`
1414
val `dotty-language-server` = Build.`dotty-language-server`
1515
val `dotty-bench` = Build.`dotty-bench`
1616
val `dotty-bench-bootstrapped` = Build.`dotty-bench-bootstrapped`
17+
val `tasty-core` = Build.`tasty-core`
18+
val `tasty-core-bootstrapped` = Build.`tasty-core-bootstrapped`
19+
val `tasty-core-scala2` = Build.`tasty-core-scala2`
20+
val `dotty-tastydoc` = Build.`dotty-tastydoc`
21+
val `dotty-tastydoc-input` = Build.`dotty-tastydoc-input`
1722
val `scala-library` = Build.`scala-library`
1823
val `scala-compiler` = Build.`scala-compiler`
1924
val `scala-reflect` = Build.`scala-reflect`

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ object projects
160160

161161
lazy val scalatestplusScalacheck = SbtCommunityProject(
162162
project = "scalatestplus-scalacheck",
163-
sbtTestCommand = "scalatestPlusScalaCheckJVM/compile", // TODO: compile only because tests are prone to java.lang.OutOfMemoryError: Metaspace
163+
sbtTestCommand = "scalatestPlusScalaCheckJVM/test",
164164
sbtUpdateCommand = "scalatestPlusScalaCheckJVM/update",
165165
sbtPublishCommand = "scalatestPlusScalaCheckJVM/publishLocal",
166166
dependencies = List(scalatest, scalacheck)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ import Decorators._
2020

2121
import java.io.DataOutputStream
2222

23+
import dotty.tools.tasty.{ TastyBuffer, TastyHeaderUnpickler }
2324

2425
import scala.tools.asm
2526
import scala.tools.asm.Handle
2627
import scala.tools.asm.tree._
2728
import tpd._
2829
import StdNames._
29-
import dotty.tools.dotc.core.tasty.{TastyBuffer, TastyHeaderUnpickler}
3030
import dotty.tools.io._
3131

3232
class GenBCode extends Phase {

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package dotty.tools
22
package dotc
33

4-
import util.SourceFile
4+
import util.{FreshNameCreator, SourceFile}
55
import ast.{tpd, untpd}
66
import tpd.{Tree, TreeTraverser}
77
import typer.PrepareInlineable.InlineAccessors
@@ -27,6 +27,12 @@ class CompilationUnit protected (val source: SourceFile) {
2727
/** Pickled TASTY binaries, indexed by class. */
2828
var pickled: Map[ClassSymbol, Array[Byte]] = Map()
2929

30+
/** The fresh name creator for the current unit.
31+
* FIXME(#7661): This is not fine-grained enough to enable reproducible builds,
32+
* see https://github.com/scala/scala/commit/f50ec3c866263448d803139e119b33afb04ec2bc
33+
*/
34+
val freshNames: FreshNameCreator = new FreshNameCreator.Default
35+
3036
/** Will be set to `true` if contains `Quote`.
3137
* The information is used in phase `Staging` in order to avoid traversing trees that need no transformations.
3238
*/

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint
5252
.setTyper(new Typer)
5353
.addMode(Mode.ImplicitsEnabled)
5454
.setTyperState(new TyperState(ctx.typerState))
55-
.setFreshNames(new FreshNameCreator.Default)
5655
ctx.initialize()(start) // re-initialize the base context with start
5756
def addImport(ctx: Context, rootRef: ImportInfo.RootRef) =
5857
ctx.fresh.setImportInfo(ImportInfo.rootImport(rootRef)(ctx))
@@ -241,12 +240,15 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint
241240
}
242241
}
243242

244-
def compileFromString(sourceCode: String): Unit = {
245-
val virtualFile = new VirtualFile("compileFromString-${java.util.UUID.randomUUID().toString}")
246-
val writer = new BufferedWriter(new OutputStreamWriter(virtualFile.output, "UTF-8")) // buffering is still advised by javadoc
247-
writer.write(sourceCode)
248-
writer.close()
249-
compileSources(List(new SourceFile(virtualFile, Codec.UTF8)))
243+
def compileFromStrings(sourceCodes: String*): Unit = {
244+
val sourceFiles = sourceCodes.map {sourceCode =>
245+
val virtualFile = new VirtualFile("compileFromString-${java.util.UUID.randomUUID().toString}")
246+
val writer = new BufferedWriter(new OutputStreamWriter(virtualFile.output, "UTF-8")) // buffering is still advised by javadoc
247+
writer.write(sourceCode)
248+
writer.close()
249+
new SourceFile(virtualFile, Codec.UTF8)
250+
}
251+
compileSources(sourceFiles.toList)
250252
}
251253

252254
/** Print summary; return # of errors encountered */

compiler/src/dotty/tools/dotc/core/Comments.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ object Comments {
121121
val tree = new Parser(SourceFile.virtual("<usecase>", code)).localDef(codePos.start)
122122
tree match {
123123
case tree: untpd.DefDef =>
124-
val newName = ctx.freshNames.newName(tree.name, NameKinds.DocArtifactName)
124+
val newName = ctx.compilationUnit.freshNames.newName(tree.name, NameKinds.DocArtifactName)
125125
untpd.cpy.DefDef(tree)(name = newName)
126126
case _ =>
127127
ctx.error(ProperDefinitionNotFound(), ctx.source.atSpan(codePos))

compiler/src/dotty/tools/dotc/core/Contexts.scala

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import Uniques._
1414
import ast.Trees._
1515
import ast.untpd
1616
import Flags.GivenOrImplicit
17-
import util.{FreshNameCreator, NoSource, SimpleIdentityMap, SourceFile}
17+
import util.{NoSource, SimpleIdentityMap, SourceFile}
1818
import typer.{Implicits, ImportInfo, Inliner, NamerContextOps, SearchHistory, SearchRoot, TypeAssigner, Typer, Nullables}
1919
import Nullables.{NotNullInfo, given}
2020
import Implicits.ContextualImplicits
@@ -44,12 +44,11 @@ object Contexts {
4444
private val (sbtCallbackLoc, store2) = store1.newLocation[AnalysisCallback]()
4545
private val (printerFnLoc, store3) = store2.newLocation[Context => Printer](new RefinedPrinter(_))
4646
private val (settingsStateLoc, store4) = store3.newLocation[SettingsState]()
47-
private val (freshNamesLoc, store5) = store4.newLocation[FreshNameCreator](new FreshNameCreator.Default)
48-
private val (compilationUnitLoc, store6) = store5.newLocation[CompilationUnit]()
49-
private val (runLoc, store7) = store6.newLocation[Run]()
50-
private val (profilerLoc, store8) = store7.newLocation[Profiler]()
51-
private val (notNullInfosLoc, store9) = store8.newLocation[List[NotNullInfo]]()
52-
private val initialStore = store9
47+
private val (compilationUnitLoc, store5) = store4.newLocation[CompilationUnit]()
48+
private val (runLoc, store6) = store5.newLocation[Run]()
49+
private val (profilerLoc, store7) = store6.newLocation[Profiler]()
50+
private val (notNullInfosLoc, store8) = store7.newLocation[List[NotNullInfo]]()
51+
private val initialStore = store8
5352

5453
/** The current context */
5554
def curCtx(given ctx: Context): Context = ctx
@@ -200,9 +199,6 @@ object Contexts {
200199
/** The current settings values */
201200
def settingsState: SettingsState = store(settingsStateLoc)
202201

203-
/** The current fresh name creator */
204-
def freshNames: FreshNameCreator = store(freshNamesLoc)
205-
206202
/** The current compilation unit */
207203
def compilationUnit: CompilationUnit = store(compilationUnitLoc)
208204

@@ -474,6 +470,8 @@ object Contexts {
474470
if (prev != null) prev
475471
else {
476472
val newCtx = fresh.setSource(source)
473+
if (newCtx.compilationUnit == null)
474+
newCtx.setCompilationUnit(CompilationUnit(source))
477475
sourceCtx = sourceCtx.updated(source, newCtx)
478476
newCtx
479477
}
@@ -566,7 +564,6 @@ object Contexts {
566564
def setSettings(settingsState: SettingsState): this.type = updateStore(settingsStateLoc, settingsState)
567565
def setRun(run: Run): this.type = updateStore(runLoc, run)
568566
def setProfiler(profiler: Profiler): this.type = updateStore(profilerLoc, profiler)
569-
def setFreshNames(freshNames: FreshNameCreator): this.type = updateStore(freshNamesLoc, freshNames)
570567
def setNotNullInfos(notNullInfos: List[NotNullInfo]): this.type = updateStore(notNullInfosLoc, notNullInfos)
571568

572569
def setProperty[T](key: Key[T], value: T): this.type =

compiler/src/dotty/tools/dotc/core/NameKinds.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ object NameKinds {
215215

216216
/** Generate fresh unique term name of this kind with given prefix name */
217217
def fresh(prefix: TermName = EmptyTermName)(implicit ctx: Context): TermName =
218-
ctx.freshNames.newName(prefix, this)
218+
ctx.compilationUnit.freshNames.newName(prefix, this)
219219

220220
/** Generate fresh unique type name of this kind with given prefix name */
221221
def fresh(prefix: TypeName)(implicit ctx: Context): TypeName =

0 commit comments

Comments
 (0)