Don't allow nullary functions under Any
to be called.
Closes PR 14173. original commit: 5bda93dfd5feef6dc31816566a156e1514f70151
This commit is contained in:
parent
5db372b4fc
commit
a9844f072f
|
@ -99,10 +99,7 @@
|
|||
;; chaperones, or if i could tell if they were immutable.
|
||||
[(? struct?) (wrap-struct neg-party v)]
|
||||
[(? procedure?)
|
||||
(if (procedure-arity-includes? v 0)
|
||||
(chaperone-procedure v (case-lambda [() (values)]
|
||||
[_ (fail neg-party v)]))
|
||||
(chaperone-procedure v (lambda args (fail neg-party v))))]
|
||||
(chaperone-procedure v (lambda args (fail neg-party v)))]
|
||||
[(? promise?)
|
||||
(chaperone-struct
|
||||
v
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
#;
|
||||
(exn-pred "use a higher-order value")
|
||||
#lang racket
|
||||
|
||||
(module t typed/racket #:no-optimize
|
||||
(provide f g)
|
||||
|
||||
(define f (ann (case-lambda [() (add1 "hello")] [(x) x]) (Number -> Number)))
|
||||
(define g (ann f Any)))
|
||||
|
||||
(require 't)
|
||||
(f 1)
|
||||
(g)
|
|
@ -296,6 +296,7 @@
|
|||
;; Needed for constructing TR types in expected values
|
||||
(for-syntax
|
||||
(rep type-rep filter-rep object-rep)
|
||||
(base-env base-structs)
|
||||
(rename-in (types abbrev union numeric-tower filter-ops utils resolve)
|
||||
[Un t:Un]
|
||||
[-> t:->])))
|
||||
|
@ -3177,12 +3178,11 @@
|
|||
#:msg #rx"expected: Symbol.*given: Any"]
|
||||
|
||||
[tc-err
|
||||
(raise (λ ([x : Number]) (add1 x)))
|
||||
#:ret (ret (Un))]
|
||||
(raise (λ ([x : Number]) (add1 x)))]
|
||||
|
||||
[tc-err
|
||||
(exn:fail:syntax "" (current-continuation-marks) (list (datum->syntax #f add1)))
|
||||
#:ret (ret -Exn)]
|
||||
(raise (exn:fail:syntax "" (current-continuation-marks)
|
||||
(list (datum->syntax #f add1))))]
|
||||
|
||||
;; PR 14218
|
||||
[tc-e (ann (values "foo" "bar") (Values String String))
|
||||
|
|
Loading…
Reference in New Issue
Block a user