Changed early failure in subtyping to all non-struct values, not just null. Closes PR 11887.
original commit: e9683e1dd2f6544391cc603a6385baee59c6c07e
This commit is contained in:
parent
26a209d374
commit
a5bbee3ce3
9
collects/tests/typed-scheme/succeed/pr11887.rkt
Normal file
9
collects/tests/typed-scheme/succeed/pr11887.rkt
Normal file
|
@ -0,0 +1,9 @@
|
|||
#lang typed/racket
|
||||
|
||||
(define-struct: [e f] doll ((inside : (Option (doll e f)))
|
||||
(elt1 : e)
|
||||
(elt2 : f)))
|
||||
|
||||
(: singleton (All (e f) (e f -> (doll e f))))
|
||||
(define (singleton e f)
|
||||
(make-doll #f e f))
|
|
@ -6,6 +6,7 @@
|
|||
(env type-name-env)
|
||||
(only-in (infer infer-dummy) unify)
|
||||
racket/match unstable/match
|
||||
racket/function
|
||||
(rename-in racket/contract
|
||||
[-> c->] [->* c->*])
|
||||
(for-syntax racket/base syntax/parse))
|
||||
|
@ -277,10 +278,10 @@
|
|||
(fail! s t)]
|
||||
[((or (? Struct? s1) (NameStruct: s1)) (Base: _ _ _ _))
|
||||
(fail! s t)]
|
||||
;; same for Null
|
||||
[((Value: '()) (or (? Struct? s1) (NameStruct: s1)))
|
||||
;; same for all values.
|
||||
[((Value: (? (negate struct?) _)) (or (? Struct? s1) (NameStruct: s1)))
|
||||
(fail! s t)]
|
||||
[((or (? Struct? s1) (NameStruct: s1)) (Value: '()))
|
||||
[((or (? Struct? s1) (NameStruct: s1)) (Value: (? (negate struct?) _)))
|
||||
(fail! s t)]
|
||||
;; just checking if s/t is a struct misses recursive/union/etc cases
|
||||
[((? (lambda (_) (eq? ks 'struct))) (Base: _ _ _ _)) (fail! s t)]
|
||||
|
|
Loading…
Reference in New Issue
Block a user