Skip to content

Commit

Permalink
also fixes nim-lang#7777
Browse files Browse the repository at this point in the history
  • Loading branch information
metagn committed Nov 26, 2022
1 parent 9bb5d2c commit 3fbdb10
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/specialops/terrmsgs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,23 @@ block:
# non-routine type shows `()` overloads:
b(123) #[tt.Error
^ type mismatch: got <Bar, int literal(123)>]#

# issue #7777

import macros

block:
type TestType = object
private_field: string

when false:
template getField(obj, field: untyped): untyped = obj.field

macro `.`(obj: TestType, field: untyped): untyped =
let private = newIdentNode("private_" & $field)
result = quote do:
`obj`.getField(`private`) #[tt.Error
^ undeclared field: 'getField' for type terrmsgs.TestType [type declared in terrmsgs.nim(63, 8)]#

var tt: TestType
discard tt.field

0 comments on commit 3fbdb10

Please sign in to comment.