Skip to content

Pure enums allow using the same name but allow nonqualification with quirky behaviour #8066

@metagn

Description

@metagn
type
  X {.pure.} = enum
    red

  Y {.pure.} = enum
    red

echo red # red, with unused warning for Y
let newRed = red # this works too and can be operated on

when false: # undeclared identifier: 'red' for both,
  echo red.ord
  from typetraits import `$`
  echo red.type

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions