add {.migrated(ident, msg):... .}
to issue callsite migration warnings for changed APIs
#18513
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 PR adds a way to indicate an API had a change in semantics, and, when a custom defined flag is used, it will issue a new migrated warning showing both the call site and the callee symbol location, along with custom msg. eg:
nim c main:
if you pass
-u:nimMigratedGetHomeDir
on cmdline, the warning disappears.ditto in your user config.nims with
switch("undef", "nimMigratedGetHomeDir")
you can also use
--warningAsError:migrated
to transform those warnings into errors, as usualThis PR (
.migrated
) and #18496 (--moduleoverride
) address main pain points when upgrading to a new compiler version (or more generally, to a new version of a library, it's not tied to compiler changes but more generally to API changes).future work
--warning:foo:foreign:on|off
to control whether to enable warnings for foreign packages; note that notes are currently turned off for foreign package notes (sane default) but in some cases it's useful to still issue those (not just for migrated warning but more generally); ditto with hints.