Skip to content

Commit 48c69f8

Browse files
authored
Relax 3-argument Fun constructor (#119)
1 parent 30a137a commit 48c69f8

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ApproxFunBase"
22
uuid = "fbd15aa5-315a-5a7d-a8a4-24992e37be05"
3-
version = "0.5.13"
3+
version = "0.5.14"
44

55
[deps]
66
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"

src/constructors.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ end
7171

7272
default_Fun(f,d::Space{ReComp},n::Integer) where {ReComp} = default_Fun(f,d,n,Val{!hasnumargs(f,1)})
7373

74-
Fun(f::Function,d::Space{ReComp},n::Integer) where {ReComp} = default_Fun(dynamic(f),d,n)
74+
Fun(f,d::Space{ReComp},n::Integer) where {ReComp} = default_Fun(dynamic(f),d,n)
7575

7676
# the following is to avoid ambiguity
7777
# Fun(f::Fun,d) should be equivalent to Fun(x->f(x),d)

test/SpacesTest.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ import ApproxFunBase: PointSpace, HeavisideSpace, PiecewiseSegment, dimension, V
5050
end
5151
@test ApproxFunBase.intpow(f,-2) == f^-2 == 1/(f*f)
5252
end
53+
54+
@testset "Fun accepts callables" begin
55+
struct Foo end
56+
(::Foo)(x) = x
57+
f1 = Fun(Foo(), PointSpace(1:10))
58+
f2 = Fun(Foo(), PointSpace(1:10), 10)
59+
@test coefficients(f1) == coefficients(f2)
60+
end
5361
end
5462

5563
@testset "Derivative operator for HeavisideSpace" begin

0 commit comments

Comments
 (0)