From bdb425c57128c85fc3f7bd03b1906f55805d2194 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Wed, 24 Aug 2016 15:06:30 +0200 Subject: Relax matching requirement in unApply We now always widen selector type to the superclass if necessary, no matter whether the selector type refers to a trait or a proper class. --- src/dotty/tools/dotc/typer/Applications.scala | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala index 45ed4d938..099105de3 100644 --- a/src/dotty/tools/dotc/typer/Applications.scala +++ b/src/dotty/tools/dotc/typer/Applications.scala @@ -775,14 +775,13 @@ trait Applications extends Compatibility { self: Typer with Dynamic => * The generalizations of a type T are the smallest set G such that * * - T is in G - * - If a typeref R in G represents a trait, R's superclass is in G. + * - If a typeref R in G represents a class or trait, R's superclass is in G. * - If a type proxy P is not a reference to a class, P's supertype is in G */ def isSubTypeOfParent(subtp: Type, tp: Type)(implicit ctx: Context): Boolean = if (subtp <:< tp) true else tp match { - case tp: TypeRef if tp.symbol.isClass => - tp.symbol.is(Trait) && isSubTypeOfParent(subtp, tp.firstParent) + case tp: TypeRef if tp.symbol.isClass => isSubTypeOfParent(subtp, tp.firstParent) case tp: TypeProxy => isSubTypeOfParent(subtp, tp.superType) case _ => false } -- cgit v1.2.3