Thread overview
[Issue 17366] Inferrence results in a missing error for final
May 03, 2017
Jonathan M Davis
May 03, 2017
Daniel Kozak
May 03, 2017
Adam D. Ruppe
May 03, 2017
Adam D. Ruppe
Dec 17, 2022
Iain Buclaw
May 03, 2017
https://issues.dlang.org/show_bug.cgi?id=17366

Jonathan M Davis <issues.dlang@jmdavisProg.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid

--
May 03, 2017
https://issues.dlang.org/show_bug.cgi?id=17366

Daniel Kozak <kozzi11@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kozzi11@gmail.com

--- Comment #1 from Daniel Kozak <kozzi11@gmail.com> ---
final print() { writeln(this); }

is a template!!!. So I believe this is the main source of this "bug".

When you add void it makes print normal member function.

final print() { writeln(this); }
is not same as
final void print() { writeln(this); }

It is more like

final void print()() { writeln(this); }

--
May 03, 2017
https://issues.dlang.org/show_bug.cgi?id=17366

Adam D. Ruppe <destructionator@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |destructionator@gmail.com

--- Comment #2 from Adam D. Ruppe <destructionator@gmail.com> ---
No, it isn't a template. Try putting `import external.module;` inside. If it is a template, there's no "cannot find module" error unless you actually call it (lazy local imports), but for a function, the error does exist.

final foo() { import...} DOES produce the error. Ditto for `auto ref` parameters, they aren't allowed here either.

--
May 03, 2017
https://issues.dlang.org/show_bug.cgi?id=17366

--- Comment #3 from Adam D. Ruppe <destructionator@gmail.com> ---
My guess is that func.d's findVtblIndex function fails to find the base class method because `type.equals` and `type.covariant` fail to take into account inference.

Looking at mtype.d, there is

      if (!t1n || !t2n) // happens with return type inference
                goto Lnotcovariant;

Which I'm guessing isn't right, it should actually analyze the body and fill those types in.

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=17366

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3

--