aboutsummaryrefslogtreecommitdiff
path: root/src/dotty
diff options
context:
space:
mode:
Diffstat (limited to 'src/dotty')
-rw-r--r--src/dotty/Pair.scala5
-rw-r--r--src/dotty/Singleton.scala5
-rw-r--r--src/dotty/annotation/internal/Alias.scala10
-rw-r--r--src/dotty/annotation/internal/AnnotationDefault.scala8
-rw-r--r--src/dotty/annotation/internal/Body.scala8
-rw-r--r--src/dotty/annotation/internal/Child.scala16
-rw-r--r--src/dotty/annotation/internal/InlineParam.scala6
-rw-r--r--src/dotty/annotation/internal/Repeated.scala10
-rw-r--r--src/dotty/annotation/internal/SourceFile.scala10
-rw-r--r--src/dotty/annotation/internal/UnsafeNonvariant.scala8
-rw-r--r--src/dotty/tools/dotc/core/Definitions.scala39
11 files changed, 26 insertions, 99 deletions
diff --git a/src/dotty/Pair.scala b/src/dotty/Pair.scala
deleted file mode 100644
index 2322fe169..000000000
--- a/src/dotty/Pair.scala
+++ /dev/null
@@ -1,5 +0,0 @@
-package dotty
-
-class Pair[T, U](x: T, y: U) {
-
-}
diff --git a/src/dotty/Singleton.scala b/src/dotty/Singleton.scala
deleted file mode 100644
index 4ba57a12d..000000000
--- a/src/dotty/Singleton.scala
+++ /dev/null
@@ -1,5 +0,0 @@
-package dotty
-
-class Singleton {
-
-}
diff --git a/src/dotty/annotation/internal/Alias.scala b/src/dotty/annotation/internal/Alias.scala
deleted file mode 100644
index 8be83960f..000000000
--- a/src/dotty/annotation/internal/Alias.scala
+++ /dev/null
@@ -1,10 +0,0 @@
-package dotty.annotation.internal
-
-import scala.annotation.Annotation
-
-/** An annotation to record a Scala2 pickled alias.
- * @param aliased A TermRef pointing to the aliased field.
- */
-class Alias(aliased: Any) extends Annotation {
-
-}
diff --git a/src/dotty/annotation/internal/AnnotationDefault.scala b/src/dotty/annotation/internal/AnnotationDefault.scala
deleted file mode 100644
index 7409b2f96..000000000
--- a/src/dotty/annotation/internal/AnnotationDefault.scala
+++ /dev/null
@@ -1,8 +0,0 @@
-package dotty.annotation.internal
-
-import scala.annotation.Annotation
-
-/** An annotation to tag Java annotation default values */
-class AnnotationDefault extends Annotation {
-
-}
diff --git a/src/dotty/annotation/internal/Body.scala b/src/dotty/annotation/internal/Body.scala
deleted file mode 100644
index 7e26b02f2..000000000
--- a/src/dotty/annotation/internal/Body.scala
+++ /dev/null
@@ -1,8 +0,0 @@
-package dotty.annotation.internal
-
-import scala.annotation.Annotation
-
-/** The class associated with a `BodyAnnotation`, which indicates
- * an inline method's right hand side
- */
-final class Body() extends Annotation
diff --git a/src/dotty/annotation/internal/Child.scala b/src/dotty/annotation/internal/Child.scala
deleted file mode 100644
index 9295de73e..000000000
--- a/src/dotty/annotation/internal/Child.scala
+++ /dev/null
@@ -1,16 +0,0 @@
-package dotty.annotation.internal
-
-import scala.annotation.Annotation
-
-/** An annotation to indicate a child class or object of the annotated class.
- * E.g. if we have
- *
- * sealed class A
- * case class B() extends A
- * case class C() extends A
- *
- * Then the class symbol `A` would carry the annotations
- * `@Child[Bref] @Child[Cref]` where `Bref`, `Cref` are TypeRefs
- * referring to the class symbols of `B` and `C`
- */
-class Child[T] extends Annotation
diff --git a/src/dotty/annotation/internal/InlineParam.scala b/src/dotty/annotation/internal/InlineParam.scala
deleted file mode 100644
index a144f9edb..000000000
--- a/src/dotty/annotation/internal/InlineParam.scala
+++ /dev/null
@@ -1,6 +0,0 @@
-package dotty.annotation.internal
-
-import scala.annotation.Annotation
-
-/** An annotation produced by Namer to indicate an inline parameter */
-final class InlineParam() extends Annotation
diff --git a/src/dotty/annotation/internal/Repeated.scala b/src/dotty/annotation/internal/Repeated.scala
deleted file mode 100644
index 24adc051f..000000000
--- a/src/dotty/annotation/internal/Repeated.scala
+++ /dev/null
@@ -1,10 +0,0 @@
-package dotty.annotation.internal
-
-import scala.annotation.Annotation
-
-/** An annotation produced by desugaring to indicate that a
- * sequence is a repeated parameter. I.e.
- *
- * T* is expanded by Desugar to Seq[T] @Repeated
- */
-final class Repeated() extends Annotation
diff --git a/src/dotty/annotation/internal/SourceFile.scala b/src/dotty/annotation/internal/SourceFile.scala
deleted file mode 100644
index c49fc2c8d..000000000
--- a/src/dotty/annotation/internal/SourceFile.scala
+++ /dev/null
@@ -1,10 +0,0 @@
-package dotty.annotation.internal
-
-import scala.annotation.Annotation
-
-/** An annotation to record a Scala2 pickled alias.
- * @param aliased A TermRef pointing to the aliased field.
- */
-class SourceFile(path: String) extends Annotation {
-
-}
diff --git a/src/dotty/annotation/internal/UnsafeNonvariant.scala b/src/dotty/annotation/internal/UnsafeNonvariant.scala
deleted file mode 100644
index 43a0a114b..000000000
--- a/src/dotty/annotation/internal/UnsafeNonvariant.scala
+++ /dev/null
@@ -1,8 +0,0 @@
-package dotty.annotation.internal
-
-import scala.annotation.Annotation
-
-/** This annotation is used as a marker for unsafe
- * instantiations in asSeenFrom. See TypeOps.asSeenfrom for an explanation.
- */
-class UnsafeNonvariant extends Annotation
diff --git a/src/dotty/tools/dotc/core/Definitions.scala b/src/dotty/tools/dotc/core/Definitions.scala
index 50746c61d..541d66306 100644
--- a/src/dotty/tools/dotc/core/Definitions.scala
+++ b/src/dotty/tools/dotc/core/Definitions.scala
@@ -140,6 +140,16 @@ class Definitions {
lazy val Sys_errorR = SysPackage.moduleClass.requiredMethodRef(nme.error)
def Sys_error(implicit ctx: Context) = Sys_errorR.symbol
+ /** The `scalaShadowing` package is used to safely modify classes and
+ * objects in scala so that they can be used from dotty. They will
+ * be visible as members of the `scala` package, replacing any objects
+ * or classes with the same name. But their binary artifacts are
+ * in `scalaShadowing` so they don't clash with the same-named `scala`
+ * members at runtime.
+ */
+ lazy val ScalaShadowingPackageVal = ctx.requiredPackage("scalaShadowing")
+ lazy val ScalaShadowingPackageClass = ScalaShadowingPackageVal.moduleClass.asClass
+
/** Note: We cannot have same named methods defined in Object and Any (and AnyVal, for that matter)
* because after erasure the Any and AnyVal references get remapped to the Object methods
* which would result in a double binding assertion failure.
@@ -410,8 +420,6 @@ class Definitions {
lazy val StringAdd_plusR = StringAddClass.requiredMethodRef(nme.raw.PLUS)
def StringAdd_+(implicit ctx: Context) = StringAdd_plusR.symbol
- lazy val PairType: TypeRef = ctx.requiredClassRef("dotty.Pair")
- def PairClass(implicit ctx: Context) = PairType.symbol.asClass
lazy val PartialFunctionType: TypeRef = ctx.requiredClassRef("scala.PartialFunction")
def PartialFunctionClass(implicit ctx: Context) = PartialFunctionType.symbol.asClass
lazy val AbstractPartialFunctionType: TypeRef = ctx.requiredClassRef("scala.runtime.AbstractPartialFunction")
@@ -450,17 +458,17 @@ class Definitions {
def StaticAnnotationClass(implicit ctx: Context) = StaticAnnotationType.symbol.asClass
// Annotation classes
- lazy val AliasAnnotType = ctx.requiredClassRef("dotty.annotation.internal.Alias")
+ lazy val AliasAnnotType = ctx.requiredClassRef("scala.annotation.internal.Alias")
def AliasAnnot(implicit ctx: Context) = AliasAnnotType.symbol.asClass
- lazy val AnnotationDefaultAnnotType = ctx.requiredClassRef("dotty.annotation.internal.AnnotationDefault")
+ lazy val AnnotationDefaultAnnotType = ctx.requiredClassRef("scala.annotation.internal.AnnotationDefault")
def AnnotationDefaultAnnot(implicit ctx: Context) = AnnotationDefaultAnnotType.symbol.asClass
- lazy val BodyAnnotType = ctx.requiredClassRef("dotty.annotation.internal.Body")
+ lazy val BodyAnnotType = ctx.requiredClassRef("scala.annotation.internal.Body")
def BodyAnnot(implicit ctx: Context) = BodyAnnotType.symbol.asClass
- lazy val ChildAnnotType = ctx.requiredClassRef("dotty.annotation.internal.Child")
+ lazy val ChildAnnotType = ctx.requiredClassRef("scala.annotation.internal.Child")
def ChildAnnot(implicit ctx: Context) = ChildAnnotType.symbol.asClass
- lazy val CovariantBetweenAnnotType = ctx.requiredClassRef("dotty.annotation.internal.CovariantBetween")
+ lazy val CovariantBetweenAnnotType = ctx.requiredClassRef("scala.annotation.internal.CovariantBetween")
def CovariantBetweenAnnot(implicit ctx: Context) = CovariantBetweenAnnotType.symbol.asClass
- lazy val ContravariantBetweenAnnotType = ctx.requiredClassRef("dotty.annotation.internal.ContravariantBetween")
+ lazy val ContravariantBetweenAnnotType = ctx.requiredClassRef("scala.annotation.internal.ContravariantBetween")
def ContravariantBetweenAnnot(implicit ctx: Context) = ContravariantBetweenAnnotType.symbol.asClass
lazy val DeprecatedAnnotType = ctx.requiredClassRef("scala.deprecated")
def DeprecatedAnnot(implicit ctx: Context) = DeprecatedAnnotType.symbol.asClass
@@ -468,9 +476,9 @@ class Definitions {
def ImplicitNotFoundAnnot(implicit ctx: Context) = ImplicitNotFoundAnnotType.symbol.asClass
lazy val InlineAnnotType = ctx.requiredClassRef("scala.inline")
def InlineAnnot(implicit ctx: Context) = InlineAnnotType.symbol.asClass
- lazy val InlineParamAnnotType = ctx.requiredClassRef("dotty.annotation.internal.InlineParam")
+ lazy val InlineParamAnnotType = ctx.requiredClassRef("scala.annotation.internal.InlineParam")
def InlineParamAnnot(implicit ctx: Context) = InlineParamAnnotType.symbol.asClass
- lazy val InvariantBetweenAnnotType = ctx.requiredClassRef("dotty.annotation.internal.InvariantBetween")
+ lazy val InvariantBetweenAnnotType = ctx.requiredClassRef("scala.annotation.internal.InvariantBetween")
def InvariantBetweenAnnot(implicit ctx: Context) = InvariantBetweenAnnotType.symbol.asClass
lazy val MigrationAnnotType = ctx.requiredClassRef("scala.annotation.migration")
def MigrationAnnot(implicit ctx: Context) = MigrationAnnotType.symbol.asClass
@@ -478,9 +486,9 @@ class Definitions {
def NativeAnnot(implicit ctx: Context) = NativeAnnotType.symbol.asClass
lazy val RemoteAnnotType = ctx.requiredClassRef("scala.remote")
def RemoteAnnot(implicit ctx: Context) = RemoteAnnotType.symbol.asClass
- lazy val RepeatedAnnotType = ctx.requiredClassRef("dotty.annotation.internal.Repeated")
+ lazy val RepeatedAnnotType = ctx.requiredClassRef("scala.annotation.internal.Repeated")
def RepeatedAnnot(implicit ctx: Context) = RepeatedAnnotType.symbol.asClass
- lazy val SourceFileAnnotType = ctx.requiredClassRef("dotty.annotation.internal.SourceFile")
+ lazy val SourceFileAnnotType = ctx.requiredClassRef("scala.annotation.internal.SourceFile")
def SourceFileAnnot(implicit ctx: Context) = SourceFileAnnotType.symbol.asClass
lazy val ScalaSignatureAnnotType = ctx.requiredClassRef("scala.reflect.ScalaSignature")
def ScalaSignatureAnnot(implicit ctx: Context) = ScalaSignatureAnnotType.symbol.asClass
@@ -510,7 +518,7 @@ class Definitions {
def UncheckedStableAnnot(implicit ctx: Context) = UncheckedStableAnnotType.symbol.asClass
lazy val UncheckedVarianceAnnotType = ctx.requiredClassRef("scala.annotation.unchecked.uncheckedVariance")
def UncheckedVarianceAnnot(implicit ctx: Context) = UncheckedVarianceAnnotType.symbol.asClass
- lazy val UnsafeNonvariantAnnotType = ctx.requiredClassRef("dotty.annotation.internal.UnsafeNonvariant")
+ lazy val UnsafeNonvariantAnnotType = ctx.requiredClassRef("scala.annotation.internal.UnsafeNonvariant")
def UnsafeNonvariantAnnot(implicit ctx: Context) = UnsafeNonvariantAnnotType.symbol.asClass
lazy val VolatileAnnotType = ctx.requiredClassRef("scala.volatile")
def VolatileAnnot(implicit ctx: Context) = VolatileAnnotType.symbol.asClass
@@ -781,6 +789,11 @@ class Definitions {
if (!_isInitialized) {
// force initialization of every symbol that is synthesized or hijacked by the compiler
val forced = syntheticCoreClasses ++ syntheticCoreMethods ++ ScalaValueClasses()
+
+ // Enter all symbols from the scalaShadowing package in the scala package
+ for (m <- ScalaShadowingPackageClass.info.decls)
+ ScalaPackageClass.enter(m)
+
_isInitialized = true
}
}