-
Notifications
You must be signed in to change notification settings - Fork 25
Description
It seems that Cobol 2002 type comparison is more complicated that what we implemented:
Two typed items are of the same type when:
- The items are described with TYPE clauses that reference equivalent type declarations; or
- The items are described as subordinate items in equivalent type declarations, starting at the same relative byte position and having the same length in bytes.
Two type declarations are considered equivalent when they have the same type-name, and for each
elementary item in one type declaration there is a corresponding elementary item in the other type
declaration, starting at the same relative byte position and having the same length in bytes.
Each pair of corresponding elementary items shall have the same BLANK WHEN ZERO, DYNAMIC LENGTH, JUSTIFIED, PICTURE, SIGN, SYNCHRONIZED, and USAGE clauses, with the following exceptions:
- Currency symbols match if and only if the corresponding currency strings are the same.
- Period picture symbols match if and only if the DECIMAL-POINT IS COMMA clause is in effect for both or for
neither of these type declarations. Comma picture symbols match if and only if the DECIMAL-POINT IS
COMMA clause is in effect for both or for neither of these type declarations.Additionally, locale specifications in the PICTURE clauses match if and only if:
- both specify the same SIZE phrase in the LOCALE phrase of the PICTURE clause, and
- both specify the LOCALE phrase without a locale-name or both specify the LOCALE phrase with the same
external identification, where the external identification is the external-locale-name or literal value
associated with a locale-name in the LOCALE clause of the SPECIAL-NAMES paragraph.
NOTE: When two typed items are defined in the same source element, the above rules mean that either both items are described with the same TYPE clause or both items are described as the same subordinate item in the same type declaration.
As we only check type name:
For Scrict type which is our own definition we need to forbid Sync clause to ensure type really match at runtime.
- Forbid SYNC in a Typedef
-Already done at the typedef level (d1686a4) but not for data under the typedef. - A strictly typed variable cannot be SYNC
- SYNC can be define at a parent level.