File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -78,7 +78,13 @@ function instanceof_tfunc(@nospecialize(t))
78
78
elseif isa (t, UnionAll)
79
79
t′ = unwrap_unionall (t)
80
80
t′′, isexact = instanceof_tfunc (t′)
81
- return rewrap_unionall (t′′, t), isexact
81
+ tr = rewrap_unionall (t′′, t)
82
+ if t′′ isa DataType && ! has_free_typevars (tr)
83
+ # a real instance must be within the declared bounds of the type,
84
+ # so we can intersect with the original wrapper.
85
+ tr = typeintersect (tr, t′′. name. wrapper)
86
+ end
87
+ return tr, isexact
82
88
elseif isa (t, Union)
83
89
ta, isexact_a = instanceof_tfunc (t. a)
84
90
tb, isexact_b = instanceof_tfunc (t. b)
Original file line number Diff line number Diff line change @@ -2442,3 +2442,6 @@ f31974(n::Int) = f31974(1:n)
2442
2442
# This query hangs if type inference improperly attempts to const prop
2443
2443
# call cycles.
2444
2444
@test code_typed (f31974, Tuple{Int}) != = nothing
2445
+
2446
+ f_overly_abstract_complex () = Complex (Ref {Number} (1 )[])
2447
+ @test Base. return_types (f_overly_abstract_complex, Tuple{}) == [Complex]
You can’t perform that action at this time.
0 commit comments