* fixes #8794 : `Error: undeclared field: 'foo'` should show type (+ where type is defined) (hard to guess in generic code) * fixes #9270: `--listFullPaths` not honored by `declared in foo.nim` messages * fixes #9767: VM stacktrace doesn't honor --excessiveStackTrace:on * fixes #9768: VM stacktrace misses column info, can lead to ambiguous or harder to read stacktraces * refactors some col+1 code to col + ColOffset (self documents code) * make getProcHeader show declared info location also for types and all routine kinds (including macros,templates) instead of just (rather arbitrarily) for iterator,proc,func,method * --listFullPaths now is honored in more places * fix typo system/except.nim => lib/system/excpt.nim * remove substr(foo, 0) hack in compiler/vm.nim which seems old and not applicable anymore
This commit is contained in:
parent
fb26b95f81
commit
bf3a308e86
9 changed files with 129 additions and 31 deletions
|
|
@ -287,7 +287,20 @@ 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 o
|
||||
o.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]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue