Thread overview
[Issue 5785] New: Lexing or Parsing issue with UFCS
Mar 25, 2011
Andrej Mitrovic
Mar 25, 2011
Andrej Mitrovic
Mar 25, 2011
kennytm@gmail.com
Mar 26, 2011
Rainer Schuetze
Apr 08, 2011
Rainer Schuetze
May 18, 2011
kennytm@gmail.com
Jul 09, 2011
yebblies
Jul 14, 2011
kennytm@gmail.com
Aug 12, 2011
Walter Bright
March 25, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5785

           Summary: Lexing or Parsing issue with UFCS
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: andrej.mitrovich@gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2011-03-25 16:01:57 PDT ---
import std.stdio;
import std.file;
import std.path;
int[string] fileExtensions;
void main()
{
    string filename;
    if (!filename.isFile || filename.getExt !in fileExtensions)
    {
    }
}

> test.d(13): template argument expected following !

The way around this is to not use UFCS:
if (!filename.isFile || getExt(filename) !in fileExtensions)

which is a damn shame because UFCS is a great thing to have.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 25, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5785



--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2011-03-25 16:04:15 PDT ---
Note that `is` _can_ be used, but `!is` cannot. Hence:

This builds fine:
if (!filename.isFile || filename.getExt in fileExtensions)

This doesn't:
if (!filename.isFile || filename.getExt !in fileExtensions)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 25, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5785


kennytm@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kennytm@gmail.com


--- Comment #2 from kennytm@gmail.com 2011-03-25 16:23:18 PDT ---
Workaround:


    if (!filename.isFile || (filename.getExt) !in fileExtensions)


----

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 26, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5785


Rainer Schuetze <r.sagitario@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |r.sagitario@gmx.de


--- Comment #3 from Rainer Schuetze <r.sagitario@gmx.de> 2011-03-26 01:20:53 PDT ---
I think !is and !in should be single tokens. Right now, you can write spaces and comments between ! and is/in.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 08, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5785


Rainer Schuetze <r.sagitario@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


--- Comment #4 from Rainer Schuetze <r.sagitario@gmx.de> 2011-04-08 00:17:27 PDT ---
Here is a patch that allows to deal with this without creating new tokens:

diff --git a/src/parse.c b/src/parse.c
index 162fa85..199cf89 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -5380,9 +5380,10 @@ Expression *Parser::parsePostExp(Expression *e)
                 nextToken();
                 if (token.value == TOKidentifier)
                 {   Identifier *id = token.ident;
+                    enum TOK save;

                     nextToken();
-                    if (token.value == TOKnot && peekNext() != TOKis)
+                    if (token.value == TOKnot && (save = peekNext()) != TOKis
&& save != TOKin)
                     {   // identifier!(template-argument-list)
                         TemplateInstance *tempinst = new TemplateInstance(loc,
id);
                         Objects *tiargs;

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 18, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5785


kennytm@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dsimcha@yahoo.com


--- Comment #5 from kennytm@gmail.com 2011-05-18 13:50:25 PDT ---
*** Issue 6031 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: -------
July 09, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5785


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies@gmail.com


--- Comment #6 from yebblies <yebblies@gmail.com> 2011-07-09 15:08:57 EST ---
https://github.com/D-Programming-Language/dmd/pull/220

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 14, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5785


kennytm@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |k-foley@onu.edu


--- Comment #7 from kennytm@gmail.com 2011-07-14 00:46:04 PDT ---
*** Issue 4159 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: -------
August 12, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5785


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


--- Comment #8 from Walter Bright <bugzilla@digitalmars.com> 2011-08-12 12:54:49 PDT ---
https://github.com/D-Programming-Language/dmd/commit/7489948e40c96545a61394765add55d4363da692

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