-
Notifications
You must be signed in to change notification settings - Fork 175
Refactor declare attribute #2080
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
hpcgap/lib/oper.g
Outdated
| rank := args[2]; | ||
| else | ||
| rank := 1; | ||
| fi; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we should also reject invalid arguments? E.g.:
mutflag:=false;
rank:= 1;
if LEN_LIST(args) = 1 and args[1] in [ true, false ] then
mutflag := args[1];
elif LEN_LIST(args) = 1 and IS_INT(args[1]) then
rank := args[1];
elif LEN_LIST(args) = 2 and args[1] in [true, false] and IS_INT(args[2]) then
mutflag := args[1];
rank := args[2];
else
Error("Usage: NewAttribute(...)");
fi;
hpcgap/lib/oper.g
Outdated
|
|
||
| atomic FILTER_REGION do | ||
| OPER_SetupAttribute(getter, flags, mutflag, filter, rank, name); | ||
| OPER_SetupAttribute(getter, flags, mutflag, filter, rank, name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I deliberately removed indents like that to reduce spurious diffs without whitespace suppression. Granted, in this particular case it matters little, but for consistency, I'd like to keep it as it was.
8a5874f to
936f7d8
Compare
Codecov Report
@@ Coverage Diff @@
## master #2080 +/- ##
==========================================
- Coverage 67.84% 61.31% -6.54%
==========================================
Files 489 493 +4
Lines 255602 260657 +5055
==========================================
- Hits 173420 159811 -13609
- Misses 82182 100846 +18664
|
This is the result of trying to fix a bug in DeclareAttribute where if the user called it with the same name but different filters, the attributes would be setup correctly, but the second would not be added to the list ATTRIBUTES. The argument parsing made it impossible to give "mutable" and a rank for the attribute: If one gave "mutable", the rank would be ignored.
936f7d8 to
a8bf825
Compare
Loading them causes error as uncovered by refactoring DeclareAttribute (gap-system/gap#2080)
This is the first part of what used to be #2078.
It rearranges the argument parsing code for
DeclareAttributeandNewAttribute, and addresses the issue that the rank argument would be ignored if"mutable"was given.It would be good if @stevelinton could comment whether this might have been intentional (not being able to rank a tester for a mutable attribute).