File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -257,14 +257,14 @@ end
257257isdefined_tfunc (arg1, sym, order) = (@nospecialize ; isdefined_tfunc (arg1, sym))
258258function isdefined_tfunc (@nospecialize (arg1), @nospecialize (sym))
259259 if isa (arg1, Const)
260- a1 = typeof (arg1. val)
260+ arg1t = typeof (arg1. val)
261261 else
262- a1 = widenconst (arg1)
262+ arg1t = widenconst (arg1)
263263 end
264- if isType (a1 )
264+ if isType (arg1t )
265265 return Bool
266266 end
267- a1 = unwrap_unionall (a1 )
267+ a1 = unwrap_unionall (arg1t )
268268 if isa (a1, DataType) && ! isabstracttype (a1)
269269 if a1 === Module
270270 hasintersect (widenconst (sym), Symbol) || return Bottom
@@ -307,8 +307,8 @@ function isdefined_tfunc(@nospecialize(arg1), @nospecialize(sym))
307307 end
308308 end
309309 elseif isa (a1, Union)
310- return tmerge (isdefined_tfunc (a1. a, sym),
311- isdefined_tfunc (a1. b, sym))
310+ return tmerge (isdefined_tfunc (rewrap_unionall ( a1. a, arg1t) , sym),
311+ isdefined_tfunc (rewrap_unionall ( a1. b, arg1t) , sym))
312312 end
313313 return Bool
314314end
Original file line number Diff line number Diff line change @@ -1160,6 +1160,9 @@ struct UnionIsdefinedB; x; end
11601160@test isdefined_tfunc (Union{UnionIsdefinedA,UnionIsdefinedB}, Const (:x )) === Const (true )
11611161@test isdefined_tfunc (Union{UnionIsdefinedA,UnionIsdefinedB}, Const (:y )) === Const (false )
11621162@test isdefined_tfunc (Union{UnionIsdefinedA,Nothing}, Const (:x )) === Bool
1163+ # https://github.com/aviatesk/JET.jl/issues/379
1164+ fJET379 (x:: Union{Complex{T}, T} ) where T = isdefined (x, :im )
1165+ @test only (Base. return_types (fJET379)) === Bool
11631166
11641167@noinline map3_22347 (f, t:: Tuple{} ) = ()
11651168@noinline map3_22347 (f, t:: Tuple ) = (f (t[1 ]), map3_22347 (f, Base. tail (t))... )
You can’t perform that action at this time.
0 commit comments