@@ -933,7 +933,14 @@ var ts;
933
933
newLine: _os.EOL,
934
934
useCaseSensitiveFileNames: useCaseSensitiveFileNames,
935
935
write: function (s) {
936
- _fs.writeSync(1, s);
936
+ var buffer = new Buffer(s, 'utf8');
937
+ var offset = 0;
938
+ var toWrite = buffer.length;
939
+ var written = 0;
940
+ while ((written = _fs.writeSync(1, buffer, offset, toWrite)) < toWrite) {
941
+ offset += written;
942
+ toWrite -= written;
943
+ }
937
944
},
938
945
readFile: readFile,
939
946
writeFile: writeFile,
@@ -1401,7 +1408,7 @@ var ts;
1401
1408
Classes_containing_abstract_methods_must_be_marked_abstract: { code: 2514, category: ts.DiagnosticCategory.Error, key: "Classes containing abstract methods must be marked abstract." },
1402
1409
Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: { code: 2515, category: ts.DiagnosticCategory.Error, key: "Non-abstract class '{0}' does not implement inherited abstract member '{1}' from class '{2}'." },
1403
1410
All_declarations_of_an_abstract_method_must_be_consecutive: { code: 2516, category: ts.DiagnosticCategory.Error, key: "All declarations of an abstract method must be consecutive." },
1404
- Constructor_objects_of_abstract_type_cannot_be_assigned_to_constructor_objects_of_non_abstract_type : { code: 2517, category: ts.DiagnosticCategory.Error, key: "Constructor objects of abstract type cannot be assigned to constructor objects of non-abstract type" },
1411
+ Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type : { code: 2517, category: ts.DiagnosticCategory.Error, key: "Cannot assign an abstract constructor type to a non-abstract constructor type. " },
1405
1412
Only_an_ambient_class_can_be_merged_with_an_interface: { code: 2518, category: ts.DiagnosticCategory.Error, key: "Only an ambient class can be merged with an interface." },
1406
1413
Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions: { code: 2520, category: ts.DiagnosticCategory.Error, key: "Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions." },
1407
1414
Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions: { code: 2521, category: ts.DiagnosticCategory.Error, key: "Expression resolves to variable declaration '{0}' that compiler uses to support async functions." },
@@ -9187,7 +9194,8 @@ var ts;
9187
9194
}
9188
9195
else {
9189
9196
node.exportClause = parseNamedImportsOrExports(226);
9190
- if (parseOptional(130)) {
9197
+ if (token === 130 || (token === 8 && !scanner.hasPrecedingLineBreak())) {
9198
+ parseExpected(130);
9191
9199
node.moduleSpecifier = parseModuleSpecifier();
9192
9200
}
9193
9201
}
@@ -13263,7 +13271,7 @@ var ts;
13263
13271
var id = getTypeListId(elementTypes);
13264
13272
var type = tupleTypes[id];
13265
13273
if (!type) {
13266
- type = tupleTypes[id] = createObjectType(8192);
13274
+ type = tupleTypes[id] = createObjectType(8192 | getWideningFlagsOfTypes(elementTypes) );
13267
13275
type.elementTypes = elementTypes;
13268
13276
}
13269
13277
return type;
@@ -14084,10 +14092,29 @@ var ts;
14084
14092
var targetSignatures = getSignaturesOfType(target, kind);
14085
14093
var result = -1;
14086
14094
var saveErrorInfo = errorInfo;
14095
+ var sourceSig = sourceSignatures[0];
14096
+ var targetSig = targetSignatures[0];
14097
+ if (sourceSig && targetSig) {
14098
+ var sourceErasedSignature = getErasedSignature(sourceSig);
14099
+ var targetErasedSignature = getErasedSignature(targetSig);
14100
+ var sourceReturnType = sourceErasedSignature && getReturnTypeOfSignature(sourceErasedSignature);
14101
+ var targetReturnType = targetErasedSignature && getReturnTypeOfSignature(targetErasedSignature);
14102
+ var sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && ts.getDeclarationOfKind(sourceReturnType.symbol, 211);
14103
+ var targetReturnDecl = targetReturnType && targetReturnType.symbol && ts.getDeclarationOfKind(targetReturnType.symbol, 211);
14104
+ var sourceIsAbstract = sourceReturnDecl && sourceReturnDecl.flags & 256;
14105
+ var targetIsAbstract = targetReturnDecl && targetReturnDecl.flags & 256;
14106
+ if (sourceIsAbstract && !targetIsAbstract) {
14107
+ if (reportErrors) {
14108
+ reportError(ts.Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type);
14109
+ }
14110
+ return 0;
14111
+ }
14112
+ }
14087
14113
outer: for (var _i = 0; _i < targetSignatures.length; _i++) {
14088
14114
var t = targetSignatures[_i];
14089
14115
if (!t.hasStringLiterals || target.flags & 262144) {
14090
14116
var localErrors = reportErrors;
14117
+ var checkedAbstractAssignability = false;
14091
14118
for (var _a = 0; _a < sourceSignatures.length; _a++) {
14092
14119
var s = sourceSignatures[_a];
14093
14120
if (!s.hasStringLiterals || source.flags & 262144) {
@@ -14135,12 +14162,12 @@ var ts;
14135
14162
target = getErasedSignature(target);
14136
14163
var result = -1;
14137
14164
for (var i = 0; i < checkCount; i++) {
14138
- var s_1 = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source);
14139
- var t_1 = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target);
14165
+ var s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source);
14166
+ var t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target);
14140
14167
var saveErrorInfo = errorInfo;
14141
- var related = isRelatedTo(s_1, t_1 , reportErrors);
14168
+ var related = isRelatedTo(s, t , reportErrors);
14142
14169
if (!related) {
14143
- related = isRelatedTo(t_1, s_1 , false);
14170
+ related = isRelatedTo(t, s , false);
14144
14171
if (!related) {
14145
14172
if (reportErrors) {
14146
14173
reportError(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, source.parameters[i < sourceMax ? i : sourceMax].name, target.parameters[i < targetMax ? i : targetMax].name);
@@ -14178,11 +14205,11 @@ var ts;
14178
14205
}
14179
14206
return 0;
14180
14207
}
14181
- var t = getReturnTypeOfSignature(target);
14182
- if (t === voidType)
14208
+ var targetReturnType = getReturnTypeOfSignature(target);
14209
+ if (targetReturnType === voidType)
14183
14210
return result;
14184
- var s = getReturnTypeOfSignature(source);
14185
- return result & isRelatedTo(s, t , reportErrors);
14211
+ var sourceReturnType = getReturnTypeOfSignature(source);
14212
+ return result & isRelatedTo(sourceReturnType, targetReturnType , reportErrors);
14186
14213
}
14187
14214
function signaturesIdenticalTo(source, target, kind) {
14188
14215
var sourceSignatures = getSignaturesOfType(source, kind);
@@ -14395,7 +14422,7 @@ var ts;
14395
14422
return !!getPropertyOfType(type, "0");
14396
14423
}
14397
14424
function isTupleType(type) {
14398
- return (type.flags & 8192) && !!type.elementTypes ;
14425
+ return !! (type.flags & 8192);
14399
14426
}
14400
14427
function getWidenedTypeOfObjectLiteral(type) {
14401
14428
var properties = getPropertiesOfObjectType(type);
@@ -14437,36 +14464,46 @@ var ts;
14437
14464
if (isArrayType(type)) {
14438
14465
return createArrayType(getWidenedType(type.typeArguments[0]));
14439
14466
}
14467
+ if (isTupleType(type)) {
14468
+ return createTupleType(ts.map(type.elementTypes, getWidenedType));
14469
+ }
14440
14470
}
14441
14471
return type;
14442
14472
}
14443
14473
function reportWideningErrorsInType(type) {
14474
+ var errorReported = false;
14444
14475
if (type.flags & 16384) {
14445
- var errorReported = false;
14446
- ts.forEach(type.types, function (t) {
14476
+ for ( var _i = 0, _a = type.types; _i < _a.length; _i++) {
14477
+ var t = _a[_i];
14447
14478
if (reportWideningErrorsInType(t)) {
14448
14479
errorReported = true;
14449
14480
}
14450
- });
14451
- return errorReported;
14481
+ }
14452
14482
}
14453
14483
if (isArrayType(type)) {
14454
14484
return reportWideningErrorsInType(type.typeArguments[0]);
14455
14485
}
14486
+ if (isTupleType(type)) {
14487
+ for (var _b = 0, _c = type.elementTypes; _b < _c.length; _b++) {
14488
+ var t = _c[_b];
14489
+ if (reportWideningErrorsInType(t)) {
14490
+ errorReported = true;
14491
+ }
14492
+ }
14493
+ }
14456
14494
if (type.flags & 524288) {
14457
- var errorReported = false;
14458
- ts.forEach(getPropertiesOfObjectType(type), function (p) {
14495
+ for ( var _d = 0, _e = getPropertiesOfObjectType(type); _d < _e.length; _d++) {
14496
+ var p = _e[_d];
14459
14497
var t = getTypeOfSymbol(p);
14460
14498
if (t.flags & 1048576) {
14461
14499
if (!reportWideningErrorsInType(t)) {
14462
14500
error(p.valueDeclaration, ts.Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, p.name, typeToString(getWidenedType(t)));
14463
14501
}
14464
14502
errorReported = true;
14465
14503
}
14466
- });
14467
- return errorReported;
14504
+ }
14468
14505
}
14469
- return false ;
14506
+ return errorReported ;
14470
14507
}
14471
14508
function reportImplicitAnyError(declaration, type) {
14472
14509
var typeAsString = typeToString(getWidenedType(type));
@@ -14614,28 +14651,31 @@ var ts;
14614
14651
inferFromTypes(sourceType, target);
14615
14652
}
14616
14653
}
14617
- else if (source.flags & 80896 && (target.flags & (4096 | 8192) ||
14618
- (target.flags & 65536) && target.symbol && target.symbol.flags & (8192 | 2048 | 32))) {
14619
- if (isInProcess(source, target)) {
14620
- return;
14621
- }
14622
- if (isDeeplyNestedGeneric(source, sourceStack, depth) && isDeeplyNestedGeneric(target, targetStack, depth)) {
14623
- return;
14654
+ else {
14655
+ source = getApparentType(source);
14656
+ if (source.flags & 80896 && (target.flags & (4096 | 8192) ||
14657
+ (target.flags & 65536) && target.symbol && target.symbol.flags & (8192 | 2048 | 32))) {
14658
+ if (isInProcess(source, target)) {
14659
+ return;
14660
+ }
14661
+ if (isDeeplyNestedGeneric(source, sourceStack, depth) && isDeeplyNestedGeneric(target, targetStack, depth)) {
14662
+ return;
14663
+ }
14664
+ if (depth === 0) {
14665
+ sourceStack = [];
14666
+ targetStack = [];
14667
+ }
14668
+ sourceStack[depth] = source;
14669
+ targetStack[depth] = target;
14670
+ depth++;
14671
+ inferFromProperties(source, target);
14672
+ inferFromSignatures(source, target, 0);
14673
+ inferFromSignatures(source, target, 1);
14674
+ inferFromIndexTypes(source, target, 0, 0);
14675
+ inferFromIndexTypes(source, target, 1, 1);
14676
+ inferFromIndexTypes(source, target, 0, 1);
14677
+ depth--;
14624
14678
}
14625
- if (depth === 0) {
14626
- sourceStack = [];
14627
- targetStack = [];
14628
- }
14629
- sourceStack[depth] = source;
14630
- targetStack[depth] = target;
14631
- depth++;
14632
- inferFromProperties(source, target);
14633
- inferFromSignatures(source, target, 0);
14634
- inferFromSignatures(source, target, 1);
14635
- inferFromIndexTypes(source, target, 0, 0);
14636
- inferFromIndexTypes(source, target, 1, 1);
14637
- inferFromIndexTypes(source, target, 0, 1);
14638
- depth--;
14639
14679
}
14640
14680
}
14641
14681
function inferFromProperties(source, target) {
0 commit comments