-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid overwrite warning using more specific method
- Loading branch information
Showing
3 changed files
with
50 additions
and
31 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,37 @@ | ||
using Base: @deprecate, depwarn | ||
using Base: depwarn | ||
|
||
function ismocked(pe::PatchEnv, func_name::Symbol, args::Tuple) | ||
m = @__MODULE__ | ||
depwarn("`$m.ismocked` is no longer used and can be safely removed.", :ismocked) | ||
return false | ||
end | ||
|
||
# Note: Very similar to using `@deprecate` but displays fully qualified function names | ||
# Note: The `depwarn` call here is similar to using `@deprecate` but instead shows a fully | ||
# qualified function name. | ||
function enable(; force=false) | ||
m = @__MODULE__ | ||
depwarn("`$m.enable(; force=$force)` is deprecated, use `$m.activate()` instead.", :enable) | ||
activate() | ||
end | ||
|
||
function activate(f) | ||
m = @__MODULE__ | ||
depwarn("`$m.activate(f)` is deprecated and will be removed in the future.", :activate) | ||
|
||
started_deactivated = !activated() | ||
try | ||
activate() | ||
Base.invokelatest(f) | ||
finally | ||
started_deactivated && deactivate() | ||
end | ||
end | ||
|
||
function deactivate() | ||
m = @__MODULE__ | ||
depwarn("`$m.deactivate()` is deprecated and will be removed in the future.", :deactivate) | ||
|
||
# Avoid redefining `_activated` when it's already set appropriately | ||
Base.invokelatest(activated) && @eval _activated(::Int) = false | ||
return nothing | ||
end |
This file contains 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