* fixes #12883

* fix comment

* add normalize

* fix
This commit is contained in:
cooldome 2019-12-13 13:30:27 +00:00 • committed by GitHub
commit 12d2b980e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 47 additions and 1 deletions

View file

@ -758,6 +758,19 @@ proc track(tracked: PEffects, n: PNode) =
if n[1].typ.len > 0:
createTypeBoundOps(tracked, n[1].typ.lastSon, n.info)
createTypeBoundOps(tracked, n[1].typ, n.info)
if a.kind == nkSym and a.sym.name.s.len > 0 and a.sym.name.s[0] == '=' and
tracked.owner.kind != skMacro:
let opKind = find(AttachedOpToStr, a.sym.name.s.normalize)
if opKind != -1:
# rebind type bounds operations after createTypeBoundOps call
let t = n[1].typ.skipTypes({tyAlias, tyVar})
if a.sym != t.attachedOps[TTypeAttachedOp(opKind)]:
createTypeBoundOps(tracked, t, n.info)
let op = t.attachedOps[TTypeAttachedOp(opKind)]
if op != nil:
n[0].sym = op
for i in 0..<n.safeLen:
track(tracked, n[i])
of nkDotExpr: