Avoid printing results of tests when eliminating if branches at the toplevel.
Closes PR 11928.
This commit is contained in:
parent
1ed0e84791
commit
8f6d3c7920
|
@ -1,8 +1,8 @@
|
|||
#;
|
||||
(
|
||||
#f line #f col #f - op - dead else branch
|
||||
dead-else.rkt line 15 col 13 - (#%app + (quote 4.0) (quote 5.0)) - dead else branch
|
||||
dead-else.rkt line 14 col 14 - + - binary float
|
||||
#f line #f col #f - op - dead else branch
|
||||
dead-else.rkt line 18 col 13 - (#%app + (quote 4.0) (quote 5.0)) - dead else branch
|
||||
dead-else.rkt line 17 col 14 - + - binary float
|
||||
5.05.0
|
||||
)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#;
|
||||
(
|
||||
#f line #f col #f - op - dead then branch
|
||||
dead-then.rkt line 14 col 13 - (#%app + (quote 2.0) (quote 3.0)) - dead then branch
|
||||
dead-then.rkt line 15 col 14 - + - binary float
|
||||
#f line #f col #f - op - dead then branch
|
||||
dead-then.rkt line 17 col 13 - (#%app + (quote 2.0) (quote 3.0)) - dead then branch
|
||||
dead-then.rkt line 18 col 14 - + - binary float
|
||||
9.09.0
|
||||
)
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
#;
|
||||
(
|
||||
silent-dead-branch.rkt 12:0 (let-values () (quote 1)) -- dead then branch
|
||||
)
|
||||
|
||||
#lang typed/racket
|
||||
|
||||
;; then branch gets eliminated, which puts the test in a begin
|
||||
;; however, doing that at the toplevel causes the result of (number? "1")
|
||||
;; to be printed, which is bad.
|
||||
;; this was PR 11928
|
||||
(when (number? "1") 1)
|
|
@ -15,12 +15,12 @@
|
|||
(pattern (if tst:expr thn:expr els:expr)
|
||||
#:when (tautology? #'tst)
|
||||
#:with opt
|
||||
(begin (log-optimization "dead else branch" #'op)
|
||||
#`(begin #,((optimize) #'tst)
|
||||
(begin (log-optimization "dead else branch" #'els)
|
||||
#`(begin (void #,((optimize) #'tst))
|
||||
#,((optimize) #'thn))))
|
||||
(pattern (if tst:expr thn:expr els:expr)
|
||||
#:when (contradiction? #'tst)
|
||||
#:with opt
|
||||
(begin (log-optimization "dead then branch" #'op)
|
||||
#`(begin #,((optimize) #'tst)
|
||||
(begin (log-optimization "dead then branch" #'thn)
|
||||
#`(begin (void #,((optimize) #'tst))
|
||||
#,((optimize) #'els)))))
|
||||
|
|
Loading…
Reference in New Issue
Block a user