Skip to content

Commit 7b67153

Browse files
author
Sara Alemanno
committed
Merge remote-tracking branch 'upstream/master' into part1
2 parents a9c8fe3 + 9ca016e commit 7b67153

File tree

549 files changed

+12304
-14042
lines changed

Some content is hidden

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

549 files changed

+12304
-14042
lines changed

.drone.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pipeline:
3131
image: lampepfl/dotty:2019-04-22
3232
commands:
3333
- cp -R . /tmp/2/ && cd /tmp/2/
34-
- ./project/scripts/sbt ";dotty-bootstrapped/compile ;dotty-bootstrapped/test; dotty-semanticdb/compile; dotty-semanticdb/test:compile;sjsSandbox/run;sjsSandbox/test"
34+
- ./project/scripts/sbt ";dotty-bootstrapped/compile ;dotty-bootstrapped/test; dotty-semanticdb/compile; dotty-semanticdb/test:compile;sjsSandbox/run;sjsSandbox/test;sjsJUnitTests/test"
3535
- ./project/scripts/bootstrapCmdTests
3636

3737
community_build:
@@ -58,8 +58,8 @@ pipeline:
5858
commands:
5959
- cp -R . /tmp/5/ && cd /tmp/5/
6060
- ./project/scripts/sbt ";++2.12.8 ;compile ;test"
61-
when:
62-
event: [ push, tag, deployment ]
61+
# when:
62+
# event: [ push, tag, deployment ]
6363

6464
test_java11:
6565
group: test

.gitmodules

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,10 @@
3737
[submodule "community-build/community-projects/sourcecode"]
3838
path = community-build/community-projects/sourcecode
3939
url = https://github.com/dotty-staging/sourcecode
40+
[submodule "community-build/community-projects/scala-xml"]
41+
path = community-build/community-projects/scala-xml
42+
url = https://github.com/scala/scala-xml
43+
[submodule "community-build/community-projects/shapeless"]
44+
path = community-build/community-projects/shapeless
45+
url = https://github.com/milessabin/shapeless
46+
branch = shapeless-3

build.sbt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ val `dotty-compiler` = Build.`dotty-compiler`
77
val `dotty-compiler-bootstrapped` = Build.`dotty-compiler-bootstrapped`
88
val `dotty-library` = Build.`dotty-library`
99
val `dotty-library-bootstrapped` = Build.`dotty-library-bootstrapped`
10+
val `dotty-library-bootstrappedJS` = Build.`dotty-library-bootstrappedJS`
1011
val `dotty-sbt-bridge` = Build.`dotty-sbt-bridge`
1112
val `dotty-sbt-bridge-tests` = Build.`dotty-sbt-bridge-tests`
1213
val `dotty-language-server` = Build.`dotty-language-server`
@@ -23,6 +24,7 @@ val `dist-bootstrapped` = Build.`dist-bootstrapped`
2324
val `community-build` = Build.`community-build`
2425

2526
val sjsSandbox = Build.sjsSandbox
27+
val sjsJUnitTests = Build.sjsJUnitTests
2628

2729
val `sbt-dotty` = Build.`sbt-dotty`
2830
val `vscode-dotty` = Build.`vscode-dotty`
Submodule scala-xml added at 19f53ad
Submodule shapeless added at 45c8229

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@ class CommunityBuildTest {
109109
updateCommand = "scalatest/update"
110110
)
111111

112+
@Test def scalaXml = test(
113+
project = "scala-xml",
114+
testCommand = "xml/test",
115+
updateCommand = "xml/update"
116+
)
117+
112118
@Test def scopt = test(
113119
project = "scopt",
114120
testCommand = "scoptJVM/compile",
@@ -165,6 +171,12 @@ class CommunityBuildTest {
165171
extraSbtArgs = Seq("-Dscala.build.compileWithDotty=true")
166172
)
167173

174+
@Test def shapeless = test(
175+
project = "shapeless",
176+
testCommand = "test",
177+
updateCommand = "update"
178+
)
179+
168180
// TODO @oderky? It got broken by #5458
169181
// @Test def pdbp = test(
170182
// project = "pdbp",

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package backend
33
package jvm
44

55
import scala.tools.asm
6+
import scala.annotation.threadUnsafe
67

78
/**
89
* This class mainly contains the method classBTypeFromSymbol, which extracts the necessary
@@ -30,14 +31,14 @@ class BTypesFromSymbols[I <: BackendInterface](val int: I) extends BTypes {
3031
coreBTypes.setBTypes(new CoreBTypes[this.type](this))
3132
}
3233

33-
protected lazy val classBTypeFromInternalNameMap = {
34+
@threadUnsafe protected lazy val classBTypeFromInternalNameMap = {
3435
perRunCaches.recordCache(collection.concurrent.TrieMap.empty[String, ClassBType])
3536
}
3637

3738
/**
3839
* Cache for the method classBTypeFromSymbol.
3940
*/
40-
private lazy val convertedClasses = perRunCaches.newMap[Symbol, ClassBType]()
41+
@threadUnsafe private lazy val convertedClasses = perRunCaches.newMap[Symbol, ClassBType]()
4142

4243
/**
4344
* The ClassBType for a class symbol `sym`.
@@ -222,7 +223,8 @@ class BTypesFromSymbols[I <: BackendInterface](val int: I) extends BTypes {
222223
if (sym.hasEnumFlag) ACC_ENUM else 0,
223224
if (sym.isVarargsMethod) ACC_VARARGS else 0,
224225
if (sym.isSynchronized) ACC_SYNCHRONIZED else 0,
225-
if (sym.isDeprecated) asm.Opcodes.ACC_DEPRECATED else 0
226+
if (sym.isDeprecated) asm.Opcodes.ACC_DEPRECATED else 0,
227+
if (sym.isEnum) asm.Opcodes.ACC_ENUM else 0
226228
)
227229
}
228230

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import dotty.tools.io.AbstractFile
88
import scala.language.implicitConversions
99
import scala.tools.asm
1010

11-
1211
/* Interface to abstract over frontend inside backend.
1312
* Intended to be implemented by both scalac and dotc
1413
*/
@@ -513,6 +512,7 @@ abstract class BackendInterface extends BackendInterfaceDefinitions {
513512
def isJavaDefaultMethod: Boolean
514513
def isClassConstructor: Boolean
515514
def isSerializable: Boolean
515+
def isEnum: Boolean
516516

517517
/**
518518
* True for module classes of modules that are top-level or owned only by objects. Module classes

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import dotty.tools.dotc.transform.{Erasure, GenericSignatures}
88
import dotty.tools.dotc.transform.SymUtils._
99
import java.io.{File => _}
1010

11+
import scala.annotation.threadUnsafe
1112
import scala.collection.generic.Clearable
1213
import scala.collection.mutable
1314
import scala.reflect.ClassTag
@@ -104,8 +105,8 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
104105
val nme_EQEQ_LOCAL_VAR: Name = StdNames.nme.EQEQ_LOCAL_VAR
105106

106107
// require LambdaMetafactory: scalac uses getClassIfDefined, but we need those always.
107-
override lazy val LambdaMetaFactory: ClassSymbol = ctx.requiredClass("java.lang.invoke.LambdaMetafactory")
108-
override lazy val MethodHandle: ClassSymbol = ctx.requiredClass("java.lang.invoke.MethodHandle")
108+
@threadUnsafe override lazy val LambdaMetaFactory: ClassSymbol = ctx.requiredClass("java.lang.invoke.LambdaMetafactory")
109+
@threadUnsafe override lazy val MethodHandle: ClassSymbol = ctx.requiredClass("java.lang.invoke.MethodHandle")
109110

110111
val nme_valueOf: Name = StdNames.nme.valueOf
111112
val nme_apply: TermName = StdNames.nme.apply
@@ -145,13 +146,13 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
145146
val PartialFunctionClass: Symbol = defn.PartialFunctionClass
146147
val AbstractPartialFunctionClass: Symbol = defn.AbstractPartialFunctionClass
147148
val String_valueOf: Symbol = defn.String_valueOf_Object
148-
lazy val Predef_classOf: Symbol = defn.ScalaPredefModule.requiredMethod(nme.classOf)
149+
@threadUnsafe lazy val Predef_classOf: Symbol = defn.ScalaPredefModule.requiredMethod(nme.classOf)
149150

150-
lazy val AnnotationRetentionAttr: ClassSymbol = ctx.requiredClass("java.lang.annotation.Retention")
151-
lazy val AnnotationRetentionSourceAttr: TermSymbol = ctx.requiredClass("java.lang.annotation.RetentionPolicy").linkedClass.requiredValue("SOURCE")
152-
lazy val AnnotationRetentionClassAttr: TermSymbol = ctx.requiredClass("java.lang.annotation.RetentionPolicy").linkedClass.requiredValue("CLASS")
153-
lazy val AnnotationRetentionRuntimeAttr: TermSymbol = ctx.requiredClass("java.lang.annotation.RetentionPolicy").linkedClass.requiredValue("RUNTIME")
154-
lazy val JavaAnnotationClass: ClassSymbol = ctx.requiredClass("java.lang.annotation.Annotation")
151+
@threadUnsafe lazy val AnnotationRetentionAttr: ClassSymbol = ctx.requiredClass("java.lang.annotation.Retention")
152+
@threadUnsafe lazy val AnnotationRetentionSourceAttr: TermSymbol = ctx.requiredClass("java.lang.annotation.RetentionPolicy").linkedClass.requiredValue("SOURCE")
153+
@threadUnsafe lazy val AnnotationRetentionClassAttr: TermSymbol = ctx.requiredClass("java.lang.annotation.RetentionPolicy").linkedClass.requiredValue("CLASS")
154+
@threadUnsafe lazy val AnnotationRetentionRuntimeAttr: TermSymbol = ctx.requiredClass("java.lang.annotation.RetentionPolicy").linkedClass.requiredValue("RUNTIME")
155+
@threadUnsafe lazy val JavaAnnotationClass: ClassSymbol = ctx.requiredClass("java.lang.annotation.Annotation")
155156

156157
def boxMethods: Map[Symbol, Symbol] = defn.ScalaValueClasses().map{x => // @darkdimius Are you sure this should be a def?
157158
(x, Erasure.Boxing.boxMethod(x.asClass))
@@ -702,6 +703,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
702703
def shouldEmitForwarders: Boolean =
703704
(sym is Flags.Module) && sym.isStatic
704705
def isJavaEntryPoint: Boolean = CollectEntryPoints.isJavaEntryPoint(sym)
706+
def isEnum = sym.is(Flags.Enum)
705707

706708
def isClassConstructor: Boolean = toDenot(sym).isClassConstructor
707709
def isSerializable: Boolean = toDenot(sym).isSerializable

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import Names.TermName, StdNames._
1414
import Types.{JavaArrayType, UnspecifiedErrorType, Type}
1515
import Symbols.{Symbol, NoSymbol}
1616

17+
import scala.annotation.threadUnsafe
1718
import scala.collection.immutable
1819

1920

@@ -37,7 +38,7 @@ import scala.collection.immutable
3738
class DottyPrimitives(ctx: Context) {
3839
import dotty.tools.backend.ScalaPrimitivesOps._
3940

40-
private lazy val primitives: immutable.Map[Symbol, Int] = init
41+
@threadUnsafe private lazy val primitives: immutable.Map[Symbol, Int] = init
4142

4243
/** Return the code for the given symbol. */
4344
def getPrimitive(sym: Symbol): Int = {

0 commit comments

Comments
 (0)