Skip to content

Commit 0aa6143

Browse files
committed
test: splitdef on constructor function
Added a note to the documentation on the purpose of `params` Added a test to check that the detection of `:params` works in `splitdef`
1 parent 87ef1f8 commit 0aa6143

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/utils.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ end
334334
Match any function definition
335335
336336
```julia
337-
function name{params}(args; kwargs)::rtype where {whereparams}
337+
function name{params}(args; kwargs)::rtype where {whereparams} # `params` is used in constructors
338338
body
339339
end
340340
```

test/split.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ let
9898
@test (@splitcombine ((c, (a, b); d=1) -> a + b + c + d))(3, (1, 2); d=4) === 10
9999
@test (@splitcombine ((c, (a, b); d) -> a + b + c + d))(3, (1, 2); d=4) === 10
100100

101+
# With params (constructor)
102+
@test splitdef(Meta.parse("A{Float64}(t::T) where {T} = 1"))[:params] == [:Float64]
103+
101104
# Test for single varargs argument in lambda
102105
@test splitdef(Meta.parse("(args...) -> 0"))[:args] == [:(args...)]
103106
@test (@splitcombine (args...) -> sum(args))(1, 2, 3) == 6

0 commit comments

Comments
 (0)