[Issue 16437] Enum type inference

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Mar 21 14:40:41 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=16437

--- Comment #2 from Basile-z <b2.temp at 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

--


More information about the Digitalmars-d-bugs mailing list