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

`typed/racket/base/shallow` hangs when recursive types are in a separate module

Open NoahStoryM opened this issue 7 months ago • 1 comments

What version of Racket are you using? v8.15 [cs]

What program did you run?

#lang typed/racket/base/shallow

(displayln 'start)

(module goto racket/base
  (provide goto label)
  (define (goto l) (l l))
  (define (label) (call/cc goto)))

(module types typed/racket/base
  (provide Goto Label)
  (define-type (Goto a) (∪ a (→ a Nothing)))
  (define-type Label (Goto Label)))

(require 'types)
(require/typed/provide 'goto
  [label (∀ (a) (→ (→ a Nothing)))]
  [goto Label])

What should have happened?

The program should print start and then terminate, similar to the following working examples:

#lang typed/racket/base/shallow

(displayln 'start)

(module goto racket/base
  (provide goto label)
  (define (goto l) (l l))
  (define (label) (call/cc goto)))

(define-type (Goto a) (∪ a (→ a Nothing)))
(define-type Label (Goto Label))

(require/typed/provide 'goto
  [label (∀ (a) (→ (→ a Nothing)))]
  [goto Label])
#lang typed/racket/base/optional

(displayln 'start)

(module goto racket/base
  (provide goto label)
  (define (goto l) (l l))
  (define (label) (call/cc goto)))

(module types typed/racket/base
  (provide Goto Label)
  (define-type (Goto a) (∪ a (→ a Nothing)))
  (define-type Label (Goto Label)))

(require 'types)
(require/typed/provide 'goto
  [label (∀ (a) (→ (→ a Nothing)))]
  [goto Label])

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

No error message is displayed. The program simply hangs indefinitely after printing start.

NoahStoryM avatar May 25 '25 09:05 NoahStoryM

@bennn did you ever get a chance to take a look at this? I am trying to find places to get my hands dirty and came across this issue - was able to reproduce:

https://github.com/user-attachments/assets/1646073b-b806-4ba5-a8a2-d0f19a658b45

In the above I:

  1. show I am on Racket 8.17
  2. run the third text snippet from above, it completes ✅
  3. run the first snippet from above, it hangs ⏲️

robertDurst avatar Aug 27 '25 03:08 robertDurst