dotnet/roslyn
在 GitHub 查看"Unassigned local" error for reference to "out var" in lambda with error parameter
Open
#17,225 建立於 2017年2月17日
Area-CompilersBugConcept-Diagnostic Clarityhelp wanted
描述
Reports CS0165 for z > 0:
using System;
class C
{
static void Main()
{
G((x, y) => y > 0 && F(out var z) && z > 0);
}
static bool F(out int i)
{
i = 0;
return true;
}
static void G(Func<int, bool> f, object o) { }
static void G(Func<int, bool> f, object x, object y) { }
}
(6,9): error CS1501: No overload for method 'G' takes 1 arguments
(6,46): error CS0165: Use of unassigned local variable 'z'