这是intellij警告:
当覆盖“::” Intellij时显示此消息:无法解析符号::
我已经正确安装了scala + sbt插件。
我该如何解决该错误?
最佳答案
您的代码不正确:::
是List
上的方法,而不是Integer
上的方法。您的最后一个元素必须是List
的实例。
这些都可以工作:
val otherList = 3::2::List(3)
或者
val otherList = 3::2::3::Nil
请注意,
::
是在List
而不是Integer
上调用的,因为它是右关联的。从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.
关于scala - Intellij无法识别Scala List运算符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30276821/