Skip to content

Commit d01ea97

Browse files
committed
fix correspondence between location? and Location in typed/racket
1 parent 74bdc52 commit d01ea97

File tree

2 files changed

+32
-3
lines changed

2 files changed

+32
-3
lines changed

typed-racket-more/typed/xml.rkt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,16 @@
1818
(Pair Symbol (Pair (Listof XExpr-Attribute) (Listof XExpr)))
1919
(Pair Symbol (Listof XExpr))))
2020

21-
(require/typed/provide xml
21+
(require/typed xml
2222
[#:struct location
2323
([line : (U False Exact-Nonnegative-Integer)]
2424
[char : (U False Exact-Nonnegative-Integer)]
25-
[offset : Exact-Nonnegative-Integer])
26-
#:type-name Location]
25+
[offset : Exact-Nonnegative-Integer])])
26+
27+
(define-type Location
28+
(U location Symbol False))
29+
30+
(require/typed/provide xml
2731
[#:struct source
2832
([start : Location]
2933
[stop : Location])
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#lang typed/racket/base
2+
3+
(module+ test
4+
5+
(require typed/rackunit
6+
"../../typed-racket-more/typed/xml.rkt")
7+
8+
(let ([xml-p-i
9+
(p-i #f #f 'xml "version=\"1.0\" encoding=\"UTF-8\"")])
10+
(check-eq?
11+
(source-start xml-p-i)
12+
#f)
13+
(check-eq?
14+
(source-stop xml-p-i)
15+
#f))
16+
17+
(let ([xml-p-i
18+
(p-i 'racket 'racket 'xml "version=\"1.0\" encoding=\"UTF-8\"")])
19+
(check-eq?
20+
(source-start xml-p-i)
21+
'racket)
22+
(check-eq?
23+
(source-stop xml-p-i)
24+
'racket)))
25+

0 commit comments

Comments
 (0)