Skip to content

Commit 3b94e75

Browse files
committed
Reclassify previously invalidated tests
Reclassify previously invalidated typelevel tests - some of them work again - some of them can be turned into neg tests - the rest gets a note why they are invalid
1 parent b153aa1 commit 3b94e75

10 files changed

+39
-62
lines changed

compiler/test/dotc/run-from-tasty.blacklist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ eff-dependent.scala
33

44
# It seems we still harmonize types in fromTasty. Not sure where this happens
55
puzzle.scala
6+
7+
# Need to print empty tree for implicit match
8+
implicitMatch.scala

tests/invalid/neg/typelevel.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// This test requires retyping from untyped trees after inlining, which is not supported anymore
12
trait HList {
23
def length: Int
34
def head: Any

tests/invalid/pos/transparent-overload.scala

Lines changed: 0 additions & 22 deletions
This file was deleted.

tests/invalid/pos/typelevel-vector1.scala

Lines changed: 0 additions & 30 deletions
This file was deleted.

tests/invalid/run/Tuple.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import annotation.showAsInfix
22

3+
// This version of Tuple requires full retyping of untyped trees on inlining
34
object typelevel {
45
erased def erasedValue[T]: T = ???
56
class Typed[T](val value: T) { type Type = T }

tests/invalid/run/typelevel-patmat.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
// This test requires retyping from untyped trees after inlining, which is not supported anymore
22
object typelevel {
33
case class Typed[T](value: T) { type Type = T }
44
}
@@ -21,7 +21,7 @@ object Test extends App {
2121
type HNil = HNil.type
2222
type Z = Z.type
2323

24-
inline def ToNat(inline n: Int): Typed[Nat] =
24+
inline def ToNat(inline n: Int) <: Typed[Nat] =
2525
if n == 0 then Typed(Z)
2626
else Typed(S(ToNat(n - 1).value))
2727

@@ -35,7 +35,7 @@ object Test extends App {
3535
println(x1)
3636
println(x2)
3737

38-
inline def toInt(n: Nat): Int = inline n match {
38+
inline def toInt(n: Nat) <: Int = inline n match {
3939
case Z => 0
4040
case S(n1) => toInt(n1) + 1
4141
}
@@ -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+
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+
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
}
@@ -78,12 +78,12 @@ object Test extends App {
7878
val e1 = nth(r2, 1)
7979
val ce1: String = e1
8080

81-
inline def concatTyped(xs: HList, ys: HList): Typed[_ <: HList] = inline xs match {
81+
inline def concatTyped(xs: HList, ys: HList) <: Typed[_ <: HList] = inline xs match {
8282
case HNil => Typed(ys)
8383
case HCons(x, xs1) => Typed(HCons(x, concatTyped(xs1, ys).value))
8484
}
8585

86-
def concatImpl(xs: HList, ys: HList): HList = xs match {
86+
def concatImpl(xs: HList, ys: HList) <: HList = xs match {
8787
case HNil => ys
8888
case HCons(x, xs1) => HCons(x, concatImpl(xs1, ys))
8989
}

tests/invalid/run/typelevel1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
// This test requires retyping from untyped trees after inlining, which is not supported anymore
22
trait HList {
33
def length: Int = ???
44
def head: Any

tests/invalid/run/typelevel3.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
// This test requires retyping from untyped trees after inlining, which is not supported anymore
22
trait HList {
33
def length: Int = 0
44
def head: Any

tests/neg/inline-overload.scala

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// This test demonstrates that overloading resulution is not redone when
2+
// inlining.
3+
object Test {
4+
5+
def f(x: Int): Int = x
6+
def f(x: String): String = x
7+
def f(x: Any): Any = x
8+
9+
inline def g(x: Any) = f(x)
10+
inline def h(x: Any) = this.f(x)
11+
12+
locally {
13+
val x1 = g(1)
14+
val x2 = g("bb")
15+
val y1: Int = x1 // error: type mismatch
16+
val y2: String = x2 // error: type mismatch
17+
}
18+
locally {
19+
val x1 = h(1)
20+
val x2 = h("bb")
21+
val y1: Int = x1 // error: type mismatch
22+
val y2: String = x2 // error: type mismatch
23+
}
24+
}

tests/invalid/run/typelevel-defaultValue.scala renamed to tests/run/typelevel-defaultValue.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ object typelevel {
55

66
object Test extends App {
77

8-
inline def defaultValue[T]: Option[Any] = inline typelevel.erasedValue[T] match {
8+
inline def defaultValue[T] <: Option[Any] = inline typelevel.erasedValue[T] match {
99
case _: Byte => Some(0: Byte)
1010
case c: Char => Some(0: Char)
1111
case d @ (_: Short) => Some(0: Short)

0 commit comments

Comments
 (0)