context-applied icon indicating copy to clipboard operation
context-applied copied to clipboard

Conflicts with WartRemover `Null`

Open gvolpe opened this issue 5 years ago • 3 comments

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.

gvolpe avatar Apr 23 '20 11:04 gvolpe

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.

augustjune avatar Apr 28 '20 12:04 augustjune

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:

gvolpe avatar May 05 '20 10:05 gvolpe

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?

steinybot avatar Nov 12 '21 07:11 steinybot