parent
9cb5ab0108
commit
fa0209609d
5 changed files with 33 additions and 12 deletions
|
|
@ -2260,20 +2260,20 @@ proc semStmtList(c: PContext, n: PNode, flags: TExprFlags): PNode =
|
||||||
# nkNilLit, nkEmpty}:
|
# nkNilLit, nkEmpty}:
|
||||||
# dec last
|
# dec last
|
||||||
for i in 0..<n.len:
|
for i in 0..<n.len:
|
||||||
var expr = semExpr(c, n[i], flags)
|
var x = semExpr(c, n[i], flags)
|
||||||
n[i] = expr
|
n[i] = x
|
||||||
if c.matchedConcept != nil and expr.typ != nil and
|
if c.matchedConcept != nil and x.typ != nil and
|
||||||
(nfFromTemplate notin n.flags or i != last):
|
(nfFromTemplate notin n.flags or i != last):
|
||||||
case expr.typ.kind
|
case x.typ.kind
|
||||||
of tyBool:
|
of tyBool:
|
||||||
if expr.kind == nkInfix and
|
if x.kind == nkInfix and
|
||||||
expr[0].kind == nkSym and
|
x[0].kind == nkSym and
|
||||||
expr[0].sym.name.s == "==":
|
x[0].sym.name.s == "==":
|
||||||
if expr[1].typ.isUnresolvedStatic:
|
if x[1].typ.isUnresolvedStatic:
|
||||||
inferConceptStaticParam(c, expr[1], expr[2])
|
inferConceptStaticParam(c, x[1], x[2])
|
||||||
continue
|
continue
|
||||||
elif expr[2].typ.isUnresolvedStatic:
|
elif x[2].typ.isUnresolvedStatic:
|
||||||
inferConceptStaticParam(c, expr[2], expr[1])
|
inferConceptStaticParam(c, x[2], x[1])
|
||||||
continue
|
continue
|
||||||
|
|
||||||
let verdict = semConstExpr(c, n[i])
|
let verdict = semConstExpr(c, n[i])
|
||||||
|
|
|
||||||
|
|
@ -625,7 +625,7 @@ proc procTypeRel(c: var TCandidate, f, a: PType): TTypeRelation =
|
||||||
return isNone
|
return isNone
|
||||||
elif a[0] != nil:
|
elif a[0] != nil:
|
||||||
return isNone
|
return isNone
|
||||||
|
|
||||||
result = getProcConvMismatch(c.c.config, f, a, result)[1]
|
result = getProcConvMismatch(c.c.config, f, a, result)[1]
|
||||||
|
|
||||||
when useEffectSystem:
|
when useEffectSystem:
|
||||||
|
|
@ -2272,6 +2272,8 @@ proc prepareOperand(c: PContext; formal: PType; a: PNode): PNode =
|
||||||
else:
|
else:
|
||||||
result = a
|
result = a
|
||||||
considerGenSyms(c, result)
|
considerGenSyms(c, result)
|
||||||
|
if result.kind != nkHiddenDeref and result.typ.kind in {tyVar, tyLent} and c.matchedConcept == nil:
|
||||||
|
result = newDeref(result)
|
||||||
|
|
||||||
proc prepareOperand(c: PContext; a: PNode): PNode =
|
proc prepareOperand(c: PContext; a: PNode): PNode =
|
||||||
if a.typ.isNil:
|
if a.typ.isNil:
|
||||||
|
|
|
||||||
17
tests/arc/tkeys_lent.nim
Normal file
17
tests/arc/tkeys_lent.nim
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
discard """
|
||||||
|
output: '''{"string": 2}'''
|
||||||
|
cmd: "nim c --gc:orc $file"
|
||||||
|
"""
|
||||||
|
|
||||||
|
import tables
|
||||||
|
|
||||||
|
proc use(x: int) = echo x
|
||||||
|
|
||||||
|
proc main =
|
||||||
|
var tab = {"string": 1}.toTable
|
||||||
|
for keyAAA in tab.keys():
|
||||||
|
template alias(): untyped = tab[keyAAA]
|
||||||
|
alias() = 2
|
||||||
|
echo tab
|
||||||
|
|
||||||
|
main()
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
discard """
|
discard """
|
||||||
output: "pcDir\npcFile\npcLinkToDir\npcLinkToFile\n"
|
output: "pcDir\npcFile\npcLinkToDir\npcLinkToFile\n"
|
||||||
|
joinable: false
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os, strutils
|
import os, strutils
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ __really_obscure_dir_name/test
|
||||||
Raises
|
Raises
|
||||||
Raises
|
Raises
|
||||||
'''
|
'''
|
||||||
|
joinable: false
|
||||||
"""
|
"""
|
||||||
# test os path creation, iteration, and deletion
|
# test os path creation, iteration, and deletion
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue