Skip to content

Commit 26d2e19

Browse files
authored
Revert "improve constraint propagation with && in || (#43142)" (#43293)
This reverts commit 2c057f8.
1 parent 45d43f3 commit 26d2e19

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

src/julia-syntax.scm

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1654,13 +1654,17 @@
16541654
(define (expand-or e)
16551655
(let ((e (cdr (flatten-ex '|\|\|| e))))
16561656
(let loop ((tail e))
1657-
(cond ((null? tail)
1658-
'(false))
1659-
((null? (cdr tail))
1660-
(car tail))
1661-
(else `(if ,(car tail)
1662-
(true)
1663-
,(loop (cdr tail))))))))
1657+
(if (null? tail)
1658+
'(false)
1659+
(if (null? (cdr tail))
1660+
(car tail)
1661+
(if (symbol-like? (car tail))
1662+
`(if ,(car tail) ,(car tail)
1663+
,(loop (cdr tail)))
1664+
(let ((g (make-ssavalue)))
1665+
`(block (= ,g ,(car tail))
1666+
(if ,g ,g
1667+
,(loop (cdr tail)))))))))))
16641668

16651669
(define (expand-for lhss itrs body)
16661670
(define (outer? x) (and (pair? x) (eq? (car x) 'outer)))

test/compiler/inference.jl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3836,9 +3836,3 @@ end |> only == Int
38363836
end
38373837
end |> only === Union{UnionNarrowingByIsdefinedA, UnionNarrowingByIsdefinedB}
38383838
end
3839-
3840-
# issue #43130
3841-
@test Base.return_types((Any,Type)) do uw, ti
3842-
(uw isa DataType && ti <: uw.name.wrapper) || return nothing
3843-
uw
3844-
end[] === Union{DataType, Nothing}

0 commit comments

Comments
 (0)