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

Fix type annotation on overloads - #146

Merged
Mikhail Arkhipov (MikhailArkhipov) merged 7 commits into
microsoft:masterfrom
MikhailArkhipov:overloads
Sep 27, 2018
Merged

Mikhail Arkhipov (MikhailArkhipov) merged 7 commits into
microsoft:masterfrom
MikhailArkhipov:overloads

Conversation

@MikhailArkhipov

@MikhailArkhipov Mikhail Arkhipov (MikhailArkhipov) commented Sep 27, 2018 •

Copy link
Copy Markdown
  • Make type overloads use same way of generating parameter types as tooltip/hover. This way get get proper short types and not something like a:T, int on a generic or a:list[float, float, float], list[float].
  • Return value should not have [ ] around it if it is a single type.
  • If function returns nothing, then display None and not [ ]
  • Prettify documentation with proper spacing
  • Update all TypingModuleDocumentation* tests baselines
string.Join(",", Parameters.Select(p => "{0}{1}:{2}={3}".FormatInvariant(p.Name, p.IsOptional ? "?" : "", p.Type ?? "", p.DefaultValue ?? ""))),
string.Join(",", ReturnType.OrderBy(k => k)),
string.IsNullOrEmpty(Documentation) ? "" : ("'''{0}'''".FormatInvariant(Documentation))
var parameters = string.Join(", ",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do we use this ToString implementation? In serialization?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It actually generates the signature

",
new[] {
"scale:scale(scalar:float=,vector:list[float]=)->[list,list[float]]"
"scale:scale(scalar:float, vector:list[float]) -> list[float]"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So [list,list[float]] is actually merged into list[float]?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Tooltips were correct while signatures were really weird

IBuiltinClassInfo IBuiltinInstanceInfo.ClassInfo => ClassInfo;
public BuiltinClassInfo ClassInfo => _klass;

public override string Name => _klass.Name;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need similar change for InstanceInfo?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't hurt, I'll add them.

return x.Length >= y.Length ? x : y;
}

private IAnalysisSet ChooseBest(IAnalysisSet x, IAnalysisSet y) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dead code?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

@MikhailArkhipov
Mikhail Arkhipov (MikhailArkhipov) merged commit 679d2c2 into microsoft:master Sep 27, 2018
Jake Bailey (jakebailey) pushed a commit to jakebailey/python-language-server that referenced this pull request Nov 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

2 participants