Beef icon indicating copy to clipboard operation
Beef copied to clipboard

Order of methods can cause errors

Open disarray2077 opened this issue 2 years ago • 0 comments

The code below doesn't compile, but it compiles fine if you swap the Test method overloads.

static String[?] ars = .("1", "2");

public static void Test<TEnum, TSource, TPredicate>(this TEnum items, TPredicate predicate)
	where TEnum : concrete, IEnumerator<TSource>
	where TPredicate : delegate bool(TSource)
{

}

public static void Test<TEnum, TSource, TPredicate>(this TEnum items, TPredicate predicate)
	where TEnum : concrete, IEnumerable<TSource>
	where TPredicate : delegate bool(TSource)
{

}

public static void Main()
{
	ars.Test((i) => i != null);
}

Tested with: https://github.com/beefytech/Beef/commit/d3ca45d80abf49193709e9627646451d9aac0cbc

disarray2077 avatar May 02 '23 00:05 disarray2077