From 6eaf815923e194cd4d0da8faa0f132dbf8de4608 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Wed, 17 Dec 2014 17:13:30 +0100 Subject: Refactored common behavior from TypeAssigner and TypeErasure --- src/dotty/tools/dotc/core/TypeOps.scala | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/dotty/tools/dotc/core/TypeOps.scala') diff --git a/src/dotty/tools/dotc/core/TypeOps.scala b/src/dotty/tools/dotc/core/TypeOps.scala index 8190b8cb6..4716d89b7 100644 --- a/src/dotty/tools/dotc/core/TypeOps.scala +++ b/src/dotty/tools/dotc/core/TypeOps.scala @@ -2,7 +2,7 @@ package dotty.tools.dotc package core import Contexts._, Types._, Symbols._, Names._, Flags._, Scopes._ -import SymDenotations._ +import SymDenotations._, Denotations.Denotation import config.Printers._ import Decorators._ import StdNames._ @@ -224,6 +224,20 @@ trait TypeOps { this: Context => cls.enter(sym, decls) } + def makePackageObjPrefixExplicit(tpe: NamedType, d: Denotation): Type = { + def tryInsert(pkgClass: SymDenotation): Type = pkgClass match { + case pkgCls: PackageClassDenotation if !(d.symbol.maybeOwner is Package) => + tpe.derivedSelect(pkgCls.packageObj.valRef) + case _ => + tpe + } + tpe.prefix match { + case pre: ThisType if pre.cls is Package => tryInsert(pre.cls) + case pre: TermRef if pre.symbol is Package => tryInsert(pre.symbol.moduleClass) + case _ => tpe + } + } + /** If we have member definitions * * type argSym v= from -- cgit v1.2.3