[regexp] set! already breaks type, dont need extra transformer I guess

This commit is contained in:
ben 2016-03-01 03:46:53 -05:00
parent faee889d96
commit 8a6411cae2
2 changed files with 23 additions and 0 deletions

View File

@ -33,6 +33,11 @@
(define rx "he(l*)(o*)") (define rx "he(l*)(o*)")
(regexp-match: rx "helloooooooo")) (regexp-match: rx "helloooooooo"))
(U #f (List String String String))) (U #f (List String String String)))
;; -- set! problems
(ann (let-regexp: ([a #rx"(b)(B)"])
(set! a #rx"")
(regexp-match: a "hai"))
(List String String String))
;; --- Can't handle |, yet ;; --- Can't handle |, yet
(ann (regexp-match: "this(group)|that" "that") (ann (regexp-match: "this(group)|that" "that")
(U #f (List String String))) (U #f (List String String)))

View File

@ -8,6 +8,24 @@
trivial/regexp trivial/regexp
typed/rackunit) typed/rackunit)
;; -- set! ruins everything
(check-equal?
(ann
(let ()
(define-regexp: a #rx"h(i)")
(set! a #rx"hi")
(regexp-match a "hi"))
(U #f (Pairof String (Listof (U #f String)))))
(list "hi"))
(check-equal?
(ann
(let-regexp: ([a #rx"h(i)"])
(set! a #rx"(h)(i)")
(regexp-match a "hi"))
(U #f (Pairof String (Listof (U #f String)))))
(list "hi" "h" "i"))
;; -- regexp-match: ;; -- regexp-match:
(check-equal? (check-equal?
(ann (ann