VWMA(1)

In legacy code, before EiffelStudio 18.07, the target of a reattachment could be used to determine the type of a manifest array. For example, with the declaration x: ARRAY [READABLE_STRING_GENERAL] the reattachment x := <<"abc", "def">> led to creation of an array of type ARRAY [READABLE_STRING_GENERAL] with elements "abc" and "def" of type STRING_8.

In Eiffel, manifest arrays were the only expressions whose type depended on the type of the target. Starting from EiffelStudio 18.01 this is no longer the case, and, by default, the type of a manifest array does not depend on the context where the manifest array is used.

Taking the rules into account, the type of the manifest array object from the example above is ARRAY [STRING_8].

For projects that were developed before EiffelStudio 18.01, the compiler checks whether a computed manifest array type is the same as the type of the target of reattachment and reports the warning VWMA(1) to simplify adaptation of legacy code to the new semantics. If the old semantics has to be preserved, an explicit manifest array type has to be used, for example: x := {ARRAY [READABLE_STRING_GENERAL]} <<"abc", "def">> The code above would have the behavior identical to the behavior of projects created by the versions before EiffelStudio 18.01.

After updating all code to follow the standard rules, the project option Manifest array type can be set to standard to switch to the standard behavior and to disable comparing types of a manifest array and the target of the attachment. To make sure all occurrences of reattachment of manifest arrays to targets of non-matching types are fixed, the option can also be set to mismatch error. That would trigger errors instead of warnings for manifest array type mismatches.

cached: 12/21/2024 5:08:23.000 AM