typed-racket icon indicating copy to clipboard operation
typed-racket copied to clipboard

Namespace mismatch; cannot locate module instance

Open rvs314 opened this issue 4 years ago • 0 comments

What version of Racket are you using?

Racket 8.0 [CS]

What program did you run?

I tried loading the following program into Dr. Racket and Racket-Mode:

#lang typed/racket

(module inner typed/racket
  (provide change-id)

  (: change-id (-> Identifier Identifier))
  (define (change-id i)
    (datum->syntax i 'changed)))

(require (for-syntax 'inner))

(define-syntax (define-special stx)
  (syntax-case stx ()
    ((_ i s) #`(define #,(change-id #'i) s))))

(define-special i 3)

What should have happened?

This should have loaded normally.

If you got an error message, please include it here.

../../usr/racket/share/pkgs/errortrace-lib/errortrace/stacktrace.rkt:690:2: expand: namespace mismatch; cannot locate module instance
  module: #<module-path-index:(submod "." inner #%contract-defs-reference ".." #%contract-defs) + 'anonymous-module[238351]>
  use phase: 1
  definition phase: 0
  for identifier: #<syntax idB4>

Adding the expression (begin-for-syntax change-id) before (require (for-syntax 'inner)) causes the error to go away.

rvs314 avatar Aug 11 '21 01:08 rvs314