[comp.lang.modula3] ASSERT vs. error message

modula-3@uni-paderborn.de (Thomas Roemke) (04/19/91)

The program below contains an illegal default method value for p.
I expected to get an error message like ''default is incompatible with method type'',
but instead I got:
M3 runtime error, "Type.m3":473: ASSERT failed

Program /homes/thor/modula-3/m3_1.6/lib/m3/m3compiler got fatal signal 3.

Why are you using an ASSERT ?
Is the computation of ''is AB a supertype of A'' more complex than calculating A <: AB ? 

   MODULE bugtest EXPORTS Main;

   TYPE 
     A = OBJECT a: INTEGER METHODS p() := Pab END;
     AB = A OBJECT b: INTEGER END;

   PROCEDURE Pab(self: AB) = BEGIN END Pab;

   BEGIN
   END bugtest.


 Thomas

-- 
(*	Thomas Roemke, University of Paderborn, Germany 
	modula-3@uni-paderborn.de
	..!uunet!mcsun!unido!pbinfo!modula-3	*)

kalsow (Bill Kalsow) (04/20/91)

Thanks for the bug report.

The compiler crashed while type checking the default method.
An internal invariant was not maintained, hence the ASSERT.
If there was no internal problem, you would have gotten
an error message.

  - Bill Kalsow