From b7eeaf7608ee3e46f6c8923957362920af3c61b6 Mon Sep 17 00:00:00 2001 From: Asumu Takikawa Date: Thu, 30 Oct 2014 03:19:58 -0400 Subject: [PATCH] Fix ordering issue in typechecking inner calls Closes PR 14810 --- .../typecheck/check-class-unit.rkt | 4 ++-- .../typed-racket/unit-tests/class-tests.rkt | 24 ++++++++++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/check-class-unit.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/check-class-unit.rkt index bdaeea665b..90e3d5b313 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/check-class-unit.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/typecheck/check-class-unit.rkt @@ -738,8 +738,8 @@ (make-method-types (hash-ref parse-info 'augment-internals) augments)) (define inner-types (make-method-types - (set-union (hash-ref parse-info 'pubment-internals) - (hash-ref parse-info 'augment-internals)) + (append (hash-ref parse-info 'pubment-internals) + (hash-ref parse-info 'augment-internals)) augments #:inner? #t)) ;; construct field accessor types diff --git a/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/class-tests.rkt b/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/class-tests.rkt index b6b6564759..082c5ee9d5 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/class-tests.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/unit-tests/class-tests.rkt @@ -1550,4 +1550,26 @@ (super-new) (define/public (foo [i #f]) (void)))) (new a%)) - (-object #:method ([foo (cl->* (t:-> -Void) (t:-> -Integer -Void))]))])) + (-object #:method ([foo (cl->* (t:-> -Void) (t:-> -Integer -Void))]))] + ;; PR 14810 - make sure inner type mapping has the right order + [tc-e (let () + (define-type-alias Foo% + (Class [m (-> Any Symbol)] + [o (-> Any Any Symbol)] + (augment [m (-> Any Symbol)] + [o (-> Any Any Symbol)]))) + (define-type-alias Bar% (Class #:implements Foo%)) + (: foo% Foo%) + (define foo% + (class object% + (super-new) + (define/pubment (m x) 'foo-m) + (define/pubment (o x y) 'foo-o))) + (: bar% Bar%) + (define bar% + (class foo% + (super-new) + (define/augment (m x) (inner 'bar-m m x)) + (define/augment (o x y) (inner 'bar-o o x y)))) + (void)) + -Void]))