None derives from object.

This commit is contained in:
Eric Traut 2019-03-17 00:12:36 -07:00
parent 42a19a82c5
commit 017c21dcb1

View File

@ -10,9 +10,9 @@ import * as assert from 'assert';
import { ParameterCategory } from '../parser/parseNodes';
import { Symbol } from './symbol';
import { ClassType, FunctionType, ObjectType,
OverloadedFunctionType, TupleType, Type, TypeCategory, TypeVarType,
UnboundType, UnionType, UnknownType } from './types';
import { ClassType, FunctionType, NoneType,
ObjectType, OverloadedFunctionType, TupleType, Type, TypeCategory,
TypeVarType, UnboundType, UnionType, UnknownType } from './types';
export interface ClassMember {
symbol?: Symbol;
@ -173,6 +173,16 @@ export class TypeUtils {
return true;
}
// None derives from object.
if (srcType instanceof NoneType) {
if (destType instanceof ObjectType) {
let destClassType = destType.getClassType();
if (destClassType.isBuiltIn() && destClassType.getClassName() === 'object') {
return true;
}
}
}
return false;
}