You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import com.softwaremill.macwire._
object A {
def props(x: Int)(implicit y: String): A = new A(x)
}
class A(x: Int)(implicit y: String) {
val sum: String = s"$x + $y"
}
object App {
def main(): Unit = {
val xVal: Int = 3
implicit val yVal: String = "5"
// val aInstance = wire[A] // works
// val aInstance = A.props(xVal) // works
val aInstance: A = wireWith(A.props _) // compile error
println(aInstance.sum)
}
}
App.main()
Error:
Error:(21, 33) type mismatch; found : Int required: String
val aInstance: A = wireWith(A.props _)
The text was updated successfully, but these errors were encountered:
This bugs seems to still be present, if you try to wire a function which has implicit Parameters:
Example:
val double = 1.0
def testWiring[F[_] : Monad](first: Double): F[String] = {
(first + second).toString.pure[F]
}
val test = wireWith(testWiring[IO] _)
This results in the Generated code Generated code: testWiring[cats.effect.IO](first)(double), which then gives a compile time error, as it tries to apply double to the implicit parameter list for Monad[F].
Problem description, steps to reproduce and (a bit of) discussion:
https://stackoverflow.com/questions/48657546/macwire-wirewith-and-implicit-parameters.
Minimal example:
Error:
The text was updated successfully, but these errors were encountered: