fix dot calls with resolved symbols in templates (#22076)

* fix dot calls with resolved symbols in templates

* make old code work

* fix custom number literals test

* remove leftover debug marker

* enable "bug 9" test too

* fix renderer, add test for #7085
This commit is contained in:
metagn
2023-06-12 07:34:34 +03:00
committed by GitHub
parent e0ad71a912
commit 71801c2b8f
6 changed files with 57 additions and 25 deletions

View File

@@ -0,0 +1,22 @@
# issue #20073
type Foo = object
proc foo(f: Foo) = discard
template works*() =
var f: Foo
foo(f)
template boom*() =
var f: Foo
f.foo() # Error: attempting to call undeclared routine: 'foo'
f.foo # Error: undeclared field: 'foo' for type a.Foo
# issue #7085
proc bar(a: string): string =
return a & "bar"
template baz*(a: string): string =
var b = a.bar()
b

View File

@@ -0,0 +1,10 @@
import mdotcall
# issue #20073
works()
boom()
# issue #7085
doAssert baz("hello") == "hellobar"
doAssert baz"hello" == "hellobar"
doAssert "hello".baz == "hellobar"