[M3commit] [modula3/cm3] e68df7: Fix a long-standing bug in record type equality.
OrlandoDiLasso
noreply at github.com
Thu Oct 7 02:51:00 CEST 2021
Branch: refs/heads/master
Home: https://github.com/modula3/cm3
Commit: e68df7f0cfab5dbad0c45ca0e244ba6aed7c7568
https://github.com/modula3/cm3/commit/e68df7f0cfab5dbad0c45ca0e244ba6aed7c7568
Author: ¨Rodney <rodney.bates at acm.org>
Date: 2021-10-06 (Wed, 06 Oct 2021)
Changed paths:
M m3-sys/m3front/src/values/Field.m3
Log Message:
-----------
Fix a long-standing bug in record type equality.
The compiler was incorrectly considering the presence and values of
default values of fields to contribute to the containing record or
object type. E.g.:
TYPE R1T = RECORD Field : INTEGER := 0 END;
TYPE R2T = RECORD Field : INTEGER := 1 END;
TYPE R3T = RECORD Field : INTEGER END;
Were all incorrectly treated as distinct types. Modula-3 2.2.4 says:
"A record is a member of T if it has fields with the given names and
types, in the given order, and no other fields.",
which only makes sense, as field default values affect neither the
value set of nor the set of legal operations on the record type.
Even considering constructing and allocating as operations, the
default values are just operands thereof.
This bug has been in the compiler at least as far back as PM3 1.1.15.
It is hard to imagine how it went unnoticed for so long.
More information about the M3commit
mailing list