* fix #12864 static params were mutating arg types during sigmatch * fix test * fix StaticParam * also fixes #12713; added test case
This commit is contained in:
parent
c269964860
commit
10eabec6d4
6 changed files with 77 additions and 6 deletions
|
|
@ -93,7 +93,7 @@ since (1, 1):
|
|||
# Note: `[]` currently gives: `Error: no generic parameters allowed for ...`
|
||||
type(default(T)[i])
|
||||
|
||||
type StaticParam*[value] = object
|
||||
type StaticParam*[value: static type] = object
|
||||
## used to wrap a static value in `genericParams`
|
||||
|
||||
# NOTE: See https://github.com/nim-lang/Nim/issues/13758 - `import std/macros` does not work on OpenBSD
|
||||
|
|
@ -118,13 +118,12 @@ macro genericParamsImpl(T: typedesc): untyped =
|
|||
let ai = impl[i]
|
||||
var ret: NimNode
|
||||
case ai.typeKind
|
||||
of ntyStatic:
|
||||
since (1, 1):
|
||||
ret = newTree(nnkBracketExpr, @[bindSym"StaticParam", ai])
|
||||
of ntyTypeDesc:
|
||||
ret = ai
|
||||
of ntyStatic: doAssert false
|
||||
else:
|
||||
assert false, $(ai.typeKind, ai.kind)
|
||||
since (1, 1):
|
||||
ret = newTree(nnkBracketExpr, @[bindSym"StaticParam", ai])
|
||||
result.add ret
|
||||
break
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue