intellij-community icon indicating copy to clipboard operation
intellij-community copied to clipboard

False positive SameParameterValueInspection for vararg

Open nsuriadi opened this issue 4 years ago • 0 comments

Issue

I've made a couple of assumptions here (please correct me if I'm wrong).

  • It looks like we were avoiding vararg comparison. I've tried to keep the same behavior here by excluding vararg in positions other than the last parameter from the inspection.
  • The usage processor doesn't seem to take receiver argument into account (Kotlin extension) and so I've decided omit receiver parameter from being compared against its corresponding argument. There doesn't to be a way to check if a param is a receiver through UAST, so I've opted to check its name.
  • I can't seem to find a way to reliably check whether a param is a vararg unless its the last param. I saw this Kotlin PSI while debugging and was wondering whether making a change in the Kotlin plugin would be necessary for this

I've also added a test for the local inspection tool. Let me know if there are any improvements I can make here.

nsuriadi avatar Mar 29 '21 14:03 nsuriadi