propensive / contextual

Statically-checked string interpolation in Scala
https://soundness.dev/contextual/
251 stars 23 forks source link

Addressing 'macro has not been expanded' error Scala 2.13.0 or newer #56

Closed meshake closed 4 years ago

meshake commented 4 years ago

It looks like on Scala 2.13.0 or newer version, contextual does not work and simply throws "macro has not been expanded" error when trying to use a defined interpolator.

I narrowed it down to the apply function in the Prefix class that references "interpolator.Input" and "interpolator.type"on the provided interpolator. I do not fully understand the problem, but I tried to fix this issue by avoiding passing the interpolator as a parameter to the default constructor and instead passing the needed information via type parameters. So I added the "InputType" as a type parameter to the Prefix class. The "type" is already passed as a type parameter "InterpolatorType", so I simply changed the "interpolator.type" to "InterpolatorType". This seems to fix the problem.

Additionally, Scala 2.13.1 was complaining about incompatible Seq types, as it expects an immutable sequence, so I changed the interpolator code to use "root.scala.collection.immutable.Seq".

Fixes #54

propensive commented 4 years ago

Thank you for the contribution @meshake! I'll try to publish a release as soon as possible.

regadas commented 4 years ago

Hi @propensive! just stumbled upon this as well. Hopefully you can find some time to release this! Thanks 🙏

martingd commented 4 years ago

Hi @propensive If you would have time to publish a new release with this fix it would be highly appreciated. :)

propensive commented 4 years ago

Thanks for the reminder! It is very much on my agenda, albeit indirectly...

martingd commented 4 years ago

Thanks for the reminder! It is very much on my agenda, albeit indirectly...

@propensive I understand you are probably busy doing other stuff, but maybe you could tell if Contextual is effectively discontinued or if you intend to do a release for Scala 2.13.

laughedelic commented 4 years ago

@martingd FYI support for 2.13 is already in master, but not released, unfortunately.

martingd commented 4 years ago

@laughedelic I know this issue has been merged, but not yet released.

laughedelic commented 4 years ago

Right, I didn't realize that I'm pointing out the obvious 😅

propensive commented 4 years ago

I'm still working on it... sorry! Hopefully I'll get it published today.

Ben-Woolley commented 4 years ago

Hello hello @propensive! Any update on releasing this?

propensive commented 3 years ago

I've just released version 3.0.0 (since 2.0.0 was basically broken) for Scala 2.13 and 2.12.