@@ -164,7 +164,6 @@ namespace ts {
164164 let getGlobalPromiseConstructorLikeType: () => ObjectType;
165165 let getGlobalThenableType: () => ObjectType;
166166
167- let jsxElementClassType: Type;
168167 let deferredNodes: Node[];
169168
170169 const tupleTypes: Map<TupleType> = {};
@@ -3941,10 +3940,6 @@ namespace ts {
39413940 return result;
39423941 }
39433942
3944- function isRestOrOptionalParameter(node: ParameterDeclaration, skipSignatureCheck?: boolean) {
3945- return isRestParameter(node) || isOptionalParameter(node, skipSignatureCheck);
3946- }
3947-
39483943 function isOptionalParameter(node: ParameterDeclaration, skipSignatureCheck?: boolean) {
39493944 if (node.parserContextFlags & ParserContextFlags.JavaScriptFile) {
39503945 if (node.type && node.type.kind === SyntaxKind.JSDocOptionalType) {
@@ -4014,7 +4009,6 @@ namespace ts {
40144009 let minArgumentCount = -1;
40154010 const isJSConstructSignature = isJSDocConstructSignature(declaration);
40164011 let returnType: Type = undefined;
4017- let typePredicate: TypePredicate = undefined;
40184012
40194013 // If this is a JSDoc construct signature, then skip the first parameter in the
40204014 // parameter list. The first parameter represents the return type of the construct
@@ -4049,16 +4043,11 @@ namespace ts {
40494043 minArgumentCount = declaration.parameters.length;
40504044 }
40514045
4052- <<<<<<< HEAD
40534046 if (isJSConstructSignature) {
40544047 minArgumentCount--;
40554048 returnType = getTypeFromTypeNode(declaration.parameters[0].type);
40564049 }
40574050 else if (classType) {
4058- =======
4059- let returnType: Type;
4060- if (classType) {
4061- >>>>>>> upstream/master
40624051 returnType = classType;
40634052 }
40644053 else if (declaration.type) {
@@ -4327,61 +4316,6 @@ namespace ts {
43274316 return type;
43284317 }
43294318
4330- <<<<<<< HEAD
4331- function isTypeParameterReferenceIllegalInConstraint(
4332- typeReferenceNode: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference,
4333- typeParameterSymbol: Symbol): boolean {
4334-
4335- const links = getNodeLinks(typeReferenceNode);
4336- if (links.isIllegalTypeReferenceInConstraint !== undefined) {
4337- return links.isIllegalTypeReferenceInConstraint;
4338- }
4339-
4340- // bubble up to the declaration
4341- let currentNode: Node = typeReferenceNode;
4342- // forEach === exists
4343- while (!forEach(typeParameterSymbol.declarations, d => getTypeParameterOwner(d) === currentNode.parent)) {
4344- currentNode = currentNode.parent;
4345- }
4346- // if last step was made from the type parameter this means that path has started somewhere in constraint which is illegal
4347- links.isIllegalTypeReferenceInConstraint = currentNode.kind === SyntaxKind.TypeParameter;
4348- return links.isIllegalTypeReferenceInConstraint;
4349- }
4350-
4351- function checkTypeParameterHasIllegalReferencesInConstraint(typeParameter: TypeParameterDeclaration): void {
4352- let typeParameterSymbol: Symbol;
4353- function check(n: Node): void {
4354- if (n.kind === SyntaxKind.TypeReference && (<TypeReferenceNode>n).typeName.kind === SyntaxKind.Identifier) {
4355- const links = getNodeLinks(n);
4356- if (links.isIllegalTypeReferenceInConstraint === undefined) {
4357- const symbol = resolveName(typeParameter, (<Identifier>(<TypeReferenceNode>n).typeName).text, SymbolFlags.Type, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined);
4358- if (symbol && (symbol.flags & SymbolFlags.TypeParameter)) {
4359- // TypeScript 1.0 spec (April 2014): 3.4.1
4360- // Type parameters declared in a particular type parameter list
4361- // may not be referenced in constraints in that type parameter list
4362-
4363- // symbol.declaration.parent === typeParameter.parent
4364- // -> typeParameter and symbol.declaration originate from the same type parameter list
4365- // -> illegal for all declarations in symbol
4366- // forEach === exists
4367- links.isIllegalTypeReferenceInConstraint = forEach(symbol.declarations, d => d.parent === typeParameter.parent);
4368- }
4369- }
4370- if (links.isIllegalTypeReferenceInConstraint) {
4371- error(typeParameter, Diagnostics.Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list);
4372- }
4373- }
4374- forEachChild(n, check);
4375- }
4376-
4377- if (typeParameter.constraint) {
4378- typeParameterSymbol = getSymbolOfNode(typeParameter);
4379- check(typeParameter.constraint);
4380- }
4381- }
4382-
4383- =======
4384- >>>>>>> upstream/master
43854319 // Get type from reference to class or interface
43864320 function getTypeFromClassOrInterfaceReference(node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference, symbol: Symbol): Type {
43874321 const type = <InterfaceType>getDeclaredTypeOfSymbol(symbol);
@@ -4428,18 +4362,7 @@ namespace ts {
44284362 }
44294363
44304364 // Get type from reference to named type that cannot be generic (enum or type parameter)
4431- <<<<<<< HEAD
44324365 function getTypeFromNonGenericTypeReference(node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference, symbol: Symbol): Type {
4433- if (symbol.flags & SymbolFlags.TypeParameter && isTypeParameterReferenceIllegalInConstraint(node, symbol)) {
4434- // TypeScript 1.0 spec (April 2014): 3.4.1
4435- // Type parameters declared in a particular type parameter list
4436- // may not be referenced in constraints in that type parameter list
4437- // Implementation: such type references are resolved to 'unknown' type that usually denotes error
4438- return unknownType;
4439- }
4440- =======
4441- function getTypeFromNonGenericTypeReference(node: TypeReferenceNode | ExpressionWithTypeArguments, symbol: Symbol): Type {
4442- >>>>>>> upstream/master
44434366 if (node.typeArguments) {
44444367 error(node, Diagnostics.Type_0_is_not_generic, symbolToString(symbol));
44454368 return unknownType;
@@ -7421,12 +7344,13 @@ namespace ts {
74217344 return container.flags & NodeFlags.Static ? getTypeOfSymbol(symbol) : (<InterfaceType>getDeclaredTypeOfSymbol(symbol)).thisType;
74227345 }
74237346
7424- <<<<<<< HEAD
74257347 if (container.parserContextFlags & ParserContextFlags.JavaScriptFile) {
74267348 const type = getTypeForThisExpressionFromJSDoc(container);
74277349 if (type && type !== unknownType) {
74287350 return type;
7429- =======
7351+ }
7352+ }
7353+
74307354 // If this is a function in a JS file, it might be a class method. Check if it's the RHS
74317355 // of a x.prototype.y = function [name]() { .... }
74327356 if (isInJavaScriptFile(node) && container.kind === SyntaxKind.FunctionExpression) {
@@ -7440,7 +7364,6 @@ namespace ts {
74407364 if (classSymbol && classSymbol.members && (classSymbol.flags & SymbolFlags.Function)) {
74417365 return getInferredClassType(classSymbol);
74427366 }
7443- >>>>>>> upstream/master
74447367 }
74457368 }
74467369
0 commit comments