diff options
author | Martin Odersky <odersky@gmail.com> | 2017-02-26 14:41:18 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2017-02-28 19:34:42 +0100 |
commit | f449d9d3f83c7e28526cb827aa19b8eaebbb784b (patch) | |
tree | ccffc2f825d9ca277a2cc253a6c1064b852b7617 /compiler/src/dotty/tools | |
parent | 783b978a4ebbe737a9b8467697a9f6970f99e907 (diff) | |
download | dotty-f449d9d3f83c7e28526cb827aa19b8eaebbb784b.tar.gz dotty-f449d9d3f83c7e28526cb827aa19b8eaebbb784b.tar.bz2 dotty-f449d9d3f83c7e28526cb827aa19b8eaebbb784b.zip |
Fix printing of refined applied types
If an applied type has a refinement, it was
printed before as one large refinement type
including the type parameter bindings.
Diffstat (limited to 'compiler/src/dotty/tools')
-rw-r--r-- | compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala | 4 | ||||
-rw-r--r-- | compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala b/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala index 0d1068b8c..6af902d1b 100644 --- a/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala +++ b/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala @@ -4,6 +4,7 @@ package printing import core._ import Texts._, Types._, Flags._, Names._, Symbols._, NameOps._, Constants._, Denotations._ import Contexts.Context, Scopes.Scope, Denotations.Denotation, Annotations.Annotation +import TypeApplications.AppliedType import StdNames.{nme, tpnme} import ast.Trees._, ast._ import typer.Implicits._ @@ -119,10 +120,11 @@ class PlainPrinter(_ctx: Context) extends Printer { } /** The longest sequence of refinement types, starting at given type - * and following parents. + * and following parents, but stopping at applied types. */ private def refinementChain(tp: Type): List[Type] = tp :: (tp match { + case AppliedType(_, _) => Nil case tp: RefinedType => refinementChain(tp.parent.stripTypeVar) case _ => Nil }) diff --git a/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala b/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala index 34190c114..4599665c8 100644 --- a/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala +++ b/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala @@ -1138,7 +1138,7 @@ object messages { | |You may want to create an anonymous class extending ${cls.name} with | ${s"class ${cls.name} { }"} - | + | |or add a companion object with | ${s"object ${cls.name} extends ${cls.name}"} | |