Fix patterns grab recursion

This commit is contained in:
Emery Hemingway 2023-12-31 20:06:12 +02:00
parent c0cff79313
commit a0355637d8
1 changed files with 2 additions and 2 deletions

View File

@ -103,7 +103,7 @@ proc grab*[T](pr: Value): Pattern =
else:
raise newException(ValueError, "cannot generate a pattern for unhandled Value type")
proc grab*[T](val: T): Pattern =
proc grab*[T](x: T): Pattern =
## Construct a `Pattern` from value of type `T`.
runnableExamples:
from std/unittest import check
@ -111,7 +111,7 @@ proc grab*[T](val: T): Pattern =
$grab(true) == "<lit #t>"
$grab(3.14) == "<lit 3.14>"
$grab([0, 1, 2, 3]) == "<arr [<lit 0> <lit 1> <lit 2> <lit 3>]>"
grab(val)
grab(x.toPreserves)
proc patternOfType(typ: static typedesc; `bind`: static bool): Pattern =
when typ is ref: