已弃用:符号字面量
不再支持符号字面量。
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