Make TR contract generation not wrap everything in recursive contract.

Eta expand struct predicates, as this was the reason for recursive
contracts in the first place.

Closes PR 14611.

original commit: 72d11286042959e8e7103bf23a1ab7a2970bd8b8
This commit is contained in:
Eric Dobson 2014-06-29 17:23:51 -07:00
parent b534242051
commit 6031c0697b

View File

@ -91,12 +91,7 @@
#:kind kind
(type->contract-fail typ prop))])
(ignore ; should be ignored by the optimizer
(quasisyntax/loc
stx
(define-values (n)
(recursive-contract
cnt
#,(contract-kind->keyword kind)))))))]
(quasisyntax/loc stx (define-values (n) cnt)))))]
[_ (int-err "should never happen - not a define-values: ~a"
(syntax->datum stx))]))
@ -455,7 +450,7 @@
nm (recursive-sc-use nm*)))))
(recursive-sc (list nm*) (list (struct/sc nm (ormap values mut?) fields))
(recursive-sc-use nm*))]
[else (flat/sc #`(flat-named-contract '#,(syntax-e pred?) #,pred?))])]
[else (flat/sc #`(flat-named-contract '#,(syntax-e pred?) (lambda (x) (#,pred? x))))])]
[(Syntax: (Base: 'Symbol _ _ _)) identifier?/sc]
[(Syntax: t)
(syntax/sc (t->sc t))]