Skip to content

Providing a recursive prefab type causes expansion to diverge #906

@LiberalArtist

Description

@LiberalArtist

What version of Racket are you using?

7.5 CS (Still true on 7.9.0.900 CS)

What program did you run?

#lang typed/racket/base

(provide (prefix-out prefixed-
                     (struct-out container)))

(struct container
  ([value : (U #f container)])
  #:prefab)

The #:prefab declaration, the type-level recursion, and prefix-out [ETA: or prefix-in, rename-out, or rename-in—see below] all seem to be necessary ingredients.

See below for an example without renaming.

What should have happened?

Macro expansion should terminate.

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

In DrRacket: "Background expansion terminated abnormally (out of memory)" and "Interactions disabled; out of memory"

At the command line:

^Cuser break
  context...:
   p
   check-break-prefix
   bitwise-arithmetic-shift-left
   loop
   equal-hash-loop
   key-equal-hash-code
   $gen-hashtable-ref
   hash-ref/none
   hash-ref
   /Applications/Racket v7.5/share/pkgs/typed-racket-lib/typed-racket/types/resolve.rkt:171:0: resolve-once
   /Applications/Racket v7.5/collects/racket/match/compiler.rkt:507:40: f683
   /Applications/Racket v7.5/share/pkgs/typed-racket-lib/typed-racket/types/subtype.rkt:62:0: subtype14
   /Applications/Racket v7.5/collects/racket/list.rkt:600:2: loop
   /Applications/Racket v7.5/share/pkgs/typed-racket-lib/typed-racket/types/union.rkt:27:0: merge
   /Applications/Racket v7.5/collects/racket/private/list.rkt:232:7: loop
   /Applications/Racket v7.5/share/pkgs/typed-racket-lib/typed-racket/types/union.rkt:40:0: normalize-type

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions