diff --git a/collects/typed-racket/typecheck/tc-structs.rkt b/collects/typed-racket/typecheck/tc-structs.rkt index 04ad8f0710..34a416bb97 100644 --- a/collects/typed-racket/typecheck/tc-structs.rkt +++ b/collects/typed-racket/typecheck/tc-structs.rkt @@ -203,6 +203,7 @@ (add-struct-fn! s (make-StructPE poly-base i) #t) (cons s (poly-wrapper (->* (list poly-base t) -Void)))) null)))) + (add-struct-constructor! (struct-names-constructor names)) (cons (and si (make-def-struct-stx-binding (struct-names-type-name names) si)) (for/list ([b bindings]) diff --git a/collects/typed-racket/types/type-table.rkt b/collects/typed-racket/types/type-table.rkt index a0b9bf251b..b0a499bdd6 100644 --- a/collects/typed-racket/types/type-table.rkt +++ b/collects/typed-racket/types/type-table.rkt @@ -51,6 +51,11 @@ (define struct-fn-table (make-free-id-table)) +(define struct-constructor-table (make-free-id-table)) + +(define (add-struct-constructor! id) (dict-set! struct-constructor-table id #t)) +(define (struct-constructor? id) (dict-ref struct-constructor-table id #f)) + (define (add-struct-fn! id pe mut?) (dict-set! struct-fn-table id (list pe mut?))) (define-values (struct-accessor? struct-mutator?) @@ -96,17 +101,19 @@ (values (mk 'tautology) (mk 'contradiction) (mk 'neither)))) (provide/cond-contract - [add-typeof-expr (syntax? tc-results? . -> . any/c)] + [add-typeof-expr (syntax? tc-results? . -> . any)] [type-of (syntax? . -> . tc-results?)] - [reset-type-table (-> any/c)] - [add-struct-fn! (identifier? StructPE? boolean? . -> . any/c)] + [reset-type-table (-> any)] + [add-struct-fn! (identifier? StructPE? boolean? . -> . any)] + [add-struct-constructor! (identifier? . -> . any)] + [struct-constructor? (identifier? . -> . boolean?)] [struct-accessor? (identifier? . -> . (or/c #f StructPE?))] [struct-mutator? (identifier? . -> . (or/c #f StructPE?))] [struct-fn-idx (identifier? . -> . exact-integer?)] [make-struct-table-code (-> syntax?)] - [add-tautology (syntax? . -> . any/c)] - [add-contradiction (syntax? . -> . any/c)] - [add-neither (syntax? . -> . any/c)] + [add-tautology (syntax? . -> . any)] + [add-contradiction (syntax? . -> . any)] + [add-neither (syntax? . -> . any)] [tautology? (syntax? . -> . boolean?)] [contradiction? (syntax? . -> . boolean?)] [neither? (syntax? . -> . boolean?)])