<commit_before>#lang racket/base

;; Functions for testing correct behavior of typechecking
(module tester racket/base
  (require
    typed-racket/utils/utils
    racket/base
    syntax/parse
    (base-env
      base-env-indexing
      base-special-env
      base-structs)
    (typecheck typechecker)
    (utils mutated-vars)
    (env mvar-env)
    (prefix-in b: (base-env base-env))
    (prefix-in n: (base-env base-env-numeric))
    (submod typed-racket/base-env/base-types initialize))
  (provide test-literal test test/proc tc tc-literal tr-expand)


  (b:init)
  (n:init)
  (initialize-structs)
  (initialize-indexing)
  (initialize-type-names)
  (initialize-special)
  
  ;; tr-expand: syntax? -> syntax?
  ;; Expands out a form and annotates it with necesarry TR machinery.
  (define (tr-expand stx)
    (define expanded-stx (local-expand stx 'expression '()))
    (find-mutated-vars expanded-stx mvar-env)
    expanded-stx)


  ;; tc: syntax? (option/c tc-results?) -> tc-results?
  ;; Typechecks the expression using the expected information if provided.
  (define (tc expr expected)
    (if expected
        (tc-expr/check expr expected)
        (tc-expr expr)))

  ;; test: syntax? tc-results? [(option/c tc-results?)] -> void?<commit_msg>Make typechecking do the standard inits.<commit_after>#lang racket/base

;; Functions for testing correct behavior of typechecking
(module tester racket/base
  (require
    typed-racket/utils/utils
    racket/base
    syntax/parse
    (for-template (only-in typed-racket/typed-racket do-standard-inits))
    (typecheck typechecker)
    (utils mutated-vars)
    (env mvar-env))
  (provide test-literal test test/proc tc tc-literal tr-expand)


  (do-standard-inits)
  
  ;; tr-expand: syntax? -> syntax?
  ;; Expands out a form and annotates it with necesarry TR machinery.
  (define (tr-expand stx)
    (define expanded-stx (local-expand stx 'expression '()))
    (find-mutated-vars expanded-stx mvar-env)
    expanded-stx)


  ;; tc: syntax? (option/c tc-results?) -> tc-results?
  ;; Typechecks the expression using the expected information if provided.
  (define (tc expr expected)
    (if expected
        (tc-expr/check expr expected)
        (tc-expr expr)))

  ;; test: syntax? tc-results? [(option/c tc-results?)] -> void?
{'fraction_non_alphanumeric': 0.12412280701754386, 'fraction_numerical': 0.0, 'mean_word_length': 3.1853211009174314, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4049395', 'n_tokens_mistral': 767, 'n_tokens_neox': 749, 'n_words': 202}