diff --git a/collects/tests/typed-racket/succeed/het-vec.rkt b/collects/tests/typed-racket/succeed/het-vec.rkt index 7d4bc354..7edbb819 100644 --- a/collects/tests/typed-racket/succeed/het-vec.rkt +++ b/collects/tests/typed-racket/succeed/het-vec.rkt @@ -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) diff --git a/collects/tests/typed-racket/xfail/inst+special-case.rkt b/collects/tests/typed-racket/xfail/inst+special-case.rkt new file mode 100644 index 00000000..bf38d91e --- /dev/null +++ b/collects/tests/typed-racket/xfail/inst+special-case.rkt @@ -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)