Have optimizer skip more code that is not typechecked.

This commit is contained in:
Vincent St-Amour 2015-10-13 14:57:05 -05:00
parent 3149b0a305
commit 6ccb0939f8
2 changed files with 15 additions and 3 deletions

View File

@ -24,9 +24,9 @@
(pattern opt:ignore-table^)
;; Can't optimize the body of this code because it isn't typechecked
(pattern (~and _:kw-lambda^
((~and op let-values)
([(i:id) e-rhs:opt-expr]) e-body:expr ...))
(pattern (~and (~or _:kw-lambda^ _:opt-lambda^)
((~and op let-values)
([(i:id) e-rhs:opt-expr]) e-body:expr ...))
#:with opt (quasisyntax/loc/origin this-syntax #'op
(op ([(i) e-rhs.opt]) e-body ...)))

View File

@ -0,0 +1,12 @@
#lang typed/racket/base
;; The optimizer now looks at all expressions regardless of shape (to log
;; all expressions with type (Vectorof Float) as candidates for uses of
;; flvectors).
;; This revealed that, previously, the optimizer did not skip the generated
;; body of optional arg function definitions (which is not typechecked, and so
;; should be skipped). It did for kw arg functions, but not optional.
;; This is now fixed, and this test is to guard against regressions.
(define (slicef-at [force? #f])
#f)