Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression from 2.0.8 to version-2-0/version-2-2/devel: Error: type mismatch: got 'uint' for '0'u' but expected 'P = distinct uint' with distinct-typed labels in casestatement #24104

Closed
tersec opened this issue Sep 13, 2024 · 1 comment · Fixed by #24105

Comments

@tersec
Copy link
Contributor

tersec commented Sep 13, 2024

Description

type P = distinct uint  # uint, uint8, uint16, uint32, uint64 
let v = 0.P
case v
of 0.P: discard
else:   discard

Nim Version

Builds:

Nim Compiler Version 2.0.8 [Linux: amd64]
Compiled at 2024-09-13
Copyright (c) 2006-2023 by Andreas Rumpf

git hash: 5935c3bfa9fec6505394867b23510eb5cbab3dbf
active boot switches: -d:release

Does not build:

Nim Compiler Version 2.0.9 [Linux: amd64]
Compiled at 2024-09-13
Copyright (c) 2006-2023 by Andreas Rumpf

git hash: 8bc8347f022982d81ae311223cc59580718b3c48
active boot switches: -d:release

devel:

Nim Compiler Version 2.1.99 [Linux: amd64]
Compiled at 2024-09-13
Copyright (c) 2006-2024 by Andreas Rumpf

git hash: 61e04ba0ed4b8c6567f4cfd5c48c2c2439c62371
active boot switches: -d:release

Current Output

/tmp/h.nim(4, 5) Error: type mismatch: got 'uint' for '0'u' but expected 'P = distinct uint'

Expected Output

No response

Known Workarounds

No response

Additional Information

No response

@metagn
Copy link
Collaborator

metagn commented Sep 13, 2024

Issue is since #23955

metagn added a commit to metagn/Nim that referenced this issue Sep 14, 2024
narimiran pushed a commit that referenced this issue Sep 16, 2024
fixes #24104, refs #23955

The line `result.typ = dstTyp` added in #23955 changes the type of
`result`, which was the type of `n` due to the argument passed to
`newIntNodeT`, to the abstract type skipped `dstTyp`. The line is
removed to just keep the type as abstract.

(cherry picked from commit 6d362e0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants