Symbol type parameters can be piracy#375
Open
timholy wants to merge 2 commits into
Open
Conversation
As described in JuliaTesting#374, types like ClosedInterval{T} = Interval{:closed,:closed,T} from IntervalSets blocked piracy-detection because `:closed` Symbol params caused `is_foreign` to return `false` unconditionally. Fundamentally, this revealed problems with the heuristic used by `is_foreign`. This was essentially acknowledged as a problem in the comments. The strategy taken here is to change the heuristic: if the combination `SomeType{:foo}` appears in the module that defines `SomeType`, then this combination is treated as a foreign type. If no such combination exists, then the Symbol is treated as a user-defined dispatch tag, and the type is treated as a user-defined type. To avoid the need for "grepping" through source code, there is one additional requirement for it to be treated as foreign: the type/symbol combination must be defined as a type alias (UnionAll) in the owning module. Fixes JuliaTesting#374. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #375 +/- ##
==========================================
+ Coverage 87.47% 87.61% +0.13%
==========================================
Files 12 12
Lines 527 541 +14
==========================================
+ Hits 461 474 +13
- Misses 66 67 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
Author
|
I saw that the one failure was about a label. I don't have suitable privileges to add labels, but I did add an entry to the CHANGELOG. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As described in #374, types like
from IntervalSets blocked piracy-detection because
:closedSymbol params causedis_foreignto returnfalseunconditionally.Fundamentally, this revealed problems with the heuristic used by
is_foreign. This was essentially acknowledged as a problem in the comments.The strategy taken here is to change the heuristic: if the combination
SomeType{:foo}appears in the module that definesSomeType, then this combination is treated as a foreign type. If no such combination exists, then the Symbol is treated as a user-defined dispatch tag, and the type is treated as a user-defined type. To avoid the need for "grepping" through source code, there is one additional requirement for it to be treated as foreign: the type/symbol combination must be defined as a type alias (UnionAll) in the owning module.Fixes #374.
Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com