diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/kw-types.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/kw-types.rkt index 6c025acc..74f9f964 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/kw-types.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/kw-types.rkt @@ -28,12 +28,10 @@ (define ts (flatten (list - (for/list ([k (in-list mand-kw-t)]) + (for/list ([k (in-list kw-t)]) (match k - [(Keyword: _ t _) t])) - (for/list ([k (in-list opt-kw-t)]) - (match k - [(Keyword: _ t _) (list (-opt t) -Boolean)])) + [(Keyword: _ t #t) t] + [(Keyword: _ t #f) (list (-opt t) -Boolean)])) plain-t (for/list ([t (in-list opt-t)]) (-opt t)) (for/list ([t (in-list opt-t)]) -Boolean) diff --git a/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/succeed/keyword-function-order.rkt b/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/succeed/keyword-function-order.rkt new file mode 100644 index 00000000..974d78f9 --- /dev/null +++ b/pkgs/typed-racket-pkgs/typed-racket-test/tests/typed-racket/succeed/keyword-function-order.rkt @@ -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)