Skip to content

Commit

Permalink
Update LKG.
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielRosenwasser committed Dec 10, 2018
1 parent 35d26f5 commit d63cc5f
Show file tree
Hide file tree
Showing 6 changed files with 518 additions and 242 deletions.
86 changes: 49 additions & 37 deletions lib/tsc.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
var ts;
(function (ts) {
ts.versionMajorMinor = "3.2";
ts.version = ts.versionMajorMinor + ".2";
ts.version = ts.versionMajorMinor + ".3";
})(ts || (ts = {}));
(function (ts) {
ts.emptyArray = [];
Expand Down Expand Up @@ -26268,7 +26268,8 @@ var ts;
}
}
if (result && isInExternalModule && (meaning & 67220415) === 67220415 && !(originalLocation.flags & 2097152)) {
if (ts.some(result.declarations, function (d) { return ts.isNamespaceExportDeclaration(d) || ts.isSourceFile(d) && !!d.symbol.globalExports; })) {
var merged = getMergedSymbol(result);
if (ts.length(merged.declarations) && ts.every(merged.declarations, function (d) { return ts.isNamespaceExportDeclaration(d) || ts.isSourceFile(d) && !!d.symbol.globalExports; })) {
error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, ts.unescapeLeadingUnderscores(name));
}
}
Expand Down Expand Up @@ -29350,12 +29351,11 @@ var ts;
if (ts.isCatchClauseVariableDeclarationOrBindingElement(declaration)) {
return anyType;
}
if (ts.isSourceFile(declaration)) {
var jsonSourceFile = ts.cast(declaration, ts.isJsonSourceFile);
if (!jsonSourceFile.statements.length) {
if (ts.isSourceFile(declaration) && ts.isJsonSourceFile(declaration)) {
if (!declaration.statements.length) {
return emptyObjectType;
}
var type_1 = getWidenedLiteralType(checkExpression(jsonSourceFile.statements[0].expression));
var type_1 = getWidenedLiteralType(checkExpression(declaration.statements[0].expression));
if (type_1.flags & 524288) {
return getRegularTypeOfObjectLiteral(type_1);
}
Expand All @@ -29378,7 +29378,8 @@ var ts;
|| ts.isClassDeclaration(declaration)
|| ts.isFunctionDeclaration(declaration)
|| (ts.isMethodDeclaration(declaration) && !ts.isObjectLiteralMethod(declaration))
|| ts.isMethodSignature(declaration)) {
|| ts.isMethodSignature(declaration)
|| ts.isSourceFile(declaration)) {
if (symbol.flags & (16 | 8192 | 32 | 384 | 512)) {
return getTypeOfFuncClassEnumModule(symbol);
}
Expand Down Expand Up @@ -32989,23 +32990,23 @@ var ts;
if (checkType === wildcardType || extendsType === wildcardType) {
return wildcardType;
}
var isDeferred = root.isDistributive && maybeTypeOfKind(checkType, 63176704);
var checkTypeInstantiable = maybeTypeOfKind(checkType, 63176704);
var combinedMapper;
if (root.inferTypeParameters) {
var context = createInferenceContext(root.inferTypeParameters, undefined, 0);
if (!isDeferred) {
if (!checkTypeInstantiable) {
inferTypes(context.inferences, checkType, extendsType, 32 | 64);
}
combinedMapper = combineTypeMappers(mapper, context);
}
if (!isDeferred) {
if (extendsType.flags & 3) {
var inferredExtendsType = combinedMapper ? instantiateType(root.extendsType, combinedMapper) : extendsType;
if (!checkTypeInstantiable && !maybeTypeOfKind(inferredExtendsType, 63176704)) {
if (inferredExtendsType.flags & 3) {
return instantiateType(root.trueType, mapper);
}
if (checkType.flags & 1) {
return getUnionType([instantiateType(root.trueType, combinedMapper || mapper), instantiateType(root.falseType, mapper)]);
}
var inferredExtendsType = combinedMapper ? instantiateType(root.extendsType, combinedMapper) : extendsType;
if (!isTypeAssignableTo(getWildcardInstantiation(checkType), getWildcardInstantiation(inferredExtendsType))) {
return instantiateType(root.falseType, mapper);
}
Expand Down Expand Up @@ -34694,7 +34695,7 @@ var ts;
if (!noImplicitAny && ts.getObjectFlags(target) & 16384) {
return false;
}
if (maybeTypeOfKind(target, 524288) && !(ts.getObjectFlags(target) & 512)) {
if (isExcessPropertyCheckTarget(target)) {
var isComparingJsxAttributes = !!(ts.getObjectFlags(source) & 4096);
if ((relation === assignableRelation || relation === definitelyAssignableRelation || relation === comparableRelation) &&
(isTypeSubsetOf(globalObjectType, target) || (!isComparingJsxAttributes && isEmptyObjectType(target)))) {
Expand All @@ -34706,10 +34707,11 @@ var ts;
var _loop_6 = function (prop) {
if (shouldCheckAsExcessProperty(prop, source.symbol) && !isKnownProperty(target, prop.escapedName, isComparingJsxAttributes)) {
if (reportErrors) {
var errorTarget = filterType(target, isExcessPropertyCheckTarget);
if (!errorNode)
return { value: ts.Debug.fail() };
if (ts.isJsxAttributes(errorNode) || ts.isJsxOpeningLikeElement(errorNode) || ts.isJsxOpeningLikeElement(errorNode.parent)) {
reportError(ts.Diagnostics.Property_0_does_not_exist_on_type_1, symbolToString(prop), typeToString(target));
reportError(ts.Diagnostics.Property_0_does_not_exist_on_type_1, symbolToString(prop), typeToString(errorTarget));
}
else {
var objectLiteralDeclaration_1 = source.symbol && ts.firstOrUndefined(source.symbol.declarations);
Expand All @@ -34720,14 +34722,14 @@ var ts;
errorNode = propDeclaration;
var name = propDeclaration.name;
if (ts.isIdentifier(name)) {
suggestion = getSuggestionForNonexistentProperty(name, target);
suggestion = getSuggestionForNonexistentProperty(name, errorTarget);
}
}
if (suggestion !== undefined) {
reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_but_0_does_not_exist_in_type_1_Did_you_mean_to_write_2, symbolToString(prop), typeToString(target), suggestion);
reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_but_0_does_not_exist_in_type_1_Did_you_mean_to_write_2, symbolToString(prop), typeToString(errorTarget), suggestion);
}
else {
reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(target));
reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(errorTarget));
}
}
}
Expand Down Expand Up @@ -37005,17 +37007,15 @@ var ts;
getAccessedPropertyName(source) === getAccessedPropertyName(target) &&
isMatchingReference(source.expression, target.expression);
case 186:
if (target.kind !== 189)
return false;
var t = target;
if (t.name.escapedText !== getBindingElementNameText(source))
return false;
if (source.parent.parent.kind === 186 && isMatchingReference(source.parent.parent, t.expression)) {
return true;
}
if (source.parent.parent.kind === 237) {
var maybeId = source.parent.parent.initializer;
return !!maybeId && isMatchingReference(maybeId, t.expression);
if (target.kind === 189 && target.name.escapedText === getBindingElementNameText(source)) {
var ancestor = source.parent.parent;
if (ancestor.kind === 186) {
return isMatchingReference(ancestor, target.expression);
}
if (ancestor.kind === 237) {
var initializer = ancestor.initializer;
return !!initializer && isMatchingReference(initializer, target.expression);
}
}
}
return false;
Expand All @@ -37025,14 +37025,24 @@ var ts;
ts.isStringLiteral(access.argumentExpression) || ts.isNumericLiteral(access.argumentExpression) ? ts.escapeLeadingUnderscores(access.argumentExpression.text) :
undefined;
}
function getReferenceParent(source) {
if (source.kind === 189) {
return source.expression;
}
if (source.kind === 186) {
var ancestor = source.parent.parent;
return ancestor.kind === 237 ? ancestor.initializer : ancestor;
}
return undefined;
}
function containsMatchingReference(source, target) {
while (source.kind === 189) {
source = source.expression;
if (isMatchingReference(source, target)) {
var parent = getReferenceParent(source);
while (parent) {
if (isMatchingReference(parent, target)) {
return true;
}
parent = getReferenceParent(parent);
}
return false;
}
function containsMatchingReferenceDiscriminant(source, target) {
return target.kind === 189 &&
Expand Down Expand Up @@ -40059,20 +40069,22 @@ var ts;
return true;
}
}
else if (targetType.flags & 3145728) {
else if (targetType.flags & 3145728 && isExcessPropertyCheckTarget(targetType)) {
for (var _i = 0, _a = targetType.types; _i < _a.length; _i++) {
var t = _a[_i];
if (isKnownProperty(t, name, isComparingJsxAttributes)) {
return true;
}
}
}
else if (targetType.flags & 16777216) {
return isKnownProperty(targetType.root.trueType, name, isComparingJsxAttributes) ||
isKnownProperty(targetType.root.falseType, name, isComparingJsxAttributes);
}
return false;
}
function isExcessPropertyCheckTarget(type) {
return !!(type.flags & 524288 && !(ts.getObjectFlags(type) & 512) ||
type.flags & 67108864 ||
type.flags & 1048576 && ts.some(type.types, isExcessPropertyCheckTarget) ||
type.flags & 2097152 && ts.every(type.types, isExcessPropertyCheckTarget));
}
function checkJsxExpression(node, checkMode) {
if (node.expression) {
var type = checkExpression(node.expression, checkMode);
Expand Down
Loading

0 comments on commit d63cc5f

Please sign in to comment.