[SAoC2022] Replace libdparse with dmd-as-a-library in D-Scanner week 3

user1234 user1234 at 12.de
Tue Oct 11 20:11:55 UTC 2022


On Monday, 10 October 2022 at 18:31:07 UTC, Lucian Danescu wrote:
> On Sunday, 9 October 2022 at 17:37:55 UTC, user1234 wrote:
>> On Sunday, 9 October 2022 at 16:05:32 UTC, Lucian Danescu 
>> wrote:
>>> Hello!
>>>
>>> [...]
>>>
>>> Let's consider this code
>>>
>>> ```
>>> static class C
>>> {
>>>     // ...
>>>     final void foo() { ... }
>>>     // ...
>>> }
>>> ```
>>>
>>> So in D-Scanner we have a check that warns against redundant 
>>> usage of `final` keyword.
>>> `Final` is indeed redundant with static methods, but with the 
>>> current D-Scanner implementation,
>>> in the example above the usage of `final` is not signaled, 
>>> while with my implementation it is.
>>
>> D-Scanner is right by no signaling anything.
>>
>> Without `final`, `foo` is virtual. The fact that `C` is static 
>> just means that it cannot read in the parent frame, e.g if 
>> declared inside a function body.
>
> Ah then I made a confusion here, I thought of a static class 
> like in Java for example, meaning all methods inside that class 
> are static as well. If I understood right, this is not the case?

Yes but then that means you have a problem of attribute in the 
translation.
Possibly that comes from this deletion : 
https://github.com/Dlang-UPB/D-scanner/commit/054601076d02407988ae75941a8c9833a7768805#diff-e7443e5d080e9a77ae0fd18b6bd97f6df91fba93c8934bf965446463405e3ae7L88

The point here was exactly to avoid the false positive you have 
now.


More information about the Digitalmars-d mailing list