Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scala 3: fails to wire constructor param with implicit lookup #320

Closed
robinraju opened this issue Jan 10, 2024 · 0 comments · Fixed by #355
Closed

Scala 3: fails to wire constructor param with implicit lookup #320

robinraju opened this issue Jan 10, 2024 · 0 comments · Fixed by #355

Comments

@robinraju
Copy link

Following discussion on: https://softwaremill.community/t/scala-3-fails-to-wire-constructor-param-with-implicit-lookup/346

The below example fails to compile with Scala 3. But works with Scala 2.x

Scala version: 3.3.1
macwire version: 2.5.9

import com.softwaremill.macwire.wire

type DBIO[T]
class ProductService[DB[_]]

trait MainModule {
  lazy val productService = wire[ProductService[DBIO]]
}

Error log

Exception occurred while executing macro expansion.
java.lang.AssertionError: assertion failed
	at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:11)
	at scala.quoted.runtime.impl.QuotesImpl$reflect$Ref$.apply(QuotesImpl.scala:444)
	at scala.quoted.runtime.impl.QuotesImpl$reflect$Ref$.apply(QuotesImpl.scala:443)
	at com.softwaremill.macwire.internals.ConstructorCrimper.paramType(ConstructorCrimper.scala:92)
	at com.softwaremill.macwire.internals.ConstructorCrimper.wireConstructorParamsWithImplicitLookups$$anonfun$4$$anonfun$3(ConstructorCrimper.scala:75)
	at scala.collection.immutable.List.map(List.scala:246)
	at com.softwaremill.macwire.internals.ConstructorCrimper.wireConstructorParamsWithImplicitLookups$$anonfun$1(ConstructorCrimper.scala:75)
	at scala.collection.immutable.List.map(List.scala:246)
	at com.softwaremill.macwire.internals.ConstructorCrimper.wireConstructorParamsWithImplicitLookups(ConstructorCrimper.scala:76)
	at com.softwaremill.macwire.internals.ConstructorCrimper.constructorArgs$$anonfun$3$$anonfun$1(ConstructorCrimper.scala:57)
	at scala.Option.map(Option.scala:242)
	at com.softwaremill.macwire.internals.ConstructorCrimper.constructorArgs$$anonfun$2(ConstructorCrimper.scala:57)
	at com.softwaremill.macwire.internals.Logger.withBlock(Logger.scala:15)
	at com.softwaremill.macwire.internals.ConstructorCrimper.constructorArgs(ConstructorCrimper.scala:58)
	at com.softwaremill.macwire.internals.ConstructorCrimper.constructorTree$$anonfun$5$$anonfun$3(ConstructorCrimper.scala:63)
	at scala.Option.flatMap(Option.scala:283)
	at com.softwaremill.macwire.internals.ConstructorCrimper.constructorTree$$anonfun$2(ConstructorCrimper.scala:67)
	at com.softwaremill.macwire.internals.Logger.withBlock(Logger.scala:15)
	at com.softwaremill.macwire.internals.ConstructorCrimper.constructorTree(ConstructorCrimper.scala:68)
	at com.softwaremill.macwire.MacwireMacros$.wire(MacwireMacros.scala:54)
	at com.softwaremill.macwire.MacwireMacros$.wireImpl(MacwireMacros.scala:14)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant