Fix a bug in typechecking kw function application
Mandatory kw arguments in function types could confuse the typechecker when the function had the `syntax-procedure-converted-arguments-property` property set.
This commit is contained in:
parent
96310d823e
commit
a70588ac4f
|
@ -28,12 +28,10 @@
|
||||||
(define ts
|
(define ts
|
||||||
(flatten
|
(flatten
|
||||||
(list
|
(list
|
||||||
(for/list ([k (in-list mand-kw-t)])
|
(for/list ([k (in-list kw-t)])
|
||||||
(match k
|
(match k
|
||||||
[(Keyword: _ t _) t]))
|
[(Keyword: _ t #t) t]
|
||||||
(for/list ([k (in-list opt-kw-t)])
|
[(Keyword: _ t #f) (list (-opt t) -Boolean)]))
|
||||||
(match k
|
|
||||||
[(Keyword: _ t _) (list (-opt t) -Boolean)]))
|
|
||||||
plain-t
|
plain-t
|
||||||
(for/list ([t (in-list opt-t)]) (-opt t))
|
(for/list ([t (in-list opt-t)]) (-opt t))
|
||||||
(for/list ([t (in-list opt-t)]) -Boolean)
|
(for/list ([t (in-list opt-t)]) -Boolean)
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
#lang racket/base
|
||||||
|
|
||||||
|
;; Tests for keyword ordering issues with mandatory keyword
|
||||||
|
;; arguments
|
||||||
|
|
||||||
|
(module a racket
|
||||||
|
(define (f a #:w [w "w"] #:x x #:y [y "y"]) x)
|
||||||
|
(provide f))
|
||||||
|
|
||||||
|
(module b typed-racket/base-env/extra-env-lang
|
||||||
|
(require (submod ".." a))
|
||||||
|
(type-environment
|
||||||
|
[f (->key -Symbol
|
||||||
|
;; this alphabetic ordering of keywords should
|
||||||
|
;; be preserved in the kw type conversion for applications,
|
||||||
|
;; rather than separating mandatory/optional as for lambdas
|
||||||
|
#:w -String #f
|
||||||
|
#:x -Symbol #t
|
||||||
|
#:y -String #f
|
||||||
|
-Symbol)]))
|
||||||
|
|
||||||
|
(module c typed/racket
|
||||||
|
(require (submod ".." b))
|
||||||
|
(f 'a #:x 'x))
|
||||||
|
|
||||||
|
(require 'c)
|
Loading…
Reference in New Issue
Block a user