Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/Analysis/Engine/Impl/PythonAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -596,10 +596,11 @@ internal AnalysisValue GetCached(object key, Func<AnalysisValue> maker) {

internal BuiltinInstanceInfo GetInstance(IPythonType type) => GetBuiltinType(type).Instance;

internal BuiltinClassInfo GetBuiltinType(IPythonType type) =>
(BuiltinClassInfo)GetCached(type,
() => MakeBuiltinType(type)
) ?? ClassInfos[BuiltinTypeId.Object];
internal BuiltinClassInfo GetBuiltinType(IPythonType type)
// Cached value may or may not be a class info. Previous calls to GetAnalysisValueFromObjects
// may have cached a different object for the type. For example, IPythonFunction would cache
// BuiltinFunctionInfo and not BuiltinClassInfo. Therefore, don't use direct cast.
=> GetCached(type, () => MakeBuiltinType(type)) as BuiltinClassInfo ?? MakeBuiltinType(type);

private BuiltinClassInfo MakeBuiltinType(IPythonType type) {
switch (type.TypeId) {
Expand Down