diff options
author | Nicolas Stucki <nicolas.stucki@gmail.com> | 2017-02-01 10:04:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-01 10:04:19 +0100 |
commit | b5185f1b4481ef61243741c7f7ed0ba8f696776b (patch) | |
tree | 7f7c18662e3e011374d1f2bbe78893e8ffac2722 /compiler/src/dotty/tools/dotc/core/Definitions.scala | |
parent | af7fdb32df34b352bf39f01a26653b169e0d55cf (diff) | |
parent | f7278e16ffa8ff242b7d985803015170dbf80ce7 (diff) | |
download | dotty-b5185f1b4481ef61243741c7f7ed0ba8f696776b.tar.gz dotty-b5185f1b4481ef61243741c7f7ed0ba8f696776b.tar.bz2 dotty-b5185f1b4481ef61243741c7f7ed0ba8f696776b.zip |
Merge pull request #1919 from dotty-staging/fix-#1915
Fix #1915 Synthetic function traits need NoInits flag
Diffstat (limited to 'compiler/src/dotty/tools/dotc/core/Definitions.scala')
-rw-r--r-- | compiler/src/dotty/tools/dotc/core/Definitions.scala | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/Definitions.scala b/compiler/src/dotty/tools/dotc/core/Definitions.scala index 716c9ef23..7fe6505ff 100644 --- a/compiler/src/dotty/tools/dotc/core/Definitions.scala +++ b/compiler/src/dotty/tools/dotc/core/Definitions.scala @@ -133,7 +133,7 @@ class Definitions { ClassInfo(ScalaPackageClass.thisType, cls, ObjectType :: parentTraits, decls) } } - newClassSymbol(ScalaPackageClass, name, Trait, completer) + newClassSymbol(ScalaPackageClass, name, Trait | NoInits, completer) } private def newMethod(cls: ClassSymbol, name: TermName, info: Type, flags: FlagSet = EmptyFlags): TermSymbol = @@ -770,6 +770,18 @@ class Definitions { lazy val PhantomClasses = Set[Symbol](AnyClass, AnyValClass, NullClass, NothingClass) + /** Classes that are known not to have an initializer irrespective of + * whether NoInits is set. Note: FunctionXXLClass is in this set + * because if it is compiled by Scala2, it does not get a NoInit flag. + * But since it is introduced only at erasure, there's no chance + * for augmentScala2Traits to do anything on a class that inherits it. So + * it also misses an implementation class, which means that the usual scheme + * of calling a superclass init in the implementation class of a Scala2 + * trait gets screwed up. Therefore, it is mandatory that FunctionXXL + * is treated as a NoInit trait. + */ + lazy val NoInitClasses = PhantomClasses + FunctionXXLClass + def isPolymorphicAfterErasure(sym: Symbol) = (sym eq Any_isInstanceOf) || (sym eq Any_asInstanceOf) |