Skip to content

Commit

Permalink
Use LazyString in depwarn (#2400)
Browse files Browse the repository at this point in the history
* Update macro.jl

* Update deprecations.jl

* Update Project.toml

* Update src/layers/macro.jl

Co-authored-by: Lasse Peters <[email protected]>

* Update src/deprecations.jl

---------

Co-authored-by: Lasse Peters <[email protected]>
  • Loading branch information
mcabbott and lassepe authored Mar 18, 2024
1 parent 85d953a commit a8737d7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "Flux"
uuid = "587475ba-b771-5e3f-ad9e-33799f191a9c"
version = "0.14.13"
version = "0.14.14"

[deps]
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
Expand Down
4 changes: 2 additions & 2 deletions src/deprecations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ end
# Greek-letter keywords deprecated in Flux 0.13
# Arguments (old => new, :function, "β" => "beta")
function _greek_ascii_depwarn(βbeta::Pair, func = :loss, names = "" => "")
Base.depwarn("""function $func no longer accepts greek-letter keyword $(names.first)
please use ascii $(names.second) instead""", func)
Base.depwarn(LazyString("function ", func, " no longer accepts greek-letter keyword ", names.first, """
please use ascii """, names.second, " instead"), func)
βbeta.first
end
_greek_ascii_depwarn(βbeta::Pair{Nothing}, _...) = βbeta.second
Expand Down
2 changes: 1 addition & 1 deletion src/layers/macro.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ end

function _check_new_macro(x::T) where T
Functors.isleaf(x) && return
Base.depwarn("This type should probably now use `Flux.@layer` instead of `@functor`: $T", Symbol("@functor"))
Base.depwarn(LazyString("This type should probably now use `Flux.@layer` instead of `@functor`: ", T), Symbol("@functor"))
end
_check_new_macro(::Tuple) = nothing # defined by Functors.jl, not by users
_check_new_macro(::NamedTuple) = nothing
Expand Down

2 comments on commit a8737d7

@mcabbott
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/103119

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.14.14 -m "<description of version>" a8737d71e09dd436b864971b8c83b1478ee070e6
git push origin v0.14.14

Please sign in to comment.