www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12160] New: UDA related regressions

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

           Summary: UDA related regressions
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: nazriel6969 gmail.com



PST ---
Hello.

While building unittests for Vibe.d I'm hiting regression.

It happens both with ~master and ~2.065 branch.

DMD output:
---
Building configuration "unittest", build type unittest
Compiling...
source/vibe/internal/meta/funcattr.d(162): Error: undefined identifier foo
source/vibe/internal/meta/funcattr.d(133): Error: template instance
vibe.internal.meta.funcattr.__unittestL155_69.AttributedParameterMetadata!(bar)
error instantiating
source/vibe/internal/meta/funcattr.d(167):        instantiated from here:
IsAttributedParameter!(bar, "name1")
source/vibe/internal/meta/funcattr.d(167): Error: template instance
vibe.internal.meta.funcattr.__unittestL155_69.IsAttributedParameter!(bar,
"name1") error instantiating
source/vibe/internal/meta/funcattr.d(335): Error: undefined identifier
attached1
source/vibe/internal/meta/funcattr.d(335): Error: undefined identifier
attached2
source/vibe/internal/meta/funcattr.d(338): Error: template instance
vibe.internal.meta.funcattr.__unittestL330_74.AttributedParameterMetadata!(foo)
error instantiating
source/vibe/internal/meta/funcattr.d(721): Error: undefined identifier
evaluator
source/vibe/internal/meta/funcattr.d(721): Error: undefined identifier
evaluator
source/vibe/internal/meta/funcattr.d(721): Error: undefined identifier
modificator
source/vibe/internal/meta/funcattr.d(777): Error: template instance
vibe.internal.meta.funcattr.AttributedFunction!(sum, __T5GroupTAyaTAyaZ) error
instantiating
source/vibe/internal/meta/funcattr.d(728):        instantiated from here:
createAttributedFunction!(sum, string, string)
source/vibe/internal/meta/funcattr.d(728): Error: template instance
vibe.internal.meta.funcattr.createAttributedFunction!(sum, string, string)
error instantiating
source/vibe/internal/meta/funcattr.d(753): Error: undefined identifier
evaluator
source/vibe/internal/meta/funcattr.d(753): Error: undefined identifier
evaluator
source/vibe/internal/meta/funcattr.d(753): Error: undefined identifier
modificator
source/vibe/internal/meta/funcattr.d(777): Error: template instance
vibe.internal.meta.funcattr.AttributedFunction!(sum, __T5GroupTAyaTAyaZ) error
instantiating
source/vibe/internal/meta/funcattr.d(759):        instantiated from here:
createAttributedFunction!(sum, string, string)
source/vibe/internal/meta/funcattr.d(759): Error: template instance
vibe.internal.meta.funcattr.createAttributedFunction!(sum, string, string)
error instantiating
source/vibe/internal/meta/uda.d(72): Error: undefined identifier Attribute
source/vibe/internal/meta/uda.d(72): Error: undefined identifier Attribute
source/vibe/internal/meta/uda.d(75): Error: template instance
vibe.internal.meta.uda.__unittestL68_84.findFirstUDA!(string, symbol) error
instantiating
source/vibe/internal/meta/uda.d(100): Error: static assert  (is(result0.value
== Attribute)) is false
Error: DMD compile run failed with exit code 1
---

It works with 2.064.2 and with LDC2-2.065-b3-merge 

Line at which DMD fails:
---
 before!foo("name1")
void bar(int name1, double name2)
{
}
---

Makes me believe that it is UDA related regression.

Link to full discussion:
https://github.com/rejectedsoftware/vibe.d/issues/526

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 14 2014
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12160




PST ---
Command used for building vibe.d:

dub --config=unittest --build=unittest

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 14 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12160




PST ---
I think regression was introduced by:
https://github.com/D-Programming-Language/dmd/pull/3183



compilation & execution

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 14 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12160


Vladimir Panteleev <thecybershadow gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |thecybershadow gmail.com



20:21:16 EET ---
Maybe this can be an opportunity to test Dub's upcoming Dustmite integration:
http://forum.dlang.org/post/ldgn1v$4tg$1 digitalmars.com

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 14 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12160


Etienne <etcimon gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |etcimon gmail.com



To be more precise, declarations inside unittest { } are not included in the
scope of the new UDA semantic analysis.

pass:

int foo()
{
 return 42;
}
unittest
{
  before!foo("name1")
}

fail:

unittest
{
 int foo()
 {
  return 42;
 }
  before!foo("name1")
}

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 14 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12160




Reduced test case:

alias TypeTuple(T...) = T;

auto before(alias Hook)(string parameter_name)
{
    return 0;
}

template checkUDAs(alias Function, string name)
{
    alias attributes = TypeTuple!(
        __traits(getAttributes, Function)
    );
}

//int foo() { return 42; }  // -> OK

void main()
{
    int foo() { return 42; }    // -> NG

     before!foo("name1")
    void bar(int name1, double name2) {}

    alias X = checkUDAs!(bar, "name1");
}

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 14 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12160


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, rejects-valid



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

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 14 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12160




08:00:54 EET ---

 I think regression was introduced by:
 https://github.com/D-Programming-Language/dmd/pull/3183
 


 compilation & execution
As far as the test case that Kenji posted, it was introduced here: https://github.com/D-Programming-Language/dmd/pull/3056 -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 14 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12160




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

https://github.com/D-Programming-Language/dmd/commit/23d14e7cfe69c677be1e7d06378741db50fe0eb4
fix Issue 12160 - UDA related regressions

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


[REG2.065a] Issue 12160 - UDA related regressions

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 15 2014
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12160


Kenji Hara <k.hara.pg gmail.com> changed:

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


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