Bug 12160 – UDA related regressions

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-02-14T09:41:00Z
Last change time
2014-02-15T00:08:26Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
nazriel6969

Comments

Comment #0 by nazriel6969 — 2014-02-14T09:41:42Z
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
Comment #1 by nazriel6969 — 2014-02-14T09:43:18Z
Command used for building vibe.d: dub --config=unittest --build=unittest
Comment #2 by nazriel6969 — 2014-02-14T10:08:05Z
I think regression was introduced by: https://github.com/D-Programming-Language/dmd/pull/3183 Building ~2.065 with # 61fee8a43142fb3e3cd504c413b16222c5d8abe4 (commit before pull #3183 was merged) and running Vibe.d unittest results in successful compilation & execution
Comment #3 by dlang-bugzilla — 2014-02-14T10:21:16Z
Maybe this can be an opportunity to test Dub's upcoming Dustmite integration: http://forum.dlang.org/post/[email protected]
Comment #4 by etcimon — 2014-02-14T10:30:05Z
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") }
Comment #5 by k.hara.pg — 2014-02-14T10:44:48Z
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"); }
Comment #6 by k.hara.pg — 2014-02-14T21:55:54Z
Comment #7 by dlang-bugzilla — 2014-02-14T22:00:54Z
(In reply to comment #2) > I think regression was introduced by: > https://github.com/D-Programming-Language/dmd/pull/3183 > > Building ~2.065 with # 61fee8a43142fb3e3cd504c413b16222c5d8abe4 (commit before > pull #3183 was merged) and running Vibe.d unittest results in successful > compilation & execution As far as the test case that Kenji posted, it was introduced here: https://github.com/D-Programming-Language/dmd/pull/3056
Comment #8 by github-bugzilla — 2014-02-15T00:05:17Z
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 Merge pull request #3266 from 9rnsr/fix12160 [REG2.065a] Issue 12160 - UDA related regressions