Thread overview
[Issue 16437] Enum type inference
Nov 19, 2018
Basile B.
Mar 21, 2019
Basile-z
May 31, 2019
Basile-z
November 19, 2018
https://issues.dlang.org/show_bug.cgi?id=16437

--- Comment #1 from Basile B. <b2.temp@gmx.com> ---
Other possible cases:

  SomeEnum {se1, se2}
  SomeEnum x = se1 | se2; // OK, there's a hint to solve se1 and se2
  auto y = se1 | se2;     // Error (unless se1/se2 exist as var in the scope.

--
March 21, 2019
https://issues.dlang.org/show_bug.cgi?id=16437

--- Comment #2 from Basile-z <b2.temp@gmx.com> ---
So I started implementing the stuff yesterday and unfortunately the inference cannot be limited to the function call. Only simpler cases such as initializers would work with inference limited to the scope of the current declaration/ expression statement.

The problem with calls is that parameters must be solved to find the function to call (because remember : overload sets...). But to infer the enum parent of an unqualified member, the function is required. This lead to a kind of paradox that's only solvable using a two steps resolution. The first step uses a list of enum that's stored in the scope to solve the parameter, the second step would verify that the solved parameter is well a child of the enum indicated in the function type, since the scope contain possibly unrelated enums, with identical member names...

More concretly, the current test: https://github.com/dlang/dmd/compare/master...Basile-z:enum-parent-inference-in-calls

--
May 31, 2019
https://issues.dlang.org/show_bug.cgi?id=16437

Basile-z <b2.temp@gmx.com> changed:

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

--