augustjune / context-applied

Compiler plugin for intuitive tagless final
MIT License
128 stars 8 forks source link

Conflicts with WartRemover `Null` #8

Open gvolpe opened 4 years ago

gvolpe commented 4 years ago

I have this error when trying to use context-applied in a project that uses the Null wart.

[error] [wartremover:Null] null is disabled

I guess the plugin generates some null values? Using the latest version 0.1.4.

augustjune commented 4 years ago

Hey @gvolpe Thanks for the issue!

Yeah, it does use null as a rhs of value F (or whatever the type parameter is called). It was a trick to avoid the allocation of a new object. Something like this:

trait E {}
val F: E = null

E type serves as a tag so F value can later be converted to an instance of Functor[F] (or whatever the context is).

I don't see a straightforward solution to keep the zero allocation cost without using null. Maybe I can use something else for tagging F value. 🤔 I will play with it and get back to you with that.

gvolpe commented 4 years ago

Sorry for the delay in getting back to you. If there's a way to use WartRemover's Null while ignoring code generated by Context Applied that would work for me too :smile:

I don't know if this is possible, though... :thinking:

steinybot commented 2 years ago

It's a bit of a hack but what about just including @SuppressWarnings(Array("org.wartremover.warts.All")) on all code generated by context-applied?