Here is the intellij warning :
When overing "::" Intellij display this message : Cannot resolve symbol ::
I have scala + sbt plugins correctly installed.
How can i fix this error ?
Your code is incorrect : ::
is a method on List
, not on Integer
. Your last element must be an instance of List
.
Either of those will work :
val otherList = 3::2::List(3)
or
val otherList = 3::2::3::Nil
Note that ::
is called on List
and not the Integer
because it is right-associative.
From the Scala Specification (Infix Operations, 6.12.3) :
The associativity of an operator is determined by the operator’s last character. Operators ending in a colon ‘:’ are right-associative. All other operators are left-associative.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With