Skip to content

Commit 1b8b47a

Browse files
committed
Update tests to not use symbol literals
All tests were automatically rewritten
1 parent c84349a commit 1b8b47a

File tree

15 files changed

+40
-41
lines changed

15 files changed

+40
-41
lines changed
File renamed without changes.

tests/neg/sip23-symbols.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
object Test {
2-
val sym0 = 's
2+
val sym0 = 's // error: no longer supported
33
//sym0: Symbol
4-
sym0: 's // error
4+
sym0: 's // error // error: no longer supported
55

66
//val sym1: 's = 's
77
//sym1: Symbol
@@ -15,9 +15,9 @@ object Test {
1515
type Identity[T] = T
1616
def narrow[T <: Singleton](t: T): Identity[T] = t
1717

18-
final val sym3 = id('s)
18+
final val sym3 = id('s) // error: no longer supported
1919
//sym3: Symbol
20-
sym3: 's // error
20+
sym3: 's // error // error: no longer supported
2121

2222
//val sym4 = narrow('s)
2323
//sym4: Symbol

tests/pos/desugar.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ object desugar {
7070
}
7171

7272
object misc {
73-
'hello
73+
Symbol("hello")
7474
s"this is a $x + ${x + y} string"
7575
type ~[X, Y] = Tuple2[X, Y]
7676
val pair: Int ~ String = 1 -> "abc"

tests/pos/literals.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ object Test {
55
val d: 1.0 = 1.0
66
val e: true = true
77
val f: '*' = '*'
8-
val g: 'a = 'a
98
}

tests/pos/t389.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
object Test {
2-
def a = 'a
3-
def b = 'B
4-
def c = '+
2+
def a = Symbol("a")
3+
def b = Symbol("B")
4+
def c = Symbol("+")
55
//def d = '`\n` //error: unclosed character literal
6-
def e = '\u0041
6+
def e = Symbol("\u0041")
77
}

tests/pos/t4579.scala

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -303,17 +303,17 @@ object LispAny extends Lisp {
303303
def asBoolean(x: Data): Boolean = x != 0
304304

305305
def normalize(x: Data): Data = x match {
306-
case 'and :: x :: y :: Nil =>
307-
normalize('if :: x :: y :: 0 :: Nil)
308-
case 'or :: x :: y :: Nil =>
309-
normalize('if :: x :: 1 :: y :: Nil)
310-
case 'def :: (name :: args) :: body :: expr :: Nil =>
311-
normalize('def :: name :: ('lambda :: args :: body :: Nil) :: expr :: Nil)
312-
case 'cond :: ('else :: expr :: Nil) :: rest =>
306+
case Symbol("and") :: x :: y :: Nil =>
307+
normalize(Symbol("if") :: x :: y :: 0 :: Nil)
308+
case Symbol("or") :: x :: y :: Nil =>
309+
normalize(Symbol("if") :: x :: 1 :: y :: Nil)
310+
case Symbol("def") :: (name :: args) :: body :: expr :: Nil =>
311+
normalize(Symbol("def") :: name :: (Symbol("lambda") :: args :: body :: Nil) :: expr :: Nil)
312+
case Symbol("cond") :: (Symbol("else") :: expr :: Nil) :: rest =>
313313
normalize(expr);
314-
case 'cond :: (test :: expr :: Nil) :: rest =>
315-
normalize('if :: test :: expr :: ('cond :: rest) :: Nil)
316-
case 'cond :: 'else :: expr :: Nil =>
314+
case Symbol("cond") :: (test :: expr :: Nil) :: rest =>
315+
normalize(Symbol("if") :: test :: expr :: (Symbol("cond") :: rest) :: Nil)
316+
case Symbol("cond") :: Symbol("else") :: expr :: Nil =>
317317
normalize(expr)
318318
case h :: t =>
319319
normalize(h) :: asList(normalize(t))
@@ -342,15 +342,15 @@ object LispAny extends Lisp {
342342
def eval1(x: Data, env: Environment): Data = x match {
343343
case Symbol(name) =>
344344
env lookup name
345-
case 'def :: Symbol(name) :: y :: z :: Nil =>
345+
case Symbol("def") :: Symbol(name) :: y :: z :: Nil =>
346346
eval(z, env.extendRec(name, (env1 => eval(y, env1))))
347-
case 'val :: Symbol(name) :: y :: z :: Nil =>
347+
case Symbol("val") :: Symbol(name) :: y :: z :: Nil =>
348348
eval(z, env.extend(name, eval(y, env)))
349-
case 'lambda :: params :: y :: Nil =>
349+
case Symbol("lambda") :: params :: y :: Nil =>
350350
mkLambda(params, y, env)
351-
case 'if :: c :: y :: z :: Nil =>
351+
case Symbol("if") :: c :: y :: z :: Nil =>
352352
if (asBoolean(eval(c, env))) eval(y, env) else eval(z, env)
353-
case 'quote :: y :: Nil =>
353+
case Symbol("quote") :: y :: Nil =>
354354
y
355355
case y :: z =>
356356
apply(eval(y, env), z map (x => eval(x, env)))

tests/pos/t4812.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
trait Test1 {
2-
def m1(sym: Symbol = 'TestSym): Unit
2+
def m1(sym: Symbol = Symbol("TestSym")): Unit
33
def m2(s: String = "TestString"): Unit
44
}

tests/run/arrays.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ object Test {
206206
val a2: Int = 0;
207207
val a3: Null = null;
208208
val a4: String = "a-z";
209-
val a5: Symbol = 'token;
209+
val a5: Symbol = Symbol("token");
210210
val a6: HashMap = new HashMap();
211211
val a7: TreeMap = scala.collection.immutable.TreeMap.empty[Int, Any];
212212
val a8: Strings = List("a", "z");

tests/run/fors.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
object Test extends dotty.runtime.LegacyApp {
88
val xs = List(1, 2, 3)
9-
val ys = List('a, 'b, 'c)
9+
val ys = List(Symbol("a"), Symbol("b"), Symbol("c"))
1010

1111
def it = 0 until 10
1212

tests/run/t4601.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ trait B {
44
self: A =>
55

66
def test: Unit = {
7-
println('blubber)
7+
println(Symbol("blubber"))
88
}
99
}
1010

tests/run/t6632.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
object Test extends dotty.runtime.LegacyApp {
22
import collection.mutable.ListBuffer
33

4-
def newLB = ListBuffer('a, 'b, 'c, 'd, 'e)
4+
def newLB = ListBuffer(Symbol("a"), Symbol("b"), Symbol("c"), Symbol("d"), Symbol("e"))
55

66
def iiobe[A](f: => A) =
77
try { f }
88
catch { case ex: IndexOutOfBoundsException => println(ex) }
99

1010
val lb0 = newLB
11-
iiobe( lb0.insert(-1, 'x) )
11+
iiobe( lb0.insert(-1, Symbol("x")) )
1212

1313
val lb1 = newLB
14-
iiobe( lb1.insertAll(-2, Array('x, 'y, 'z)) )
14+
iiobe( lb1.insertAll(-2, Array(Symbol("x"), Symbol("y"), Symbol("z"))) )
1515

1616
val lb2 = newLB
17-
iiobe( lb2.update(-3, 'u) )
17+
iiobe( lb2.update(-3, Symbol("u")) )
1818

1919
val lb3 = newLB
20-
iiobe( lb3.updated(-1, 'u) )
21-
iiobe( lb3.updated(5, 'u) )
20+
iiobe( lb3.updated(-1, Symbol("u")) )
21+
iiobe( lb3.updated(5, Symbol("u")) )
2222
}

tests/run/t6633.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
object Test extends dotty.runtime.LegacyApp {
22
import collection.mutable.ListBuffer
33

4-
def newLB = ListBuffer('a, 'b, 'c, 'd, 'e)
4+
def newLB = ListBuffer(Symbol("a"), Symbol("b"), Symbol("c"), Symbol("d"), Symbol("e"))
55

66
val lb0 = newLB
77

88
try {
9-
lb0.insert(9, 'x)
9+
lb0.insert(9, Symbol("x"))
1010
} catch {
1111
case ex: IndexOutOfBoundsException => println(ex)
1212
}
1313

1414
val lb1 = newLB
1515

1616
try {
17-
lb1.insert(9, 'x)
17+
lb1.insert(9, Symbol("x"))
1818
} catch {
1919
case ex: IndexOutOfBoundsException =>
2020
}

tests/run/t6634.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import collection.mutable.ListBuffer
22

33
//object Test extends dotty.runtime.LegacyApp {
44
object Test extends App {
5-
def newLB = ListBuffer('a, 'b, 'c, 'd, 'e)
5+
def newLB = ListBuffer(Symbol("a"), Symbol("b"), Symbol("c"), Symbol("d"), Symbol("e"))
66

77
val lb0 = newLB
88
println("Trying lb0 ...")

tests/run/t8933b/A.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
trait MixinWithSymbol {
22
self: MotherClass =>
3-
def symbolFromTrait: Any = 'traitSymbol
3+
def symbolFromTrait: Any = Symbol("traitSymbol")
44
}

tests/run/t8933b/Test.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class MotherClass extends MixinWithSymbol {
2-
def foo = 'sym1
2+
def foo = Symbol("sym1")
33
}
44

55
object Test {

0 commit comments

Comments
 (0)