已刪除:符號文字
不再支援符號字面值。
scala.Symbol
類別仍然存在,因此符號字面值 'xyz
的字面翻譯為 Symbol("xyz")
。不過,建議改用一般字串字面值 "xyz"
。(Symbol
類別將在未來棄用並移除)。範例
scalac Test.scala
-- Error: Test.scala:1:25 ------------------------------------------------------------------------------------------------
1 |@main def test = println('abc)
| ^
| symbol literal 'abc is no longer supported,
| use a string literal "abc" or an application Symbol("abc") instead,
| or enclose in braces '{abc} if you want a quoted expression.
| For now, you can also `import language.deprecated.symbolLiterals` to accept
| the idiom, but this possibility might no longer be available in the future.
1 error found