-
-
Notifications
You must be signed in to change notification settings - Fork 190
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 when using a list with interpolated strings #2242
Comments
Alternative, failing code: let f x = readOnlyDict[$"{x}:0", ""; $"{x}:1", ""] After formatting, breaks:let f x =
readOnlyDict[$"{x}:0", ""
$"{x}:1", ""] This seems related to #2201, where it was suggested that adding a space before the list bracket fixes Fantomas' handling. However, in many cases adding a space will break the code, as |
Hello, thank you for raising this. |
That is debatable btw. In F# 6 the new indexer syntax recontextualizes what you wrote. > readOnlyDict;;
val it:
(seq<'a * 'b> -> Collections.Generic.IReadOnlyDictionary<'a,'b>)
when 'a: equality
The only bug I see here is how it is wrongly handling a multiline expression inside the index. |
@nojaf Well, I mentioned that after the observation that Fantomas 4.6 tackles this code correctly somehow. The project is F# 6.0 indeed, but running it with commandline Fantomas 4.7 showed the problem.
This is an interesting observation. I didn't consider this. So I tried a few things in F# Interactive, and I get a compile error each time, esp. w.r.t. it being an indexed property. But, in the "normal" let configureCorsPolicy x = Seq.iter ignore x
let hdrKey = "foo"
configureCorsPolicy
readOnlyDict[$"{hdrKey}:0", "X-MessageID"; $"{hdrKey}:1", "Authorization"] I thought this was similar to the subtle difference between |
Sorry, I stand corrected. It wasn't an error in FSI, it was a warning:
Darn, and now I notice the |
Thanks for following up on this. |
The compiler is a bit weird here. I removed the That's clearly F# compiler territory and not so much Fantomas territory. I might have a look one of these days in submitting a PR to fix the underlying bug where the alignment gets screwed up in multiline statements. |
Well, one other thing to note is that Fantomas is using a slightly newer version of the compiler bits. For a few days now, we are using our own FCS version, which is tied closely to the All of this isn't really a problem unless there are some more significant changes like the new index syntax.
Thank you, check out our Contribution Guidelines to get started. |
Fixed by #2446 |
Issue created from fantomas-online
Before formatting, code was compiling:
Formatted code
Reformatted code (note the missing semicolon!)
Problem description
Fantomas was not able to produce the same code after reformatting the result.
Extra information
warningserrors.Options
Fantomas master branch at 2022-05-09T12:59:04Z - f2e3c08
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? yes ;).
The text was updated successfully, but these errors were encountered: