Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated Resyntax fixes #1402

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions typed-racket-lib/typed-racket/base-env/ann-inst.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
;; This file is loaded by all Typed Racket programs, so it should not
;; have expensive runtime dependencies.

(require (for-syntax syntax/parse/pre "../private/syntax-properties.rkt"
racket/base)
(require (for-syntax racket/base
syntax/parse/pre
"../private/syntax-properties.rkt")
"colon.rkt")

(provide (for-syntax add-ann) ann inst row-inst)
Expand Down
35 changes: 14 additions & 21 deletions typed-racket-lib/typed-racket/base-env/annotate-classes.rkt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#lang racket/base

(require syntax/parse/pre
racket/private/immediate-default
(require (for-label "colon.rkt")
racket/list
racket/set
racket/match
racket/private/immediate-default
racket/set
syntax/parse/pre
"../private/parse-classes.rkt"
"../private/syntax-properties.rkt"
(for-label "colon.rkt"))
"../private/syntax-properties.rkt")
(provide (all-defined-out))

;; Data definitions
Expand Down Expand Up @@ -169,7 +169,7 @@
#:with ty #'t))
(define-splicing-syntax-class optional-standalone-annotation
(pattern (~optional a:standalone-annotation)
#:attr ty (if (attribute a) #'a.ty #f)))
#:attr ty (and (attribute a) #'a.ty)))

(define-syntax-class type-variables
#:attributes ((vars 1))
Expand Down Expand Up @@ -330,23 +330,16 @@
(define-values (all-mand-tys all-opt-tys)
(cond
[kw-property
(define-values (mand-kw-set opt-kw-set)
(values
(list->set (lambda-kws-mand kw-property))
(list->set (lambda-kws-opt kw-property))))

(define mand-kw-set (list->set (lambda-kws-mand kw-property)))
(define opt-kw-set (list->set (lambda-kws-opt kw-property)))
(define-values (mand-tys^ opt-kw^)
(partition (part-pred opt-kw-set)
(attribute mand.type-form)))

(partition (part-pred opt-kw-set) (attribute mand.type-form)))

(define-values (opt-tys^ mand-kw^)
(partition (part-pred mand-kw-set)
(attribute opt.type-form)))

(values (append mand-tys^ mand-kw^)
(append opt-tys^ opt-kw^))]
[else
(values (attribute mand.type-form) (attribute opt.type-form))]))]
(partition (part-pred mand-kw-set) (attribute opt.type-form)))

(values (append mand-tys^ mand-kw^) (append opt-tys^ opt-kw^))]
[else (values (attribute mand.type-form) (attribute opt.type-form))]))]
#:attr kw-property kw-property
#:attr mand-tys
(flatten all-mand-tys)
Expand Down
16 changes: 7 additions & 9 deletions typed-racket-lib/typed-racket/base-env/base-contracted.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
;; This file provides Typed Racket bindings for values that need
;; contract protection, even in typed code.

(require "../utils/utils.rkt"
"../utils/any-wrap.rkt"
(require (for-syntax racket/base
"../env/env-req.rkt")
(prefix-in c: racket/contract)
(rename-in
racket/base
[default-continuation-prompt-tag -default-continuation-prompt-tag])
(for-syntax racket/base
"../env/env-req.rkt"))
(rename-in racket/base [default-continuation-prompt-tag -default-continuation-prompt-tag])
"../utils/any-wrap.rkt"
"../utils/utils.rkt")

(provide default-continuation-prompt-tag)

Expand All @@ -32,8 +30,8 @@
(module* #%type-decl #f
(#%plain-module-begin
(require typed-racket/env/global-env
typed-racket/types/abbrev
typed-racket/rep/type-rep)
typed-racket/rep/type-rep
typed-racket/types/abbrev)
(register-type
(quote-syntax default-continuation-prompt-tag)
;; TODO: we actually want the type
Expand Down
21 changes: 13 additions & 8 deletions typed-racket-lib/typed-racket/base-env/base-env-indexing-abs.rkt
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
#lang racket/base

(require
(for-template racket/base racket/list racket/unsafe/ops racket/flonum racket/extflonum racket/fixnum)
(for-syntax racket/base syntax/parse)
racket/stxparam
"../utils/tc-utils.rkt"
(rename-in "../types/abbrev.rkt" [-Boolean B] [-Symbol Sym])
(rename-in "../types/numeric-tower.rkt" [-Number N])
(only-in "base-structs.rkt" -Arity-At-Least))
(require (for-syntax racket/base
syntax/parse)
(for-template racket/base
racket/extflonum
racket/fixnum
racket/flonum
racket/list
racket/unsafe/ops)
racket/stxparam
(rename-in "../types/abbrev.rkt" [-Boolean B] [-Symbol Sym])
(rename-in "../types/numeric-tower.rkt" [-Number N])
(only-in "base-structs.rkt" -Arity-At-Least)
"../utils/tc-utils.rkt")

(provide indexing)

Expand Down
9 changes: 4 additions & 5 deletions typed-racket-lib/typed-racket/base-env/base-env-indexing.rkt
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#lang racket/base

(require
"../utils/utils.rkt"
"../types/numeric-tower.rkt"
"../env/init-envs.rkt"
"base-env-indexing-abs.rkt")
(require "../env/init-envs.rkt"
"../types/numeric-tower.rkt"
"../utils/utils.rkt"
"base-env-indexing-abs.rkt")

(define e (indexing -Integer))
(define (initialize-indexing) (initialize-type-env e))
Expand Down
6 changes: 3 additions & 3 deletions typed-racket-lib/typed-racket/base-env/base-special-env.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

;; this file cheats to define types for unexported variables
;; that are expanded into by Racket macros
(require "../env/init-envs.rkt"
(require (for-syntax racket/base)
"../env/init-envs.rkt"
"../types/abbrev.rkt"
"../types/numeric-tower.rkt"
(for-syntax racket/base))
"../types/numeric-tower.rkt")
(provide make-template-identifier)

(define (make-template-identifier what where)
Expand Down
6 changes: 5 additions & 1 deletion typed-racket-lib/typed-racket/base-env/base-structs.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@

(require (for-template racket/base (prefix-in k: '#%kernel)))

(provide initialize-structs -Date -Srcloc -Date -Arity-At-Least -Exn)
(provide initialize-structs
-Date
-Srcloc
-Arity-At-Least
-Exn)

(define-syntax define-hierarchy
(syntax-rules (define-hierarchy)
Expand Down
4 changes: 2 additions & 2 deletions typed-racket-lib/typed-racket/base-env/base-types-extra.rkt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#lang racket/base

(require (for-syntax "type-name-error.rkt"
racket/base))
(require (for-syntax racket/base
"type-name-error.rkt"))

(define-syntax (define-other-types stx)
(syntax-case stx ()
Expand Down
8 changes: 4 additions & 4 deletions typed-racket-lib/typed-racket/base-env/class-clauses.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
;; other parts of TR to use the bindings of init, public, etc. without
;; requiring prims.rkt

(require (prefix-in untyped: racket/class)
"colon.rkt"
(for-syntax racket/base
(require (for-syntax racket/base
syntax/parse
syntax/stx
"../private/syntax-properties.rkt"))
"../private/syntax-properties.rkt")
(prefix-in untyped: racket/class)
"colon.rkt")

(provide (for-syntax class-clause
clause
Expand Down
35 changes: 17 additions & 18 deletions typed-racket-lib/typed-racket/base-env/class-prims.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,25 @@

;; This module provides TR primitives for classes and objects

(require (prefix-in untyped: racket/class)
"class-clauses.rkt"
"colon.rkt"
(require (for-syntax racket/base
racket/class
racket/list
racket/match
racket/syntax
syntax/kerncase
syntax/parse
syntax/stx
"../private/syntax-properties.rkt"
"../typecheck/internal-forms.rkt"
"../utils/disarm.rkt"
"../utils/tc-utils.rkt"
"annotate-classes.rkt")
(prefix-in untyped: racket/class)
(only-in "prims.rkt" (define tr:define))
"../private/class-literals.rkt"
"../utils/typed-method-property.rkt"
(only-in "prims.rkt" [define tr:define])
(for-syntax
racket/base
racket/class
racket/list
racket/match
racket/syntax
syntax/kerncase
syntax/parse
syntax/stx
"../typecheck/internal-forms.rkt"
"annotate-classes.rkt"
"../private/syntax-properties.rkt"
"../utils/disarm.rkt"
"../utils/tc-utils.rkt"))
"class-clauses.rkt"
"colon.rkt")

(provide ;; Typed class macro that coordinates with TR
class
Expand Down
7 changes: 4 additions & 3 deletions typed-racket-lib/typed-racket/base-env/env-lang.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

(require "../utils/utils.rkt")

(require (for-syntax racket/base syntax/parse)
(require (for-syntax racket/base
syntax/parse)
racket/stxparam
"../utils/tc-utils.rkt"
"../env/init-envs.rkt"
"../types/abbrev.rkt"
"../types/numeric-tower.rkt"
"../types/prop-ops.rkt")
"../types/prop-ops.rkt"
"../utils/tc-utils.rkt")

(define-syntax (-#%module-begin stx)
(define-syntax-class clause
Expand Down
14 changes: 7 additions & 7 deletions typed-racket-lib/typed-racket/base-env/extra-env-lang.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@
;;
;; Also see env-lang.rkt

(require "../utils/utils.rkt"
(for-syntax "../private/parse-type.rkt"
"type-name-error.rkt"
racket/base
(only-in racket/splicing splicing-syntax-parameterize)
(require (for-syntax racket/base
syntax/parse
syntax/stx
(only-in racket/splicing splicing-syntax-parameterize)
"../private/parse-type.rkt"
"../types/abbrev.rkt"
"../types/numeric-tower.rkt"
"../types/prop-ops.rkt"
"../utils/struct-info.rkt")
(for-meta 2 (only-in racket/base #%app quote)))
"../utils/struct-info.rkt"
"type-name-error.rkt")
(for-meta 2 (only-in racket/base #%app quote))
"../utils/utils.rkt")

(provide type-environment
(rename-out [-#%module-begin #%module-begin])
Expand Down
4 changes: 2 additions & 2 deletions typed-racket-lib/typed-racket/base-env/for-clauses.rkt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#lang racket/base

(require syntax/parse/pre
(for-template (only-in racket/base quote))
(require (for-template (only-in racket/base quote))
syntax/parse/pre
"annotate-classes.rkt")

(provide (all-defined-out))
Expand Down
12 changes: 6 additions & 6 deletions typed-racket-lib/typed-racket/base-env/prims-lambda.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
;; In particular, "parse-type.rkt" needs the binding of the TR
;; case-lambda in order to match for case-lambda types.

(require "colon.rkt"
"ann-inst.rkt"
(for-syntax "annotate-classes.rkt"
"../private/syntax-properties.rkt"
racket/base
(require (for-syntax racket/base
racket/syntax
syntax/parse/pre
syntax/stx
syntax/parse/pre))
"../private/syntax-properties.rkt"
"annotate-classes.rkt")
"ann-inst.rkt"
"colon.rkt")

(provide (rename-out [-case-lambda case-lambda]
[-case-lambda case-lambda:]
Expand Down
8 changes: 2 additions & 6 deletions typed-racket-lib/typed-racket/base-env/unit-prims.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,8 @@
;; in the signature, this is needed to typecheck define-values/invoke-unit forms
(define-for-syntax (imports/members sig-id)
(define-values (_1 imp-mem _2 _3) (signature-members sig-id sig-id))
#`(#,sig-id #,@(map (lambda (id)
(local-expand
id
(syntax-local-context)
(kernel-form-identifier-list)))
imp-mem)))
#`(#,sig-id #,@(for/list ([id (in-list imp-mem)])
(local-expand id (syntax-local-context) (kernel-form-identifier-list)))))

;; Given a list of signature specs
;; Processes each signature spec to determine the variables exported
Expand Down
14 changes: 8 additions & 6 deletions typed-racket-lib/typed-racket/optimizer/sequence.rkt
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
#lang racket/base

(require syntax/parse
racket/match
(require (for-template racket/base
racket/unsafe/ops)
racket/function
racket/match
syntax/parse
syntax/parse/experimental/specialize
(for-template racket/base racket/unsafe/ops)
"../utils/utils.rkt" "../utils/tc-utils.rkt"
"../rep/type-rep.rkt"
"../types/abbrev.rkt"
"utils.rkt"
"../utils/tc-utils.rkt"
"../utils/utils.rkt"
"float.rkt"
"logging.rkt"
"float.rkt")
"utils.rkt")

(provide sequence-opt-expr)

Expand Down
18 changes: 9 additions & 9 deletions typed-racket-test/optimizer/known-bugs.rkt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#lang racket/base

(require
rackunit
racket/sandbox
racket/flonum racket/fixnum racket/unsafe/ops
racket/math
syntax/srcloc
(for-syntax
racket/base
syntax/parse))
(require (for-syntax racket/base
syntax/parse)
racket/fixnum
racket/flonum
racket/math
racket/sandbox
racket/unsafe/ops
rackunit
syntax/srcloc)

(provide tests)

Expand Down
2 changes: 1 addition & 1 deletion typed-racket-test/optimizer/reset-port.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
(provide read-syntax)

(define (read-syntax name port)
(read-line port)
(read-line port 'any)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know 'any is preferable in general, but does it break anything here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, it's just for testing. Probably doesn't matter.

(when (port-counts-lines? port)
(set-port-next-location! port 1 0 1))
(make-special-comment 'typed-racket/optimizer/reset-port))
Loading