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

fix #36783, more specialization on called Type arguments #36795

Merged
merged 2 commits into from
Jul 28, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/gf.c
Original file line number Diff line number Diff line change
Expand Up @@ -668,8 +668,12 @@ static void jl_compilation_sig(
also matching all other TypeConstructors. This means neither
Type{TC} nor TypeConstructor is more specific.
*/
if (!*newparams) *newparams = jl_svec_copy(tt->parameters);
jl_svecset(*newparams, i, jl_type_type);
// don't apply this heuristic if the argument is called (issue #36783)
int iscalled = i_arg > 0 && i_arg <= 8 && (definition->called & (1 << (i_arg - 1)));
if (!iscalled) {
if (!*newparams) *newparams = jl_svec_copy(tt->parameters);
jl_svecset(*newparams, i, jl_type_type);
}
}
else if (jl_is_type_type(jl_tparam0(elt)) &&
// try to give up on specializing type parameters for Type{Type{Type{...}}}
Expand Down Expand Up @@ -874,14 +878,15 @@ JL_DLLEXPORT int jl_isa_compileable_sig(
}
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

I vague think the previous conditional (jl_is_kind(elt)) should return 0 if iscalled, but there's a TODO there that it's possibly missing other cases already


if (jl_is_type_type(jl_unwrap_unionall(elt))) {
int iscalled = i_arg > 0 && i_arg <= 8 && (definition->called & (1 << (i_arg - 1)));
if (jl_types_equal(elt, (jl_value_t*)jl_type_type)) {
if (very_general_type(decl_i))
if (!iscalled && very_general_type(decl_i))
continue;
if (i >= nargs && definition->isva)
continue;
return 0;
}
if (very_general_type(decl_i))
if (!iscalled && very_general_type(decl_i))
return 0;
if (!jl_is_datatype(elt))
return 0;
Expand Down