introduce precise string '[]', '[]=' accessors; fixes #8049 (#8817)

This commit is contained in:
Andreas Rumpf 2018-08-30 23:01:15 +02:00 • committed by GitHub
commit df4d5b77a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 3 deletions

View file

@ -2132,6 +2132,10 @@ proc paramTypesMatch*(m: var TCandidate, f, a: PType,
styleCheckUse(arg.info, arg.sons[best].sym)
result = paramTypesMatchAux(m, f, arg.sons[best].typ, arg.sons[best],
argOrig)
when false:
if m.calleeSym != nil and m.calleeSym.name.s == "[]":
echo m.c.config $ arg.info, " for ", m.calleeSym.name.s, " ", m.c.config $ m.calleeSym.info
writeMatches(m)
proc setSon(father: PNode, at: int, son: PNode) =
let oldLen = father.len
@ -2380,6 +2384,11 @@ proc matches*(c: PContext, n, nOrig: PNode, m: var TCandidate) =
if m.magic in {mArrGet, mArrPut}:
m.state = csMatch
m.call = n
# Note the following doesn't work as it would produce ambiguities.
# Instead we patch system.nim, see bug #8049.
when false:
inc m.genericMatches
inc m.exactMatches
return
var marker = initIntSet()
matchesAux(c, n, nOrig, m, marker)