Skip to content

Commit 38e87b0

Browse files
authored
Merge pull request #7019 from dotty-staging/upgrade/scalac-2.13
Switch to the 2.13 standard library
2 parents a6b56a1 + 37fab22 commit 38e87b0

File tree

1,220 files changed

+2107
-83813
lines changed

Some content is hidden

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

1,220 files changed

+2107
-83813
lines changed

.drone.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ steps:
2727

2828
- name: test
2929
pull: default
30-
image: lampepfl/dotty:2019-04-22
30+
image: lampepfl/dotty:2019-08-22
3131
depends_on: [ clone ]
3232
commands:
3333
- cp -R . /tmp/1/ && cd /tmp/1/
@@ -36,7 +36,7 @@ steps:
3636

3737
- name: test_bootstrapped
3838
pull: default
39-
image: lampepfl/dotty:2019-04-22
39+
image: lampepfl/dotty:2019-08-22
4040
depends_on: [ clone ]
4141
commands:
4242
- cp -R . /tmp/2/ && cd /tmp/2/
@@ -45,7 +45,7 @@ steps:
4545

4646
- name: community_build
4747
pull: default
48-
image: lampepfl/dotty:2019-04-22
48+
image: lampepfl/dotty:2019-08-22
4949
depends_on: [ clone ]
5050
commands:
5151
- cp -R . /tmp/3/ && cd /tmp/3/
@@ -54,7 +54,7 @@ steps:
5454

5555
- name: test_sbt
5656
pull: default
57-
image: lampepfl/dotty:2019-04-22
57+
image: lampepfl/dotty:2019-08-22
5858
depends_on: [ clone ]
5959
commands:
6060
- cp -R . /tmp/4/ && cd /tmp/4/
@@ -66,7 +66,7 @@ steps:
6666

6767
- name: test_java11
6868
pull: default
69-
image: lampepfl/dotty:2019-04-22
69+
image: lampepfl/dotty:2019-08-22
7070
depends_on: [ clone ]
7171
commands:
7272
- export PATH="/usr/lib/jvm/java-11-openjdk-amd64/bin:$PATH"
@@ -80,7 +80,7 @@ steps:
8080

8181
- name: documentation
8282
pull: default
83-
image: lampepfl/dotty:2019-04-22
83+
image: lampepfl/dotty:2019-08-22
8484
depends_on:
8585
- test
8686
- test_bootstrapped
@@ -99,7 +99,7 @@ steps:
9999

100100
- name: publish_nightly
101101
pull: default
102-
image: lampepfl/dotty:2019-04-22
102+
image: lampepfl/dotty:2019-08-22
103103
depends_on:
104104
- test
105105
- test_bootstrapped
@@ -126,7 +126,7 @@ steps:
126126

127127
- name: publish_release
128128
pull: default
129-
image: lampepfl/dotty:2019-04-22
129+
image: lampepfl/dotty:2019-08-22
130130
depends_on:
131131
- test
132132
- test_bootstrapped
@@ -169,7 +169,7 @@ steps:
169169

170170
- name: publish_sbt_release
171171
pull: default
172-
image: lampepfl/dotty:2019-04-22
172+
image: lampepfl/dotty:2019-08-22
173173
depends_on:
174174
- test
175175
- test_bootstrapped

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
url = https://github.com/dotty-staging/sourcecode
4040
[submodule "community-build/community-projects/scala-xml"]
4141
path = community-build/community-projects/scala-xml
42-
url = https://github.com/scala/scala-xml
42+
url = https://github.com/dotty-staging/scala-xml
4343
[submodule "community-build/community-projects/shapeless"]
4444
path = community-build/community-projects/shapeless
4545
url = https://github.com/milessabin/shapeless

bench/src/main/scala/Benchmarks.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import org.openjdk.jmh.results.format._
1313
import java.util.concurrent.TimeUnit
1414

1515
import java.io.{File, FileOutputStream, BufferedWriter, FileWriter}
16-
import scala.collection.JavaConversions._
16+
import scala.collection.JavaConverters._
1717
import scala.io.Source
1818

1919
object Bench {
@@ -86,7 +86,7 @@ class CompilerOptions {
8686

8787
@Setup
8888
def prepare: Unit = {
89-
opts = Bench.readCompileOptions.to[Array]
89+
opts = Bench.readCompileOptions.toArray
9090
}
9191
}
9292

Submodule ScalaPB updated 382 files
Submodule algebra updated 34 files
Submodule fastparse updated 211 files
Submodule minitest updated 37 files
Submodule scalacheck updated 51 files
Submodule scalap updated 6825 files
Submodule scopt updated 40 files

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

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import org.junit.experimental.categories.Category
99

1010
@Category(Array(classOf[TestCategory]))
1111
class CommunityBuildTest {
12-
lazy val communitybuildDir: Path = Paths.get(sys.props("user.dir") + "/community-build/")
12+
lazy val communitybuildDir: Path = Paths.get(sys.props("user.dir"))
1313

1414
lazy val compilerVersion: String = {
1515
val file = communitybuildDir.resolve("dotty-bootstrapped.version")
@@ -153,15 +153,15 @@ class CommunityBuildTest {
153153

154154
@Test def fastparse = test(
155155
project = "fastparse",
156-
testCommand = "fastparseJVM/compile",
157-
updateCommand = "fastparseJVM/update"
156+
testCommand = "dotty-community-build/compile;dotty-community-build/test:compile",
157+
updateCommand = "dotty-community-build/update"
158158
)
159159

160160
// TODO: revert to sourcecodeJVM/test
161161
@Test def sourcecode = test(
162162
project = "sourcecode",
163-
testCommand = "sourcecodeJVM/compile",
164-
updateCommand = "sourcecodeJVM/update"
163+
testCommand = "sourcecode/compile;sourcecode/test:compile",
164+
updateCommand = "sourcecode/update"
165165
)
166166

167167
@Test def stdLib213 = test(
@@ -194,8 +194,16 @@ class CommunityBuildTest {
194194
// We set `useEffpiPlugin := false` because we don't want to run their
195195
// compiler plugin since it relies on external binaries (from the model
196196
// checker mcrl2), however we do compile the compiler plugin.
197-
testCommand = ";set ThisBuild / useEffpiPlugin := false; effpi/test:compile; plugin/test:compile; benchmarks/test:compile; examples/test:compile; pluginBenchmarks/test:compile",
198-
updateCommand = ";set ThisBuild / useEffpiPlugin := false; effpi/test:update; plugin/test:update; benchmarks/test:update; examples/test:update; pluginBenchmarks/test:update"
197+
198+
// We have to drop the plugin and some akka tests for now, the plugin depends on github.com/bmc/scalasti which
199+
// has not been updated since 2018, so no 2.13 compat. Some akka tests are dropped due to MutableBehaviour being
200+
// dropped in the 2.13 compatible release
201+
202+
// testCommand = ";set ThisBuild / useEffpiPlugin := false; effpi/test:compile; plugin/test:compile; benchmarks/test:compile; examples/test:compile; pluginBenchmarks/test:compile",
203+
// updateCommand = ";set ThisBuild / useEffpiPlugin := false; effpi/test:update; plugin/test:update; benchmarks/test:update; examples/test:update; pluginBenchmarks/test:update"
204+
205+
testCommand = ";set ThisBuild / useEffpiPlugin := false; effpi/test:compile; benchmarks/test:compile; examples/test:compile; pluginBenchmarks/test:compile",
206+
updateCommand = ";set ThisBuild / useEffpiPlugin := false; effpi/test:update; benchmarks/test:update; examples/test:update; pluginBenchmarks/test:update"
199207
)
200208

201209
// TODO @oderky? It got broken by #5458
File renamed without changes.
File renamed without changes.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ trait BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
387387
}
388388
debuglog(s"Potentially conflicting names for forwarders: $conflictingNames")
389389

390-
for (m0 <- moduleClass.info.membersBasedOnFlags(ExcludedForwarderFlags, Flag_METHOD)) {
390+
for (m0 <- moduleClass.info.sortedMembersBasedOnFlags(required = Flag_METHOD, excluded = ExcludedForwarderFlags)) {
391391
val m = if (m0.isBridge) m0.nextOverriddenSymbol else m0
392392
if (m == NoSymbol)
393393
log(s"$m0 is a bridge method that overrides nothing, something went wrong in a previous phase.")

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,11 @@ abstract class BackendInterface extends BackendInterfaceDefinitions {
602602
def params: List[Symbol]
603603
def resultType: Type
604604
def memberInfo(s: Symbol): Type
605-
def membersBasedOnFlags(excludedFlags: Flags, requiredFlags: Flags): List[Symbol]
605+
606+
/** The members of this type that have all of `required` flags but none of `excluded` flags set.
607+
* The members are sorted by name and signature to guarantee a stable ordering.
608+
*/
609+
def sortedMembersBasedOnFlags(required: Flags, excluded: Flags): List[Symbol]
606610
def members: List[Symbol]
607611
def decls: List[Symbol]
608612
def underlying: Type

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

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,6 @@ class CoreBTypes[BTFS <: BTypesFromSymbols[_ <: BackendInterface]](val bTypes: B
131131
lazy val srFloatRef : ClassBType = classBTypeFromSymbol(requiredClass[scala.runtime.FloatRef])
132132
lazy val srDoubleRef : ClassBType = classBTypeFromSymbol(requiredClass[scala.runtime.DoubleRef])
133133

134-
// scala.FunctionX and scala.runtim.AbstractFunctionX
135-
lazy val FunctionReference : Vector[ClassBType] = (0 to MaxFunctionArity).map(i => classBTypeFromSymbol(FunctionClass(i)))(collection.breakOut)
136-
lazy val AbstractFunctionReference : Vector[ClassBType] = (0 to MaxFunctionArity).map(i => classBTypeFromSymbol(AbstractFunctionClass(i)))(collection.breakOut)
137-
lazy val AbstractFunctionArityMap : Map[ClassBType, Int] = AbstractFunctionReference.zipWithIndex.toMap
138-
139-
lazy val PartialFunctionReference : ClassBType = classBTypeFromSymbol(PartialFunctionClass)
140-
lazy val AbstractPartialFunctionReference : ClassBType = classBTypeFromSymbol(AbstractPartialFunctionClass)
141-
142134
lazy val BoxesRunTime: ClassBType = classBTypeFromSymbol(requiredClass[scala.runtime.BoxesRunTime])
143135

144136
/**
@@ -263,13 +255,6 @@ final class CoreBTypesProxy[BTFS <: BTypesFromSymbols[_ <: BackendInterface]](va
263255
def srFloatRef : ClassBType = _coreBTypes.srFloatRef
264256
def srDoubleRef : ClassBType = _coreBTypes.srDoubleRef
265257

266-
def FunctionReference : Vector[ClassBType] = _coreBTypes.FunctionReference
267-
def AbstractFunctionReference : Vector[ClassBType] = _coreBTypes.AbstractFunctionReference
268-
def AbstractFunctionArityMap : Map[ClassBType, Int] = _coreBTypes.AbstractFunctionArityMap
269-
270-
def PartialFunctionReference : ClassBType = _coreBTypes.PartialFunctionReference
271-
def AbstractPartialFunctionReference : ClassBType = _coreBTypes.AbstractPartialFunctionReference
272-
273258
def BoxesRunTime: ClassBType = _coreBTypes.BoxesRunTime
274259

275260
def asmBoxTo : Map[BType, MethodNameAndType] = _coreBTypes.asmBoxTo

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -878,8 +878,18 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
878878

879879
def =:=(other: Type): Boolean = tp =:= other
880880

881-
def membersBasedOnFlags(excludedFlags: Flags, requiredFlags: Flags): List[Symbol] =
882-
tp.membersBasedOnFlags(termFlagSet(requiredFlags), termFlagSet(excludedFlags)).map(_.symbol).toList
881+
def sortedMembersBasedOnFlags(required: Flags, excluded: Flags): List[Symbol] = {
882+
val requiredFlagSet = termFlagSet(required)
883+
val excludedFlagSet = termFlagSet(excluded)
884+
// The output of `memberNames` is a Set, sort it to guarantee a stable ordering.
885+
val names = tp.memberNames(takeAllFilter).toSeq.sorted
886+
val buffer = mutable.ListBuffer[Symbol]()
887+
names.foreach { name =>
888+
buffer ++= tp.memberBasedOnFlags(name, requiredFlagSet, excludedFlagSet)
889+
.alternatives.sortBy(_.signature)(Signature.lexicographicOrdering).map(_.symbol)
890+
}
891+
buffer.toList
892+
}
883893

884894
def resultType: Type = tp.resultType
885895

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,11 +394,11 @@ class GenBCodePipeline(val entryPoints: List[Symbol], val int: DottyBackendInter
394394
}
395395
for ((label, i) <- initialLabels.iterator.zipWithIndex) {
396396
mv.visitLabel(label)
397-
emitLambdaDeserializeIndy(groups(i))
397+
emitLambdaDeserializeIndy(groups(i).toIndexedSeq)
398398
mv.visitInsn(ARETURN)
399399
}
400400
mv.visitLabel(terminalLabel)
401-
emitLambdaDeserializeIndy(groups(numGroups - 1))
401+
emitLambdaDeserializeIndy(groups(numGroups - 1).toIndexedSeq)
402402
mv.visitInsn(ARETURN)
403403
}
404404

compiler/src/dotty/tools/backend/sjs/JSCodeGen.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ class JSCodeGen()(implicit ctx: Context) {
194194
ctx.settings.outputDir.value
195195

196196
val pathParts = sym.fullName.toString.split("[./]")
197-
val dir = (outputDirectory /: pathParts.init)(_.subdirectoryNamed(_))
197+
val dir = pathParts.init.foldLeft(outputDirectory)(_.subdirectoryNamed(_))
198198

199199
var filename = pathParts.last
200200
if (sym.is(ModuleClass))

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ object Bench extends Driver {
1515
@sharable private[this] var numRuns = 1
1616

1717
private def ntimes(n: Int)(op: => Reporter): Reporter =
18-
(emptyReporter /: (0 until n)) ((_, _) => op)
18+
(0 until n).foldLeft(emptyReporter)((_, _) => op)
1919

2020
override def doCompile(compiler: Compiler, fileNames: List[String])(implicit ctx: Context): Reporter =
2121
ntimes(numRuns) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ class Driver {
7474
val (classPaths, classNames) = fileNames0.flatMap { name =>
7575
val path = Paths.get(name)
7676
if (name.endsWith(".jar")) {
77-
new dotty.tools.io.Jar(File(name)).iterator.collect {
77+
new dotty.tools.io.Jar(File(name)).toList.collect {
7878
case e if e.getName.endsWith(".tasty") =>
7979
(name, e.getName.stripSuffix(".tasty").replace("/", "."))
80-
}.toList
80+
}
8181
}
8282
else if (!name.endsWith(".tasty"))
8383
("", name) :: Nil

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint
5656
ctx.initialize()(start) // re-initialize the base context with start
5757
def addImport(ctx: Context, refFn: () => TermRef) =
5858
ctx.fresh.setImportInfo(ImportInfo.rootImport(refFn)(ctx))
59-
(start.setRun(this) /: defn.RootImportFns)(addImport)
59+
defn.RootImportFns.foldLeft(start.setRun(this))(addImport)
6060
}
6161

6262
private[this] var compiling = false

compiler/src/dotty/tools/dotc/ast/CheckTrees.scala.disabled

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ object CheckTrees {
6464
check(arg.tpe <:< formal)
6565
}
6666
val MethodType(paramNames, paramTypes) = fn.tpe.widen // checked already at construction
67-
(args, paramNames, paramTypes).zipped foreach checkArg
67+
args.lazyZip(paramNames).lazyZip(paramTypes) foreach checkArg
6868
case TypeApply(fn, args) =>
6969
val pt @ PolyType(_) = fn.tpe.widen // checked already at construction
70-
(args, pt.instantiateBounds(args map (_.tpe))).zipped foreach checkTypeArg
70+
args.lazyZip(pt.instantiateBounds(args map (_.tpe))) foreach checkTypeArg
7171
case Literal(const: Constant) =>
7272
case New(tpt) =>
7373
check(tpt.isValueType)
@@ -184,7 +184,7 @@ object CheckTrees {
184184
check(tpt.isValueType)
185185
val tparams = tpt.tpe.typeParams
186186
check(sameLength(tparams, args))
187-
(args, tparams map (_.info.bounds)).zipped foreach checkTypeArg
187+
args.lazyZip(tparams map (_.info.bounds)) foreach checkTypeArg
188188
case TypeBoundsTree(lo, hi) =>
189189
check(lo.isValueType); check(hi.isValueType)
190190
check(lo.tpe <:< hi.tpe)

0 commit comments

Comments
 (0)