summary refs log tree commit diff stats
path: root/compiler/semcall.nim
diff options
context:
space:
mode:
authorDean Thompson <deansherthompson@gmail.com>2019-01-21 16:40:04 -0500
committerGitHub <noreply@github.com>2019-01-21 16:40:04 -0500
commita6de0274ee768d135bab280d2b2700a0bb475300 (patch)
tree176b91e837ab7d2217713665c16fc28163017960 /compiler/semcall.nim
parent5b39c7aca91c1d20eb81425cf8f3854876aed475 (diff)
parentee89ba6bdb664fe4972f2917499cff1afdac0bab (diff)
downloadNim-a6de0274ee768d135bab280d2b2700a0bb475300.tar.gz
Merge pull request #1 from nim-lang/devel
Getting the latest from nim-lang
Diffstat (limited to 'compiler/semcall.nim')
-rw-r--r--compiler/semcall.nim13
1 files changed, 12 insertions, 1 deletions
diff --git a/compiler/semcall.nim b/compiler/semcall.nim
index 7e0ea5490..3723d3fc1 100644
--- a/compiler/semcall.nim
+++ b/compiler/semcall.nim
@@ -287,7 +287,18 @@ proc getMsgDiagnostic(c: PContext, flags: TExprFlags, n, f: PNode): string =
 
   let ident = considerQuotedIdent(c, f, n).s
   if nfDotField in n.flags and nfExplicitCall notin n.flags:
-    result = errUndeclaredField % ident & result
+    let sym = n.sons[1].typ.sym
+    var typeHint = ""
+    if sym == nil:
+      # Perhaps we're in a `compiles(foo.bar)` expression, or
+      # in a concept, eg:
+      #   ExplainedConcept {.explain.} = concept x
+      #     x.foo is int
+      # We coudl use: `(c.config $ n.sons[1].info)` to get more context.
+      discard
+    else:
+      typeHint = " for type " & getProcHeader(c.config, sym)
+    result = errUndeclaredField % ident & typeHint & " " & result
   else:
     if result.len == 0: result = errUndeclaredRoutine % ident
     else: result = errBadRoutine % [ident, result]