Skip to content

Commit 0cdb299

Browse files
committed
Fixed test.
Until the previous fix to Denotation-& the test here spuriously passed. The Dotty spec is that value classes synthesize equals and hashCode only if no concrete definitions are inherited except the ones from Any. That was previously miscalculated. The test has been updated to reflect the specified behavior.
1 parent 82f8a81 commit 0cdb299

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tests/run/t6534.scala

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@ object Test {
88
def main(args: Array[String]): Unit = {
99
val b1 = new Bippy1(71)
1010
val b2 = new Bippy2(71)
11-
assert(b1 == b1 && b1.## == b1.x.##, ((b1, b1.##)))
12-
assert(b2 == b2 && b2.## == b2.x.##, ((b2, b2.##)))
11+
assert(b1 == b1)
12+
assert(b1.## == b1.x.##, "hash differs1 " + ((b1, b1.##)))
13+
assert(b2 == b2)
14+
// assert(b2.## == b2.x.##, "hash differs2 " + ((b2, b2.##, b2.x.##)))
15+
// Disabled, this does not hold. Because the value class inherits
16+
// a different hashCode, no code is generated for it. Replaced by:
17+
assert(b2.## == -1)
18+
assert(!b1.equals(b1))
1319
}
1420
}

0 commit comments

Comments
 (0)