Thread overview
[Issue 22004] [REG2.097] Error: mismatched function return type inference of `void` and `noreturn`
Oct 06, 2021
Dlang Bot
Oct 09, 2021
Dlang Bot
Oct 10, 2021
Dlang Bot
Oct 10, 2021
Dlang Bot
Oct 11, 2021
Dlang Bot
Oct 11, 2021
Dlang Bot
Oct 13, 2021
Dlang Bot
June 08, 2021
https://issues.dlang.org/show_bug.cgi?id=22004

moonlightsentinel@disroot.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |moonlightsentinel@disroot.o
                   |                            |rg

--- Comment #1 from moonlightsentinel@disroot.org ---
Probably worked in 2.096 because both lambdas were inferred to return void

--
October 06, 2021
https://issues.dlang.org/show_bug.cgi?id=22004

--- Comment #2 from Dlang Bot <dlang-bot@dlang.rocks> ---
@MoonlightSentinel created dlang/dmd pull request #13135 "Issue 22004 - Allow noreturn returns from void functions" mentioning this issue:

- Issue 22004 - Allow noreturn returns from void functions

  This is valid because
  - noreturn is convertible to any type (incl. void)
  - the program will abort/throw while evaluating the expression and hence
    never actually return a value

  This means that the ReturnStatement` can be replaced by the standalone
  expression without changing the behaviour of the program.

  ---

  Doesn't fix 22004 because the supplied example requires further changes
  to accomodate for `return <noreturn>;` and subsequent `return;`'s.

https://github.com/dlang/dmd/pull/13135

--
October 09, 2021
https://issues.dlang.org/show_bug.cgi?id=22004

--- Comment #3 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #13135 "Issue 22004 - Allow noreturn returns from void functions" was merged into stable:

- 3d83852dc2f36b76a83cab6a21b6461d84012af4 by MoonlightSentinel:
  Issue 22004 - Allow noreturn returns from void functions

  This is valid because
  - `noreturn` is convertible to any type (incl. `void`)
  - the program will abort/throw while evaluating the expression and hence
    never actually return a value

  This means that the `ReturnStatement` can be replaced by the standalone
  expression without changing the behaviour of the program.

  ---

  Doesn't fix 22004 because the supplied example requires further changes
  to accomodate for `return <noreturn>;` and subsequent `return;`'s during
  the return type inference.

https://github.com/dlang/dmd/pull/13135

--
October 10, 2021
https://issues.dlang.org/show_bug.cgi?id=22004

--- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> ---
@MartinNowak created dlang/dmd pull request #13149 "merge stable" mentioning this issue:

- Issue 22004 - Allow noreturn returns from void functions (#13135)

  This is valid because
  - `noreturn` is convertible to any type (incl. `void`)
  - the program will abort/throw while evaluating the expression and hence
    never actually return a value

  This means that the `ReturnStatement` can be replaced by the standalone
  expression without changing the behaviour of the program.

  ---

  Doesn't fix 22004 because the supplied example requires further changes
  to accomodate for `return <noreturn>;` and subsequent `return;`'s during
  the return type inference.

https://github.com/dlang/dmd/pull/13149

--
October 10, 2021
https://issues.dlang.org/show_bug.cgi?id=22004

--- Comment #5 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #13149 "merge stable" was merged into master:

- 0fabd110dd146eaf868e1195e9bff172d3c9ba1c by Florian:
  Issue 22004 - Allow noreturn returns from void functions (#13135)

  This is valid because
  - `noreturn` is convertible to any type (incl. `void`)
  - the program will abort/throw while evaluating the expression and hence
    never actually return a value

  This means that the `ReturnStatement` can be replaced by the standalone
  expression without changing the behaviour of the program.

  ---

  Doesn't fix 22004 because the supplied example requires further changes
  to accomodate for `return <noreturn>;` and subsequent `return;`'s during
  the return type inference.

https://github.com/dlang/dmd/pull/13149

--
October 11, 2021
https://issues.dlang.org/show_bug.cgi?id=22004

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #6 from Dlang Bot <dlang-bot@dlang.rocks> ---
@MoonlightSentinel created dlang/dmd pull request #13155 "Fix 22004 - Subsequent return statements override inferred noreturn return type" fixing this issue:

- Fix 22004 - Subsequent return statements override inferred noreturn...

  ... return type.

  Return type inference used to commit to `noreturn` when encountering
  a return statement producing a `noreturn` value. This was problematic
  when the function contained subsequent `void` returns, raising an error
  regarding missmatched function type inference even though `void` and
  `noreturn` are compatible (neither produce an actual value).

  This patch changes the code to let `noreturn` be overriden by `void`.

https://github.com/dlang/dmd/pull/13155

--
October 11, 2021
https://issues.dlang.org/show_bug.cgi?id=22004

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #7 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #13155 "Fix 22004 - Subsequent return statements override inferred noreturn return type" was merged into stable:

- 8f4be075c727594c203cc0a36fea9d518c1f1d30 by MoonlightSentinel:
  Fix 22004 - Subsequent return statements override inferred noreturn...

  ... return type.

  Return type inference used to commit to `noreturn` when encountering
  a return statement producing a `noreturn` value. This was problematic
  when the function contained subsequent `void` returns, raising an error
  regarding missmatched function type inference even though `void` and
  `noreturn` are compatible (neither produce an actual value).

  This patch changes the code to let `noreturn` be overriden by `void`.

https://github.com/dlang/dmd/pull/13155

--
October 13, 2021
https://issues.dlang.org/show_bug.cgi?id=22004

--- Comment #8 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #13164 "Merge stable" was merged into master:

- 8989d6653d5fa5e1d2c20fa30dabeda54c0f283f by MoonlightSentinel:
  Fix 22004 - Subsequent return statements override inferred noreturn...

  ... return type.

  Return type inference used to commit to `noreturn` when encountering
  a return statement producing a `noreturn` value. This was problematic
  when the function contained subsequent `void` returns, raising an error
  regarding missmatched function type inference even though `void` and
  `noreturn` are compatible (neither produce an actual value).

  This patch changes the code to let `noreturn` be overriden by `void`.

https://github.com/dlang/dmd/pull/13164

--