From f431fd94df3b5d6c16ef078c1ad93a5edf87c14f Mon Sep 17 00:00:00 2001 From: Vincent St-Amour Date: Thu, 5 May 2011 18:32:01 -0400 Subject: [PATCH] Add extra early failure cases to subtype* to avoid inference failures. original commit: d7fd2b2e3fad604677e04c405e7585dc2c48e872 --- collects/typed-scheme/types/subtype.rkt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/collects/typed-scheme/types/subtype.rkt b/collects/typed-scheme/types/subtype.rkt index 4d098fa4..3f836bd5 100644 --- a/collects/typed-scheme/types/subtype.rkt +++ b/collects/typed-scheme/types/subtype.rkt @@ -272,6 +272,16 @@ (dprintf "found unrelated structs: ~a ~a\n" s1 s2) (fail! s t)] [else (unmatch)])] + ;; similar case for structs and base types, which are obviously unrelated + [((Base: _ _ _ _) (or (? Struct? s1) (NameStruct: s1))) + (fail! s t)] + [((or (? Struct? s1) (NameStruct: s1)) (Base: _ _ _ _)) + (fail! s t)] + ;; same for Null + [((Value: '()) (or (? Struct? s1) (NameStruct: s1))) + (fail! s t)] + [((or (? Struct? s1) (NameStruct: s1)) (Value: '())) + (fail! s t)] ;; just checking if s/t is a struct misses recursive/union/etc cases [((? (lambda (_) (eq? ks 'struct))) (Base: _ _ _ _)) (fail! s t)] [((Base: _ _ _ _) (? (lambda (_) (eq? kt 'struct)))) (fail! s t)]