Skip to content

Commit 3179b21

Browse files
committed
Update tests to transparent syntax
1 parent 2548798 commit 3179b21

File tree

25 files changed

+38
-38
lines changed

25 files changed

+38
-38
lines changed

tests/invalid/run/typelevel-patmat.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ object Test extends App {
4545
inline val i2 = toInt(y2)
4646
val j2: 2 = i2
4747

48-
inline def concat(xs: HList, ys: HList) <: HList = inline xs match {
48+
transparent inline def concat(xs: HList, ys: HList): HList = inline xs match {
4949
case HNil => ys
5050
case HCons(x, xs1) => HCons(x, concat(xs1, ys))
5151
}
@@ -68,7 +68,7 @@ object Test extends App {
6868
val r6 = concat(HCons(1, HCons("a", HNil)), HCons(true, HCons(1.0, HNil)))
6969
val c6: HCons[Int, HCons[String, HCons[Boolean, HCons[Double, HNil]]]] = r6
7070

71-
inline def nth(xs: HList, n: Int) <: Any = inline xs match {
71+
transparent inline def nth(xs: HList, n: Int): Any = inline xs match {
7272
case HCons(x, _) if n == 0 => x
7373
case HCons(_, xs1) if n > 0 => nth(xs1, n - 1)
7474
}

tests/invalid/run/typelevel1.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ trait HList {
44
def head: Any
55
def tail: HList
66

7-
inline def isEmpty <: Boolean = length == 0
7+
transparent inline def isEmpty: Boolean = length == 0
88
}
99

1010
case object HNil extends HList {
11-
inline override def length <: Int = 0
11+
transparent inline override def length: Int = 0
1212
def head: Nothing = ???
1313
def tail: Nothing = ???
1414
}
1515

1616
case class :: [H, T <: HList] (hd: H, tl: T) extends HList {
17-
inline override def length <: Int = 1 + tl.length
17+
transparent inline override def length: Int = 1 + tl.length
1818
inline def head: H = this.hd
1919
inline def tail: T = this.tl
2020
}
@@ -32,7 +32,7 @@ object Test extends App {
3232

3333
// Does not work since it infers `Any` as a type argument for `::`
3434
// and we cannot undo that without a typing from untyped.
35-
inline def concat[T1, T2](xs: HList, ys: HList) <: HList =
35+
transparent inline def concat[T1, T2](xs: HList, ys: HList): HList =
3636
inline if xs.isEmpty then ys
3737
else new ::(xs.head, concat(xs.tail, ys))
3838

tests/neg-macros/quote-whitebox/Macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import scala.quoted._
22

33
object Macros {
4-
inline def defaultOf(inline str: String) <: Any = ${ defaultOfImpl('str) }
4+
transparent inline def defaultOf(inline str: String): Any = ${ defaultOfImpl('str) }
55
def defaultOfImpl(str: Expr[String]) (using QuoteContext): Expr[Any] = str.unliftOrError match {
66
case "int" => '{1}
77
case "string" => '{"a"}

tests/neg/specializing-inline.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ object Test {
44
val z = h(true)
55
val zc: Int = z // error
66

7-
inline def g <: Any = 1
7+
transparent inline def g: Any = 1
88
val y = g
99
val yc: Int = y // OK
1010

tests/pending/pos/summonFrom.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ object summonFroms {
44
object invariant {
55
case class Box[T](value: T)
66
implicit val box: Box[Int] = Box(0)
7-
inline def unbox <: Any = summonInline[Box[t]].value
7+
transparent inline def unbox: Any = summonInline[Box[t]].value
88
val i: Int = unbox
99
val i2 = unbox
1010
val i3: Int = i2
@@ -13,7 +13,7 @@ object summonFroms {
1313
object covariant {
1414
case class Box[+T](value: T)
1515
implicit val box: Box[Int] = Box(0)
16-
inline def unbox <: Any = summonInline[Box[t]].value
16+
transparent inline def unbox: Any = summonInline[Box[t]].value
1717
val i: Int = unbox
1818
val i2 = unbox
1919
val i3: Int = i2
@@ -22,7 +22,7 @@ object summonFroms {
2222
object contravariant {
2323
case class TrashCan[-T](trash: T => Unit)
2424
implicit val trashCan: TrashCan[Int] = TrashCan { i => ; }
25-
inline def trash <: Nothing => Unit = summonInline[TrashCan[t]].trash
25+
transparent inline def trash: Nothing => Unit = summonInline[TrashCan[t]].trash
2626
val t1: Int => Unit = trash
2727
val t2 = trash
2828
val t3: Int => Unit = t2

tests/pos-macros/quote-whitebox-2/Macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import scala.quoted._
33

44
object Macro {
55

6-
inline def charOrString(inline str: String) <: Any = ${ impl('str) }
6+
transparent inline def charOrString(inline str: String): Any = ${ impl('str) }
77

88
def impl(strExpr: Expr[String]) (using QuoteContext)=
99
val str = strExpr.unliftOrError

tests/pos/given-pattern.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
class Test {
44
import scala.collection.immutable.{TreeSet, HashSet}
55

6-
inline def trySummon[S, T](f: PartialFunction[S, T]) <: T = ???
6+
transparent inline def trySummon[S, T](f: PartialFunction[S, T]): T = ???
77

88
inline def setFor[T]: Set[T] = trySummon {
99
case given ord: Ordering[T] => new TreeSet[T]

tests/pos/i4006.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
class Foo {
2-
inline def foo <: Int = try { 1 } finally println("Hello")
2+
transparent inline def foo: Int = try { 1 } finally println("Hello")
33
foo
44
}

tests/pos/i5574.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import scala.compiletime._
33
object i5574 {
44
class Box[F[_]]
55

6-
inline def foo[T] <: Any =
6+
transparent inline def foo[T]: Any =
77
inline erasedValue[T] match {
88
case _: Box[f] =>
99
type t = f

tests/pos/i6213.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
object Test {
22
class C { type T }
3-
inline def foo[U] <: Any = (??? : C { type T = U })
3+
transparent inline def foo[U]: Any = (??? : C { type T = U })
44

55
foo[Int]
66
}

0 commit comments

Comments
 (0)