Skip to content

Error using local variable in a requirement inside a setup block #392

@dfremont

Description

@dfremont

System Details

  1. Python 3.13.7
  2. Scenic main branch
  3. macOS 15

Detailed Description

Running Scenic on the scenario below produces the following error:

Traceback (most recent call last; use -b to show Scenic internals):
  File "/Users/dfremont/Documents/Berkeley/repositories/BerkeleyLearnVerify/Scenic/test.scenic", line 5, in <lambda>
    require other.position.y > 1.5
            ^^^^^^^^^^^^^^^^^^^^^^
RandomControlFlowError: random values cannot be compared (and control flow cannot depend on them)

The above exception was the direct cause of the following exception:

Traceback (most recent call last; use -b to show Scenic internals):
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/contextlib.py", line 162, in __exit__
    self.gen.throw(value)
    ~~~~~~~~~~~~~~^^^^^^^
RuntimeError: internal error: requirement dependency not sampled

I think this issue may have been reported to me a long time ago, since I found it in git stash, but I'm not sure.

Steps To Reproduce

scenario Main():
    setup:
        ego = new Object
        other = new Object at (10, Range(1, 2))
        require other.position.y > 1.5

Issue Submission Checklist

  • I am reporting an issue, not asking a question
  • I checked the open and closed issues, forum, etc. and have not found any solution
  • I have provided all necessary code, etc. to reproduce the issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: triageIssue needs to be assessedtype: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions