From 3908da65f5d78d11f4b8672edaa204642be46d95 Mon Sep 17 00:00:00 2001 From: Eric Dobson Date: Sun, 17 Feb 2013 09:51:57 -0800 Subject: [PATCH] Make struct types overlap with procedures. Closes PR11971. original commit: 0b87c999b3113bf378f7c79578a6e65c28e1df67 --- collects/tests/typed-racket/succeed/pr11971.rkt | 14 ++++++++++++++ collects/typed-racket/rep/type-rep.rkt | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 collects/tests/typed-racket/succeed/pr11971.rkt diff --git a/collects/tests/typed-racket/succeed/pr11971.rkt b/collects/tests/typed-racket/succeed/pr11971.rkt new file mode 100644 index 00000000..6002f521 --- /dev/null +++ b/collects/tests/typed-racket/succeed/pr11971.rkt @@ -0,0 +1,14 @@ +#lang racket/load + +(module a racket + (provide (struct-out foo)) + (define-struct foo (proc) #:property prop:procedure (struct-field-index proc))) + +(module b typed/racket + (require/typed 'a + (struct foo ((proc : (Number Number -> Number))))) + (if (procedure? (foo +)) + #t + (error 'wrong-branch))) + +(require 'b) diff --git a/collects/typed-racket/rep/type-rep.rkt b/collects/typed-racket/rep/type-rep.rkt index 86299155..8fff15a0 100644 --- a/collects/typed-racket/rep/type-rep.rkt +++ b/collects/typed-racket/rep/type-rep.rkt @@ -328,7 +328,8 @@ (and proc (type-rec-id proc)) poly? pred-id)] - [#:key 'struct]) + ;; This should eventually be based on understanding of struct properties. + [#:key '(struct procedure)]) ;; A structure type descriptor ;; s : struct