Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong return type for Set->sortedBy() and OrderedSet->sortBy() #8

Closed
h-man2 opened this issue Sep 6, 2021 · 0 comments · Fixed by #10
Closed

Wrong return type for Set->sortedBy() and OrderedSet->sortBy() #8

h-man2 opened this issue Sep 6, 2021 · 0 comments · Fixed by #10
Labels
bug Something isn't working good first issue Good for newcomers ocl conformance ocl 2.4 Conformance to OCL 2.4

Comments

@h-man2
Copy link
Contributor

h-man2 commented Sep 6, 2021

Describe the bug
The operation sortedBy for types Set and OrderedSet currently return a value of type Sequence.
This is wrong and does not conform to the OCL specification that specifies OrderedSet.

To Reproduce
Enter the following into the USE shell:

use> ?Set{-2..3}->sortedBy(I|I*I)
-> Sequence{0,-1,1,-2,2,3} : Sequence(Integer)
use> ?OrderedSet{-2..3}->sortedBy(I|I*I)
-> Sequence{0,-1,1,-2,2,3} : Sequence(Integer)

Expected behavior
The return type should be OrderedSet:

use> ?Set{-2..3}->sortedBy(I|I*I)
-> Sequence{0,-1,1,-2,2,3} : OrderedSet(Integer)
use> ?OrderedSet{-2..3}->sortedBy(I|I*I)
-> Sequence{0,-1,1,-2,2,3} : OrderedSet(Integer)

Additional context
This conforms to OCL 2.4 (p. 60).

@h-man2 h-man2 added bug Something isn't working good first issue Good for newcomers ocl 2.4 Conformance to OCL 2.4 ocl conformance labels Sep 6, 2021
h-man2 added a commit that referenced this issue Sep 6, 2021
- Type of sortedBy is now calculated conforming the OCL standard
- Added tests for all collection types
@h-man2 h-man2 closed this as completed in #10 Sep 6, 2021
h-man2 added a commit that referenced this issue Sep 6, 2021
Issue #8 -wrong return type for Set->sortedBy() and OrderedSet->sortBy()
h-man2 added a commit that referenced this issue Sep 6, 2021
- Merge of testcases failed (too late... changed tests in target directory)
h-man2 added a commit that referenced this issue Sep 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers ocl conformance ocl 2.4 Conformance to OCL 2.4
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant