diff options
author | odersky <odersky@gmail.com> | 2017-04-10 10:30:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-10 10:30:18 +0200 |
commit | 80f9b6da66cb4eeabfd5ab97e422752ff134d590 (patch) | |
tree | 092126e5b948d5799c95e803fb735fbc794e8f26 /compiler | |
parent | 7294180d28dcbb3ba84ae302084a0806e76fa8a0 (diff) | |
parent | e2639e08b097aa9e5cb1f9a38ef37c6caec05874 (diff) | |
download | dotty-80f9b6da66cb4eeabfd5ab97e422752ff134d590.tar.gz dotty-80f9b6da66cb4eeabfd5ab97e422752ff134d590.tar.bz2 dotty-80f9b6da66cb4eeabfd5ab97e422752ff134d590.zip |
Merge pull request #2206 from dotty-staging/fix-#2198
Fix #2198: Don't widen module singletons
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/src/dotty/tools/dotc/typer/Namer.scala | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/src/dotty/tools/dotc/typer/Namer.scala b/compiler/src/dotty/tools/dotc/typer/Namer.scala index ce2030c01..b436b36b0 100644 --- a/compiler/src/dotty/tools/dotc/typer/Namer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Namer.scala @@ -1043,9 +1043,11 @@ class Namer { typer: Typer => def isInline = sym.is(FinalOrInline, butNot = Method | Mutable) // Widen rhs type and approximate `|' but keep ConstantTypes if - // definition is inline (i.e. final in Scala2). + // definition is inline (i.e. final in Scala2) and keep module singleton types + // instead of widening to the underlying module class types. def widenRhs(tp: Type): Type = tp.widenTermRefExpr match { - case tp: ConstantType if isInline => tp + case ctp: ConstantType if isInline => ctp + case ref: TypeRef if ref.symbol.is(ModuleClass) => tp case _ => ctx.harmonizeUnion(tp.widen) } |