summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-08-15 15:02:18 -0700
committerPaul Phillips <paulp@improving.org>2013-08-17 08:22:52 -0700
commit9672a80d08148e9f3223077bf96aaa4ddf17c599 (patch)
tree0af2d5fead3aa60561fdca17fcb51813e764658f /src/compiler
parentb38c9289308334af940aea2ee0ab1d2e65a88ccb (diff)
downloadscala-9672a80d08148e9f3223077bf96aaa4ddf17c599.tar.gz
scala-9672a80d08148e9f3223077bf96aaa4ddf17c599.tar.bz2
scala-9672a80d08148e9f3223077bf96aaa4ddf17c599.zip
Add checkability condition.
All parents of an intersection type must be checkable for the type to be checkable.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Checkable.scala6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Checkable.scala b/src/compiler/scala/tools/nsc/typechecker/Checkable.scala
index 31a31df764..67c5666f66 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Checkable.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Checkable.scala
@@ -246,8 +246,8 @@ trait Checkable {
uncheckedOk(P0) || (P0.widen match {
case TypeRef(_, NothingClass | NullClass | AnyValClass, _) => false
case RefinedType(_, decls) if !decls.isEmpty => false
- case p =>
- new CheckabilityChecker(AnyTpe, p) isCheckable
+ case RefinedType(parents, _) => parents forall isCheckable
+ case p => new CheckabilityChecker(AnyTpe, p) isCheckable
})
)
@@ -273,6 +273,8 @@ trait Checkable {
// Matching on types like case _: AnyRef { def bippy: Int } => doesn't work -- yet.
case RefinedType(_, decls) if !decls.isEmpty =>
getContext.unit.warning(tree.pos, s"a pattern match on a refinement type is unchecked")
+ case RefinedType(parents, _) =>
+ parents foreach (p => checkCheckable(tree, p, X, inPattern, canRemedy))
case _ =>
val checker = new CheckabilityChecker(X, P)
log(checker.summaryString)