Skip to content

Commit 35978d6

Browse files
NoahStoryMsamth
authored andcommitted
Add types for some raise functions.
1 parent 2aa4588 commit 35978d6

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

typed-racket-lib/typed-racket/base-env/base-env-indexing-abs.rkt

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
(for-template racket/base racket/list racket/unsafe/ops racket/flonum racket/extflonum racket/fixnum)
55
"../utils/tc-utils.rkt"
66
(rename-in "../types/abbrev.rkt" [-Boolean B] [-Symbol Sym])
7-
(rename-in "../types/numeric-tower.rkt" [-Number N]))
7+
(rename-in "../types/numeric-tower.rkt" [-Number N])
8+
(only-in "base-structs.rkt" -Arity-At-Least))
89

910
(provide indexing)
1011

@@ -239,7 +240,7 @@
239240
[flvector (->* (list) -Flonum -FlVector)]
240241
[make-flvector (cl->* (-> index-type -FlVector)
241242
(-> index-type -Flonum -FlVector))]
242-
243+
243244
[shared-flvector (->* (list) -Flonum -FlVector)]
244245
[make-shared-flvector (cl->* (-> index-type -FlVector)
245246
(-> index-type -Flonum -FlVector))]
@@ -254,13 +255,13 @@
254255
[unsafe-flvector-length (-> -FlVector -Index)]
255256
[unsafe-flvector-ref (-> -FlVector index-type -Flonum)]
256257
[unsafe-flvector-set! (-> -FlVector index-type -Flonum -Void)]
257-
258+
258259
;; Section 4.2.5.2 (ExtFlonum Vectors)
259260
[extflvector? (make-pred-ty -ExtFlVector)]
260261
[extflvector (->* (list) -ExtFlonum -ExtFlVector)]
261262
[make-extflvector (cl->* (-> index-type -ExtFlVector)
262263
(-> index-type -ExtFlonum -ExtFlVector))]
263-
264+
264265
[shared-extflvector (->* (list) -ExtFlonum -ExtFlVector)]
265266
[make-shared-extflvector (cl->* (-> index-type -ExtFlVector)
266267
(-> index-type -ExtFlonum -ExtFlVector))]
@@ -275,13 +276,13 @@
275276
[unsafe-extflvector-length (-> -ExtFlVector -Index)]
276277
[unsafe-extflvector-ref (-> -ExtFlVector index-type -ExtFlonum)]
277278
[unsafe-extflvector-set! (-> -ExtFlVector index-type -ExtFlonum -Void)]
278-
279+
279280
;; Section 4.2.4.2 (Fixnum vectors)
280281
[fxvector? (make-pred-ty -FxVector)]
281282
[fxvector (->* (list) -Fixnum -FxVector)]
282283
[make-fxvector (cl->* (-> index-type -FxVector)
283284
(-> index-type -Fixnum -FxVector))]
284-
285+
285286
[shared-fxvector (->* (list) -Fixnum -FxVector)]
286287
[make-shared-fxvector (cl->* (-> index-type -FxVector)
287288
(-> index-type -Fixnum -FxVector))]
@@ -344,7 +345,12 @@
344345
[raise-arguments-error
345346
(->* (list Sym -String) Univ (Un))]
346347
[raise-range-error
347-
(-> Sym -String -String index-type Univ index-type index-type (Un index-type (-val #f)) (Un))]
348+
(-> Sym -String -String index-type Univ index-type index-type (-opt index-type) (Un))]
349+
[raise-arity-error
350+
(->* (list (Un Sym top-func) (Un index-type -Arity-At-Least (-lst (Un index-type -Arity-At-Least)))) Univ (Un))]
351+
[raise-arity-mask-error
352+
(->* (list (Un Sym top-func) index-type) Univ (Un))]
353+
[raise-result-arity-error
354+
(->* (list (-opt Sym) index-type (-opt -String)) Univ (Un))]
348355

349356
))
350-

typed-racket-lib/typed-racket/base-env/base-env.rkt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,10 +1357,9 @@
13571357
(->* (list -String) Univ (Un))
13581358
(->* (list Sym -String) Univ (Un)))]
13591359

1360-
;raise-type-error (in index)
13611360
[raise-mismatch-error (-> Sym -String Univ (Un))]
1362-
;raise-arity-error
13631361
[raise-syntax-error (->optkey (-opt Sym) -String [Univ Univ (-lst (-Syntax Univ)) -String] #:exn (-> (-lst (-Syntax Univ)) -String -Cont-Mark-Set -Exn) #f (Un))]
1362+
;raise-argument-error, raise-type-error, etc. (in index)
13641363

13651364
[unquoted-printing-string? (make-pred-ty -Unquoted-Printing-String)]
13661365
[unquoted-printing-string (-> -String -Unquoted-Printing-String)]

0 commit comments

Comments
 (0)