Skip to content

When defining a structure in REPL, its fields can't use its type. #1195

Open
@NoahStoryM

Description

@NoahStoryM

What version of Racket are you using?

v8.4 [cs]

What program did you run?

Welcome to Racket v8.4 [cs].
> (struct slist
    ([scar : Any]
     [scdr : SList])
    #:transparent
    #:type-name SList)
string:3:11: Type Checker: parse error in type;
 type name `SList' is unbound
  in: SList
 [,bt for context]

What should have happened?

No error.

More

We can use module to define such structure:

Welcome to Racket v8.4 [cs].
> (module typed typed/racket
    (provide (all-defined-out))
    (struct slist
      ([scar : Any]
       [scdr : SList])
      #:transparent
      #:type-name SList))
> (require 'typed)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions