digitalmars.D.bugs - [Issue 23142] New: Scope should not apply to unittests
- d-bugmail puremagic.com (37/37) May 26 2022 https://issues.dlang.org/show_bug.cgi?id=23142
https://issues.dlang.org/show_bug.cgi?id=23142 Issue ID: 23142 Summary: Scope should not apply to unittests Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: alphaglosined gmail.com When declaring in a class or struct a unittest block should ignore any scope attributes set due to not having a context pointer. ```d void main() { } struct Foo { int x; scope: void func() { } unittest { } } ``` onlineapp.d(9): Error: function `onlineapp.Foo.__unittest_L9_C4` functions cannot be `scope` This error is not at all helpful and prevents a common use case for unittests as documentation without writing scope on every method which is very error-prone. --
May 26 2022