From 67bc0996540f508301b34bad98f40ddba318660b Mon Sep 17 00:00:00 2001
From: Etienne Kneuss <ekneuss@gmail.com>
Date: Tue, 26 May 2015 15:45:50 +0200
Subject: [PATCH] Strenghten List.find

---
 library/collection/List.scala | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/library/collection/List.scala b/library/collection/List.scala
index f8d3fb333..530bb5b41 100644
--- a/library/collection/List.scala
+++ b/library/collection/List.scala
@@ -410,7 +410,10 @@ sealed abstract class List[T] {
     case Nil() => None[T]()
     case Cons(h, t) if p(h) => Some(h)
     case Cons(_, t) => t.find(p)
-  }} ensuring { res => !res.isDefined || content.contains(res.get) }
+  }} ensuring { res => res match {
+    case Some(r) => (content contains r) && p(r)
+    case None() => true
+  }}
 
   def groupBy[R](f: T => R): Map[R, List[T]] = this match {
     case Nil() => Map.empty[R, List[T]]
-- 
GitLab