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

Commit 28ce8e3

Browse files
author
MikhailArkhipov
committed
Fix null ref on bases due to new AnyStr behavior
1 parent b923349 commit 28ce8e3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Analysis/Ast/Impl/Types/PythonClassType.Generics.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ ICollection<IPythonType> newBases
205205
}
206206

207207
// Don't add generic type parameters to bases
208-
if (!(arg.Value is IGenericTypeParameter) && arg.Value is IMember member && !member.GetPythonType().IsUnknown()) {
208+
if (_bases != null && !(arg.Value is IGenericTypeParameter) && arg.Value is IMember member && !member.GetPythonType().IsUnknown()) {
209209
var type = member.GetPythonType();
210210
// Type may be a specific type created off generic or just a type
211211
// for the copy constructor. Consider 'class A(Generic[K, V], Mapping[K, V])'

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public IReadOnlyList<IPythonType> Mro {
199199
if (_mro != null) {
200200
return _mro;
201201
}
202-
if (_bases.Count == 0) {
202+
if (_bases == null || _bases.Count == 0) {
203203
return new IPythonType[] { this };
204204
}
205205
_mro = new IPythonType[] { this };

0 commit comments

Comments
 (0)