-
Notifications
You must be signed in to change notification settings - Fork 133
Improve handling of circular and imported class bases #1497
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if all the tests pass then looks fine, tests should handle majority of cases. Make sure to start VS Code as well just in case the multithreading issues come back
@@ -47,14 +47,23 @@ public void DeclareVariable(string name, IMember value, VariableSource source, N | |||
=> DeclareVariable(name, value, source, GetLocationOfName(location), overwrite); | |||
|
|||
public void DeclareVariable(string name, IMember value, VariableSource source, Location location, bool overwrite = true) { | |||
if (source == VariableSource.Import) { | |||
// Duplicate declaration so if variable gets overwritten it can still be retrieved. Consider: | |||
// from X import A |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe update the comment now that it loses its old context:
Store declaration source so in case if variable gets overwritten...
@@ -60,23 +61,19 @@ internal partial class PythonClassType { | |||
/// </summary> | |||
public IPythonType CreateSpecificType(IArgumentSet args) { | |||
lock (_genericParameterLock) { | |||
var genericTypeParameters = GetTypeParameters(); | |||
var newGenericTypeParameters = GetTypeParameters(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newGenericTypeParameters
is not entirely accurate because GetTypeParameters
just gets the parameters that need to be filled in for this class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, passes and VS Code works on my test projects, Cameron's command/variable naming feedback notwithstanding.
* Add test for GPy (fails) * Disambiguate bases * Handle base loops better * GPy test (on ignore) * PT feedback + test * PR feedback * Pass template class * Add declaration position extension * Pass template class * Change eval to scope * Add test for scoped import * Adjust comparison
Fixes #1495
by declaring imported variables in regular collection as well as in special
imported
collection so they can be found when we need to resolve class base.