Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set-type should be able to be used in constraint block to constrain random variable's range #20

Open
LeeKaiXuan opened this issue Jun 13, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@LeeKaiXuan
Copy link
Collaborator

Description

In constraint block, a set-type should be able to be used to constrain a random variable's range.

Scenario Code

component pss_top {
    action root_a {
        activity {
            do constraintBySet with { value in [1]; };
        }
    }

    action constraintBySet {
        rand int value;
        set<int> foo = {1, 3, 5, 7};

        constraint { value in foo; }
        exec body ASM = """constraintBySet: {{value}}""";
    }
}

Expected Output or Behaviour

constraintBySet: 1

Error Message from PSSGen or JAVA

Exception in thread "main" java.lang.ClassCastException: class PSSSetVal cannot be cast to class PSSListVal (PSSSetVal and PSSListVal are in unnamed module of loader 'app')
        at PSSInExpression.deduceDomain(PSSInExpression.java:17)
        at PSSExpressionConstraint.deduceDomain(PSSExpressionConstraint.java:11)
        at PSSSolver.reduceDomain(PSSSolver.java:49)
        at PSSSolver.solve(PSSSolver.java:80)
        at PSSActionModel.traverse(PSSActionModel.java:154)
        at PSSTraversalList.traverse(PSSTraversalList.java:80)
        at PSSActionInst.traverseSubAction(PSSActionInst.java:35)
        at PSSActionModel.traverse(PSSActionModel.java:167)
        at PSSGenMain.traverseRootAction(PSSGenMain.java:77)
        at PSSGenMain.main(PSSGenMain.java:15)
@LeeKaiXuan LeeKaiXuan added the bug Something isn't working label Jun 13, 2024
@LeeKaiXuan LeeKaiXuan self-assigned this Jun 13, 2024
LeeKaiXuan added a commit that referenced this issue Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant