Skip to content

Commit eab86e4

Browse files
committed
Add some run tests related to value classes
1 parent e511abd commit eab86e4

23 files changed

+21
-20
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+
// Lambdas in Dotty are created with LambdaMetaFactory (when possible)
9+
// which does not guarantee that the list of methods will always be the same.
10+
/*
11+
val methods = f.getClass.getDeclaredMethods.map(_.getName).sorted
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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
final class Opt[+A >: Null](val value: A) extends AnyVal {
22
def get: A = value
3-
def isEmpty = value == null
3+
def isDefined = value != null
44
}
55
object Opt {
66
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 & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ 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")
14-
def isEmpty = false
14+
def isDefined = true
1515
def get = this
1616
}
1717
object SomeProduct {

0 commit comments

Comments
 (0)