fix match2 bug with nested user-defined datatypes
This commit is contained in:
parent
e9290629da
commit
d5435eb71b
|
@ -335,8 +335,9 @@
|
|||
#:with ((~literal #%plain-lambda) (RecName)
|
||||
((~literal let-values) ()
|
||||
((~literal let-values) ()
|
||||
. info-body)))
|
||||
. (((~literal #%plain-app) ((~literal quote) C) . rst) ...))))
|
||||
(get-extra-info #'ty)
|
||||
#:when (member (syntax->datum #'A) (syntax->datum #'(C ...)))
|
||||
#'()]
|
||||
[(x:id ty) #'((x ty))]
|
||||
[((p1 (unq p) ...) ty) ; comma tup stx
|
||||
|
@ -403,8 +404,9 @@
|
|||
#:with ((~literal #%plain-lambda) (RecName)
|
||||
((~literal let-values) ()
|
||||
((~literal let-values) ()
|
||||
. info-body)))
|
||||
. (((~literal #%plain-app) ((~literal quote) C) . rst) ...))))
|
||||
(get-extra-info ty)
|
||||
#:when (member (syntax->datum #'A) (syntax->datum #'(C ...)))
|
||||
(compile-pat #'(A) ty)]
|
||||
[x:id p]
|
||||
[(p1 (unq p) ...) ; comma tup stx
|
||||
|
@ -680,12 +682,10 @@
|
|||
(stx-map
|
||||
(lambda (tyin)
|
||||
(define old-orig (get-orig tyin))
|
||||
(displayln old-orig)
|
||||
(define new-orig
|
||||
(and old-orig
|
||||
(substs (stx-map get-orig #'(τ_solved ...)) #'Xs old-orig
|
||||
(lambda (x y) (equal? (syntax->datum x) (syntax->datum y))))))
|
||||
(displayln new-orig)
|
||||
(syntax-property tyin 'orig (list new-orig)))
|
||||
#'(τ_in ...)))
|
||||
(⊢ (#%app e_fn- e_arg- ...) : τ_out)])
|
||||
|
|
|
@ -110,3 +110,13 @@
|
|||
⇒ (Some (BQ (∷ 4 (∷ 5 (∷ 6 (∷ 7 (∷ 8 (∷ 9 Nil)))))) Nil)))
|
||||
|
||||
(check-type (>> (inst bq-head Int) bq-tails-result) : (Option Int) -> (Some 4))
|
||||
|
||||
;; check match2 nested datatype bug
|
||||
(check-type
|
||||
(match bq-tails-result with
|
||||
[None -> (None {Int})]
|
||||
[Some bq -> (bq-head bq)]) : (Option Int) -> (Some 4))
|
||||
(check-type
|
||||
(match2 bq-tails-result with
|
||||
[None -> (None {Int})]
|
||||
[Some bq -> (bq-head bq)]) : (Option Int) -> (Some 4))
|
||||
|
|
Loading…
Reference in New Issue
Block a user