Skip to content

Commit 053d509

Browse files
Merge branch 'master' into ws-optimize-string-interpolation
2 parents 2da90a0 + 08f4679 commit 053d509

File tree

242 files changed

+3711
-855
lines changed

Some content is hidden

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

242 files changed

+3711
-855
lines changed

AUTHORS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,7 @@ The majority of the dotty codebase is new code, with the exception of the compon
7171
> the [compiler bridge in sbt 0.13](https://github.com/sbt/sbt/tree/0.13/compile/interface/src/main/scala/xsbt),
7272
> but has been heavily adapted and refactored.
7373
> Original authors were Mark Harrah, Grzegorz Kossakowski, Martin Duhemm, Adriaan Moors and others.
74+
75+
`dotty.tools.dotc.plugins`
76+
77+
> Adapted from [scala/scala](https://github.com/scala/scala) with some modifications. They were originally authored by Lex Spoon, Som Snytt, Adriaan Moors, Paul Phillips and others.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
972972
case tp =>
973973
ctx.warning(
974974
s"an unexpected type representation reached the compiler backend while compiling $currentUnit: $tp. " +
975-
"If possible, please file a bug on issues.scala-lang.org.")
975+
"If possible, please file a bug on https://github.com/lampepfl/dotty/issues")
976976

977977
tp match {
978978
case tp: ThisType if tp.cls == ArrayClass => ObjectReference.asInstanceOf[ct.bTypes.ClassBType] // was introduced in 9b17332f11 to fix SI-999, but this code is not reached in its test, or any other test

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

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ class GenBCodePipeline(val entryPoints: List[Symbol], val int: DottyBackendInter
159159
*/
160160
class Worker1(needsOutFolder: Boolean) {
161161

162-
val caseInsensitively = scala.collection.mutable.Map.empty[String, Symbol]
162+
val caseInsensitively = scala.collection.mutable.HashMap.empty[String, Symbol]
163163

164164
def run(): Unit = {
165165
while (true) {
@@ -190,18 +190,27 @@ class GenBCodePipeline(val entryPoints: List[Symbol], val int: DottyBackendInter
190190
val claszSymbol = cd.symbol
191191

192192
// GenASM checks this before classfiles are emitted, https://github.com/scala/scala/commit/e4d1d930693ac75d8eb64c2c3c69f2fc22bec739
193-
val lowercaseJavaClassName = claszSymbol.name.toString.toLowerCase
194-
caseInsensitively.get(lowercaseJavaClassName) match {
195-
case None =>
196-
caseInsensitively.put(lowercaseJavaClassName, claszSymbol)
197-
case Some(dupClassSym) =>
198-
// Order is not deterministic so we enforce lexicographic order between the duplicates for error-reporting
199-
if (claszSymbol.name.toString < dupClassSym.name.toString)
200-
ctx.warning(s"Class ${claszSymbol.name} differs only in case from ${dupClassSym.name}. " +
201-
"Such classes will overwrite one another on case-insensitive filesystems.", claszSymbol.pos)
202-
else
203-
ctx.warning(s"Class ${dupClassSym.name} differs only in case from ${claszSymbol.name}. " +
204-
"Such classes will overwrite one another on case-insensitive filesystems.", dupClassSym.pos)
193+
def checkName(claszSymbol: Symbol): Unit = {
194+
val lowercaseJavaClassName = claszSymbol.effectiveName.toString.toLowerCase
195+
caseInsensitively.get(lowercaseJavaClassName) match {
196+
case None =>
197+
caseInsensitively.put(lowercaseJavaClassName, claszSymbol)
198+
case Some(dupClassSym) =>
199+
if (claszSymbol.effectiveName.toString != dupClassSym.effectiveName.toString) {
200+
// Order is not deterministic so we enforce lexicographic order between the duplicates for error-reporting
201+
val (cl1, cl2) =
202+
if (claszSymbol.effectiveName.toString < dupClassSym.effectiveName.toString) (claszSymbol, dupClassSym)
203+
else (dupClassSym, claszSymbol)
204+
ctx.warning(s"Class ${cl1.effectiveName} differs only in case from ${cl2.effectiveName}. " +
205+
"Such classes will overwrite one another on case-insensitive filesystems.", cl1.pos)
206+
}
207+
}
208+
}
209+
checkName(claszSymbol)
210+
if (int.symHelper(claszSymbol).isModuleClass) {
211+
val companionModule = claszSymbol.companionModule
212+
if (int.symHelper(companionModule.owner).isPackageClass)
213+
checkName(companionModule)
205214
}
206215

207216
// -------------- mirror class, if needed --------------

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class Compiler {
6666
new NormalizeFlags, // Rewrite some definition flags
6767
new ExtensionMethods, // Expand methods of value classes with extension methods
6868
new ExpandSAMs, // Expand single abstract method closures to anonymous classes
69+
new ShortcutImplicits, // Allow implicit functions without creating closures
6970
new TailRec, // Rewrite tail recursion to loops
7071
new ByNameClosures, // Expand arguments to by-name parameters to closures
7172
new LiftTry, // Put try expressions that might execute on non-empty stacks into their own methods
@@ -76,11 +77,11 @@ class Compiler {
7677
new PatternMatcher, // Compile pattern matches
7778
new ExplicitOuter, // Add accessors to outer classes from nested ones.
7879
new ExplicitSelf, // Make references to non-trivial self types explicit as casts
79-
new ShortcutImplicits, // Allow implicit functions without creating closures
8080
new StringInterpolatorOpt, // Optimizes raw and s string interpolators by rewriting them to string concatentations
8181
new CrossCastAnd, // Normalize selections involving intersection types.
8282
new Splitter) :: // Expand selections involving union types into conditionals
8383
List(new ErasedDecls, // Removes all erased defs and vals decls (except for parameters)
84+
new IsInstanceOfChecker, // check runtime realisability for `isInstanceOf`
8485
new VCInlineMethods, // Inlines calls to value class methods
8586
new SeqLiterals, // Express vararg arguments as arrays
8687
new InterceptedMethods, // Special handling of `==`, `|=`, `getClass` methods

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint
157157
if (ctx.settings.YtestPickler.value) List("pickler")
158158
else ctx.settings.YstopAfter.value
159159

160-
val phases = ctx.squashPhases(ctx.phasePlan,
160+
val pluginPlan = ctx.addPluginPhases(ctx.phasePlan)
161+
val phases = ctx.squashPhases(pluginPlan,
161162
ctx.settings.Yskip.value, ctx.settings.YstopBefore.value, stopAfter, ctx.settings.Ycheck.value)
162163
ctx.usePhases(phases)
163164

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ object desugar {
5050
*/
5151
class DerivedFromParamTree(suffix: String) extends DerivedTypeTree {
5252

53-
/** Make sure that for all enclosing module classes their companion lasses
53+
/** Make sure that for all enclosing module classes their companion classes
5454
* are completed. Reason: We need the constructor of such companion classes to
5555
* be completed so that OriginalSymbol attachments are pushed to DerivedTypeTrees
5656
* in apply/unapply methods.
@@ -429,7 +429,6 @@ object desugar {
429429
}
430430
val hasRepeatedParam = constrVparamss.exists(_.exists {
431431
case ValDef(_, tpt, _) => isRepeated(tpt)
432-
case _ => false
433432
})
434433
if (mods.is(Abstract) || hasRepeatedParam) Nil // cannot have default arguments for repeated parameters, hence copy method is not issued
435434
else {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ object Trees {
771771
def flatten[T >: Untyped](trees: List[Tree[T]]): List[Tree[T]] = {
772772
var buf: ListBuffer[Tree[T]] = null
773773
var xs = trees
774-
while (xs.nonEmpty) {
774+
while (!xs.isEmpty) {
775775
xs.head match {
776776
case Thicket(elems) =>
777777
if (buf == null) {
@@ -805,7 +805,7 @@ object Trees {
805805
def unforced: AnyRef
806806
protected def force(x: AnyRef): Unit
807807
def forceIfLazy(implicit ctx: Context): T = unforced match {
808-
case lzy: Lazy[T] =>
808+
case lzy: Lazy[T @unchecked] =>
809809
val x = lzy.complete
810810
force(x)
811811
x

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
6060
class NonEmptyFunction(args: List[Tree], body: Tree, val mods: Modifiers) extends Function(args, body)
6161

6262
/** A function created from a wildcard expression
63-
* @param placeHolderParams a list of definitions of synthetic parameters
63+
* @param placeholderParams a list of definitions of synthetic parameters.
6464
* @param body the function body where wildcards are replaced by
6565
* references to synthetic parameters.
6666
*/

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,15 @@ object CompilerCommand extends DotClass {
114114

115115
def shouldStopWithInfo = {
116116
import settings._
117-
Set(help, Xhelp, Yhelp) exists (_.value)
117+
Set(help, Xhelp, Yhelp, showPlugins) exists (_.value)
118118
}
119119

120120
def infoMessage: String = {
121121
import settings._
122122
if (help.value) usageMessage
123123
else if (Xhelp.value) xusageMessage
124124
else if (Yhelp.value) yusageMessage
125+
else if (showPlugins.value) ctx.pluginDescriptions
125126
else ""
126127
}
127128

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ object Printers {
2828
val overload: Printer = noPrinter
2929
val patmatch: Printer = noPrinter
3030
val pickling: Printer = noPrinter
31+
val plugins: Printer = noPrinter
3132
val simplify: Printer = noPrinter
3233
val subtyping: Printer = noPrinter
3334
val transforms: Printer = noPrinter

0 commit comments

Comments
 (0)