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 original commit: f292a9c0f277bc07d0932ed67f893ca1cb022a43
This commit is contained in:
parent
0e02b13d28
commit
82fa4808d6
|
@ -262,17 +262,18 @@ This file defines two sorts of primitives. All of them are provided into any mod
|
|||
(if (Error? typ)
|
||||
;; This code should never get run, typechecking will have an error earlier
|
||||
#`(error 'make-predicate "Couldn't parse type")
|
||||
#`(ann
|
||||
#,(ignore-some-property
|
||||
(type->contract
|
||||
typ
|
||||
;; must be a flat contract
|
||||
#:kind 'flat
|
||||
;; the value is not from the typed side
|
||||
#:typed-side #f
|
||||
(type->contract-fail typ #'ty #:ctc-str "predicate"))
|
||||
#t)
|
||||
(Any -> Boolean : ty)))))]))
|
||||
#`(let ()
|
||||
(ann
|
||||
#,(ignore-some-property
|
||||
(type->contract
|
||||
typ
|
||||
;; must be a flat contract
|
||||
#:kind 'flat
|
||||
;; the value is not from the typed side
|
||||
#:typed-side #f
|
||||
(type->contract-fail typ #'ty #:ctc-str "predicate"))
|
||||
#t)
|
||||
(Any -> Boolean : ty))))))]))
|
||||
|
||||
(define-syntax (cast stx)
|
||||
(syntax-parse stx
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
#lang racket/load
|
||||
;; Test for PR 14030
|
||||
(require typed/racket)
|
||||
(make-predicate Integer)
|
||||
|
Loading…
Reference in New Issue
Block a user