Skip to content

Commit d172f81

Browse files
committed
Write test to check for specialized apply
1 parent a02a5d2 commit d172f81

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

compiler/test/dotty/tools/dotc/transform/SpecializeFunction1Tests.scala

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,25 @@ class SpecializeFunction1Tests extends DottyBytecodeTest {
2929
val applys = methods
3030
.collect {
3131
case m if m.name == "apply$mcII$sp" => m
32+
case m if m.name == "apply" => m
3233
}
34+
.map(_.name)
3335
.toList
3436

35-
assert(applys.length == 1, "Wrong number of specialized applys")
37+
assert(
38+
// there should be two "apply", one generic and the one overwritten and
39+
// then the specialized one
40+
applys.length == 3,
41+
s"Wrong number of specialized applys, actual length: ${applys.length} $applys"
42+
)
43+
assert(
44+
applys.contains("apply"),
45+
"Foo did not contain `apply` forwarder method"
46+
)
47+
assert(
48+
applys.contains("apply$mcII$sp"),
49+
"Foo did not contain specialized apply"
50+
)
3651
}
3752
}
3853
}

0 commit comments

Comments
 (0)