Skip to content

Fix accidental definition tuple_svec(::Type{Union{}}) - #40

Merged
mateuszbaran merged 2 commits into
JuliaArrays:mainfrom
PatrickHaecker:bottom_tuple_svec
Nov 7, 2026
Merged

mateuszbaran merged 2 commits into
JuliaArrays:mainfrom
PatrickHaecker:bottom_tuple_svec

Conversation

@PatrickHaecker

Copy link
Copy Markdown
Contributor

JET complains about it and it is correct: Bottom is <:Tuple and it does not have a field parameters.

JET complains about it and it is correct: `Bottom` is `<:Tuple` and it does not have a field `parameters`.
@PatrickHaecker

Copy link
Copy Markdown
Contributor Author

Anything missing, so that this PR can be merged?

@mateuszbaran

Copy link
Copy Markdown
Collaborator

I'm not entirely sure if this is a true issue, JET's false positive or Julia language deficiency that might be patched. tuple_svec is an internal function that is never supposed to receive Union{} and the code gets more complex, so I'm not sure if it's worth fixing, unless this type of change is actually explicitly endorsed by core Julia developers.

@PatrickHaecker

PatrickHaecker commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor Author

I'm not entirely sure if this is a true issue, JET's false positive or Julia language deficiency that might be patched.

I'd say it is a shortcoming of the Julia language. I agree that most of the time this is not wanted, although I also recently learned that Union{} as a type is used sometimes (obviously not as an object). It's not a false positive of JET, although I also wanted to think that when I started to dig into these problems.

tuple_svec is an internal function that is never supposed to receive Union{} and the code gets more complex, so I'm not sure if it's worth fixing, unless this type of change is actually explicitly endorsed by core Julia developers.

It is endorsed by core Julia developers, see, e.g., Julia#63338, Julia#63935 and Julia#63972 with the involvement of Shuhei, Jameson and Kristoffer. Unfortunately, with the semantics we currently have, Julia needs to allow Union{} when not explicitly inhibited as in this PR, which can create all sorts of problems, as e.g. type intersection is sometimes not unique due to the unwanted method instance for Union{} hanging around, so some optimizations are silently missed out.

I hope that we'll have a more elegant mechanism in the future. The most elegant idea I currently know about is described in this comment.

Until then, we should fix these problems if they are public API or already known to be problematic (e.g. suboptimum code has been detected or shows up via JET). In the case of this PR it's the latter.

That's why I ask for integrating the PR. We can remove the tests if you want to keep complexity low. I think a single line should add inconsiderable complexity. When Julia provides a better mechanism, we can version-gate it and remove even that when LTS supports the better mechanism.

Btw.: Great package! StaticArrays makes a huge difference for real-time SW developed with Julia. So thanks a lot for working on it!

@mateuszbaran

Copy link
Copy Markdown
Collaborator

Thanks for the explanation, that makes sense. I will merge this as is then, could you just bump the patch version so that it can be released immediately?

@PatrickHaecker

Copy link
Copy Markdown
Contributor Author

Thanks, @mateuszbaran. I bumped the patch version.

@codecov

codecov Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.43%. Comparing base (cc7d8fb) to head (f3ddc62).
⚠️ Report is 13 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #40      +/-   ##
==========================================
+ Coverage   96.87%   98.43%   +1.56%     
==========================================
  Files           1        1              
  Lines          64       64              
==========================================
+ Hits           62       63       +1     
+ Misses          2        1       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mateuszbaran
mateuszbaran merged commit 5c9b849 into JuliaArrays:main Nov 7, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants