diff options
author | Martin Odersky <odersky@gmail.com> | 2017-04-02 11:43:03 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2017-04-11 09:33:12 +0200 |
commit | 264211f6b7129923c01c2e3c402b157685d64b1f (patch) | |
tree | 8d60f112df5ad8d34d98766fe340802bde1bcd07 /compiler/src/dotty/tools/dotc/core/Definitions.scala | |
parent | a7ee8dc999f415dbbed9c4e60bf4ade1cf8a94eb (diff) | |
download | dotty-264211f6b7129923c01c2e3c402b157685d64b1f.tar.gz dotty-264211f6b7129923c01c2e3c402b157685d64b1f.tar.bz2 dotty-264211f6b7129923c01c2e3c402b157685d64b1f.zip |
Scope refactoring
Since we now have separate package-scopes, it's easier to have
them take into account the special role played by the scala package.
So we can drop the funky logic of `makeScalaSpecial`.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/core/Definitions.scala')
-rw-r--r-- | compiler/src/dotty/tools/dotc/core/Definitions.scala | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/Definitions.scala b/compiler/src/dotty/tools/dotc/core/Definitions.scala index 8925724fd..c7b1538c7 100644 --- a/compiler/src/dotty/tools/dotc/core/Definitions.scala +++ b/compiler/src/dotty/tools/dotc/core/Definitions.scala @@ -108,7 +108,7 @@ class Definitions { * def apply(implicit $x0: T0, ..., $x{N_1}: T{N-1}): R * } */ - private def newFunctionNTrait(name: TypeName) = { + def newFunctionNTrait(name: TypeName) = { val completer = new LazyType { def complete(denot: SymDenotation)(implicit ctx: Context): Unit = { val cls = denot.asClass.classSymbol @@ -932,23 +932,6 @@ class Definitions { // ----- Initialization --------------------------------------------------- - /** Give the scala package a scope where a FunctionN trait is automatically - * added when someone looks for it. - */ - private def makeScalaSpecial()(implicit ctx: Context) = { - val oldInfo = ScalaPackageClass.classInfo - val oldDecls = oldInfo.decls - val newDecls = new PackageScope(oldDecls) { - override def lookupEntry(name: Name)(implicit ctx: Context): ScopeEntry = { - val res = super.lookupEntry(name) - if (res == null && name.isTypeName && name.isSyntheticFunction) - newScopeEntry(newFunctionNTrait(name.asTypeName)) - else res - } - } - ScalaPackageClass.info = oldInfo.derivedClassInfo(decls = newDecls) - } - /** Lists core classes that don't have underlying bytecode, but are synthesized on-the-fly in every reflection universe */ lazy val syntheticScalaClasses = List( AnyClass, @@ -976,8 +959,6 @@ class Definitions { def init()(implicit ctx: Context) = { this.ctx = ctx if (!_isInitialized) { - makeScalaSpecial() - // force initialization of every symbol that is synthesized or hijacked by the compiler val forced = syntheticCoreClasses ++ syntheticCoreMethods ++ ScalaValueClasses() |