Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve signature issue #40

Merged
merged 8 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/type_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
"""
parameters(sig::UnionAll) = parameters(sig.body)
parameters(sig::DataType) = sig.parameters
parameters(sig::Union) = Base.uniontypes(sig)
parameters(sig::Union) = Base.uniontypes(sig)
parameters(sig::TypeVar) = [sig]

Check warning on line 11 in src/type_utils.jl

View check run for this annotation

Codecov / codecov/patch

src/type_utils.jl#L11

Added line #L11 was not covered by tests
willtebbutt marked this conversation as resolved.
Show resolved Hide resolved
12 changes: 12 additions & 0 deletions test/type_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,17 @@

# Non-parametric type
@test isempty(parameters(Bool))

# type-vars in signatures
s = only(only(parameters(Tuple{Type{T}} where {T})).parameters)
@test s.name == :T
@test s.lb == Union{}
@test s.ub == Any

# https://github.com/invenia/ExprTools.jl/issues/39
@testset "#39" begin
s = Tuple{Type{T}, T} where {T<:Number}
willtebbutt marked this conversation as resolved.
Show resolved Hide resolved
@test parameters(s) isa Core.SimpleVector # what test to write here?
end
end
end
willtebbutt marked this conversation as resolved.
Show resolved Hide resolved
willtebbutt marked this conversation as resolved.
Show resolved Hide resolved
Loading