Open stephencelis opened 2 years ago
/cc @slavapestov You've been pretty active on generics so I wonder if you'd know what was going on here? We're pushing our overloads and @_disfavoredOverload to the limits to try to work around this issue in swift-parsing, and our workarounds make for a pretty bad library user experience 🙁
I found this thread saying it's intended behavior: https://forums.swift.org/t/function-builder-cannot-infer-generic-parameters-even-though-direct-call-to-buildblock-can/35886
A pretty big bummer 🙁 Not sure if there are ways around the behavior. Even introducing a generic at the builder level (e.g., @ParserBuilder\<Input>) doesn't seem to propagate the generic through.
I may not understand the thread, but towards the end, @DougGregor seems to say that a feature like buildPartialBlock could unlock this kind of fluent inference again, but I tried a snapshot and it still doesn't work. Should I report such an enhancement to buildPartialBlock separately?
Environment
Swift 5.5Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 5 | |Component/s | Compiler | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: 697cecc0c7d7a2b891e974ca48770122Issue Description:
Result builders seem to have a problem inferring generics. In the following example, the generic should be well-understood but must be explicitly specified: