diff options
author | Dmitry Petrashko <dark@d-d.me> | 2015-04-02 16:50:32 +0200 |
---|---|---|
committer | Dmitry Petrashko <dark@d-d.me> | 2015-04-02 16:50:32 +0200 |
commit | 63d1f8661a13dc4b6ae087c87a6b30189fb61a8f (patch) | |
tree | 97e9714ea2bd516526c51e07b67998c325f3d954 /src | |
parent | 008bf64b47c9e8de41104579457f48edef1706fd (diff) | |
parent | e5618d29e37ad50bd1b8c591ed50db63a6d7bc79 (diff) | |
download | dotty-63d1f8661a13dc4b6ae087c87a6b30189fb61a8f.tar.gz dotty-63d1f8661a13dc4b6ae087c87a6b30189fb61a8f.tar.bz2 dotty-63d1f8661a13dc4b6ae087c87a6b30189fb61a8f.zip |
Merge pull request #436 from dotty-staging/linked-class
use methods to find companion class
Diffstat (limited to 'src')
-rw-r--r-- | src/dotty/tools/dotc/ast/Desugar.scala | 7 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Denotations.scala | 8 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/StdNames.scala | 8 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/SymDenotations.scala | 56 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/SymbolLoaders.scala | 4 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Symbols.scala | 9 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/pickling/ClassfileParser.scala | 11 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/pickling/UnPickler.scala | 24 | ||||
-rw-r--r-- | src/dotty/tools/dotc/transform/FirstTransform.scala | 8 | ||||
-rw-r--r-- | src/dotty/tools/dotc/transform/PatternMatcher.scala | 8 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/Checking.scala | 3 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/Namer.scala | 42 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/RefChecks.scala | 3 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/Typer.scala | 2 |
14 files changed, 157 insertions, 36 deletions
diff --git a/src/dotty/tools/dotc/ast/Desugar.scala b/src/dotty/tools/dotc/ast/Desugar.scala index 9bef032fe..1dfa24291 100644 --- a/src/dotty/tools/dotc/ast/Desugar.scala +++ b/src/dotty/tools/dotc/ast/Desugar.scala @@ -362,9 +362,10 @@ object desugar { companionDefs(parent, applyMeths ::: unapplyMeth :: defaultGetters) } else if (defaultGetters.nonEmpty) - companionDefs(anyRef, defaultGetters) + companionDefs(anyRef, defaultGetters) else Nil + // For an implicit class C[Ts](p11: T11, ..., p1N: T1N) ... (pM1: TM1, .., pMN: TMN), the method // synthetic implicit C[Ts](p11: T11, ..., p1N: T1N) ... (pM1: TM1, ..., pMN: TMN): C[Ts] = // new C[Ts](p11, ..., p1N) ... (pM1, ..., pMN) = @@ -409,6 +410,8 @@ object desugar { flatTree(cdef1 :: companions ::: implicitWrappers) } + val AccessOrSynthetic = AccessFlags | Synthetic + /** Expand * * object name extends parents { self => body } @@ -436,7 +439,7 @@ object desugar { .withPos(tmpl.self.pos orElse tmpl.pos.startPos) val clsTmpl = cpy.Template(tmpl)(self = clsSelf, body = tmpl.body) val cls = TypeDef(clsName, clsTmpl) - .withMods(mods.toTypeFlags & AccessFlags | ModuleClassCreationFlags) + .withMods(mods.toTypeFlags & AccessOrSynthetic | ModuleClassCreationFlags) Thicket(modul, classDef(cls)) } } diff --git a/src/dotty/tools/dotc/core/Denotations.scala b/src/dotty/tools/dotc/core/Denotations.scala index 91cf73404..6ca1bae8f 100644 --- a/src/dotty/tools/dotc/core/Denotations.scala +++ b/src/dotty/tools/dotc/core/Denotations.scala @@ -471,7 +471,7 @@ object Denotations { * 2) the union of all validity periods is a contiguous * interval. */ - private var nextInRun: SingleDenotation = this + protected var nextInRun: SingleDenotation = this /** The version of this SingleDenotation that was valid in the first phase * of this run. @@ -611,7 +611,10 @@ object Denotations { val current = symbol.current // println(s"installing $this after $phase/${phase.id}, valid = ${current.validFor}") // printPeriods(current) - this.nextInRun = current.nextInRun + if (current.nextInRun ne current) + this.nextInRun = current.nextInRun + else + this.nextInRun = this this.validFor = Period(ctx.runId, targetId, current.validFor.lastPhaseId) if (current.validFor.firstPhaseId == targetId) { // replace current with this denotation @@ -622,6 +625,7 @@ object Denotations { } else { // insert this denotation after current current.validFor = Period(ctx.runId, current.validFor.firstPhaseId, targetId - 1) + this.nextInRun = current.nextInRun current.nextInRun = this } // printPeriods(this) diff --git a/src/dotty/tools/dotc/core/StdNames.scala b/src/dotty/tools/dotc/core/StdNames.scala index 7b730d4d7..4f59bd453 100644 --- a/src/dotty/tools/dotc/core/StdNames.scala +++ b/src/dotty/tools/dotc/core/StdNames.scala @@ -83,8 +83,8 @@ object StdNames { final val HASHkw: N = kw("#") final val ATkw: N = kw("@") - val ANON_CLASS: N = "$anon" - val ANON_FUN: N = "$anonfun" + val ANON_CLASS: N = "$anon" + val ANON_FUN: N = "$anonfun" val BITMAP_PREFIX: N = "bitmap$" val BITMAP_NORMAL: N = BITMAP_PREFIX // initialization bitmap for public/protected lazy vals val BITMAP_TRANSIENT: N = BITMAP_PREFIX + "trans$" // initialization bitmap for transient lazy vals @@ -117,13 +117,15 @@ object StdNames { val PROTECTED_PREFIX: N = "protected$" val PROTECTED_SET_PREFIX: N = PROTECTED_PREFIX + "set" val ROOT: N = "<root>" - val SHADOWED: N = "(shadowed)" // tag to be used until we have proper name kinds + val SHADOWED: N = "(shadowed)" // tag to be used until we have proper name kinds val SINGLETON_SUFFIX: N = ".type" val SPECIALIZED_SUFFIX: N = "$sp" val SUPER_PREFIX: N = "super$" val WHILE_PREFIX: N = "while$" val DEFAULT_EXCEPTION_NAME: N = "ex$" val INITIALIZER_PREFIX: N = "initial$" + val COMPANION_MODULE_METHOD: N = "companion$module" + val COMPANION_CLASS_METHOD: N = "companion$class" // value types (and AnyRef) are all used as terms as well // as (at least) arguments to the @specialize annotation. diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala index dabdf54af..e8008eeb3 100644 --- a/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/src/dotty/tools/dotc/core/SymDenotations.scala @@ -239,7 +239,7 @@ object SymDenotations { final def ensureCompleted()(implicit ctx: Context): Unit = info /** The symbols defined in this class or object. - * Careful! This coes not force the type, so is compilation order dependent. + * Careful! This does not force the type, so is compilation order dependent. * This method should be used only in the following circumstances: * * 1. When accessing type parameters or type parameter accessors (both are entered before @@ -772,18 +772,36 @@ object SymDenotations { * and which is also defined in the same scope and compilation unit. * NoSymbol if this module does not exist. */ - final def companionModule(implicit ctx: Context): Symbol = - if (name == tpnme.ANON_CLASS) - NoSymbol // avoid forcing anon classes, this might cause cyclic reference errors - else - companionNamed(effectiveName.moduleClassName).sourceModule + final def companionModule(implicit ctx: Context): Symbol = { + if (this.flagsUNSAFE is Flags.Module) this.sourceModule + else { + val companionMethod = info.decls.denotsNamed(nme.COMPANION_MODULE_METHOD, selectPrivate).first + if (companionMethod.exists) + companionMethod.info.resultType.classSymbol.sourceModule + else + NoSymbol + } + } + /** The class with the same (type-) name as this module or module class, - * and which is also defined in the same scope and compilation unit. - * NoSymbol if this class does not exist. - */ - final def companionClass(implicit ctx: Context): Symbol = - companionNamed(effectiveName.toTypeName) + * and which is also defined in the same scope and compilation unit. + * NoSymbol if this class does not exist. + */ + final def companionClass(implicit ctx: Context): Symbol = { + val companionMethod = info.decls.denotsNamed(nme.COMPANION_CLASS_METHOD, selectPrivate).first + + if (companionMethod.exists) + companionMethod.info.resultType.classSymbol + else + NoSymbol + } + + final def scalacLinkedClass(implicit ctx: Context): Symbol = + if (this is ModuleClass) companionNamed(effectiveName.toTypeName) + else if (this.isClass) companionNamed(effectiveName.moduleClassName).sourceModule.moduleClass + else NoSymbol + /** Find companion class symbol with given name, or NoSymbol if none exists. * Three alternative strategies: @@ -1265,7 +1283,7 @@ object SymDenotations { myMemberCache } - /** Enter a symbol in current scope. + /** Enter a symbol in current scope, and future scopes of same denotation. * Note: We require that this does not happen after the first time * someone does a findMember on a subclass. * @param scope The scope in which symbol should be entered. @@ -1273,7 +1291,13 @@ object SymDenotations { */ def enter(sym: Symbol, scope: Scope = EmptyScope)(implicit ctx: Context): Unit = { val mscope = scope match { - case scope: MutableScope => scope + case scope: MutableScope => + // if enter gets a scope as an argument, + // than this is a scope that will eventually become decls of this symbol. + // And this should only happen if this is first time the scope of symbol + // is computed, ie symbol yet has no future. + assert(this.nextInRun == this) + scope case _ => unforcedDecls.openForMutations } if (this is PackageClass) { @@ -1285,11 +1309,15 @@ object SymDenotations { } } enterNoReplace(sym, mscope) + val nxt = this.nextInRun + if (nxt.validFor.code > this.validFor.code) { + this.nextInRun.asSymDenotation.asClass.enter(sym) + } } /** Enter a symbol in given `scope` without potentially replacing the old copy. */ def enterNoReplace(sym: Symbol, scope: MutableScope)(implicit ctx: Context): Unit = { - require(!(this is Frozen)) + require((sym.denot.flagsUNSAFE is Private) || !(this is Frozen)) scope.enter(sym) if (myMemberFingerPrint != FingerPrint.unknown) diff --git a/src/dotty/tools/dotc/core/SymbolLoaders.scala b/src/dotty/tools/dotc/core/SymbolLoaders.scala index 0ad34e16a..a863ad1b9 100644 --- a/src/dotty/tools/dotc/core/SymbolLoaders.scala +++ b/src/dotty/tools/dotc/core/SymbolLoaders.scala @@ -217,7 +217,7 @@ abstract class SymbolLoader extends LazyType { denot.markAbsent() postProcess(root) if (!root.isRoot) - postProcess(root.linkedClass.denot) + postProcess(root.scalacLinkedClass.denot) } } } @@ -229,7 +229,7 @@ class ClassfileLoader(val classfile: AbstractFile) extends SymbolLoader { def description = "class file "+ classfile.toString def rootDenots(rootDenot: ClassDenotation)(implicit ctx: Context): (ClassDenotation, ClassDenotation) = { - val linkedDenot = rootDenot.linkedClass.denot match { + val linkedDenot = rootDenot.scalacLinkedClass.denot match { case d: ClassDenotation => d case d => // this can happen if the companion if shadowed by a val or type diff --git a/src/dotty/tools/dotc/core/Symbols.scala b/src/dotty/tools/dotc/core/Symbols.scala index 3b8d226be..c655f1c52 100644 --- a/src/dotty/tools/dotc/core/Symbols.scala +++ b/src/dotty/tools/dotc/core/Symbols.scala @@ -161,6 +161,15 @@ trait Symbols { this: Context => owner.thisType, modcls, parents, decls, TermRef.withSymAndName(owner.thisType, module, name)), privateWithin, coord, assocFile) + def synthesizeCompanionMethod(name: Name, target: SymDenotation, owner: SymDenotation)(implicit ctx: Context) = + if(owner.exists && target.exists && !owner.isAbsent && !target.isAbsent) { + val existing = owner.unforcedDecls.lookup(name) + + existing.orElse{ + ctx.newSymbol(owner.symbol, name, Flags.Synthetic | Flags.Private, ExprType(target.typeRef)) + } + } else NoSymbol + /** Create a package symbol with associated package class * from its non-info fields and a lazy type for loading the package's members. */ diff --git a/src/dotty/tools/dotc/core/pickling/ClassfileParser.scala b/src/dotty/tools/dotc/core/pickling/ClassfileParser.scala index 3b8daab39..52ea7ba38 100644 --- a/src/dotty/tools/dotc/core/pickling/ClassfileParser.scala +++ b/src/dotty/tools/dotc/core/pickling/ClassfileParser.scala @@ -92,6 +92,10 @@ class ClassfileParser( if (c != classRoot.symbol) mismatchError(c) } + if(classRoot.symbol.id == 4812) { + println("bar") + } + addEnclosingTParams() if (unpickleOrParseInnerClasses()) return @@ -130,10 +134,17 @@ class ClassfileParser( for (i <- 0 until in.nextChar) parseMember(method = true) classInfo = parseAttributes(classRoot.symbol, classInfo) if (isAnnotation) addAnnotationConstructor(classInfo) + + val companionClassMethod = ctx.synthesizeCompanionMethod(nme.COMPANION_CLASS_METHOD, classRoot, moduleRoot) + if (companionClassMethod.exists) companionClassMethod.entered + val companionModuleMethod = ctx.synthesizeCompanionMethod(nme.COMPANION_MODULE_METHOD, moduleRoot, classRoot) + if (companionModuleMethod.exists) companionModuleMethod.entered + setClassInfo(classRoot, classInfo) setClassInfo(moduleRoot, staticInfo) } + /** Add type parameters of enclosing classes */ def addEnclosingTParams()(implicit ctx: Context): Unit = { var sym = classRoot.owner diff --git a/src/dotty/tools/dotc/core/pickling/UnPickler.scala b/src/dotty/tools/dotc/core/pickling/UnPickler.scala index 170ebd28b..462a8a370 100644 --- a/src/dotty/tools/dotc/core/pickling/UnPickler.scala +++ b/src/dotty/tools/dotc/core/pickling/UnPickler.scala @@ -118,6 +118,24 @@ object UnPickler { denot.owner.thisType select denot.sourceModule else selfInfo if (!(denot.flagsUNSAFE is JavaModule)) ensureConstructor(denot.symbol.asClass, decls) + + val scalacCompanion = denot.classSymbol.scalacLinkedClass + + def registerCompanionPair(module: Symbol, claz: Symbol) = { + val companionClassMethod = ctx.synthesizeCompanionMethod(nme.COMPANION_CLASS_METHOD, claz, module) + if (companionClassMethod.exists) + companionClassMethod.entered + val companionModuleMethod = ctx.synthesizeCompanionMethod(nme.COMPANION_MODULE_METHOD, module, claz) + if (companionModuleMethod.exists) + companionModuleMethod.entered + } + + if (denot.flagsUNSAFE is Module) { + registerCompanionPair(denot.classSymbol, scalacCompanion) + } else { + registerCompanionPair(scalacCompanion, denot.classSymbol) + } + denot.info = ClassInfo(denot.owner.thisType, denot.classSymbol, parentRefs, decls, ost) } } @@ -483,7 +501,11 @@ class UnPickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClassRoot: if (isModuleRoot) { moduleRoot setFlag flags moduleRoot.symbol - } else ctx.newSymbol(owner, name.asTermName, flags, localMemberUnpickler, coord = start) + } else ctx.newSymbol(owner, name.asTermName, flags, + new LocalUnpickler() withModuleClass(implicit ctx => + owner.info.decls.lookup(name.moduleClassName) + .suchThat(_ is Module).symbol) + , coord = start) case _ => errorBadSignature("bad symbol tag: " + tag) }) diff --git a/src/dotty/tools/dotc/transform/FirstTransform.scala b/src/dotty/tools/dotc/transform/FirstTransform.scala index 0de261149..b8d2b44f3 100644 --- a/src/dotty/tools/dotc/transform/FirstTransform.scala +++ b/src/dotty/tools/dotc/transform/FirstTransform.scala @@ -19,6 +19,7 @@ import DenotTransformers._ import typer.Checking import Names.Name import NameOps._ +import StdNames._ /** The first tree transform @@ -72,10 +73,13 @@ class FirstTransform extends MiniPhaseTransform with IdentityDenotTransformer wi case Nil => Nil } - def newCompanion(name: TermName): Thicket = { + def newCompanion(name: TermName, forClass: Symbol): Thicket = { val modul = ctx.newCompleteModuleSymbol(ctx.owner, name, Synthetic, Synthetic, defn.ObjectClass.typeRef :: Nil, Scopes.newScope) + val mc = modul.moduleClass if (ctx.owner.isClass) modul.enteredAfter(thisTransformer) + ctx.synthesizeCompanionMethod(nme.COMPANION_CLASS_METHOD, forClass, mc).enteredAfter(thisTransformer) + ctx.synthesizeCompanionMethod(nme.COMPANION_MODULE_METHOD, mc, forClass).enteredAfter(thisTransformer) ModuleDef(modul, Nil) } @@ -89,7 +93,7 @@ class FirstTransform extends MiniPhaseTransform with IdentityDenotTransformer wi false } val uniqueName = if (nameClash) objName.avoidClashName else objName - Thicket(stat :: newCompanion(uniqueName).trees) + Thicket(stat :: newCompanion(uniqueName, stat.symbol).trees) case stat => stat } diff --git a/src/dotty/tools/dotc/transform/PatternMatcher.scala b/src/dotty/tools/dotc/transform/PatternMatcher.scala index 3c304ccec..33e52e068 100644 --- a/src/dotty/tools/dotc/transform/PatternMatcher.scala +++ b/src/dotty/tools/dotc/transform/PatternMatcher.scala @@ -643,8 +643,12 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans // val outer = expectedTp.typeSymbol.newMethod(vpmName.outer, newFlags = SYNTHETIC | ARTIFACT) setInfo expectedTp.prefix val expectedClass = expectedTp.dealias.classSymbol.asClass - ExplicitOuter.ensureOuterAccessors(expectedClass) - codegen._asInstanceOf(testedBinder, expectedTp).select(ExplicitOuter.outerAccessor(expectedClass)).select(defn.Object_eq).appliedTo(expectedOuter) + val test = codegen._asInstanceOf(testedBinder, expectedTp) + val outerAccessorTested = ctx.atPhase(ctx.explicitOuterPhase.next) { implicit ctx => + ExplicitOuter.ensureOuterAccessors(expectedClass) + test.select(ExplicitOuter.outerAccessor(expectedClass)).select(defn.Object_eq).appliedTo(expectedOuter) + } + outerAccessorTested } } diff --git a/src/dotty/tools/dotc/typer/Checking.scala b/src/dotty/tools/dotc/typer/Checking.scala index f7502d56d..b8b4c9d2c 100644 --- a/src/dotty/tools/dotc/typer/Checking.scala +++ b/src/dotty/tools/dotc/typer/Checking.scala @@ -232,7 +232,8 @@ trait Checking { /** Check that type `tp` is stable. */ def checkStable(tp: Type, pos: Position)(implicit ctx: Context): Unit = - if (!tp.isStable) ctx.error(d"$tp is not stable", pos) + if (!tp.isStable) + ctx.error(d"$tp is not stable", pos) /** Check that type `tp` is a legal prefix for '#'. * @return The type itself diff --git a/src/dotty/tools/dotc/typer/Namer.scala b/src/dotty/tools/dotc/typer/Namer.scala index 357860290..e9e4d4c87 100644 --- a/src/dotty/tools/dotc/typer/Namer.scala +++ b/src/dotty/tools/dotc/typer/Namer.scala @@ -395,32 +395,64 @@ class Namer { typer: Typer => /** Create top-level symbols for statements and enter them into symbol table */ def index(stats: List[Tree])(implicit ctx: Context): Context = { + val classDef = mutable.Map[TypeName, TypeDef]() + val moduleDef = mutable.Map[TypeName, TypeDef]() + /** Merge the definitions of a synthetic companion generated by a case class * and the real companion, if both exist. */ def mergeCompanionDefs() = { - val classDef = mutable.Map[TypeName, TypeDef]() for (cdef @ TypeDef(name, _) <- stats) - if (cdef.isClassDef) classDef(name) = cdef - for (mdef @ ModuleDef(name, _) <- stats) + if (cdef.isClassDef) { + classDef(name) = cdef + cdef.attachmentOrElse(ExpandedTree, cdef) match { + case Thicket(cls :: mval :: (mcls @ TypeDef(_, _: Template)) :: crest) => + moduleDef(name) = mcls + case _ => + } + } + for (mdef @ ModuleDef(name, _) <- stats if !mdef.mods.is(Flags.Package)) { + val typName = name.toTypeName + val Thicket(vdef :: (mcls @ TypeDef(_, impl: Template)) :: Nil) = mdef.attachment(ExpandedTree) + moduleDef(typName) = mcls classDef get name.toTypeName match { case Some(cdef) => - val Thicket(vdef :: (mcls @ TypeDef(_, impl: Template)) :: Nil) = mdef.attachment(ExpandedTree) cdef.attachmentOrElse(ExpandedTree, cdef) match { case Thicket(cls :: mval :: TypeDef(_, compimpl: Template) :: crest) => val mcls1 = cpy.TypeDef(mcls)( rhs = cpy.Template(impl)(body = compimpl.body ++ impl.body)) mdef.putAttachment(ExpandedTree, Thicket(vdef :: mcls1 :: Nil)) + moduleDef(typName) = mcls1 cdef.putAttachment(ExpandedTree, Thicket(cls :: crest)) case _ => } case none => } + } + } + + def createLinks(classTree: TypeDef, moduleTree: TypeDef)(implicit ctx: Context) = { + val claz = ctx.denotNamed(classTree.name.encode).symbol + val modl = ctx.denotNamed(moduleTree.name.encode).symbol + ctx.synthesizeCompanionMethod(nme.COMPANION_CLASS_METHOD, claz, modl).entered + ctx.synthesizeCompanionMethod(nme.COMPANION_MODULE_METHOD, modl, claz).entered + } + + def createCompanionLinks(implicit ctx: Context): Unit = { + for (cdef @ TypeDef(name, _) <- classDef.values) { + moduleDef.getOrElse(name, EmptyTree) match { + case t: TypeDef => + createLinks(cdef, t) + case EmptyTree => + } + } } stats foreach expand mergeCompanionDefs() - (ctx /: stats) ((ctx, stat) => indexExpanded(stat)(ctx)) + val ctxWithStats = (ctx /: stats) ((ctx, stat) => indexExpanded(stat)(ctx)) + createCompanionLinks(ctxWithStats) + ctxWithStats } /** The completer of a symbol defined by a member def or import (except ClassSymbols) */ diff --git a/src/dotty/tools/dotc/typer/RefChecks.scala b/src/dotty/tools/dotc/typer/RefChecks.scala index 0ccb589ac..8a778a38d 100644 --- a/src/dotty/tools/dotc/typer/RefChecks.scala +++ b/src/dotty/tools/dotc/typer/RefChecks.scala @@ -395,7 +395,8 @@ object RefChecks { for (member <- missing) { val memberSym = member.symbol - def undefined(msg: String) = abstractClassError(false, member.showDcl + " is not defined" + msg) + def undefined(msg: String) = + abstractClassError(false, member.showDcl + " is not defined" + msg) val underlying = memberSym.underlyingSymbol // Give a specific error message for abstract vars based on why it fails: diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index ceab2fd2b..58d866ac1 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -963,7 +963,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit val packageContext = if (pkg is Package) ctx.fresh.setOwner(pkg.moduleClass).setTree(tree) else { - ctx.error(d"$pkg is not a packge", tree.pos) + ctx.error(d"$pkg is not a package", tree.pos) ctx } val stats1 = typedStats(tree.stats, pkg.moduleClass)(packageContext) |