Skip to content

Commit 8f1dde9

Browse files
committed
Drap braces in more tests
1 parent 567d760 commit 8f1dde9

File tree

4 files changed

+27
-46
lines changed

4 files changed

+27
-46
lines changed

tests/pos/reference/adts.scala

Lines changed: 19 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,32 @@
11
package adts
2-
object t1 {
2+
object t1 with
33

4-
enum Option[+T] {
5-
case Some(x: T)
6-
case None
7-
}
4+
enum Option[+T] with
5+
case Some(x: T)
6+
case None
87

9-
}
8+
object t2 with
109

11-
object t2 {
10+
enum Option[+T] with
11+
case Some(x: T) extends Option[T]
12+
case None extends Option[Nothing]
1213

13-
enum Option[+T] {
14-
case Some(x: T) extends Option[T]
15-
case None extends Option[Nothing]
16-
}
17-
18-
19-
}
20-
21-
enum Color(val rgb: Int) {
14+
enum Color(val rgb: Int) with
2215
case Red extends Color(0xFF0000)
2316
case Green extends Color(0x00FF00)
2417
case Blue extends Color(0x0000FF)
2518
case Mix(mix: Int) extends Color(mix)
26-
}
2719

28-
object t3 {
20+
object t3 with
2921

30-
enum Option[+T] {
31-
case Some(x: T) extends Option[T]
32-
case None
22+
enum Option[+T] with
23+
case Some(x: T) extends Option[T]
24+
case None
3325

34-
def isDefined: Boolean = this match {
35-
case None => false
36-
case some => true
37-
}
38-
}
39-
object Option {
40-
def apply[T >: Null](x: T): Option[T] =
41-
if (x == null) None else Some(x)
42-
}
26+
def isDefined: Boolean = this match
27+
case None => false
28+
case some => true
4329

44-
}
30+
object Option with
31+
def apply[T >: Null](x: T): Option[T] =
32+
if (x == null) None else Some(x)

tests/pos/reference/auto-param-tupling.scala

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
package autoParamTupling {
1+
package autoParamTupling
22

3-
object t1 {
3+
object t1 with
44
val xs: List[(Int, Int)] = ???
55

66
xs.map {
@@ -13,5 +13,3 @@ object t1 {
1313

1414
xs.map(_ + _)
1515

16-
}
17-
}
Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
package compiletime
22

3-
class Test {
3+
class Test with
44
import scala.compiletime.{constValue, erasedValue, S}
55

66
trait Nat
77
case object Zero extends Nat
88
case class Succ[N <: Nat](n: N) extends Nat
99

1010
inline def toIntC[N] <: Int =
11-
inline constValue[N] match {
11+
inline constValue[N] match
1212
case 0 => 0
1313
case _: S[n1] => 1 + toIntC[n1]
14-
}
1514

1615
final val ctwo = toIntC[2]
1716

18-
inline def defaultValue[T] <: Option[Any] = inline erasedValue[T] match {
17+
inline def defaultValue[T] <: Option[Any] = inline erasedValue[T] match
1918
case _: Byte => Some(0: Byte)
2019
case _: Char => Some(0: Char)
2120
case _: Short => Some(0: Short)
@@ -26,20 +25,16 @@ class Test {
2625
case _: Boolean => Some(false)
2726
case _: Unit => Some(())
2827
case _ => None
29-
}
3028

3129
val dInt: Some[Int] = defaultValue[Int]
3230
val dDouble: Some[Double] = defaultValue[Double]
3331
val dBoolean: Some[Boolean] = defaultValue[Boolean]
3432
val dAny: None.type = defaultValue[Any]
3533

36-
inline def toIntT[N <: Nat] <: Int = inline scala.compiletime.erasedValue[N] match {
34+
inline def toIntT[N <: Nat] <: Int = inline scala.compiletime.erasedValue[N] match
3735
case _: Zero.type => 0
3836
case _: Succ[n] => toIntT[n] + 1
39-
}
4037

4138
inline def summonFrom(f: Nothing => Any) <: Any = ???
4239

4340
final val two = toIntT[Succ[Succ[Zero.type]]]
44-
45-
}

tests/pos/reference/delegate-match.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package implicitmatch
22

3-
class Test extends App {
3+
class Test extends App with
44
import scala.collection.immutable.{TreeSet, HashSet}
55
import scala.compiletime.summonFrom
66

@@ -22,4 +22,4 @@ class Test extends App {
2222
inline def f: Any = summonFrom {
2323
case ev: A => println(ev.x) // error: ambiguous implicits
2424
}
25-
}
25+

0 commit comments

Comments
 (0)