digitalmars.D - [SAoC2022] Replace libdparse with dmd-as-a-library in D-Scanner week 3
- Lucian Danescu (33/33) Oct 09 2022 Hello!
- Dom Disc (6/10) Oct 09 2022 I would say, raise a bugzilla issue, and propose your
- user1234 (5/22) Oct 09 2022 D-Scanner is right by no signaling anything.
- Lucian Danescu (4/30) Oct 10 2022 Ah then I made a confusion here, I thought of a static class like
Hello! This week I added initial implementations for the following visitor: [incorrect_infinite_range](https://github.com/Dlang-UPB/D-scanner/pull/26) Made the additions necessary so that the parser is compatible with ASTBase also: [ErrorExp](https://github.com/dlang/dmd/pull/14520) and [ErrorStatement](https://github.com/dlang/dmd/pull/14521) and completed a pull request [fixing a location issue](https://github.com/dlang/dmd/pull/14473) Since the latest pull requests were merged into dmd, I could run tests and ran into this situation: 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. I would have a question here, and that would be if I should stick 100% with the current behavior of D-Scanner, or if I should update the behavior, as I would say is the case here, and probably similar situations will arise in the future.
Oct 09 2022
On Sunday, 9 October 2022 at 16:05:32 UTC, Lucian Danescu wrote:should I stick 100% with the current behavior of D-Scanner, or if I should update the behavior, as I would say is the case here, and probably similar situations will arise in the future.I would say, raise a bugzilla issue, and propose your implemenation as a fix to it. That would at least document the change. Only if the issue is discarded as WONTFIX (i.e. it is intended), you should stick 100% with the current behavior.
Oct 09 2022
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.
Oct 09 2022
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: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?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.
Oct 10 2022
On Monday, 10 October 2022 at 18:31:07 UTC, Lucian Danescu wrote: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?That's a `final class` in D: https://dlang.org/spec/class.html#final -Johan
Oct 10 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: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.On Sunday, 9 October 2022 at 16:05:32 UTC, Lucian Danescu wrote: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?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.
Oct 11 2022