PR# 19921 Wrong implementation of {ARRAYED_SET}.symdif

Problem Report Summary
Submitter: rosivaldo
Category: EiffelBase
Priority: Low
Date: 2024/05/22
Class: Bug
Severity: Non-critical
Number: 19921
Release: 23.09 (23.09.10.7341 - win64)
Confidential: No
Status: Open
Responsible:
Environment: win64
Synopsis: Wrong implementation of {ARRAYED_SET}.symdif

Description
Items that should be regarded different are regarded equal.
To Reproduce
- Extract the files within attached file main.zip.
- Open with EiffelStudio the project st_examples.ecf.
- Compile the target st_examples_tests.
- Target AutoTest tool to class:ANNOTATED_ARRAYED_SET_TESTS_DSCR/.*test_symdif.
- Run the test test_symdif.
- The error below will be reported.

test_symdif (ANNOTATED_ARRAYED_SET_TESTS_DSCR): FAIL (exclusive_elements_there)
	on_prepare: ok
	test routine: exceptional (Postcondition violation in ANNOTATED_ARRAYED_SET.symdif)
	on_clean: ok

The context:
{ANNOTATED_ARRAYED_SET_TESTS_DSCR}.test_symdif creates two ANNOTATED_ARRAYED_SET [detachable separate CHARACTER_REF] objects and puts 'a' into the first arrayed set, s1, and ('a').to_reference into the second, s2.
The subsequent s1.symdif (s2) instruction should extend s1 with the reference that is in s2, since the comparison is done by reference and the two items are not even of the same type ('a' /= ('a').to_reference).
But s1.symdif (s2) keeps the 'a' within s1 and ignores ('a').to_reference within s2.
Problem Report Interactions
From:jfiat_es    Date:2024/06/04    Status: Open    Download   
Thanks for the report, we will test your suggestion.

From:rosivaldo    Date:2024/05/22    Status: Open    Download   
In order to get rid of the apparent bug, {ANNOTATED_ARRAYED_SET}.symdif was rewritten as below.

	symdif (other: TRAVERSABLE_SUBSET [G])
			-- <Precursor>
		local
			int: like Current
		do
			int := twin
			int.intersect (other)
			merge (other)
			subtract (int)
		ensure then
			-- As before...
		end

It seems to have defeated the bug.

From:rosivaldo    Date:2024/05/22    Download   
Attachments for problem report #19921

Attachment: main.zip     Size:131038