Closed
Description
Because %
character can have a special meaning within interpolated strings (as format specifier for interpolation expressions), it needs to be escaped by doubling to be treated as literal %
character. However, if an interpolated string literal has no interpolation expressions, it will not drop the extra %
chars from content
Repro steps
Create an interpolated string literal without any interpolations (expressions within curly braces) and containing a substring of %%
.
Expected behavior
Regardless of whether the literal contained any interpolation expressions, it treats %%
as %
> //Interpolated string literal with no interpolation holes
- $"%%";;
val it: string = "%"
> //And for comparison an interpolated string literal *with* interpolation holes
- $"{42=41+1} ... %%";;
val it: string = "True ... %"
Actual behavior
> //Interpolated string literal with no interpolation holes
- $"%%";;
val it: string = "%%"
> //And for comparison an interpolated string literal *with* interpolation holes
- $"{42=41+1} ... %%";;
val it: string = "True ... %"
Known workarounds
Don't use interpolated string literals that have no interpolation holes.
Metadata
Metadata
Assignees
Type
Projects
Status
Done