softwaremill / softwaremill/macwire
"value x$2" when wiring a parametrised type
Open
@mbore is already working on this.
Since Mar 22, 2022.
autowire
bug
- Dominant language
- Scala
- Stars
- 1.3k
- Forks
- 77
- Avg merge
- 9m
- Merged PRs (30d)
- 4
Description
Using PrometheusMetrics[IO] as a dependency causes problems when compiling bootzooka:
[error] Error while emitting Dependencies.scala
[error] value x$2
[error] one error found
As a work-around, the dependency is created by hand: https://github.com/softwaremill/bootzooka/blob/tapir-update/backend/src/main/scala/com/softwaremill/bootzooka/Dependencies.scala#L36 (note that this is currently on a branch)
To reproduce, change the Dependencies class to:
object Dependencies {
def wire(
config: Config,
sttpBackend: Resource[IO, SttpBackend[IO, Any]],
xa: Resource[IO, Transactor[IO]],
clock: Clock
): Resource[IO, Dependencies] = {
def buildHttpApi(
http: Http,
userApi: UserApi,
passwordResetApi: PasswordResetApi,
versionApi: VersionApi,
prometheusMetrics: PrometheusMetrics[IO],
cfg: HttpConfig
) = {
new HttpApi(
http,
userApi.endpoints concatNel passwordResetApi.endpoints,
NonEmptyList.of(prometheusMetrics.metricsEndpoint, versionApi.versionEndpoint),
prometheusMetrics,
cfg
)
}
autowire[Dependencies](
config.api,
config.user,
config.passwordReset,
config.email,
DefaultIdGenerator,
PrometheusMetrics.default[IO](registry = CollectorRegistry.defaultRegistry),
clock,
sttpBackend,
xa,
buildHttpApi _,
new EmailService(_, _, _, _, _),
EmailSender.create _,
new ApiKeyAuthToken(_),
new PasswordResetAuthToken(_)
)
}
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.