Skip to content

Commit

Permalink
support fallback concrete types for abstract number types
Browse files Browse the repository at this point in the history
  • Loading branch information
schlichtanders committed Jul 21, 2024
1 parent 06944fb commit a0fc1bf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ConfigurationsENV"
uuid = "4a543033-a920-4921-b9ec-d69f25e1cf2a"
authors = ["Stephan Sahm <[email protected]> and contributors"]
version = "0.1.0"
version = "0.1.1"

[deps]
Configurations = "5218b696-f38b-4ac9-8b61-a12ec717816d"
Expand Down
5 changes: 4 additions & 1 deletion src/ConfigurationsENV.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ function from_string(u::Union, str)
end
end
from_string(::Type{String}, str) = string(str)
from_string(::Type{T}, str) where {T<:Number} = parse(T, str)
_defaulttype(::Type{<:Complex}) = Complex{Float64}
_defaulttype(::Type{<:Real}) = Float64
_defaulttype(::Type{<:Integer}) = Int
from_string(::Type{T}, str) where {T<:Number} = isconcretetype(T) ? parse(T, str) : parse(_defaulttype(T), str)
from_string(::Type{T}, str) where {T} = T(str)

@cont function nestedkeys_and_types(::Type{T}) where {T}
Expand Down

2 comments on commit a0fc1bf

@schlichtanders
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/111441

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.1.1 -m "<description of version>" a0fc1bf5ecd07dc27ccde221e983d9af87859f8b
git push origin v0.1.1

Please sign in to comment.