Skip to content

Commit a208cce

Browse files
committed
Add test for generic static field type consistency
1 parent c7ad885 commit a208cce

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed
Binary file not shown.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
public class Test<T> {
3+
4+
public static Test<Integer> static_field;
5+
6+
public static Test<Integer> test() {
7+
8+
return static_field;
9+
10+
}
11+
12+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
CORE
2+
Test.class
3+
--function Test.test --validate-goto-model --show-goto-functions
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
Test\.test:\(\)LTest;#return_value = static_field;
7+
--
8+
^warning: ignoring
9+
--
10+
This checks that the return value type matches the static field -- if it didn't,
11+
either --validate-goto-model would throw because of a mismatching assignment, or
12+
a cast would be used to adjust the type.
13+
14+
The original motivation for this test was that generic field references could
15+
accidentally omit generic arguments that were present in function types.

0 commit comments

Comments
 (0)