Allow flvectors/fxvectors in Any contract

Closes PR 14374
This commit is contained in:
Asumu Takikawa 2014-03-03 12:00:22 -05:00
parent 8b4c5d3deb
commit 5c7046cab3
2 changed files with 17 additions and 1 deletions

View File

@ -1,6 +1,7 @@
#lang racket/base
(require racket/match racket/contract/base racket/contract/combinator
racket/fixnum racket/flonum
racket/set
(only-in (combine-in racket/private/promise)
promise?
@ -11,7 +12,11 @@
(define (base-val? e)
(or (number? e) (string? e) (char? e) (symbol? e)
(null? e) (regexp? e) (eq? undef e) (path? e)
(regexp? e) (keyword? e) (bytes? e) (boolean? e) (void? e)))
(regexp? e) (keyword? e) (bytes? e) (boolean? e) (void? e)
;; Base values because you can only store flonums/fixnums in these
;; and not any higher-order values. This isn't sound if we ever
;; introduce bounded polymorphism for Flvector/Fxvector.
(flvector? e) (fxvector? e)))
(define (val-first-projection b)
(define (fail neg-party v)

View File

@ -0,0 +1,11 @@
#lang typed/racket
;; Test for PR 14374. Ensure that flvector is okay for Any
(require typed/rackunit
racket/fixnum
racket/flonum)
(check-equal? (flvector 0.0) (flvector 0.0))
(check-equal? (fxvector 0) (fxvector 0))