lib/core: Make all `Set` cloneable
authorLucas Bajolet <r4pass@hotmail.com>
Sat, 12 Dec 2015 18:39:19 +0000 (13:39 -0500)
committerLucas Bajolet <r4pass@hotmail.com>
Sat, 12 Dec 2015 18:39:41 +0000 (13:39 -0500)
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

lib/core/collection/abstract_collection.nit
lib/core/collection/array.nit

index ef10cfa..f77d8f4 100644 (file)
@@ -409,6 +409,7 @@ end
 #      assert s.has(b)      ==  true
 interface Set[E]
        super SimpleCollection[E]
+       super Cloneable
 
        redef fun has_only(item)
        do
@@ -471,6 +472,8 @@ interface Set[E]
                return nhs
        end
 
+       redef fun clone do return union(self)
+
        # Returns a new instance of `Set`.
        #
        # Depends on the subclass, mainly used for copy services
index d196333..df7f5e7 100644 (file)
@@ -592,7 +592,6 @@ end
 # A set implemented with an Array.
 class ArraySet[E]
        super Set[E]
-       super Cloneable
 
        # The stored elements.
        private var array: Array[E] is noinit