Merge remote-tracking branch 'origin/master' into pathMappingModuleResolution

This commit is contained in:
vladima
2015-12-11 09:29:20 -08:00
3791 changed files with 23206 additions and 10947 deletions
+13 -1
View File
@@ -1189,7 +1189,8 @@ namespace ts {
case SyntaxKind.ThisType:
seenThisKeyword = true;
return;
case SyntaxKind.TypePredicate:
return checkTypePredicate(node as TypePredicateNode);
case SyntaxKind.TypeParameter:
return declareSymbolAndAddToSymbolTable(<Declaration>node, SymbolFlags.TypeParameter, SymbolFlags.TypeParameterExcludes);
case SyntaxKind.Parameter:
@@ -1275,6 +1276,17 @@ namespace ts {
}
}
function checkTypePredicate(node: TypePredicateNode) {
const { parameterName, type } = node;
if (parameterName && parameterName.kind === SyntaxKind.Identifier) {
checkStrictModeIdentifier(parameterName as Identifier);
}
if (parameterName && parameterName.kind === SyntaxKind.ThisType) {
seenThisKeyword = true;
}
bind(type);
}
function bindSourceFileIfExternalModule() {
setExportContextFlag(file);
if (isExternalModule(file)) {
+336 -232
View File
@@ -124,8 +124,8 @@ namespace ts {
const noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
const anySignature = createSignature(undefined, undefined, emptyArray, anyType, undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false);
const unknownSignature = createSignature(undefined, undefined, emptyArray, unknownType, undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false);
const anySignature = createSignature(undefined, undefined, emptyArray, anyType, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false);
const unknownSignature = createSignature(undefined, undefined, emptyArray, unknownType, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false);
const globals: SymbolTable = {};
@@ -1743,10 +1743,16 @@ namespace ts {
function writeType(type: Type, flags: TypeFormatFlags) {
// Write undefined/null type as any
if (type.flags & TypeFlags.Intrinsic) {
// Special handling for unknown / resolving types, they should show up as any and not unknown or __resolving
writer.writeKeyword(!(globalFlags & TypeFormatFlags.WriteOwnNameForAnyLike) && isTypeAny(type)
? "any"
: (<IntrinsicType>type).intrinsicName);
if (type.flags & TypeFlags.PredicateType) {
buildTypePredicateDisplay(writer, (type as PredicateType).predicate);
buildTypeDisplay((type as PredicateType).predicate.type, writer, enclosingDeclaration, flags, symbolStack);
}
else {
// Special handling for unknown / resolving types, they should show up as any and not unknown or __resolving
writer.writeKeyword(!(globalFlags & TypeFormatFlags.WriteOwnNameForAnyLike) && isTypeAny(type)
? "any"
: (<IntrinsicType>type).intrinsicName);
}
}
else if (type.flags & TypeFlags.ThisType) {
if (inObjectTypeLiteral) {
@@ -2116,6 +2122,18 @@ namespace ts {
writePunctuation(writer, SyntaxKind.CloseParenToken);
}
function buildTypePredicateDisplay(writer: SymbolWriter, predicate: TypePredicate) {
if (isIdentifierTypePredicate(predicate)) {
writer.writeParameter(predicate.parameterName);
}
else {
writeKeyword(writer, SyntaxKind.ThisKeyword);
}
writeSpace(writer);
writeKeyword(writer, SyntaxKind.IsKeyword);
writeSpace(writer);
}
function buildReturnTypeDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, symbolStack?: Symbol[]) {
if (flags & TypeFormatFlags.WriteArrowStyleSignature) {
writeSpace(writer);
@@ -2126,17 +2144,7 @@ namespace ts {
}
writeSpace(writer);
let returnType: Type;
if (signature.typePredicate) {
writer.writeParameter(signature.typePredicate.parameterName);
writeSpace(writer);
writeKeyword(writer, SyntaxKind.IsKeyword);
writeSpace(writer);
returnType = signature.typePredicate.type;
}
else {
returnType = getReturnTypeOfSignature(signature);
}
const returnType = getReturnTypeOfSignature(signature);
buildTypeDisplay(returnType, writer, enclosingDeclaration, flags, symbolStack);
}
@@ -2693,7 +2701,13 @@ namespace ts {
// During a normal type check we'll never get to here with a property assignment (the check of the containing
// object literal uses a different path). We exclude widening only so that language services and type verification
// tools see the actual type.
return declaration.kind !== SyntaxKind.PropertyAssignment ? getWidenedType(type) : type;
if (declaration.kind === SyntaxKind.PropertyAssignment) {
return type;
}
if (type.flags & TypeFlags.PredicateType && (declaration.kind === SyntaxKind.PropertyDeclaration || declaration.kind === SyntaxKind.PropertySignature)) {
return type;
}
return getWidenedType(type);
}
// Rest parameters default to type any[], other parameters default to type any
@@ -3427,13 +3441,12 @@ namespace ts {
}
function createSignature(declaration: SignatureDeclaration, typeParameters: TypeParameter[], parameters: Symbol[],
resolvedReturnType: Type, typePredicate: TypePredicate, minArgumentCount: number, hasRestParameter: boolean, hasStringLiterals: boolean): Signature {
resolvedReturnType: Type, minArgumentCount: number, hasRestParameter: boolean, hasStringLiterals: boolean): Signature {
const sig = new Signature(checker);
sig.declaration = declaration;
sig.typeParameters = typeParameters;
sig.parameters = parameters;
sig.resolvedReturnType = resolvedReturnType;
sig.typePredicate = typePredicate;
sig.minArgumentCount = minArgumentCount;
sig.hasRestParameter = hasRestParameter;
sig.hasStringLiterals = hasStringLiterals;
@@ -3441,7 +3454,7 @@ namespace ts {
}
function cloneSignature(sig: Signature): Signature {
return createSignature(sig.declaration, sig.typeParameters, sig.parameters, sig.resolvedReturnType, sig.typePredicate,
return createSignature(sig.declaration, sig.typeParameters, sig.parameters, sig.resolvedReturnType,
sig.minArgumentCount, sig.hasRestParameter, sig.hasStringLiterals);
}
@@ -3449,7 +3462,7 @@ namespace ts {
const baseConstructorType = getBaseConstructorTypeOfClass(classType);
const baseSignatures = getSignaturesOfType(baseConstructorType, SignatureKind.Construct);
if (baseSignatures.length === 0) {
return [createSignature(undefined, classType.localTypeParameters, emptyArray, classType, undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false)];
return [createSignature(undefined, classType.localTypeParameters, emptyArray, classType, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false)];
}
const baseTypeNode = getBaseTypeNodeOfClass(classType);
const typeArguments = map(baseTypeNode.typeArguments, getTypeFromTypeNode);
@@ -3915,6 +3928,24 @@ namespace ts {
return false;
}
function createTypePredicateFromTypePredicateNode(node: TypePredicateNode): IdentifierTypePredicate | ThisTypePredicate {
if (node.parameterName.kind === SyntaxKind.Identifier) {
const parameterName = node.parameterName as Identifier;
return {
kind: TypePredicateKind.Identifier,
parameterName: parameterName ? parameterName.text : undefined,
parameterIndex: parameterName ? getTypePredicateParameterIndex((node.parent as SignatureDeclaration).parameters, parameterName) : undefined,
type: getTypeFromTypeNode(node.type)
} as IdentifierTypePredicate;
}
else {
return {
kind: TypePredicateKind.This,
type: getTypeFromTypeNode(node.type)
} as ThisTypePredicate;
}
}
function getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature {
const links = getNodeLinks(declaration);
if (!links.resolvedSignature) {
@@ -3955,20 +3986,11 @@ namespace ts {
}
let returnType: Type;
let typePredicate: TypePredicate;
if (classType) {
returnType = classType;
}
else if (declaration.type) {
returnType = getTypeFromTypeNode(declaration.type);
if (declaration.type.kind === SyntaxKind.TypePredicate) {
const typePredicateNode = <TypePredicateNode>declaration.type;
typePredicate = {
parameterName: typePredicateNode.parameterName ? typePredicateNode.parameterName.text : undefined,
parameterIndex: typePredicateNode.parameterName ? getTypePredicateParameterIndex(declaration.parameters, typePredicateNode.parameterName) : undefined,
type: getTypeFromTypeNode(typePredicateNode.type)
};
}
}
else {
// TypeScript 1.0 spec (April 2014):
@@ -3983,8 +4005,7 @@ namespace ts {
}
}
links.resolvedSignature = createSignature(declaration, typeParameters, parameters, returnType, typePredicate,
minArgumentCount, hasRestParameter(declaration), hasStringLiterals);
links.resolvedSignature = createSignature(declaration, typeParameters, parameters, returnType, minArgumentCount, hasRestParameter(declaration), hasStringLiterals);
}
return links.resolvedSignature;
}
@@ -4141,17 +4162,40 @@ namespace ts {
: undefined;
}
function getConstraintOfTypeParameter(type: TypeParameter): Type {
if (!type.constraint) {
if (type.target) {
const targetConstraint = getConstraintOfTypeParameter(type.target);
type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType;
function getConstraintDeclaration(type: TypeParameter) {
return (<TypeParameterDeclaration>getDeclarationOfKind(type.symbol, SyntaxKind.TypeParameter)).constraint;
}
function hasConstraintReferenceTo(type: Type, target: TypeParameter): boolean {
let checked: Type[];
while (type && type.flags & TypeFlags.TypeParameter && !contains(checked, type)) {
if (type === target) {
return true;
}
(checked || (checked = [])).push(type);
const constraintDeclaration = getConstraintDeclaration(<TypeParameter>type);
type = constraintDeclaration && getTypeFromTypeNode(constraintDeclaration);
}
return false;
}
function getConstraintOfTypeParameter(typeParameter: TypeParameter): Type {
if (!typeParameter.constraint) {
if (typeParameter.target) {
const targetConstraint = getConstraintOfTypeParameter(typeParameter.target);
typeParameter.constraint = targetConstraint ? instantiateType(targetConstraint, typeParameter.mapper) : noConstraintType;
}
else {
type.constraint = getTypeFromTypeNode((<TypeParameterDeclaration>getDeclarationOfKind(type.symbol, SyntaxKind.TypeParameter)).constraint);
const constraintDeclaration = getConstraintDeclaration(typeParameter);
let constraint = getTypeFromTypeNode(constraintDeclaration);
if (hasConstraintReferenceTo(constraint, typeParameter)) {
error(constraintDeclaration, Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(typeParameter));
constraint = unknownType;
}
typeParameter.constraint = constraint;
}
}
return type.constraint === noConstraintType ? undefined : type.constraint;
return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint;
}
function getParentSymbolOfTypeParameter(typeParameter: TypeParameter): Symbol {
@@ -4203,55 +4247,6 @@ namespace ts {
return type;
}
function isTypeParameterReferenceIllegalInConstraint(typeReferenceNode: TypeReferenceNode | ExpressionWithTypeArguments, typeParameterSymbol: Symbol): boolean {
const links = getNodeLinks(typeReferenceNode);
if (links.isIllegalTypeReferenceInConstraint !== undefined) {
return links.isIllegalTypeReferenceInConstraint;
}
// bubble up to the declaration
let currentNode: Node = typeReferenceNode;
// forEach === exists
while (!forEach(typeParameterSymbol.declarations, d => d.parent === currentNode.parent)) {
currentNode = currentNode.parent;
}
// if last step was made from the type parameter this means that path has started somewhere in constraint which is illegal
links.isIllegalTypeReferenceInConstraint = currentNode.kind === SyntaxKind.TypeParameter;
return links.isIllegalTypeReferenceInConstraint;
}
function checkTypeParameterHasIllegalReferencesInConstraint(typeParameter: TypeParameterDeclaration): void {
let typeParameterSymbol: Symbol;
function check(n: Node): void {
if (n.kind === SyntaxKind.TypeReference && (<TypeReferenceNode>n).typeName.kind === SyntaxKind.Identifier) {
const links = getNodeLinks(n);
if (links.isIllegalTypeReferenceInConstraint === undefined) {
const symbol = resolveName(typeParameter, (<Identifier>(<TypeReferenceNode>n).typeName).text, SymbolFlags.Type, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined);
if (symbol && (symbol.flags & SymbolFlags.TypeParameter)) {
// TypeScript 1.0 spec (April 2014): 3.4.1
// Type parameters declared in a particular type parameter list
// may not be referenced in constraints in that type parameter list
// symbol.declaration.parent === typeParameter.parent
// -> typeParameter and symbol.declaration originate from the same type parameter list
// -> illegal for all declarations in symbol
// forEach === exists
links.isIllegalTypeReferenceInConstraint = forEach(symbol.declarations, d => d.parent === typeParameter.parent);
}
}
if (links.isIllegalTypeReferenceInConstraint) {
error(typeParameter, Diagnostics.Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list);
}
}
forEachChild(n, check);
}
if (typeParameter.constraint) {
typeParameterSymbol = getSymbolOfNode(typeParameter);
check(typeParameter.constraint);
}
}
// Get type from reference to class or interface
function getTypeFromClassOrInterfaceReference(node: TypeReferenceNode | ExpressionWithTypeArguments, symbol: Symbol): Type {
const type = <InterfaceType>getDeclaredTypeOfSymbol(symbol);
@@ -4298,13 +4293,6 @@ namespace ts {
// Get type from reference to named type that cannot be generic (enum or type parameter)
function getTypeFromNonGenericTypeReference(node: TypeReferenceNode | ExpressionWithTypeArguments, symbol: Symbol): Type {
if (symbol.flags & SymbolFlags.TypeParameter && isTypeParameterReferenceIllegalInConstraint(node, symbol)) {
// TypeScript 1.0 spec (April 2014): 3.4.1
// Type parameters declared in a particular type parameter list
// may not be referenced in constraints in that type parameter list
// Implementation: such type references are resolved to 'unknown' type that usually denotes error
return unknownType;
}
if (node.typeArguments) {
error(node, Diagnostics.Type_0_is_not_generic, symbolToString(symbol));
return unknownType;
@@ -4643,6 +4631,25 @@ namespace ts {
return links.resolvedType;
}
function getPredicateType(node: TypePredicateNode): Type {
return createPredicateType(getSymbolOfNode(node), createTypePredicateFromTypePredicateNode(node));
}
function createPredicateType(symbol: Symbol, predicate: ThisTypePredicate | IdentifierTypePredicate) {
const type = createType(TypeFlags.Boolean | TypeFlags.PredicateType) as PredicateType;
type.symbol = symbol;
type.predicate = predicate;
return type;
}
function getTypeFromPredicateTypeNode(node: TypePredicateNode): Type {
const links = getNodeLinks(node);
if (!links.resolvedType) {
links.resolvedType = getPredicateType(node);
}
return links.resolvedType;
}
function getTypeFromTypeNode(node: TypeNode): Type {
switch (node.kind) {
case SyntaxKind.AnyKeyword:
@@ -4664,7 +4671,7 @@ namespace ts {
case SyntaxKind.TypeReference:
return getTypeFromTypeReference(<TypeReferenceNode>node);
case SyntaxKind.TypePredicate:
return booleanType;
return getTypeFromPredicateTypeNode(<TypePredicateNode>node);
case SyntaxKind.ExpressionWithTypeArguments:
return getTypeFromTypeReference(<ExpressionWithTypeArguments>node);
case SyntaxKind.TypeQuery:
@@ -4751,19 +4758,22 @@ namespace ts {
};
}
function createInferenceMapper(context: InferenceContext): TypeMapper {
const mapper: TypeMapper = t => {
for (let i = 0; i < context.typeParameters.length; i++) {
if (t === context.typeParameters[i]) {
context.inferences[i].isFixed = true;
return getInferredType(context, i);
function getInferenceMapper(context: InferenceContext): TypeMapper {
if (!context.mapper) {
const mapper: TypeMapper = t => {
const typeParameters = context.typeParameters;
for (let i = 0; i < typeParameters.length; i++) {
if (t === typeParameters[i]) {
context.inferences[i].isFixed = true;
return getInferredType(context, i);
}
}
}
return t;
};
mapper.context = context;
return mapper;
return t;
};
mapper.context = context;
context.mapper = mapper;
}
return context.mapper;
}
function identityMapper(type: Type): Type {
@@ -4774,37 +4784,45 @@ namespace ts {
return t => instantiateType(mapper1(t), mapper2);
}
function instantiateTypeParameter(typeParameter: TypeParameter, mapper: TypeMapper): TypeParameter {
function cloneTypeParameter(typeParameter: TypeParameter): TypeParameter {
const result = <TypeParameter>createType(TypeFlags.TypeParameter);
result.symbol = typeParameter.symbol;
if (typeParameter.constraint) {
result.constraint = instantiateType(typeParameter.constraint, mapper);
result.target = typeParameter;
return result;
}
function cloneTypePredicate(predicate: TypePredicate, mapper: TypeMapper): ThisTypePredicate | IdentifierTypePredicate {
if (isIdentifierTypePredicate(predicate)) {
return {
kind: TypePredicateKind.Identifier,
parameterName: predicate.parameterName,
parameterIndex: predicate.parameterIndex,
type: instantiateType(predicate.type, mapper)
} as IdentifierTypePredicate;
}
else {
result.target = typeParameter;
result.mapper = mapper;
return {
kind: TypePredicateKind.This,
type: instantiateType(predicate.type, mapper)
} as ThisTypePredicate;
}
return result;
}
function instantiateSignature(signature: Signature, mapper: TypeMapper, eraseTypeParameters?: boolean): Signature {
let freshTypeParameters: TypeParameter[];
let freshTypePredicate: TypePredicate;
if (signature.typeParameters && !eraseTypeParameters) {
freshTypeParameters = instantiateList(signature.typeParameters, mapper, instantiateTypeParameter);
// First create a fresh set of type parameters, then include a mapping from the old to the
// new type parameters in the mapper function. Finally store this mapper in the new type
// parameters such that we can use it when instantiating constraints.
freshTypeParameters = map(signature.typeParameters, cloneTypeParameter);
mapper = combineTypeMappers(createTypeMapper(signature.typeParameters, freshTypeParameters), mapper);
}
if (signature.typePredicate) {
freshTypePredicate = {
parameterName: signature.typePredicate.parameterName,
parameterIndex: signature.typePredicate.parameterIndex,
type: instantiateType(signature.typePredicate.type, mapper)
};
for (const tp of freshTypeParameters) {
tp.mapper = mapper;
}
}
const result = createSignature(signature.declaration, freshTypeParameters,
instantiateList(signature.parameters, mapper, instantiateSymbol),
instantiateType(signature.resolvedReturnType, mapper),
freshTypePredicate,
signature.minArgumentCount, signature.hasRestParameter, signature.hasStringLiterals);
result.target = signature;
result.mapper = mapper;
@@ -4874,6 +4892,10 @@ namespace ts {
if (type.flags & TypeFlags.Intersection) {
return getIntersectionType(instantiateList((<IntersectionType>type).types, mapper, instantiateType));
}
if (type.flags & TypeFlags.PredicateType) {
const predicate = (type as PredicateType).predicate;
return createPredicateType(type.symbol, cloneTypePredicate(predicate, mapper));
}
}
return type;
}
@@ -5045,6 +5067,36 @@ namespace ts {
if (isTypeAny(source)) return Ternary.True;
if (source === numberType && target.flags & TypeFlags.Enum) return Ternary.True;
}
if (source.flags & TypeFlags.Boolean && target.flags & TypeFlags.Boolean) {
if (source.flags & TypeFlags.PredicateType && target.flags & TypeFlags.PredicateType) {
const sourcePredicate = source as PredicateType;
const targetPredicate = target as PredicateType;
if (sourcePredicate.predicate.kind !== targetPredicate.predicate.kind) {
if (reportErrors) {
reportError(Diagnostics.A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard);
reportError(Diagnostics.Type_predicate_0_is_not_assignable_to_1, typeToString(source), typeToString(target));
}
return Ternary.False;
}
if (sourcePredicate.predicate.kind === TypePredicateKind.Identifier) {
const sourceIdentifierPredicate = sourcePredicate.predicate as IdentifierTypePredicate;
const targetIdentifierPredicate = targetPredicate.predicate as IdentifierTypePredicate;
if (sourceIdentifierPredicate.parameterIndex !== targetIdentifierPredicate.parameterIndex) {
if (reportErrors) {
reportError(Diagnostics.Parameter_0_is_not_in_the_same_position_as_parameter_1, sourceIdentifierPredicate.parameterName, targetIdentifierPredicate.parameterName);
reportError(Diagnostics.Type_predicate_0_is_not_assignable_to_1, typeToString(source), typeToString(target));
}
return Ternary.False;
}
}
const related = isRelatedTo(sourcePredicate.predicate.type, targetPredicate.predicate.type, reportErrors, headMessage);
if (related === Ternary.False && reportErrors) {
reportError(Diagnostics.Type_predicate_0_is_not_assignable_to_1, typeToString(source), typeToString(target));
}
return related;
}
return Ternary.True;
}
if (source.flags & TypeFlags.FreshObjectLiteral) {
if (hasExcessProperties(<FreshObjectLiteralType>source, target, reportErrors)) {
@@ -5263,8 +5315,9 @@ namespace ts {
if (sources.length !== targets.length && relation === identityRelation) {
return Ternary.False;
}
const length = sources.length <= targets.length ? sources.length : targets.length;
let result = Ternary.True;
for (let i = 0; i < targets.length; i++) {
for (let i = 0; i < length; i++) {
const related = isRelatedTo(sources[i], targets[i], reportErrors);
if (!related) {
return Ternary.False;
@@ -5279,11 +5332,11 @@ namespace ts {
// Third, check if both types are part of deeply nested chains of generic type instantiations and if so assume the types are
// equal and infinitely expanding. Fourth, if we have reached a depth of 100 nested comparisons, assume we have runaway recursion
// and issue an error. Otherwise, actually compare the structure of the two types.
function objectTypeRelatedTo(apparentSource: Type, originalSource: Type, target: Type, reportErrors: boolean): Ternary {
function objectTypeRelatedTo(source: Type, originalSource: Type, target: Type, reportErrors: boolean): Ternary {
if (overflow) {
return Ternary.False;
}
const id = relation !== identityRelation || apparentSource.id < target.id ? apparentSource.id + "," + target.id : target.id + "," + apparentSource.id;
const id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id;
const related = relation[id];
if (related !== undefined) {
if (elaborateErrors && related === RelationComparisonResult.Failed) {
@@ -5313,28 +5366,28 @@ namespace ts {
maybeStack = [];
expandingFlags = 0;
}
sourceStack[depth] = apparentSource;
sourceStack[depth] = source;
targetStack[depth] = target;
maybeStack[depth] = {};
maybeStack[depth][id] = RelationComparisonResult.Succeeded;
depth++;
const saveExpandingFlags = expandingFlags;
if (!(expandingFlags & 1) && isDeeplyNestedGeneric(apparentSource, sourceStack, depth)) expandingFlags |= 1;
if (!(expandingFlags & 1) && isDeeplyNestedGeneric(source, sourceStack, depth)) expandingFlags |= 1;
if (!(expandingFlags & 2) && isDeeplyNestedGeneric(target, targetStack, depth)) expandingFlags |= 2;
let result: Ternary;
if (expandingFlags === 3) {
result = Ternary.Maybe;
}
else {
result = propertiesRelatedTo(apparentSource, target, reportErrors);
result = propertiesRelatedTo(source, target, reportErrors);
if (result) {
result &= signaturesRelatedTo(apparentSource, target, SignatureKind.Call, reportErrors);
result &= signaturesRelatedTo(source, target, SignatureKind.Call, reportErrors);
if (result) {
result &= signaturesRelatedTo(apparentSource, target, SignatureKind.Construct, reportErrors);
result &= signaturesRelatedTo(source, target, SignatureKind.Construct, reportErrors);
if (result) {
result &= stringIndexTypesRelatedTo(apparentSource, originalSource, target, reportErrors);
result &= stringIndexTypesRelatedTo(source, originalSource, target, reportErrors);
if (result) {
result &= numberIndexTypesRelatedTo(apparentSource, originalSource, target, reportErrors);
result &= numberIndexTypesRelatedTo(source, originalSource, target, reportErrors);
}
}
}
@@ -5610,46 +5663,19 @@ namespace ts {
result &= related;
}
if (source.typePredicate && target.typePredicate) {
const hasDifferentParameterIndex = source.typePredicate.parameterIndex !== target.typePredicate.parameterIndex;
let hasDifferentTypes: boolean;
if (hasDifferentParameterIndex ||
(hasDifferentTypes = !isTypeIdenticalTo(source.typePredicate.type, target.typePredicate.type))) {
const targetReturnType = getReturnTypeOfSignature(target);
if (targetReturnType === voidType) return result;
const sourceReturnType = getReturnTypeOfSignature(source);
// The follow block preserves old behavior forbidding boolean returning functions from being assignable to type guard returning functions
if (targetReturnType.flags & TypeFlags.PredicateType && (targetReturnType as PredicateType).predicate.kind === TypePredicateKind.Identifier) {
if (!(sourceReturnType.flags & TypeFlags.PredicateType)) {
if (reportErrors) {
const sourceParamText = source.typePredicate.parameterName;
const targetParamText = target.typePredicate.parameterName;
const sourceTypeText = typeToString(source.typePredicate.type);
const targetTypeText = typeToString(target.typePredicate.type);
if (hasDifferentParameterIndex) {
reportError(Diagnostics.Parameter_0_is_not_in_the_same_position_as_parameter_1,
sourceParamText,
targetParamText);
}
else if (hasDifferentTypes) {
reportError(Diagnostics.Type_0_is_not_assignable_to_type_1,
sourceTypeText,
targetTypeText);
}
reportError(Diagnostics.Type_predicate_0_is_not_assignable_to_1,
`${sourceParamText} is ${sourceTypeText}`,
`${targetParamText} is ${targetTypeText}`);
reportError(Diagnostics.Signature_0_must_have_a_type_predicate, signatureToString(source));
}
return Ternary.False;
}
}
else if (!source.typePredicate && target.typePredicate) {
if (reportErrors) {
reportError(Diagnostics.Signature_0_must_have_a_type_predicate, signatureToString(source));
}
return Ternary.False;
}
const targetReturnType = getReturnTypeOfSignature(target);
if (targetReturnType === voidType) return result;
const sourceReturnType = getReturnTypeOfSignature(source);
return result & isRelatedTo(sourceReturnType, targetReturnType, reportErrors);
}
@@ -5986,6 +6012,9 @@ namespace ts {
if (type.flags & (TypeFlags.Undefined | TypeFlags.Null)) {
return anyType;
}
if (type.flags & TypeFlags.PredicateType) {
return booleanType;
}
if (type.flags & TypeFlags.ObjectLiteral) {
return getWidenedTypeOfObjectLiteral(type);
}
@@ -6209,6 +6238,11 @@ namespace ts {
inferFromTypes(sourceTypes[i], targetTypes[i]);
}
}
else if (source.flags & TypeFlags.PredicateType && target.flags & TypeFlags.PredicateType) {
if ((source as PredicateType).predicate.kind === (target as PredicateType).predicate.kind) {
inferFromTypes((source as PredicateType).predicate.type, (target as PredicateType).predicate.type);
}
}
else if (source.flags & TypeFlags.Tuple && target.flags & TypeFlags.Tuple && (<TupleType>source).elementTypes.length === (<TupleType>target).elementTypes.length) {
// If source and target are tuples of the same size, infer from element types
const sourceTypes = (<TupleType>source).elementTypes;
@@ -6304,17 +6338,7 @@ namespace ts {
function inferFromSignature(source: Signature, target: Signature) {
forEachMatchingParameterType(source, target, inferFromTypes);
if (source.typePredicate && target.typePredicate) {
if (target.typePredicate.parameterIndex === source.typePredicate.parameterIndex) {
// Return types from type predicates are treated as booleans. In order to infer types
// from type predicates we would need to infer using the type within the type predicate
// (i.e. 'Foo' from 'x is Foo').
inferFromTypes(source.typePredicate.type, target.typePredicate.type);
}
}
else {
inferFromTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target));
}
inferFromTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target));
}
function inferFromIndexTypes(source: Type, target: Type, sourceKind: IndexKind, targetKind: IndexKind) {
@@ -6375,11 +6399,17 @@ namespace ts {
inferredType = emptyObjectType;
inferenceSucceeded = true;
}
context.inferredTypes[index] = inferredType;
// Only do the constraint check if inference succeeded (to prevent cascading errors)
if (inferenceSucceeded) {
const constraint = getConstraintOfTypeParameter(context.typeParameters[index]);
inferredType = constraint && !isTypeAssignableTo(inferredType, constraint) ? constraint : inferredType;
if (constraint) {
const instantiatedConstraint = instantiateType(constraint, getInferenceMapper(context));
if (!isTypeAssignableTo(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
context.inferredTypes[index] = inferredType = instantiatedConstraint;
}
}
}
else if (context.failedTypeParameterIndex === undefined || context.failedTypeParameterIndex > index) {
// If inference failed, it is necessary to record the index of the failed type parameter (the one we are on).
@@ -6387,7 +6417,6 @@ namespace ts {
// So if this failure is on preceding type parameter, this type parameter is the new failure index.
context.failedTypeParameterIndex = index;
}
context.inferredTypes[index] = inferredType;
}
return inferredType;
}
@@ -6396,7 +6425,6 @@ namespace ts {
for (let i = 0; i < context.inferredTypes.length; i++) {
getInferredType(context, i);
}
return context.inferredTypes;
}
@@ -6453,10 +6481,7 @@ namespace ts {
function isAssignedInBinaryExpression(node: BinaryExpression) {
if (node.operatorToken.kind >= SyntaxKind.FirstAssignment && node.operatorToken.kind <= SyntaxKind.LastAssignment) {
let n = node.left;
while (n.kind === SyntaxKind.ParenthesizedExpression) {
n = (<ParenthesizedExpression>n).expression;
}
const n = skipParenthesizedNodes(node.left);
if (n.kind === SyntaxKind.Identifier && getResolvedSymbol(<Identifier>n) === symbol) {
return true;
}
@@ -6712,20 +6737,20 @@ namespace ts {
}
if (targetType) {
if (!assumeTrue) {
if (type.flags & TypeFlags.Union) {
return getUnionType(filter((<UnionType>type).types, t => !isTypeSubtypeOf(t, targetType)));
}
return type;
}
return getNarrowedType(type, targetType);
return getNarrowedType(type, targetType, assumeTrue);
}
return type;
}
function getNarrowedType(originalType: Type, narrowedTypeCandidate: Type) {
function getNarrowedType(originalType: Type, narrowedTypeCandidate: Type, assumeTrue: boolean) {
if (!assumeTrue) {
if (originalType.flags & TypeFlags.Union) {
return getUnionType(filter((<UnionType>originalType).types, t => !isTypeSubtypeOf(t, narrowedTypeCandidate)));
}
return originalType;
}
// If the current type is a union type, remove all constituents that aren't assignable to target. If that produces
// 0 candidates, fall back to the assignability check
if (originalType.flags & TypeFlags.Union) {
@@ -6748,22 +6773,59 @@ namespace ts {
return type;
}
const signature = getResolvedSignature(expr);
const predicateType = getReturnTypeOfSignature(signature);
if (signature.typePredicate &&
expr.arguments[signature.typePredicate.parameterIndex] &&
getSymbolAtLocation(expr.arguments[signature.typePredicate.parameterIndex]) === symbol) {
if (!assumeTrue) {
if (type.flags & TypeFlags.Union) {
return getUnionType(filter((<UnionType>type).types, t => !isTypeSubtypeOf(t, signature.typePredicate.type)));
}
return type;
if (!predicateType || !(predicateType.flags & TypeFlags.PredicateType)) {
return type;
}
const predicate = (predicateType as PredicateType).predicate;
if (isIdentifierTypePredicate(predicate)) {
const callExpression = expr as CallExpression;
if (callExpression.arguments[predicate.parameterIndex] &&
getSymbolAtTypePredicatePosition(callExpression.arguments[predicate.parameterIndex]) === symbol) {
return getNarrowedType(type, predicate.type, assumeTrue);
}
return getNarrowedType(type, signature.typePredicate.type);
}
else {
const expression = skipParenthesizedNodes(expr.expression);
return narrowTypeByThisTypePredicate(type, predicate, expression, assumeTrue);
}
return type;
}
function narrowTypeByTypePredicateMember(type: Type, expr: ElementAccessExpression | PropertyAccessExpression, assumeTrue: boolean): Type {
if (type.flags & TypeFlags.Any) {
return type;
}
const memberType = getTypeOfExpression(expr);
if (!(memberType.flags & TypeFlags.PredicateType)) {
return type;
}
return narrowTypeByThisTypePredicate(type, (memberType as PredicateType).predicate as ThisTypePredicate, expr, assumeTrue);
}
function narrowTypeByThisTypePredicate(type: Type, predicate: ThisTypePredicate, expression: Expression, assumeTrue: boolean): Type {
if (expression.kind === SyntaxKind.ElementAccessExpression || expression.kind === SyntaxKind.PropertyAccessExpression) {
const accessExpression = expression as ElementAccessExpression | PropertyAccessExpression;
const possibleIdentifier = skipParenthesizedNodes(accessExpression.expression);
if (possibleIdentifier.kind === SyntaxKind.Identifier && getSymbolAtTypePredicatePosition(possibleIdentifier) === symbol) {
return getNarrowedType(type, predicate.type, assumeTrue);
}
}
return type;
}
function getSymbolAtTypePredicatePosition(expr: Expression): Symbol {
expr = skipParenthesizedNodes(expr);
switch (expr.kind) {
case SyntaxKind.Identifier:
case SyntaxKind.PropertyAccessExpression:
case SyntaxKind.QualifiedName:
return getSymbolOfEntityNameOrPropertyAccessExpression(expr as Node as (EntityName | PropertyAccessExpression));
}
}
// Narrow the given type based on the given expression having the assumed boolean value. The returned type
// will be a subtype or the same type as the argument.
function narrowType(type: Type, expr: Expression, assumeTrue: boolean): Type {
@@ -6792,11 +6854,21 @@ namespace ts {
return narrowType(type, (<PrefixUnaryExpression>expr).operand, !assumeTrue);
}
break;
case SyntaxKind.ElementAccessExpression:
case SyntaxKind.PropertyAccessExpression:
return narrowTypeByTypePredicateMember(type, expr as (ElementAccessExpression | PropertyAccessExpression), assumeTrue);
}
return type;
}
}
function skipParenthesizedNodes(expression: Expression): Expression {
while (expression.kind === SyntaxKind.ParenthesizedExpression) {
expression = (expression as ParenthesizedExpression).expression;
}
return expression;
}
function checkIdentifier(node: Identifier): Type {
const symbol = getResolvedSymbol(node);
@@ -8778,7 +8850,7 @@ namespace ts {
function inferTypeArguments(node: CallLikeExpression, signature: Signature, args: Expression[], excludeArgument: boolean[], context: InferenceContext): void {
const typeParameters = signature.typeParameters;
const inferenceMapper = createInferenceMapper(context);
const inferenceMapper = getInferenceMapper(context);
// Clear out all the inference results from the last time inferTypeArguments was called on this context
for (let i = 0; i < typeParameters.length; i++) {
@@ -8844,14 +8916,11 @@ namespace ts {
getInferredTypes(context);
}
function checkTypeArguments(signature: Signature, typeArguments: TypeNode[], typeArgumentResultTypes: Type[], reportErrors: boolean, headMessage?: DiagnosticMessage): boolean {
function checkTypeArguments(signature: Signature, typeArgumentNodes: TypeNode[], typeArgumentTypes: Type[], reportErrors: boolean, headMessage?: DiagnosticMessage): boolean {
const typeParameters = signature.typeParameters;
let typeArgumentsAreAssignable = true;
let mapper: TypeMapper;
for (let i = 0; i < typeParameters.length; i++) {
const typeArgNode = typeArguments[i];
const typeArgument = getTypeFromTypeNode(typeArgNode);
// Do not push on this array! It has a preallocated length
typeArgumentResultTypes[i] = typeArgument;
if (typeArgumentsAreAssignable /* so far */) {
const constraint = getConstraintOfTypeParameter(typeParameters[i]);
if (constraint) {
@@ -8861,17 +8930,19 @@ namespace ts {
errorInfo = chainDiagnosticMessages(errorInfo, typeArgumentHeadMessage);
typeArgumentHeadMessage = headMessage;
}
if (!mapper) {
mapper = createTypeMapper(typeParameters, typeArgumentTypes);
}
const typeArgument = typeArgumentTypes[i];
typeArgumentsAreAssignable = checkTypeAssignableTo(
typeArgument,
constraint,
reportErrors ? typeArgNode : undefined,
getTypeWithThisArgument(instantiateType(constraint, mapper), typeArgument),
reportErrors ? typeArgumentNodes[i] : undefined,
typeArgumentHeadMessage,
errorInfo);
}
}
}
return typeArgumentsAreAssignable;
}
@@ -9327,7 +9398,8 @@ namespace ts {
}
else if (candidateForTypeArgumentError) {
if (!isTaggedTemplate && !isDecorator && typeArguments) {
checkTypeArguments(candidateForTypeArgumentError, (<CallExpression>node).typeArguments, [], /*reportErrors*/ true, headMessage);
const typeArguments = (<CallExpression>node).typeArguments;
checkTypeArguments(candidateForTypeArgumentError, typeArguments, map(typeArguments, getTypeFromTypeNode), /*reportErrors*/ true, headMessage);
}
else {
Debug.assert(resultOfFailedInference.failedTypeParameterIndex >= 0);
@@ -9394,7 +9466,7 @@ namespace ts {
if (candidate.typeParameters) {
let typeArgumentTypes: Type[];
if (typeArguments) {
typeArgumentTypes = new Array<Type>(candidate.typeParameters.length);
typeArgumentTypes = map(typeArguments, getTypeFromTypeNode);
typeArgumentsAreValid = checkTypeArguments(candidate, typeArguments, typeArgumentTypes, /*reportErrors*/ false);
}
else {
@@ -10926,11 +10998,10 @@ namespace ts {
}
checkSourceElement(node.constraint);
getConstraintOfTypeParameter(getDeclaredTypeOfTypeParameter(getSymbolOfNode(node)));
if (produceDiagnostics) {
checkTypeParameterHasIllegalReferencesInConstraint(node);
checkTypeNameIsReserved(node.name, Diagnostics.Type_parameter_name_cannot_be_0);
}
// TODO: Check multiple declarations are identical
}
function checkParameter(node: ParameterDeclaration) {
@@ -10985,7 +11056,7 @@ namespace ts {
return -1;
}
function isInLegalTypePredicatePosition(node: Node): boolean {
function isInLegalParameterTypePredicatePosition(node: Node): boolean {
switch (node.parent.kind) {
case SyntaxKind.ArrowFunction:
case SyntaxKind.CallSignature:
@@ -10999,6 +11070,19 @@ namespace ts {
return false;
}
function isInLegalThisTypePredicatePosition(node: Node): boolean {
if (isInLegalParameterTypePredicatePosition(node)) {
return true;
}
switch (node.parent.kind) {
case SyntaxKind.PropertyDeclaration:
case SyntaxKind.PropertySignature:
case SyntaxKind.GetAccessor:
return node === (node.parent as (PropertyDeclaration | GetAccessorDeclaration | PropertySignature)).type;
}
return false;
}
function checkSignatureDeclaration(node: SignatureDeclaration) {
// Grammar checking
if (node.kind === SyntaxKind.IndexSignature) {
@@ -11017,9 +11101,14 @@ namespace ts {
if (node.type) {
if (node.type.kind === SyntaxKind.TypePredicate) {
const typePredicate = getSignatureFromDeclaration(node).typePredicate;
const typePredicateNode = <TypePredicateNode>node.type;
if (isInLegalTypePredicatePosition(typePredicateNode)) {
const returnType = getReturnTypeOfSignature(getSignatureFromDeclaration(node));
if (!returnType || !(returnType.flags & TypeFlags.PredicateType)) {
return;
}
const typePredicate = (returnType as PredicateType).predicate;
const typePredicateNode = node.type as TypePredicateNode;
checkSourceElement(typePredicateNode);
if (isIdentifierTypePredicate(typePredicate)) {
if (typePredicate.parameterIndex >= 0) {
if (node.parameters[typePredicate.parameterIndex].dotDotDotToken) {
error(typePredicateNode.parameterName,
@@ -11067,10 +11156,6 @@ namespace ts {
}
}
}
else {
error(typePredicateNode,
Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods);
}
}
else {
checkSourceElement(node.type);
@@ -11341,13 +11426,23 @@ namespace ts {
checkDecorators(node);
}
function checkTypeArgumentConstraints(typeParameters: TypeParameter[], typeArguments: TypeNode[]): boolean {
function checkTypeArgumentConstraints(typeParameters: TypeParameter[], typeArgumentNodes: TypeNode[]): boolean {
let typeArguments: Type[];
let mapper: TypeMapper;
let result = true;
for (let i = 0; i < typeParameters.length; i++) {
const constraint = getConstraintOfTypeParameter(typeParameters[i]);
if (constraint) {
if (!typeArguments) {
typeArguments = map(typeArgumentNodes, getTypeFromTypeNode);
mapper = createTypeMapper(typeParameters, typeArguments);
}
const typeArgument = typeArguments[i];
result = result && checkTypeAssignableTo(getTypeFromTypeNode(typeArgument), constraint, typeArgument, Diagnostics.Type_0_does_not_satisfy_the_constraint_1);
result = result && checkTypeAssignableTo(
typeArgument,
getTypeWithThisArgument(instantiateType(constraint, mapper), typeArgument),
typeArgumentNodes[i],
Diagnostics.Type_0_does_not_satisfy_the_constraint_1);
}
}
return result;
@@ -13027,7 +13122,7 @@ namespace ts {
error(node.expression, Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class);
}
}
else if (func.type || isGetAccessorWithAnnotatatedSetAccessor(func) || signature.typePredicate) {
else if (func.type || isGetAccessorWithAnnotatatedSetAccessor(func) || returnType.flags & TypeFlags.PredicateType) {
if (isAsyncFunctionLike(func)) {
const promisedType = getPromisedType(returnType);
const awaitedType = checkAwaitedType(exprType, node.expression, Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member);
@@ -14218,9 +14313,18 @@ namespace ts {
}
function checkTypePredicate(node: TypePredicateNode) {
if (!isInLegalTypePredicatePosition(node)) {
const { parameterName } = node;
if (parameterName.kind === SyntaxKind.Identifier && !isInLegalParameterTypePredicatePosition(node)) {
error(node, Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods);
}
else if (parameterName.kind === SyntaxKind.ThisType) {
if (!isInLegalThisTypePredicatePosition(node)) {
error(node, Diagnostics.A_this_based_type_predicate_is_only_allowed_within_a_class_or_interface_s_members_get_accessors_or_return_type_positions_for_functions_and_methods);
}
else {
getTypeFromThisTypeNode(parameterName as ThisTypeNode);
}
}
}
function checkSourceElement(node: Node): void {
+3 -3
View File
@@ -1309,6 +1309,9 @@ namespace ts {
}
function emitSignatureDeclaration(node: SignatureDeclaration) {
const prevEnclosingDeclaration = enclosingDeclaration;
enclosingDeclaration = node;
// Construct signature or constructor type write new Signature
if (node.kind === SyntaxKind.ConstructSignature || node.kind === SyntaxKind.ConstructorType) {
write("new ");
@@ -1321,9 +1324,6 @@ namespace ts {
write("(");
}
const prevEnclosingDeclaration = enclosingDeclaration;
enclosingDeclaration = node;
// Parameters
emitCommaList(node.parameters, emitParameterDeclaration);
+9 -1
View File
@@ -867,7 +867,7 @@
"category": "Error",
"code": 2312
},
"Constraint of a type parameter cannot reference any type parameter from the same type parameter list.": {
"Type parameter '{0}' has a circular constraint.": {
"category": "Error",
"code": 2313
},
@@ -1647,6 +1647,14 @@
"category": "Error",
"code": 2517
},
"A 'this'-based type guard is not compatible with a parameter-based type guard.": {
"category": "Error",
"code": 2518
},
"A 'this'-based type predicate is only allowed within a class or interface's members, get accessors, or return type positions for functions and methods.": {
"category": "Error",
"code": 2519
},
"Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions.": {
"category": "Error",
"code": 2520
+2 -2
View File
@@ -5260,11 +5260,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
writeLine();
emitToken(SyntaxKind.CloseBraceToken, node.members.end);
emitStart(node);
write(")(");
write("(");
if (baseTypeNode) {
emit(baseTypeNode.expression);
}
write(")");
write("))");
if (node.kind === SyntaxKind.ClassDeclaration) {
write(";");
}
+20 -9
View File
@@ -1963,11 +1963,7 @@ namespace ts {
function parseTypeReferenceOrTypePredicate(): TypeReferenceNode | TypePredicateNode {
const typeName = parseEntityName(/*allowReservedWords*/ false, Diagnostics.Type_expected);
if (typeName.kind === SyntaxKind.Identifier && token === SyntaxKind.IsKeyword && !scanner.hasPrecedingLineBreak()) {
nextToken();
const node = <TypePredicateNode>createNode(SyntaxKind.TypePredicate, typeName.pos);
node.parameterName = <Identifier>typeName;
node.type = parseType();
return finishNode(node);
return parseTypePredicate(typeName as Identifier);
}
const node = <TypeReferenceNode>createNode(SyntaxKind.TypeReference, typeName.pos);
node.typeName = typeName;
@@ -1977,8 +1973,16 @@ namespace ts {
return finishNode(node);
}
function parseThisTypeNode(): TypeNode {
const node = <TypeNode>createNode(SyntaxKind.ThisType);
function parseTypePredicate(lhs: Identifier | ThisTypeNode): TypePredicateNode {
nextToken();
const node = createNode(SyntaxKind.TypePredicate, lhs.pos) as TypePredicateNode;
node.parameterName = lhs;
node.type = parseType();
return finishNode(node);
}
function parseThisTypeNode(): ThisTypeNode {
const node = createNode(SyntaxKind.ThisType) as ThisTypeNode;
nextToken();
return finishNode(node);
}
@@ -2424,8 +2428,15 @@ namespace ts {
return parseStringLiteralTypeNode();
case SyntaxKind.VoidKeyword:
return parseTokenNode<TypeNode>();
case SyntaxKind.ThisKeyword:
return parseThisTypeNode();
case SyntaxKind.ThisKeyword: {
const thisKeyword = parseThisTypeNode();
if (token === SyntaxKind.IsKeyword && !scanner.hasPrecedingLineBreak()) {
return parseTypePredicate(thisKeyword);
}
else {
return thisKeyword;
}
}
case SyntaxKind.TypeOfKeyword:
return parseTypeQuery();
case SyntaxKind.OpenBraceToken:
-5
View File
@@ -411,11 +411,6 @@ namespace ts {
// and is more efficient than `fs.watchFile` (ref: https://github.com/nodejs/node/pull/2649
// and https://github.com/Microsoft/TypeScript/issues/4643), therefore
// if the current node.js version is newer than 4, use `fs.watch` instead.
if (isNode4OrLater()) {
// Note: in node the callback of fs.watch is given only the relative file name as a parameter
return _fs.watch(fileName, (eventName: string, relativeFileName: string) => callback(fileName));
}
const watchedFile = watchedFileSet.addFile(fileName, callback);
return {
close: () => watchedFileSet.removeFile(watchedFile)
+30 -6
View File
@@ -733,11 +733,15 @@ namespace ts {
// @kind(SyntaxKind.StringKeyword)
// @kind(SyntaxKind.SymbolKeyword)
// @kind(SyntaxKind.VoidKeyword)
// @kind(SyntaxKind.ThisType)
export interface TypeNode extends Node {
_typeNodeBrand: any;
}
// @kind(SyntaxKind.ThisType)
export interface ThisTypeNode extends TypeNode {
_thisTypeNodeBrand: any;
}
export interface FunctionOrConstructorTypeNode extends TypeNode, SignatureDeclaration {
_functionOrConstructorTypeNodeBrand: any;
}
@@ -756,7 +760,7 @@ namespace ts {
// @kind(SyntaxKind.TypePredicate)
export interface TypePredicateNode extends TypeNode {
parameterName: Identifier;
parameterName: Identifier | ThisTypeNode;
type: TypeNode;
}
@@ -1820,10 +1824,25 @@ namespace ts {
CannotBeNamed
}
export const enum TypePredicateKind {
This,
Identifier
}
export interface TypePredicate {
kind: TypePredicateKind;
type: Type;
}
// @kind (TypePredicateKind.This)
export interface ThisTypePredicate extends TypePredicate {
_thisTypePredicateBrand: any;
}
// @kind (TypePredicateKind.Identifier)
export interface IdentifierTypePredicate extends TypePredicate {
parameterName: string;
parameterIndex: number;
type: Type;
}
/* @internal */
@@ -2047,7 +2066,6 @@ namespace ts {
resolvedSymbol?: Symbol; // Cached name resolution result
flags?: NodeCheckFlags; // Set of flags specific to Node
enumMemberValue?: number; // Constant value of enum member
isIllegalTypeReferenceInConstraint?: boolean; // Is type reference in constraint refers to the type parameter from the same list
isVisible?: boolean; // Is this node visible
generatedName?: string; // Generated name for module, enum, or import declaration
generatedNames?: Map<string>; // Generated names table for source file
@@ -2091,6 +2109,7 @@ namespace ts {
ESSymbol = 0x01000000, // Type of symbol primitive introduced in ES6
ThisType = 0x02000000, // This type
ObjectLiteralPatternWithComputedProperties = 0x04000000, // Object literal type implied by binding pattern has computed properties
PredicateType = 0x08000000, // Predicate types are also Boolean types, but should not be considered Intrinsics - there's no way to capture this with flags
/* @internal */
Intrinsic = Any | String | Number | Boolean | ESSymbol | Void | Undefined | Null,
@@ -2102,7 +2121,7 @@ namespace ts {
UnionOrIntersection = Union | Intersection,
StructuredType = ObjectType | Union | Intersection,
/* @internal */
RequiresWidening = ContainsUndefinedOrNull | ContainsObjectLiteral,
RequiresWidening = ContainsUndefinedOrNull | ContainsObjectLiteral | PredicateType,
/* @internal */
PropagatingFlags = ContainsUndefinedOrNull | ContainsObjectLiteral | ContainsAnyFunctionType
}
@@ -2123,6 +2142,11 @@ namespace ts {
intrinsicName: string; // Name of intrinsic type
}
// Predicate types (TypeFlags.Predicate)
export interface PredicateType extends Type {
predicate: ThisTypePredicate | IdentifierTypePredicate;
}
// String literal types (TypeFlags.StringLiteral)
export interface StringLiteralType extends Type {
text: string; // Text of string literal
@@ -2239,7 +2263,6 @@ namespace ts {
declaration: SignatureDeclaration; // Originating declaration
typeParameters: TypeParameter[]; // Type parameters (undefined if non-generic)
parameters: Symbol[]; // Parameters
typePredicate?: TypePredicate; // Type predicate
/* @internal */
resolvedReturnType: Type; // Resolved return type
/* @internal */
@@ -2288,6 +2311,7 @@ namespace ts {
inferUnionTypes: boolean; // Infer union types for disjoint candidates (otherwise undefinedType)
inferences: TypeInferences[]; // Inferences made for each type parameter
inferredTypes: Type[]; // Inferred type for each type parameter
mapper?: TypeMapper; // Type mapper for this inference context
failedTypeParameterIndex?: number; // Index of type parameter for which inference failed
// It is optional because in contextual signature instantiation, nothing fails
}
+5
View File
@@ -342,6 +342,7 @@ namespace ts {
case SyntaxKind.EnumMember:
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.FunctionExpression:
case SyntaxKind.MethodDeclaration:
errorNode = (<Declaration>node).name;
break;
}
@@ -692,6 +693,10 @@ namespace ts {
return node && node.kind === SyntaxKind.MethodDeclaration && node.parent.kind === SyntaxKind.ObjectLiteralExpression;
}
export function isIdentifierTypePredicate(predicate: TypePredicate): predicate is IdentifierTypePredicate {
return predicate && predicate.kind === TypePredicateKind.Identifier;
}
export function getContainingFunction(node: Node): FunctionLikeDeclaration {
while (true) {
node = node.parent;
+3 -3
View File
@@ -20,12 +20,12 @@ var Cell = (function () {
function Cell() {
}
return Cell;
})();
}());
var Ship = (function () {
function Ship() {
}
return Ship;
})();
}());
var Board = (function () {
function Board() {
}
@@ -33,4 +33,4 @@ var Board = (function () {
return this.ships.every(function (val) { return val.isSunk; });
};
return Board;
})();
}());
@@ -31,7 +31,7 @@ var A;
this.y = y;
}
return Point;
})();
}());
A.Point = Point;
})(A || (A = {}));
//// [test.js]
@@ -55,7 +55,7 @@ var clodule1 = (function () {
function clodule1() {
}
return clodule1;
})();
}());
var clodule1;
(function (clodule1) {
function f(x) { }
@@ -64,7 +64,7 @@ var clodule2 = (function () {
function clodule2() {
}
return clodule2;
})();
}());
var clodule2;
(function (clodule2) {
var x;
@@ -72,13 +72,13 @@ var clodule2;
function D() {
}
return D;
})();
}());
})(clodule2 || (clodule2 = {}));
var clodule3 = (function () {
function clodule3() {
}
return clodule3;
})();
}());
var clodule3;
(function (clodule3) {
clodule3.y = { id: T };
@@ -87,12 +87,12 @@ var clodule4 = (function () {
function clodule4() {
}
return clodule4;
})();
}());
var clodule4;
(function (clodule4) {
var D = (function () {
function D() {
}
return D;
})();
}());
})(clodule4 || (clodule4 = {}));
@@ -21,7 +21,7 @@ var clodule = (function () {
}
clodule.fn = function (id) { };
return clodule;
})();
}());
var clodule;
(function (clodule) {
// error: duplicate identifier expected
@@ -21,7 +21,7 @@ var clodule = (function () {
}
clodule.fn = function (id) { };
return clodule;
})();
}());
var clodule;
(function (clodule) {
// error: duplicate identifier expected
@@ -21,7 +21,7 @@ var clodule = (function () {
}
clodule.sfn = function (id) { return 42; };
return clodule;
})();
}());
var clodule;
(function (clodule) {
// error: duplicate identifier expected
@@ -30,7 +30,7 @@ var Point = (function () {
}
Point.Origin = function () { return { x: 0, y: 0 }; }; // unexpected error here bug 840246
return Point;
})();
}());
var Point;
(function (Point) {
function Origin() { return null; }
@@ -45,7 +45,7 @@ var A;
}
Point.Origin = function () { return { x: 0, y: 0 }; }; // unexpected error here bug 840246
return Point;
})();
}());
A.Point = Point;
var Point;
(function (Point) {
@@ -30,7 +30,7 @@ var Point = (function () {
}
Point.Origin = function () { return { x: 0, y: 0 }; };
return Point;
})();
}());
var Point;
(function (Point) {
function Origin() { return ""; } // not an error, since not exported
@@ -44,7 +44,7 @@ var A;
}
Point.Origin = function () { return { x: 0, y: 0 }; };
return Point;
})();
}());
A.Point = Point;
var Point;
(function (Point) {
@@ -30,7 +30,7 @@ var Point = (function () {
}
Point.Origin = { x: 0, y: 0 };
return Point;
})();
}());
var Point;
(function (Point) {
Point.Origin = ""; //expected duplicate identifier error
@@ -44,7 +44,7 @@ var A;
}
Point.Origin = { x: 0, y: 0 };
return Point;
})();
}());
A.Point = Point;
var Point;
(function (Point) {
@@ -30,7 +30,7 @@ var Point = (function () {
}
Point.Origin = { x: 0, y: 0 };
return Point;
})();
}());
var Point;
(function (Point) {
var Origin = ""; // not an error, since not exported
@@ -44,7 +44,7 @@ var A;
}
Point.Origin = { x: 0, y: 0 };
return Point;
})();
}());
A.Point = Point;
var Point;
(function (Point) {
@@ -51,7 +51,7 @@ var X;
this.y = y;
}
return Point;
})();
}());
Y.Point = Point;
})(Y = X.Y || (X.Y = {}));
})(X || (X = {}));
@@ -75,7 +75,7 @@ var A = (function () {
function A() {
}
return A;
})();
}());
var A;
(function (A) {
A.Instance = new A();
@@ -9,4 +9,4 @@ var C = (function () {
function C() {
}
return C;
})();
}());
@@ -10,4 +10,4 @@ var C = (function () {
}
C.prototype.foo = function () { };
return C;
})();
}());
@@ -10,4 +10,4 @@ var C = (function () {
}
C.prototype.bar = function () { };
return C;
})();
}());
@@ -9,4 +9,4 @@ var C = (function () {
function C() {
}
return C;
})();
}());
@@ -9,4 +9,4 @@ var C = (function () {
function C() {
}
return C;
})();
}());
@@ -10,4 +10,4 @@ var C = (function () {
}
C.prototype[1] = function () { };
return C;
})();
}());
@@ -10,4 +10,4 @@ var C = (function () {
}
C.prototype["bar"] = function () { };
return C;
})();
}());
@@ -7,4 +7,4 @@ var any = (function () {
function any() {
}
return any;
})();
}());
@@ -14,4 +14,4 @@ var List = (function () {
function List() {
}
return List;
})();
}());
@@ -11,5 +11,5 @@ var C = (function () {
this.foo = 10;
}
return C;
})();
}());
var constructor = function () { };
@@ -8,4 +8,4 @@ var C = (function () {
function C() {
}
return C;
})();
}());
@@ -8,4 +8,4 @@ var C = (function () {
function C() {
}
return C;
})();
}());
@@ -9,4 +9,4 @@ var AtomicNumbers = (function () {
}
AtomicNumbers.H = 1;
return AtomicNumbers;
})();
}());
@@ -10,4 +10,4 @@ var C = (function () {
this.x = 10;
}
return C;
})();
}());
@@ -32,4 +32,4 @@ var StringIterator = (function () {
return this;
};
return StringIterator;
})();
}());
@@ -19,7 +19,7 @@ var M;
}
C.prototype[Symbol.iterator] = function () { };
return C;
})();
}());
M.C = C;
(new C)[Symbol.iterator];
})(M || (M = {}));
@@ -14,5 +14,5 @@ var C = (function () {
}
C.prototype[Symbol.iterator] = function () { };
return C;
})();
}());
(new C)[Symbol.iterator];
@@ -14,5 +14,5 @@ var C = (function () {
}
C.prototype[Symbol.iterator] = function () { };
return C;
})();
}());
(new C)[Symbol.iterator];
@@ -14,5 +14,5 @@ var C = (function () {
}
C.prototype[Symbol.iterator] = function () { };
return C;
})();
}());
(new C)[Symbol.iterator](0); // Should error
@@ -11,5 +11,5 @@ var C = (function () {
}
C.prototype[Symbol.iterator] = function () { };
return C;
})();
}());
(new C)[Symbol.iterator];
@@ -14,5 +14,5 @@ var C = (function () {
}
C.prototype[Symbol.iterator] = function () { };
return C;
})();
}());
(new C)[Symbol.iterator];
@@ -30,7 +30,7 @@ var enumdule;
this.y = y;
}
return Point;
})();
}());
enumdule.Point = Point;
})(enumdule || (enumdule = {}));
var x;
@@ -10,5 +10,5 @@ var C = (function () {
function C() {
}
return C;
})();
}());
exports.C = C;
@@ -10,5 +10,5 @@ var C = (function () {
function C() {
}
return C;
})();
}());
exports.C = C;
@@ -31,6 +31,6 @@ var A;
return 1;
};
return Point2d;
})();
}());
A.Point2d = Point2d;
})(A || (A = {}));
@@ -32,7 +32,7 @@ var A;
function Point() {
}
return Point;
})();
}());
A.Point = Point;
A.Origin = { x: 0, y: 0 };
var Point3d = (function (_super) {
@@ -41,7 +41,7 @@ var A;
_super.apply(this, arguments);
}
return Point3d;
})(Point);
}(Point));
A.Point3d = Point3d;
A.Origin3d = { x: 0, y: 0, z: 0 };
var Line = (function () {
@@ -50,6 +50,6 @@ var A;
this.end = end;
}
return Line;
})();
}());
A.Line = Line;
})(A || (A = {}));
@@ -22,11 +22,11 @@ var A;
function Point() {
}
return Point;
})();
}());
var points = (function () {
function points() {
}
return points;
})();
}());
A.points = points;
})(A || (A = {}));
@@ -36,7 +36,7 @@ var A;
function Point() {
}
return Point;
})();
}());
A.Origin = { x: 0, y: 0 };
var Point3d = (function (_super) {
__extends(Point3d, _super);
@@ -44,7 +44,7 @@ var A;
_super.apply(this, arguments);
}
return Point3d;
})(Point);
}(Point));
A.Point3d = Point3d;
A.Origin3d = { x: 0, y: 0, z: 0 };
var Line = (function () {
@@ -56,6 +56,6 @@ var A;
return null;
};
return Line;
})();
}());
A.Line = Line;
})(A || (A = {}));
@@ -22,7 +22,7 @@ var A;
function Point() {
}
return Point;
})();
}());
A.Point = Point;
var Line = (function () {
function Line(start, end) {
@@ -30,7 +30,7 @@ var A;
this.end = end;
}
return Line;
})();
}());
A.Line = Line;
function fromOrigin(p) {
return new Line({ x: 0, y: 0 }, p);
@@ -22,14 +22,14 @@ var A;
function Point() {
}
return Point;
})();
}());
var Line = (function () {
function Line(start, end) {
this.start = start;
this.end = end;
}
return Line;
})();
}());
A.Line = Line;
function fromOrigin(p) {
return new Line({ x: 0, y: 0 }, p);
@@ -22,7 +22,7 @@ var A;
function Point() {
}
return Point;
})();
}());
A.Point = Point;
var Line = (function () {
function Line(start, end) {
@@ -30,7 +30,7 @@ var A;
this.end = end;
}
return Line;
})();
}());
function fromOrigin(p) {
return new Line({ x: 0, y: 0 }, p);
}
@@ -29,7 +29,7 @@ var A;
this.y = y;
}
return Point;
})();
}());
A.Point = Point;
var B;
(function (B) {
@@ -41,7 +41,7 @@ var A;
return new Line({ x: 0, y: 0 }, p);
};
return Line;
})();
}());
B.Line = Line;
})(B = A.B || (A.B = {}));
})(A || (A = {}));
@@ -20,7 +20,7 @@ var A;
this.y = y;
}
return Point;
})();
}());
A.Origin = { x: 0, y: 0 };
A.Unity = { start: new Point(0, 0), end: new Point(1, 0) };
})(A || (A = {}));
@@ -20,6 +20,6 @@ var A;
this.y = y;
}
return Point;
})();
}());
A.UnitSquare = null;
})(A || (A = {}));
@@ -15,6 +15,6 @@ var A;
function B() {
}
return B;
})();
}());
A.beez2 = new Array();
})(A || (A = {}));
@@ -13,4 +13,4 @@ var C = (function () {
configurable: true
});
return C;
})();
}());
@@ -9,4 +9,4 @@ var C = (function () {
}
C.prototype.foo = function () { };
return C;
})();
}());
@@ -9,4 +9,4 @@ var C = (function () {
}
C.prototype.foo = function () { };
return C;
})();
}());
@@ -9,4 +9,4 @@ var C = (function () {
}
C.prototype[foo] = function () { };
return C;
})();
}());
@@ -9,4 +9,4 @@ var C = (function () {
}
C.prototype. = function () { };
return C;
})();
}());
@@ -8,4 +8,4 @@ var C = (function () {
function C() {
}
return C;
})();
}());
@@ -8,4 +8,4 @@ var C = (function () {
function C() {
}
return C;
})();
}());
@@ -9,4 +9,4 @@ var C = (function () {
}
C.prototype.foo = function () { };
return C;
})();
}());
@@ -19,4 +19,4 @@ var C = (function () {
return bar;
};
return C;
})();
}());
@@ -54,7 +54,7 @@ var X;
this.y = y;
}
return Point;
})();
}());
Y.Point = Point;
})(Y = X.Y || (X.Y = {}));
})(X || (X = {}));
@@ -68,4 +68,4 @@ var A = (function () {
function A() {
}
return A;
})();
}());
@@ -25,7 +25,7 @@ var enumdule;
this.y = y;
}
return Point;
})();
}());
enumdule.Point = Point;
})(enumdule || (enumdule = {}));
var enumdule;
@@ -40,24 +40,24 @@ var A;
function A() {
}
return A;
})();
}());
A_1.A = A;
var AG = (function () {
function AG() {
}
return AG;
})();
}());
A_1.AG = AG;
var A2 = (function () {
function A2() {
}
return A2;
})();
}());
var AG2 = (function () {
function AG2() {
}
return AG2;
})();
}());
})(A || (A = {}));
// no errors expected, these are all exported
var a;
@@ -48,7 +48,7 @@ var B;
this.end = end;
}
return Line;
})();
}());
B.Line = Line;
})(B || (B = {}));
var Geometry;
@@ -45,7 +45,7 @@ var Inner;
function A() {
}
return A;
})();
}());
var B;
(function (B) {
B.a = 1, B.c = 2;
@@ -63,7 +63,7 @@ var Inner;
function D() {
}
return D;
})();
}());
Inner.e1 = new D;
Inner.f1 = new D;
Inner.g1 = new D;
+1 -1
View File
@@ -9,4 +9,4 @@ var C = (function () {
function C(C) {
}
return C;
})();
}());
+1 -1
View File
@@ -11,4 +11,4 @@ var C1 = (function () {
this.p3 = p3;
} // OK
return C1;
})();
}());
+1 -1
View File
@@ -7,4 +7,4 @@ var C = (function () {
function C() {
}
return C;
})();
}());
+1 -1
View File
@@ -8,4 +8,4 @@ var C = (function () {
function C() {
}
return C;
})();
}());
+1 -1
View File
@@ -9,4 +9,4 @@ var C = (function () {
}
C.prototype.m = function () { };
return C;
})();
}());
+1 -1
View File
@@ -9,4 +9,4 @@ var C = (function () {
}
C.m = function () { };
return C;
})();
}());
+1 -1
View File
@@ -9,4 +9,4 @@ var C = (function () {
}
C.m = function () { };
return C;
})();
}());
+1 -1
View File
@@ -9,4 +9,4 @@ var C = (function () {
}
C.prototype.m = function () { };
return C;
})();
}());
+1 -1
View File
@@ -9,4 +9,4 @@ var C = (function () {
this.p = p;
}
return C;
})();
}());
@@ -47,7 +47,7 @@ var A;
function Point() {
}
return Point;
})();
}());
A.Point = Point;
})(A || (A = {}));
var A;
@@ -59,7 +59,7 @@ var A;
return { x: p.x, y: p.y };
};
return Point;
})();
}());
})(A || (A = {}));
// ensure merges as expected
var p;
@@ -74,7 +74,7 @@ var X;
function Line() {
}
return Line;
})();
}());
Z.Line = Line;
})(Z = Y.Z || (Y.Z = {}));
})(Y = X.Y || (X.Y = {}));
@@ -89,7 +89,7 @@ var X;
function Line() {
}
return Line;
})();
}());
})(Z = Y.Z || (Y.Z = {}));
})(Y = X.Y || (X.Y = {}));
})(X || (X = {}));
@@ -66,7 +66,7 @@ var A;
this.br = br;
}
return Plane;
})();
}());
Utils.Plane = Plane;
})(Utils = A.Utils || (A.Utils = {}));
})(A || (A = {}));
@@ -39,7 +39,7 @@ var A;
function Point() {
}
return Point;
})();
}());
A.Point = Point;
})(A || (A = {}));
var A;
@@ -49,7 +49,7 @@ var A;
function Point() {
}
return Point;
})();
}());
A.Point = Point;
})(A || (A = {}));
var X;
@@ -62,7 +62,7 @@ var X;
function Line() {
}
return Line;
})();
}());
Z.Line = Line;
})(Z = Y.Z || (Y.Z = {}));
})(Y = X.Y || (X.Y = {}));
@@ -78,7 +78,7 @@ var X;
function Line() {
}
return Line;
})();
}());
Z.Line = Line;
})(Z = Y.Z || (Y.Z = {}));
})(Y = X.Y || (X.Y = {}));
@@ -56,7 +56,7 @@ var A;
this.br = br;
}
return Plane;
})();
}());
Utils.Plane = Plane;
})(Utils = A.Utils || (A.Utils = {}));
})(A = exports.A || (exports.A = {}));
@@ -60,7 +60,7 @@ var X;
function Line() {
}
return Line;
})();
}());
Z.Line = Line;
})(Z = Y.Z || (Y.Z = {}));
})(Y = X.Y || (X.Y = {}));
@@ -75,7 +75,7 @@ var X;
function Line() {
}
return Line;
})();
}());
Z.Line = Line;
})(Z || (Z = {}));
})(Y = X.Y || (X.Y = {}));
@@ -59,7 +59,7 @@ var otherRoot;
this.br = br;
}
return Plane;
})();
}());
Utils.Plane = Plane;
})(Utils = A.Utils || (A.Utils = {}));
})(A = otherRoot.A || (otherRoot.A = {}));
@@ -62,7 +62,7 @@ var A;
this.br = br;
}
return Plane;
})();
}());
Utils.Plane = Plane;
})(Utils = A.Utils || (A.Utils = {}));
})(A || (A = {}));
@@ -15,7 +15,7 @@ var Message = (function () {
function Message() {
}
return Message;
})();
}());
function saySize(message) {
if (message instanceof Array) {
return message.length; // Should have type Message[] here
@@ -13,4 +13,4 @@ var C = (function () {
yield (foo);
};
return C;
})();
}());
@@ -11,4 +11,4 @@ var C = (function () {
yield foo;
}
return C;
})();
}());
@@ -13,4 +13,4 @@ var C = (function () {
yield foo;
};
return C;
})();
}());
@@ -30,7 +30,7 @@ var Point = (function () {
return "x=" + this.x + " y=" + this.y;
};
return Point;
})();
}());
var ColoredPoint = (function (_super) {
__extends(ColoredPoint, _super);
function ColoredPoint(x, y, color) {
@@ -41,4 +41,4 @@ var ColoredPoint = (function (_super) {
return _super.prototype.toString.call(this) + " color=" + this.color;
};
return ColoredPoint;
})(Point);
}(Point));
@@ -84,7 +84,7 @@ var C = (function () {
configurable: true
});
return C;
})();
}());
// Errors, accessibility modifiers must precede static
var D = (function () {
function D() {
@@ -123,7 +123,7 @@ var D = (function () {
configurable: true
});
return D;
})();
}());
// Errors, multiple accessibility modifier
var E = (function () {
function E() {
@@ -140,4 +140,4 @@ var E = (function () {
configurable: true
});
return E;
})();
}());
@@ -20,4 +20,4 @@ var C = (function () {
configurable: true
});
return C;
})();
}());
+2 -2
View File
@@ -34,7 +34,7 @@ var C = (function () {
configurable: true
});
return C;
})();
}());
var D = (function () {
function D() {
}
@@ -45,7 +45,7 @@ var D = (function () {
configurable: true
});
return D;
})();
}());
var x = {
get a() { return 1; }
};
+2 -2
View File
@@ -31,7 +31,7 @@ var C = (function () {
configurable: true
});
return C;
})();
}());
var D = (function () {
function D() {
}
@@ -42,7 +42,7 @@ var D = (function () {
configurable: true
});
return D;
})();
}());
var x = {
get a() { return 1; }
};
@@ -24,4 +24,4 @@ var C = (function () {
configurable: true
});
return C;
})();
}());
@@ -46,7 +46,7 @@ var C = (function () {
configurable: true
});
return C;
})();
}());
var D = (function () {
function D() {
}
@@ -60,7 +60,7 @@ var D = (function () {
configurable: true
});
return D;
})();
}());
var E = (function () {
function E() {
}
@@ -74,7 +74,7 @@ var E = (function () {
configurable: true
});
return E;
})();
}());
var F = (function () {
function F() {
}
@@ -88,4 +88,4 @@ var F = (function () {
configurable: true
});
return F;
})();
}());
@@ -30,4 +30,4 @@ var C = (function () {
configurable: true
});
return C;
})();
}());
@@ -28,6 +28,6 @@ var C = (function () {
configurable: true
});
return C;
})();
}());
var c;
var r = c.x(''); // string
+3 -3
View File
@@ -20,7 +20,7 @@ var Result = (function () {
function Result() {
}
return Result;
})();
}());
var Test = (function () {
function Test() {
}
@@ -33,7 +33,7 @@ var Test = (function () {
configurable: true
});
return Test;
})();
}());
var Test2 = (function () {
function Test2() {
}
@@ -46,4 +46,4 @@ var Test2 = (function () {
configurable: true
});
return Test2;
})();
}());
@@ -16,5 +16,5 @@ var C = (function () {
configurable: true
});
return C;
})();
}());
var y = { get foo() { return 3; } };

Some files were not shown because too many files have changed in this diff Show More