fslang-design icon indicating copy to clipboard operation
fslang-design copied to clipboard

[style-guide] space around SynType.StaticConstantExpr

Open nojaf opened this issue 3 years ago • 3 comments

Considering the following code:

type T = Provider< @"...">

There needs to be a space before the @ string in order for this to remain valid code. Should there be a space after the literal in this case?

As mentioned by @auduchinok in https://github.com/fsprojects/fantomas/issues/2101, all other types of arguments do not need a space:

T<int>
T<a * b>
T<_>
T<"123">
T<1, Qwerty, @"123">

What guidance should there be regarding type arguments @dsyme? I don't the guide currently has any information on the subject.

Side note: Fantomas currently adds the extra space when a leading space is required. I personally don't have any preference or stake here, I only want a change in Fantomas because the style guide changed. That is why I'm bringing this up.

nojaf avatar Mar 04 '22 10:03 nojaf

Should there be a space after the literal in this case?

Aesthetically yes, I guess it would be good. We should also just fix the problem that doesn't allow <@ in that position.

dsyme avatar Mar 04 '22 13:03 dsyme

Yeah, I see this as a parser bug and not a stylistic choice.

cartermp avatar Mar 04 '22 16:03 cartermp

Until a fix is made, there should indeed be a space after the literal in this case.

@nojaf I don't think we need a style guide update for this corner case, we can take this issue as the clarification.

Thanks!

dsyme avatar May 26 '22 17:05 dsyme