Skip to content

Optional with default value is not reset during read #88

@tpecholt

Description

@tpecholt

In expressions/expressions_in_templates.zs there is an optional field with default value:

struct ArrayExpressions<T>
{
    T array[2];
    bool isZeroArrayValid = true if array[0] == 0 && array[1] == 0;
};

During write operation validate() enforces the condition so isZeroArrayValid has to be nullopt when array elements are nonzero.

But during read operation isZeroArrayValid is first initialized to true in the ctor. Then the read operation doesn't reset it so it stays true. Therefore
writeReadTest comparison and validate both fails after a read operation.

Optional fields should be reset during read op.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions