Skip to content

Commit 4d23983

Browse files
committed
Add some run tests related to value classes
1 parent 942c41b commit 4d23983

23 files changed

+21
-18
lines changed

tests/pending/run/t6260-delambdafy.check

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

tests/pending/run/t6260-delambdafy.flags

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/pending/run/t6260-delambdafy.scala

Lines changed: 0 additions & 12 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

tests/run/t6260-delambdafy.check

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
f(C@2e)

tests/run/t6260-delambdafy.scala

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class C[A](private val a: Any) extends AnyVal
2+
3+
object Test {
4+
val f = (x: C[Any]) => {println(s"f($x)"); x}
5+
def main(args: Array[String]): Unit = {
6+
f(new C("."))
7+
8+
val methods = f.getClass.getDeclaredMethods.map(_.getName).sorted
9+
// Lambdas in Dotty are created with LambdaMetaFactory (when possible)
10+
// which does not guarantee that the list of methods will always be the same.
11+
/*
12+
println("")
13+
println(methods.mkString("\n"))
14+
*/
15+
}
16+
}
17+
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

tests/pending/run/value-class-extractor-2.scala renamed to tests/run/value-class-extractor-2.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
final class Opt[+A >: Null](val value: A) extends AnyVal {
22
def get: A = value
33
def isEmpty = value == null
4+
def isDefined = !isEmpty
45
}
56
object Opt {
67
final val None = new Opt[Null](null)

tests/pending/run/value-class-extractor.scala renamed to tests/run/value-class-extractor.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ object NonNullChar {
66
@inline final val None = new NonNullChar(0.toChar)
77
}
88

9-
final class SomeProduct extends Product3[String, Int, List[String]] {
9+
final class SomeProduct /*extends Product3[String, Int, List[String]]*/ {
1010
def canEqual(x: Any) = x.isInstanceOf[SomeProduct]
1111
def _1 = "abc"
1212
def _2 = 5
1313
def _3 = List("bippy")
1414
def isEmpty = false
15+
def isDefined = !isEmpty
1516
def get = this
1617
}
1718
object SomeProduct {

0 commit comments

Comments
 (0)