Community
Participate
Working Groups
I have observed that all empty Sequence values seem to share the same set of extended properties. For instance, the following test case fails, as y.~extended seems to have been initialized when "x.~extended = 1" was executed: @test operation testExtendedPropertyAssignmentUsesIdentity() { var x : Sequence; var y : Sequence; x.~extended = 1; assertEquals(1, x.~extended); assertTrue(y.~extended.isUndefined()); } Looking at the code, it seems that the issue is in EolContext, which uses a HashMap instead of an IdentityHashMap for the mapping from an object to its extended properties. HashMap uses the hashCode() function, which is based on the actual contents. Two empty sequences have the same hashCode(), so they end up sharing the extended properties as well. I believe this is not the wanted behaviour, as it will likely surprise most users and may be a problem if we have different sequences with different meanings that somehow end up having the same literal elements.
I have added the above test to the EOL assignment acceptance test suite, and changed EolContext to use an IdentityHashMap for the extended properties. The required code has been committed to SVN.
Fixed in 0.9.1