www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14320] New: Improve diagnostic message for "undefined

https://issues.dlang.org/show_bug.cgi?id=14320

          Issue ID: 14320
           Summary: Improve diagnostic message for "undefined identifier"
                    error
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: k.hara.pg gmail.com

-- gui/widgget.d -----
module gui.widget;

class Style {}  // originally existed in gui.style

class Widget
{
    Style style() {}
    void layoutChildren(bool fit, Widget positionReference) {}
}
----

-- controls/tree.d ---
module controls.tree;

import gui.widget;

class Tree : Widget
{
    override void layoutChildren(bool fit, Widget positionReference)
    {
        gui.style.Style st = style; // line 9
    }
}
----

The error diagnostic is:

controls/tree.d(9): Error: undefined identifier 'style'


It actually explains the unexistent of module 'gui.style' in package 'gui', but
it sounds like the explanation for the invisibility of Widget.style() function.

I think it should be improved as follows:

controls/tree.d(9): Error: undefined identifier 'gui.style' in package 'gui'

--
Mar 23 2015