Skip to content

Commit a4725b0

Browse files
authored
Merge pull request #106 from aplavin/master
fix constructorof(Base.Fix1/2) on 1.12+
2 parents 51da615 + 31a1e65 commit a4725b0

3 files changed

Lines changed: 14 additions & 1 deletion

File tree

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ConstructionBase"
22
uuid = "187b0558-2788-49d3-abe0-74a17ed4e7c9"
33
authors = ["Takafumi Arakaki", "Rafael Schouten", "Jan Weidner"]
4-
version = "1.6.0"
4+
version = "1.6.1"
55

66
[weakdeps]
77
IntervalSets = "8197267c-284f-5f27-9208-e0e47529a953"

src/nonstandard.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,8 @@ constructorof(::Type{<:LinRange}) = linrange_constructor
3838
### Expr: args get splatted
3939
# ::Expr annotation is to make it type-stable on Julia 1.3-, probably not necessary anymore
4040
constructorof(::Type{<:Expr}) = (head, args) -> Expr(head, args...)::Expr
41+
42+
### Base.Fix: the N type parameter cannot be inferred from fields
43+
if isdefined(Base, :Fix)
44+
constructorof(::Type{<:Base.Fix{N}}) where {N} = Base.Fix{N}
45+
end

test/runtests.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,14 @@ end
244244
e = :(a + b)
245245
@test e == @inferred constructorof(typeof(e))(getfields(e)...)
246246
end
247+
248+
@testset "Fix" begin
249+
for T in [Base.Fix1, Base.Fix2]
250+
f = T(+, 1)
251+
@test setproperties(f, x=10) === T(+, 10)
252+
@test setproperties(f, f=-) === T(-, 1)
253+
end
254+
end
247255
end
248256

249257
@testset "default function constructors" begin

0 commit comments

Comments
 (0)