Skip to content

Commit 08972f1

Browse files
committed
Add Compat for TypeUtils
See JuliaLang/julia#20006
1 parent 3541c2d commit 08972f1

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/Compat.jl

+11-1
Original file line numberDiff line numberDiff line change
@@ -1698,4 +1698,14 @@ if VERSION < v"0.6.0-dev.1256"
16981698
Base.take!(io::Base.AbstractIOBuffer) = takebuf_array(io)
16991699
end
17001700

1701-
end # module
1701+
module TypeUtils
1702+
@static if isdefined(Core, :UnionAll)
1703+
using Base: isabstract, parameter_upper_bound, unparameterized_type
1704+
else
1705+
isabstract(t::DataType) = t.abstract
1706+
parameter_upper_bound(t::DataType, idx) = t.parameters[idx].ub
1707+
unparameterized_type(t::DataType) = t.name.primary
1708+
end
1709+
export isabstract, parameter_upper_bound, unparameterized_type
1710+
end # module TypeUtils
1711+
end # module Compat

0 commit comments

Comments
 (0)