fix #12864 static params were mutating arg types during sigmatch; fix #12713 ; refs #13529 (#13976)

* 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:
Timothee Cour 2020-04-14 06:00:02 -07:00 • committed by GitHub
commit 10eabec6d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 77 additions and 6 deletions

View file

@ -171,3 +171,27 @@ echo inSize([
[1, 2, 3],
[4, 5, 6]
])
block: # #12864
template fun() =
type Object = object
proc fun(f: Object): int = 1
proc fun(f: static[int]): int = 2
doAssert fun(Object()) == 1
var a: Object
doAssert fun(a) == 1
proc fun2(f: Object): int = 1
proc fun2(f: static[Object]): int = 2
doAssert fun2(Object()) == 2
doAssert fun2(a) == 1
const a2 = Object()
doAssert fun2(a2) == 2
fun()
static: fun()
when true: #12864 original snippet
import times
discard times.format(initDateTime(30, mMar, 2017, 0, 0, 0, 0, utc()), TimeFormat())