www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15868] New: Inappropriate error message: "base type must be

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

          Issue ID: 15868
           Summary: Inappropriate error message: "base type must be class
                    or interface" (and it is)
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: andy.pj.hanson gmail.com

This bug requires multiple modules to reproduce.

app.d:

    import cls : Cls;
    void main() {}

cls.d:

    import ifc : Ifc;
    class Cls : Ifc {}

ifc.d:

    import cls : Cls;
    interface Ifc {}

    // This class causes the error,
    // but it isn't mentioned in the error message.
    class ClsHolder {Cls.Cls cls;}

The error message is:
    src/cls.d(2,1): Error: class cls.Cls base type must be class or interface,
not Ifc

A better message would be something like: `src/ifc.d(6,20): Error: symbol
Cls.Cls not found.`
(The error will disappear if ClsHolder is changed from using `Cls.Cls` to just
`Cls`.)

--
Apr 03 2016