Bugfix return type for some set operators

This commit is contained in:
slederer 2024-10-16 02:01:12 +02:00
parent 32bfe1c803
commit 19f7d2a0eb
2 changed files with 15 additions and 0 deletions

View file

@ -3517,6 +3517,9 @@ begin
GtEqToken: begin emitSwap; emitSetIsSubset; end;
end;
if tok in [ EqToken, NotEqToken, LtEqToken, GtEqToken ] then
setBaseType(typeA, BooleanType);
tok := curToken.tokenKind;
end;
end;
@ -5076,6 +5079,7 @@ end;
Otherwise, you should pass a MemLocation instance where
the memLoc field is set to NoMem. A temporary is then created
and its MemLocation passed back in optionalDest.
FIXME: this is not implemented? A temporary is always created.
Argument passing: Args are passed on the eval stack.

11
tests/settest.pas Normal file
View file

@ -0,0 +1,11 @@
program settest;
type myset = set of (alpha, beta, gamma, delta);
var a,b:myset;
begin
a := [alpha, gamma];
b := [alpha, gamma, delta];
writeln (a <= b);
writeln (a >= b);
writeln (b >= a);
writeln ((b - [alpha, gamma]) >= a);
end.