diff options
author | Martin Odersky <odersky@gmail.com> | 2015-09-29 18:21:15 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-09-29 19:19:31 +0200 |
commit | 2d9dcecc5757e4bd8659e78a94119c61ebc81a14 (patch) | |
tree | 4edb74c8aa180d5869f71542bb7cca2038b50b26 | |
parent | 5b07f556ebb1e87d5b5c87c6375fa33c29c9a72d (diff) | |
download | dotty-2d9dcecc5757e4bd8659e78a94119c61ebc81a14.tar.gz dotty-2d9dcecc5757e4bd8659e78a94119c61ebc81a14.tar.bz2 dotty-2d9dcecc5757e4bd8659e78a94119c61ebc81a14.zip |
Fix problem with avoid.
When determining what to refine we should not rely only on signatures
but we need full denotation matching.
-rw-r--r-- | src/dotty/tools/dotc/typer/TypeAssigner.scala | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/typer/TypeAssigner.scala b/src/dotty/tools/dotc/typer/TypeAssigner.scala index 3247592c3..ba8d44110 100644 --- a/src/dotty/tools/dotc/typer/TypeAssigner.scala +++ b/src/dotty/tools/dotc/typer/TypeAssigner.scala @@ -62,9 +62,10 @@ trait TypeAssigner { case info: ClassInfo if variance > 0 => val parentType = info.instantiatedParents.reduceLeft(ctx.typeComparer.andType(_, _)) def addRefinement(parent: Type, decl: Symbol) = { - val inherited = parentType.findMember(decl.name, info.cls.thisType, Private) - val inheritedInfo = inherited.atSignature(decl.info.signature).info - // @smarter atSignature probably wrong now; we are now missing out on types that refine the result type + val inherited = + parentType.findMember(decl.name, info.cls.thisType, Private) + .suchThat(decl.matches(_)) + val inheritedInfo = inherited.info if (inheritedInfo.exists && decl.info <:< inheritedInfo && !(inheritedInfo <:< decl.info)) typr.echo( i"add ref $parent $decl --> ", |