-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
some fixes for compilation #27898
some fixes for compilation #27898
Conversation
@@ -601,7 +601,7 @@ static void jl_compilation_sig( | |||
for (i = 0; i < np; i++) { | |||
jl_value_t *elt = jl_tparam(tt, i); | |||
jl_value_t *decl_i = jl_nth_slot_type(decl, i); | |||
size_t i_arg = (i <= nargs ? i : nargs); | |||
size_t i_arg = (i < nargs - 1 ? i : nargs - 1); |
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.
min(i, nargs - 1)
for readability?
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.
Readability+C? You're funny. The min
function can't exist in C since it doesn't have templates, and fmin
is a floating point function.
src/gf.c
Outdated
if (definition->isva ? np <= nargs : np != nargs) | ||
return 0; | ||
if (np != nargs) { | ||
if (!definition->isva || (np <= nargs && jl_is_vararg_type(jl_tparam(type, np - 1)))) { |
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 don't quite understand this condition. Why does the vararg matter?
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.
Only Vararg functions may be compiled for Vararg signatures
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.
Right, but isn't this asking the opposite?
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.
This (should?) check the condition up to the "only" clause. We should also check for the rest of that somewhere, but currently appear to be probably missing that check. It's not particularly important.
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.
Right, so this disallows anything of the form say Tuple{typeof(f), Int...}
, for say f(a::Int, b::Int...)
which may be what you intended, but I thought you may have intended the opposite.
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.
Right, this check is for ensure that we have enough parameters to form a Vararg. For np == nargs, we expect to just compile a concrete signature
A type-assert is usually a bad idea, unless the RHS is a concrete type.
No description provided.