Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Commit 82a03de

Browse files
committed
Fixing test failure because of extra call
1 parent 2f014c3 commit 82a03de

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

src/Analysis/Ast/Impl/Analyzer/Evaluation/ExpressionEval.Callables.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ public IMember GetValueFromFunctionType(IPythonFunctionType fn, IPythonInstance
180180

181181
LoadFunctionDependencyModules(fn);
182182

183-
var tmp = instance?.Call(fn.Name, args);
184183
var t = instance?.Call(fn.Name, args) ?? fn.Call(null, fn.Name, args);
185184
if (!t.IsUnknown()) {
186185
return t;

src/Analysis/Ast/Impl/Analyzer/Handlers/WithHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public void HandleWith(WithStatement node) {
3535
// If fetching context from __enter__ failed, annotation in the stub may be using
3636
// type from typing that we haven't specialized yet or there may be an issue in
3737
// the stub itself, such as type or incorrect type. Try using context manager then.
38-
context = context.IsUnknown() ? contextManager: context;
38+
context = context ?? contextManager;
3939
}
4040

4141
if (item.Variable is NameExpression nex && !string.IsNullOrEmpty(nex.Name)) {

src/Analysis/Ast/Impl/Extensions/AnalysisExtensions.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ internal static void SpecializeFunction(this IDocumentAnalysis analysis, string
4444
var f = analysis.GetOrCreateFunction(name);
4545
if (f != null) {
4646
foreach (var o in f.Overloads.OfType<PythonFunctionOverload>()) {
47-
o.SetParameters(parameters);
47+
if(parameters.Count > 0) {
48+
o.SetParameters(parameters);
49+
}
4850
o.SetReturnValueProvider(returnTypeCallback);
4951
}
5052
f.Specialize(dependencies);

src/Analysis/Ast/Impl/Types/ArgumentSet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public ArgumentSet(IPythonFunctionType fn, int overloadIndex, IPythonInstance in
116116
// Some specialized functions have more complicated definitions, so we pass
117117
// parameters to those, TypeVar() is an example, so we allow the latter logic to handle
118118
// argument instatiation. For simple specialized functions, it is enough to handle here.
119-
if (fn.IsSpecialized) {
119+
if (fn.IsSpecialized && overload.Parameters.Count == 0) {
120120
// Specialized functions typically don't have AST definitions.
121121
// We construct the arguments from the call expression. If an argument does not have a name,
122122
// we try using name from the function definition based on the argument's position.

0 commit comments

Comments
 (0)