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

Overload resolution chooses wrong overload for FormatableString #1417

Closed
popcatalin81 opened this issue Mar 27, 2018 · 1 comment
Closed

Comments

@popcatalin81
Copy link

popcatalin81 commented Mar 27, 2018

Version Used: 7.1

The following snippet shows how using a formattable string uses the wrong overload of write:

class Program {
	static void Main()
	{
		Write($"Hello there {DateTime.Now}");	
	}
	static void Write(string text)
	{
		Console.WriteLine("unformated");
	}
	
	static void Write(FormattableString text)
	{
		Console.WriteLine("formated");
	}
}

Expected Behavior:
formatted

Actual Behavior:
unformatted

As a note explicitly casting the formattable string to FormatableString produces the correct results:

@jnm2
Copy link
Contributor

jnm2 commented Mar 27, 2018

Duplicate of #675.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants