Small TR fixes.

original commit: a94c449ff1d7e6eb299c06d8be2da681d1b99d9f
This commit is contained in:
Eric Dobson 2013-04-22 23:50:44 -07:00
parent 211f0fcd58
commit 4d72cbffa0
2 changed files with 23 additions and 23 deletions

View File

@ -29,12 +29,12 @@
(define-syntax (tc-e stx)
(syntax-parse stx
[(_ expr ty) (syntax/loc stx (tc-e expr #:ret (ret ty)))]
[(_ expr ty) (syntax/loc stx (tc-e expr #:ret (ret ty)))]
[(_ a #:ret b)
(quasisyntax/loc stx
(check-tc-result-equal? (format "~a ~a" #,(syntax-line stx) 'a)
#,(let ([ex (local-expand #'a 'expression null)])
(find-mutated-vars ex mvar-env)
(find-mutated-vars ex mvar-env)
(tc-expr ex))
#,(syntax-local-eval #'b)))]))
@ -47,77 +47,77 @@
[tc-e (in-list (list 1 2 3)) (-seq -Integer)]
[tc-e (in-vector (vector 1 2 3)) (-seq -Integer)]
|#
[tc-e (in-hash #hash((1 . 2))) (-seq -Integer -Integer)]
[tc-e (in-hash-keys #hash((1 . 2))) (-seq -Integer)]
[tc-e (in-hash-values #hash((1 . 2))) (-seq -Integer)]
(tc-e (file->string "tmp") -String)
(tc-e (file->string "tmp" #:mode 'binary) -String)
(tc-e (file->string "tmp" #:mode 'text) -String)
(tc-e (file->bytes "tmp") -Bytes)
(tc-e (file->bytes "tmp" #:mode 'binary) -Bytes)
(tc-e (file->bytes "tmp" #:mode 'text) -Bytes)
(tc-e (file->list "tmp") (-lst Univ))
(tc-e ((inst file->list Any) "tmp" #:mode 'binary) (-lst Univ))
(tc-e ((inst file->list Any) "tmp" #:mode 'text) (-lst Univ))
(tc-e (file->list "tmp" (lambda (x) "string")) (-lst -String))
(tc-e ((inst file->list String) "tmp" (lambda (x) "string") #:mode 'binary) (-lst -String))
(tc-e ((inst file->list String) "tmp" (lambda (x) "string") #:mode 'text) (-lst -String))
(tc-e (file->lines "tmp") (-lst -String))
(tc-e (file->lines "tmp" #:mode 'text) (-lst -String))
(tc-e (file->lines "tmp" #:line-mode (first (shuffle '(linefeed return return-linefeed any any-one)))
#:mode 'binary) (-lst -String))
(tc-e (file->bytes-lines "tmp") (-lst -Bytes))
(tc-e (file->bytes-lines "tmp" #:mode 'text) (-lst -Bytes))
(tc-e (file->bytes-lines "tmp" #:line-mode (first (shuffle '(linefeed return return-linefeed any any-one)))
#:mode 'binary) (-lst -Bytes))
(tc-e (display-to-file "a" "tmp" #:mode (if (= 1 2) 'binary 'text)
#:exists (first (shuffle '(error append update replace truncate truncate/replace))))
-Void)
(tc-e (write-to-file "a" "tmp" #:mode (if (= 1 2) 'binary 'text)
#:exists (first (shuffle '(error append update replace truncate truncate/replace))))
-Void)
(tc-e (display-lines-to-file (list 2 'esha "esht") "tmp" #:separator #f
#:mode (if (= 1 2) 'binary 'text)
#:exists (first (shuffle '(error append update replace truncate truncate/replace))))
-Void)
(tc-e (get-preference 'pref (lambda () 'error) 'timestamp #f #:use-lock? #t #:timeout-lock-there #f #:lock-there #f) Univ)
(tc-e (make-handle-get-preference-locked .3 'sym (lambda () 'eseh) 'timestamp #f #:lock-there #f #:max-delay .45)
(t:-> -Pathlike Univ))
(tc-e (call-with-file-lock/timeout #f 'exclusive (lambda () 'res) (lambda () 'err)
#:lock-file "lock"
#:delay .01
#:max-delay .2) (one-of/c 'res 'err))
(tc-e (make-derived-parameter current-input-port
(lambda: ((s : String)) (open-input-file s))
object-name) (-Param -String Univ))
;; exception handling
[tc-e (with-handlers ([void (λ (x) (values 0 0))]) (values "" ""))
#:ret (ret (list (t:Un -Zero -String) (t:Un -Zero -String)))]
(tc-e (make-temporary-file) -Path)
(tc-e (make-temporary-file "ee~a") -Path)
(tc-e (make-temporary-file "ee~a" 'directory) -Path)
(tc-e (make-temporary-file "ee~a" "temp" "here") -Path)
))

View File

@ -39,6 +39,7 @@
;; sty : Struct?
;; names : Listof[Identifier]
;; desc : struct-desc
;; struct-info : struct-info?
;; type-only : Boolean
(struct parsed-struct (sty names desc struct-info type-only) #:transparent)
@ -90,7 +91,6 @@
((or (Poly? parent) (Mu? parent) (Struct? parent))
parent)
(else
(displayln parent0)
(tc-error/stx #'v.par "parent type not a valid structure name: ~a"
(syntax->datum #'v.par)))))])
(values #'v.name parent0 parent))