diff --git a/Python/Product/Analysis/MemberResult.cs b/Python/Product/Analysis/MemberResult.cs index 94142e55a9..154d17a941 100644 --- a/Python/Product/Analysis/MemberResult.cs +++ b/Python/Product/Analysis/MemberResult.cs @@ -29,7 +29,7 @@ public struct MemberResult { internal MemberResult(string name, IEnumerable vars) { _name = _completion = name; - _vars = () => vars; + _vars = () => vars ?? Empty; _type = null; _type = GetMemberType; } @@ -42,7 +42,7 @@ public MemberResult(string name, PythonMemberType type) { internal MemberResult(string name, string completion, IEnumerable vars, PythonMemberType? type) { _name = name; - _vars = () => vars; + _vars = () => vars ?? Empty; _completion = completion; if (type != null) { _type = () => type.Value; @@ -54,7 +54,8 @@ internal MemberResult(string name, string completion, IEnumerable internal MemberResult(string name, Func> vars, Func type) { _name = _completion = name; - _vars = vars; + Func> empty = () => Empty; + _vars = vars ?? empty; _type = type; } diff --git a/Python/Product/Analysis/ModuleAnalysis.cs b/Python/Product/Analysis/ModuleAnalysis.cs index 9ce84ecb6d..6b0c3eafdf 100644 --- a/Python/Product/Analysis/ModuleAnalysis.cs +++ b/Python/Product/Analysis/ModuleAnalysis.cs @@ -452,7 +452,8 @@ public IEnumerable GetDefinitionTree(SourceLocation location) { .ToList(); } catch (Exception) { // TODO: log exception - return new[] { new MemberResult("Unknown", null) }; + Debug.Fail("Failed to find scope. Bad state in analysis"); + return new[] { new MemberResult("Unknown", new AnalysisValue[] { }) }; } }