Fix make-predicate at the top-level

This solves the immediate problem, but more generally the
handling of ignored syntax at the top-level seems very fishy.
There is a complicated protocol involving the top-level
type-checker returning #<void> for cases with no obvious
return type, but it's unclear if it actually works. That
code in tc-toplevel.rkt should be revamped in the future.

Closes PR 14030

Please merge into 6.0
(cherry picked from commit f292a9c0f2)
This commit is contained in:
Asumu Takikawa 2013-11-20 17:58:50 -05:00 committed by Ryan Culpepper
parent fff9125165
commit b3e3acb85b
2 changed files with 17 additions and 11 deletions

View File

@ -262,17 +262,18 @@ This file defines two sorts of primitives. All of them are provided into any mod
(if (Error? typ) (if (Error? typ)
;; This code should never get run, typechecking will have an error earlier ;; This code should never get run, typechecking will have an error earlier
#`(error 'make-predicate "Couldn't parse type") #`(error 'make-predicate "Couldn't parse type")
#`(ann #`(let ()
#,(ignore-some-property (ann
(type->contract #,(ignore-some-property
typ (type->contract
;; must be a flat contract typ
#:kind 'flat ;; must be a flat contract
;; the value is not from the typed side #:kind 'flat
#:typed-side #f ;; the value is not from the typed side
(type->contract-fail typ #'ty #:ctc-str "predicate")) #:typed-side #f
#t) (type->contract-fail typ #'ty #:ctc-str "predicate"))
(Any -> Boolean : ty)))))])) #t)
(Any -> Boolean : ty))))))]))
(define-syntax (cast stx) (define-syntax (cast stx)
(syntax-parse stx (syntax-parse stx

View File

@ -0,0 +1,5 @@
#lang racket/load
;; Test for PR 14030
(require typed/racket)
(make-predicate Integer)