www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8894] New: 2.059: Lookup error message has become uninformative

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

           Summary: 2.059: Lookup error message has become uninformative
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com



16:11:17 PDT ---
module test;
struct Foo { }

void main()
{
    Foo f;
    auto x = f.x;
}

2.058:
$ dmd test.d
test.d(6): Error: no property 'x' for type 'Foo'

2.059:
$dmd test.d
test.d(6): Error: undefined identifier 'x'

Best guess: it's probably related to UFCS changes in 2.059.

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




16:17:19 PDT ---

 module test;
 struct Foo { }
 
 void main()
 {
     Foo f;
     auto x = f.x;
 }
 
 2.058:
 $ dmd test.d
 test.d(6): Error: no property 'x' for type 'Foo'
 
 2.059:
 $dmd test.d
 test.d(6): Error: undefined identifier 'x'
 
 Best guess: it's probably related to UFCS changes in 2.059.
It seems errors are gagged at this point in "Expression *Type::getProperty(Loc loc, Identifier *ident)" in file mtype.c: if (this != Type::terror) { assert(global.gag); // << passes if (s) error(loc, "no property '%s' for type '%s', did you mean '%s'?", ident->toChars(), toChars(), s->toChars()); else error(loc, "no property '%s' for type '%s'", ident->toChars(), toChars()); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 25 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8894




16:24:25 PDT ---

 It seems errors are gagged at this point in "Expression *Type::getProperty(Loc
 loc, Identifier *ident)" in file mtype.c:
The gagging starts in `DotIdExp::semantic(Scope *sc, int flag)` with a nice comment: /* This would be much better if we added a "hasProperty" method to types, * i.e. the gagging is a bad way. */ // .. Type *t1 = e1->type; unsigned errors = global.startGagging(); e = t1->dotExp(sc, e1, ident); if (global.endGagging(errors)) // if failed to find the property { e1->type = t1; // kludge to restore type e = resolveUFCSProperties(sc, this); } e = e->semantic(sc); return e; So it seems UFCS really is to blame. Type properties are checked first, then UFCS is checked, however if neither of them have a match then we should print out the property error rather than the UFCS error. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 25 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8894




12:35:01 PDT ---
I've been thinking.. maybe we could change the verrorPrint function to print to
a buffer by default, and then print that to stdout/stderr from the caller
function when gagging is off, but store the error to the global struct if
gagging is on. That way we can recover the previous error messages if resolving
UFCS failed.

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




12:39:14 PDT ---

 I've been thinking.. maybe we could change the verrorPrint function to print to
 a buffer by default, and then print that to stdout/stderr from the caller
 function when gagging is off, but store the error to the global struct if
 gagging is on. That way we can recover the previous error messages if resolving
 UFCS failed.
Essentially the code would then look something like this: Type *t1 = e1->type; unsigned errors = global.startGagging(); e = t1->dotExp(sc, e1, ident); OutBuffer oldErrors; // new if (global.endGagging(errors, &oldErrors)) // new { e1->type = t1; // kludge to restore type errors = global.startGagging(); // new e = resolveUFCSProperties(sc, this); if(global.endGagging(errors)) // new printErrors(&oldErrors); // new } e = e->semantic(sc); return e; "&oldErrors" would be an optional parameter where current errors are stored, as the old errors would be cleared on the call to endGagging. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 26 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8894




Easy way would be, if errors aren't gagged (so that we care about which error
message occurs), to gag the UFCS attempt, and if it fails, make the property
call again.

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


Walter Bright <bugzilla digitalmars.com> changed:

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



22:57:15 PST ---
https://github.com/D-Programming-Language/dmd/pull/1274

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




04:20:12 PST ---
https://github.com/D-Programming-Language/dmd/pull/1361

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


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

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



09:06:22 PST ---
*** Issue 9128 has been marked as a duplicate of this issue. ***

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




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/a0a63bbf95ab82ed9e599d1641f7bd9968c7a9bb
Fixes Issue 8894 - Regression with property lookup error message.

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


Issue 8894 - Regression with property lookup error message.

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


Walter Bright <bugzilla digitalmars.com> changed:

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


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