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

Clean up type system #439

Merged
merged 34 commits into from
Dec 5, 2018
Merged

Clean up type system #439

merged 34 commits into from
Dec 5, 2018

Conversation

MikhailArkhipov
Copy link

@MikhailArkhipov MikhailArkhipov commented Nov 29, 2018

Fixes #404

  • Make type derive properly, i.e. IPythonType => IPythonFunction, make module a type, etc.
  • Move class-specific methods to IPythonClass
  • Simplify implementation by using proper base classes like AstPythonTypeWrapper.
  • Reduce type complexity with functions/methods/bounded such as if function has declaring type, it is then a method, etc.
  • Fix couple tests with typings related to protocol derivation.
  • In most cases MemberId is now function of BuiltInTypeId for consistency.
  • Update few tests baselines with changed tooltips/information.

I will wait for #361 to go in first.

@@ -942,19 +945,13 @@ class BankAccount(object):
var analysis = await server.OpenDefaultDocumentAndGetAnalysisAsync(code);

var v0 = analysis.Should().HaveVariable("scanner").WithValueAt<IBuiltinInstanceInfo>(0);
Copy link
Contributor

Choose a reason for hiding this comment

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

you probably don't need this variable anymore.

MikhailArkhipov added 2 commits December 4, 2018 13:24
@@ -141,7 +139,7 @@ public BuiltinInstanceInfo(BuiltinClassInfo klass)
public override IEnumerable<OverloadResult> Overloads {
get {
IAnalysisSet callRes;
if (_klass.GetAllMembers(ProjectState._defaultContext).TryGetValue("__call__", out callRes)) {
if (ClassInfo.GetAllMembers(ProjectState._defaultContext).TryGetValue("__call__", out callRes)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

In TypeId, ClassInfo is checked for null, and here it isn't. Which one is correct?

Copy link
Author

Choose a reason for hiding this comment

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

I checked ctor calls and I don't see how it can be null. And what would be the legal scenario for the null case...

@MikhailArkhipov MikhailArkhipov merged commit b6eb8ff into microsoft:master Dec 5, 2018
@MikhailArkhipov MikhailArkhipov deleted the analysis2 branch December 5, 2018 20:09
jakebailey pushed a commit to jakebailey/python-language-server that referenced this pull request Nov 1, 2019
* Types hierarchy cleanup

* Test fixes, part I

* Restore IPythonBoundFunction

* Fix function instance types

* More fixes

* Fix overload handling

* Fix properties

* Fix type factory

* Remove class built-in type

* Simplify builtins, remove obsolete method

* Fix typeshed merge

* Allow declaring module to be null

* Correct assertion

* Simplify functions/methods

* Fix stub merge tests

* Fix tests

* Baselines

* Null ref

* Build break

* Overrides signatures

* Fix typeinfo tests

* PR feedback

* Better handle overloads

* Build breaks

* Baselines

* PR fix

* PR feedback

* Merge conflict

* Fix microsoft#446

* Fix microsoft#446
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants