@@ -265,6 +265,10 @@ function _types_are_equal(A::Type, B::Type)
265
265
ccall (:jl_types_equal , Cint, (Any, Any), A, B) != = Cint (0 )
266
266
end
267
267
268
+ function _type_is_bottom (X:: Type )
269
+ X <: Bottom
270
+ end
271
+
268
272
# # promotion mechanism ##
269
273
270
274
"""
@@ -340,21 +344,20 @@ function _promote_type_binary(T::Type, S::Type, recursion_depth_limit::Tuple{Var
340
344
@noinline
341
345
throw (_promote_type_binary_detected_infinite_recursion_exception)
342
346
end
343
- type_is_bottom (X:: Type ) = X <: Bottom
344
347
detect_loop_onesided (T:: Type , S:: Type , A:: Type , B:: Type ) = _types_are_equal (T, A) && _types_are_equal (S, B)
345
348
detect_loop (T:: Type , S:: Type , A:: Type , B:: Type ) = detect_loop_onesided (T, S, A, B) || detect_loop_onesided (T, S, B, A)
346
- if type_is_bottom (T)
349
+ if _type_is_bottom (T)
347
350
return S
348
351
end
349
- if type_is_bottom (S) || _types_are_equal (S, T)
352
+ if _type_is_bottom (S) || _types_are_equal (S, T)
350
353
return T
351
354
end
352
355
# Try promote_rule in both orders.
353
356
ts = promote_rule (T, S)
354
357
st = promote_rule (S, T)
355
358
# If no promote_rule is defined, both directions give Bottom. In that
356
359
# case use typejoin on the original types instead.
357
- if type_is_bottom (st) && type_is_bottom (ts)
360
+ if _type_is_bottom (st) && _type_is_bottom (ts)
358
361
return typejoin (T, S)
359
362
end
360
363
if detect_loop (T, S, ts, st)
0 commit comments