You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
It's not actually a function, but an assignment of a top-level expression to unit, a habit I picked up from ocaml that is similar to x |> ignore<unit>, where if the result type changes, the unused value will be detected. You can reproduce it like this as well:
Description
When
use
ing anIDisposable
at the top-level, the generated code contains areturn
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
The text was updated successfully, but these errors were encountered: