diff --git a/collects/typed-scheme/ts-reference.scrbl b/collects/typed-scheme/ts-reference.scrbl index 824ff0466b..f52c4a9804 100644 --- a/collects/typed-scheme/ts-reference.scrbl +++ b/collects/typed-scheme/ts-reference.scrbl @@ -258,7 +258,8 @@ Scheme. @index["opaque"]{The fourth case} defines a new type @scheme[t]. @scheme[pred], imported from module @scheme[m], is a predicate for this type. The type is defined as precisely those values to which @scheme[pred] produces -@scheme[#t]. @scheme[pred] must have type @scheme[(Any -> Boolean)]. +@scheme[#t]. @scheme[pred] must have type @scheme[(Any -> Boolean)]. +Opaque types must be required lexically before they are used. In all cases, the identifiers are protected with @rtech{contracts} which enforce the specified types. If this contract fails, the module diff --git a/collects/typed-scheme/typecheck/tc-structs.ss b/collects/typed-scheme/typecheck/tc-structs.ss index 47bcd92a23..d1d37b38d8 100644 --- a/collects/typed-scheme/typecheck/tc-structs.ss +++ b/collects/typed-scheme/typecheck/tc-structs.ss @@ -51,7 +51,7 @@ (syntax-case nm/par () [nm (identifier? #'nm) (values #'nm #f #f (syntax-e #'nm) (make-F (syntax-e #'nm)))] [(nm par) (let* ([parent0 (parse-type #'par)] - [parent (resolve-name parent0)]) + [parent (if (Name? parent0) (resolve-name parent0) (tc-error/stx #'par "parent type not a valid structure name: ~a" (syntax->datum #'par)))]) (values #'nm parent0 parent (syntax-e #'nm) (make-F (syntax-e #'nm))))] [_ (int-err "not a parent: ~a" (syntax->datum nm/par))]))