diff --git a/src/libtype.scm b/src/libtype.scm index 4be0fb727..0bd91a9f3 100644 --- a/src/libtype.scm +++ b/src/libtype.scm @@ -619,7 +619,8 @@ :subtype? (^[type super] (if (is-a? super ) (subtype? (~ type'primary-type) (~ super'primary-type)) - 'super)) + (and (of-type? #f super) + (subtype? (~ type'primary-type) super)))) :supertype? (^[type sub] (subtype? sub (~ type'primary-type)))) ;;; diff --git a/test/type.scm b/test/type.scm index 874be171c..addb23f88 100644 --- a/test/type.scm +++ b/test/type.scm @@ -87,7 +87,10 @@ (t-subtype ( ) #f) (t-subtype ( ) ( ) #t) (t-subtype ( ) #f) +(t-subtype ( ) #t) (t-subtype ( ) ( ( ) ( )) #t) +(t-subtype ( ) ( ) #t) +(t-subtype ( ) ( ) #f) (t-subtype ( ) #t) (t-subtype ( ) ( ) #t) @@ -139,6 +142,8 @@ (t-subtype ( 1 3) #t) (t-subtype ( 1 'a) ( ) #t) (t-subtype ( 1 'a) ( ) #f) +(t-subtype ( ( #f) ) ( ) #t) +(t-subtype ( ) ( ( #f) ) #t) (test-section "built-in type constructors")