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: [email protected]
Reporter: [email protected]
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.
--