Community
Participate
Working Groups
Surely filter just selects collection elements, so it does not change the collection kind, therefore Bag::filter => Bag. This is particularly tricky given the lack of let diagnosis so [let aFilteredBag : Bag(X) = anUnfilteredBag(X)] gets no diagnosis. Equally a filtered Set is surely still a Set.
Sorry, but I couldn't understand either the issue or the expected resolution ... Could you elaborate on what Acceleo gets wrong and what you expect it to do?
I would expect Collection(T)::filter(Classifier) : Collection(T) Bag(T)::filter(Classifier) : Bag(T) OrderedSet(T)::filter(Classifier) : OrderedSet(T) Sequence(T)::filter(Classifier) : Sequence(T) Set(T)::filter(Classifier) : Set(T) (Classifier is what might replace OclType one day).
This is already what Acceleo does, filter doesn't alter collection types. What you ask us to do is to add explicitely the Bag::filter() : Bag and all three others instead of only Collection::filter() : Collection?
I did [let aFilteredBag : Bag(X) = anUnfilteredBag(X)] and aFiteredBag was empty. I did [let aFilteredBag : Sequence(X) = anUnfilteredBag(X)] and aFiteredBag was not empty! This suggests that the signature of filter is as documented Collection::filter() : Sequence
I can't figure out why you're talking about the "filter" operation with what you write as expressions. I could only figure the issue (well, more "deduce" as I am not sure this is your actual problem) with your last comment about a documentation issue on the filter operation. There's indeed an implementation error on my side, I always return a Sequence from the filter operation... which provoked the documentation error as I am not the one who wrote it.
filter should no longer implicitly cast everything to a Sequence. The fix has been committed on HEAD and will be available for the next build.
Closing our "resolved" and "verified" bugs.