Changed early failure in subtyping to all non-struct values, not just null. Closes PR 11887.
This commit is contained in:
parent
240d95ada6
commit
e9683e1dd2
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)
|
(env type-name-env)
|
||||||
(only-in (infer infer-dummy) unify)
|
(only-in (infer infer-dummy) unify)
|
||||||
racket/match unstable/match
|
racket/match unstable/match
|
||||||
|
racket/function
|
||||||
(rename-in racket/contract
|
(rename-in racket/contract
|
||||||
[-> c->] [->* c->*])
|
[-> c->] [->* c->*])
|
||||||
(for-syntax racket/base syntax/parse))
|
(for-syntax racket/base syntax/parse))
|
||||||
|
@ -277,10 +278,10 @@
|
||||||
(fail! s t)]
|
(fail! s t)]
|
||||||
[((or (? Struct? s1) (NameStruct: s1)) (Base: _ _ _ _))
|
[((or (? Struct? s1) (NameStruct: s1)) (Base: _ _ _ _))
|
||||||
(fail! s t)]
|
(fail! s t)]
|
||||||
;; same for Null
|
;; same for all values.
|
||||||
[((Value: '()) (or (? Struct? s1) (NameStruct: s1)))
|
[((Value: (? (negate struct?) _)) (or (? Struct? s1) (NameStruct: s1)))
|
||||||
(fail! s t)]
|
(fail! s t)]
|
||||||
[((or (? Struct? s1) (NameStruct: s1)) (Value: '()))
|
[((or (? Struct? s1) (NameStruct: s1)) (Value: (? (negate struct?) _)))
|
||||||
(fail! s t)]
|
(fail! s t)]
|
||||||
;; just checking if s/t is a struct misses recursive/union/etc cases
|
;; just checking if s/t is a struct misses recursive/union/etc cases
|
||||||
[((? (lambda (_) (eq? ks 'struct))) (Base: _ _ _ _)) (fail! s t)]
|
[((? (lambda (_) (eq? ks 'struct))) (Base: _ _ _ _)) (fail! s t)]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user