From 4bf3479776aaca8aacaa7382648d7cf510d2020f Mon Sep 17 00:00:00 2001 From: Alexis King Date: Mon, 7 Sep 2015 21:39:10 -0700 Subject: [PATCH] Add types for writeln and println --- typed-racket-lib/typed-racket/base-env/base-env.rkt | 2 ++ typed-racket-test/unit-tests/typecheck-tests.rkt | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/typed-racket-lib/typed-racket/base-env/base-env.rkt b/typed-racket-lib/typed-racket/base-env/base-env.rkt index 610a5d0b..afe4f5a3 100644 --- a/typed-racket-lib/typed-racket/base-env/base-env.rkt +++ b/typed-racket-lib/typed-racket/base-env/base-env.rkt @@ -2070,7 +2070,9 @@ [write (Univ [-Output-Port] . ->opt . -Void)] [display (Univ [-Output-Port] . ->opt . -Void)] [print (Univ [-Output-Port (one-of/c 0 1)] . ->opt . -Void)] +[writeln (Univ [-Output-Port] . ->opt . -Void)] [displayln (Univ [-Output-Port] . ->opt . -Void)] +[println (Univ [-Output-Port (one-of/c 0 1)] . ->opt . -Void)] [fprintf (->* (list -Output-Port -String) Univ -Void)] [printf (->* (list -String) Univ -Void)] [eprintf (->* (list -String) Univ -Void)] diff --git a/typed-racket-test/unit-tests/typecheck-tests.rkt b/typed-racket-test/unit-tests/typecheck-tests.rkt index d8ab72ff..94a7a928 100644 --- a/typed-racket-test/unit-tests/typecheck-tests.rkt +++ b/typed-racket-test/unit-tests/typecheck-tests.rkt @@ -2844,6 +2844,15 @@ (display "hello" accumulator/not-thread-safe)) -Void] + ;; Writing + [tc-e (writeln "hello") -Void] + [tc-e (writeln "hello" (current-output-port)) -Void] + [tc-e (displayln "hello") -Void] + [tc-e (displayln "hello" (current-output-port)) -Void] + [tc-e (println "hello") -Void] + [tc-e (println "hello" (current-output-port)) -Void] + [tc-e (println "hello" (current-output-port) 1) -Void] + ;; Additional tests for recursive type aliases [tc-e ;; The types here are valid, but uninhabitable. (let () (define-type-alias A (Listof B))