Skip to content

Commit 522875a

Browse files
authored
Merge pull request #1309 from herbie-fp/autofix-35-1
Automated Resyntax fixes
2 parents ef7a2ad + 14758da commit 522875a

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

src/core/egg-herbie.rkt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,8 @@
301301
(list 'if (loop cond (get-representation 'bool)) (loop ift type) (loop iff type))
302302
(list 'if (loop cond 'bool) (loop ift type) (loop iff type)))]
303303
[(list (? impl-exists? impl) args ...) (cons impl (map loop args (impl-info impl 'itype)))]
304-
[(list (? (λ (x) (string-contains? (~a x) "unsound")) op) args ...)
304+
[(list op args ...)
305+
#:when (string-contains? (~a op) "unsound")
305306
(define op* (string->symbol (string-replace (symbol->string (car expr)) "unsound-" "")))
306307
(cons op* (map loop args (map (const 'real) args)))]
307308
[(list op args ...) (cons op (map loop args (operator-info op 'itype)))])))

src/core/preprocess.rkt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@
165165
(define repr (context-lookup context a))
166166
(define fmin (get-fpcore-impl 'fmin (repr->prop repr) (list repr repr)))
167167
(define fmax (get-fpcore-impl 'fmax (repr->prop repr) (list repr repr)))
168-
(replace-vars (list (cons a (list fmin a b)) (cons b (list fmax a b))) expression)]
168+
(replace-vars (list (list a fmin a b) (list b fmax a b)) expression)]
169169
[(list 'abs var)
170170
(define repr (context-lookup context var))
171171
(define fabs (get-fpcore-impl 'fabs (repr->prop repr) (list repr)))

src/core/test-rules.rkt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121

2222
(define (drop-unsound expr)
2323
(match expr
24-
[(list (? (λ (x) (string-contains? (~a x) "unsound")) op) args ...)
24+
[(list op args ...)
25+
#:when (string-contains? (~a op) "unsound")
2526
(define op* (string->symbol (string-replace (symbol->string (car expr)) "unsound-" "")))
2627
(cons op* (map drop-unsound args))]
2728
[_ expr]))

0 commit comments

Comments
 (0)