purity inference: be more careful with array assignments

This commit is contained in:
peter
2016-05-23 17:39:02 +02:00
parent b8788cfc2f
commit 8692887d89
2 changed files with 39 additions and 8 deletions
@@ -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() {