ghostbuster91 / scalafix-unified

5 stars 2 forks source link

Replaces the `Nil` in pattern matching #1

Closed guizmaii closed 11 months ago

guizmaii commented 2 years ago

I was having something like this in my code:

args match {
  case a :: b :: Nil => ..
  ...  
}

And the plugin replaced the Nil by List.empty:

args match {
  case a :: b :: List.Empty => ..
  ...  
}

which obviously doesn't compile 😅

ghostbuster91 commented 2 years ago

Hi,

You probably tried 0.0.4 version which was indeed broken in that way. There was another version 0.0.6 but I forgot to update the releases. Didn't setup release drafter yet.

0.0.6 on the other hand rewrites all the list construction to List.empty (including non-empty lists :joy: ).

I just pushed 0.0.7 which seems to be fixing that problem :) Should be available in maven central in few hours.

guizmaii commented 2 years ago

Hi :)

including non-empty lists

Ahah, that's an interesting behaviour 😄

I just pushed 0.0.7

Amazing! Will give it a try tomorrow! :)