summary refs log tree commit diff stats
path: root/compiler/sigmatch.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2016-07-14 23:20:38 +0200
committerAndreas Rumpf <rumpf_a@web.de>2016-07-15 00:22:14 +0200
commit995727ffd0cef78231203523d7a3c36bb014b30d (patch)
tree9294d9ccfdd3bdadd27c03b3fe4c7d6443c46edb /compiler/sigmatch.nim
parent50e3ca9f3628c256f5f8e9936f38efd77d445131 (diff)
downloadNim-995727ffd0cef78231203523d7a3c36bb014b30d.tar.gz
decent error message for 'var T' problems
Diffstat (limited to 'compiler/sigmatch.nim')
-rw-r--r--compiler/sigmatch.nim4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim
index 8c8c83d0f..7c57936eb 100644
--- a/compiler/sigmatch.nim
+++ b/compiler/sigmatch.nim
@@ -22,7 +22,7 @@ type
   TCandidateState* = enum
     csEmpty, csMatch, csNoMatch
 
-  CandidateErrors* = seq[PSym]
+  CandidateErrors* = seq[(PSym,int)]
   TCandidate* = object
     c*: PContext
     exactMatches*: int       # also misused to prefer iters over procs
@@ -49,6 +49,7 @@ type
                              # a distrinct type
     typedescMatched*: bool
     isNoCall*: bool          # misused for generic type instantiations C[T]
+    mutabilityProblem*: uint8 # tyVar mismatch
     inheritancePenalty: int  # to prefer closest father object type
     errors*: CandidateErrors # additional clarifications to be displayed to the
                              # user if overload resolution fails
@@ -1579,6 +1580,7 @@ proc matchesAux(c: PContext, n, nOrig: PNode,
     if formal.typ.kind == tyVar:
       if not n.isLValue:
         m.state = csNoMatch
+        m.mutabilityProblem = uint8(f-1)
         return
 
   var