Skip to content

Circularity doesn't get detected #23

@amir734jj

Description

@amir734jj

APS doesn't find a cycle in the following code:

with "basic";
with "tiny";

module TINY_CIRCULAR[T :: var TINY[]] extends T
begin
    phylum S;
    type RemoteS := remote S;
    type Integers := SET[Integer];
    type IntegerLattice := UNION_LATTICE[Integer, Integers];

    circular collection attribute S.s_bag1 : IntegerLattice := {};
    circular collection attribute S.s_bag2 : IntegerLattice := {};

    attribute Root.result : Integers;
    attribute Wood.w_s : RemoteS;
        
    pragma synthesized(w_s, result);
    pragma inherited();

    constructor s_constructor() : S;

    match ?l=leaf(?x) begin
        t : S := s_constructor();
        t.s_bag1 :> { x };
        l.w_s := t;
    end;

    match ?b=branch(?x,?y) begin
        v : S := s_constructor();
        b.w_s := v;
        v.s_bag1 :> v.s_bag2;
    end;

    match ?p=root(?b) begin
        b.w_s.s_bag2 :> b.w_s.s_bag1 \/ { 1, 2, 3 };
        p.result := b.w_s.s_bag1;
    end;
end;

However, changing the line from:

v.s_bag1 :> v.s_bag2;

To:

i : IntegerLattice := v.s_bag2;
v.s_bag1 :> i;

Fixes the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions