nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
76855ad
)
lib/standard/collection: check the item can be compared in `Range#has`
author
Jean Privat
<jean@pryen.org>
Tue, 19 May 2015 14:54:49 +0000
(10:54 -0400)
committer
Jean Privat
<jean@pryen.org>
Tue, 19 May 2015 23:42:26 +0000
(19:42 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>
lib/standard/collection/range.nit
patch
|
blob
|
history
diff --git
a/lib/standard/collection/range.nit
b/lib/standard/collection/range.nit
index
1ad0309
..
5ed0531
100644
(file)
--- a/
lib/standard/collection/range.nit
+++ b/
lib/standard/collection/range.nit
@@
-30,7
+30,7
@@
class Range[E: Discrete]
# assert [1..10].has(5)
# assert [1..10].has(10)
# assert not [1..10[.has(10)
- redef fun has(item) do return item >= first and item <= last
+ redef fun has(item) do return item isa Comparable and item >= first and item <= last
# assert [1..1].has_only(1)
# assert not [1..10].has_only(1)