Skip to content

Commit e439999

Browse files
committed
Fix tests
1 parent c8a67f6 commit e439999

16 files changed

+47
-54
lines changed

library/src/scala/tasty/reflect/Printers.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -713,8 +713,9 @@ trait Printers
713713
if (vdef.symbol.flags.is(Flags.Mutable)) this += highlightKeyword("var ", color)
714714
else this += highlightKeyword("val ", color)
715715

716+
this += highlightValDef(name, color)
716717
if (tpt.pos.exists && tpt.pos.start != tpt.pos.end) {
717-
this += highlightValDef(name, color) += ": "
718+
this += ": "
718719
printTypeTree(tpt)
719720
}
720721
rhs match {
@@ -832,7 +833,7 @@ trait Printers
832833
// type bounds already printed in `fn`
833834
this
834835
case _ =>
835-
inSquare(printTypeOrBoundsTrees(args.filter(arg => arg.pos.exists && arg.pos.start != arg.pos.end), ", "))
836+
inSquare(printTypeOrBoundsTrees(args, ", "))
836837
}
837838

838839
case Term.Super(qual, idOpt) =>
@@ -1358,7 +1359,7 @@ trait Printers
13581359
/** Print type tree
13591360
*
13601361
* @param selfIn The current type is a self type in the indicated class.
1361-
* NoSymbol means the current type is not a self type annotation.
1362+
* None means the current type is not a self type annotation.
13621363
* Self type annotation should elide current class prefix to avoid
13631364
* cyclic type checking error.
13641365
*
@@ -1472,6 +1473,7 @@ trait Printers
14721473
/** Print type
14731474
*
14741475
* @param selfIn The current type is a self type in the indicated class.
1476+
* None means the current type is not a self type annotation.
14751477
* Self type annotation should elide current class prefix to avoid
14761478
* cyclic type checking error.
14771479
*

tests/pos/i0306.decompiled

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
/** Decompiled from out/posTestFromTasty/pos/i0306/bar.class */
1+
/** Decompiled from out/posTestFromTasty/pos/i0306/bar.tasty */
22
object bar {
33
class C[T <: scala.Seq[_ >: scala.Nothing <: scala.Any]]()
44
val x: scala.AnyRef = new bar.C[scala.collection.Seq[_ >: scala.Nothing <: scala.Any]]()
5-
val y: scala.collection.Seq[_ >: scala.Nothing <: scala.Any] = bar.x match {
5+
val y = bar.x match {
66
case x: bar.C[u] =>
77
def xx: u = xx
88
((xx: u): scala.collection.Seq[_ >: scala.Nothing <: scala.Any])
99
}
10-
val z: java.lang.String = {
10+
val z = {
1111
def xx: scala.Predef.String = xx
1212
(xx: java.lang.String)
1313
}
14-
}
14+
}

tests/pos/i2104b.decompiled

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ object Cons {
77
/** Decompiled from out/posTestFromTasty/pos/i2104b/Pair.tasty */
88
case class Pair[A, B](_1: A, _2: B) {
99
override def hashCode(): scala.Int = {
10-
var acc: scala.Int = 2479866
10+
var acc = 2479866
1111
acc = scala.runtime.Statics.mix(acc, scala.runtime.Statics.anyHash(Pair.this._1))
1212
acc = scala.runtime.Statics.mix(acc, scala.runtime.Statics.anyHash(Pair.this._2))
1313
scala.runtime.Statics.finalizeHash(acc, 2)

tests/pos/lambda.decompiled

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
/** Decompiled from out/posTestFromTasty/pos/lambda/foo/Foo.class */
1+
/** Decompiled from out/posTestFromTasty/pos/lambda/foo/Foo.tasty */
22
package foo {
33
class Foo() {
44
((x: scala.Int) => 2)
5-
val a: scala.Function1[scala.Int, scala.Int] = ((x: scala.Int) => x.*(x))
5+
val a = ((x: scala.Int) => x.*(x))
66
}
7-
}
7+
}

tests/pos/methodTypes.decompiled

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
/** Decompiled from out/posTestFromTasty/pos/methodTypes/Foo.class */
1+
/** Decompiled from out/posTestFromTasty/pos/methodTypes/Foo.tasty */
22
class Foo() {
3-
val x: scala.Int = 1
3+
val x = 1
44
def y: scala.Int = 2
55
def z(): scala.Int = 3
6-
}
6+
}

tests/pos/simpleCaseClass-2.decompiled

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/** Decompiled from out/posTestFromTasty/pos/simpleCaseClass-2/A.tasty */
22
case class A(x: scala.Int) {
33
override def hashCode(): scala.Int = {
4-
var acc: scala.Int = 65
4+
var acc = 65
55
acc = scala.runtime.Statics.mix(acc, A.this.x)
66
scala.runtime.Statics.finalizeHash(acc, 1)
77
}

tests/pos/simpleCaseClass-3.decompiled

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/** Decompiled from out/posTestFromTasty/pos/simpleCaseClass-3/A.tasty */
22
case class A[T](x: T) {
33
override def hashCode(): scala.Int = {
4-
var acc: scala.Int = 65
4+
var acc = 65
55
acc = scala.runtime.Statics.mix(acc, scala.runtime.Statics.anyHash(A.this.x))
66
scala.runtime.Statics.finalizeHash(acc, 1)
77
}

tests/pos/simpleDoWhile.decompiled

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
/** Decompiled from out/posTestFromTasty/pos/simpleDoWhile/Foo.class */
1+
/** Decompiled from out/posTestFromTasty/pos/simpleDoWhile/Foo.tasty */
22
class Foo() {
33
def foo: scala.Unit = {
4-
var i: scala.Int = 1
4+
var i = 1
55
do i = 0 while (i.!=(0))
66
}
7-
}
7+
}

tests/pos/simpleRefinement.decompiled

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** Decompiled from out/posTestFromTasty/pos/simpleRefinement/Bar.class */
1+
/** Decompiled from out/posTestFromTasty/pos/simpleRefinement/Bar.tasty */
22
trait Bar() extends java.lang.Object {
33
type S
44
type T
@@ -10,19 +10,9 @@ trait Bar() extends java.lang.Object {
1010
def w[T]: scala.Any
1111
def w2[T](a: scala.Null)(b: scala.Null): scala.Any
1212
}
13-
/** Decompiled from out/posTestFromTasty/pos/simpleRefinement/Foo.class */
13+
/** Decompiled from out/posTestFromTasty/pos/simpleRefinement/Foo.tasty */
1414
class Foo() {
15-
val bar: Bar {
16-
type S >: scala.Int <: scala.Int
17-
type T >: scala.Function1[scala.Int, scala.Int] <: scala.Function1[scala.Int, scala.Int]
18-
type U >: [X >: scala.Nothing <: scala.Any] => scala.Int <: [X >: scala.Nothing <: scala.Any] => scala.Int
19-
val x: scala.Long
20-
def y: scala.Boolean
21-
def z(): scala.Char
22-
def z2()(): scala.Char
23-
def w[T >: scala.Nothing <: scala.Any]: scala.Predef.String
24-
def w2[T >: scala.Nothing <: scala.Any](a: scala.Null)(b: scala.Null): scala.Null
25-
} = {
15+
val bar = {
2616
final class $anon() extends Bar {
2717
type S = scala.Int
2818
type T = scala.Function1[scala.Int, scala.Int]
@@ -46,4 +36,4 @@ class Foo() {
4636
def w2[T >: scala.Nothing <: scala.Any](a: scala.Null)(b: scala.Null): scala.Null
4737
})
4838
}
49-
}
39+
}

tests/pos/simpleWhile.decompiled

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
/** Decompiled from out/posTestFromTasty/pos/simpleWhile/Foo.class */
1+
/** Decompiled from out/posTestFromTasty/pos/simpleWhile/Foo.tasty */
22
class Foo() {
33
def foo: scala.Unit = {
4-
var i: scala.Int = 1
4+
var i = 1
55
while (i.!=(0)) i = 0
66
}
77
}

tests/pos/t704.decompiled

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
/** Decompiled from out/posTestFromTasty/pos/t704/C.class */
1+
/** Decompiled from out/posTestFromTasty/pos/t704/C.tasty */
22
class C() extends E
3-
/** Decompiled from out/posTestFromTasty/pos/t704/D.class */
3+
/** Decompiled from out/posTestFromTasty/pos/t704/D.tasty */
44
trait D() extends java.lang.Object {
5-
val x: java.lang.String = "xxxx should appear twice"
5+
val x = "xxxx should appear twice"
66
object xxxx {
77
scala.Console.println(D.this.x)
88
}
99
def get_xxxx: scala.AnyRef = D.this.xxxx
1010
}
11-
/** Decompiled from out/posTestFromTasty/pos/t704/E.class */
11+
/** Decompiled from out/posTestFromTasty/pos/t704/E.tasty */
1212
trait E() extends java.lang.Object with D {
1313
def f(): scala.Unit = {
14-
val y: java.lang.String = "yyyy should appear twice"
14+
val y = "yyyy should appear twice"
1515
object yyyy {
16-
val x1: scala.AnyRef = E.this.get_xxxx
16+
val x1 = E.this.get_xxxx
1717
scala.Console.println(y)
1818
}
1919
yyyy
2020
()
2121
}
2222
}
23-
/** Decompiled from out/posTestFromTasty/pos/t704/Go.class */
23+
/** Decompiled from out/posTestFromTasty/pos/t704/Go.tasty */
2424
object Go extends D {
2525
def main(args: scala.Array[scala.Predef.String]): scala.Unit = {
2626
new C().f()
2727
new C().f()
2828
}
29-
}
29+
}

tests/pos/varargs-position.decompiled

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
/** Decompiled from out/posTestFromTasty/pos/varargs-position/varargspos.tasty */
12
object varargspos {
23
def g(a: scala.Int, x: scala.Int*): scala.Int = a.+(x.length)
34
varargspos.g(1, 2, 3, 4)
4-
val xs: collection.immutable.List[scala.Int] = scala.Nil.::[scala.Int](2).::[scala.Int](1)
5-
val a: scala.Int = 8
6-
val b: scala.Int = 7
5+
val xs = scala.Nil.::[scala.Int](2).::[scala.Int](1)
6+
val a = 8
7+
val b = 7
78
varargspos.g(5, varargspos.xs: _*)
89
varargspos.g(3, scala.Nil: _*)
910
varargspos.g(varargspos.a, varargspos.xs: _*)

tests/run/literals.decompiled

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ object Test {
33
def αρετη: java.lang.String = "alpha rho epsilon tau eta"
44
case class GGG(i: scala.Int) {
55
override def hashCode(): scala.Int = {
6-
var acc: scala.Int = 767242539
6+
var acc = 767242539
77
acc = scala.runtime.Statics.mix(acc, GGG.this.i)
88
scala.runtime.Statics.finalizeHash(acc, 1)
99
}
@@ -92,7 +92,7 @@ object Test {
9292
Test.check_success[scala.Double]("1l.asInstanceOf[Double] == 1.0", 1L.asInstanceOf[scala.Double], 1.0)
9393
scala.Predef.println()
9494
Test.check_success[scala.Int]("\"\".length()", "\032".length(), 1)
95-
val ggg: scala.Int = Test.GGG.apply(1).αα(Test.GGG.apply(2))
95+
val ggg = Test.GGG.apply(1).αα(Test.GGG.apply(2))
9696
Test.check_success[scala.Int]("ggg == 3", ggg, 3)
9797
}
9898
}

tests/run/t4300.decompiled

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class B() extends A {
1515
/** Decompiled from out/runTestFromTasty/run/t4300/Test.tasty */
1616
object Test {
1717
def main(args: scala.Array[scala.Predef.String]): scala.Unit = {
18-
val b: B = new B()
18+
val b = new B()
1919
b.b()
2020

2121
{
@@ -25,4 +25,4 @@ object Test {
2525
b.g()
2626
b.h()
2727
}
28-
}
28+
}

tests/run/t889.decompiled

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/** Decompiled from out/runTestFromTasty/run/t889/Test.tasty */
22
object Test extends dotty.runtime.LegacyApp {
3-
val a: collection.immutable.List[java.lang.String] = scala.List.apply[java.lang.String]("a")
3+
val a = scala.List.apply[java.lang.String]("a")
44
Test.a match {
55
case scala.Seq("a", "b", rest: _*) =>
66
scala.Predef.println("a, b, ".+(rest))
77
case scala.Seq(first, rest: _*) =>
88
scala.Predef.println("first: ".+(first).+(", rest: ").+(rest))
99
}
10-
}
10+
}

tests/run/valueclasses-pavlov.decompiled

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ trait Foo() extends scala.Any {
3737
/** Decompiled from out/runTestFromTasty/run/valueclasses-pavlov/Test.tasty */
3838
object Test {
3939
def main(args: scala.Array[scala.Predef.String]): scala.Unit = {
40-
val b1: Box1 = new Box1("")
41-
val b2: Box2 = new Box2("")
40+
val b1 = new Box1("")
41+
val b2 = new Box2("")
4242
val f: Foo = b2
4343
scala.Predef.println(f.box1(b1))
4444
scala.Predef.println(f.box2(b2))

0 commit comments

Comments
 (0)