-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Tuple converter regression #24609
Comments
!nim c import std/options
type
Config* = object
bits*: tuple[r, g, b, a: Option[int32]]
# works on 2.0.8
#
# results in error on 2.2.0
# type mismatch: got 'int literal(8)' for '8' but expected 'Option[system.int32]'
#
converter toInt32Tuple*(t: tuple[r,g,b,a: int]): tuple[r,g,b,a: Option[int32]] =
(some(t.r.int32), some(t.g.int32), some(t.b.int32), some(t.a.int32))
var cfg: Config
cfg.bits = (r: 8, g: 8, b: 8, a: 16) |
🐧 Linux bisect by @metagn (collaborator)devel 👎 FAILOutput
Filesize stable 👎 FAILOutput
Filesize 2.0.10 👎 FAILOutput
Filesize 2.0.0 👍 OKOutput
Filesize 1.6.20 👍 OKOutput
Filesize 1.4.8 👍 OKOutput
Filesize 1.2.18 👍 OKOutput
Filesize 1.0.10 👍 OKOutput
Filesize #cfd69bad1 ➡️ 🐛Diagnosticsmetagn introduced a bug at
The bug is in the files:
The bug can be in the commits: (Diagnostics sometimes off-by-one). Stats
🤖 Bug found in |
The reason is that the compiler now tries to match each individual element of the tuple constructor to the individual elements of the expected tuple type which gives an error trying to convert |
Description
The below code used to work on 2.0.8 and before (going back several years), but it fails with a compilation error on 2.2.0.
Not sure if this is intentional; seems like an accidental regression to me that breaks existing code.
Nim Version
2.2.0
Current Output
No response
Expected Output
No response
Known Workarounds
Don't use converters :)
Additional Information
No response
The text was updated successfully, but these errors were encountered: