Skip to content

Commit

Permalink
Catch another case in contract ellipses shortcut (#248)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackfirth authored Aug 30, 2024
1 parent cec0272 commit 9c9992c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions default-recommendations/contract-shortcuts-test.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,9 @@ test: "contracts equivalent to path-string? can be refactored to path-string?"

test: "->* contracts using #:rest (listof arg) can be replaced with -> and ellipses"
- (void (->* (string? number?) #:rest (listof symbol?) list?))
- (void (->* (string? number?) () #:rest (listof symbol?) list?))
- (void (-> string? number? symbol? ... list?))


test: "->* contracts using #:rest and optional arguments not refactorable to -> and ellipses"
- (void (->* () (string?) #:rest (listof symbol?) list?))
2 changes: 1 addition & 1 deletion default-recommendations/contract-shortcuts.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@
#:literals (->* listof)
[((~and arrow-id ->*)
(~and args (arg-contract ...))
(~optional ())
(~and rest-kw #:rest) (~and rest-list (listof rest-contract))
result-contract)
(-> (ORIGINAL-GAP arrow-id args)
arg-contract ...
(ORIGINAL-GAP args rest-kw)
rest-contract (... ...)
(ORIGINAL-GAP rest-list result-contract)
result-contract)])
Expand Down

0 comments on commit 9c9992c

Please sign in to comment.