@@ -130,7 +130,7 @@ fun null_producer(n : int) = {
}
fun main(n : int) : nonnull int = { // line 10
var p : Pair := new Pair(0, 1);
var p : Trpl := new Trpl(0, 1, 2);
p.snd := null;
p.fst := null_producer(n);
return p.fst;
...
...
@@ -143,15 +143,21 @@ Your analysis should print the following:
N 14 4 -> null 12 13
N 14 4 -> obj 11 29
N 14 4 -> obj 11 32
N 14 4 -> obj 11 35
N 14 4 -> null 5 14
N 1 10 -> null 12 13
N 1 10 -> null 5 14
N 1 10 -> obj 11 29
N 1 10 -> obj 11 32
N 1 10 -> obj 11 35
```
Where:
-`N` means that we are talking about an assignment to a nonnull variable (here, a field).
-`14 4` refers to the source location that Teal associates with the initial field assignment
-`obj 6 29` refers to the literal number `5`
-`8 4` is the source location of the second assignment
-`null 3 50` is the source location in which `null` occurs in `null_producer` (from which it can make its way into `p.fst`).
-`14 4` refers to the source location that Teal associates with the `return` statement
-`1 10` refers to the source location that Teal associates with the `fst` field. Since we don't expect a field-sensitive analysis, it is fine to point to _any_ nonnull field (i.e., it would also be okay to report the location of `trd`).
-`obj 11 35` refers to the literal number `2`
-`null 5 14` is the source location in which `null` occurs in `null_producer` (from which it can make its way into `p.fst`).
Note that `p.fst` will not point to `n`: the content of `n` will flow into `p.fst`, however; in Andersen's analysis,
this translates into an inclusion edge (after some steps of analysis). Since nothing in this code calls `main`, we can't see what `n` will point