Don't set current-inspector in Typed Racket.

There's not a good way to do this dynamically, and the initial
approach breaks programs.

Reverts part of 191ec136b6.

Relevant to #385.
This commit is contained in:
Sam Tobin-Hochstadt 2016-07-09 19:40:38 -04:00
parent 5175f9d873
commit c3a1202df1
2 changed files with 5 additions and 18 deletions

View File

@ -5,8 +5,6 @@
"standard-inits.rkt")
;; these need to be available to the generated code
"typecheck/renamer.rkt" syntax/location
;; this defines the inspector that structs will use
"utils/inspector.rkt"
(for-syntax (submod "base-env/prims-contract.rkt" self-ctor))
(for-syntax "utils/struct-extraction.rkt")
(for-syntax "typecheck/renamer.rkt")
@ -18,14 +16,6 @@
with-type
(for-syntax do-standard-inits))
;; This sets the inspector that typed racket structs will use, so that
;; any-wrap/c can inspect them. This allows any-wrap/c to wrap structs
;; that are defined in typed racket, and to fail on structs that it
;; can't wrap safely.
;; https://github.com/racket/typed-racket/issues/379
;; https://github.com/racket/typed-racket/pull/385
(current-inspector new-inspector)
(define-syntax-rule (drivers [name sym] ...)
(begin
(begin-for-syntax

View File

@ -12,8 +12,7 @@
(only-in racket/udp udp?)
(only-in (combine-in racket/private/promise)
promise?
prop:force promise-forcer)
(only-in "inspector.rkt" old-inspector))
prop:force promise-forcer))
(define (base-val? e)
(or (number? e) (string? e) (char? e) (symbol? e)
@ -74,7 +73,7 @@
v
"Attempted to use a higher-order value passed as `Any` in untyped code: ~v" v))
(define (wrap-struct neg-party s inspector)
(define (wrap-struct neg-party s [inspector (current-inspector)])
(define blame+neg-party (cons b neg-party))
(define (extract-functions struct-type)
(define-values (sym init auto ref set! imms par skip?)
@ -172,8 +171,8 @@
(for/set ([i (in-set v)]) (any-wrap/traverse i neg-party))]
;; could do something with generic sets here if they had
;; chaperones, or if i could tell if they were immutable.
[(? (struct?/inspector old-inspector))
(wrap-struct neg-party v old-inspector)]
[(? struct?)
(wrap-struct neg-party v)]
[(? procedure?)
(chaperone-procedure v (lambda args (fail neg-party v)))]
[(? promise?)
@ -207,9 +206,7 @@
#:first-order (lambda (x) #t)
#:late-neg-projection late-neg-projection))
(define ((struct?/inspector inspector) v)
(parameterize ([current-inspector inspector])
(struct? v)))
(define ((struct?/inspector inspector) v) (struct? v))
;; Contract for "safe" struct predicate procedures.
;; We can trust that these obey the type (-> Any Boolean).