From 688f421cb27bbaf25dc7c6234dddd997dd033a99 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 13 Dec 2019 14:03:11 +0100 Subject: [PATCH] Avoid nested IgnoredProtos First step towards fixing #6533 --- compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala b/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala index 9e379c6f7367..0e0bbc0d2f49 100644 --- a/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala +++ b/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala @@ -113,10 +113,14 @@ object ProtoTypes { } /** A class marking ignored prototypes that can be revealed by `deepenProto` */ - case class IgnoredProto(ignored: Type) extends UncachedGroundType with MatchAlways { - override def revealIgnored = ignored.revealIgnored + case class IgnoredProto(ignored: Type) extends UncachedGroundType with MatchAlways with + override def revealIgnored = ignored override def deepenProto(implicit ctx: Context): Type = ignored - } + + object IgnoredProto with + def apply(ignored: Type): IgnoredProto = ignored match + case ignored: IgnoredProto => ignored + case _ => new IgnoredProto(ignored) /** A prototype for expressions [] that are part of a selection operation: *