Fix fromPreserve for distinct types
This is an example of why bypassing the type system with "when" is dangerous.
This commit is contained in:
parent
1cf0df255f
commit
6c4cfa0885
|
@ -780,7 +780,7 @@ proc fromPreserve*[T, E](v: var T; pr: Preserve[E]): bool =
|
|||
elif compiles(fromPreserveHook(v, pr)):
|
||||
result = fromPreserveHook(v, pr)
|
||||
elif T is distinct:
|
||||
result = fromPreserve(result.distinctBase, pr)
|
||||
result = fromPreserve(v.distinctBase, pr)
|
||||
elif T is enum:
|
||||
if pr.isSymbol:
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue