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

Conditional defines around selfIdentifier in implicit type constructor #2733

Closed
1 of 3 tasks
nojaf opened this issue Jan 19, 2023 · 3 comments · Fixed by #2753
Closed
1 of 3 tasks

Conditional defines around selfIdentifier in implicit type constructor #2733

nojaf opened this issue Jan 19, 2023 · 3 comments · Fixed by #2753

Comments

@nojaf
Copy link
Contributor

nojaf commented Jan 19, 2023

Issue created from fantomas-online

Code

type internal CompilerStateCache(readAllBytes: string -> byte[], projectOptions: FSharpProjectOptions)
#if !NO_TYPEPROVIDERS
    as this =
#else
    =
#endif
    class end

Result

type internal CompilerStateCache(readAllBytes: string -> byte[], projectOptions: FSharpProjectOptions) as
#if !NO_TYPEPROVIDERS
this =
#else
    =
#endif
    class
    end

Problem description

We probably need the as keyword as trivia to solve this one.

Extra information

  • The formatted result breaks my code.
  • The formatted result gives compiler warnings.
  • I or my company would be willing to help fix this.

Options

Fantomas main branch at 2023-01-19T07:22:18Z - 959e49b

Default Fantomas configuration

Did you know that you can ignore files when formatting from fantomas-tool or the FAKE targets by using a .fantomasignore file?

@T-Gro
Copy link

T-Gro commented Mar 23, 2023

Hi.
I have found a case in the dotnet/fsharp repo where the same issue still exhibits.
This PR did nothing else but applying Fantomas.

https://github.com/dotnet/fsharp/pull/14961/files#diff-d7b05bb46c11b5ef9a294b9a5a78d157dc3939b9c3e1c885320964eefdfed66cR1109

@T-Gro
Copy link

T-Gro commented Mar 23, 2023

Before, the "as this" was only inside the conditional directive. It was moved to be outside of it.
Code before:

#if !NO_TYPEPROVIDERS
    as this
#endif

@nojaf
Copy link
Contributor Author

nojaf commented Mar 23, 2023

Well, yes that is to be expected. You are most likely on a version that predates this fix.

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