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

Documentation on implicit builder is out of date? #3779

Closed
AntonLydike opened this issue Jan 22, 2025 · 0 comments · Fixed by #3782
Closed

Documentation on implicit builder is out of date? #3779

AntonLydike opened this issue Jan 22, 2025 · 0 comments · Fixed by #3782
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@AntonLydike
Copy link
Collaborator

The implicit builder docs state:


class ImplicitBuilder(contextlib.AbstractContextManager[tuple[BlockArgument, ...]]):
    """
    Stores the current implicit builder context, consisting of the stack of builders in
    the current thread, and the current builder.

    Operations created within a `with` block of an implicit builder will be added to it.
    If there are nested implicit builder blocks, the operation will be added to the
    innermost one. Operations cannot be added to multiple blocks, and any attempt to do so
    will result in an exception.

    Example:

    ``` python
    from xdsl.dialects import arith

    block = Block()
    builder = Builder(block)

    with builder.implicit():
        arith.Constant.from_int_and_width(5, 32)

    assert len(block.ops) == 1
    assert isinstance(block.ops.first, arith.Constant)
    ```
    """

But trying to use Bulder(block).implicit() throws:

Traceback (most recent call last):
  File "/home/anton/projects/sympy2xdsl/test/filecheck/basic.py", line 13, in <module>
    with builder.implicit():
         ^^^^^^^^^^^^^^^^
AttributeError: 'Builder' object has no attribute 'implicit'

(@superlopuh )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants