From 8d3aac092ac64d7bfe7383889b1a41ae165e45f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Georges=20Dup=C3=A9ron?= Date: Mon, 5 Sep 2016 00:04:04 +0200 Subject: [PATCH] Skip some tests in racket < 6.3 as the type inference is not good enough to make them work there. There are alternative versions of these tests which don't rely so much on inference and are included. --- info.rkt | 2 +- test/test-poly.rkt | 72 ++++++++++++++++++++++++++-------------------- 2 files changed, 42 insertions(+), 32 deletions(-) diff --git a/info.rkt b/info.rkt index 8c88a9e..4d735ea 100644 --- a/info.rkt +++ b/info.rkt @@ -14,5 +14,5 @@ " in Typed/Racket. The API should hopefully stay" " backward-compatible when Typed/Racket officially supports" " (or rejects) structure type properties.")) -(define version "0.0") +(define version "1.0") (define pkg-authors '("Georges Dupéron")) diff --git a/test/test-poly.rkt b/test/test-poly.rkt index b2ac285..5e21ed4 100644 --- a/test/test-poly.rkt +++ b/test/test-poly.rkt @@ -1,40 +1,50 @@ #lang typed/racket +(define-syntax (skip<6.3 stx) + (syntax-case stx () + [(_ . rest) + (if (or (regexp-match #px"^6(\\.[012](\\..*|)|)$" (version)) + (regexp-match #px"^[123245]\\..*$" (version))) + #'(begin) + #'(begin . rest))])) + (require typed-struct-props typed/rackunit) -(struct/props (A) foo1 ([f : A] [g : A]) #:transparent - #:property prop:custom-write - (λ (this out mode) - (write (ann (list (foo1-f this) - (foo1-g this)) - (Listof A)) - out))) +(skip<6.3 + (struct/props (A) foo1 ([f : A] [g : A]) #:transparent + #:property prop:custom-write + (λ (this out mode) + (write (ann (list (foo1-f this) + (foo1-g this)) + (Listof A)) + out)))) -(struct/props (A) foo2 ([f : A] [g : A]) #:transparent - #:property prop:equal+hash - (list (λ (a b rec) - ;; We can access the A ... here, but not the A' ... - (ann (list (foo2-f a) - (foo2-g a)) - (Listof A)) - #f) - (λ (a rec) - ;; Type inference works, despite the lambda being in a - ;; list, because we detect the special case where a list - ;; is immediately constructed. - (ann (list (foo2-f a) - (foo2-g a)) - (Listof A)) - 42) - (λ (a rec) - ;; Type inference works, despite the lambda being in a - ;; list, because we detect the special case where a list - ;; is immediately constructed. - (ann (list (foo2-f a) - (foo2-g a)) - (Listof A)) - 43))) +(skip<6.3 + (struct/props (A) foo2 ([f : A] [g : A]) #:transparent + #:property prop:equal+hash + (list (λ (a b rec) + ;; We can access the A ... here, but not the A' ... + (ann (list (foo2-f a) + (foo2-g a)) + (Listof A)) + #f) + (λ (a rec) + ;; Type inference works, despite the lambda being in a + ;; list, because we detect the special case where a list + ;; is immediately constructed. + (ann (list (foo2-f a) + (foo2-g a)) + (Listof A)) + 42) + (λ (a rec) + ;; Type inference works, despite the lambda being in a + ;; list, because we detect the special case where a list + ;; is immediately constructed. + (ann (list (foo2-f a) + (foo2-g a)) + (Listof A)) + 43)))) (struct/props (A) foo3 ([f : A] [g : A]) #:transparent #:property prop:custom-write