codegen: warn on unbound static parameter #45897
Closed
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.
This is a proposal which fixes #29393, specifically by adding a warning as proposed in #29393 (comment).
With this PR applied, some of the following examples collected from the linked issues of #29393 are throwing a warning (format to be discussed ?) when unnecessary boxing occurs because of some unbound static parameter:
unbound.jl
Output running $ julia unbound.jl
While working on this PR, I modified a few things in
codegen.cpp
andjltypes.c
(I thought it wasn't worth making a separate PR): I'd be happy to split that to another PR if I was wrong.I'm unsure how to write corresponding tests for these new warnings in
CI
(if needed), so any advice is welcome. From the warnings thrown by the test suite, there doesn't seem to be false positives at first glance.