Created
January 10, 2015 19:33
-
-
Save pnwamk/eba07d62b322e2fac3e2 to your computer and use it in GitHub Desktop.
foo.rkt (aliasing path error)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; ERROR EXAMPLE FILE "foo.rkt" | |
#lang typed/racket/base | |
;(provide Foo) ;; comment this line to see THE ERROR | |
(provide in-foo) | |
(require (for-syntax racket/base)) | |
;; -- taken from 'math/private/Foo/typed-array-struct.rkt' | |
(struct: (A) foo ([shape : (Vectorof Index)] | |
[size : Index] | |
[strict? : (Boxof Boolean)] | |
[strict! : (-> Void)] | |
[unsafe-proc : ((Vectorof Index) -> A)])) | |
;; -- end 'math/private/array/typed-array-struct.rkt' | |
(define-sequence-syntax in-foo | |
(λ () #'in-foo) | |
(λ (stx) | |
(syntax-case stx () | |
[[(x) (_ arr-expr)] | |
(syntax/loc stx | |
[(x) | |
(:do-in | |
([(ds size dims js proc) | |
(plet: (A) ([arr : (foo A) arr-expr]) | |
(cond [(foo? arr) | |
(define ds (foo-shape arr)) | |
(define dims (vector-length ds)) | |
(define size (foo-size arr)) | |
(define proc (foo-unsafe-proc arr)) | |
(define: js : (Vectorof Index) (make-vector dims 0)) | |
(values ds size dims js proc)] | |
[else | |
(raise-argument-error 'in-foo "foo" arr)]))]) | |
(void) | |
([j 0]) | |
#true | |
([(x) (proc js)]) | |
#true | |
#true | |
[0])])] | |
[[_ clause] (raise-syntax-error 'in-Foo "expected (in-foo <foo>)" #'clause #'clause)]))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment