diff options
author | Martin Odersky <odersky@gmail.com> | 2013-12-31 19:07:22 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-12-31 19:08:34 +0100 |
commit | e7d8c90b3817871a067f9ea7dd83f4efec83b5a1 (patch) | |
tree | 6a971a282548785cf4e3ce9d2b0cc4a0a29694c4 /src | |
parent | a3fe0c6b63b7c2019c80546f100693b261bb2f34 (diff) | |
download | dotty-e7d8c90b3817871a067f9ea7dd83f4efec83b5a1.tar.gz dotty-e7d8c90b3817871a067f9ea7dd83f4efec83b5a1.tar.bz2 dotty-e7d8c90b3817871a067f9ea7dd83f4efec83b5a1.zip |
Adding dotty.Predef to root imports
We need to have a place where to put (yet to be implemented) classTag/typeTag macros, which will replace the custom search for tags in Scala2x
Diffstat (limited to 'src')
-rw-r--r-- | src/dotty/Predef.scala | 10 | ||||
-rw-r--r-- | src/dotty/tools/dotc/Compiler.scala | 5 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Definitions.scala | 12 |
3 files changed, 16 insertions, 11 deletions
diff --git a/src/dotty/Predef.scala b/src/dotty/Predef.scala new file mode 100644 index 000000000..106b62b1d --- /dev/null +++ b/src/dotty/Predef.scala @@ -0,0 +1,10 @@ +package dotty + +import scala.reflect.ClassTag +import scala.reflect.runtime.universe.TypeTag + +object Predef { + /** implicits for ClassTag and TypeTag. Should be implemented with macros */ + implicit def classTag[T]: ClassTag[T] = ??? + implicit def typeTag[T]: TypeTag[T] = ??? +}
\ No newline at end of file diff --git a/src/dotty/tools/dotc/Compiler.scala b/src/dotty/tools/dotc/Compiler.scala index 9c71bdc96..a4226eec2 100644 --- a/src/dotty/tools/dotc/Compiler.scala +++ b/src/dotty/tools/dotc/Compiler.scala @@ -12,9 +12,6 @@ class Compiler { def phases = List(new FrontEnd) - def rootImports(implicit ctx: Context) = - defn.JavaLangPackageVal :: defn.ScalaPackageVal :: defn.PredefModule :: Nil - def rootContext(implicit ctx: Context): Context = { ctx.definitions.init() ctx.usePhases(phases) @@ -26,7 +23,7 @@ class Compiler { .withTyperState(new MutableTyperState(ctx.typerState, new ConsoleReporter()(ctx), isCommittable = true)) def addImport(ctx: Context, sym: Symbol) = ctx.fresh.withImportInfo(ImportInfo.rootImport(sym)(ctx)) - (start.withRunInfo(new RunInfo(start)) /: rootImports)(addImport) + (start.withRunInfo(new RunInfo(start)) /: defn.RootImports)(addImport) } def newRun(implicit ctx: Context): Run = diff --git a/src/dotty/tools/dotc/core/Definitions.scala b/src/dotty/tools/dotc/core/Definitions.scala index 7a30be9d3..6f6442208 100644 --- a/src/dotty/tools/dotc/core/Definitions.scala +++ b/src/dotty/tools/dotc/core/Definitions.scala @@ -148,7 +148,8 @@ class Definitions(implicit ctx: Context) { lazy val NullClass: ClassSymbol = newCompleteClassSymbol( ScalaPackageClass, tpnme.Null, AbstractFinal, List(ObjectClass.typeRef)) - lazy val PredefModule = requiredModule("scala.Predef") + lazy val ScalaPredefModule = requiredModule("scala.Predef") + lazy val DottyPredefModule = requiredModule("dotty.Predef") lazy val NilModule = requiredModule("scala.collection.immutable.Nil") // lazy val FunctionClass: ClassSymbol = requiredClass("scala.Function") @@ -300,18 +301,15 @@ class Definitions(implicit ctx: Context) { lazy val RepeatedParamClasses: Set[Symbol] = Set(RepeatedParamClass, JavaRepeatedParamClass) - /** Modules whose members are in the default namespace */ - lazy val UnqualifiedModules: Set[TermSymbol] = Set(PredefModule, ScalaPackageVal, JavaLangPackageVal) - - /** `UnqualifiedModules` and their module classes */ - lazy val UnqualifiedOwners = UnqualifiedModules ++ UnqualifiedModules.map(_.moduleClass) + /** `Modules whose members are in the default namespace and their module classes */ + lazy val UnqualifiedOwners = RootImports.toSet ++ RootImports.map(_.moduleClass) lazy val PhantomClasses = Set[Symbol](AnyClass, AnyValClass, NullClass, NothingClass) lazy val asInstanceOfMethods = Set[Symbol](Any_asInstanceOf, Object_asInstanceOf) lazy val isInstanceOfMethods = Set[Symbol](Any_isInstanceOf, Object_isInstanceOf) - lazy val RootImports = Set[Symbol](PredefModule, ScalaPackageVal, JavaLangPackageVal) + lazy val RootImports = List[Symbol](JavaLangPackageVal, ScalaPackageVal, ScalaPredefModule, DottyPredefModule) def isTupleType(tp: Type) = { val arity = tp.dealias.typeArgs.length |