You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The type conversion T(a) is an L-value if a is an L-value and typeEqualsOrDistinct(T, typeof(a)) holds.
which is the case here.
Because a is an L-value here, and they're all ints per that static block, T(a) should therefore also be an L-value, but it appears not to be.
Nim Version
Nim Compiler Version 1.6.14 [Linux: amd64]
Compiled at 2023-06-29
Copyright (c) 2006-2023 by Andreas Rumpf
active boot switches: -d:release
Nim Compiler Version 2.0.1 [Linux: amd64]
Compiled at 2023-08-20
Copyright (c) 2006-2023 by Andreas Rumpf
git hash: 037f536e7ee25c4baf23dff8a4525825c506442c
active boot switches: -d:release
Nim Compiler Version 2.1.1 [Linux: amd64]
Compiled at 2023-08-20
Copyright (c) 2006-2023 by Andreas Rumpf
git hash: a4781dc4bcdf6e76076af80d0b21cb09865b3d44
active boot switches: -d:release
Current Output
r.nim(19, 2) Error: type mismatch
Expression: f(T(a))
[1] T(a): T
Expected one of (first mismatch at [position]):
[1] proc f(y: var T)
Expected Output
No response
Possible Solution
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered:
fixes#22523
There were 2 problems with the code in `sameType` for
`dcEqIgnoreDistinct`:
1. The code that skipped `{tyDistinct, tyGenericInst}` only ran if the
given types had different kinds. This is fixed by always performing this
skip.
2. The code block below that checks if `tyGenericInst`s have different
values still ran for `dcEqIgnoreDistinct` since it checks if the given
types are generic insts, not the skipped types (and also only the 1st
given type). This is fixed by only invoking this block for `dcEq`;
`dcEqOrDistinctOf` (which is unused) also skips the first given type.
Arguably there is another issue here that `skipGenericAlias` only ever
skips 1 type.
These combined fix the issue (`T` is `GenericInst(V, 1, distinct int)`
and `D[0]` is `GenericInst(D, 0, distinct int)`).
(cherry picked from commit b0e6d28)
Description
fails to build not for
but rather for
https://nim-lang.org/docs/manual.html#type-relations-convertible-relation states that
Because
a
is an L-value here, and they're allint
s per thatstatic
block,T(a)
should therefore also be an L-value, but it appears not to be.Nim Version
Current Output
Expected Output
No response
Possible Solution
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: