www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7481] New: Compiler should 'soldier on' after template errors

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7481

           Summary: Compiler should 'soldier on' after template errors
           Product: D
           Version: D1 & D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: clugdbug yahoo.com.au



At the start of TemplateInstance::semantic is this code:
    if (global.errors)
    {
        //printf("not instantiating %s due to %d errors\n", toChars(),
global.errors);
        if (!global.gag)
        {
            /* Trying to soldier on rarely generates useful messages
             * at this point.
             */
            fatal();
        }
It's a hack, really. This has the effect that after ANY error, any template
instantiation will abort compilation completely. Back in the Bad Old Days, when
the compiler soldiered on, it would spew reams of garbage and then crash. But
now, with all of the ErrorExp improvements, soldiering on does in fact generate
useful error messages.
If there have been errors in the template arguments, obviously it shouldn't
instantiate it, but there's no need to abort compilation completely. More
importantly, notice that it *does* continue if errors are gagged.  Aborting
compilation is hampering our ability to observe what it's doing.
Soldiering on will help make it more robust.

Simple example: this code should generate two errors, one for 'zoo' and one for
'roo'.

int foo(X)(X x) { return 6; }

void main()
{
  foo!(zoo)(5);
  foo!(double)(roo);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 10 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7481


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com



23:35:18 PST ---
The place I'd like to get is to continue compiling anything that does not
depend on something that already failed. We're partway there with the way
expressions are evaluated.

For templates, it should try to instantiate one only if its arguments are free
of errors.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 10 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7481





 The place I'd like to get is to continue compiling anything that does not
 depend on something that already failed. We're partway there with the way
 expressions are evaluated.
 
 For templates, it should try to instantiate one only if its arguments are free
 of errors.
That's basically what this patch does. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 11 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7481




https://github.com/D-Programming-Language/dmd/pull/708

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 11 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7481


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc



I'm seeing a huge amount of error messages. It's excessive, please improve the
situation.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 18 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7481


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



https://github.com/D-Programming-Language/dmd/commit/b19906ed843b719f3a429ee0c18601296647e340

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