Bug 5122 – Error messages that show the package/module name too of a function

Status
RESOLVED
Resolution
DUPLICATE
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2010-10-26T13:12:00Z
Last change time
2012-10-21T16:08:17Z
Keywords
diagnostic
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2010-10-26T13:12:58Z
This is small D2 module, file named "mod.d": module mod; int foo(int x) { return x; } This is a wrong small module that imports "mod.d", named "test.d": import mod: foo; pure int bar(int x) { return foo(x); } void main() {} DMD 2.050alpha gives the error message: test.d(3): Error: pure function 'bar' cannot call impure function 'foo' In this case it's easy to find "bar" and fix the bug, but this is less easy when "test" imports many modules and functions. So I'd like a better error message, that shows the module name too of "foo". This is a possible improved error message: test.d(3): Error: pure function 'bar' cannot call impure function 'foo' of module 'mod'. An alternative: test.d(3): Error: pure function 'bar' cannot call impure function 'mod.foo'. (If "foo" is inside another package it's better to give the name of the package too.)
Comment #1 by andrej.mitrovich — 2012-10-21T16:08:17Z
*** This issue has been marked as a duplicate of issue 7050 ***