Skip to content

Optional in cycles #202

@alex28sh

Description

@alex28sh

Hello! Currently I'm having issues verifying code with Optional types. For example, for code containing cycles I get following error:
Loop invariant issubtype(typeof(a), int()) might not hold on entry. (<no position>)

Here is the example of code:

    a = int(0) # type : Optional[int]
    a = None # type : Optional[int]
    d_4_i_ = int(0) # type : int
    while (d_4_i_) < (len(arr)):
        Invariant(Acc(list_pred(arr)))
        Invariant(((0) <= (d_4_i_)) and ((d_4_i_) <= (len(arr))))
        if (((arr)[d_4_i_]) < (0)) and (((a) is None) or (((arr)[d_4_i_]) >= (a))):
            a = ((arr)[d_4_i_])
        d_4_i_ = (d_4_i_) + (1)

Could you kindly help me with this 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