Remove unused code in subst-gen, and remove internal error.
This commit is contained in:
parent
7e7350691f
commit
6cc10cdb18
|
@ -716,39 +716,18 @@
|
||||||
;; was found. If we're at this point and had no other constraints, then adding the
|
;; was found. If we're at this point and had no other constraints, then adding the
|
||||||
;; equivalent of the constraint (dcon null (c Bot X Top)) is okay.
|
;; equivalent of the constraint (dcon null (c Bot X Top)) is okay.
|
||||||
(define (extend-idxs S)
|
(define (extend-idxs S)
|
||||||
(define fi-R (fi R))
|
(hash-union
|
||||||
;; If the index variable v is not used in the type, then
|
(for/hash ([v (in-list Y)]
|
||||||
;; we allow it to be replaced with the empty list of types;
|
#:unless (hash-has-key? S v))
|
||||||
;; otherwise we error, as we do not yet know what an appropriate
|
(let ([var (hash-ref idx-hash v Constant)])
|
||||||
;; lower bound is.
|
(values v
|
||||||
(define (demote/check-free v)
|
(evcase var
|
||||||
(if (memq v fi-R)
|
[Constant (i-subst null)]
|
||||||
(int-err "attempted to demote dotted variable")
|
[Covariant (i-subst null)]
|
||||||
(i-subst null)))
|
[Contravariant (i-subst/starred null Univ)]
|
||||||
;; absent-entries is #f if there's an error in the substitution, otherwise
|
;; TODO figure out if there is a better subst here
|
||||||
;; it's a list of variables that don't appear in the substitution
|
[Invariant (i-subst null)]))))
|
||||||
(define absent-entries
|
S))
|
||||||
(for/fold ([no-entry null]) ([v (in-list Y)])
|
|
||||||
(let ([entry (hash-ref S v #f)])
|
|
||||||
;; Make sure we got a subst entry for an index var
|
|
||||||
;; (i.e. a list of types for the fixed portion
|
|
||||||
;; and a type for the starred portion)
|
|
||||||
(cond
|
|
||||||
[(not no-entry) no-entry]
|
|
||||||
[(not entry) (cons v no-entry)]
|
|
||||||
[(or (i-subst? entry) (i-subst/starred? entry) (i-subst/dotted? entry)) no-entry]
|
|
||||||
[else #f]))))
|
|
||||||
(and absent-entries
|
|
||||||
(hash-union
|
|
||||||
(for/hash ([missing (in-list absent-entries)])
|
|
||||||
(let ([var (hash-ref idx-hash missing Constant)])
|
|
||||||
(values missing
|
|
||||||
(evcase var
|
|
||||||
[Constant (demote/check-free missing)]
|
|
||||||
[Covariant (demote/check-free missing)]
|
|
||||||
[Contravariant (i-subst/starred null Univ)]
|
|
||||||
[Invariant (demote/check-free missing)]))))
|
|
||||||
S)))
|
|
||||||
(match (car (cset-maps C))
|
(match (car (cset-maps C))
|
||||||
[(cons cmap (dmap dm))
|
[(cons cmap (dmap dm))
|
||||||
(let ([subst (hash-union
|
(let ([subst (hash-union
|
||||||
|
|
|
@ -109,9 +109,7 @@
|
||||||
(infer-t (-v a) (-v b) #:vars '(b))
|
(infer-t (-v a) (-v b) #:vars '(b))
|
||||||
|
|
||||||
(infer-t (make-ListDots -Symbol 'b) (-lst -Symbol) #:indices '(b)
|
(infer-t (make-ListDots -Symbol 'b) (-lst -Symbol) #:indices '(b)
|
||||||
;; TODO Figure out why this doesnt' work
|
#:result [(make-ListDots (-v b) 'b) -Null])
|
||||||
#;#;
|
|
||||||
#:result [(make-ListDots (-v b) 'b) (-lst Univ)])
|
|
||||||
(infer-t (make-ListDots (-v a) 'b) (-lst -Symbol) #:vars '(a) #:indices '(b)
|
(infer-t (make-ListDots (-v a) 'b) (-lst -Symbol) #:vars '(a) #:indices '(b)
|
||||||
#:result [(-lst* (make-ListDots (-v b) 'b) (-v a))
|
#:result [(-lst* (make-ListDots (-v b) 'b) (-v a))
|
||||||
(-lst* (-lst -Bottom) -Bottom)])
|
(-lst* (-lst -Bottom) -Bottom)])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user