Beef icon indicating copy to clipboard operation
Beef copied to clipboard

[Bug] int? causes issues with overloading

Open farism opened this issue 3 years ago • 0 comments

using System;

namespace TryBeef;

class Program {
	public static void Main(String[] args) {
		void fn(int? a) {
			Console.WriteLine("int");
		}

		void fn(float a) {
			Console.WriteLine("float");
		}
		
		void fn(String a) {
			Console.WriteLine("str");
		}
		
		fn((int)1); // ambiguous with float overload
		
		fn("hello"); // attempts implicit cast from String to int
	}
}

https://trybeef.netlify.app/#/SZnfj1

farism avatar Oct 22 '22 05:10 farism