Add failing test case for instantiation and special typing rules.

original commit: 67af968a73de3df4b86e87c71a8023bc3c929e75
This commit is contained in:
Vincent St-Amour 2012-12-19 12:39:45 -05:00
parent 160d731c4a
commit 6991bbaad0
2 changed files with 15 additions and 0 deletions

View File

@ -8,3 +8,8 @@
(ann (vector-ref x 1) String)
(ann (vector-ref x y) Symbol)
(: ref : Integer -> (U Number String Symbol))
(define (ref i) (vector-ref x i))
(ann (vector-ref #(1.0 2.0) 0) Flonum)

View File

@ -0,0 +1,10 @@
#lang typed/racket
;; In tc-app, code paths for annotated operators and special case typing rules
;; (for, e.g., `vector-ref') are mutually exclusive.
;; The annotated operator case matches first and falls back to the regular
;; application rules, skipping the special cases.
;; This example, because it uses a heterogenous vector, needs the special type
;; rule, and therefore doesn't typecheck.
(ann ((inst vector-ref String) #(1.0) 0) Float)