From e25b24986fc2c141a0abd8a4f6f4245f94d1f379 Mon Sep 17 00:00:00 2001 From: Asumu Takikawa Date: Mon, 5 Aug 2013 14:10:45 -0400 Subject: [PATCH] Fix a private/augment method issue --- .../typed-racket/typecheck/check-class-unit.rkt | 4 +++- .../tests/typed-racket/unit-tests/class-tests.rkt | 8 +++++++- 2 files changed, 10 insertions(+), 2 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 7d7ccd5c8e..096f3f4108 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 @@ -565,7 +565,9 @@ (for/list ([f (in-set names)]) (define pre-type (dict-ref type-map f #f)) (define maybe-type (if (pair? pre-type) (car pre-type) pre-type)) - (or (and maybe-type (fixup-method-type maybe-type self-type)) + (or (and maybe-type + (not (equal? maybe-type top-func)) + (fixup-method-type maybe-type self-type)) (make-Univ)))) (define private-method-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 91c3bd6fc7..a3a6a4d2db 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 @@ -1044,5 +1044,11 @@ (: c% (Class (field [x String]))) (define c% (class object% (super-new) - (field [x : Integer 5])))))) + (field [x : Integer 5])))) + + ;; fails, but make sure it's not an internal error + (check-err #:exn #rx"Cannot apply expression of type Any" + (class object% (super-new) + (define/pubment (foo x) 0) + (define/public (g x) (foo 3))))))