Merge pull request #11374 from Microsoft/port-11368

ports #11398 in release-2.0.5
This commit is contained in:
Vladimir Matveev
2016-10-05 09:49:19 -07:00
committed by GitHub
5 changed files with 23109 additions and 1 deletions

View File

@@ -5386,7 +5386,26 @@ namespace ts {
return false;
}
function removeSubtypes(types: Type[]) {
function isSetOfLiteralsFromSameEnum(types: TypeSet): boolean {
const first = types[0];
if (first.flags & TypeFlags.EnumLiteral) {
const firstEnum = getParentOfSymbol(first.symbol);
for (let i = 1; i < types.length; i++) {
const other = types[i];
if (!(other.flags & TypeFlags.EnumLiteral) || (firstEnum !== getParentOfSymbol(other.symbol))) {
return false;
}
}
return true;
}
return false;
}
function removeSubtypes(types: TypeSet) {
if (types.length === 0 || isSetOfLiteralsFromSameEnum(types)) {
return;
}
let i = types.length;
while (i > 0) {
i--;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff