Closed DanielMoss closed 2 years ago
I've done some more testing and traced the problem back to the compile-time
project - specifically to how summoning the implicit terms works in NewInstance
. It seems to be a problem when the class you're constructing has an implicit parameter whose type is dependent on one of the class' type parameters.
For example, if we add the following code to the compilation tests, then we'll receive a compilation failure:
/* Results in
* [error] -- Error: microlibs-scala\compile-time\shared\src\test\scala-3\japgolly\microlibs\compiletime\Scala3CompilationTests.scala:21:13
* [error] 21 | newInstance[Test[Int]]
* [error] | ^^^^^^^^^^^^^^^^^^^^^^
* [error] | no implicit values were found that match type T
* [error] | This location contains code that was inlined from Scala3CompilationTests.scala:21
*
*/
implicit val i: Int = 10
class Test[T](implicit param: T)
newInstance[Test[Int]]
Hi @DanielMoss, thanks for the debugging help! I've got some bad news for you.
Unfortunately you'll have to persist with your workaround for a while longer I'm afraid
No problem at all @japgolly. Thanks very much for all the context - I wasn't even aware that type substitution was something we have to take care of ourselves when in macro land.
No worries at all and I wish I couldn't come back to you with a better result. It's still early days for Scala 3 but we'll get there eventually 🙂
Hi. Thanks for the great library.
I'm experimenting with upgrading a project I've got to Scala 3, and had some code stop compiling unexpectedly. Here's what I'm playing around with:
I've included this code in a small project over here, in case anyone wants to play about with it.
I imagine this is related to the macro changes that have happened, but I'm only just dipping my toes into Scala 3 so I'm not sure what exactly is going wrong at the second.