-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 (cherry picked from commit 71801c2)
- Loading branch information
Showing
6 changed files
with
57 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import mdotcall | ||
|
||
# issue #20073 | ||
works() | ||
boom() | ||
|
||
# issue #7085 | ||
doAssert baz("hello") == "hellobar" | ||
doAssert baz"hello" == "hellobar" | ||
doAssert "hello".baz == "hellobar" |