* 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
|
|
@ -170,3 +170,49 @@ var
|
|||
s: StringValue16
|
||||
|
||||
echo s
|
||||
|
||||
block: #13529
|
||||
block:
|
||||
type Foo[T: static type] = object
|
||||
var foo: Foo["test"]
|
||||
doAssert $foo == "()"
|
||||
doAssert foo.T is string
|
||||
static: doAssert foo.T == "test"
|
||||
doAssert not compiles(
|
||||
block:
|
||||
type Foo2[T: static type] = object
|
||||
x: T)
|
||||
|
||||
block:
|
||||
type Foo[T: static[float]] = object
|
||||
var foo: Foo[1.2]
|
||||
doAssert $foo == "()"
|
||||
doAssert foo.T == 1.2
|
||||
|
||||
block: # routines also work
|
||||
proc fun(a: static) = (const a2 = a)
|
||||
fun(1)
|
||||
fun(1.2)
|
||||
block: # routines also work
|
||||
proc fun(a: static type) = (const a2 = a)
|
||||
fun(1)
|
||||
fun(1.2)
|
||||
|
||||
block: # this also works
|
||||
proc fun[T](a: static[T]) = (const a2 = a)
|
||||
fun(1)
|
||||
fun(1.2)
|
||||
|
||||
block: # #12713
|
||||
block:
|
||||
type Cell = object
|
||||
c: int
|
||||
proc test(c: static string) = discard #Remove this and it compiles
|
||||
proc test(c: Cell) = discard
|
||||
test Cell(c: 0)
|
||||
block:
|
||||
type Cell = object
|
||||
c: int
|
||||
proc test(c: static string) = discard #Remove this and it compiles
|
||||
proc test(c: Cell) = discard
|
||||
test Cell()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue