Dmitry Reutov
Dmitry Reutov

Reputation: 3032

IntelliJ mistakenly highlights "Wrong number of arguments for extractor"

Matching case class with TuppleN parameter i get such highlighting "Wrong number of arguments for extractor"... Of course such code compiles and executes perfectly well

Simple example

case class SomeTestClass(param: (String, String))
val t = SomeTestClass("love" -> "life")
t match {
  // here i get highlighting "wrong number arguments for extractor"
  case SomeTestClass(Tuple2(param1, param2)) => true
  case _ => false
}

the same story for

case SomeTestClass((param1, param2)) => true
case SomeTestClass(param) => true

How to get rid of this? It seems like it was not before, and i didnt upgrade IDE

UPD: Disabling Type control is not a good idea as it is very very helpful, using /*_*/ folding construction works but it is just replacing one trouble to another, so not seems too much attractive

Upvotes: 4

Views: 499

Answers (1)

Iva Kam
Iva Kam

Reputation: 962

Probably not the best solution for that problem, but you can enclose wrongly highlighted fragment of code with /*_*/ and disable highlighting in that particular part of code.

This looks like a bug and the best place to tell about it is the IDEA bug-tracker. There are many places where intelliJ highlighter could disagree with scalac.

Anyway, you can avoid this by unfolding your tuple into named variables.

Upvotes: 2

Related Questions