[Issue 4563] [module system] Error messages for missing package or missing name

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Oct 24 11:19:12 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=4563



--- Comment #13 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2012-10-24 11:19:11 PDT ---
(In reply to comment #11)
> (In reply to comment #10)
> 
> > Ok, I'll implement a pull and see what others think about it.
> 
> Thank you.

I think we can do even better:

import foo.bar.doo;

Now it's
test.d(3): Error: module doo is in file 'foo\bar\doo.d' which cannot be read

If 'foo' doesn't exist the error should probably be:
test.d(3): Error: package 'foo' not found

If 'bar' doesn't exist it should be:
test.d(3): Error: package 'bar' not found in package 'foo'

If 'doo' doesn't exist:
test.d(3): Error: module 'doo' not found in package 'foo.bar'

Also, we might consider doing informative spellchecker errors, e.g.:

import std.stddio;
test.d(3): Error: module 'stddio' not found in package 'std', did you mean
'stdio'?

The above should probably try finding D modules that are similar to 'stddio',
read their module declaration (because it might be different from the
filename), and if the module declaration is similar to 'stddio' it should print
that module name as a recommendation.

import stdd.stdio;
test.d(3): Error: package 'stdd' not found, did you mean 'std'?

Here we might try finding non-empty folders with .d or .di files named
similarly to 'stdd' and recommend such a folder.

I don't know how hard this will be but I think it's worth pursuing.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list