Skip to content

Commit e870c8a

Browse files
committed
Apply symlits.md
1 parent a5e44d8 commit e870c8a

File tree

3 files changed

+22
-12
lines changed

3 files changed

+22
-12
lines changed

docs/_spec/01-lexical-syntax.md

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ A single new line token is accepted
259259
260260
## Literals
261261
262-
There are literals for integer numbers, floating point numbers, characters, booleans, symbols, strings.
262+
There are literals for integer numbers, floating point numbers, characters, booleans, strings.
263263
The syntax of these literals is in each case as in Java.
264264
265265
<!-- TODO
@@ -274,7 +274,6 @@ Literal ::= [‘-’] integerLiteral
274274
| characterLiteral
275275
| stringLiteral
276276
| interpolatedString
277-
| symbolLiteral
278277
|null
279278
```
280279
@@ -490,16 +489,6 @@ In addition, Unicode escape sequences of the form `\uxxxx`, where each `x` is a
490489
491490
It is a compile time error if a backslash character in a character or string literal does not start a valid escape sequence.
492491
493-
### Symbol literals
494-
495-
```ebnf
496-
symbolLiteral ::= ‘'’ plainid
497-
```
498-
499-
A symbol literal `'x` is deprecated shorthand for the expression `scala.Symbol("x")`.
500-
501-
The `apply` method of `Symbol`'s companion object caches weak references to `Symbol`s, thus ensuring that identical symbol literals are equivalent with respect to reference equality.
502-
503492
## Whitespace and Comments
504493
505494
Tokens may be separated by whitespace characters and/or comments.

docs/_spec/A?-deprecated.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
### Symbol Literals
3+
4+
Symbol literals are no longer supported.
5+
6+
The [`scala.Symbol`](https://scala-lang.org/api/3.x/scala/Symbol.html) class still exists, so a literal translation of the symbol literal `'xyz` is `Symbol("xyz")`. However, it is recommended to use a plain string literal `"xyz"` instead. (The `Symbol` class will be deprecated and removed in the future). Example:
7+
8+
9+
```
10+
scalac Test.scala
11+
-- Error: Test.scala:1:25 ------------------------------------------------------------------------------------------------
12+
13+
1 |@main def test = println('abc)
14+
| ^
15+
| symbol literal 'abc is no longer supported,
16+
| use a string literal "abc" or an application Symbol("abc") instead,
17+
| or enclose in braces '{abc} if you want a quoted expression.
18+
| For now, you can also `import language.deprecated.symbolLiterals` to accept
19+
| the idiom, but this possibility might no longer be available in the future.
20+
1 error found
21+
```

0 commit comments

Comments
 (0)