@@ -3886,7 +3886,7 @@ namespace ts {
38863886 if (!links.declaredType) {
38873887 const enumType = <EnumType>getDeclaredTypeOfEnum(getParentOfSymbol(symbol));
38883888 links.declaredType = enumType.flags & TypeFlags.Union ?
3889- enumType.memberTypes[getEnumMemberValue(<EnumDeclaration >symbol.valueDeclaration)] :
3889+ enumType.memberTypes[getEnumMemberValue(<EnumMember >symbol.valueDeclaration)] :
38903890 enumType;
38913891 }
38923892 return links.declaredType;
@@ -6049,7 +6049,7 @@ namespace ts {
60496049 return !node.typeParameters && areAllParametersUntyped && !isNullaryArrow;
60506050 }
60516051
6052- function isContextSensitiveFunctionOrObjectLiteralMethod(func: Node): func is FunctionExpression | MethodDeclaration {
6052+ function isContextSensitiveFunctionOrObjectLiteralMethod(func: Node): func is FunctionExpression | ArrowFunction | MethodDeclaration {
60536053 return (isFunctionExpressionOrArrowFunction(func) || isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func);
60546054 }
60556055
@@ -10022,7 +10022,7 @@ namespace ts {
1002210022 }
1002310023 }
1002410024
10025- function isFunctionExpressionOrArrowFunction(node: Node): node is FunctionExpression {
10025+ function isFunctionExpressionOrArrowFunction(node: Node): node is FunctionExpression | ArrowFunction {
1002610026 return node.kind === SyntaxKind.FunctionExpression || node.kind === SyntaxKind.ArrowFunction;
1002710027 }
1002810028
@@ -10033,7 +10033,7 @@ namespace ts {
1003310033 : undefined;
1003410034 }
1003510035
10036- function getContextualTypeForFunctionLikeDeclaration(node: FunctionExpression | MethodDeclaration) {
10036+ function getContextualTypeForFunctionLikeDeclaration(node: FunctionExpression | ArrowFunction | MethodDeclaration) {
1003710037 return isObjectLiteralMethod(node) ?
1003810038 getContextualTypeForObjectLiteralMethod(node) :
1003910039 getApparentTypeOfContextualType(node);
@@ -10044,7 +10044,7 @@ namespace ts {
1004410044 // If the contextual type is a union type, get the signature from each type possible and if they are
1004510045 // all identical ignoring their return type, the result is same signature but with return type as
1004610046 // union type of return types from these signatures
10047- function getContextualSignature(node: FunctionExpression | MethodDeclaration): Signature {
10047+ function getContextualSignature(node: FunctionExpression | ArrowFunction | MethodDeclaration): Signature {
1004810048 Debug.assert(node.kind !== SyntaxKind.MethodDeclaration || isObjectLiteralMethod(node));
1004910049 const type = getContextualTypeForFunctionLikeDeclaration(node);
1005010050 if (!type) {
@@ -11392,7 +11392,7 @@ namespace ts {
1139211392 argCount = getEffectiveArgumentCount(node, /*args*/ undefined, signature);
1139311393 }
1139411394 else {
11395- const callExpression = <CallExpression>node;
11395+ const callExpression = <CallExpression | NewExpression >node;
1139611396 if (!callExpression.arguments) {
1139711397 // This only happens when we have something of the form: 'new C'
1139811398 Debug.assert(callExpression.kind === SyntaxKind.NewExpression);
@@ -11403,7 +11403,7 @@ namespace ts {
1140311403 argCount = signatureHelpTrailingComma ? args.length + 1 : args.length;
1140411404
1140511405 // If we are missing the close paren, the call is incomplete.
11406- callIsIncomplete = (<CallExpression> callExpression) .arguments.end === callExpression.end;
11406+ callIsIncomplete = callExpression.arguments.end === callExpression.end;
1140711407
1140811408 typeArguments = callExpression.typeArguments;
1140911409 spreadArgIndex = getSpreadArgumentIndex(args);
@@ -12490,7 +12490,7 @@ namespace ts {
1249012490 * @param node The call/new expression to be checked.
1249112491 * @returns On success, the expression's signature's return type. On failure, anyType.
1249212492 */
12493- function checkCallExpression(node: CallExpression): Type {
12493+ function checkCallExpression(node: CallExpression | NewExpression ): Type {
1249412494 // Grammar checking; stop grammar-checking if checkGrammarTypeArguments return true
1249512495 checkGrammarTypeArguments(node, node.typeArguments) || checkGrammarArguments(node, node.arguments);
1249612496
@@ -12945,7 +12945,7 @@ namespace ts {
1294512945 }
1294612946 }
1294712947
12948- if (produceDiagnostics && node.kind !== SyntaxKind.MethodDeclaration && node.kind !== SyntaxKind.MethodSignature ) {
12948+ if (produceDiagnostics && node.kind !== SyntaxKind.MethodDeclaration) {
1294912949 checkCollisionWithCapturedSuperVariable(node, (<FunctionExpression>node).name);
1295012950 checkCollisionWithCapturedThisVariable(node, (<FunctionExpression>node).name);
1295112951 }
@@ -17419,9 +17419,12 @@ namespace ts {
1741917419 }
1742017420 }
1742117421
17422- checkCollisionWithCapturedThisVariable(node, node.name);
17423- checkCollisionWithRequireExportsInGeneratedCode(node, node.name);
17424- checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name);
17422+ if (isIdentifier(node.name)) {
17423+ checkCollisionWithCapturedThisVariable(node, node.name);
17424+ checkCollisionWithRequireExportsInGeneratedCode(node, node.name);
17425+ checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name);
17426+ }
17427+
1742517428 checkExportsOnMergedDeclarations(node);
1742617429 const symbol = getSymbolOfNode(node);
1742717430
@@ -19040,15 +19043,15 @@ namespace ts {
1904019043 return undefined;
1904119044 }
1904219045
19043- function isLiteralConstDeclaration(node: VariableDeclaration): boolean {
19046+ function isLiteralConstDeclaration(node: VariableDeclaration | PropertyDeclaration | PropertySignature | ParameterDeclaration ): boolean {
1904419047 if (isConst(node)) {
1904519048 const type = getTypeOfSymbol(getSymbolOfNode(node));
1904619049 return !!(type.flags & TypeFlags.StringOrNumberLiteral && type.flags & TypeFlags.FreshLiteral);
1904719050 }
1904819051 return false;
1904919052 }
1905019053
19051- function writeLiteralConstValue(node: VariableDeclaration, writer: SymbolWriter) {
19054+ function writeLiteralConstValue(node: VariableDeclaration | PropertyDeclaration | PropertySignature | ParameterDeclaration , writer: SymbolWriter) {
1905219055 const type = getTypeOfSymbol(getSymbolOfNode(node));
1905319056 writer.writeStringLiteral(literalTypeToString(<LiteralType>type));
1905419057 }
@@ -19785,7 +19788,7 @@ namespace ts {
1978519788 checkGrammarForAtLeastOneTypeArgument(node, typeArguments);
1978619789 }
1978719790
19788- function checkGrammarForOmittedArgument(node: CallExpression, args: NodeArray<Expression>): boolean {
19791+ function checkGrammarForOmittedArgument(node: CallExpression | NewExpression , args: NodeArray<Expression>): boolean {
1978919792 if (args) {
1979019793 const sourceFile = getSourceFileOfNode(node);
1979119794 for (const arg of args) {
@@ -19796,7 +19799,7 @@ namespace ts {
1979619799 }
1979719800 }
1979819801
19799- function checkGrammarArguments(node: CallExpression, args: NodeArray<Expression>): boolean {
19802+ function checkGrammarArguments(node: CallExpression | NewExpression , args: NodeArray<Expression>): boolean {
1980019803 return checkGrammarForOmittedArgument(node, args);
1980119804 }
1980219805
@@ -19918,8 +19921,7 @@ namespace ts {
1991819921
1991919922 for (const prop of node.properties) {
1992019923 const name = prop.name;
19921- if (prop.kind === SyntaxKind.OmittedExpression ||
19922- name.kind === SyntaxKind.ComputedPropertyName) {
19924+ if (name.kind === SyntaxKind.ComputedPropertyName) {
1992319925 // If the name is not a ComputedPropertyName, the grammar checking will skip it
1992419926 checkGrammarComputedPropertyName(<ComputedPropertyName>name);
1992519927 }
@@ -19966,7 +19968,7 @@ namespace ts {
1996619968 currentKind = SetAccessor;
1996719969 }
1996819970 else {
19969- Debug.fail("Unexpected syntax kind:" + prop.kind);
19971+ Debug.fail("Unexpected syntax kind:" + (<Node> prop) .kind);
1997019972 }
1997119973
1997219974 const effectiveName = getPropertyNameForPropertyNameNode(name);
0 commit comments