[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gm2] Another one, type and type equivalence stuff...
From: |
Gaius Mulley |
Subject: |
Re: [Gm2] Another one, type and type equivalence stuff... |
Date: |
Thu, 09 Sep 2010 17:18:04 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) |
Gaius Mulley <address@hidden> writes:
> Dragiša Durić <address@hidden> writes:
>
>> % gm2 -I. -fiso -c TestCase5.mod
>> TestCase5.mod:25:3: error: type incompatibility found between types
>> 'INTEGER' and 'My' during an assignment, hint maybe the expression should be
>> converted
>> TestCase5.mod:26:3: error: 'cmp' is not recognised as a procedure, check
>> declaration or import
>> TestCase5.mod:22:3: error: 'cmp' is not recognised as a procedure, check
>> declaration or import
>>
>> What can be interesting, XDS groks it.
>> % ../xds/bin/xc "=compile" TestCase5.mod
>> XDS Modula-2 v2.40 [x86, v1.50] - build 10.05.2005
>> Compiling "TestCase5.mod"
>> no errors, no warnings, lines 29, time 0.01
>> =========
>> MODULE TestCase5;
>>
>> FROM
>> SYSTEM
>> IMPORT
>> ADDRESS;
>>
>> TYPE
>> Compare = PROCEDURE (ADDRESS, ADDRESS): INTEGER;
>> My = Compare;
>>
>> PROCEDURE MyCmp(arg1, arg2: ADDRESS): INTEGER;
>> BEGIN
>> IF arg1 = arg2 THEN
>> RETURN -1;
>> ELSE
>> RETURN 0;
>> END;
>> END MyCmp;
>>
>> VAR
>> cmp: My;
>> a, b: ADDRESS;
>> BEGIN
>> cmp := MyCmp;
>> IF cmp(a, b) > 0 THEN
>> a := b;
>> END;
>> END TestCase5.
>>
>> --
>> Dragiša Durić <address@hidden>
>
> Hi Dragiša,
>
> now fixed in the latest cvs - again thanks for the test code.
>
> * gm2/gm2-compiler/M2GenGCC.mod: skip the type of a
> procedure variable.
> * gm2/gm2-compiler/M2Quads.mod: skip the type of a
> procedure variable held in OperandF. Ensure that
> assignment compatibility is only checked for procedure
> variables in pass 3. Leaving fuller assignment checking
> to be done during tree conversion. This fixes a bug
> reported by
> DragiÅ¡a DuriÄ\207 (dragisa-duric/testcase05/pass/testcase5.mod).
>
> regards,
> Gaius
Hi,
I've since improved the error reporting of erroneous qualidents. Here
are the latest changes:
* gm2/bnf/m2-3.bnf: improved Qualident to include much
stricter
checking of imported idents.
* gm2/bnf/m2.bnf: place imported modules into a separate list
in definition modules.
* gm2/gm2-compiler/P1SymBuild.def: introduce parameter to
BuildImportOuterModule to indicate whether a definition
module is being compiled.
* gm2/gm2-compiler/P1SymBuild.mod: implement above.
* gm2/gm2-compiler/P3SymBuild.mod: modified
CheckImportListOuterModule to include a check for
ImplicitlyExported symbols.
* gm2/gm2-compiler/SymbolTable.def: (New procedures)
PutIncludedByDefinition and IsIncludedByDefinition.
* gm2/gm2-compiler/SymbolTable.mod: (New procedures
implemented) PutIncludedByDefinition and IsIncludedByDefinition.
regards,
Gaius