-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Internal Error/StackOverflowError in type inference #42327
Comments
Yep, also breaks on 1.7-rc1:
though this time in
|
Dup of #38364 arguably. Also, I want to highlight this comment: #38364 (comment)
|
Kind of? The MWE by @martinholters at least throws a sensible
though the original example by @fonsp also throws the internal error (though a different one that also ends in type inference). I'd be happy with this getting a non-internal error and otherwise being a duplicate (though I'm not sure the cause is the same, as the errors seem to be handled differently...). The use case in the reproducer in my OP, while valid code, can be worked around on my end by not creating those large tuples internally. I guess the difference between the two issues is that in my case, the code creating those |
Like the comment says, the exact point where things explode might vary but in the end, it still gets you. |
Reproducer can be found here. Run as
julia reproducer.jl
, it takes care of a temp environment and such.What I think is happening is that the definition of
iterate
here kills type inference when trying to iterate over the result of a recursive buildup ofFlatten{T}
. That definition is copied verbatim fromBase.Iterators.flatten
and also contains this line:which potentially splats a very large/deeply nested tuple. I think this is what leads to the type inference death in the end and since this is copied from
Base.Iterators.flatten
, theBase
version should also have this same problem. It's hard to manifest, as recursively building up a regularflatten
already givesAny
much sooner and the subsequent loss of performance makes this crash infeasible, which was the motivation for buildingFlatten{T}
in the first place as I can guarantee here that theeltype
will always be the same.I'm fairly certain this is the cause, as interrupting the "waiting" code before hitting the internal error leads to this stacktrace:
I know that splatting large things is bad, so I'll move to a queue/Channel based design soon™, but I don't think it should crash/throw that unsightly internal error here..
Initial internal error
Transition to `abstract_call`
I'll build 1.7 later today and check if it breaks on there as well, but I'm fairly certain that it will.
The text was updated successfully, but these errors were encountered: