This repository was archived by the owner on Apr 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 133
Improve handling of circular and imported class bases #1497
Merged
Merged
Changes from 6 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
38ca65b
Add test for GPy (fails)
bef7e5d
Disambiguate bases
3e8f788
Handle base loops better
b390c13
Merge master
41344cc
GPy test (on ignore)
44cc5eb
PT feedback + test
5ab9697
PR feedback
a4578c3
Pass template class
e08ff18
Add declaration position extension
e90bffc
Pass template class
2ea4da0
Change eval to scope
09e88d0
Add test for scoped import
ff4c48e
Adjust comparison
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright(c) Microsoft Corporation | ||
// All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the License); you may not use | ||
// this file except in compliance with the License. You may obtain a copy of the | ||
// License at http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS | ||
// OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY | ||
// IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, | ||
// MERCHANTABILITY OR NON-INFRINGEMENT. | ||
// | ||
// See the Apache Version 2.0 License for specific language governing | ||
// permissions and limitations under the License. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Microsoft.Python.Analysis.Types; | ||
using Microsoft.Python.Parsing.Ast; | ||
|
||
namespace Microsoft.Python.Analysis.Values { | ||
internal class EmptyGlobalScope : IGlobalScope { | ||
public EmptyGlobalScope(IPythonModule module) { | ||
GlobalScope = this; | ||
Module = module; | ||
} | ||
|
||
public IPythonModule Module { get; } | ||
public string Name => string.Empty; | ||
public ScopeStatement Node => Module.Analysis.Ast; | ||
public IScope OuterScope => null; | ||
public IGlobalScope GlobalScope { get; } | ||
public IReadOnlyList<IScope> Children => Array.Empty<IScope>(); | ||
public IEnumerable<IScope> EnumerateTowardsGlobal => Enumerable.Repeat(this, 1); | ||
public IEnumerable<IScope> EnumerateFromGlobal => Enumerable.Repeat(this, 1); | ||
public IVariableCollection Variables => VariableCollection.Empty; | ||
public IVariableCollection NonLocals => VariableCollection.Empty; | ||
public IVariableCollection Globals => VariableCollection.Empty; | ||
public IVariableCollection Imported => VariableCollection.Empty; | ||
|
||
public void DeclareVariable(string name, IMember value, VariableSource source, Location location) { } | ||
public void LinkVariable(string name, IVariable v, Location location) { } | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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...