Track disappeared uses of match expanders within match forms (#1349)

This commit is contained in:
Alexis King 2016-06-27 11:13:12 -07:00 committed by Sam Tobin-Hochstadt
parent b9445023c1
commit 517c3cfef9
2 changed files with 64 additions and 63 deletions

View File

@ -21,6 +21,7 @@
;; this parses the clauses using parse, then compiles them ;; this parses the clauses using parse, then compiles them
;; go : syntax syntax syntax -> syntax ;; go : syntax syntax syntax -> syntax
(define (go parse stx es clauses) (define (go parse stx es clauses)
(with-disappeared-uses
(syntax-parse clauses (syntax-parse clauses
[([pats . rhs] ...) [([pats . rhs] ...)
(parameterize ([orig-stx stx]) (parameterize ([orig-stx stx])
@ -81,4 +82,4 @@
(let ([xs exprs*] ...) (let ([xs exprs*] ...)
(define (outer-fail) raise-error) (define (outer-fail) raise-error)
body)) body))
'feature-profile:pattern-matching #t)])) 'feature-profile:pattern-matching #t)])))

View File

@ -1,6 +1,7 @@
#lang racket/base #lang racket/base
(require racket/struct-info (require racket/struct-info
racket/syntax
"patterns.rkt" "patterns.rkt"
"parse-helper.rkt" "parse-helper.rkt"
"parse-quasi.rkt" "parse-quasi.rkt"
@ -29,8 +30,7 @@
(lambda (x y) (eq? (syntax-e x) (syntax-e y))) (lambda (x y) (eq? (syntax-e x) (syntax-e y)))
[(expander args ...) [(expander args ...)
(and (identifier? #'expander) (and (identifier? #'expander)
(match-expander? (syntax-local-value #'expander (syntax-local-value/record #'expander match-expander?))
(lambda () #f))))
(match-expander-transform (match-expander-transform
rearm+parse #'expander disarmed-stx match-expander-proc rearm+parse #'expander disarmed-stx match-expander-proc
"This expander only works with the legacy match syntax")] "This expander only works with the legacy match syntax")]