Bug 10925 – unittests qualified on the right hand side fail

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-08-30T00:25:32Z
Last change time
2024-12-13T18:11:03Z
Keywords
pull
Assigned to
No Owner
Creator
monarchdodra
Moved to GitHub: dmd#18661 →

Comments

Comment #0 by monarchdodra — 2013-08-30T00:25:32Z
//==== pure unittest { } //==== OK! //==== unittest pure { } //==== Error: statement expected to be { }, not pure This is inconsistent with how functions can be qualified. I, and others have been hit by this, and is quite a pain. ANother argument for allowing it is that the word "unittest" remainsthe first word of the line, making it easier to detect *as* a unittest when scanning through a document, rather than some function.
Comment #1 by sfrijters — 2015-03-22T11:00:40Z
I have also run into this issue today and would rather like to see it fixed / allowed, for the same reasons given by monarchdodra.
Comment #2 by k.hara.pg — 2015-03-22T11:29:20Z
Historically invariant block needed parenthesis until 2.065. class C { invariant {} // Error until 2.065, allowed from 2.066 } And "postfix attributes" is valid only for functions. class C { void fun() pure { ... } // OK int function() fptr pure; // NG } If we allow postfix attributes on unittest and invariant blocks, I'd like to force the empty parameter list `()` to make the syntax similar to functions. class C { unittest() pure { ... } // proposal invariant() pure nothrow { ... } }
Comment #3 by k.hara.pg — 2015-03-24T14:03:31Z
Comment #4 by bugzilla — 2015-03-27T09:53:21Z
This is an enhancement request, not a bug.
Comment #5 by robert.schadek — 2024-12-13T18:11:03Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18661 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB