aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Applications.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-08-24 15:06:30 +0200
committerMartin Odersky <odersky@gmail.com>2016-08-26 11:13:17 +0200
commitbdb425c57128c85fc3f7bd03b1906f55805d2194 (patch)
tree1144b1224b5e282c40085142c0b48808eb79008d /src/dotty/tools/dotc/typer/Applications.scala
parente1dc0b46a81a507ca040dca05a98f49fd6520d25 (diff)
downloaddotty-bdb425c57128c85fc3f7bd03b1906f55805d2194.tar.gz
dotty-bdb425c57128c85fc3f7bd03b1906f55805d2194.tar.bz2
dotty-bdb425c57128c85fc3f7bd03b1906f55805d2194.zip
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.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Applications.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Applications.scala5
1 files changed, 2 insertions, 3 deletions
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
}