[Issue 16410] attribute inference for final methods of templated classes
https://issues.dlang.org/show_bug.cgi?id=16410 Lodovico Giaretta changed: What|Removed |Added Summary|attribute inference inside |attribute inference for |templated classes |final methods of templated ||classes Severity|major |normal --- Comment #9 from Lodovico Giaretta --- (In reply to Lodovico Giaretta from comment #8) > Sorry, I don't understand why Foo!T.bar being @nogc would prevent possibly > intended behaviour. Can you please elaborate on this? Nevermind, got that. If a method is inferred @nogc, it can no longer be overridden as non-@nogc. This is correct. My bad. Then a new question arises: why cannot attribute inference happen for *final* methods of templated classes? --
[Issue 16410] attribute inference for final methods of templated classes
https://issues.dlang.org/show_bug.cgi?id=16410 --- Comment #10 from Lodovico Giaretta --- (In reply to Lodovico Giaretta from comment #9) > Then a new question arises: why cannot attribute inference happen for > *final* methods of templated classes? Small precisation: I mean *final override* methods. For final (non-virtual) methods it already happens. --
[Issue 16410] attribute inference for final methods of templated classes
https://issues.dlang.org/show_bug.cgi?id=16410 --- Comment #11 from Steven Schveighoffer --- (In reply to Lodovico Giaretta from comment #10) > (In reply to Lodovico Giaretta from comment #9) > > Then a new question arises: why cannot attribute inference happen for > > *final* methods of templated classes? > > Small precisation: I mean *final override* methods. For final (non-virtual) > methods it already happens. I think it should, where possible. That is, if you can override a non-@nogc method with a @nogc method (and if not, I think you should be able to), then inference of the attribute should happen for final methods. --
[Issue 16410] attribute inference for final methods of templated classes
https://issues.dlang.org/show_bug.cgi?id=16410 Bolpat changed: What|Removed |Added Keywords||rejects-valid CC||qs.il.paperi...@gmail.com --
[Issue 16410] attribute inference for final methods of templated classes
https://issues.dlang.org/show_bug.cgi?id=16410 RazvanN changed: What|Removed |Added Status|NEW |RESOLVED CC||razvan.nitu1...@gmail.com Resolution|--- |INVALID --- Comment #12 from RazvanN --- (In reply to Lodovico Giaretta from comment #10) > (In reply to Lodovico Giaretta from comment #9) > > Then a new question arises: why cannot attribute inference happen for > > *final* methods of templated classes? > > Small precisation: I mean *final override* methods. For final (non-virtual) > methods it already happens. The compiler cannot infer the attributes for final override methods because you already may have some constraints from the overriding function. For example, if the overriden function is @safe, the overriding function must also be @safe. Technically, the overriden function dictates the interface. I think it might be surprising to the attributes for overrides, even if they are final. I think we can close this issue as INVALID. --