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

Idempotency problem with with block #1647

Closed
Smaug123 opened this issue Apr 15, 2021 · 1 comment · Fixed by #1657
Closed

Idempotency problem with with block #1647

Smaug123 opened this issue Apr 15, 2021 · 1 comment · Fixed by #1657

Comments

@Smaug123
Copy link
Contributor

Too long for GitHub query param, sorry. The following raises an idempotence error: it tries to indent the with block the second time around.

Input code

module Foo =
    let blah () =
        match foo with
        | Thing crate ->
            crate.Apply { new Evaluator<_, _> with
                member __.Eval inner teq =
                    let foo =
                        // blah
                        let exists =
                            try
                                let defaultTime = (DateTime.FromFileTimeUtc 0L).ToLocalTime ()
                                foo.CreationTime <> defaultTime
                            with
                            // hmm
                            | :? FileNotFoundException -> false
                        exists
                    ()
            }

Output

module Foo =
    let blah () =
        match foo with
        | Thing crate ->

        crate.Apply
            { new Evaluator<_, _> with
                member __.Eval inner teq =
                    let foo =
                        // blah
                        let exists =
                            try
                                let defaultTime =
                                    (DateTime.FromFileTimeUtc 0L).ToLocalTime ()

                                foo.CreationTime <> defaultTime
                            with
                            // hmm
                            :? FileNotFoundException -> false

                        exists

                    ()
            }

Settings

[*.fs]
fsharp_space_before_uppercase_invocation=true
fsharp_space_before_class_constructor=true
fsharp_space_before_member=true
fsharp_space_before_colon=true
fsharp_space_before_semicolon=true
fsharp_multiline_block_brackets_on_same_column=true
fsharp_newline_between_type_definition_and_members=true
fsharp_keep_if_then_in_same_line=true
fsharp_align_function_signature_to_indentation=true
fsharp_alternative_long_member_definitions=true
fsharp_multi_line_lambda_closing_newline=true
fsharp_keep_indent_in_branch=true
@Smaug123 Smaug123 changed the title Idempotency problem Idempotency problem with with block Apr 15, 2021
@Smaug123
Copy link
Contributor Author

Related to #1571, probably?

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

Successfully merging a pull request may close this issue.

2 participants