Skip to content

Commit 73e4933

Browse files
committed
Add test checking generic function parameter casts appear when expected
1 parent a62b5da commit 73e4933

File tree

6 files changed

+64
-0
lines changed

6 files changed

+64
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
test.class
3+
--function test.main2 --show-goto-functions
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
this \. test.callee2:\(Ltest;\)V\(\(struct test \*\)param\);
7+
--
8+
--
9+
test and callee2 have differing parameter types, so there should be a cast at the callsite.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
test.class
3+
--function test.main --show-goto-functions
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
this \. test.callee:\(Ltest;\)V\(param\);
7+
--
8+
--
9+
test and callee have matching parameter types, so there should be no cast at the callsite.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
test.class
3+
--function test.main
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^VERIFICATION FAILED$
7+
^\[java::test.callee:\(Ltest;\)V\.assertion\.1\] line 12 assertion at file test\.java line 12 function java::test\.callee:\(Ltest;\)V bytecode-index 5: FAILURE$
8+
--
9+
^warning: ignoring
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
test.class
3+
--function test.main2
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^VERIFICATION FAILED$
7+
^\[java::test.callee2:\(Ltest;\)V\.assertion\.1\] line 24 assertion at file test\.java line 24 function java::test\.callee2:\(Ltest;\)V bytecode-index 5: FAILURE$
8+
--
9+
^warning: ignoring
Binary file not shown.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
public class test<T> {
3+
4+
public void main(test<String> param) {
5+
6+
callee(param);
7+
8+
}
9+
10+
public void callee(test<String> param) {
11+
12+
assert false;
13+
14+
}
15+
16+
public void main2(test<String> param) {
17+
18+
callee2((test<T>)param);
19+
20+
}
21+
22+
public void callee2(test<T> param) {
23+
24+
assert false;
25+
26+
}
27+
28+
}

0 commit comments

Comments
 (0)