Skip to content

Commit 5ec4e3d

Browse files
committed
Make typeConstructors of package classes symbolic.
Reason (1): The previous scheme would have failed for RootClass. (2) Symbols of package classes do not change between compilation runs, so the new scheme is more efficient.
1 parent 11a3d0d commit 5ec4e3d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/dotty/tools/dotc/core/SymDenotations.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,11 +441,12 @@ object SymDenotations {
441441
/** The type This(cls), where cls is this class, NoPrefix for all other symbols */
442442
def thisType(implicit ctx: Context): Type = NoPrefix
443443

444-
/** The type representing the type constructor for this type,
444+
/** The type representing the type constructor for this type.
445445
* @throws ClassCastException is this is not a type
446446
*/
447447
def typeConstructor(implicit ctx: Context): TypeRef =
448-
TypeRef(owner.thisType, name.asTypeName)
448+
if (isPackageClass) TypeRef(owner.thisType, symbol.asType)
449+
else TypeRef(owner.thisType, name.asTypeName)
449450

450451
/** The variance of this type parameter as an Int, with
451452
* +1 = Covariant, -1 = Contravariant, 0 = Nonvariant, or not a type parameter

0 commit comments

Comments
 (0)