Skip to content

Commit

Permalink
Base.NamedTuple(itr) = (; itr...) (#741)
Browse files Browse the repository at this point in the history
  • Loading branch information
cscherrer authored May 4, 2021
1 parent e43c8f9 commit 13757f5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "Compat"
uuid = "34da2185-b29b-5c13-b0c7-acf172513d20"
version = "3.27.0"
version = "3.28.0"

[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ changes in `julia`.

## Supported features

* `NamedTuple(::Pairs)` ([#37454]) (since Compat 3.28)

* `UUID(::UUID)` and `parse(::Type{UUID}, string)` ([#36018] / [#36199]) (since Compat 3.27)

* `cispi(x)` for accurately calculating `cis(pi * x)` ([#38449]) (since Compat 3.25)
Expand Down Expand Up @@ -238,4 +240,5 @@ Note that you should specify the correct minimum version for `Compat` in the
[#29790]: https://github.com/JuliaLang/julia/pull/29790
[#38449]: https://github.com/JuliaLang/julia/pull/38449
[#36018]: https://github.com/JuliaLang/julia/pull/36018
[#36199]: https://github.com/JuliaLang/julia/pull/36199
[#36199]: https://github.com/JuliaLang/julia/pull/36199
[#37454]: https://github.com/JuliaLang/julia/pull/37454
5 changes: 5 additions & 0 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,11 @@ if VERSION < v"1.6.0-DEV.196"
Base.parse(::Type{UUID}, s::AbstractString) = UUID(s)
end

# https://github.com/JuliaLang/julia/pull/37454
if VERSION < v"1.6.0-DEV.877"
Base.NamedTuple(itr) = (; itr...)
end

include("iterators.jl")
include("deprecated.jl")

Expand Down
6 changes: 6 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -878,3 +878,9 @@ end
uuid2 = UUID(uuidstr2)
@test parse(UUID, uuidstr2) == uuid2
end

# https://github.com/JuliaLang/julia/pull/37454
@testset "Base.NamedTuple(itr) = (; itr...)" begin
f(;kwargs...) = NamedTuple(kwargs)
@test f(a=1, b=2) == (a=1, b=2)
end

2 comments on commit 13757f5

@simeonschaub
Copy link
Member

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/36039

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 v3.28.0 -m "<description of version>" 13757f5ed5d1f0fa8f197ac6922ae3aa80cfd6f7
git push origin v3.28.0

Please sign in to comment.