From 9ca8361ced3066a965557a7e1a4ebe79737c663e Mon Sep 17 00:00:00 2001 From: Asumu Takikawa Date: Fri, 24 May 2013 11:19:57 -0400 Subject: [PATCH] Don't add super-type inits into type with #:extends original commit: 4543204e859cddfa6abacd52ff725ceb6dca6ee6 --- .../typed-racket/private/parse-type.rkt | 15 +++++---------- .../typed-racket/unit-tests/parse-type-tests.rkt | 3 +++ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/private/parse-type.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/private/parse-type.rkt index b7d33ea2..93baa81f 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/private/parse-type.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/private/parse-type.rkt @@ -619,9 +619,6 @@ ;; if any duplicates are found between this class and the superclass ;; type, then raise an error - (check-duplicate-clause - (append init-names init-field-names super-init-names) - "init or init-field name ~a conflicts with #:extends clause") (check-duplicate-clause (append field-names init-field-names super-field-names) "field or init-field name ~a conflicts with #:extends clause") @@ -629,14 +626,12 @@ (append method-names super-method-names) "method name ~a conflicts with #:extends clause") - ;; then append the super types if there were no errors (define inits - (append - super-inits - (map list - (append init-names init-field-names) - (append init-types init-field-types) - (append init-optional?s init-field-optional?s)))) + (map list + (append init-names init-field-names) + (append init-types init-field-types) + (append init-optional?s init-field-optional?s))) + ;; then append the super types if there were no errors (define fields (append super-fields diff --git a/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/parse-type-tests.rkt b/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/parse-type-tests.rkt index dfa70b4e..f880e391 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/parse-type-tests.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/parse-type-tests.rkt @@ -225,6 +225,9 @@ ;; test #:extends [(Class #:extends (Class [m (Number -> Number)]) (field [x Number])) (make-Class #f null `((x ,-Number)) `((m ,(t:-> N N))))] + [(Class #:extends (Class (init [x Integer]) [m (Number -> Number)]) + (field [x Number])) + (make-Class #f null `((x ,-Number)) `((m ,(t:-> N N))))] [FAIL (Class #:extends (Class [m (Number -> Number)]) [m String])] ))