-
Notifications
You must be signed in to change notification settings - Fork 25
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
Type piracy checks for union varargs "too rough"? #173
Comments
Let me explain a few things: To your main point: The point is that Aqua's type piracy check works by checking one method at a time, and only checking this one method without regarding any of its surroundings, other dispatches etc. So I wouldn't know how to easily tackle what your observed, even in the case that we declare it a bug in Aqua.jl. |
I see. Thanks for clarifying. It would be a very strong feature enhancement if the piracy check could, for union arguments as above, something along the lines "what if I removed the owned types from the union and ask by |
I started a thread on slack about that: https://julialang.slack.com/archives/C67910KEH/p1695887352340349 |
It may be beneficial to explain what could go wrong in different cases of type piracy instead of putting everything in one bag.
(that's a rough idea, may require iterating upon) |
Thanks @mateuszbaran, that helps a lot! |
Unions are bad for type piracy. Unless I'm missing something, if a type signature is piracy, adding elements to existing unions or turning existing types into unions will never fix the problem entirely. Big +1 for "It may be beneficial to explain what could go wrong in different cases of type piracy instead of putting everything in one bag." It's much more informative and motivating to hear "PkgA could define |
While bumping Aqua.jl in the test project of LinearMaps.jl, I came across "newly detected" piracy issues, that had not been reported on Aqua.jl versions pre v0.7. One concrete example is the following:
Of course, there is some danger of piracy here because the argument tuple may contain only
LinearAlgebra
objects. In Julia v1.9 (on which the test was run), however, we have a methodwhich catches the "dangerous" case. All of this was conciously designed, so that
LinearMaps
's method can only be called if there is at least oneLinearMap
typed object among the arguments, which means there's no piracy going on. In the above referred to PR, I am even adopting the method signature to different julia versions, but no mercy by Aqua.jl on the piracy detection front, unfortunately.The text was updated successfully, but these errors were encountered: