Thread overview
[Issue 7071] "final:" shouldn't affect variables
Jul 06, 2018
RazvanN
Jul 06, 2018
Vladimir Panteleev
Jul 06, 2018
Vladimir Panteleev
Jul 06, 2018
RazvanN
July 06, 2018
https://issues.dlang.org/show_bug.cgi?id=7071

RazvanN <razvan.nitu1305@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |razvan.nitu1305@gmail.com
         Resolution|---                         |FIXED

--- Comment #3 from RazvanN <razvan.nitu1305@gmail.com> ---
The example compiles successfully on master git head. Closing as fixed.

--
July 06, 2018
https://issues.dlang.org/show_bug.cgi?id=7071

Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |WORKSFORME

--- Comment #4 from Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> ---
Razvan: I think a while ago we decided to use WORKSFORME for closing bugs that are no longer reproducible. FIXED is for things fixed as a result of a PR intended to fix that particular bug. I think at some point we used the resolution to find which bugs were fixed in one release cycle.

--
July 06, 2018
https://issues.dlang.org/show_bug.cgi?id=7071

--- Comment #5 from Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> ---
BTW, is this bug even valid? What does "final" mean for a variable? Maybe refusing to compile "final" with variables is the correct behavior? If so, does that mean there's a regression?

--
July 06, 2018
https://issues.dlang.org/show_bug.cgi?id=7071

--- Comment #6 from RazvanN <razvan.nitu1305@gmail.com> ---
If final is applied directly to the declaration, the compiler will issue an error:

class C
{
    final string s; // error: cannot apply final to variable declarations;
}

However, if final is used as in the original bug report, it is simply ignored. The dmd philosophy for attributes that apply to block declarations is to apply the attribute where possible and to ignore it where it cannot be applied. Precedent: https://github.com/dlang/dmd/pull/7229

--