tests and docs for call operator (#16980)

* tests and docs for call operator

* fix leftover

* add extra dot test
This commit is contained in:
hlaaftana 2021-02-09 14:18:16 +03:00 • committed by GitHub
commit aac8f67573
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 124 additions and 1 deletions

View file

@ -17,6 +17,14 @@ one param call to c with 10
'''
"""
block:
type Foo = object
var a: Foo
template `.`(a: Foo, b: untyped): untyped = astToStr(b)
template callme(a, f): untyped = a.f
doAssert callme(a, f2) == "f2" # not `f`
doAssert a.callme(f3) == "f3"
type
T1 = object
x*: int