From f7278e16ffa8ff242b7d985803015170dbf80ce7 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Wed, 1 Feb 2017 12:18:52 +1100 Subject: Add explanation to NoInitClasses --- compiler/src/dotty/tools/dotc/core/Definitions.scala | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'compiler/src') diff --git a/compiler/src/dotty/tools/dotc/core/Definitions.scala b/compiler/src/dotty/tools/dotc/core/Definitions.scala index 7eb3d9d47..18e2b883c 100644 --- a/compiler/src/dotty/tools/dotc/core/Definitions.scala +++ b/compiler/src/dotty/tools/dotc/core/Definitions.scala @@ -766,6 +766,16 @@ 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) = -- cgit v1.2.3