Skip to content

use in top-level expression results in invalid Python syntax #3912

Closed
@joprice

Description

@joprice

Description

When useing an IDisposable at the top-level, the generated code contains a return statement, which is not valid outside of the context of a function definition.

Repro code

https://fable.io/repl/#?code=PYBwpgdgBAYghgIwDZgHQGFgCcwChcAuAnuFABpQC8UAlhABZhY0FQDKRAzgWALaoBJACI1OIYJ0Qp8AbQA8AcSTAEcJAD4AurhSsAHgC5yVKBDgEaANzAB5CEiL5dUABQBKE7ihQArpzBQeiZ6Xq5uQA&html=Q&css=Q

Expected and actual results

The expression should be wrapped in something like an IIFE, as is the case for the js backend.

Related information

  • Fable version: 4.19.3
  • Operating system: OSX

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions