Skip to content
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

Improve some kernel error messages #2955

Merged
merged 5 commits into from
Nov 1, 2018

Conversation

fingolfin
Copy link
Member

This continues the work begun in PR #2947 and implements the change I promised there: Instead of "(not a integer)" we now say for example "(not the integer 5)".

Also adds and uses RequireStringRep, RequireInt, RequireSmallInt

@fingolfin fingolfin added topic: kernel release notes: to be added PRs introducing changes that should be (but have not yet been) mentioned in the release notes labels Oct 30, 2018
@ChrisJefferson
Copy link
Contributor

ChrisJefferson commented Oct 30, 2018

Picky, I don't really like the messages (not true) and (not false), as in context it could be (I think) confusing, consider:

<x> must be a small list (not true) -- the not true could be referring to the fact the statement is false :) Therefore I'd prefer something else, perhaps not the value 'true', or not the boolean 'true'.

EDIT: I'm happy with (not fail), although I have a small preference for (not 'fail'), just to make clear it's a value (which we use in other places)

src/error.h Outdated
*/
#define RequireSmallInt(funcname, op, argname) \
RequireArgumentCondition(funcname, op, argname, IS_INTOBJ(op), \
"must be an integer")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the refer to the "smallness" of the required integer somehow?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ouch, indeed, that's a copy&past mistake. I'll change it to "must be a small integer"

@fingolfin
Copy link
Member Author

How about (not 'true')?

@codecov
Copy link

codecov bot commented Oct 30, 2018

Codecov Report

Merging #2955 into master will increase coverage by 0.01%.
The diff coverage is 78.57%.

@@            Coverage Diff             @@
##           master    #2955      +/-   ##
==========================================
+ Coverage   83.79%   83.81%   +0.01%     
==========================================
  Files         682      682              
  Lines      346236   346046     -190     
==========================================
- Hits       290135   290043      -92     
+ Misses      56101    56003      -98
Impacted Files Coverage Δ
src/compiler.c 88.55% <0%> (+0.22%) ⬆️
src/integer.c 97.87% <100%> (-0.01%) ⬇️
src/stringobj.c 94.49% <100%> (+0.6%) ⬆️
src/intrprtr.c 98.82% <100%> (-0.01%) ⬇️
src/range.c 96.88% <100%> (+1.09%) ⬆️
src/exprs.c 97.58% <100%> (-0.01%) ⬇️
src/opers.c 94.62% <100%> (-0.02%) ⬇️
src/gvars.c 86.01% <100%> (+3.43%) ⬆️
src/sysfiles.c 41.09% <100%> (+0.05%) ⬆️
src/stats.c 95.3% <100%> (+0.16%) ⬆️
... and 14 more

This changes error messages like

    Error, E: <n> must be a positive small integer (not a integer)
    Error, OnTuples: <tuple> must be a small list (not a boolean or fail)

to something like this:

    Error, E: <n> must be a positive small integer (not the integer 0)
    Error, OnTuples: <tuple> must be a small list (not fail)

Specifically, small integers are printed as part of the error message; and for
the three T_BOOL values true, false and fail, we print them, too.
@ChrisJefferson ChrisJefferson merged commit bd68904 into gap-system:master Nov 1, 2018
@fingolfin fingolfin deleted the mh/error-check branch November 1, 2018 10:02
@fingolfin fingolfin added release notes: added PRs introducing changes that have since been mentioned in the release notes and removed release notes: to be added PRs introducing changes that should be (but have not yet been) mentioned in the release notes labels Apr 15, 2019
@olexandr-konovalov olexandr-konovalov added this to the GAP 4.11.0 milestone Feb 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release notes: added PRs introducing changes that have since been mentioned in the release notes topic: kernel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants