-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Allow limit_type_depth
to introduce more than one new TypeVar
#20626
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
Looks like the |
limit_type_depth
to introduce more than one new TypeVar
limit_type_depth
to introduce more than one new TypeVar
I wonder whether types deep enough for this PR to make a difference appear in the benchmarks, but better be safe than sorry, so @nanosoldier |
Should we do something like
to turn potentially very subtle bugs into more obvious ones? (Of course, |
Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @jrevels |
Nice, 👍. Only one small thing; I would not use gensym here since it might generate a large number of symbols that aren't strictly necessary. Yes, using separate names makes the types easier to read, but we can use a symbol pool instead. |
I'd like to do something like var = TypeVar(Symbol("_", length(vars) + 1), t.name.wrapper) but string concatenation is not available during inference. Is there any easy way to accomplish this? With a "symbol pool", you probably meant having something like My current thinking is: Either go all the way and ensure that the |
Scott reported a problem, possibly related to this (as it seems to trigger the assertion here), on Discourse: https://discourse.julialang.org/t/strange-failure-in-v0-6/2911/8 |
return r | ||
end | ||
|
||
function limit_type_depth(t::ANY, d::Int, cov::Bool, vars::Vector{TypeVar}=TypeVar[]) | ||
if isa(t,Union) | ||
if d > MAX_TYPE_DEPTH | ||
return Any |
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.
Should this have been cov ? Any : (v = TypeVar(:_); push!(vars, v); v)
? cc @martinholters
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.
Sounds reasonable. I'll look into this...
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.
Fixes #20615.
This is WIP because it increases the time to run thefft
test from 20s to 630s on my system. (All other tests look unsuspicious at first glance.)