Report any suspected bugs that you find
-
Helpdesk
- Posts: 37
- Joined: Sat Jan 01, 2011 5:43 am
-
Contact:
Post
by Helpdesk » Wed May 22, 2024 11:42 pm
When compiling a module
TypeExports which imports a module
M1 both directly and indirectly (via module
M2), an error message is incorrectly reported:
Code: Select all
Line Col
5 25 Error: parameters must be of exported types
Code: Select all
MODULE TypeExports;
IMPORT M2, M1;
PROCEDURE Test*(r: M1.R);
END Test;
END TypeExports.
Where M1 and M2 are:
Code: Select all
MODULE M1;
TYPE
R* = RECORD END;
END M1.
Code: Select all
MODULE M2;
IMPORT M1;
PROCEDURE P*(r: M1.R);
END P;
END M2.
TypeExports compiles without an error if the order of the imports is changed to:
-
cfbsoftware
- Site Admin
- Posts: 507
- Joined: Fri Dec 31, 2010 12:30 pm
-
Contact:
Post
by cfbsoftware » Thu May 23, 2024 1:45 am
This problem will be fixed in the next maintenance release. During investigation it was discovered that there are possible legitimate use cases of exported procedures with parameters of private types. For example:
Code: Select all
MODULE PrivateType;
IMPORT M;
VAR
value: INTEGER;
BEGIN
ASSERT(M.IsDefined(M.r));
value := M.Value(M.r)
END PrivateType.
Code: Select all
MODULE M;
TYPE
R = RECORD value: INTEGER; defined: BOOLEAN END;
VAR
r*: R;
PROCEDURE IsDefined*(r: R): BOOLEAN;
RETURN r.defined
END IsDefined;
PROCEDURE Value*(r: R): INTEGER;
RETURN r.value
END Value;
BEGIN
r.defined := FALSE
END M.
Consequently the severity of the resulting messages will be downgraded from errors to warnings:
Code: Select all
compiling M
Line Col
9 29 Warning: parameter type is not exported
13 25 Warning: parameter type is not exported