From fbc2411603bbffeea64b8725622261bc6feb4e49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Georges=20Dup=C3=A9ron?= Date: Thu, 12 Nov 2015 12:17:40 +0100 Subject: [PATCH] Tried to make low/typed-untyped-module.rkt tests for require/provide run. In the end the error was just due to https://github.com/racket/typed-racket/issues/228, upgrading to a newer build of Racket fixed this. Added a couple of typed/untyped utilities in the process. --- .../graph/_examples_differentiate_unions.rkt | 2 +- graph/lib/low-untyped.rkt | 14 +++---- graph/lib/low.rkt | 42 +++++++++++++++++++ 3 files changed, 50 insertions(+), 8 deletions(-) diff --git a/graph/graph/_examples_differentiate_unions.rkt b/graph/graph/_examples_differentiate_unions.rkt index ac5cd37..ee13b06 100644 --- a/graph/graph/_examples_differentiate_unions.rkt +++ b/graph/graph/_examples_differentiate_unions.rkt @@ -1,4 +1,4 @@ -#lang typed/racket +#lang typed/racket/no-check #;(λ ([x : (U (Vector Number) (Vector String String))]) diff --git a/graph/lib/low-untyped.rkt b/graph/lib/low-untyped.rkt index 17070d8..67e68d5 100644 --- a/graph/lib/low-untyped.rkt +++ b/graph/lib/low-untyped.rkt @@ -11,10 +11,10 @@ (require (for-syntax racket/base)) (include/reader "low.rkt" (λ (source-name in) - (port-count-lines! in) - (do () - [(let-values ([(line column position) - (port-next-location in)]) - (> line 1))] - (read-line in)) - (read-syntax source-name in))) \ No newline at end of file + (port-count-lines! in) + (do () + [(let-values ([(line column position) + (port-next-location in)]) + (> line 1))] + (read-line in)) + (read-syntax source-name in))) \ No newline at end of file diff --git a/graph/lib/low.rkt b/graph/lib/low.rkt index e6b8339..178c895 100644 --- a/graph/lib/low.rkt +++ b/graph/lib/low.rkt @@ -6,6 +6,47 @@ ;; ==== low/typed-untyped-module.rkt ==== +(require typed/untyped-utils) +(provide half-typed-module typed/untyped-prefix define-modules) + +;; half-typed-module +(define-syntax-rule (typed-module m typed-language untyped-language . body) + (module m typed-language . body)) + +(define-syntax-rule (untyped-module m typed-language untyped-language . body) + (module m untyped-language . body)) + +(define-typed/untyped-identifier half-typed-module typed-module untyped-module) + +#| ;; test: should work in no-check but not in typed: +(half-typed-module moo typed/racket typed/racket/no-check + (: foo One) + (define foo 2)) +|# + +;; typed/untyped-prefix +(define-syntax-rule + (typed-typed/untyped-prefix [typed-prefix ...] [untyped-prefix ...] . rest) + (typed-prefix ... . rest)) + +(define-syntax-rule + (untyped-typed/untyped-prefix [typed-prefix ...] [untyped-prefix ...] . rest) + (untyped-prefix ... . rest)) + +(define-typed/untyped-identifier typed/untyped-prefix + typed-typed/untyped-prefix + untyped-typed/untyped-prefix) + +#| +;; test: should work in no-check but not in typed: +(typed/untyped-prefix + [module moo2 typed/racket] + [module moo2 typed/racket/no-check] + (: foo One) + (define foo 2)) +|# + +;; define-modules (define-syntax define-modules (syntax-rules (no-submodule) [(_ ([no-submodule] [name lang] ...) . body) @@ -29,6 +70,7 @@ |# ;; ==== low/require-provide.rkt ==== + (provide require/provide) (define-syntax (require/provide stx)