From f73ccaaf95e3e1ba56afb0e25beb631180f80e79 Mon Sep 17 00:00:00 2001 From: Kathy Gray Date: Fri, 27 Jan 2006 22:17:22 +0000 Subject: [PATCH] Changes to reflect name change of draw2 to graphics, tests for cyclic uses of interfaces svn: r2009 --- collects/profj/check.ss | 8 ++++---- collects/profj/to-scheme.ss | 6 +++--- collects/profj/tool.ss | 2 +- collects/tests/profj/beginner-tests.ss | 10 ++++++++++ 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/collects/profj/check.ss b/collects/profj/check.ss index 28f6c555ed..73fbf5638d 100644 --- a/collects/profj/check.ss +++ b/collects/profj/check.ss @@ -1366,11 +1366,11 @@ (add-required c-class "String" `("java" "lang") type-recs) (set-expr-type exp string-type)) ((eq? (expr-types exp) 'image) - (get-record (send type-recs get-class-record '("Image" "draw2") #f - ((get-importer type-recs) '("Image" "draw2") + (get-record (send type-recs get-class-record '("Image" "graphics") #f + ((get-importer type-recs) '("Image" "graphics") type-recs level (expr-src exp))) type-recs) - (add-required c-class "Image" `("draw2") type-recs) - (set-expr-type exp (make-ref-type "Image" '("draw2")))) + (add-required c-class "Image" `("graphics") type-recs) + (set-expr-type exp (make-ref-type "Image" '("graphics")))) (else (expr-types exp))) env)) ((bin-op? exp) (set-expr-type exp diff --git a/collects/profj/to-scheme.ss b/collects/profj/to-scheme.ss index 499ff6cbfd..005815054f 100644 --- a/collects/profj/to-scheme.ss +++ b/collects/profj/to-scheme.ss @@ -2052,8 +2052,8 @@ (make-image (lambda () `(let ((temp-obj (make-object ,(if (send (types) require-prefix? - '("Image" "draw2") (lambda () #f)) - 'draw2.Image + '("Image" "graphics") (lambda () #f)) + 'graphics.Image 'Image)))) (send temp-obj Image-constructor-dynamic ,value) temp-obj)))) @@ -2070,7 +2070,7 @@ (cond ((eq? type string-type) make-string) ((and (equal? "Image" (ref-type-class/iface type)) - (equal? '("draw2") (ref-type-path type))) + (equal? '("graphics") (ref-type-path type))) (make-image)) (else (error 'translate-literal (format "Translate literal given unknown type: ~s" type)))))) diff --git a/collects/profj/tool.ss b/collects/profj/tool.ss index 4211809c6a..1cdad31698 100644 --- a/collects/profj/tool.ss +++ b/collects/profj/tool.ss @@ -887,7 +887,7 @@ (cond ((and (equal? "Image" (send value my-name)) (object-method-arity-includes? value 'Image-constructor-dynamic 1) - (object-method-arity-includes? value 'movePinhole-draw2.Posn 1)) + (object-method-arity-includes? value 'movePinhole-graphics.Posn 1)) ;(printf "~a~n" ((send value fields-for-display))) (list (cadr ((send value fields-for-display))))) (else diff --git a/collects/tests/profj/beginner-tests.ss b/collects/tests/profj/beginner-tests.ss index ef761cf24b..1c6aabed18 100644 --- a/collects/tests/profj/beginner-tests.ss +++ b/collects/tests/profj/beginner-tests.ss @@ -10,6 +10,16 @@ ;;Execution tests that should pass + (execute-test + "interface A { + boolean s( B b); + } + class B implements A { + B() { } + boolean s( B b ) { return true; } + }" + language #f "Interface and class with cyclic reference") + (execute-test "class Simple { Simple() { }