summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2020-04-29 21:58:59 +0200
committerGitHub <noreply@github.com>2020-04-29 21:58:59 +0200
commitd9e907c0e2a58630f7b57c0afbe51c05fcf6b3ab (patch)
treeee7ad5e4bf27372a763dda5426dcd3ebdb4bc9f0 /compiler
parent707367e1ca231d964ba82a92b642eb5efdc1aa7c (diff)
downloadNim-d9e907c0e2a58630f7b57c0afbe51c05fcf6b3ab.tar.gz
fixes #14079 [backport:1.2] (#14163)
Diffstat (limited to 'compiler')
-rw-r--r--compiler/sempass2.nim3
-rw-r--r--compiler/sigmatch.nim3
-rw-r--r--compiler/sinkparameter_inference.nim3
3 files changed, 5 insertions, 4 deletions
diff --git a/compiler/sempass2.nim b/compiler/sempass2.nim
index b801f4531..0fdf25850 100644
--- a/compiler/sempass2.nim
+++ b/compiler/sempass2.nim
@@ -854,7 +854,8 @@ proc track(tracked: PEffects, n: PNode) =
     when false: cstringCheck(tracked, n)
     if tracked.owner.kind != skMacro:
       createTypeBoundOps(tracked, n[0].typ, n.info)
-    checkForSink(tracked.config, tracked.owner, n[1])
+    if n[0].kind != nkSym or not isLocalVar(tracked, n[0].sym):
+      checkForSink(tracked.config, tracked.owner, n[1])
   of nkVarSection, nkLetSection:
     for child in n:
       let last = lastSon(child)
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim
index 6c8f926dd..e209f5d78 100644
--- a/compiler/sigmatch.nim
+++ b/compiler/sigmatch.nim
@@ -548,7 +548,8 @@ proc allowsNilDeprecated(c: TCandidate, f: PType): TTypeRelation =
     result = isNone
 
 proc inconsistentVarTypes(f, a: PType): bool {.inline.} =
-  result = f.kind != a.kind and (f.kind in {tyVar, tyLent} or a.kind in {tyVar, tyLent})
+  result = f.kind != a.kind and
+    (f.kind in {tyVar, tyLent, tySink} or a.kind in {tyVar, tyLent, tySink})
 
 proc procParamTypeRel(c: var TCandidate, f, a: PType): TTypeRelation =
   ## For example we have:
diff --git a/compiler/sinkparameter_inference.nim b/compiler/sinkparameter_inference.nim
index 1becc250e..182e44324 100644
--- a/compiler/sinkparameter_inference.nim
+++ b/compiler/sinkparameter_inference.nim
@@ -48,8 +48,7 @@ proc checkForSink*(config: ConfigRef; owner: PSym; arg: PNode) =
         # we only report every potential 'sink' parameter only once:
         incl arg.sym.flags, sfWasForwarded
         message(config, arg.info, hintPerformance,
-          ("could not turn '$1' to a sink parameter " &
-          "because '$2' was forward declared") % [arg.sym.name.s, owner.name.s])
+          "could not turn '$1' to a sink parameter" % [arg.sym.name.s])
       #echo config $ arg.info, " candidate for a sink parameter here"
   of nkStmtList, nkStmtListExpr, nkBlockStmt, nkBlockExpr:
     if not isEmptyType(arg.typ):