fixes #5638
This commit is contained in:
parent
e105c04e49
commit
87732f797c
2 changed files with 19 additions and 3 deletions
|
|
@ -250,13 +250,11 @@ proc resolveOverloads(c: PContext, n, orig: PNode,
|
|||
if result.state in {csEmpty, csNoMatch}:
|
||||
tryOp "."
|
||||
|
||||
elif nfDotSetter in n.flags:
|
||||
internalAssert f.kind == nkIdent and n.sonsLen == 3
|
||||
elif nfDotSetter in n.flags and f.kind == nkIdent and n.len == 3:
|
||||
let calleeName = newStrNode(nkStrLit,
|
||||
f.ident.s[0..f.ident.s.len-2]).withInfo(n.info)
|
||||
let callOp = newIdentNode(getIdent".=", n.info)
|
||||
n.sons[0..1] = [callOp, n[1], calleeName]
|
||||
#excl(n.flags, nfDotSetter)
|
||||
orig.sons[0..1] = [callOp, orig[1], calleeName]
|
||||
pickBest(callOp)
|
||||
|
||||
|
|
|
|||
18
tests/metatype/tcompilesregression.nim
Normal file
18
tests/metatype/tcompilesregression.nim
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
discard """
|
||||
output: '''ok'''
|
||||
"""
|
||||
|
||||
# bug #5638
|
||||
|
||||
type X = object
|
||||
a_impl: int
|
||||
|
||||
proc a(x: X): int =
|
||||
x.a_impl
|
||||
|
||||
var x: X
|
||||
assert(not compiles((block:
|
||||
x.a = 1
|
||||
)))
|
||||
|
||||
echo "ok"
|
||||
Loading…
Add table
Add a link
Reference in a new issue