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

kernel: fix Issue 1434 #1435

Merged
merged 1 commit into from
Jun 23, 2017
Merged

Conversation

james-d-mitchell
Copy link
Contributor

There were no checks on the arguments of the function IsInjectiveTransList,
this PR introduces such checks, and associated tests. The documentation of this function was also incorrect (the arguments were the wrong way around), and this is also fixed in this PR.

@codecov
Copy link

codecov bot commented Jun 20, 2017

Codecov Report

Merging #1435 into master will increase coverage by <.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #1435      +/-   ##
==========================================
+ Coverage   63.39%   63.39%   +<.01%     
==========================================
  Files        1010     1010              
  Lines      337899   337917      +18     
  Branches    13550    13554       +4     
==========================================
+ Hits       214217   214230      +13     
- Misses     120692   120695       +3     
- Partials     2990     2992       +2
Impacted Files Coverage Δ
src/trans.c 98.59% <100%> (+0.08%) ⬆️
lib/queue.g 66.4% <0%> (-3.2%) ⬇️
src/hpc/thread.c 46.35% <0%> (-0.6%) ⬇️
src/objset.c 40.57% <0%> (-0.58%) ⬇️
src/listfunc.c 76.77% <0%> (-0.18%) ⬇️
src/hpc/threadapi.c 32.04% <0%> (+0.09%) ⬆️
hpcgap/src/stats.c 73.02% <0%> (+0.13%) ⬆️
src/hpc/traverse.c 80.23% <0%> (+0.38%) ⬆️

src/trans.c Outdated
ErrorQuit("the second argument must consist of positive integers "
"but found %s",
(Int)TNAM_OBJ(val), 0L);
} else if (INT_INTOBJ(val) > LEN_LIST(t)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could use n here instead of LEN_LIST(t) (very minor comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, will do

Copy link
Member

@fingolfin fingolfin left a comment

Choose a reason for hiding this comment

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

Only minor remark, looks good overall, thanks

src/trans.c Outdated

if (!IS_LIST(l)) {
ErrorQuit("the first argument must be a list but found %s",
Copy link
Member

Choose a reason for hiding this comment

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

In most (?) other kernel error mssages, we would say " must be a list (not a %s)".

I don't mind the first part so much, but "(not a %s)" is used quite consistently everywhere, and "but found %s" is not.

Of course this applies to all other error messages, too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, I used "found %s" because the first thing I tried it on printed "(not a integer)" which I found difficult :(

Copy link
Member

Choose a reason for hiding this comment

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

Sure, that's something annoying we show in lots of place right now, though. If it bothers you, we could start an effort to correctly print a/an by providing a function that returns the TNAM string, together with a or an correctly prefixed.

Or else, a PR that changes (not a %s) everywhere.

But I am not so happy about mixing this...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed, I'll change this back to (not a %s)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And think about making a TNAM_OBJ_WITH_ARTICLE

@james-d-mitchell
Copy link
Contributor Author

@fingolfin I've made the changes now.

@james-d-mitchell
Copy link
Contributor Author

But forgot to update the tests...

There were no checks on the arguments of the function IsInjectiveTransList,
this commit introduces such checks, and associated tests.
@james-d-mitchell
Copy link
Contributor Author

All done, and ready to go.

@markuspf markuspf merged commit 2cf43fc into gap-system:master Jun 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants