mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
purity inference: be more careful with array assignments
This commit is contained in:
+12
@@ -92,6 +92,18 @@ int random() { return 2; }
|
||||
"""
|
||||
}
|
||||
|
||||
public void "test field array assignment as local var"() {
|
||||
assertPure false, """
|
||||
int[] randomArray() {
|
||||
int[] local = i;
|
||||
local[0] = random();
|
||||
return local;
|
||||
}
|
||||
int random() { return 2; }
|
||||
int[] i = new int[0];
|
||||
"""
|
||||
}
|
||||
|
||||
public void "test use explicit pure contract"() {
|
||||
assertPure true, """
|
||||
int method() {
|
||||
|
||||
Reference in New Issue
Block a user