Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
SI-7470 implements fundep materialization #2499
This pull request builds upon #2494, enabling implicit macros to affect type inference. Unfortunately we had a disagreement about whether we want to include this functionality in trunk, so I moved the controversial bits into a separate pull request. The difference between #2494 and this pull request is a single commit: scalamacros/kepler@ticket/5923...topic/iso.
We have a multi-parametric
We cannot use the regular materialization technique, because there's a problem with type inference. As shown on the snippet above, when inferring an implicit argument for an invocation of foo, we look for an implicit of type
The patch consists of two simple ideas, both having just a handful of locs in their implementation:
Even if you can't infer all the type parameters of implicit being looked up, let the macro expand. All the undetparams will later be inferred from the result of expansion. The implementation of that technique is extremely simple - just 8 lines of code.
Also, more convincing examples would help support this PR's case. A common use case would be in database mappers where the companion object is boilerplate.
could be shortened to
if the library provides a macro like