@@ -979,6 +979,9 @@ julia> [0 1; 2 3] .|> (x -> x^2) |> sum
979979"""
980980|> (x, f) = f (x)
981981
982+ _type_is_complete (:: Type{T} ) where {T} = @isdefined (T) ? true : false
983+ _is_complete_type (x) = (x isa Type) && _type_is_complete (x)
984+
982985"""
983986 f = Returns(value)
984987
@@ -1009,7 +1012,7 @@ struct Returns{V} <: Function
10091012 if value isa TypeWrapper
10101013 throw (ArgumentError (" ambiguous input" ))
10111014 end
1012- if value isa Type
1015+ if _is_complete_type ( value)
10131016 value = TypeWrapper {value} ()
10141017 end
10151018 new {typeof(value)} (value)
@@ -1104,10 +1107,10 @@ struct ComposedFunction{O,I} <: Function
11041107 inner:: I
11051108 ComposedFunction {O, I} (outer, inner) where {O, I} = new {O, I} (outer, inner)
11061109 function ComposedFunction (outer, inner)
1107- if outer isa Type
1110+ if _is_complete_type ( outer)
11081111 outer = Constructor {outer} ()
11091112 end
1110- if inner isa Type
1113+ if _is_complete_type ( inner)
11111114 inner = Constructor {inner} ()
11121115 end
11131116 new {typeof(outer), typeof(inner)} (outer, inner)
@@ -1264,10 +1267,10 @@ struct Fix{N,F,T} <: Function
12641267 if x isa TypeWrapper
12651268 throw (ArgumentError (" ambiguous input" ))
12661269 end
1267- if f isa Type
1270+ if _is_complete_type (f)
12681271 f = Constructor {f} ()
12691272 end
1270- if x isa Type
1273+ if _is_complete_type (x)
12711274 x = TypeWrapper {x} ()
12721275 end
12731276 new {N,typeof(f),typeof(x)} (f, x)
0 commit comments