From 711283cba5fece0fec3cef164b540e76307925f6 Mon Sep 17 00:00:00 2001 From: norayr Date: Mon, 5 Dec 2016 22:06:10 +0400 Subject: [PATCH] added type aliasing check and warning. -- noch --- src/compiler/OPP.Mod | 6 ++++++ src/runtime/Errors.Txt | 1 + 2 files changed, 7 insertions(+) diff --git a/src/compiler/OPP.Mod b/src/compiler/OPP.Mod index 826a60e6..06a271b8 100644 --- a/src/compiler/OPP.Mod +++ b/src/compiler/OPP.Mod @@ -922,6 +922,12 @@ MODULE OPP; (* NW, RC 6.3.89 / 10.2.94 *) (* object model 4.12.93 *) OPT.Insert(OPS.name, obj); obj^.mode := OPT.Typ; obj^.typ := OPT.undftyp; CheckMark(obj^.vis); IF sym = OPS.eql THEN + IF (obj^.name = "INTEGER") OR (obj^.name = "SHORTINT") OR + (obj^.name = "LONGINT") OR (obj^.name = "HUGEINT") OR + (obj^.name = "LONGREAL") OR (obj^.name = "REAL") OR + (obj^.name = "CHAR") THEN + OPM.Mark(-310, OPM.curpos); (* notice about aliasing of predefined type *) + END; OPS.Get(sym); TypeDecl(obj^.typ, obj^.typ) ELSIF (sym = OPS.becomes) OR (sym = OPS.colon) THEN err(OPS.eql); OPS.Get(sym); TypeDecl(obj^.typ, obj^.typ) diff --git a/src/runtime/Errors.Txt b/src/runtime/Errors.Txt index 5e608945..c9f98339 100644 --- a/src/runtime/Errors.Txt +++ b/src/runtime/Errors.Txt @@ -177,6 +177,7 @@ Compiler Warnings 307 no ELSE symbol after CASE statement sequence may lead to trap 308 SYSTEM.VAL result includes memory past end of source variable; use SYSTEM.GET 309 you should name this parameter type, or else no actual parameter will match +310 aliasing of predefined type Run-time Error Messages -1 assertion failed, cf. SYSTEM_assert