From 6991bbaad0d8229fb1d9e488c0526b6c563090bd Mon Sep 17 00:00:00 2001 From: Vincent St-Amour Date: Wed, 19 Dec 2012 12:39:45 -0500 Subject: [PATCH] Add failing test case for instantiation and special typing rules. original commit: 67af968a73de3df4b86e87c71a8023bc3c929e75 --- collects/tests/typed-racket/succeed/het-vec.rkt | 5 +++++ .../tests/typed-racket/xfail/inst+special-case.rkt | 10 ++++++++++ 2 files changed, 15 insertions(+) create mode 100644 collects/tests/typed-racket/xfail/inst+special-case.rkt 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)