tpure_enums_conflict_legacy.nim 593 B

1234567891011121314151617181920212223242526
  1. # bug #8066
  2. when true:
  3. type
  4. MyEnum {.pure.} = enum
  5. valueA, valueB, valueC, valueD, amb
  6. OtherEnum {.pure.} = enum
  7. valueX, valueY, valueZ, amb
  8. echo valueA # MyEnum.valueA
  9. echo MyEnum.amb # OK.
  10. echo amb #[tt.Error
  11. ^ type mismatch: got <MyEnum | OtherEnum>
  12. but expected one of:
  13. proc echo(x: varargs[typed, `$$`])
  14. first type mismatch at position: 1
  15. required type for x: varargs[typed]
  16. but expression 'amb' is of type: None
  17. ambiguous identifier: 'amb' -- use one of the following:
  18. MyEnum.amb: MyEnum
  19. OtherEnum.amb: OtherEnum
  20. expression: echo amb]#