Skip to content

Commit 229efbb

Browse files
committed
slight refactor
1 parent 124acec commit 229efbb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

base/promotion.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,8 @@ function _promote_type_binary(T::Type, S::Type, recursion_depth_limit::Tuple{Var
341341
throw(_promote_type_binary_detected_infinite_recursion_exception)
342342
end
343343
type_is_bottom(X::Type) = X <: Bottom
344-
detect_loop(T::Type, S::Type, A::Type, B::Type) = _types_are_equal(T, A) && _types_are_equal(S, B)
344+
detect_loop_onesided(T::Type, S::Type, A::Type, B::Type) = _types_are_equal(T, A) && _types_are_equal(S, B)
345+
detect_loop(T::Type, S::Type, A::Type, B::Type) = detect_loop_onesided(T, S, A, B) || detect_loop_onesided(T, S, B, A)
345346
if type_is_bottom(T)
346347
return S
347348
end
@@ -356,7 +357,7 @@ function _promote_type_binary(T::Type, S::Type, recursion_depth_limit::Tuple{Var
356357
if type_is_bottom(st) && type_is_bottom(ts)
357358
return typejoin(T, S)
358359
end
359-
if detect_loop(T, S, ts, st) || detect_loop(T, S, st, ts)
360+
if detect_loop(T, S, ts, st)
360361
# This is not strictly necessary, as we already limit the recursion depth, but
361362
# makes for nicer UX.
362363
err_detected_infinite_recursion()

0 commit comments

Comments
 (0)