Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions proposals/utf8-string-literals.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,16 @@ The second example is hard to make work because it requires conversions in both

### Overload resolution breaks

The following API would become ambiguous:
The following API would change meaning if we did not have a suffix:

```c#
M("");
static void M1(char[] charArray) => ...;
static void M1(ReadOnlySpan<char> charSpan) => ...;
static void M1(byte[] charArray) => ...;
```

What should we do to address this?
Today this calls the `ReadOnlySpan` overload, because there is an implicit user-defined conversion from `string`. If we introduced a conversion-from-expression for all string
literals, then overload resolution would instead prefer the `byte[]` overload.

## Examples today
Examples of where runtime has manually encoded the UTF8 bytes today
Expand Down