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
new on the distinct ref should not make the type into a double indirection.
Additional Information/Possible Solution
I was working on https://github.com/nim-lang/Nim/issues/9566 and the problem is that in options.nim the expression when T is SomePointer does not work for distinct ref types. Then I saw a very similar pattern in system.nim: when (t is ref): in proc new. Usually I would fix this problem with a macro that transforms the type in the way I want to. But in #9566 I could not fix in, because a macro in a type body did not work as I needed it to work and in system.nim macros are not allowed. So I guess a macro is not a solution here.
The text was updated successfully, but these errors were encountered:
distinct
hides theref
nature of the type.Example
Current Output
(if
echo y.value
is commented out)Expected Output
new on the distinct ref should not make the type into a double indirection.
Additional Information/Possible Solution
I was working on
https://github.com/nim-lang/Nim/issues/9566
and the problem is that inoptions.nim
the expressionwhen T is SomePointer
does not work for distinct ref types. Then I saw a very similar pattern insystem.nim
:when (t is ref):
in procnew
. Usually I would fix this problem with a macro that transforms the type in the way I want to. But in #9566 I could not fix in, because a macro in a type body did not work as I needed it to work and insystem.nim
macros are not allowed. So I guess a macro is not a solution here.The text was updated successfully, but these errors were encountered: