Skip to content

Keys in enum are case-sensitive on OSX and case-insensitive on linux #21207

@jerous86

Description

@jerous86

Description

On OSX the keys in an enum are case-sensitive, while on linux they are case-insensitive

On OSX the following executes without error:

# uname -a; echo "type Key* = enum Key_A, Key_a" >/tmp/test.nim && nim cpp /tmp/test.nim
Darwin (hostname) 21.6.0 Darwin Kernel Version 21.6.0: root:xnu-8020.240.14~1/RELEASE_X86_64 x86_64

On linux it gives an error:

# uname -a; echo "type Key* = enum Key_A, Key_a" >/tmp/test.nim && nim cpp /tmp/test.nim
Linux (hostname) 5.15.0-56-generic #62-Ubuntu SMP Tue Nov 22 19:54:14 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
/tmp/test.nim(1, 25) Error: redefinition of 'Key_a'; previous declaration here: /tmp/test.nim(1, 18)

Nim Version

On OSX:

Nim Compiler Version 1.6.10 [MacOSX: amd64]
Compiled at 2022-12-24
Copyright (c) 2006-2021 by Andreas Rumpf

active boot switches: -d:release```

On linux:
```# nim -v
Nim Compiler Version 1.6.10 [Linux: amd64]
Compiled at 2022-11-21
Copyright (c) 2006-2021 by Andreas Rumpf

git hash: f1519259f85cbdf2d5ff617c6a5534fcd2ff6942
active boot switches: -d:release```

### Current Output

_No response_

### Expected Output

```text
I assume that the keys in an enum should always be case-insensitive, hence for OSX I would expect also an compilation error.

Possible Solution

No response

Additional Information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions