Bug 17177 – AutoImplement fails on function overload sets with "cannot infer type from overloaded function symbol"

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2017-02-12T13:31:00Z
Last change time
2017-03-22T12:22:07Z
Assigned to
nobody
Creator
alexandru.ermicioi

Comments

Comment #0 by alexandru.ermicioi — 2017-02-12T13:31:30Z
Given following code: import std.meta; import std.typecons; import std.traits; class ProxyablePerson { private { string surname_; } public { int surname(string surname) { return 0; } int surname() { return 0; } } } string how(C, alias fun)() { string stmt; static if (!is(ReturnType!fun == void)) { stmt ~= " return parent(args); "; } else { stmt ~= " parent(args); "; } return stmt; } alias Proxy = AutoImplement!(ProxyablePerson, how, templateNot!isFinalFunction); void main() { } AutoImplement fails on surname overload set with following error: /usr/include/dmd/phobos/std/typecons.d-mixin-3579(3584,15): Error: cannot infer type from overloaded function symbol &super.surname /usr/include/dmd/phobos/std/typecons.d-mixin-3579(3592,15): Error: cannot infer type from overloaded function symbol &super.surname src/app.d(36,15): Error: template instance std.typecons.AutoImplement!(ProxyablePerson, how, templateNot) error instantiating Note: leaving one function from overload set (so no surname overload set is present), will compile ok without any error.
Comment #1 by alexandru.ermicioi — 2017-02-13T21:01:41Z
I have made a pull request for this bug: https://github.com/dlang/phobos/pull/5119 The problem was in generation of "parent" symbol for body code, that denoted the super.overridenMember. In original version, it was a delegate to parent method, and because of this, the compiler couldn't know which parent method from overload set it has to choose. Solved it with help of getMember traits. The idea is to alias "parent" to overload set of super.overriddenMethod. Note: decided to remove previous lines due to following issue: https://issues.dlang.org/show_bug.cgi?id=12228
Comment #2 by github-bugzilla — 2017-02-21T16:37:24Z
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/085902b3d68fe692d020b6b0c31c63deb2a5d987 fix issue 17177. AutoImplement fails on function overload sets with "cannot infer type from overloaded function symbol". https://github.com/dlang/phobos/commit/ef0dffab0d49ba7f069fd3c82173823310fda7ab Merge pull request #5119 from aermicioi/issue_17177 fix issue 17177. AutoImplement fails on function overload sets with …
Comment #3 by github-bugzilla — 2017-02-24T18:15:48Z
Commits pushed to newCTFE at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/085902b3d68fe692d020b6b0c31c63deb2a5d987 fix issue 17177. AutoImplement fails on function overload sets with "cannot infer type from overloaded function symbol". https://github.com/dlang/phobos/commit/ef0dffab0d49ba7f069fd3c82173823310fda7ab Merge pull request #5119 from aermicioi/issue_17177
Comment #4 by github-bugzilla — 2017-03-22T12:22:07Z
Commits pushed to stable at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/085902b3d68fe692d020b6b0c31c63deb2a5d987 fix issue 17177. AutoImplement fails on function overload sets with "cannot infer type from overloaded function symbol". https://github.com/dlang/phobos/commit/ef0dffab0d49ba7f069fd3c82173823310fda7ab Merge pull request #5119 from aermicioi/issue_17177