Skip to content

Commit 5d3b786

Browse files
committed
Fix problem with avoid.
When determining what to refine we should not rely only on signatures but we need full denotation matching.
1 parent 2cd4590 commit 5d3b786

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/dotty/tools/dotc/typer/TypeAssigner.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,10 @@ trait TypeAssigner {
6262
case info: ClassInfo if variance > 0 =>
6363
val parentType = info.instantiatedParents.reduceLeft(ctx.typeComparer.andType(_, _))
6464
def addRefinement(parent: Type, decl: Symbol) = {
65-
val inherited = parentType.findMember(decl.name, info.cls.thisType, Private)
66-
val inheritedInfo = inherited.atSignature(decl.info.signature).info
67-
// @smarter atSignature probably wrong now; we are now missing out on types that refine the result type
65+
val inherited =
66+
parentType.findMember(decl.name, info.cls.thisType, Private)
67+
.suchThat(decl.matches(_))
68+
val inheritedInfo = inherited.info
6869
if (inheritedInfo.exists && decl.info <:< inheritedInfo && !(inheritedInfo <:< decl.info))
6970
typr.echo(
7071
i"add ref $parent $decl --> ",

0 commit comments

Comments
 (0)