Add check_only
option to precompile
#58146
Draft
+15
−11
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.
We want to compile a subset of the possible specializations of a function. To this end, we have a number of manually written
precompile
statements. Creating this list is, unfortunately, error-prone, and the list is also liable to going stale. Thus we'd like to validate eachprecompile
statement in the list.The simple answer is, of course, to actually run the
precompile
s, and we naturally do so, but this takes time.We would like a relatively quick way to check the validity of a
precompile
statement.We can't use
hasmethod
as it has both false positives (too loose):and also false negatives (too strict):
We can't use
hasmethod && isconcretetype
as it has false negatives (too strict):This PR adds the
check_only
Bool
keyword argument toprecompile
; iftrue
, the method instance isn't actually compiled. We can, of course, add a newisprecompilable
instead, or move things around.Cc: @nickrobinson251 whose idea this is, @gbaraldi who suggested opening the PR for discussion, and @JeffBezanson who had some thoughts on "compilability".