diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index be9e9a525c0d5..87b0bd86d200c 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -51,17 +51,6 @@ module ts { } } - /** - * A declaration has a dynamic name if both of the following are true: - * 1. The declaration has a computed property name - * 2. The computed name is *not* expressed as Symbol., where name - * is a property of the Symbol constructor that denotes a built in - * Symbol. - */ - export function hasDynamicName(declaration: Declaration): boolean { - return declaration.name && declaration.name.kind === SyntaxKind.ComputedPropertyName; - } - export function bindSourceFile(file: SourceFile): void { var start = new Date().getTime(); bindSourceFileWorker(file); @@ -98,13 +87,18 @@ module ts { if (symbolKind & SymbolFlags.Value && !symbol.valueDeclaration) symbol.valueDeclaration = node; } - // Should not be called on a declaration with a computed property name. + // Should not be called on a declaration with a computed property name, + // unless it is a well known Symbol. function getDeclarationName(node: Declaration): string { if (node.name) { if (node.kind === SyntaxKind.ModuleDeclaration && node.name.kind === SyntaxKind.StringLiteral) { return '"' + (node.name).text + '"'; } - Debug.assert(!hasDynamicName(node)); + if (node.name.kind === SyntaxKind.ComputedPropertyName) { + var nameExpression = (node.name).expression; + Debug.assert(isWellKnownSymbolSyntactically(nameExpression)); + return getPropertyNameForKnownSymbolName((nameExpression).name.text); + } return (node.name).text; } switch (node.kind) { diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index b9f8857cb2335..aab9f49eae6ba 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -67,6 +67,7 @@ module ts { var stringType = createIntrinsicType(TypeFlags.String, "string"); var numberType = createIntrinsicType(TypeFlags.Number, "number"); var booleanType = createIntrinsicType(TypeFlags.Boolean, "boolean"); + var esSymbolType = createIntrinsicType(TypeFlags.ESSymbol, "symbol"); var voidType = createIntrinsicType(TypeFlags.Void, "void"); var undefinedType = createIntrinsicType(TypeFlags.Undefined | TypeFlags.ContainsUndefinedOrNull, "undefined"); var nullType = createIntrinsicType(TypeFlags.Null | TypeFlags.ContainsUndefinedOrNull, "null"); @@ -84,6 +85,7 @@ module ts { var globals: SymbolTable = {}; var globalArraySymbol: Symbol; + var globalESSymbolConstructorSymbol: Symbol; var globalObjectType: ObjectType; var globalFunctionType: ObjectType; @@ -93,6 +95,7 @@ module ts { var globalBooleanType: ObjectType; var globalRegExpType: ObjectType; var globalTemplateStringsArrayType: ObjectType; + var globalESSymbolType: ObjectType; var anyArrayType: Type; @@ -120,6 +123,10 @@ module ts { "boolean": { type: booleanType, flags: TypeFlags.Boolean + }, + "symbol": { + type: esSymbolType, + flags: TypeFlags.ESSymbol } }; @@ -706,9 +713,15 @@ module ts { return type; } - // A reserved member name starts with two underscores followed by a non-underscore + // A reserved member name starts with two underscores, but the third character cannot be an underscore + // or the @ symbol. A third underscore indicates an escaped form of an identifer that started + // with at least two underscores. The @ character indicates that the name is denoted by a well known ES + // Symbol instance. function isReservedMemberName(name: string) { - return name.charCodeAt(0) === CharacterCodes._ && name.charCodeAt(1) === CharacterCodes._ && name.charCodeAt(2) !== CharacterCodes._; + return name.charCodeAt(0) === CharacterCodes._ && + name.charCodeAt(1) === CharacterCodes._ && + name.charCodeAt(2) !== CharacterCodes._ && + name.charCodeAt(2) !== CharacterCodes.at; } function getNamedMembers(members: SymbolTable): Symbol[] { @@ -2489,9 +2502,9 @@ module ts { return getPropertiesOfObjectType(getApparentType(type)); } - // For a type parameter, return the base constraint of the type parameter. For the string, number, and - // boolean primitive types, return the corresponding object types.Otherwise return the type itself. - // Note that the apparent type of a union type is the union type itself. + // For a type parameter, return the base constraint of the type parameter. For the string, number, + // boolean, and symbol primitive types, return the corresponding object types. Otherwise return the + // type itself. Note that the apparent type of a union type is the union type itself. function getApparentType(type: Type): Type { if (type.flags & TypeFlags.TypeParameter) { do { @@ -2510,6 +2523,9 @@ module ts { else if (type.flags & TypeFlags.Boolean) { type = globalBooleanType; } + else if (type.flags & TypeFlags.ESSymbol) { + type = globalESSymbolType; + } return type; } @@ -2999,12 +3015,24 @@ module ts { return type; } - function getGlobalSymbol(name: string): Symbol { - return resolveName(undefined, name, SymbolFlags.Type, Diagnostics.Cannot_find_global_type_0, name); + function getGlobalValueSymbol(name: string): Symbol { + return getGlobalSymbol(name, SymbolFlags.Value, Diagnostics.Cannot_find_global_value_0); + } + + function getGlobalTypeSymbol(name: string): Symbol { + return getGlobalSymbol(name, SymbolFlags.Type, Diagnostics.Cannot_find_global_type_0); + } + + function getGlobalSymbol(name: string, meaning: SymbolFlags, diagnostic: DiagnosticMessage): Symbol { + return resolveName(undefined, name, meaning, diagnostic, name); } function getGlobalType(name: string): ObjectType { - return getTypeOfGlobalSymbol(getGlobalSymbol(name), 0); + return getTypeOfGlobalSymbol(getGlobalTypeSymbol(name), 0); + } + + function getGlobalESSymbolConstructorSymbol() { + return globalESSymbolConstructorSymbol || (globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol")); } function createArrayType(elementType: Type): Type { @@ -3174,6 +3202,8 @@ module ts { return numberType; case SyntaxKind.BooleanKeyword: return booleanType; + case SyntaxKind.SymbolKeyword: + return esSymbolType; case SyntaxKind.VoidKeyword: return voidType; case SyntaxKind.StringLiteral: @@ -4740,7 +4770,7 @@ module ts { if (assumeTrue) { // Assumed result is true. If check was not for a primitive type, remove all primitive types if (!typeInfo) { - return removeTypesFromUnionType(type, /*typeKind*/ TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.Boolean, /*isOfTypeKind*/ true); + return removeTypesFromUnionType(type, /*typeKind*/ TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.Boolean | TypeFlags.ESSymbol, /*isOfTypeKind*/ true); } // Check was for a primitive type, return that primitive type if it is a subtype if (isTypeSubtypeOf(typeInfo.type, type)) { @@ -5475,7 +5505,7 @@ module ts { function isNumericComputedName(name: ComputedPropertyName): boolean { // It seems odd to consider an expression of type Any to result in a numeric name, // but this behavior is consistent with checkIndexedAccess - return isTypeOfKind(checkComputedPropertyName(name), TypeFlags.Any | TypeFlags.NumberLike); + return allConstituentTypesHaveKind(checkComputedPropertyName(name), TypeFlags.Any | TypeFlags.NumberLike); } function isNumericLiteralName(name: string) { @@ -5508,10 +5538,13 @@ module ts { if (!links.resolvedType) { links.resolvedType = checkExpression(node.expression); - // This will allow types number, string, or any. It will also allow enums, the unknown + // This will allow types number, string, symbol or any. It will also allow enums, the unknown // type, and any union of these types (like string | number). - if (!isTypeOfKind(links.resolvedType, TypeFlags.Any | TypeFlags.NumberLike | TypeFlags.StringLike)) { - error(node, Diagnostics.A_computed_property_name_must_be_of_type_string_number_or_any); + if (!allConstituentTypesHaveKind(links.resolvedType, TypeFlags.Any | TypeFlags.NumberLike | TypeFlags.StringLike | TypeFlags.ESSymbol)) { + error(node, Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any); + } + else { + checkThatExpressionIsProperSymbolReference(node.expression, links.resolvedType, /*reportError*/ true); } } @@ -5760,8 +5793,8 @@ module ts { // See if we can index as a property. if (node.argumentExpression) { - if (node.argumentExpression.kind === SyntaxKind.StringLiteral || node.argumentExpression.kind === SyntaxKind.NumericLiteral) { - var name = (node.argumentExpression).text; + var name = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); + if (name !== undefined) { var prop = getPropertyOfType(objectType, name); if (prop) { getNodeLinks(node).resolvedSymbol = prop; @@ -5775,10 +5808,10 @@ module ts { } // Check for compatible indexer types. - if (isTypeOfKind(indexType, TypeFlags.Any | TypeFlags.StringLike | TypeFlags.NumberLike)) { + if (allConstituentTypesHaveKind(indexType, TypeFlags.Any | TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.ESSymbol)) { // Try to use a number indexer. - if (isTypeOfKind(indexType, TypeFlags.Any | TypeFlags.NumberLike)) { + if (allConstituentTypesHaveKind(indexType, TypeFlags.Any | TypeFlags.NumberLike)) { var numberIndexType = getIndexTypeOfType(objectType, IndexKind.Number); if (numberIndexType) { return numberIndexType; @@ -5800,11 +5833,78 @@ module ts { } // REVIEW: Users should know the type that was actually used. - error(node, Diagnostics.An_index_expression_argument_must_be_of_type_string_number_or_any); + error(node, Diagnostics.An_index_expression_argument_must_be_of_type_string_number_symbol_or_any); return unknownType; } + /** + * If indexArgumentExpression is a string literal or number literal, returns its text. + * If indexArgumentExpression is a well known symbol, returns the property name corresponding + * to this symbol, as long as it is a proper symbol reference. + * Otherwise, returns undefined. + */ + function getPropertyNameForIndexedAccess(indexArgumentExpression: Expression, indexArgumentType: Type): string { + if (indexArgumentExpression.kind === SyntaxKind.StringLiteral || indexArgumentExpression.kind === SyntaxKind.NumericLiteral) { + return (indexArgumentExpression).text; + } + if (checkThatExpressionIsProperSymbolReference(indexArgumentExpression, indexArgumentType, /*reportError*/ false)) { + var rightHandSideName = ((indexArgumentExpression).name).text; + return getPropertyNameForKnownSymbolName(rightHandSideName); + } + + return undefined; + } + + /** + * A proper symbol reference requires the following: + * 1. The property access denotes a property that exists + * 2. The expression is of the form Symbol. + * 3. The property access is of the primitive type symbol. + * 4. Symbol in this context resolves to the global Symbol object + */ + function checkThatExpressionIsProperSymbolReference(expression: Expression, expressionType: Type, reportError: boolean): boolean { + if (expressionType === unknownType) { + // There is already an error, so no need to report one. + return false; + } + + if (!isWellKnownSymbolSyntactically(expression)) { + return false; + } + + // Make sure the property type is the primitive symbol type + if ((expressionType.flags & TypeFlags.ESSymbol) === 0) { + if (reportError) { + error(expression, Diagnostics.A_computed_property_name_of_the_form_0_must_be_of_type_symbol, getTextOfNode(expression)); + } + return false; + } + + // The name is Symbol., so make sure Symbol actually resolves to the + // global Symbol object + var leftHandSide = (expression).expression; + var leftHandSideSymbol = getResolvedSymbol(leftHandSide); + if (!leftHandSideSymbol) { + return false; + } + + var globalESSymbol = getGlobalESSymbolConstructorSymbol(); + if (!globalESSymbol) { + // Already errored when we tried to look up the symbol + return false; + } + + if (leftHandSideSymbol !== globalESSymbol) { + if (reportError) { + error(leftHandSide, Diagnostics.Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object); + } + return false; + } + + return true; + } + function resolveUntypedCall(node: CallLikeExpression): Signature { if (node.kind === SyntaxKind.TaggedTemplateExpression) { checkExpression((node).template); @@ -6719,7 +6819,7 @@ module ts { } function checkArithmeticOperandType(operand: Node, type: Type, diagnostic: DiagnosticMessage): boolean { - if (!isTypeOfKind(type, TypeFlags.Any | TypeFlags.NumberLike)) { + if (!allConstituentTypesHaveKind(type, TypeFlags.Any | TypeFlags.NumberLike)) { error(operand, diagnostic); return false; } @@ -6835,6 +6935,9 @@ module ts { case SyntaxKind.PlusToken: case SyntaxKind.MinusToken: case SyntaxKind.TildeToken: + if (someConstituentTypeHasKind(operandType, TypeFlags.ESSymbol)) { + error(node.operand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(node.operator)); + } return numberType; case SyntaxKind.ExclamationToken: return booleanType; @@ -6870,8 +6973,26 @@ module ts { return numberType; } - // Return true if type has the given flags, or is a union type composed of types that all have those flags - function isTypeOfKind(type: Type, kind: TypeFlags): boolean { + // Just like isTypeOfKind below, except that it returns true if *any* constituent + // has this kind. + function someConstituentTypeHasKind(type: Type, kind: TypeFlags): boolean { + if (type.flags & kind) { + return true; + } + if (type.flags & TypeFlags.Union) { + var types = (type).types; + for (var i = 0; i < types.length; i++) { + if (types[i].flags & kind) { + return true; + } + } + return false; + } + return false; + } + + // Return true if type has the given flags, or is a union type composed of types that all have those flags. + function allConstituentTypesHaveKind(type: Type, kind: TypeFlags): boolean { if (type.flags & kind) { return true; } @@ -6901,7 +7022,7 @@ module ts { // and the right operand to be of type Any or a subtype of the 'Function' interface type. // The result is always of the Boolean primitive type. // NOTE: do not raise error if leftType is unknown as related error was already reported - if (isTypeOfKind(leftType, TypeFlags.Primitive)) { + if (allConstituentTypesHaveKind(leftType, TypeFlags.Primitive)) { error(node.left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } // NOTE: do not raise error if right is unknown as related error was already reported @@ -6916,10 +7037,10 @@ module ts { // The in operator requires the left operand to be of type Any, the String primitive type, or the Number primitive type, // and the right operand to be of type Any, an object type, or a type parameter type. // The result is always of the Boolean primitive type. - if (!isTypeOfKind(leftType, TypeFlags.Any | TypeFlags.StringLike | TypeFlags.NumberLike)) { - error(node.left, Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number); + if (!allConstituentTypesHaveKind(leftType, TypeFlags.Any | TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.ESSymbol)) { + error(node.left, Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); } - if (!isTypeOfKind(rightType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter)) { + if (!allConstituentTypesHaveKind(rightType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter)) { error(node.right, Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } return booleanType; @@ -7080,19 +7201,26 @@ module ts { if (rightType.flags & (TypeFlags.Undefined | TypeFlags.Null)) rightType = leftType; var resultType: Type; - if (isTypeOfKind(leftType, TypeFlags.NumberLike) && isTypeOfKind(rightType, TypeFlags.NumberLike)) { + if (allConstituentTypesHaveKind(leftType, TypeFlags.NumberLike) && allConstituentTypesHaveKind(rightType, TypeFlags.NumberLike)) { // Operands of an enum type are treated as having the primitive type Number. // If both operands are of the Number primitive type, the result is of the Number primitive type. resultType = numberType; } - else if (isTypeOfKind(leftType, TypeFlags.StringLike) || isTypeOfKind(rightType, TypeFlags.StringLike)) { - // If one or both operands are of the String primitive type, the result is of the String primitive type. - resultType = stringType; - } - else if (leftType.flags & TypeFlags.Any || rightType.flags & TypeFlags.Any) { - // Otherwise, the result is of type Any. - // NOTE: unknown type here denotes error type. Old compiler treated this case as any type so do we. - resultType = anyType; + else { + if (allConstituentTypesHaveKind(leftType, TypeFlags.StringLike) || allConstituentTypesHaveKind(rightType, TypeFlags.StringLike)) { + // If one or both operands are of the String primitive type, the result is of the String primitive type. + resultType = stringType; + } + else if (leftType.flags & TypeFlags.Any || rightType.flags & TypeFlags.Any) { + // Otherwise, the result is of type Any. + // NOTE: unknown type here denotes error type. Old compiler treated this case as any type so do we. + resultType = anyType; + } + + // Symbols are not allowed at all in arithmetic expressions + if (resultType && !checkForDisallowedESSymbolOperand(operator)) { + return resultType; + } } if (!resultType) { @@ -7104,14 +7232,18 @@ module ts { checkAssignmentOperator(resultType); } return resultType; - case SyntaxKind.EqualsEqualsToken: - case SyntaxKind.ExclamationEqualsToken: - case SyntaxKind.EqualsEqualsEqualsToken: - case SyntaxKind.ExclamationEqualsEqualsToken: case SyntaxKind.LessThanToken: case SyntaxKind.GreaterThanToken: case SyntaxKind.LessThanEqualsToken: case SyntaxKind.GreaterThanEqualsToken: + if (!checkForDisallowedESSymbolOperand(operator)) { + return booleanType; + } + // Fall through + case SyntaxKind.EqualsEqualsToken: + case SyntaxKind.ExclamationEqualsToken: + case SyntaxKind.EqualsEqualsEqualsToken: + case SyntaxKind.ExclamationEqualsEqualsToken: if (!isTypeAssignableTo(leftType, rightType) && !isTypeAssignableTo(rightType, leftType)) { reportOperatorError(); } @@ -7131,6 +7263,20 @@ module ts { return rightType; } + // Return type is true if there was no error, false if there was an error. + function checkForDisallowedESSymbolOperand(operator: SyntaxKind): boolean { + var offendingSymbolOperand = + someConstituentTypeHasKind(leftType, TypeFlags.ESSymbol) ? node.left : + someConstituentTypeHasKind(rightType, TypeFlags.ESSymbol) ? node.right : + undefined; + if (offendingSymbolOperand) { + error(offendingSymbolOperand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(operator)); + return false; + } + + return true; + } + function getSuggestedBooleanOperator(operator: SyntaxKind): SyntaxKind { switch (operator) { case SyntaxKind.BarToken: @@ -7216,7 +7362,10 @@ module ts { } function checkPropertyAssignment(node: PropertyAssignment, contextualMapper?: TypeMapper): Type { - if (hasDynamicName(node)) { + // Do not use hasDynamicName here, because that returns false for well known symbols. + // We want to perform checkComputedPropertyName for all computed properties, including + // well known symbols. + if (node.name.kind === SyntaxKind.ComputedPropertyName) { checkComputedPropertyName(node.name); } @@ -7227,7 +7376,10 @@ module ts { // Grammar checking checkGrammarMethod(node); - if (hasDynamicName(node)) { + // Do not use hasDynamicName here, because that returns false for well known symbols. + // We want to perform checkComputedPropertyName for all computed properties, including + // well known symbols. + if (node.name.kind === SyntaxKind.ComputedPropertyName) { checkComputedPropertyName(node.name); } @@ -7490,7 +7642,7 @@ module ts { function checkPropertyDeclaration(node: PropertyDeclaration) { // Grammar checking - checkGrammarModifiers(node) || checkGrammarProperty(node); + checkGrammarModifiers(node) || checkGrammarProperty(node) || checkGrammarComputedPropertyName(node.name); checkVariableLikeDeclaration(node); } @@ -8039,12 +8191,16 @@ module ts { function checkFunctionLikeDeclaration(node: FunctionLikeDeclaration): void { checkSignatureDeclaration(node); - if (hasDynamicName(node)) { + // Do not use hasDynamicName here, because that returns false for well known symbols. + // We want to perform checkComputedPropertyName for all computed properties, including + // well known symbols. + if (node.name.kind === SyntaxKind.ComputedPropertyName) { // This check will account for methods in class/interface declarations, // as well as accessors in classes/object literals checkComputedPropertyName(node.name); } - else { + + if (!hasDynamicName(node)) { // first we want to check the local symbol that contain this declaration // - if node.localSymbol !== undefined - this is current declaration is exported and localSymbol points to the local symbol // - if node.localSymbol === undefined - this node is non-exported so we can just pick the result of getSymbolOfNode @@ -8302,12 +8458,14 @@ module ts { function checkVariableLikeDeclaration(node: VariableLikeDeclaration) { checkSourceElement(node.type); // For a computed property, just check the initializer and exit - if (hasDynamicName(node)) { + // Do not use hasDynamicName here, because that returns false for well known symbols. + // We want to perform checkComputedPropertyName for all computed properties, including + // well known symbols. + if (node.name.kind === SyntaxKind.ComputedPropertyName) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); } - return; } // For a binding pattern, check contained binding elements if (isBindingPattern(node.name)) { @@ -8482,7 +8640,7 @@ module ts { // and Expr must be an expression of type Any, an object type, or a type parameter type. var varExpr = node.initializer; var exprType = checkExpression(varExpr); - if (exprType !== anyType && exprType !== stringType) { + if (!allConstituentTypesHaveKind(exprType, TypeFlags.Any | TypeFlags.StringLike)) { error(varExpr, Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any); } else { @@ -8494,7 +8652,7 @@ module ts { var exprType = checkExpression(node.expression); // unknownType is returned i.e. if node.expression is identifier whose name cannot be resolved // in this case error about missing name is already reported - do not report extra one - if (!isTypeOfKind(exprType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter)) { + if (!allConstituentTypesHaveKind(exprType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter)) { error(node.expression, Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter); } @@ -8745,6 +8903,7 @@ module ts { case "number": case "boolean": case "string": + case "symbol": case "void": error(name, message, (name).text); } @@ -8963,7 +9122,7 @@ module ts { var typeName1 = typeToString(existing.containingType); var typeName2 = typeToString(base); - var errorInfo = chainDiagnosticMessages(undefined, Diagnostics.Named_properties_0_of_types_1_and_2_are_not_identical, prop.name, typeName1, typeName2); + var errorInfo = chainDiagnosticMessages(undefined, Diagnostics.Named_property_0_of_types_1_and_2_are_not_identical, symbolToString(prop), typeName1, typeName2); errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Interface_0_cannot_simultaneously_extend_types_1_and_2, typeToString(type), typeName1, typeName2); diagnostics.add(createDiagnosticForNodeFromMessageChain(typeNode, errorInfo)); } @@ -9755,6 +9914,7 @@ module ts { case SyntaxKind.NumberKeyword: case SyntaxKind.StringKeyword: case SyntaxKind.BooleanKeyword: + case SyntaxKind.SymbolKeyword: return true; case SyntaxKind.VoidKeyword: return node.parent.kind !== SyntaxKind.VoidExpression; @@ -10279,7 +10439,7 @@ module ts { getSymbolLinks(unknownSymbol).type = unknownType; globals[undefinedSymbol.name] = undefinedSymbol; // Initialize special types - globalArraySymbol = getGlobalSymbol("Array"); + globalArraySymbol = getGlobalTypeSymbol("Array"); globalArrayType = getTypeOfGlobalSymbol(globalArraySymbol, 1); globalObjectType = getGlobalType("Object"); globalFunctionType = getGlobalType("Function"); @@ -10287,11 +10447,24 @@ module ts { globalNumberType = getGlobalType("Number"); globalBooleanType = getGlobalType("Boolean"); globalRegExpType = getGlobalType("RegExp"); + // If we're in ES6 mode, load the TemplateStringsArray. // Otherwise, default to 'unknown' for the purposes of type checking in LS scenarios. - globalTemplateStringsArrayType = languageVersion >= ScriptTarget.ES6 - ? getGlobalType("TemplateStringsArray") - : unknownType; + if (languageVersion >= ScriptTarget.ES6) { + globalTemplateStringsArrayType = getGlobalType("TemplateStringsArray"); + globalESSymbolType = getGlobalType("Symbol"); + globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol"); + } + else { + globalTemplateStringsArrayType = unknownType; + + // Consider putting Symbol interface in lib.d.ts. On the plus side, putting it in lib.d.ts would make it + // extensible for Polyfilling Symbols. But putting it into lib.d.ts could also break users that have + // a global Symbol already, particularly if it is a class. + globalESSymbolType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + globalESSymbolConstructorSymbol = undefined; + } + anyArrayType = createArrayType(anyType); } @@ -10506,25 +10679,25 @@ module ts { return grammarErrorOnNode(node, Diagnostics.An_index_signature_must_have_exactly_one_parameter); } } - else if (parameter.dotDotDotToken) { + if (parameter.dotDotDotToken) { return grammarErrorOnNode(parameter.dotDotDotToken, Diagnostics.An_index_signature_cannot_have_a_rest_parameter); } - else if (parameter.flags & NodeFlags.Modifier) { + if (parameter.flags & NodeFlags.Modifier) { return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier); } - else if (parameter.questionToken) { + if (parameter.questionToken) { return grammarErrorOnNode(parameter.questionToken, Diagnostics.An_index_signature_parameter_cannot_have_a_question_mark); } - else if (parameter.initializer) { + if (parameter.initializer) { return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_cannot_have_an_initializer); } - else if (!parameter.type) { + if (!parameter.type) { return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); } - else if (parameter.type.kind !== SyntaxKind.StringKeyword && parameter.type.kind !== SyntaxKind.NumberKeyword) { + if (parameter.type.kind !== SyntaxKind.StringKeyword && parameter.type.kind !== SyntaxKind.NumberKeyword) { return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); } - else if (!node.type) { + if (!node.type) { return grammarErrorOnNode(node, Diagnostics.An_index_signature_must_have_a_type_annotation); } } @@ -10797,8 +10970,8 @@ module ts { } } - function checkGrammarForDisallowedComputedProperty(node: DeclarationName, message: DiagnosticMessage) { - if (node.kind === SyntaxKind.ComputedPropertyName) { + function checkGrammarForNonSymbolComputedProperty(node: DeclarationName, message: DiagnosticMessage) { + if (node.kind === SyntaxKind.ComputedPropertyName && !isWellKnownSymbolSyntactically((node).expression)) { return grammarErrorOnNode(node, message); } } @@ -10829,17 +11002,17 @@ module ts { // and accessors are not allowed in ambient contexts in general, // so this error only really matters for methods. if (isInAmbientContext(node)) { - return checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_an_ambient_context); + return checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol); } else if (!node.body) { - return checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_method_overloads); + return checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol); } } else if (node.parent.kind === SyntaxKind.InterfaceDeclaration) { - return checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_interfaces); + return checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol); } else if (node.parent.kind === SyntaxKind.TypeLiteral) { - return checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_type_literals); + return checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol); } } @@ -11053,6 +11226,9 @@ module ts { var inAmbientContext = isInAmbientContext(enumDecl); for (var i = 0, n = enumDecl.members.length; i < n; i++) { var node = enumDecl.members[i]; + // Do not use hasDynamicName here, because that returns false for well known symbols. + // We want to perform checkComputedPropertyName for all computed properties, including + // well known symbols. if (node.name.kind === SyntaxKind.ComputedPropertyName) { hasError = grammarErrorOnNode(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_enums); } @@ -11133,17 +11309,17 @@ module ts { function checkGrammarProperty(node: PropertyDeclaration) { if (node.parent.kind === SyntaxKind.ClassDeclaration) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, Diagnostics.A_class_member_cannot_be_declared_optional) || - checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_class_property_declarations)) { + checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { return true; } } else if (node.parent.kind === SyntaxKind.InterfaceDeclaration) { - if (checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_interfaces)) { + if (checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } } else if (node.parent.kind === SyntaxKind.TypeLiteral) { - if (checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_type_literals)) { + if (checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { return true; } } diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 2c64f8ff4b008..386d4300ade3f 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -123,12 +123,12 @@ module ts { An_object_member_cannot_be_declared_optional: { code: 1162, category: DiagnosticCategory.Error, key: "An object member cannot be declared optional." }, yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: DiagnosticCategory.Error, key: "'yield' expression must be contained_within a generator declaration." }, Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in enums." }, - Computed_property_names_are_not_allowed_in_an_ambient_context: { code: 1165, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in an ambient context." }, - Computed_property_names_are_not_allowed_in_class_property_declarations: { code: 1166, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in class property declarations." }, + A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { code: 1165, category: DiagnosticCategory.Error, key: "A computed property name in an ambient context must directly refer to a built-in symbol." }, + A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { code: 1166, category: DiagnosticCategory.Error, key: "A computed property name in a class property declaration must directly refer to a built-in symbol." }, Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1167, category: DiagnosticCategory.Error, key: "Computed property names are only available when targeting ECMAScript 6 and higher." }, - Computed_property_names_are_not_allowed_in_method_overloads: { code: 1168, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in method overloads." }, - Computed_property_names_are_not_allowed_in_interfaces: { code: 1169, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in interfaces." }, - Computed_property_names_are_not_allowed_in_type_literals: { code: 1170, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in type literals." }, + A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { code: 1168, category: DiagnosticCategory.Error, key: "A computed property name in a method overload must directly refer to a built-in symbol." }, + A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { code: 1169, category: DiagnosticCategory.Error, key: "A computed property name in an interface must directly refer to a built-in symbol." }, + A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { code: 1170, category: DiagnosticCategory.Error, key: "A computed property name in a type literal must directly refer to a built-in symbol." }, A_comma_expression_is_not_allowed_in_a_computed_property_name: { code: 1171, category: DiagnosticCategory.Error, key: "A comma expression is not allowed in a computed property name." }, extends_clause_already_seen: { code: 1172, category: DiagnosticCategory.Error, key: "'extends' clause already seen." }, extends_clause_must_precede_implements_clause: { code: 1173, category: DiagnosticCategory.Error, key: "'extends' clause must precede 'implements' clause." }, @@ -166,7 +166,7 @@ module ts { Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: DiagnosticCategory.Error, key: "Global type '{0}' must be a class or interface type." }, Global_type_0_must_have_1_type_parameter_s: { code: 2317, category: DiagnosticCategory.Error, key: "Global type '{0}' must have {1} type parameter(s)." }, Cannot_find_global_type_0: { code: 2318, category: DiagnosticCategory.Error, key: "Cannot find global type '{0}'." }, - Named_properties_0_of_types_1_and_2_are_not_identical: { code: 2319, category: DiagnosticCategory.Error, key: "Named properties '{0}' of types '{1}' and '{2}' are not identical." }, + Named_property_0_of_types_1_and_2_are_not_identical: { code: 2319, category: DiagnosticCategory.Error, key: "Named property '{0}' of types '{1}' and '{2}' are not identical." }, Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: DiagnosticCategory.Error, key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." }, Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: DiagnosticCategory.Error, key: "Excessive stack depth comparing types '{0}' and '{1}'." }, Type_0_is_not_assignable_to_type_1: { code: 2322, category: DiagnosticCategory.Error, key: "Type '{0}' is not assignable to type '{1}'." }, @@ -188,7 +188,7 @@ module ts { Property_0_does_not_exist_on_type_1: { code: 2339, category: DiagnosticCategory.Error, key: "Property '{0}' does not exist on type '{1}'." }, Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: DiagnosticCategory.Error, key: "Only public and protected methods of the base class are accessible via the 'super' keyword" }, Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: DiagnosticCategory.Error, key: "Property '{0}' is private and only accessible within class '{1}'." }, - An_index_expression_argument_must_be_of_type_string_number_or_any: { code: 2342, category: DiagnosticCategory.Error, key: "An index expression argument must be of type 'string', 'number', or 'any'." }, + An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: DiagnosticCategory.Error, key: "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'." }, Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: DiagnosticCategory.Error, key: "Type '{0}' does not satisfy the constraint '{1}'." }, Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: DiagnosticCategory.Error, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: DiagnosticCategory.Error, key: "Supplied parameters do not match any signature of call target." }, @@ -204,7 +204,7 @@ module ts { The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { code: 2357, category: DiagnosticCategory.Error, key: "The operand of an increment or decrement operator must be a variable, property or indexer." }, The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: DiagnosticCategory.Error, key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: DiagnosticCategory.Error, key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." }, - The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number: { code: 2360, category: DiagnosticCategory.Error, key: "The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'." }, + The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { code: 2360, category: DiagnosticCategory.Error, key: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." }, The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: DiagnosticCategory.Error, key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" }, The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: DiagnosticCategory.Error, key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: DiagnosticCategory.Error, key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, @@ -299,20 +299,24 @@ module ts { Type_0_is_not_an_array_type: { code: 2461, category: DiagnosticCategory.Error, key: "Type '{0}' is not an array type." }, A_rest_element_must_be_last_in_an_array_destructuring_pattern: { code: 2462, category: DiagnosticCategory.Error, key: "A rest element must be last in an array destructuring pattern" }, A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: DiagnosticCategory.Error, key: "A binding pattern parameter cannot be optional in an implementation signature." }, - A_computed_property_name_must_be_of_type_string_number_or_any: { code: 2464, category: DiagnosticCategory.Error, key: "A computed property name must be of type 'string', 'number', or 'any'." }, + A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { code: 2464, category: DiagnosticCategory.Error, key: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." }, this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: DiagnosticCategory.Error, key: "'this' cannot be referenced in a computed property name." }, super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: DiagnosticCategory.Error, key: "'super' cannot be referenced in a computed property name." }, - A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2466, category: DiagnosticCategory.Error, key: "A computed property name cannot reference a type parameter from its containing type." }, - Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { code: 2468, category: DiagnosticCategory.Error, key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." }, - Enum_declarations_must_all_be_const_or_non_const: { code: 2469, category: DiagnosticCategory.Error, key: "Enum declarations must all be const or non-const." }, - In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 2470, category: DiagnosticCategory.Error, key: "In 'const' enum declarations member initializer must be constant expression." }, - const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 2471, category: DiagnosticCategory.Error, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, - A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 2472, category: DiagnosticCategory.Error, key: "A const enum member can only be accessed using a string literal." }, - const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 2473, category: DiagnosticCategory.Error, key: "'const' enum member initializer was evaluated to a non-finite value." }, - const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 2474, category: DiagnosticCategory.Error, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, - Property_0_does_not_exist_on_const_enum_1: { code: 2475, category: DiagnosticCategory.Error, key: "Property '{0}' does not exist on 'const' enum '{1}'." }, - let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2476, category: DiagnosticCategory.Error, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, - Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2477, category: DiagnosticCategory.Error, key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, + A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2467, category: DiagnosticCategory.Error, key: "A computed property name cannot reference a type parameter from its containing type." }, + Cannot_find_global_value_0: { code: 2468, category: DiagnosticCategory.Error, key: "Cannot find global value '{0}'." }, + The_0_operator_cannot_be_applied_to_type_symbol: { code: 2469, category: DiagnosticCategory.Error, key: "The '{0}' operator cannot be applied to type 'symbol'." }, + Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { code: 2470, category: DiagnosticCategory.Error, key: "'Symbol' reference does not refer to the global Symbol constructor object." }, + A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { code: 2471, category: DiagnosticCategory.Error, key: "A computed property name of the form '{0}' must be of type 'symbol'." }, + Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { code: 2472, category: DiagnosticCategory.Error, key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." }, + Enum_declarations_must_all_be_const_or_non_const: { code: 2473, category: DiagnosticCategory.Error, key: "Enum declarations must all be const or non-const." }, + In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 2474, category: DiagnosticCategory.Error, key: "In 'const' enum declarations member initializer must be constant expression." }, + const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 2475, category: DiagnosticCategory.Error, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, + A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 2476, category: DiagnosticCategory.Error, key: "A const enum member can only be accessed using a string literal." }, + const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 2477, category: DiagnosticCategory.Error, key: "'const' enum member initializer was evaluated to a non-finite value." }, + const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 2478, category: DiagnosticCategory.Error, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, + Property_0_does_not_exist_on_const_enum_1: { code: 2479, category: DiagnosticCategory.Error, key: "Property '{0}' does not exist on 'const' enum '{1}'." }, + let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2480, category: DiagnosticCategory.Error, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, + Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: DiagnosticCategory.Error, key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 8299e9f773300..37a67c94a2b4c 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -483,11 +483,11 @@ "category": "Error", "code": 1164 }, - "Computed property names are not allowed in an ambient context.": { + "A computed property name in an ambient context must directly refer to a built-in symbol.": { "category": "Error", "code": 1165 }, - "Computed property names are not allowed in class property declarations.": { + "A computed property name in a class property declaration must directly refer to a built-in symbol.": { "category": "Error", "code": 1166 }, @@ -495,15 +495,15 @@ "category": "Error", "code": 1167 }, - "Computed property names are not allowed in method overloads.": { + "A computed property name in a method overload must directly refer to a built-in symbol.": { "category": "Error", "code": 1168 }, - "Computed property names are not allowed in interfaces.": { + "A computed property name in an interface must directly refer to a built-in symbol.": { "category": "Error", "code": 1169 }, - "Computed property names are not allowed in type literals.": { + "A computed property name in a type literal must directly refer to a built-in symbol.": { "category": "Error", "code": 1170 }, @@ -656,7 +656,7 @@ "category": "Error", "code": 2318 }, - "Named properties '{0}' of types '{1}' and '{2}' are not identical.": { + "Named property '{0}' of types '{1}' and '{2}' are not identical.": { "category": "Error", "code": 2319 }, @@ -744,7 +744,7 @@ "category": "Error", "code": 2341 }, - "An index expression argument must be of type 'string', 'number', or 'any'.": { + "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'.": { "category": "Error", "code": 2342 }, @@ -808,7 +808,7 @@ "category": "Error", "code": 2359 }, - "The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.": { + "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'.": { "category": "Error", "code": 2360 }, @@ -1188,7 +1188,7 @@ "category": "Error", "code": 2463 }, - "A computed property name must be of type 'string', 'number', or 'any'.": { + "A computed property name must be of type 'string', 'number', 'symbol', or 'any'.": { "category": "Error", "code": 2464 }, @@ -1202,48 +1202,64 @@ }, "A computed property name cannot reference a type parameter from its containing type.": { "category": "Error", - "code": 2466 + "code": 2467 }, - "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher.": { + "Cannot find global value '{0}'.": { "category": "Error", "code": 2468 }, - "Enum declarations must all be const or non-const.": { + "The '{0}' operator cannot be applied to type 'symbol'.": { "category": "Error", "code": 2469 }, - "In 'const' enum declarations member initializer must be constant expression.": { + "'Symbol' reference does not refer to the global Symbol constructor object.": { "category": "Error", "code": 2470 }, - "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.": { + "A computed property name of the form '{0}' must be of type 'symbol'.": { "category": "Error", "code": 2471 }, - "A const enum member can only be accessed using a string literal.": { + "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher.": { "category": "Error", "code": 2472 }, - "'const' enum member initializer was evaluated to a non-finite value.": { + "Enum declarations must all be const or non-const.": { "category": "Error", "code": 2473 }, - "'const' enum member initializer was evaluated to disallowed value 'NaN'.": { + "In 'const' enum declarations member initializer must be constant expression.": { "category": "Error", "code": 2474 }, - "Property '{0}' does not exist on 'const' enum '{1}'.": { + "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.": { "category": "Error", "code": 2475 }, - "'let' is not allowed to be used as a name in 'let' or 'const' declarations.": { + "A const enum member can only be accessed using a string literal.": { "category": "Error", "code": 2476 }, - "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'.": { + "'const' enum member initializer was evaluated to a non-finite value.": { "category": "Error", "code": 2477 }, + "'const' enum member initializer was evaluated to disallowed value 'NaN'.": { + "category": "Error", + "code": 2478 + }, + "Property '{0}' does not exist on 'const' enum '{1}'.": { + "category": "Error", + "code": 2479 + }, + "'let' is not allowed to be used as a name in 'let' or 'const' declarations.": { + "category": "Error", + "code": 2480 + }, + "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'.": { + "category": "Error", + "code": 2481 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 6a2338268e899..ddf17f8d0d650 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -275,7 +275,7 @@ module ts { var firstAccessor: AccessorDeclaration; var getAccessor: AccessorDeclaration; var setAccessor: AccessorDeclaration; - if (accessor.name.kind === SyntaxKind.ComputedPropertyName) { + if (hasDynamicName(accessor)) { firstAccessor = accessor; if (accessor.kind === SyntaxKind.GetAccessor) { getAccessor = accessor; @@ -289,19 +289,22 @@ module ts { } else { forEach(node.members,(member: Declaration) => { - if ((member.kind === SyntaxKind.GetAccessor || member.kind === SyntaxKind.SetAccessor) && - (member.name).text === (accessor.name).text && - (member.flags & NodeFlags.Static) === (accessor.flags & NodeFlags.Static)) { - if (!firstAccessor) { - firstAccessor = member; - } + if ((member.kind === SyntaxKind.GetAccessor || member.kind === SyntaxKind.SetAccessor) + && (member.flags & NodeFlags.Static) === (accessor.flags & NodeFlags.Static)) { + var memberName = getPropertyNameForPropertyNameNode(member.name); + var accessorName = getPropertyNameForPropertyNameNode(accessor.name); + if (memberName === accessorName) { + if (!firstAccessor) { + firstAccessor = member; + } - if (member.kind === SyntaxKind.GetAccessor && !getAccessor) { - getAccessor = member; - } + if (member.kind === SyntaxKind.GetAccessor && !getAccessor) { + getAccessor = member; + } - if (member.kind === SyntaxKind.SetAccessor && !setAccessor) { - setAccessor = member; + if (member.kind === SyntaxKind.SetAccessor && !setAccessor) { + setAccessor = member; + } } } }); @@ -579,6 +582,7 @@ module ts { case SyntaxKind.StringKeyword: case SyntaxKind.NumberKeyword: case SyntaxKind.BooleanKeyword: + case SyntaxKind.SymbolKeyword: case SyntaxKind.VoidKeyword: case SyntaxKind.StringLiteral: return writeTextOfNode(currentSourceFile, type); diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 630418dc485ac..9b3c01cf0f07d 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -2593,6 +2593,7 @@ module ts { case SyntaxKind.StringKeyword: case SyntaxKind.NumberKeyword: case SyntaxKind.BooleanKeyword: + case SyntaxKind.SymbolKeyword: // If these are followed by a dot, then parse these out as a dotted type reference instead. var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReference(); @@ -2617,6 +2618,7 @@ module ts { case SyntaxKind.StringKeyword: case SyntaxKind.NumberKeyword: case SyntaxKind.BooleanKeyword: + case SyntaxKind.SymbolKeyword: case SyntaxKind.VoidKeyword: case SyntaxKind.TypeOfKeyword: case SyntaxKind.OpenBraceToken: diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index fbbd69bbd6924..f85df69f026e6 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -82,6 +82,7 @@ module ts { "string": SyntaxKind.StringKeyword, "super": SyntaxKind.SuperKeyword, "switch": SyntaxKind.SwitchKeyword, + "symbol": SyntaxKind.SymbolKeyword, "this": SyntaxKind.ThisKeyword, "throw": SyntaxKind.ThrowKeyword, "true": SyntaxKind.TrueKeyword, diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 12c5af21e1298..72ef66e3fe1c2 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -140,6 +140,7 @@ module ts { NumberKeyword, SetKeyword, StringKeyword, + SymbolKeyword, TypeKeyword, // Parse tree nodes @@ -1298,9 +1299,10 @@ module ts { ObjectLiteral = 0x00020000, // Originates in an object literal ContainsUndefinedOrNull = 0x00040000, // Type is or contains Undefined or Null type ContainsObjectLiteral = 0x00080000, // Type is or contains object literal type + ESSymbol = 0x00100000, // Type of symbol primitive introduced in ES6 - Intrinsic = Any | String | Number | Boolean | Void | Undefined | Null, - Primitive = String | Number | Boolean | Void | Undefined | Null | StringLiteral | Enum, + Intrinsic = Any | String | Number | Boolean | ESSymbol | Void | Undefined | Null, + Primitive = String | Number | Boolean | ESSymbol | Void | Undefined | Null | StringLiteral | Enum, StringLike = String | StringLiteral, NumberLike = Number | Enum, ObjectType = Class | Interface | Reference | Tuple | Anonymous, diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 5a50e2799dc7c..0656bed7d5fbf 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -835,6 +835,54 @@ module ts { return SyntaxKind.FirstTriviaToken <= token && token <= SyntaxKind.LastTriviaToken; } + /** + * A declaration has a dynamic name if both of the following are true: + * 1. The declaration has a computed property name + * 2. The computed name is *not* expressed as Symbol., where name + * is a property of the Symbol constructor that denotes a built in + * Symbol. + */ + export function hasDynamicName(declaration: Declaration): boolean { + return declaration.name && + declaration.name.kind === SyntaxKind.ComputedPropertyName && + !isWellKnownSymbolSyntactically((declaration.name).expression); + } + + /** + * Checks if the expression is of the form: + * Symbol.name + * where Symbol is literally the word "Symbol", and name is any identifierName + */ + export function isWellKnownSymbolSyntactically(node: Expression): boolean { + return node.kind === SyntaxKind.PropertyAccessExpression && isESSymbolIdentifier((node).expression); + } + + export function getPropertyNameForPropertyNameNode(name: DeclarationName): string { + if (name.kind === SyntaxKind.Identifier || name.kind === SyntaxKind.StringLiteral || name.kind === SyntaxKind.NumericLiteral) { + return (name).text; + } + if (name.kind === SyntaxKind.ComputedPropertyName) { + var nameExpression = (name).expression; + if (isWellKnownSymbolSyntactically(nameExpression)) { + var rightHandSideName = (nameExpression).name.text; + return getPropertyNameForKnownSymbolName(rightHandSideName); + } + } + + return undefined; + } + + export function getPropertyNameForKnownSymbolName(symbolName: string): string { + return "__@" + symbolName; + } + + /** + * Includes the word "Symbol" with unicode escapes + */ + export function isESSymbolIdentifier(node: Node): boolean { + return node.kind === SyntaxKind.Identifier && (node).text === "Symbol"; + } + export function isModifier(token: SyntaxKind): boolean { switch (token) { case SyntaxKind.PublicKeyword: diff --git a/src/lib/es6.d.ts b/src/lib/es6.d.ts index b666b11b96946..50238e94bb4f9 100644 --- a/src/lib/es6.d.ts +++ b/src/lib/es6.d.ts @@ -1,4 +1,4 @@ -declare type PropertyKey = string | number | Symbol; +declare type PropertyKey = string | number | symbol; interface Symbol { /** Returns a string representation of an object. */ @@ -7,7 +7,7 @@ interface Symbol { /** Returns the primitive value of the specified object. */ valueOf(): Object; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface SymbolConstructor { @@ -20,21 +20,21 @@ interface SymbolConstructor { * Returns a new unique Symbol value. * @param description Description of the new Symbol object. */ - (description?: string|number): Symbol; + (description?: string|number): symbol; /** * Returns a Symbol object from the global symbol registry matching the given key if found. * Otherwise, returns a new symbol with this key. * @param key key to search for. */ - for(key: string): Symbol; + for(key: string): symbol; /** * Returns a key from the global symbol registry matching the given Symbol if found. * Otherwise, returns a undefined. * @param sym Symbol to find the key for. */ - keyFor(sym: Symbol): string; + keyFor(sym: symbol): string; // Well-known Symbols @@ -42,42 +42,42 @@ interface SymbolConstructor { * A method that determines if a constructor object recognizes an object as one of the * constructor’s instances. Called by the semantics of the instanceof operator. */ - hasInstance: Symbol; + hasInstance: symbol; /** * A Boolean value that if true indicates that an object should flatten to its array elements * by Array.prototype.concat. */ - isConcatSpreadable: Symbol; + isConcatSpreadable: symbol; /** * A Boolean value that if true indicates that an object may be used as a regular expression. */ - isRegExp: Symbol; + isRegExp: symbol; /** * A method that returns the default iterator for an object.Called by the semantics of the * for-of statement. */ - iterator: Symbol; + iterator: symbol; /** * A method that converts an object to a corresponding primitive value.Called by the ToPrimitive * abstract operation. */ - toPrimitive: Symbol; + toPrimitive: symbol; /** * A String value that is used in the creation of the default string description of an object. * Called by the built- in method Object.prototype.toString. */ - toStringTag: Symbol; + toStringTag: symbol; /** * An Object whose own property names are property names that are excluded from the with * environment bindings of the associated objects. */ - unscopables: Symbol; + unscopables: symbol; } declare var Symbol: SymbolConstructor; @@ -108,7 +108,7 @@ interface ObjectConstructor { * Returns an array of all symbol properties found directly on object o. * @param o Object to retrieve the symbols from. */ - getOwnPropertySymbols(o: any): Symbol[]; + getOwnPropertySymbols(o: any): symbol[]; /** * Returns true if the values are the same value, false otherwise. @@ -230,7 +230,7 @@ interface ArrayLike { interface Array { /** Iterator */ - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; /** * Returns an array of key, value pairs for every entry in the array @@ -329,7 +329,7 @@ interface ArrayConstructor { interface String { /** Iterator */ - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; /** * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point @@ -447,12 +447,12 @@ interface IteratorResult { } interface Iterator { - //[Symbol.iterator](): Iterator; + [Symbol.iterator](): Iterator; next(): IteratorResult; } interface Iterable { - //[Symbol.iterator](): Iterator; + [Symbol.iterator](): Iterator; } interface GeneratorFunction extends Function { @@ -474,7 +474,7 @@ interface Generator extends Iterator { next(value?: any): IteratorResult; throw (exception: any): IteratorResult; return (value: T): IteratorResult; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface Math { @@ -588,11 +588,11 @@ interface Math { */ cbrt(x: number): number; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface RegExp { - // [Symbol.isRegExp]: boolean; + [Symbol.isRegExp]: boolean; /** * Matches a string with a regular expression, and returns an array containing the results of @@ -649,8 +649,8 @@ interface Map { set(key: K, value?: V): Map; size: number; values(): Iterator; - // [Symbol.iterator]():Iterator<[K,V]>; - // [Symbol.toStringTag]: string; + [Symbol.iterator]():Iterator<[K,V]>; + [Symbol.toStringTag]: string; } interface MapConstructor { @@ -666,7 +666,7 @@ interface WeakMap { get(key: K): V; has(key: K): boolean; set(key: K, value?: V): WeakMap; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface WeakMapConstructor { @@ -686,8 +686,8 @@ interface Set { keys(): Iterator; size: number; values(): Iterator; - // [Symbol.iterator]():Iterator; - // [Symbol.toStringTag]: string; + [Symbol.iterator]():Iterator; + [Symbol.toStringTag]: string; } interface SetConstructor { @@ -702,7 +702,7 @@ interface WeakSet { clear(): void; delete(value: T): boolean; has(value: T): boolean; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface WeakSetConstructor { @@ -713,7 +713,7 @@ interface WeakSetConstructor { declare var WeakSet: WeakSetConstructor; interface JSON { - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } /** @@ -733,7 +733,7 @@ interface ArrayBuffer { */ slice(begin: number, end?: number): ArrayBuffer; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface ArrayBufferConstructor { @@ -870,7 +870,7 @@ interface DataView { */ setUint32(byteOffset: number, value: number, littleEndian: boolean): void; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface DataViewConstructor { @@ -1137,7 +1137,7 @@ interface Int8Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Int8ArrayConstructor { @@ -1427,7 +1427,7 @@ interface Uint8Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Uint8ArrayConstructor { @@ -1717,7 +1717,7 @@ interface Uint8ClampedArray { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Uint8ClampedArrayConstructor { @@ -2007,7 +2007,7 @@ interface Int16Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Int16ArrayConstructor { @@ -2297,7 +2297,7 @@ interface Uint16Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Uint16ArrayConstructor { @@ -2587,7 +2587,7 @@ interface Int32Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Int32ArrayConstructor { @@ -2877,7 +2877,7 @@ interface Uint32Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Uint32ArrayConstructor { @@ -3167,7 +3167,7 @@ interface Float32Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Float32ArrayConstructor { @@ -3457,7 +3457,7 @@ interface Float64Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Float64ArrayConstructor { @@ -3521,7 +3521,7 @@ declare var Reflect: { getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; getPrototypeOf(target: any): any; has(target: any, propertyKey: string): boolean; - has(target: any, propertyKey: Symbol): boolean; + has(target: any, propertyKey: symbol): boolean; isExtensible(target: any): boolean; ownKeys(target: any): Array; preventExtensions(target: any): boolean; diff --git a/src/services/formatting/tokenRange.ts b/src/services/formatting/tokenRange.ts index 61fcb26dc9be2..6dace543eab3b 100644 --- a/src/services/formatting/tokenRange.ts +++ b/src/services/formatting/tokenRange.ts @@ -134,7 +134,7 @@ module ts.formatting { static UnaryPredecrementExpressions = TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.OpenParenToken, SyntaxKind.ThisKeyword, SyntaxKind.NewKeyword]); static UnaryPostdecrementExpressions = TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.CloseParenToken, SyntaxKind.CloseBracketToken, SyntaxKind.NewKeyword]); static Comments = TokenRange.FromTokens([SyntaxKind.SingleLineCommentTrivia, SyntaxKind.MultiLineCommentTrivia]); - static TypeNames = TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.NumberKeyword, SyntaxKind.StringKeyword, SyntaxKind.BooleanKeyword, SyntaxKind.VoidKeyword, SyntaxKind.AnyKeyword]); + static TypeNames = TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.NumberKeyword, SyntaxKind.StringKeyword, SyntaxKind.BooleanKeyword, SyntaxKind.SymbolKeyword, SyntaxKind.VoidKeyword, SyntaxKind.AnyKeyword]); } } } \ No newline at end of file diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts index 771fe48219f1c..b254397f8b0cc 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -97,8 +97,7 @@ module ts.NavigationBar { function sortNodes(nodes: Node[]): Node[] { return nodes.slice(0).sort((n1: Declaration, n2: Declaration) => { if (n1.name && n2.name) { - // TODO(jfreeman): How do we sort declarations with computed names? - return (n1.name).text.localeCompare((n2.name).text); + return getPropertyNameForPropertyNameNode(n1.name).localeCompare(getPropertyNameForPropertyNameNode(n2.name)); } else if (n1.name) { return 1; @@ -426,7 +425,7 @@ module ts.NavigationBar { // Add the constructor parameters in as children of the class (for property parameters). // Note that *all* parameters will be added to the nodes array, but parameters that // are not properties will be filtered out later by createChildItem. - var nodes: Node[] = removeComputedProperties(node); + var nodes: Node[] = removeDynamicallyNamedProperties(node); if (constructor) { nodes.push.apply(nodes, constructor.parameters); } @@ -455,7 +454,7 @@ module ts.NavigationBar { } function createIterfaceItem(node: InterfaceDeclaration): ts.NavigationBarItem { - var childItems = getItemsWorker(sortNodes(removeComputedProperties(node)), createChildItem); + var childItems = getItemsWorker(sortNodes(removeDynamicallyNamedProperties(node)), createChildItem); return getNavigationBarItem( node.name.text, ts.ScriptElementKind.interfaceElement, @@ -466,10 +465,17 @@ module ts.NavigationBar { } } - function removeComputedProperties(node: ClassDeclaration | InterfaceDeclaration | EnumDeclaration): Declaration[] { + function removeComputedProperties(node: EnumDeclaration): Declaration[] { return filter(node.members, member => member.name === undefined || member.name.kind !== SyntaxKind.ComputedPropertyName); } + /** + * Like removeComputedProperties, but retains the properties with well known symbol names + */ + function removeDynamicallyNamedProperties(node: ClassDeclaration | InterfaceDeclaration): Declaration[]{ + return filter(node.members, member => !hasDynamicName(member)); + } + function getInnermostModule(node: ModuleDeclaration): ModuleDeclaration { while (node.body.kind === SyntaxKind.ModuleDeclaration) { node = node.body; diff --git a/src/services/services.ts b/src/services/services.ts index 767d1a7f09974..b4d539843073c 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -5797,7 +5797,8 @@ module ts { else if (token === SyntaxKind.AnyKeyword || token === SyntaxKind.StringKeyword || token === SyntaxKind.NumberKeyword || - token === SyntaxKind.BooleanKeyword) { + token === SyntaxKind.BooleanKeyword || + token === SyntaxKind.SymbolKeyword) { if (angleBracketStack > 0 && !syntacticClassifierAbsent) { // If it looks like we're could be in something generic, don't classify this // as a keyword. We may just get overwritten by the syntactic classifier, diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index b91a706aa4519..8afa0a5b939cb 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -179,110 +179,111 @@ declare module "typescript" { NumberKeyword = 117, SetKeyword = 118, StringKeyword = 119, - TypeKeyword = 120, - QualifiedName = 121, - ComputedPropertyName = 122, - TypeParameter = 123, - Parameter = 124, - PropertySignature = 125, - PropertyDeclaration = 126, - MethodSignature = 127, - MethodDeclaration = 128, - Constructor = 129, - GetAccessor = 130, - SetAccessor = 131, - CallSignature = 132, - ConstructSignature = 133, - IndexSignature = 134, - TypeReference = 135, - FunctionType = 136, - ConstructorType = 137, - TypeQuery = 138, - TypeLiteral = 139, - ArrayType = 140, - TupleType = 141, - UnionType = 142, - ParenthesizedType = 143, - ObjectBindingPattern = 144, - ArrayBindingPattern = 145, - BindingElement = 146, - ArrayLiteralExpression = 147, - ObjectLiteralExpression = 148, - PropertyAccessExpression = 149, - ElementAccessExpression = 150, - CallExpression = 151, - NewExpression = 152, - TaggedTemplateExpression = 153, - TypeAssertionExpression = 154, - ParenthesizedExpression = 155, - FunctionExpression = 156, - ArrowFunction = 157, - DeleteExpression = 158, - TypeOfExpression = 159, - VoidExpression = 160, - PrefixUnaryExpression = 161, - PostfixUnaryExpression = 162, - BinaryExpression = 163, - ConditionalExpression = 164, - TemplateExpression = 165, - YieldExpression = 166, - SpreadElementExpression = 167, - OmittedExpression = 168, - TemplateSpan = 169, - Block = 170, - VariableStatement = 171, - EmptyStatement = 172, - ExpressionStatement = 173, - IfStatement = 174, - DoStatement = 175, - WhileStatement = 176, - ForStatement = 177, - ForInStatement = 178, - ContinueStatement = 179, - BreakStatement = 180, - ReturnStatement = 181, - WithStatement = 182, - SwitchStatement = 183, - LabeledStatement = 184, - ThrowStatement = 185, - TryStatement = 186, - DebuggerStatement = 187, - VariableDeclaration = 188, - VariableDeclarationList = 189, - FunctionDeclaration = 190, - ClassDeclaration = 191, - InterfaceDeclaration = 192, - TypeAliasDeclaration = 193, - EnumDeclaration = 194, - ModuleDeclaration = 195, - ModuleBlock = 196, - ImportDeclaration = 197, - ExportAssignment = 198, - ExternalModuleReference = 199, - CaseClause = 200, - DefaultClause = 201, - HeritageClause = 202, - CatchClause = 203, - PropertyAssignment = 204, - ShorthandPropertyAssignment = 205, - EnumMember = 206, - SourceFile = 207, - SyntaxList = 208, - Count = 209, + SymbolKeyword = 120, + TypeKeyword = 121, + QualifiedName = 122, + ComputedPropertyName = 123, + TypeParameter = 124, + Parameter = 125, + PropertySignature = 126, + PropertyDeclaration = 127, + MethodSignature = 128, + MethodDeclaration = 129, + Constructor = 130, + GetAccessor = 131, + SetAccessor = 132, + CallSignature = 133, + ConstructSignature = 134, + IndexSignature = 135, + TypeReference = 136, + FunctionType = 137, + ConstructorType = 138, + TypeQuery = 139, + TypeLiteral = 140, + ArrayType = 141, + TupleType = 142, + UnionType = 143, + ParenthesizedType = 144, + ObjectBindingPattern = 145, + ArrayBindingPattern = 146, + BindingElement = 147, + ArrayLiteralExpression = 148, + ObjectLiteralExpression = 149, + PropertyAccessExpression = 150, + ElementAccessExpression = 151, + CallExpression = 152, + NewExpression = 153, + TaggedTemplateExpression = 154, + TypeAssertionExpression = 155, + ParenthesizedExpression = 156, + FunctionExpression = 157, + ArrowFunction = 158, + DeleteExpression = 159, + TypeOfExpression = 160, + VoidExpression = 161, + PrefixUnaryExpression = 162, + PostfixUnaryExpression = 163, + BinaryExpression = 164, + ConditionalExpression = 165, + TemplateExpression = 166, + YieldExpression = 167, + SpreadElementExpression = 168, + OmittedExpression = 169, + TemplateSpan = 170, + Block = 171, + VariableStatement = 172, + EmptyStatement = 173, + ExpressionStatement = 174, + IfStatement = 175, + DoStatement = 176, + WhileStatement = 177, + ForStatement = 178, + ForInStatement = 179, + ContinueStatement = 180, + BreakStatement = 181, + ReturnStatement = 182, + WithStatement = 183, + SwitchStatement = 184, + LabeledStatement = 185, + ThrowStatement = 186, + TryStatement = 187, + DebuggerStatement = 188, + VariableDeclaration = 189, + VariableDeclarationList = 190, + FunctionDeclaration = 191, + ClassDeclaration = 192, + InterfaceDeclaration = 193, + TypeAliasDeclaration = 194, + EnumDeclaration = 195, + ModuleDeclaration = 196, + ModuleBlock = 197, + ImportDeclaration = 198, + ExportAssignment = 199, + ExternalModuleReference = 200, + CaseClause = 201, + DefaultClause = 202, + HeritageClause = 203, + CatchClause = 204, + PropertyAssignment = 205, + ShorthandPropertyAssignment = 206, + EnumMember = 207, + SourceFile = 208, + SyntaxList = 209, + Count = 210, FirstAssignment = 52, LastAssignment = 63, FirstReservedWord = 65, LastReservedWord = 100, FirstKeyword = 65, - LastKeyword = 120, + LastKeyword = 121, FirstFutureReservedWord = 101, LastFutureReservedWord = 109, - FirstTypeNode = 135, - LastTypeNode = 143, + FirstTypeNode = 136, + LastTypeNode = 144, FirstPunctuation = 14, LastPunctuation = 63, FirstToken = 0, - LastToken = 120, + LastToken = 121, FirstTriviaToken = 2, LastTriviaToken = 6, FirstLiteralToken = 7, @@ -291,7 +292,7 @@ declare module "typescript" { LastTemplateToken = 13, FirstBinaryOperator = 24, LastBinaryOperator = 63, - FirstNode = 121, + FirstNode = 122, } const enum NodeFlags { Export = 1, @@ -1031,8 +1032,9 @@ declare module "typescript" { ObjectLiteral = 131072, ContainsUndefinedOrNull = 262144, ContainsObjectLiteral = 524288, - Intrinsic = 127, - Primitive = 510, + ESSymbol = 1048576, + Intrinsic = 1048703, + Primitive = 1049086, StringLike = 258, NumberLike = 132, ObjectType = 48128, diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index ae53c66680708..e2ccc04a7c319 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -553,274 +553,277 @@ declare module "typescript" { StringKeyword = 119, >StringKeyword : SyntaxKind - TypeKeyword = 120, + SymbolKeyword = 120, +>SymbolKeyword : SyntaxKind + + TypeKeyword = 121, >TypeKeyword : SyntaxKind - QualifiedName = 121, + QualifiedName = 122, >QualifiedName : SyntaxKind - ComputedPropertyName = 122, + ComputedPropertyName = 123, >ComputedPropertyName : SyntaxKind - TypeParameter = 123, + TypeParameter = 124, >TypeParameter : SyntaxKind - Parameter = 124, + Parameter = 125, >Parameter : SyntaxKind - PropertySignature = 125, + PropertySignature = 126, >PropertySignature : SyntaxKind - PropertyDeclaration = 126, + PropertyDeclaration = 127, >PropertyDeclaration : SyntaxKind - MethodSignature = 127, + MethodSignature = 128, >MethodSignature : SyntaxKind - MethodDeclaration = 128, + MethodDeclaration = 129, >MethodDeclaration : SyntaxKind - Constructor = 129, + Constructor = 130, >Constructor : SyntaxKind - GetAccessor = 130, + GetAccessor = 131, >GetAccessor : SyntaxKind - SetAccessor = 131, + SetAccessor = 132, >SetAccessor : SyntaxKind - CallSignature = 132, + CallSignature = 133, >CallSignature : SyntaxKind - ConstructSignature = 133, + ConstructSignature = 134, >ConstructSignature : SyntaxKind - IndexSignature = 134, + IndexSignature = 135, >IndexSignature : SyntaxKind - TypeReference = 135, + TypeReference = 136, >TypeReference : SyntaxKind - FunctionType = 136, + FunctionType = 137, >FunctionType : SyntaxKind - ConstructorType = 137, + ConstructorType = 138, >ConstructorType : SyntaxKind - TypeQuery = 138, + TypeQuery = 139, >TypeQuery : SyntaxKind - TypeLiteral = 139, + TypeLiteral = 140, >TypeLiteral : SyntaxKind - ArrayType = 140, + ArrayType = 141, >ArrayType : SyntaxKind - TupleType = 141, + TupleType = 142, >TupleType : SyntaxKind - UnionType = 142, + UnionType = 143, >UnionType : SyntaxKind - ParenthesizedType = 143, + ParenthesizedType = 144, >ParenthesizedType : SyntaxKind - ObjectBindingPattern = 144, + ObjectBindingPattern = 145, >ObjectBindingPattern : SyntaxKind - ArrayBindingPattern = 145, + ArrayBindingPattern = 146, >ArrayBindingPattern : SyntaxKind - BindingElement = 146, + BindingElement = 147, >BindingElement : SyntaxKind - ArrayLiteralExpression = 147, + ArrayLiteralExpression = 148, >ArrayLiteralExpression : SyntaxKind - ObjectLiteralExpression = 148, + ObjectLiteralExpression = 149, >ObjectLiteralExpression : SyntaxKind - PropertyAccessExpression = 149, + PropertyAccessExpression = 150, >PropertyAccessExpression : SyntaxKind - ElementAccessExpression = 150, + ElementAccessExpression = 151, >ElementAccessExpression : SyntaxKind - CallExpression = 151, + CallExpression = 152, >CallExpression : SyntaxKind - NewExpression = 152, + NewExpression = 153, >NewExpression : SyntaxKind - TaggedTemplateExpression = 153, + TaggedTemplateExpression = 154, >TaggedTemplateExpression : SyntaxKind - TypeAssertionExpression = 154, + TypeAssertionExpression = 155, >TypeAssertionExpression : SyntaxKind - ParenthesizedExpression = 155, + ParenthesizedExpression = 156, >ParenthesizedExpression : SyntaxKind - FunctionExpression = 156, + FunctionExpression = 157, >FunctionExpression : SyntaxKind - ArrowFunction = 157, + ArrowFunction = 158, >ArrowFunction : SyntaxKind - DeleteExpression = 158, + DeleteExpression = 159, >DeleteExpression : SyntaxKind - TypeOfExpression = 159, + TypeOfExpression = 160, >TypeOfExpression : SyntaxKind - VoidExpression = 160, + VoidExpression = 161, >VoidExpression : SyntaxKind - PrefixUnaryExpression = 161, + PrefixUnaryExpression = 162, >PrefixUnaryExpression : SyntaxKind - PostfixUnaryExpression = 162, + PostfixUnaryExpression = 163, >PostfixUnaryExpression : SyntaxKind - BinaryExpression = 163, + BinaryExpression = 164, >BinaryExpression : SyntaxKind - ConditionalExpression = 164, + ConditionalExpression = 165, >ConditionalExpression : SyntaxKind - TemplateExpression = 165, + TemplateExpression = 166, >TemplateExpression : SyntaxKind - YieldExpression = 166, + YieldExpression = 167, >YieldExpression : SyntaxKind - SpreadElementExpression = 167, + SpreadElementExpression = 168, >SpreadElementExpression : SyntaxKind - OmittedExpression = 168, + OmittedExpression = 169, >OmittedExpression : SyntaxKind - TemplateSpan = 169, + TemplateSpan = 170, >TemplateSpan : SyntaxKind - Block = 170, + Block = 171, >Block : SyntaxKind - VariableStatement = 171, + VariableStatement = 172, >VariableStatement : SyntaxKind - EmptyStatement = 172, + EmptyStatement = 173, >EmptyStatement : SyntaxKind - ExpressionStatement = 173, + ExpressionStatement = 174, >ExpressionStatement : SyntaxKind - IfStatement = 174, + IfStatement = 175, >IfStatement : SyntaxKind - DoStatement = 175, + DoStatement = 176, >DoStatement : SyntaxKind - WhileStatement = 176, + WhileStatement = 177, >WhileStatement : SyntaxKind - ForStatement = 177, + ForStatement = 178, >ForStatement : SyntaxKind - ForInStatement = 178, + ForInStatement = 179, >ForInStatement : SyntaxKind - ContinueStatement = 179, + ContinueStatement = 180, >ContinueStatement : SyntaxKind - BreakStatement = 180, + BreakStatement = 181, >BreakStatement : SyntaxKind - ReturnStatement = 181, + ReturnStatement = 182, >ReturnStatement : SyntaxKind - WithStatement = 182, + WithStatement = 183, >WithStatement : SyntaxKind - SwitchStatement = 183, + SwitchStatement = 184, >SwitchStatement : SyntaxKind - LabeledStatement = 184, + LabeledStatement = 185, >LabeledStatement : SyntaxKind - ThrowStatement = 185, + ThrowStatement = 186, >ThrowStatement : SyntaxKind - TryStatement = 186, + TryStatement = 187, >TryStatement : SyntaxKind - DebuggerStatement = 187, + DebuggerStatement = 188, >DebuggerStatement : SyntaxKind - VariableDeclaration = 188, + VariableDeclaration = 189, >VariableDeclaration : SyntaxKind - VariableDeclarationList = 189, + VariableDeclarationList = 190, >VariableDeclarationList : SyntaxKind - FunctionDeclaration = 190, + FunctionDeclaration = 191, >FunctionDeclaration : SyntaxKind - ClassDeclaration = 191, + ClassDeclaration = 192, >ClassDeclaration : SyntaxKind - InterfaceDeclaration = 192, + InterfaceDeclaration = 193, >InterfaceDeclaration : SyntaxKind - TypeAliasDeclaration = 193, + TypeAliasDeclaration = 194, >TypeAliasDeclaration : SyntaxKind - EnumDeclaration = 194, + EnumDeclaration = 195, >EnumDeclaration : SyntaxKind - ModuleDeclaration = 195, + ModuleDeclaration = 196, >ModuleDeclaration : SyntaxKind - ModuleBlock = 196, + ModuleBlock = 197, >ModuleBlock : SyntaxKind - ImportDeclaration = 197, + ImportDeclaration = 198, >ImportDeclaration : SyntaxKind - ExportAssignment = 198, + ExportAssignment = 199, >ExportAssignment : SyntaxKind - ExternalModuleReference = 199, + ExternalModuleReference = 200, >ExternalModuleReference : SyntaxKind - CaseClause = 200, + CaseClause = 201, >CaseClause : SyntaxKind - DefaultClause = 201, + DefaultClause = 202, >DefaultClause : SyntaxKind - HeritageClause = 202, + HeritageClause = 203, >HeritageClause : SyntaxKind - CatchClause = 203, + CatchClause = 204, >CatchClause : SyntaxKind - PropertyAssignment = 204, + PropertyAssignment = 205, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 205, + ShorthandPropertyAssignment = 206, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 206, + EnumMember = 207, >EnumMember : SyntaxKind - SourceFile = 207, + SourceFile = 208, >SourceFile : SyntaxKind - SyntaxList = 208, + SyntaxList = 209, >SyntaxList : SyntaxKind - Count = 209, + Count = 210, >Count : SyntaxKind FirstAssignment = 52, @@ -838,7 +841,7 @@ declare module "typescript" { FirstKeyword = 65, >FirstKeyword : SyntaxKind - LastKeyword = 120, + LastKeyword = 121, >LastKeyword : SyntaxKind FirstFutureReservedWord = 101, @@ -847,10 +850,10 @@ declare module "typescript" { LastFutureReservedWord = 109, >LastFutureReservedWord : SyntaxKind - FirstTypeNode = 135, + FirstTypeNode = 136, >FirstTypeNode : SyntaxKind - LastTypeNode = 143, + LastTypeNode = 144, >LastTypeNode : SyntaxKind FirstPunctuation = 14, @@ -862,7 +865,7 @@ declare module "typescript" { FirstToken = 0, >FirstToken : SyntaxKind - LastToken = 120, + LastToken = 121, >LastToken : SyntaxKind FirstTriviaToken = 2, @@ -889,7 +892,7 @@ declare module "typescript" { LastBinaryOperator = 63, >LastBinaryOperator : SyntaxKind - FirstNode = 121, + FirstNode = 122, >FirstNode : SyntaxKind } const enum NodeFlags { @@ -3318,10 +3321,13 @@ declare module "typescript" { ContainsObjectLiteral = 524288, >ContainsObjectLiteral : TypeFlags - Intrinsic = 127, + ESSymbol = 1048576, +>ESSymbol : TypeFlags + + Intrinsic = 1048703, >Intrinsic : TypeFlags - Primitive = 510, + Primitive = 1049086, >Primitive : TypeFlags StringLike = 258, diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index 68c13edb7dbca..74ec089e0d07e 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -210,110 +210,111 @@ declare module "typescript" { NumberKeyword = 117, SetKeyword = 118, StringKeyword = 119, - TypeKeyword = 120, - QualifiedName = 121, - ComputedPropertyName = 122, - TypeParameter = 123, - Parameter = 124, - PropertySignature = 125, - PropertyDeclaration = 126, - MethodSignature = 127, - MethodDeclaration = 128, - Constructor = 129, - GetAccessor = 130, - SetAccessor = 131, - CallSignature = 132, - ConstructSignature = 133, - IndexSignature = 134, - TypeReference = 135, - FunctionType = 136, - ConstructorType = 137, - TypeQuery = 138, - TypeLiteral = 139, - ArrayType = 140, - TupleType = 141, - UnionType = 142, - ParenthesizedType = 143, - ObjectBindingPattern = 144, - ArrayBindingPattern = 145, - BindingElement = 146, - ArrayLiteralExpression = 147, - ObjectLiteralExpression = 148, - PropertyAccessExpression = 149, - ElementAccessExpression = 150, - CallExpression = 151, - NewExpression = 152, - TaggedTemplateExpression = 153, - TypeAssertionExpression = 154, - ParenthesizedExpression = 155, - FunctionExpression = 156, - ArrowFunction = 157, - DeleteExpression = 158, - TypeOfExpression = 159, - VoidExpression = 160, - PrefixUnaryExpression = 161, - PostfixUnaryExpression = 162, - BinaryExpression = 163, - ConditionalExpression = 164, - TemplateExpression = 165, - YieldExpression = 166, - SpreadElementExpression = 167, - OmittedExpression = 168, - TemplateSpan = 169, - Block = 170, - VariableStatement = 171, - EmptyStatement = 172, - ExpressionStatement = 173, - IfStatement = 174, - DoStatement = 175, - WhileStatement = 176, - ForStatement = 177, - ForInStatement = 178, - ContinueStatement = 179, - BreakStatement = 180, - ReturnStatement = 181, - WithStatement = 182, - SwitchStatement = 183, - LabeledStatement = 184, - ThrowStatement = 185, - TryStatement = 186, - DebuggerStatement = 187, - VariableDeclaration = 188, - VariableDeclarationList = 189, - FunctionDeclaration = 190, - ClassDeclaration = 191, - InterfaceDeclaration = 192, - TypeAliasDeclaration = 193, - EnumDeclaration = 194, - ModuleDeclaration = 195, - ModuleBlock = 196, - ImportDeclaration = 197, - ExportAssignment = 198, - ExternalModuleReference = 199, - CaseClause = 200, - DefaultClause = 201, - HeritageClause = 202, - CatchClause = 203, - PropertyAssignment = 204, - ShorthandPropertyAssignment = 205, - EnumMember = 206, - SourceFile = 207, - SyntaxList = 208, - Count = 209, + SymbolKeyword = 120, + TypeKeyword = 121, + QualifiedName = 122, + ComputedPropertyName = 123, + TypeParameter = 124, + Parameter = 125, + PropertySignature = 126, + PropertyDeclaration = 127, + MethodSignature = 128, + MethodDeclaration = 129, + Constructor = 130, + GetAccessor = 131, + SetAccessor = 132, + CallSignature = 133, + ConstructSignature = 134, + IndexSignature = 135, + TypeReference = 136, + FunctionType = 137, + ConstructorType = 138, + TypeQuery = 139, + TypeLiteral = 140, + ArrayType = 141, + TupleType = 142, + UnionType = 143, + ParenthesizedType = 144, + ObjectBindingPattern = 145, + ArrayBindingPattern = 146, + BindingElement = 147, + ArrayLiteralExpression = 148, + ObjectLiteralExpression = 149, + PropertyAccessExpression = 150, + ElementAccessExpression = 151, + CallExpression = 152, + NewExpression = 153, + TaggedTemplateExpression = 154, + TypeAssertionExpression = 155, + ParenthesizedExpression = 156, + FunctionExpression = 157, + ArrowFunction = 158, + DeleteExpression = 159, + TypeOfExpression = 160, + VoidExpression = 161, + PrefixUnaryExpression = 162, + PostfixUnaryExpression = 163, + BinaryExpression = 164, + ConditionalExpression = 165, + TemplateExpression = 166, + YieldExpression = 167, + SpreadElementExpression = 168, + OmittedExpression = 169, + TemplateSpan = 170, + Block = 171, + VariableStatement = 172, + EmptyStatement = 173, + ExpressionStatement = 174, + IfStatement = 175, + DoStatement = 176, + WhileStatement = 177, + ForStatement = 178, + ForInStatement = 179, + ContinueStatement = 180, + BreakStatement = 181, + ReturnStatement = 182, + WithStatement = 183, + SwitchStatement = 184, + LabeledStatement = 185, + ThrowStatement = 186, + TryStatement = 187, + DebuggerStatement = 188, + VariableDeclaration = 189, + VariableDeclarationList = 190, + FunctionDeclaration = 191, + ClassDeclaration = 192, + InterfaceDeclaration = 193, + TypeAliasDeclaration = 194, + EnumDeclaration = 195, + ModuleDeclaration = 196, + ModuleBlock = 197, + ImportDeclaration = 198, + ExportAssignment = 199, + ExternalModuleReference = 200, + CaseClause = 201, + DefaultClause = 202, + HeritageClause = 203, + CatchClause = 204, + PropertyAssignment = 205, + ShorthandPropertyAssignment = 206, + EnumMember = 207, + SourceFile = 208, + SyntaxList = 209, + Count = 210, FirstAssignment = 52, LastAssignment = 63, FirstReservedWord = 65, LastReservedWord = 100, FirstKeyword = 65, - LastKeyword = 120, + LastKeyword = 121, FirstFutureReservedWord = 101, LastFutureReservedWord = 109, - FirstTypeNode = 135, - LastTypeNode = 143, + FirstTypeNode = 136, + LastTypeNode = 144, FirstPunctuation = 14, LastPunctuation = 63, FirstToken = 0, - LastToken = 120, + LastToken = 121, FirstTriviaToken = 2, LastTriviaToken = 6, FirstLiteralToken = 7, @@ -322,7 +323,7 @@ declare module "typescript" { LastTemplateToken = 13, FirstBinaryOperator = 24, LastBinaryOperator = 63, - FirstNode = 121, + FirstNode = 122, } const enum NodeFlags { Export = 1, @@ -1062,8 +1063,9 @@ declare module "typescript" { ObjectLiteral = 131072, ContainsUndefinedOrNull = 262144, ContainsObjectLiteral = 524288, - Intrinsic = 127, - Primitive = 510, + ESSymbol = 1048576, + Intrinsic = 1048703, + Primitive = 1049086, StringLike = 258, NumberLike = 132, ObjectType = 48128, @@ -1976,24 +1978,24 @@ function delint(sourceFile) { delintNode(sourceFile); function delintNode(node) { switch (node.kind) { - case 177 /* ForStatement */: - case 178 /* ForInStatement */: - case 176 /* WhileStatement */: - case 175 /* DoStatement */: - if (node.statement.kind !== 170 /* Block */) { + case 178 /* ForStatement */: + case 179 /* ForInStatement */: + case 177 /* WhileStatement */: + case 176 /* DoStatement */: + if (node.statement.kind !== 171 /* Block */) { report(node, "A looping statement's contents should be wrapped in a block body."); } break; - case 174 /* IfStatement */: + case 175 /* IfStatement */: var ifStatement = node; - if (ifStatement.thenStatement.kind !== 170 /* Block */) { + if (ifStatement.thenStatement.kind !== 171 /* Block */) { report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body."); } - if (ifStatement.elseStatement && ifStatement.elseStatement.kind !== 170 /* Block */ && ifStatement.elseStatement.kind !== 174 /* IfStatement */) { + if (ifStatement.elseStatement && ifStatement.elseStatement.kind !== 171 /* Block */ && ifStatement.elseStatement.kind !== 175 /* IfStatement */) { report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body."); } break; - case 163 /* BinaryExpression */: + case 164 /* BinaryExpression */: var op = node.operator; if (op === 28 /* EqualsEqualsToken */ || op === 29 /* ExclamationEqualsToken */) { report(node, "Use '===' and '!=='."); diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index 0c153e7b1dc20..3e750b0314879 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -697,274 +697,277 @@ declare module "typescript" { StringKeyword = 119, >StringKeyword : SyntaxKind - TypeKeyword = 120, + SymbolKeyword = 120, +>SymbolKeyword : SyntaxKind + + TypeKeyword = 121, >TypeKeyword : SyntaxKind - QualifiedName = 121, + QualifiedName = 122, >QualifiedName : SyntaxKind - ComputedPropertyName = 122, + ComputedPropertyName = 123, >ComputedPropertyName : SyntaxKind - TypeParameter = 123, + TypeParameter = 124, >TypeParameter : SyntaxKind - Parameter = 124, + Parameter = 125, >Parameter : SyntaxKind - PropertySignature = 125, + PropertySignature = 126, >PropertySignature : SyntaxKind - PropertyDeclaration = 126, + PropertyDeclaration = 127, >PropertyDeclaration : SyntaxKind - MethodSignature = 127, + MethodSignature = 128, >MethodSignature : SyntaxKind - MethodDeclaration = 128, + MethodDeclaration = 129, >MethodDeclaration : SyntaxKind - Constructor = 129, + Constructor = 130, >Constructor : SyntaxKind - GetAccessor = 130, + GetAccessor = 131, >GetAccessor : SyntaxKind - SetAccessor = 131, + SetAccessor = 132, >SetAccessor : SyntaxKind - CallSignature = 132, + CallSignature = 133, >CallSignature : SyntaxKind - ConstructSignature = 133, + ConstructSignature = 134, >ConstructSignature : SyntaxKind - IndexSignature = 134, + IndexSignature = 135, >IndexSignature : SyntaxKind - TypeReference = 135, + TypeReference = 136, >TypeReference : SyntaxKind - FunctionType = 136, + FunctionType = 137, >FunctionType : SyntaxKind - ConstructorType = 137, + ConstructorType = 138, >ConstructorType : SyntaxKind - TypeQuery = 138, + TypeQuery = 139, >TypeQuery : SyntaxKind - TypeLiteral = 139, + TypeLiteral = 140, >TypeLiteral : SyntaxKind - ArrayType = 140, + ArrayType = 141, >ArrayType : SyntaxKind - TupleType = 141, + TupleType = 142, >TupleType : SyntaxKind - UnionType = 142, + UnionType = 143, >UnionType : SyntaxKind - ParenthesizedType = 143, + ParenthesizedType = 144, >ParenthesizedType : SyntaxKind - ObjectBindingPattern = 144, + ObjectBindingPattern = 145, >ObjectBindingPattern : SyntaxKind - ArrayBindingPattern = 145, + ArrayBindingPattern = 146, >ArrayBindingPattern : SyntaxKind - BindingElement = 146, + BindingElement = 147, >BindingElement : SyntaxKind - ArrayLiteralExpression = 147, + ArrayLiteralExpression = 148, >ArrayLiteralExpression : SyntaxKind - ObjectLiteralExpression = 148, + ObjectLiteralExpression = 149, >ObjectLiteralExpression : SyntaxKind - PropertyAccessExpression = 149, + PropertyAccessExpression = 150, >PropertyAccessExpression : SyntaxKind - ElementAccessExpression = 150, + ElementAccessExpression = 151, >ElementAccessExpression : SyntaxKind - CallExpression = 151, + CallExpression = 152, >CallExpression : SyntaxKind - NewExpression = 152, + NewExpression = 153, >NewExpression : SyntaxKind - TaggedTemplateExpression = 153, + TaggedTemplateExpression = 154, >TaggedTemplateExpression : SyntaxKind - TypeAssertionExpression = 154, + TypeAssertionExpression = 155, >TypeAssertionExpression : SyntaxKind - ParenthesizedExpression = 155, + ParenthesizedExpression = 156, >ParenthesizedExpression : SyntaxKind - FunctionExpression = 156, + FunctionExpression = 157, >FunctionExpression : SyntaxKind - ArrowFunction = 157, + ArrowFunction = 158, >ArrowFunction : SyntaxKind - DeleteExpression = 158, + DeleteExpression = 159, >DeleteExpression : SyntaxKind - TypeOfExpression = 159, + TypeOfExpression = 160, >TypeOfExpression : SyntaxKind - VoidExpression = 160, + VoidExpression = 161, >VoidExpression : SyntaxKind - PrefixUnaryExpression = 161, + PrefixUnaryExpression = 162, >PrefixUnaryExpression : SyntaxKind - PostfixUnaryExpression = 162, + PostfixUnaryExpression = 163, >PostfixUnaryExpression : SyntaxKind - BinaryExpression = 163, + BinaryExpression = 164, >BinaryExpression : SyntaxKind - ConditionalExpression = 164, + ConditionalExpression = 165, >ConditionalExpression : SyntaxKind - TemplateExpression = 165, + TemplateExpression = 166, >TemplateExpression : SyntaxKind - YieldExpression = 166, + YieldExpression = 167, >YieldExpression : SyntaxKind - SpreadElementExpression = 167, + SpreadElementExpression = 168, >SpreadElementExpression : SyntaxKind - OmittedExpression = 168, + OmittedExpression = 169, >OmittedExpression : SyntaxKind - TemplateSpan = 169, + TemplateSpan = 170, >TemplateSpan : SyntaxKind - Block = 170, + Block = 171, >Block : SyntaxKind - VariableStatement = 171, + VariableStatement = 172, >VariableStatement : SyntaxKind - EmptyStatement = 172, + EmptyStatement = 173, >EmptyStatement : SyntaxKind - ExpressionStatement = 173, + ExpressionStatement = 174, >ExpressionStatement : SyntaxKind - IfStatement = 174, + IfStatement = 175, >IfStatement : SyntaxKind - DoStatement = 175, + DoStatement = 176, >DoStatement : SyntaxKind - WhileStatement = 176, + WhileStatement = 177, >WhileStatement : SyntaxKind - ForStatement = 177, + ForStatement = 178, >ForStatement : SyntaxKind - ForInStatement = 178, + ForInStatement = 179, >ForInStatement : SyntaxKind - ContinueStatement = 179, + ContinueStatement = 180, >ContinueStatement : SyntaxKind - BreakStatement = 180, + BreakStatement = 181, >BreakStatement : SyntaxKind - ReturnStatement = 181, + ReturnStatement = 182, >ReturnStatement : SyntaxKind - WithStatement = 182, + WithStatement = 183, >WithStatement : SyntaxKind - SwitchStatement = 183, + SwitchStatement = 184, >SwitchStatement : SyntaxKind - LabeledStatement = 184, + LabeledStatement = 185, >LabeledStatement : SyntaxKind - ThrowStatement = 185, + ThrowStatement = 186, >ThrowStatement : SyntaxKind - TryStatement = 186, + TryStatement = 187, >TryStatement : SyntaxKind - DebuggerStatement = 187, + DebuggerStatement = 188, >DebuggerStatement : SyntaxKind - VariableDeclaration = 188, + VariableDeclaration = 189, >VariableDeclaration : SyntaxKind - VariableDeclarationList = 189, + VariableDeclarationList = 190, >VariableDeclarationList : SyntaxKind - FunctionDeclaration = 190, + FunctionDeclaration = 191, >FunctionDeclaration : SyntaxKind - ClassDeclaration = 191, + ClassDeclaration = 192, >ClassDeclaration : SyntaxKind - InterfaceDeclaration = 192, + InterfaceDeclaration = 193, >InterfaceDeclaration : SyntaxKind - TypeAliasDeclaration = 193, + TypeAliasDeclaration = 194, >TypeAliasDeclaration : SyntaxKind - EnumDeclaration = 194, + EnumDeclaration = 195, >EnumDeclaration : SyntaxKind - ModuleDeclaration = 195, + ModuleDeclaration = 196, >ModuleDeclaration : SyntaxKind - ModuleBlock = 196, + ModuleBlock = 197, >ModuleBlock : SyntaxKind - ImportDeclaration = 197, + ImportDeclaration = 198, >ImportDeclaration : SyntaxKind - ExportAssignment = 198, + ExportAssignment = 199, >ExportAssignment : SyntaxKind - ExternalModuleReference = 199, + ExternalModuleReference = 200, >ExternalModuleReference : SyntaxKind - CaseClause = 200, + CaseClause = 201, >CaseClause : SyntaxKind - DefaultClause = 201, + DefaultClause = 202, >DefaultClause : SyntaxKind - HeritageClause = 202, + HeritageClause = 203, >HeritageClause : SyntaxKind - CatchClause = 203, + CatchClause = 204, >CatchClause : SyntaxKind - PropertyAssignment = 204, + PropertyAssignment = 205, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 205, + ShorthandPropertyAssignment = 206, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 206, + EnumMember = 207, >EnumMember : SyntaxKind - SourceFile = 207, + SourceFile = 208, >SourceFile : SyntaxKind - SyntaxList = 208, + SyntaxList = 209, >SyntaxList : SyntaxKind - Count = 209, + Count = 210, >Count : SyntaxKind FirstAssignment = 52, @@ -982,7 +985,7 @@ declare module "typescript" { FirstKeyword = 65, >FirstKeyword : SyntaxKind - LastKeyword = 120, + LastKeyword = 121, >LastKeyword : SyntaxKind FirstFutureReservedWord = 101, @@ -991,10 +994,10 @@ declare module "typescript" { LastFutureReservedWord = 109, >LastFutureReservedWord : SyntaxKind - FirstTypeNode = 135, + FirstTypeNode = 136, >FirstTypeNode : SyntaxKind - LastTypeNode = 143, + LastTypeNode = 144, >LastTypeNode : SyntaxKind FirstPunctuation = 14, @@ -1006,7 +1009,7 @@ declare module "typescript" { FirstToken = 0, >FirstToken : SyntaxKind - LastToken = 120, + LastToken = 121, >LastToken : SyntaxKind FirstTriviaToken = 2, @@ -1033,7 +1036,7 @@ declare module "typescript" { LastBinaryOperator = 63, >LastBinaryOperator : SyntaxKind - FirstNode = 121, + FirstNode = 122, >FirstNode : SyntaxKind } const enum NodeFlags { @@ -3462,10 +3465,13 @@ declare module "typescript" { ContainsObjectLiteral = 524288, >ContainsObjectLiteral : TypeFlags - Intrinsic = 127, + ESSymbol = 1048576, +>ESSymbol : TypeFlags + + Intrinsic = 1048703, >Intrinsic : TypeFlags - Primitive = 510, + Primitive = 1049086, >Primitive : TypeFlags StringLike = 258, diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index 0e80f6b55b963..22f50173a4f59 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -211,110 +211,111 @@ declare module "typescript" { NumberKeyword = 117, SetKeyword = 118, StringKeyword = 119, - TypeKeyword = 120, - QualifiedName = 121, - ComputedPropertyName = 122, - TypeParameter = 123, - Parameter = 124, - PropertySignature = 125, - PropertyDeclaration = 126, - MethodSignature = 127, - MethodDeclaration = 128, - Constructor = 129, - GetAccessor = 130, - SetAccessor = 131, - CallSignature = 132, - ConstructSignature = 133, - IndexSignature = 134, - TypeReference = 135, - FunctionType = 136, - ConstructorType = 137, - TypeQuery = 138, - TypeLiteral = 139, - ArrayType = 140, - TupleType = 141, - UnionType = 142, - ParenthesizedType = 143, - ObjectBindingPattern = 144, - ArrayBindingPattern = 145, - BindingElement = 146, - ArrayLiteralExpression = 147, - ObjectLiteralExpression = 148, - PropertyAccessExpression = 149, - ElementAccessExpression = 150, - CallExpression = 151, - NewExpression = 152, - TaggedTemplateExpression = 153, - TypeAssertionExpression = 154, - ParenthesizedExpression = 155, - FunctionExpression = 156, - ArrowFunction = 157, - DeleteExpression = 158, - TypeOfExpression = 159, - VoidExpression = 160, - PrefixUnaryExpression = 161, - PostfixUnaryExpression = 162, - BinaryExpression = 163, - ConditionalExpression = 164, - TemplateExpression = 165, - YieldExpression = 166, - SpreadElementExpression = 167, - OmittedExpression = 168, - TemplateSpan = 169, - Block = 170, - VariableStatement = 171, - EmptyStatement = 172, - ExpressionStatement = 173, - IfStatement = 174, - DoStatement = 175, - WhileStatement = 176, - ForStatement = 177, - ForInStatement = 178, - ContinueStatement = 179, - BreakStatement = 180, - ReturnStatement = 181, - WithStatement = 182, - SwitchStatement = 183, - LabeledStatement = 184, - ThrowStatement = 185, - TryStatement = 186, - DebuggerStatement = 187, - VariableDeclaration = 188, - VariableDeclarationList = 189, - FunctionDeclaration = 190, - ClassDeclaration = 191, - InterfaceDeclaration = 192, - TypeAliasDeclaration = 193, - EnumDeclaration = 194, - ModuleDeclaration = 195, - ModuleBlock = 196, - ImportDeclaration = 197, - ExportAssignment = 198, - ExternalModuleReference = 199, - CaseClause = 200, - DefaultClause = 201, - HeritageClause = 202, - CatchClause = 203, - PropertyAssignment = 204, - ShorthandPropertyAssignment = 205, - EnumMember = 206, - SourceFile = 207, - SyntaxList = 208, - Count = 209, + SymbolKeyword = 120, + TypeKeyword = 121, + QualifiedName = 122, + ComputedPropertyName = 123, + TypeParameter = 124, + Parameter = 125, + PropertySignature = 126, + PropertyDeclaration = 127, + MethodSignature = 128, + MethodDeclaration = 129, + Constructor = 130, + GetAccessor = 131, + SetAccessor = 132, + CallSignature = 133, + ConstructSignature = 134, + IndexSignature = 135, + TypeReference = 136, + FunctionType = 137, + ConstructorType = 138, + TypeQuery = 139, + TypeLiteral = 140, + ArrayType = 141, + TupleType = 142, + UnionType = 143, + ParenthesizedType = 144, + ObjectBindingPattern = 145, + ArrayBindingPattern = 146, + BindingElement = 147, + ArrayLiteralExpression = 148, + ObjectLiteralExpression = 149, + PropertyAccessExpression = 150, + ElementAccessExpression = 151, + CallExpression = 152, + NewExpression = 153, + TaggedTemplateExpression = 154, + TypeAssertionExpression = 155, + ParenthesizedExpression = 156, + FunctionExpression = 157, + ArrowFunction = 158, + DeleteExpression = 159, + TypeOfExpression = 160, + VoidExpression = 161, + PrefixUnaryExpression = 162, + PostfixUnaryExpression = 163, + BinaryExpression = 164, + ConditionalExpression = 165, + TemplateExpression = 166, + YieldExpression = 167, + SpreadElementExpression = 168, + OmittedExpression = 169, + TemplateSpan = 170, + Block = 171, + VariableStatement = 172, + EmptyStatement = 173, + ExpressionStatement = 174, + IfStatement = 175, + DoStatement = 176, + WhileStatement = 177, + ForStatement = 178, + ForInStatement = 179, + ContinueStatement = 180, + BreakStatement = 181, + ReturnStatement = 182, + WithStatement = 183, + SwitchStatement = 184, + LabeledStatement = 185, + ThrowStatement = 186, + TryStatement = 187, + DebuggerStatement = 188, + VariableDeclaration = 189, + VariableDeclarationList = 190, + FunctionDeclaration = 191, + ClassDeclaration = 192, + InterfaceDeclaration = 193, + TypeAliasDeclaration = 194, + EnumDeclaration = 195, + ModuleDeclaration = 196, + ModuleBlock = 197, + ImportDeclaration = 198, + ExportAssignment = 199, + ExternalModuleReference = 200, + CaseClause = 201, + DefaultClause = 202, + HeritageClause = 203, + CatchClause = 204, + PropertyAssignment = 205, + ShorthandPropertyAssignment = 206, + EnumMember = 207, + SourceFile = 208, + SyntaxList = 209, + Count = 210, FirstAssignment = 52, LastAssignment = 63, FirstReservedWord = 65, LastReservedWord = 100, FirstKeyword = 65, - LastKeyword = 120, + LastKeyword = 121, FirstFutureReservedWord = 101, LastFutureReservedWord = 109, - FirstTypeNode = 135, - LastTypeNode = 143, + FirstTypeNode = 136, + LastTypeNode = 144, FirstPunctuation = 14, LastPunctuation = 63, FirstToken = 0, - LastToken = 120, + LastToken = 121, FirstTriviaToken = 2, LastTriviaToken = 6, FirstLiteralToken = 7, @@ -323,7 +324,7 @@ declare module "typescript" { LastTemplateToken = 13, FirstBinaryOperator = 24, LastBinaryOperator = 63, - FirstNode = 121, + FirstNode = 122, } const enum NodeFlags { Export = 1, @@ -1063,8 +1064,9 @@ declare module "typescript" { ObjectLiteral = 131072, ContainsUndefinedOrNull = 262144, ContainsObjectLiteral = 524288, - Intrinsic = 127, - Primitive = 510, + ESSymbol = 1048576, + Intrinsic = 1048703, + Primitive = 1049086, StringLike = 258, NumberLike = 132, ObjectType = 48128, diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index 0c201b0a5fd44..d2cfc6f633b1a 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -649,274 +649,277 @@ declare module "typescript" { StringKeyword = 119, >StringKeyword : SyntaxKind - TypeKeyword = 120, + SymbolKeyword = 120, +>SymbolKeyword : SyntaxKind + + TypeKeyword = 121, >TypeKeyword : SyntaxKind - QualifiedName = 121, + QualifiedName = 122, >QualifiedName : SyntaxKind - ComputedPropertyName = 122, + ComputedPropertyName = 123, >ComputedPropertyName : SyntaxKind - TypeParameter = 123, + TypeParameter = 124, >TypeParameter : SyntaxKind - Parameter = 124, + Parameter = 125, >Parameter : SyntaxKind - PropertySignature = 125, + PropertySignature = 126, >PropertySignature : SyntaxKind - PropertyDeclaration = 126, + PropertyDeclaration = 127, >PropertyDeclaration : SyntaxKind - MethodSignature = 127, + MethodSignature = 128, >MethodSignature : SyntaxKind - MethodDeclaration = 128, + MethodDeclaration = 129, >MethodDeclaration : SyntaxKind - Constructor = 129, + Constructor = 130, >Constructor : SyntaxKind - GetAccessor = 130, + GetAccessor = 131, >GetAccessor : SyntaxKind - SetAccessor = 131, + SetAccessor = 132, >SetAccessor : SyntaxKind - CallSignature = 132, + CallSignature = 133, >CallSignature : SyntaxKind - ConstructSignature = 133, + ConstructSignature = 134, >ConstructSignature : SyntaxKind - IndexSignature = 134, + IndexSignature = 135, >IndexSignature : SyntaxKind - TypeReference = 135, + TypeReference = 136, >TypeReference : SyntaxKind - FunctionType = 136, + FunctionType = 137, >FunctionType : SyntaxKind - ConstructorType = 137, + ConstructorType = 138, >ConstructorType : SyntaxKind - TypeQuery = 138, + TypeQuery = 139, >TypeQuery : SyntaxKind - TypeLiteral = 139, + TypeLiteral = 140, >TypeLiteral : SyntaxKind - ArrayType = 140, + ArrayType = 141, >ArrayType : SyntaxKind - TupleType = 141, + TupleType = 142, >TupleType : SyntaxKind - UnionType = 142, + UnionType = 143, >UnionType : SyntaxKind - ParenthesizedType = 143, + ParenthesizedType = 144, >ParenthesizedType : SyntaxKind - ObjectBindingPattern = 144, + ObjectBindingPattern = 145, >ObjectBindingPattern : SyntaxKind - ArrayBindingPattern = 145, + ArrayBindingPattern = 146, >ArrayBindingPattern : SyntaxKind - BindingElement = 146, + BindingElement = 147, >BindingElement : SyntaxKind - ArrayLiteralExpression = 147, + ArrayLiteralExpression = 148, >ArrayLiteralExpression : SyntaxKind - ObjectLiteralExpression = 148, + ObjectLiteralExpression = 149, >ObjectLiteralExpression : SyntaxKind - PropertyAccessExpression = 149, + PropertyAccessExpression = 150, >PropertyAccessExpression : SyntaxKind - ElementAccessExpression = 150, + ElementAccessExpression = 151, >ElementAccessExpression : SyntaxKind - CallExpression = 151, + CallExpression = 152, >CallExpression : SyntaxKind - NewExpression = 152, + NewExpression = 153, >NewExpression : SyntaxKind - TaggedTemplateExpression = 153, + TaggedTemplateExpression = 154, >TaggedTemplateExpression : SyntaxKind - TypeAssertionExpression = 154, + TypeAssertionExpression = 155, >TypeAssertionExpression : SyntaxKind - ParenthesizedExpression = 155, + ParenthesizedExpression = 156, >ParenthesizedExpression : SyntaxKind - FunctionExpression = 156, + FunctionExpression = 157, >FunctionExpression : SyntaxKind - ArrowFunction = 157, + ArrowFunction = 158, >ArrowFunction : SyntaxKind - DeleteExpression = 158, + DeleteExpression = 159, >DeleteExpression : SyntaxKind - TypeOfExpression = 159, + TypeOfExpression = 160, >TypeOfExpression : SyntaxKind - VoidExpression = 160, + VoidExpression = 161, >VoidExpression : SyntaxKind - PrefixUnaryExpression = 161, + PrefixUnaryExpression = 162, >PrefixUnaryExpression : SyntaxKind - PostfixUnaryExpression = 162, + PostfixUnaryExpression = 163, >PostfixUnaryExpression : SyntaxKind - BinaryExpression = 163, + BinaryExpression = 164, >BinaryExpression : SyntaxKind - ConditionalExpression = 164, + ConditionalExpression = 165, >ConditionalExpression : SyntaxKind - TemplateExpression = 165, + TemplateExpression = 166, >TemplateExpression : SyntaxKind - YieldExpression = 166, + YieldExpression = 167, >YieldExpression : SyntaxKind - SpreadElementExpression = 167, + SpreadElementExpression = 168, >SpreadElementExpression : SyntaxKind - OmittedExpression = 168, + OmittedExpression = 169, >OmittedExpression : SyntaxKind - TemplateSpan = 169, + TemplateSpan = 170, >TemplateSpan : SyntaxKind - Block = 170, + Block = 171, >Block : SyntaxKind - VariableStatement = 171, + VariableStatement = 172, >VariableStatement : SyntaxKind - EmptyStatement = 172, + EmptyStatement = 173, >EmptyStatement : SyntaxKind - ExpressionStatement = 173, + ExpressionStatement = 174, >ExpressionStatement : SyntaxKind - IfStatement = 174, + IfStatement = 175, >IfStatement : SyntaxKind - DoStatement = 175, + DoStatement = 176, >DoStatement : SyntaxKind - WhileStatement = 176, + WhileStatement = 177, >WhileStatement : SyntaxKind - ForStatement = 177, + ForStatement = 178, >ForStatement : SyntaxKind - ForInStatement = 178, + ForInStatement = 179, >ForInStatement : SyntaxKind - ContinueStatement = 179, + ContinueStatement = 180, >ContinueStatement : SyntaxKind - BreakStatement = 180, + BreakStatement = 181, >BreakStatement : SyntaxKind - ReturnStatement = 181, + ReturnStatement = 182, >ReturnStatement : SyntaxKind - WithStatement = 182, + WithStatement = 183, >WithStatement : SyntaxKind - SwitchStatement = 183, + SwitchStatement = 184, >SwitchStatement : SyntaxKind - LabeledStatement = 184, + LabeledStatement = 185, >LabeledStatement : SyntaxKind - ThrowStatement = 185, + ThrowStatement = 186, >ThrowStatement : SyntaxKind - TryStatement = 186, + TryStatement = 187, >TryStatement : SyntaxKind - DebuggerStatement = 187, + DebuggerStatement = 188, >DebuggerStatement : SyntaxKind - VariableDeclaration = 188, + VariableDeclaration = 189, >VariableDeclaration : SyntaxKind - VariableDeclarationList = 189, + VariableDeclarationList = 190, >VariableDeclarationList : SyntaxKind - FunctionDeclaration = 190, + FunctionDeclaration = 191, >FunctionDeclaration : SyntaxKind - ClassDeclaration = 191, + ClassDeclaration = 192, >ClassDeclaration : SyntaxKind - InterfaceDeclaration = 192, + InterfaceDeclaration = 193, >InterfaceDeclaration : SyntaxKind - TypeAliasDeclaration = 193, + TypeAliasDeclaration = 194, >TypeAliasDeclaration : SyntaxKind - EnumDeclaration = 194, + EnumDeclaration = 195, >EnumDeclaration : SyntaxKind - ModuleDeclaration = 195, + ModuleDeclaration = 196, >ModuleDeclaration : SyntaxKind - ModuleBlock = 196, + ModuleBlock = 197, >ModuleBlock : SyntaxKind - ImportDeclaration = 197, + ImportDeclaration = 198, >ImportDeclaration : SyntaxKind - ExportAssignment = 198, + ExportAssignment = 199, >ExportAssignment : SyntaxKind - ExternalModuleReference = 199, + ExternalModuleReference = 200, >ExternalModuleReference : SyntaxKind - CaseClause = 200, + CaseClause = 201, >CaseClause : SyntaxKind - DefaultClause = 201, + DefaultClause = 202, >DefaultClause : SyntaxKind - HeritageClause = 202, + HeritageClause = 203, >HeritageClause : SyntaxKind - CatchClause = 203, + CatchClause = 204, >CatchClause : SyntaxKind - PropertyAssignment = 204, + PropertyAssignment = 205, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 205, + ShorthandPropertyAssignment = 206, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 206, + EnumMember = 207, >EnumMember : SyntaxKind - SourceFile = 207, + SourceFile = 208, >SourceFile : SyntaxKind - SyntaxList = 208, + SyntaxList = 209, >SyntaxList : SyntaxKind - Count = 209, + Count = 210, >Count : SyntaxKind FirstAssignment = 52, @@ -934,7 +937,7 @@ declare module "typescript" { FirstKeyword = 65, >FirstKeyword : SyntaxKind - LastKeyword = 120, + LastKeyword = 121, >LastKeyword : SyntaxKind FirstFutureReservedWord = 101, @@ -943,10 +946,10 @@ declare module "typescript" { LastFutureReservedWord = 109, >LastFutureReservedWord : SyntaxKind - FirstTypeNode = 135, + FirstTypeNode = 136, >FirstTypeNode : SyntaxKind - LastTypeNode = 143, + LastTypeNode = 144, >LastTypeNode : SyntaxKind FirstPunctuation = 14, @@ -958,7 +961,7 @@ declare module "typescript" { FirstToken = 0, >FirstToken : SyntaxKind - LastToken = 120, + LastToken = 121, >LastToken : SyntaxKind FirstTriviaToken = 2, @@ -985,7 +988,7 @@ declare module "typescript" { LastBinaryOperator = 63, >LastBinaryOperator : SyntaxKind - FirstNode = 121, + FirstNode = 122, >FirstNode : SyntaxKind } const enum NodeFlags { @@ -3414,10 +3417,13 @@ declare module "typescript" { ContainsObjectLiteral = 524288, >ContainsObjectLiteral : TypeFlags - Intrinsic = 127, + ESSymbol = 1048576, +>ESSymbol : TypeFlags + + Intrinsic = 1048703, >Intrinsic : TypeFlags - Primitive = 510, + Primitive = 1049086, >Primitive : TypeFlags StringLike = 258, diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index 27a2ce5e41556..158562aeaf843 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -248,110 +248,111 @@ declare module "typescript" { NumberKeyword = 117, SetKeyword = 118, StringKeyword = 119, - TypeKeyword = 120, - QualifiedName = 121, - ComputedPropertyName = 122, - TypeParameter = 123, - Parameter = 124, - PropertySignature = 125, - PropertyDeclaration = 126, - MethodSignature = 127, - MethodDeclaration = 128, - Constructor = 129, - GetAccessor = 130, - SetAccessor = 131, - CallSignature = 132, - ConstructSignature = 133, - IndexSignature = 134, - TypeReference = 135, - FunctionType = 136, - ConstructorType = 137, - TypeQuery = 138, - TypeLiteral = 139, - ArrayType = 140, - TupleType = 141, - UnionType = 142, - ParenthesizedType = 143, - ObjectBindingPattern = 144, - ArrayBindingPattern = 145, - BindingElement = 146, - ArrayLiteralExpression = 147, - ObjectLiteralExpression = 148, - PropertyAccessExpression = 149, - ElementAccessExpression = 150, - CallExpression = 151, - NewExpression = 152, - TaggedTemplateExpression = 153, - TypeAssertionExpression = 154, - ParenthesizedExpression = 155, - FunctionExpression = 156, - ArrowFunction = 157, - DeleteExpression = 158, - TypeOfExpression = 159, - VoidExpression = 160, - PrefixUnaryExpression = 161, - PostfixUnaryExpression = 162, - BinaryExpression = 163, - ConditionalExpression = 164, - TemplateExpression = 165, - YieldExpression = 166, - SpreadElementExpression = 167, - OmittedExpression = 168, - TemplateSpan = 169, - Block = 170, - VariableStatement = 171, - EmptyStatement = 172, - ExpressionStatement = 173, - IfStatement = 174, - DoStatement = 175, - WhileStatement = 176, - ForStatement = 177, - ForInStatement = 178, - ContinueStatement = 179, - BreakStatement = 180, - ReturnStatement = 181, - WithStatement = 182, - SwitchStatement = 183, - LabeledStatement = 184, - ThrowStatement = 185, - TryStatement = 186, - DebuggerStatement = 187, - VariableDeclaration = 188, - VariableDeclarationList = 189, - FunctionDeclaration = 190, - ClassDeclaration = 191, - InterfaceDeclaration = 192, - TypeAliasDeclaration = 193, - EnumDeclaration = 194, - ModuleDeclaration = 195, - ModuleBlock = 196, - ImportDeclaration = 197, - ExportAssignment = 198, - ExternalModuleReference = 199, - CaseClause = 200, - DefaultClause = 201, - HeritageClause = 202, - CatchClause = 203, - PropertyAssignment = 204, - ShorthandPropertyAssignment = 205, - EnumMember = 206, - SourceFile = 207, - SyntaxList = 208, - Count = 209, + SymbolKeyword = 120, + TypeKeyword = 121, + QualifiedName = 122, + ComputedPropertyName = 123, + TypeParameter = 124, + Parameter = 125, + PropertySignature = 126, + PropertyDeclaration = 127, + MethodSignature = 128, + MethodDeclaration = 129, + Constructor = 130, + GetAccessor = 131, + SetAccessor = 132, + CallSignature = 133, + ConstructSignature = 134, + IndexSignature = 135, + TypeReference = 136, + FunctionType = 137, + ConstructorType = 138, + TypeQuery = 139, + TypeLiteral = 140, + ArrayType = 141, + TupleType = 142, + UnionType = 143, + ParenthesizedType = 144, + ObjectBindingPattern = 145, + ArrayBindingPattern = 146, + BindingElement = 147, + ArrayLiteralExpression = 148, + ObjectLiteralExpression = 149, + PropertyAccessExpression = 150, + ElementAccessExpression = 151, + CallExpression = 152, + NewExpression = 153, + TaggedTemplateExpression = 154, + TypeAssertionExpression = 155, + ParenthesizedExpression = 156, + FunctionExpression = 157, + ArrowFunction = 158, + DeleteExpression = 159, + TypeOfExpression = 160, + VoidExpression = 161, + PrefixUnaryExpression = 162, + PostfixUnaryExpression = 163, + BinaryExpression = 164, + ConditionalExpression = 165, + TemplateExpression = 166, + YieldExpression = 167, + SpreadElementExpression = 168, + OmittedExpression = 169, + TemplateSpan = 170, + Block = 171, + VariableStatement = 172, + EmptyStatement = 173, + ExpressionStatement = 174, + IfStatement = 175, + DoStatement = 176, + WhileStatement = 177, + ForStatement = 178, + ForInStatement = 179, + ContinueStatement = 180, + BreakStatement = 181, + ReturnStatement = 182, + WithStatement = 183, + SwitchStatement = 184, + LabeledStatement = 185, + ThrowStatement = 186, + TryStatement = 187, + DebuggerStatement = 188, + VariableDeclaration = 189, + VariableDeclarationList = 190, + FunctionDeclaration = 191, + ClassDeclaration = 192, + InterfaceDeclaration = 193, + TypeAliasDeclaration = 194, + EnumDeclaration = 195, + ModuleDeclaration = 196, + ModuleBlock = 197, + ImportDeclaration = 198, + ExportAssignment = 199, + ExternalModuleReference = 200, + CaseClause = 201, + DefaultClause = 202, + HeritageClause = 203, + CatchClause = 204, + PropertyAssignment = 205, + ShorthandPropertyAssignment = 206, + EnumMember = 207, + SourceFile = 208, + SyntaxList = 209, + Count = 210, FirstAssignment = 52, LastAssignment = 63, FirstReservedWord = 65, LastReservedWord = 100, FirstKeyword = 65, - LastKeyword = 120, + LastKeyword = 121, FirstFutureReservedWord = 101, LastFutureReservedWord = 109, - FirstTypeNode = 135, - LastTypeNode = 143, + FirstTypeNode = 136, + LastTypeNode = 144, FirstPunctuation = 14, LastPunctuation = 63, FirstToken = 0, - LastToken = 120, + LastToken = 121, FirstTriviaToken = 2, LastTriviaToken = 6, FirstLiteralToken = 7, @@ -360,7 +361,7 @@ declare module "typescript" { LastTemplateToken = 13, FirstBinaryOperator = 24, LastBinaryOperator = 63, - FirstNode = 121, + FirstNode = 122, } const enum NodeFlags { Export = 1, @@ -1100,8 +1101,9 @@ declare module "typescript" { ObjectLiteral = 131072, ContainsUndefinedOrNull = 262144, ContainsObjectLiteral = 524288, - Intrinsic = 127, - Primitive = 510, + ESSymbol = 1048576, + Intrinsic = 1048703, + Primitive = 1049086, StringLike = 258, NumberLike = 132, ObjectType = 48128, diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index 4e137cae59d1a..36bce4fa9f564 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -822,274 +822,277 @@ declare module "typescript" { StringKeyword = 119, >StringKeyword : SyntaxKind - TypeKeyword = 120, + SymbolKeyword = 120, +>SymbolKeyword : SyntaxKind + + TypeKeyword = 121, >TypeKeyword : SyntaxKind - QualifiedName = 121, + QualifiedName = 122, >QualifiedName : SyntaxKind - ComputedPropertyName = 122, + ComputedPropertyName = 123, >ComputedPropertyName : SyntaxKind - TypeParameter = 123, + TypeParameter = 124, >TypeParameter : SyntaxKind - Parameter = 124, + Parameter = 125, >Parameter : SyntaxKind - PropertySignature = 125, + PropertySignature = 126, >PropertySignature : SyntaxKind - PropertyDeclaration = 126, + PropertyDeclaration = 127, >PropertyDeclaration : SyntaxKind - MethodSignature = 127, + MethodSignature = 128, >MethodSignature : SyntaxKind - MethodDeclaration = 128, + MethodDeclaration = 129, >MethodDeclaration : SyntaxKind - Constructor = 129, + Constructor = 130, >Constructor : SyntaxKind - GetAccessor = 130, + GetAccessor = 131, >GetAccessor : SyntaxKind - SetAccessor = 131, + SetAccessor = 132, >SetAccessor : SyntaxKind - CallSignature = 132, + CallSignature = 133, >CallSignature : SyntaxKind - ConstructSignature = 133, + ConstructSignature = 134, >ConstructSignature : SyntaxKind - IndexSignature = 134, + IndexSignature = 135, >IndexSignature : SyntaxKind - TypeReference = 135, + TypeReference = 136, >TypeReference : SyntaxKind - FunctionType = 136, + FunctionType = 137, >FunctionType : SyntaxKind - ConstructorType = 137, + ConstructorType = 138, >ConstructorType : SyntaxKind - TypeQuery = 138, + TypeQuery = 139, >TypeQuery : SyntaxKind - TypeLiteral = 139, + TypeLiteral = 140, >TypeLiteral : SyntaxKind - ArrayType = 140, + ArrayType = 141, >ArrayType : SyntaxKind - TupleType = 141, + TupleType = 142, >TupleType : SyntaxKind - UnionType = 142, + UnionType = 143, >UnionType : SyntaxKind - ParenthesizedType = 143, + ParenthesizedType = 144, >ParenthesizedType : SyntaxKind - ObjectBindingPattern = 144, + ObjectBindingPattern = 145, >ObjectBindingPattern : SyntaxKind - ArrayBindingPattern = 145, + ArrayBindingPattern = 146, >ArrayBindingPattern : SyntaxKind - BindingElement = 146, + BindingElement = 147, >BindingElement : SyntaxKind - ArrayLiteralExpression = 147, + ArrayLiteralExpression = 148, >ArrayLiteralExpression : SyntaxKind - ObjectLiteralExpression = 148, + ObjectLiteralExpression = 149, >ObjectLiteralExpression : SyntaxKind - PropertyAccessExpression = 149, + PropertyAccessExpression = 150, >PropertyAccessExpression : SyntaxKind - ElementAccessExpression = 150, + ElementAccessExpression = 151, >ElementAccessExpression : SyntaxKind - CallExpression = 151, + CallExpression = 152, >CallExpression : SyntaxKind - NewExpression = 152, + NewExpression = 153, >NewExpression : SyntaxKind - TaggedTemplateExpression = 153, + TaggedTemplateExpression = 154, >TaggedTemplateExpression : SyntaxKind - TypeAssertionExpression = 154, + TypeAssertionExpression = 155, >TypeAssertionExpression : SyntaxKind - ParenthesizedExpression = 155, + ParenthesizedExpression = 156, >ParenthesizedExpression : SyntaxKind - FunctionExpression = 156, + FunctionExpression = 157, >FunctionExpression : SyntaxKind - ArrowFunction = 157, + ArrowFunction = 158, >ArrowFunction : SyntaxKind - DeleteExpression = 158, + DeleteExpression = 159, >DeleteExpression : SyntaxKind - TypeOfExpression = 159, + TypeOfExpression = 160, >TypeOfExpression : SyntaxKind - VoidExpression = 160, + VoidExpression = 161, >VoidExpression : SyntaxKind - PrefixUnaryExpression = 161, + PrefixUnaryExpression = 162, >PrefixUnaryExpression : SyntaxKind - PostfixUnaryExpression = 162, + PostfixUnaryExpression = 163, >PostfixUnaryExpression : SyntaxKind - BinaryExpression = 163, + BinaryExpression = 164, >BinaryExpression : SyntaxKind - ConditionalExpression = 164, + ConditionalExpression = 165, >ConditionalExpression : SyntaxKind - TemplateExpression = 165, + TemplateExpression = 166, >TemplateExpression : SyntaxKind - YieldExpression = 166, + YieldExpression = 167, >YieldExpression : SyntaxKind - SpreadElementExpression = 167, + SpreadElementExpression = 168, >SpreadElementExpression : SyntaxKind - OmittedExpression = 168, + OmittedExpression = 169, >OmittedExpression : SyntaxKind - TemplateSpan = 169, + TemplateSpan = 170, >TemplateSpan : SyntaxKind - Block = 170, + Block = 171, >Block : SyntaxKind - VariableStatement = 171, + VariableStatement = 172, >VariableStatement : SyntaxKind - EmptyStatement = 172, + EmptyStatement = 173, >EmptyStatement : SyntaxKind - ExpressionStatement = 173, + ExpressionStatement = 174, >ExpressionStatement : SyntaxKind - IfStatement = 174, + IfStatement = 175, >IfStatement : SyntaxKind - DoStatement = 175, + DoStatement = 176, >DoStatement : SyntaxKind - WhileStatement = 176, + WhileStatement = 177, >WhileStatement : SyntaxKind - ForStatement = 177, + ForStatement = 178, >ForStatement : SyntaxKind - ForInStatement = 178, + ForInStatement = 179, >ForInStatement : SyntaxKind - ContinueStatement = 179, + ContinueStatement = 180, >ContinueStatement : SyntaxKind - BreakStatement = 180, + BreakStatement = 181, >BreakStatement : SyntaxKind - ReturnStatement = 181, + ReturnStatement = 182, >ReturnStatement : SyntaxKind - WithStatement = 182, + WithStatement = 183, >WithStatement : SyntaxKind - SwitchStatement = 183, + SwitchStatement = 184, >SwitchStatement : SyntaxKind - LabeledStatement = 184, + LabeledStatement = 185, >LabeledStatement : SyntaxKind - ThrowStatement = 185, + ThrowStatement = 186, >ThrowStatement : SyntaxKind - TryStatement = 186, + TryStatement = 187, >TryStatement : SyntaxKind - DebuggerStatement = 187, + DebuggerStatement = 188, >DebuggerStatement : SyntaxKind - VariableDeclaration = 188, + VariableDeclaration = 189, >VariableDeclaration : SyntaxKind - VariableDeclarationList = 189, + VariableDeclarationList = 190, >VariableDeclarationList : SyntaxKind - FunctionDeclaration = 190, + FunctionDeclaration = 191, >FunctionDeclaration : SyntaxKind - ClassDeclaration = 191, + ClassDeclaration = 192, >ClassDeclaration : SyntaxKind - InterfaceDeclaration = 192, + InterfaceDeclaration = 193, >InterfaceDeclaration : SyntaxKind - TypeAliasDeclaration = 193, + TypeAliasDeclaration = 194, >TypeAliasDeclaration : SyntaxKind - EnumDeclaration = 194, + EnumDeclaration = 195, >EnumDeclaration : SyntaxKind - ModuleDeclaration = 195, + ModuleDeclaration = 196, >ModuleDeclaration : SyntaxKind - ModuleBlock = 196, + ModuleBlock = 197, >ModuleBlock : SyntaxKind - ImportDeclaration = 197, + ImportDeclaration = 198, >ImportDeclaration : SyntaxKind - ExportAssignment = 198, + ExportAssignment = 199, >ExportAssignment : SyntaxKind - ExternalModuleReference = 199, + ExternalModuleReference = 200, >ExternalModuleReference : SyntaxKind - CaseClause = 200, + CaseClause = 201, >CaseClause : SyntaxKind - DefaultClause = 201, + DefaultClause = 202, >DefaultClause : SyntaxKind - HeritageClause = 202, + HeritageClause = 203, >HeritageClause : SyntaxKind - CatchClause = 203, + CatchClause = 204, >CatchClause : SyntaxKind - PropertyAssignment = 204, + PropertyAssignment = 205, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 205, + ShorthandPropertyAssignment = 206, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 206, + EnumMember = 207, >EnumMember : SyntaxKind - SourceFile = 207, + SourceFile = 208, >SourceFile : SyntaxKind - SyntaxList = 208, + SyntaxList = 209, >SyntaxList : SyntaxKind - Count = 209, + Count = 210, >Count : SyntaxKind FirstAssignment = 52, @@ -1107,7 +1110,7 @@ declare module "typescript" { FirstKeyword = 65, >FirstKeyword : SyntaxKind - LastKeyword = 120, + LastKeyword = 121, >LastKeyword : SyntaxKind FirstFutureReservedWord = 101, @@ -1116,10 +1119,10 @@ declare module "typescript" { LastFutureReservedWord = 109, >LastFutureReservedWord : SyntaxKind - FirstTypeNode = 135, + FirstTypeNode = 136, >FirstTypeNode : SyntaxKind - LastTypeNode = 143, + LastTypeNode = 144, >LastTypeNode : SyntaxKind FirstPunctuation = 14, @@ -1131,7 +1134,7 @@ declare module "typescript" { FirstToken = 0, >FirstToken : SyntaxKind - LastToken = 120, + LastToken = 121, >LastToken : SyntaxKind FirstTriviaToken = 2, @@ -1158,7 +1161,7 @@ declare module "typescript" { LastBinaryOperator = 63, >LastBinaryOperator : SyntaxKind - FirstNode = 121, + FirstNode = 122, >FirstNode : SyntaxKind } const enum NodeFlags { @@ -3587,10 +3590,13 @@ declare module "typescript" { ContainsObjectLiteral = 524288, >ContainsObjectLiteral : TypeFlags - Intrinsic = 127, + ESSymbol = 1048576, +>ESSymbol : TypeFlags + + Intrinsic = 1048703, >Intrinsic : TypeFlags - Primitive = 510, + Primitive = 1049086, >Primitive : TypeFlags StringLike = 258, diff --git a/tests/baselines/reference/ES5SymbolProperty1.errors.txt b/tests/baselines/reference/ES5SymbolProperty1.errors.txt new file mode 100644 index 0000000000000..1c0c5a55ad25d --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty1.errors.txt @@ -0,0 +1,19 @@ +tests/cases/conformance/Symbols/ES5SymbolProperty1.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/Symbols/ES5SymbolProperty1.ts(7,6): error TS2471: A computed property name of the form 'Symbol.foo' must be of type 'symbol'. + + +==== tests/cases/conformance/Symbols/ES5SymbolProperty1.ts (2 errors) ==== + interface SymbolConstructor { + foo: string; + } + var Symbol: SymbolConstructor; + + var obj = { + [Symbol.foo]: 0 + ~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~~ +!!! error TS2471: A computed property name of the form 'Symbol.foo' must be of type 'symbol'. + } + + obj[Symbol.foo]; \ No newline at end of file diff --git a/tests/baselines/reference/ES5SymbolProperty1.js b/tests/baselines/reference/ES5SymbolProperty1.js new file mode 100644 index 0000000000000..3f761d3073fbb --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty1.js @@ -0,0 +1,18 @@ +//// [ES5SymbolProperty1.ts] +interface SymbolConstructor { + foo: string; +} +var Symbol: SymbolConstructor; + +var obj = { + [Symbol.foo]: 0 +} + +obj[Symbol.foo]; + +//// [ES5SymbolProperty1.js] +var Symbol; +var obj = { + [Symbol.foo]: 0 +}; +obj[Symbol.foo]; diff --git a/tests/baselines/reference/ES5SymbolProperty2.errors.txt b/tests/baselines/reference/ES5SymbolProperty2.errors.txt new file mode 100644 index 0000000000000..397e8f5151199 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty2.errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/Symbols/ES5SymbolProperty2.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/Symbols/ES5SymbolProperty2.ts(5,10): error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. +tests/cases/conformance/Symbols/ES5SymbolProperty2.ts(10,11): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/Symbols/ES5SymbolProperty2.ts (3 errors) ==== + module M { + var Symbol; + + export class C { + [Symbol.iterator]() { } + ~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~~~~~~~ +!!! error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + } + (new C)[Symbol.iterator]; + } + + (new M.C)[Symbol.iterator]; + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/ES5SymbolProperty2.js b/tests/baselines/reference/ES5SymbolProperty2.js new file mode 100644 index 0000000000000..effd1e610f4c8 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty2.js @@ -0,0 +1,26 @@ +//// [ES5SymbolProperty2.ts] +module M { + var Symbol; + + export class C { + [Symbol.iterator]() { } + } + (new C)[Symbol.iterator]; +} + +(new M.C)[Symbol.iterator]; + +//// [ES5SymbolProperty2.js] +var M; +(function (M) { + var Symbol; + var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function () { }; + return C; + })(); + M.C = C; + (new C)[Symbol.iterator]; +})(M || (M = {})); +(new M.C)[Symbol.iterator]; diff --git a/tests/baselines/reference/ES5SymbolProperty3.errors.txt b/tests/baselines/reference/ES5SymbolProperty3.errors.txt new file mode 100644 index 0000000000000..3ec09f889f593 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty3.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/Symbols/ES5SymbolProperty3.ts(4,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/Symbols/ES5SymbolProperty3.ts(4,6): error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + + +==== tests/cases/conformance/Symbols/ES5SymbolProperty3.ts (2 errors) ==== + var Symbol; + + class C { + [Symbol.iterator]() { } + ~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~~~~~~~ +!!! error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + } + + (new C)[Symbol.iterator] \ No newline at end of file diff --git a/tests/baselines/reference/ES5SymbolProperty3.js b/tests/baselines/reference/ES5SymbolProperty3.js new file mode 100644 index 0000000000000..52ea7e091ee47 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty3.js @@ -0,0 +1,18 @@ +//// [ES5SymbolProperty3.ts] +var Symbol; + +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator] + +//// [ES5SymbolProperty3.js] +var Symbol; +var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function () { }; + return C; +})(); +(new C)[Symbol.iterator]; diff --git a/tests/baselines/reference/ES5SymbolProperty4.errors.txt b/tests/baselines/reference/ES5SymbolProperty4.errors.txt new file mode 100644 index 0000000000000..045647e0313f9 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty4.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/Symbols/ES5SymbolProperty4.ts(4,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/Symbols/ES5SymbolProperty4.ts(4,6): error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + + +==== tests/cases/conformance/Symbols/ES5SymbolProperty4.ts (2 errors) ==== + var Symbol: { iterator: string }; + + class C { + [Symbol.iterator]() { } + ~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~~~~~~~ +!!! error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + } + + (new C)[Symbol.iterator] \ No newline at end of file diff --git a/tests/baselines/reference/ES5SymbolProperty4.js b/tests/baselines/reference/ES5SymbolProperty4.js new file mode 100644 index 0000000000000..ae8a539f351e3 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty4.js @@ -0,0 +1,18 @@ +//// [ES5SymbolProperty4.ts] +var Symbol: { iterator: string }; + +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator] + +//// [ES5SymbolProperty4.js] +var Symbol; +var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function () { }; + return C; +})(); +(new C)[Symbol.iterator]; diff --git a/tests/baselines/reference/ES5SymbolProperty5.errors.txt b/tests/baselines/reference/ES5SymbolProperty5.errors.txt new file mode 100644 index 0000000000000..7a94d1c4cda37 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty5.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/Symbols/ES5SymbolProperty5.ts(4,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/Symbols/ES5SymbolProperty5.ts(7,1): error TS2346: Supplied parameters do not match any signature of call target. + + +==== tests/cases/conformance/Symbols/ES5SymbolProperty5.ts (2 errors) ==== + var Symbol: { iterator: symbol }; + + class C { + [Symbol.iterator]() { } + ~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } + + (new C)[Symbol.iterator](0) // Should error + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/ES5SymbolProperty5.js b/tests/baselines/reference/ES5SymbolProperty5.js new file mode 100644 index 0000000000000..63b12667d0fb2 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty5.js @@ -0,0 +1,18 @@ +//// [ES5SymbolProperty5.ts] +var Symbol: { iterator: symbol }; + +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator](0) // Should error + +//// [ES5SymbolProperty5.js] +var Symbol; +var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function () { }; + return C; +})(); +(new C)[Symbol.iterator](0); // Should error diff --git a/tests/baselines/reference/ES5SymbolProperty6.errors.txt b/tests/baselines/reference/ES5SymbolProperty6.errors.txt new file mode 100644 index 0000000000000..c86c13da05b1f --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty6.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/Symbols/ES5SymbolProperty6.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/Symbols/ES5SymbolProperty6.ts(2,6): error TS2304: Cannot find name 'Symbol'. +tests/cases/conformance/Symbols/ES5SymbolProperty6.ts(5,9): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/Symbols/ES5SymbolProperty6.ts (3 errors) ==== + class C { + [Symbol.iterator]() { } + ~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } + + (new C)[Symbol.iterator] + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/ES5SymbolProperty6.js b/tests/baselines/reference/ES5SymbolProperty6.js new file mode 100644 index 0000000000000..10eda091e5e1a --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty6.js @@ -0,0 +1,15 @@ +//// [ES5SymbolProperty6.ts] +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator] + +//// [ES5SymbolProperty6.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function () { }; + return C; +})(); +(new C)[Symbol.iterator]; diff --git a/tests/baselines/reference/ES5SymbolProperty7.errors.txt b/tests/baselines/reference/ES5SymbolProperty7.errors.txt new file mode 100644 index 0000000000000..4b35618ad52ae --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty7.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/Symbols/ES5SymbolProperty7.ts(4,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/Symbols/ES5SymbolProperty7.ts(4,6): error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + + +==== tests/cases/conformance/Symbols/ES5SymbolProperty7.ts (2 errors) ==== + var Symbol: { iterator: any }; + + class C { + [Symbol.iterator]() { } + ~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~~~~~~~ +!!! error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + } + + (new C)[Symbol.iterator] \ No newline at end of file diff --git a/tests/baselines/reference/ES5SymbolProperty7.js b/tests/baselines/reference/ES5SymbolProperty7.js new file mode 100644 index 0000000000000..d3f796ce758fc --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty7.js @@ -0,0 +1,18 @@ +//// [ES5SymbolProperty7.ts] +var Symbol: { iterator: any }; + +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator] + +//// [ES5SymbolProperty7.js] +var Symbol; +var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function () { }; + return C; +})(); +(new C)[Symbol.iterator]; diff --git a/tests/baselines/reference/ES5SymbolType1.js b/tests/baselines/reference/ES5SymbolType1.js new file mode 100644 index 0000000000000..5b555c19e7ca9 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolType1.js @@ -0,0 +1,7 @@ +//// [ES5SymbolType1.ts] +var s: symbol; +s.toString(); + +//// [ES5SymbolType1.js] +var s; +s.toString(); diff --git a/tests/baselines/reference/ES5SymbolType1.types b/tests/baselines/reference/ES5SymbolType1.types new file mode 100644 index 0000000000000..79d93902fd6a2 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolType1.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/Symbols/ES5SymbolType1.ts === +var s: symbol; +>s : symbol + +s.toString(); +>s.toString() : string +>s.toString : () => string +>s : symbol +>toString : () => string + diff --git a/tests/baselines/reference/baseTypePrivateMemberClash.errors.txt b/tests/baselines/reference/baseTypePrivateMemberClash.errors.txt index eca303ff72cda..28e6684469651 100644 --- a/tests/baselines/reference/baseTypePrivateMemberClash.errors.txt +++ b/tests/baselines/reference/baseTypePrivateMemberClash.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/baseTypePrivateMemberClash.ts(8,11): error TS2320: Interface 'Z' cannot simultaneously extend types 'X' and 'Y'. - Named properties 'm' of types 'X' and 'Y' are not identical. + Named property 'm' of types 'X' and 'Y' are not identical. ==== tests/cases/compiler/baseTypePrivateMemberClash.ts (1 errors) ==== @@ -13,4 +13,4 @@ tests/cases/compiler/baseTypePrivateMemberClash.ts(8,11): error TS2320: Interfac interface Z extends X, Y { } ~ !!! error TS2320: Interface 'Z' cannot simultaneously extend types 'X' and 'Y'. -!!! error TS2320: Named properties 'm' of types 'X' and 'Y' are not identical. \ No newline at end of file +!!! error TS2320: Named property 'm' of types 'X' and 'Y' are not identical. \ No newline at end of file diff --git a/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType2.errors.txt b/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType2.errors.txt index 5fabfd0b7adfe..4ff65843eba64 100644 --- a/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType2.errors.txt +++ b/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType2.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesThatDifferOnlyByReturnType2.ts(8,11): error TS2320: Interface 'A' cannot simultaneously extend types 'I' and 'I'. - Named properties 'foo' of types 'I' and 'I' are not identical. + Named property 'foo' of types 'I' and 'I' are not identical. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesThatDifferOnlyByReturnType2.ts(13,16): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. @@ -14,7 +14,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesTha interface A extends I, I { } ~ !!! error TS2320: Interface 'A' cannot simultaneously extend types 'I' and 'I'. -!!! error TS2320: Named properties 'foo' of types 'I' and 'I' are not identical. +!!! error TS2320: Named property 'foo' of types 'I' and 'I' are not identical. var x: A; // BUG 822524 diff --git a/tests/baselines/reference/callWithSpread.errors.txt b/tests/baselines/reference/callWithSpread.errors.txt index 7ea026f434662..a28d4c8b1a176 100644 --- a/tests/baselines/reference/callWithSpread.errors.txt +++ b/tests/baselines/reference/callWithSpread.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/expressions/functionCalls/callWithSpread.ts(52,21): error TS2468: Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/expressions/functionCalls/callWithSpread.ts(52,21): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher. ==== tests/cases/conformance/expressions/functionCalls/callWithSpread.ts (1 errors) ==== @@ -55,5 +55,5 @@ tests/cases/conformance/expressions/functionCalls/callWithSpread.ts(52,21): erro // Only supported in when target is ES6 var c = new C(1, 2, ...a); ~~~~ -!!! error TS2468: Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher. +!!! error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher. \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames12.errors.txt b/tests/baselines/reference/computedPropertyNames12.errors.txt index 56774fe8daed5..1fdf741f8934f 100644 --- a/tests/baselines/reference/computedPropertyNames12.errors.txt +++ b/tests/baselines/reference/computedPropertyNames12.errors.txt @@ -1,14 +1,14 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(5,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(6,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(7,12): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(8,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(9,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(10,12): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(11,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(12,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(13,12): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(14,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(15,12): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(5,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(6,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(7,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(8,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(9,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(10,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(11,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(12,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(13,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(14,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(15,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts (11 errors) ==== @@ -18,35 +18,35 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(15,12) class C { [s]: number; ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. [n] = n; ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. static [s + s]: string; ~~~~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. [s + n] = 2; ~~~~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. [+s]: typeof s; ~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. static [""]: number; ~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. [0]: number; ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. [a]: number; ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. static [true]: number; ~~~~~~~~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. [`hello bye`] = 0; ~~~~~~~~~~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. static [`hello ${a} bye`] = 0 ~~~~~~~~~~~~~~~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames14.errors.txt b/tests/baselines/reference/computedPropertyNames14.errors.txt index 1cf5b1445f23a..9ab0cf6a4e99b 100644 --- a/tests/baselines/reference/computedPropertyNames14.errors.txt +++ b/tests/baselines/reference/computedPropertyNames14.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(6,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(8,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(6,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(8,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts (6 errors) ==== @@ -11,20 +11,20 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(8,12): class C { [b]() {} ~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. static [true]() { } ~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [[]]() { } ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. static [{}]() { } ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [undefined]() { } ~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. static [null]() { } ~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames15.errors.txt b/tests/baselines/reference/computedPropertyNames15.errors.txt index 0e759668a9517..64b08df32217e 100644 --- a/tests/baselines/reference/computedPropertyNames15.errors.txt +++ b/tests/baselines/reference/computedPropertyNames15.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts (2 errors) ==== @@ -10,8 +10,8 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(7,5): [p1]() { } [p2]() { } ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [p3]() { } ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames17.errors.txt b/tests/baselines/reference/computedPropertyNames17.errors.txt index b236ae3245ede..df9fe01528aed 100644 --- a/tests/baselines/reference/computedPropertyNames17.errors.txt +++ b/tests/baselines/reference/computedPropertyNames17.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(3,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(4,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(8,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(3,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(4,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(8,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts (6 errors) ==== @@ -11,20 +11,20 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(8,9): class C { get [b]() { return 0;} ~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. static set [true](v) { } ~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. get [[]]() { return 0; } ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. set [{}](v) { } ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. static get [undefined]() { return 0; } ~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. set [null](v) { } ~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames3.errors.txt b/tests/baselines/reference/computedPropertyNames3.errors.txt index 080bff1ab9ab0..7136e441e720e 100644 --- a/tests/baselines/reference/computedPropertyNames3.errors.txt +++ b/tests/baselines/reference/computedPropertyNames3.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts (6 errors) ==== @@ -12,19 +12,19 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): [0 + 1]() { } static [() => { }]() { } ~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. get [delete id]() { } ~~~~~~~~~~~ !!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. ~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. set [[0, 1]](v) { } ~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. static get [""]() { } ~~~~~~~~~~~~ !!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. ~~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. static set [id.toString()](v) { } } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames32.errors.txt b/tests/baselines/reference/computedPropertyNames32.errors.txt index e2f08c79fc906..63b13d40ab4f1 100644 --- a/tests/baselines/reference/computedPropertyNames32.errors.txt +++ b/tests/baselines/reference/computedPropertyNames32.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames32.ts(6,10): error TS2466: A computed property name cannot reference a type parameter from its containing type. +tests/cases/conformance/es6/computedProperties/computedPropertyNames32.ts(6,10): error TS2467: A computed property name cannot reference a type parameter from its containing type. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames32.ts (1 errors) ==== @@ -9,5 +9,5 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames32.ts(6,10): } [foo()]() { } ~ -!!! error TS2466: A computed property name cannot reference a type parameter from its containing type. +!!! error TS2467: A computed property name cannot reference a type parameter from its containing type. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames35.errors.txt b/tests/baselines/reference/computedPropertyNames35.errors.txt index 01c4614e84a44..aa9279fe9c387 100644 --- a/tests/baselines/reference/computedPropertyNames35.errors.txt +++ b/tests/baselines/reference/computedPropertyNames35.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts(4,5): error TS1169: Computed property names are not allowed in interfaces. -tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts(4,10): error TS2466: A computed property name cannot reference a type parameter from its containing type. +tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts(4,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts(4,10): error TS2467: A computed property name cannot reference a type parameter from its containing type. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts (2 errors) ==== @@ -8,7 +8,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts(4,10): bar(): string; [foo()](): void; ~~~~~~~~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ -!!! error TS2466: A computed property name cannot reference a type parameter from its containing type. +!!! error TS2467: A computed property name cannot reference a type parameter from its containing type. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames42.errors.txt b/tests/baselines/reference/computedPropertyNames42.errors.txt index 059b3117a4397..417931c535f5b 100644 --- a/tests/baselines/reference/computedPropertyNames42.errors.txt +++ b/tests/baselines/reference/computedPropertyNames42.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts(8,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts(8,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts(8,5): error TS2411: Property '[""]' of type 'Foo' is not assignable to string index type 'Foo2'. @@ -12,7 +12,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts(8,5): // Computed properties [""]: Foo; ~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~~~~~~~~~~ !!! error TS2411: Property '[""]' of type 'Foo' is not assignable to string index type 'Foo2'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames5.errors.txt b/tests/baselines/reference/computedPropertyNames5.errors.txt index 2b8cf5503b851..2b59a816e16aa 100644 --- a/tests/baselines/reference/computedPropertyNames5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames5.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(4,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(8,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(4,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(8,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts (6 errors) ==== @@ -11,20 +11,20 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(8,5): e var v = { [b]: 0, ~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [true]: 1, ~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [[]]: 0, ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [{}]: 0, ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [undefined]: undefined, ~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [null]: null ~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames6.errors.txt b/tests/baselines/reference/computedPropertyNames6.errors.txt index 57798e9f6b678..1a651b581c3bc 100644 --- a/tests/baselines/reference/computedPropertyNames6.errors.txt +++ b/tests/baselines/reference/computedPropertyNames6.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts (2 errors) ==== @@ -10,8 +10,8 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(7,5): e [p1]: 0, [p2]: 1, ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [p3]: 2 ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames8.errors.txt b/tests/baselines/reference/computedPropertyNames8.errors.txt index 515af1f4fc438..44e32e0a771d3 100644 --- a/tests/baselines/reference/computedPropertyNames8.errors.txt +++ b/tests/baselines/reference/computedPropertyNames8.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts (2 errors) ==== @@ -9,9 +9,9 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts(6,9): e var v = { [t]: 0, ~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [u]: 1 ~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. }; } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames9.errors.txt b/tests/baselines/reference/computedPropertyNames9.errors.txt index d87576f1f778d..a71e0f5e8eb1f 100644 --- a/tests/baselines/reference/computedPropertyNames9.errors.txt +++ b/tests/baselines/reference/computedPropertyNames9.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts(9,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts(9,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts (1 errors) ==== @@ -12,5 +12,5 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts(9,5): e [f(0)]: 0, [f(true)]: 0 ~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.errors.txt index 69ff2b9e452c8..961b64a7f32eb 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3.ts(2,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3.ts(2,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3.ts (1 errors) ==== interface I { ["" + ""](): void; ~~~~~~~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.errors.txt index 53eb057f8a12e..45fa3ae521e3c 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4.ts(2,5): error TS1170: Computed property names are not allowed in type literals. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4.ts(2,5): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4.ts (1 errors) ==== var v: { ["" + ""](): void; ~~~~~~~~~ -!!! error TS1170: Computed property names are not allowed in type literals. +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesOnOverloads.errors.txt b/tests/baselines/reference/computedPropertyNamesOnOverloads.errors.txt index b3c2957a13f36..ee7b67ad82905 100644 --- a/tests/baselines/reference/computedPropertyNamesOnOverloads.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesOnOverloads.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts(4,5): error TS1168: Computed property names are not allowed in method overloads. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts(5,5): error TS1168: Computed property names are not allowed in method overloads. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts(4,5): error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts(5,5): error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts (2 errors) ==== @@ -8,9 +8,9 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads. class C { [methodName](v: string); ~~~~~~~~~~~~ -!!! error TS1168: Computed property names are not allowed in method overloads. +!!! error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. [methodName](); ~~~~~~~~~~~~ -!!! error TS1168: Computed property names are not allowed in method overloads. +!!! error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. [methodName](v?: string) { } } \ No newline at end of file diff --git a/tests/baselines/reference/conflictingMemberTypesInBases.errors.txt b/tests/baselines/reference/conflictingMemberTypesInBases.errors.txt index 58fdcb4c7ae69..07e7a64ec1ff7 100644 --- a/tests/baselines/reference/conflictingMemberTypesInBases.errors.txt +++ b/tests/baselines/reference/conflictingMemberTypesInBases.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/conflictingMemberTypesInBases.ts(12,11): error TS2320: Interface 'E' cannot simultaneously extend types 'B' and 'D'. - Named properties 'm' of types 'B' and 'D' are not identical. + Named property 'm' of types 'B' and 'D' are not identical. ==== tests/cases/compiler/conflictingMemberTypesInBases.ts (1 errors) ==== @@ -17,6 +17,6 @@ tests/cases/compiler/conflictingMemberTypesInBases.ts(12,11): error TS2320: Inte interface E extends B { } // Error here for extending B and D ~ !!! error TS2320: Interface 'E' cannot simultaneously extend types 'B' and 'D'. -!!! error TS2320: Named properties 'm' of types 'B' and 'D' are not identical. +!!! error TS2320: Named property 'm' of types 'B' and 'D' are not identical. interface E extends D { } // No duplicate error here \ No newline at end of file diff --git a/tests/baselines/reference/constDeclarationShadowedByVarDeclaration.errors.txt b/tests/baselines/reference/constDeclarationShadowedByVarDeclaration.errors.txt index ff669e41396bc..24af601139fb5 100644 --- a/tests/baselines/reference/constDeclarationShadowedByVarDeclaration.errors.txt +++ b/tests/baselines/reference/constDeclarationShadowedByVarDeclaration.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(7,9): error TS2477: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. -tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(15,13): error TS2477: Cannot initialize outer scoped variable 'y' in the same scope as block scoped declaration 'y'. -tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(22,7): error TS2477: Cannot initialize outer scoped variable 'z' in the same scope as block scoped declaration 'z'. +tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(7,9): error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. +tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(15,13): error TS2481: Cannot initialize outer scoped variable 'y' in the same scope as block scoped declaration 'y'. +tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(22,7): error TS2481: Cannot initialize outer scoped variable 'z' in the same scope as block scoped declaration 'z'. ==== tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts (3 errors) ==== @@ -12,7 +12,7 @@ tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(22,7): error TS var x = 0; ~ -!!! error TS2477: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. +!!! error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. } @@ -22,7 +22,7 @@ tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(22,7): error TS { var y = 0; ~ -!!! error TS2477: Cannot initialize outer scoped variable 'y' in the same scope as block scoped declaration 'y'. +!!! error TS2481: Cannot initialize outer scoped variable 'y' in the same scope as block scoped declaration 'y'. } } @@ -31,5 +31,5 @@ tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(22,7): error TS const z = 0; var z = 0 ~ -!!! error TS2477: Cannot initialize outer scoped variable 'z' in the same scope as block scoped declaration 'z'. +!!! error TS2481: Cannot initialize outer scoped variable 'z' in the same scope as block scoped declaration 'z'. } \ No newline at end of file diff --git a/tests/baselines/reference/constEnumBadPropertyNames.errors.txt b/tests/baselines/reference/constEnumBadPropertyNames.errors.txt index 52c78fa68aece..f2330617dea18 100644 --- a/tests/baselines/reference/constEnumBadPropertyNames.errors.txt +++ b/tests/baselines/reference/constEnumBadPropertyNames.errors.txt @@ -1,8 +1,8 @@ -tests/cases/compiler/constEnumBadPropertyNames.ts(2,11): error TS2475: Property 'B' does not exist on 'const' enum 'E'. +tests/cases/compiler/constEnumBadPropertyNames.ts(2,11): error TS2479: Property 'B' does not exist on 'const' enum 'E'. ==== tests/cases/compiler/constEnumBadPropertyNames.ts (1 errors) ==== const enum E { A } var x = E["B"] ~~~ -!!! error TS2475: Property 'B' does not exist on 'const' enum 'E'. \ No newline at end of file +!!! error TS2479: Property 'B' does not exist on 'const' enum 'E'. \ No newline at end of file diff --git a/tests/baselines/reference/constEnumErrors.errors.txt b/tests/baselines/reference/constEnumErrors.errors.txt index edd3044f0bc00..be7dad54eeb52 100644 --- a/tests/baselines/reference/constEnumErrors.errors.txt +++ b/tests/baselines/reference/constEnumErrors.errors.txt @@ -1,16 +1,16 @@ tests/cases/compiler/constEnumErrors.ts(1,12): error TS2300: Duplicate identifier 'E'. tests/cases/compiler/constEnumErrors.ts(5,8): error TS2300: Duplicate identifier 'E'. -tests/cases/compiler/constEnumErrors.ts(12,9): error TS2470: In 'const' enum declarations member initializer must be constant expression. -tests/cases/compiler/constEnumErrors.ts(14,9): error TS2470: In 'const' enum declarations member initializer must be constant expression. -tests/cases/compiler/constEnumErrors.ts(15,10): error TS2470: In 'const' enum declarations member initializer must be constant expression. -tests/cases/compiler/constEnumErrors.ts(22,13): error TS2472: A const enum member can only be accessed using a string literal. -tests/cases/compiler/constEnumErrors.ts(24,13): error TS2472: A const enum member can only be accessed using a string literal. -tests/cases/compiler/constEnumErrors.ts(26,9): error TS2471: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. -tests/cases/compiler/constEnumErrors.ts(27,10): error TS2471: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. -tests/cases/compiler/constEnumErrors.ts(32,5): error TS2471: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. -tests/cases/compiler/constEnumErrors.ts(40,9): error TS2473: 'const' enum member initializer was evaluated to a non-finite value. -tests/cases/compiler/constEnumErrors.ts(41,9): error TS2473: 'const' enum member initializer was evaluated to a non-finite value. -tests/cases/compiler/constEnumErrors.ts(42,9): error TS2474: 'const' enum member initializer was evaluated to disallowed value 'NaN'. +tests/cases/compiler/constEnumErrors.ts(12,9): error TS2474: In 'const' enum declarations member initializer must be constant expression. +tests/cases/compiler/constEnumErrors.ts(14,9): error TS2474: In 'const' enum declarations member initializer must be constant expression. +tests/cases/compiler/constEnumErrors.ts(15,10): error TS2474: In 'const' enum declarations member initializer must be constant expression. +tests/cases/compiler/constEnumErrors.ts(22,13): error TS2476: A const enum member can only be accessed using a string literal. +tests/cases/compiler/constEnumErrors.ts(24,13): error TS2476: A const enum member can only be accessed using a string literal. +tests/cases/compiler/constEnumErrors.ts(26,9): error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. +tests/cases/compiler/constEnumErrors.ts(27,10): error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. +tests/cases/compiler/constEnumErrors.ts(32,5): error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. +tests/cases/compiler/constEnumErrors.ts(40,9): error TS2477: 'const' enum member initializer was evaluated to a non-finite value. +tests/cases/compiler/constEnumErrors.ts(41,9): error TS2477: 'const' enum member initializer was evaluated to a non-finite value. +tests/cases/compiler/constEnumErrors.ts(42,9): error TS2478: 'const' enum member initializer was evaluated to disallowed value 'NaN'. ==== tests/cases/compiler/constEnumErrors.ts (13 errors) ==== @@ -31,14 +31,14 @@ tests/cases/compiler/constEnumErrors.ts(42,9): error TS2474: 'const' enum member // forward reference to the element of the same enum X = Y, ~ -!!! error TS2470: In 'const' enum declarations member initializer must be constant expression. +!!! error TS2474: In 'const' enum declarations member initializer must be constant expression. // forward reference to the element of the same enum Y = E1.Z, ~~~~ -!!! error TS2470: In 'const' enum declarations member initializer must be constant expression. +!!! error TS2474: In 'const' enum declarations member initializer must be constant expression. Y1 = E1["Z"] ~~~~~~~ -!!! error TS2470: In 'const' enum declarations member initializer must be constant expression. +!!! error TS2474: In 'const' enum declarations member initializer must be constant expression. } const enum E2 { @@ -47,25 +47,25 @@ tests/cases/compiler/constEnumErrors.ts(42,9): error TS2474: 'const' enum member var y0 = E2[1] ~ -!!! error TS2472: A const enum member can only be accessed using a string literal. +!!! error TS2476: A const enum member can only be accessed using a string literal. var name = "A"; var y1 = E2[name]; ~~~~ -!!! error TS2472: A const enum member can only be accessed using a string literal. +!!! error TS2476: A const enum member can only be accessed using a string literal. var x = E2; ~~ -!!! error TS2471: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. +!!! error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. var y = [E2]; ~~ -!!! error TS2471: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. +!!! error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. function foo(t: any): void { } foo(E2); ~~ -!!! error TS2471: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. +!!! error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. const enum NaNOrInfinity { A = 9007199254740992, @@ -75,11 +75,11 @@ tests/cases/compiler/constEnumErrors.ts(42,9): error TS2474: 'const' enum member E = D * D, F = E * E, // overflow ~~~~~ -!!! error TS2473: 'const' enum member initializer was evaluated to a non-finite value. +!!! error TS2477: 'const' enum member initializer was evaluated to a non-finite value. G = 1 / 0, // overflow ~~~~~ -!!! error TS2473: 'const' enum member initializer was evaluated to a non-finite value. +!!! error TS2477: 'const' enum member initializer was evaluated to a non-finite value. H = 0 / 0 // NaN ~~~~~ -!!! error TS2474: 'const' enum member initializer was evaluated to disallowed value 'NaN'. +!!! error TS2478: 'const' enum member initializer was evaluated to disallowed value 'NaN'. } \ No newline at end of file diff --git a/tests/baselines/reference/genericAndNonGenericInheritedSignature1.errors.txt b/tests/baselines/reference/genericAndNonGenericInheritedSignature1.errors.txt index 63ff9d9313e7c..7180dc7c25bb1 100644 --- a/tests/baselines/reference/genericAndNonGenericInheritedSignature1.errors.txt +++ b/tests/baselines/reference/genericAndNonGenericInheritedSignature1.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/genericAndNonGenericInheritedSignature1.ts(7,11): error TS2320: Interface 'Hello' cannot simultaneously extend types 'Foo' and 'Bar'. - Named properties 'f' of types 'Foo' and 'Bar' are not identical. + Named property 'f' of types 'Foo' and 'Bar' are not identical. ==== tests/cases/compiler/genericAndNonGenericInheritedSignature1.ts (1 errors) ==== @@ -12,6 +12,6 @@ tests/cases/compiler/genericAndNonGenericInheritedSignature1.ts(7,11): error TS2 interface Hello extends Foo, Bar { ~~~~~ !!! error TS2320: Interface 'Hello' cannot simultaneously extend types 'Foo' and 'Bar'. -!!! error TS2320: Named properties 'f' of types 'Foo' and 'Bar' are not identical. +!!! error TS2320: Named property 'f' of types 'Foo' and 'Bar' are not identical. } \ No newline at end of file diff --git a/tests/baselines/reference/genericAndNonGenericInheritedSignature2.errors.txt b/tests/baselines/reference/genericAndNonGenericInheritedSignature2.errors.txt index 05fdd68319e66..158fd44792309 100644 --- a/tests/baselines/reference/genericAndNonGenericInheritedSignature2.errors.txt +++ b/tests/baselines/reference/genericAndNonGenericInheritedSignature2.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/genericAndNonGenericInheritedSignature2.ts(7,11): error TS2320: Interface 'Hello' cannot simultaneously extend types 'Bar' and 'Foo'. - Named properties 'f' of types 'Bar' and 'Foo' are not identical. + Named property 'f' of types 'Bar' and 'Foo' are not identical. ==== tests/cases/compiler/genericAndNonGenericInheritedSignature2.ts (1 errors) ==== @@ -12,6 +12,6 @@ tests/cases/compiler/genericAndNonGenericInheritedSignature2.ts(7,11): error TS2 interface Hello extends Bar, Foo { ~~~~~ !!! error TS2320: Interface 'Hello' cannot simultaneously extend types 'Bar' and 'Foo'. -!!! error TS2320: Named properties 'f' of types 'Bar' and 'Foo' are not identical. +!!! error TS2320: Named property 'f' of types 'Bar' and 'Foo' are not identical. } \ No newline at end of file diff --git a/tests/baselines/reference/giant.errors.txt b/tests/baselines/reference/giant.errors.txt index e8c574d211585..1d623870d63de 100644 --- a/tests/baselines/reference/giant.errors.txt +++ b/tests/baselines/reference/giant.errors.txt @@ -16,7 +16,7 @@ tests/cases/compiler/giant.ts(34,16): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(35,12): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(36,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(36,16): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(61,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(61,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/giant.ts(61,6): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(62,5): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(63,6): error TS1096: An index signature must have exactly one parameter. @@ -39,7 +39,7 @@ tests/cases/compiler/giant.ts(98,20): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(99,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(100,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(100,20): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(125,9): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(125,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/giant.ts(125,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(126,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(127,10): error TS1096: An index signature must have exactly one parameter. @@ -63,7 +63,7 @@ tests/cases/compiler/giant.ts(177,20): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(178,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(179,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(179,20): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(204,9): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(204,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/giant.ts(204,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(205,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(206,10): error TS1096: An index signature must have exactly one parameter. @@ -119,7 +119,7 @@ tests/cases/compiler/giant.ts(292,16): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(293,12): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(294,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(294,16): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(319,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(319,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/giant.ts(319,6): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(320,5): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(321,6): error TS1096: An index signature must have exactly one parameter. @@ -142,7 +142,7 @@ tests/cases/compiler/giant.ts(356,20): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(357,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(358,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(358,20): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(383,9): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(383,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/giant.ts(383,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(384,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(385,10): error TS1096: An index signature must have exactly one parameter. @@ -166,7 +166,7 @@ tests/cases/compiler/giant.ts(435,20): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(436,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(437,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(437,20): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(462,9): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(462,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/giant.ts(462,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(463,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(464,10): error TS1096: An index signature must have exactly one parameter. @@ -238,7 +238,7 @@ tests/cases/compiler/giant.ts(556,21): error TS1036: Statements are not allowed tests/cases/compiler/giant.ts(558,24): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(561,21): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(563,21): error TS1184: An implementation cannot be declared in ambient contexts. -tests/cases/compiler/giant.ts(587,9): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(587,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/giant.ts(587,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(588,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(589,10): error TS1096: An index signature must have exactly one parameter. @@ -255,7 +255,7 @@ tests/cases/compiler/giant.ts(621,26): error TS1184: An implementation cannot be tests/cases/compiler/giant.ts(623,24): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(626,21): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(628,21): error TS1184: An implementation cannot be declared in ambient contexts. -tests/cases/compiler/giant.ts(653,9): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(653,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/giant.ts(653,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(654,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(655,10): error TS1096: An index signature must have exactly one parameter. @@ -364,7 +364,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -474,7 +474,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -601,7 +601,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -828,7 +828,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -938,7 +938,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -1065,7 +1065,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -1334,7 +1334,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -1434,7 +1434,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; diff --git a/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt b/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt index 9df5357767f17..0985157e0da73 100644 --- a/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt +++ b/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(12,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(13,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(14,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(16,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(17,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(19,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(20,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(12,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(13,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(14,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(16,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(17,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(19,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(20,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(30,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(31,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(32,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter @@ -15,7 +15,7 @@ tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInv tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(37,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(38,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(39,17): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(43,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(43,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(43,17): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter @@ -33,27 +33,27 @@ tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInv var ra1 = a1 in x; ~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. var ra2 = a2 in x; ~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. var ra3 = a3 in x; ~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. var ra4 = a4 in x; var ra5 = null in x; ~~~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. var ra6 = undefined in x; ~~~~~~~~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. var ra7 = E.a in x; var ra8 = false in x; ~~~~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. var ra9 = {} in x; ~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. // invalid right operands // the right operand is required to be of type Any, an object type, or a type parameter type @@ -98,6 +98,6 @@ tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInv // both operands are invalid var rc1 = {} in ''; ~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. ~~ !!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter \ No newline at end of file diff --git a/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt b/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt index 82e96bf3846cb..88e09d7746b92 100644 --- a/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt +++ b/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(3,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(3,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(3,6): error TS2304: Cannot find name 'x'. tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(4,5): error TS1021: An index signature must have a type annotation. -tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(9,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(9,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(9,6): error TS2304: Cannot find name 'x'. tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(14,5): error TS1021: An index signature must have a type annotation. @@ -11,7 +11,7 @@ tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(14,5): error TS1021 // Used to be indexer, now it is a computed property [x]: string; ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'x'. [x: string]; @@ -23,7 +23,7 @@ tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(14,5): error TS1021 // Used to be indexer, now it is a computed property [x]: string ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'x'. diff --git a/tests/baselines/reference/indexSignatureWithInitializer.errors.txt b/tests/baselines/reference/indexSignatureWithInitializer.errors.txt index d6f547a25cb03..4a49de69393ac 100644 --- a/tests/baselines/reference/indexSignatureWithInitializer.errors.txt +++ b/tests/baselines/reference/indexSignatureWithInitializer.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/indexSignatureWithInitializer.ts(3,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/indexSignatureWithInitializer.ts(3,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/indexSignatureWithInitializer.ts(3,6): error TS2304: Cannot find name 'x'. -tests/cases/compiler/indexSignatureWithInitializer.ts(7,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/compiler/indexSignatureWithInitializer.ts(7,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/compiler/indexSignatureWithInitializer.ts(7,6): error TS2304: Cannot find name 'x'. @@ -9,7 +9,7 @@ tests/cases/compiler/indexSignatureWithInitializer.ts(7,6): error TS2304: Cannot interface I { [x = '']: string; ~~~~~~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'x'. } @@ -17,7 +17,7 @@ tests/cases/compiler/indexSignatureWithInitializer.ts(7,6): error TS2304: Cannot class C { [x = 0]: string ~~~~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'x'. } \ No newline at end of file diff --git a/tests/baselines/reference/indexTypeCheck.errors.txt b/tests/baselines/reference/indexTypeCheck.errors.txt index 03d0e2ce8edbd..9f4b403ca2ec5 100644 --- a/tests/baselines/reference/indexTypeCheck.errors.txt +++ b/tests/baselines/reference/indexTypeCheck.errors.txt @@ -5,7 +5,7 @@ tests/cases/compiler/indexTypeCheck.ts(22,2): error TS2413: Numeric index type ' tests/cases/compiler/indexTypeCheck.ts(27,2): error TS2413: Numeric index type 'number' is not assignable to string index type 'string'. tests/cases/compiler/indexTypeCheck.ts(32,3): error TS1096: An index signature must have exactly one parameter. tests/cases/compiler/indexTypeCheck.ts(36,3): error TS1023: An index signature parameter type must be 'string' or 'number'. -tests/cases/compiler/indexTypeCheck.ts(51,1): error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +tests/cases/compiler/indexTypeCheck.ts(51,1): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. ==== tests/cases/compiler/indexTypeCheck.ts (8 errors) ==== @@ -75,7 +75,7 @@ tests/cases/compiler/indexTypeCheck.ts(51,1): error TS2342: An index expression yellow[blue]; // error ~~~~~~~~~~~~ -!!! error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. var x:number[]; x[0]; diff --git a/tests/baselines/reference/indexWithoutParamType2.errors.txt b/tests/baselines/reference/indexWithoutParamType2.errors.txt index 468368b5f23d4..7e72b7804e29c 100644 --- a/tests/baselines/reference/indexWithoutParamType2.errors.txt +++ b/tests/baselines/reference/indexWithoutParamType2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/indexWithoutParamType2.ts(3,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/compiler/indexWithoutParamType2.ts(3,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/compiler/indexWithoutParamType2.ts(3,6): error TS2304: Cannot find name 'x'. @@ -7,7 +7,7 @@ tests/cases/compiler/indexWithoutParamType2.ts(3,6): error TS2304: Cannot find n // Used to be indexer, now it is a computed property [x]: string ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'x'. } \ No newline at end of file diff --git a/tests/baselines/reference/inheritSameNamePrivatePropertiesFromDifferentOrigins.errors.txt b/tests/baselines/reference/inheritSameNamePrivatePropertiesFromDifferentOrigins.errors.txt index 555349cc2514c..e8c47e95fe9c8 100644 --- a/tests/baselines/reference/inheritSameNamePrivatePropertiesFromDifferentOrigins.errors.txt +++ b/tests/baselines/reference/inheritSameNamePrivatePropertiesFromDifferentOrigins.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/inheritSameNamePrivatePropertiesFromDifferentOrigins.ts(9,11): error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. - Named properties 'x' of types 'C' and 'C2' are not identical. + Named property 'x' of types 'C' and 'C2' are not identical. ==== tests/cases/compiler/inheritSameNamePrivatePropertiesFromDifferentOrigins.ts (1 errors) ==== @@ -14,6 +14,6 @@ tests/cases/compiler/inheritSameNamePrivatePropertiesFromDifferentOrigins.ts(9,1 interface A extends C, C2 { // error ~ !!! error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. -!!! error TS2320: Named properties 'x' of types 'C' and 'C2' are not identical. +!!! error TS2320: Named property 'x' of types 'C' and 'C2' are not identical. y: string; } \ No newline at end of file diff --git a/tests/baselines/reference/inheritSameNamePropertiesWithDifferentOptionality.errors.txt b/tests/baselines/reference/inheritSameNamePropertiesWithDifferentOptionality.errors.txt index 3f9c4a3bae0d4..f6debbde7eca4 100644 --- a/tests/baselines/reference/inheritSameNamePropertiesWithDifferentOptionality.errors.txt +++ b/tests/baselines/reference/inheritSameNamePropertiesWithDifferentOptionality.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/inheritSameNamePropertiesWithDifferentOptionality.ts(9,11): error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. - Named properties 'x' of types 'C' and 'C2' are not identical. + Named property 'x' of types 'C' and 'C2' are not identical. ==== tests/cases/compiler/inheritSameNamePropertiesWithDifferentOptionality.ts (1 errors) ==== @@ -14,6 +14,6 @@ tests/cases/compiler/inheritSameNamePropertiesWithDifferentOptionality.ts(9,11): interface A extends C, C2 { // error ~ !!! error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. -!!! error TS2320: Named properties 'x' of types 'C' and 'C2' are not identical. +!!! error TS2320: Named property 'x' of types 'C' and 'C2' are not identical. y: string; } \ No newline at end of file diff --git a/tests/baselines/reference/inheritSameNamePropertiesWithDifferentVisibility.errors.txt b/tests/baselines/reference/inheritSameNamePropertiesWithDifferentVisibility.errors.txt index 9864b4a47926d..1865e9f6b7823 100644 --- a/tests/baselines/reference/inheritSameNamePropertiesWithDifferentVisibility.errors.txt +++ b/tests/baselines/reference/inheritSameNamePropertiesWithDifferentVisibility.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/inheritSameNamePropertiesWithDifferentVisibility.ts(9,11): error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. - Named properties 'x' of types 'C' and 'C2' are not identical. + Named property 'x' of types 'C' and 'C2' are not identical. ==== tests/cases/compiler/inheritSameNamePropertiesWithDifferentVisibility.ts (1 errors) ==== @@ -14,6 +14,6 @@ tests/cases/compiler/inheritSameNamePropertiesWithDifferentVisibility.ts(9,11): interface A extends C, C2 { // error ~ !!! error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. -!!! error TS2320: Named properties 'x' of types 'C' and 'C2' are not identical. +!!! error TS2320: Named property 'x' of types 'C' and 'C2' are not identical. y: string; } \ No newline at end of file diff --git a/tests/baselines/reference/interfaceDeclaration1.errors.txt b/tests/baselines/reference/interfaceDeclaration1.errors.txt index 1e8cc0c1e68f9..b73cfef75dfaa 100644 --- a/tests/baselines/reference/interfaceDeclaration1.errors.txt +++ b/tests/baselines/reference/interfaceDeclaration1.errors.txt @@ -7,7 +7,7 @@ tests/cases/compiler/interfaceDeclaration1.ts(35,7): error TS2420: Class 'C1' in Property 'prototype' is missing in type 'C1'. tests/cases/compiler/interfaceDeclaration1.ts(41,11): error TS2310: Type 'i8' recursively references itself as a base type. tests/cases/compiler/interfaceDeclaration1.ts(52,11): error TS2320: Interface 'i12' cannot simultaneously extend types 'i10' and 'i11'. - Named properties 'foo' of types 'i10' and 'i11' are not identical. + Named property 'foo' of types 'i10' and 'i11' are not identical. ==== tests/cases/compiler/interfaceDeclaration1.ts (8 errors) ==== @@ -80,5 +80,5 @@ tests/cases/compiler/interfaceDeclaration1.ts(52,11): error TS2320: Interface 'i interface i12 extends i10, i11 { } ~~~ !!! error TS2320: Interface 'i12' cannot simultaneously extend types 'i10' and 'i11'. -!!! error TS2320: Named properties 'foo' of types 'i10' and 'i11' are not identical. +!!! error TS2320: Named property 'foo' of types 'i10' and 'i11' are not identical. \ No newline at end of file diff --git a/tests/baselines/reference/interfaceExtendingClassWithPrivates2.errors.txt b/tests/baselines/reference/interfaceExtendingClassWithPrivates2.errors.txt index c9be8471e8c8b..7850c10fe2666 100644 --- a/tests/baselines/reference/interfaceExtendingClassWithPrivates2.errors.txt +++ b/tests/baselines/reference/interfaceExtendingClassWithPrivates2.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(9,11): error TS2320: Interface 'I3' cannot simultaneously extend types 'Foo' and 'Bar'. - Named properties 'x' of types 'Foo' and 'Bar' are not identical. + Named property 'x' of types 'Foo' and 'Bar' are not identical. tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(12,11): error TS2430: Interface 'I4' incorrectly extends interface 'Bar'. Property 'x' is private in type 'Bar' but not in type 'I4'. tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(12,11): error TS2430: Interface 'I4' incorrectly extends interface 'Foo'. @@ -20,7 +20,7 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtending interface I3 extends Foo, Bar { // error ~~ !!! error TS2320: Interface 'I3' cannot simultaneously extend types 'Foo' and 'Bar'. -!!! error TS2320: Named properties 'x' of types 'Foo' and 'Bar' are not identical. +!!! error TS2320: Named property 'x' of types 'Foo' and 'Bar' are not identical. } interface I4 extends Foo, Bar { // error diff --git a/tests/baselines/reference/interfaceExtendingClassWithProtecteds2.errors.txt b/tests/baselines/reference/interfaceExtendingClassWithProtecteds2.errors.txt index a63dfd6efca79..48e3b7d7e6c7e 100644 --- a/tests/baselines/reference/interfaceExtendingClassWithProtecteds2.errors.txt +++ b/tests/baselines/reference/interfaceExtendingClassWithProtecteds2.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts(9,11): error TS2320: Interface 'I3' cannot simultaneously extend types 'Foo' and 'Bar'. - Named properties 'x' of types 'Foo' and 'Bar' are not identical. + Named property 'x' of types 'Foo' and 'Bar' are not identical. tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts(12,11): error TS2430: Interface 'I4' incorrectly extends interface 'Bar'. Property 'x' is protected but type 'I4' is not a class derived from 'Bar'. tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts(12,11): error TS2430: Interface 'I4' incorrectly extends interface 'Foo'. @@ -20,7 +20,7 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtending interface I3 extends Foo, Bar { // error ~~ !!! error TS2320: Interface 'I3' cannot simultaneously extend types 'Foo' and 'Bar'. -!!! error TS2320: Named properties 'x' of types 'Foo' and 'Bar' are not identical. +!!! error TS2320: Named property 'x' of types 'Foo' and 'Bar' are not identical. } interface I4 extends Foo, Bar { // error diff --git a/tests/baselines/reference/interfaceImplementation7.errors.txt b/tests/baselines/reference/interfaceImplementation7.errors.txt index ff1118e5c690b..b297015dfbeea 100644 --- a/tests/baselines/reference/interfaceImplementation7.errors.txt +++ b/tests/baselines/reference/interfaceImplementation7.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/interfaceImplementation7.ts(4,11): error TS2320: Interface 'i3' cannot simultaneously extend types 'i1' and 'i2'. - Named properties 'name' of types 'i1' and 'i2' are not identical. + Named property 'name' of types 'i1' and 'i2' are not identical. tests/cases/compiler/interfaceImplementation7.ts(7,7): error TS2420: Class 'C1' incorrectly implements interface 'i4'. Types of property 'name' are incompatible. Type '() => string' is not assignable to type '() => { s: string; n: number; }'. @@ -14,7 +14,7 @@ tests/cases/compiler/interfaceImplementation7.ts(7,7): error TS2420: Class 'C1' interface i3 extends i1, i2 { } ~~ !!! error TS2320: Interface 'i3' cannot simultaneously extend types 'i1' and 'i2'. -!!! error TS2320: Named properties 'name' of types 'i1' and 'i2' are not identical. +!!! error TS2320: Named property 'name' of types 'i1' and 'i2' are not identical. interface i4 extends i1, i2 { name(): { s: string; n: number; }; } class C1 implements i4 { diff --git a/tests/baselines/reference/interfacePropertiesWithSameName2.errors.txt b/tests/baselines/reference/interfacePropertiesWithSameName2.errors.txt index a7df9c15e5980..82301d9ae16ba 100644 --- a/tests/baselines/reference/interfacePropertiesWithSameName2.errors.txt +++ b/tests/baselines/reference/interfacePropertiesWithSameName2.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/interfacePropertiesWithSameName2.ts(10,11): error TS2320: Interface 'MoverShaker' cannot simultaneously extend types 'Mover' and 'Shaker'. - Named properties 'getStatus' of types 'Mover' and 'Shaker' are not identical. + Named property 'getStatus' of types 'Mover' and 'Shaker' are not identical. tests/cases/compiler/interfacePropertiesWithSameName2.ts(26,11): error TS2320: Interface 'MoverShaker2' cannot simultaneously extend types 'Mover' and 'Shaker'. - Named properties 'getStatus' of types 'Mover' and 'Shaker' are not identical. + Named property 'getStatus' of types 'Mover' and 'Shaker' are not identical. ==== tests/cases/compiler/interfacePropertiesWithSameName2.ts (2 errors) ==== @@ -17,7 +17,7 @@ tests/cases/compiler/interfacePropertiesWithSameName2.ts(26,11): error TS2320: I interface MoverShaker extends Mover, Shaker { ~~~~~~~~~~~ !!! error TS2320: Interface 'MoverShaker' cannot simultaneously extend types 'Mover' and 'Shaker'. -!!! error TS2320: Named properties 'getStatus' of types 'Mover' and 'Shaker' are not identical. +!!! error TS2320: Named property 'getStatus' of types 'Mover' and 'Shaker' are not identical. } @@ -36,7 +36,7 @@ tests/cases/compiler/interfacePropertiesWithSameName2.ts(26,11): error TS2320: I interface MoverShaker2 extends MoversAndShakers.Mover, MoversAndShakers.Shaker { } // error ~~~~~~~~~~~~ !!! error TS2320: Interface 'MoverShaker2' cannot simultaneously extend types 'Mover' and 'Shaker'. -!!! error TS2320: Named properties 'getStatus' of types 'Mover' and 'Shaker' are not identical. +!!! error TS2320: Named property 'getStatus' of types 'Mover' and 'Shaker' are not identical. interface MoverShaker3 extends MoversAndShakers.Mover, MoversAndShakers.Shaker { getStatus(): { speed: number; frequency: number; }; // ok because this getStatus overrides the conflicting ones above diff --git a/tests/baselines/reference/interfacePropertiesWithSameName3.errors.txt b/tests/baselines/reference/interfacePropertiesWithSameName3.errors.txt index b7dfdffc79e9e..cc333e0e0545d 100644 --- a/tests/baselines/reference/interfacePropertiesWithSameName3.errors.txt +++ b/tests/baselines/reference/interfacePropertiesWithSameName3.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/interfacePropertiesWithSameName3.ts(3,11): error TS2320: Interface 'F' cannot simultaneously extend types 'E' and 'D'. - Named properties 'a' of types 'E' and 'D' are not identical. + Named property 'a' of types 'E' and 'D' are not identical. tests/cases/compiler/interfacePropertiesWithSameName3.ts(7,11): error TS2320: Interface 'F2' cannot simultaneously extend types 'E2' and 'D2'. - Named properties 'a' of types 'E2' and 'D2' are not identical. + Named property 'a' of types 'E2' and 'D2' are not identical. ==== tests/cases/compiler/interfacePropertiesWithSameName3.ts (2 errors) ==== @@ -10,12 +10,12 @@ tests/cases/compiler/interfacePropertiesWithSameName3.ts(7,11): error TS2320: In interface F extends E, D { } // error ~ !!! error TS2320: Interface 'F' cannot simultaneously extend types 'E' and 'D'. -!!! error TS2320: Named properties 'a' of types 'E' and 'D' are not identical. +!!! error TS2320: Named property 'a' of types 'E' and 'D' are not identical. class D2 { a: number; } class E2 { a: string; } interface F2 extends E2, D2 { } // error ~~ !!! error TS2320: Interface 'F2' cannot simultaneously extend types 'E2' and 'D2'. -!!! error TS2320: Named properties 'a' of types 'E2' and 'D2' are not identical. +!!! error TS2320: Named property 'a' of types 'E2' and 'D2' are not identical. \ No newline at end of file diff --git a/tests/baselines/reference/interfaceWithMultipleBaseTypes.errors.txt b/tests/baselines/reference/interfaceWithMultipleBaseTypes.errors.txt index 1562e16df4df4..95adbbf671746 100644 --- a/tests/baselines/reference/interfaceWithMultipleBaseTypes.errors.txt +++ b/tests/baselines/reference/interfaceWithMultipleBaseTypes.errors.txt @@ -4,7 +4,7 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBa Types of property 'b' are incompatible. Type 'number' is not assignable to type 'string'. tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBaseTypes.ts(52,15): error TS2320: Interface 'Derived3' cannot simultaneously extend types 'Base1' and 'Base2'. - Named properties 'x' of types 'Base1' and 'Base2' are not identical. + Named property 'x' of types 'Base1' and 'Base2' are not identical. tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBaseTypes.ts(54,15): error TS2430: Interface 'Derived4' incorrectly extends interface 'Base1'. Types of property 'x' are incompatible. Type '{ a: T; b: T; }' is not assignable to type '{ a: number; }'. @@ -86,7 +86,7 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBa interface Derived3 extends Base1, Base2 { } // error ~~~~~~~~ !!! error TS2320: Interface 'Derived3' cannot simultaneously extend types 'Base1' and 'Base2'. -!!! error TS2320: Named properties 'x' of types 'Base1' and 'Base2' are not identical. +!!! error TS2320: Named property 'x' of types 'Base1' and 'Base2' are not identical. interface Derived4 extends Base1, Base2 { // error ~~~~~~~~ diff --git a/tests/baselines/reference/letInLetOrConstDeclarations.errors.txt b/tests/baselines/reference/letInLetOrConstDeclarations.errors.txt index 799d2d6b6982d..fbcee2765832f 100644 --- a/tests/baselines/reference/letInLetOrConstDeclarations.errors.txt +++ b/tests/baselines/reference/letInLetOrConstDeclarations.errors.txt @@ -1,21 +1,21 @@ -tests/cases/compiler/letInLetOrConstDeclarations.ts(2,9): error TS2476: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. -tests/cases/compiler/letInLetOrConstDeclarations.ts(3,14): error TS2476: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. -tests/cases/compiler/letInLetOrConstDeclarations.ts(6,11): error TS2476: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +tests/cases/compiler/letInLetOrConstDeclarations.ts(2,9): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +tests/cases/compiler/letInLetOrConstDeclarations.ts(3,14): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +tests/cases/compiler/letInLetOrConstDeclarations.ts(6,11): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. ==== tests/cases/compiler/letInLetOrConstDeclarations.ts (3 errors) ==== { let let = 1; // should error ~~~ -!!! error TS2476: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. for (let let in []) { } // should error ~~~ -!!! error TS2476: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. } { const let = 1; // should error ~~~ -!!! error TS2476: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. } { function let() { // should be ok diff --git a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.errors.txt b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.errors.txt index 4c49e6beb0c57..584edc24bb59a 100644 --- a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.errors.txt +++ b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates3.ts(9,11): error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. - Named properties 'x' of types 'C' and 'C2' are not identical. + Named property 'x' of types 'C' and 'C2' are not identical. tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates3.ts(31,15): error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. - Named properties 'x' of types 'C' and 'C2' are not identical. + Named property 'x' of types 'C' and 'C2' are not identical. ==== tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates3.ts (2 errors) ==== @@ -16,7 +16,7 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheri interface A extends C { // error ~ !!! error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. -!!! error TS2320: Named properties 'x' of types 'C' and 'C2' are not identical. +!!! error TS2320: Named property 'x' of types 'C' and 'C2' are not identical. y: string; } @@ -41,7 +41,7 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheri interface A extends C { // error, privates conflict ~ !!! error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. -!!! error TS2320: Named properties 'x' of types 'C' and 'C2' are not identical. +!!! error TS2320: Named property 'x' of types 'C' and 'C2' are not identical. y: string; } diff --git a/tests/baselines/reference/mergedInterfacesWithMultipleBases4.errors.txt b/tests/baselines/reference/mergedInterfacesWithMultipleBases4.errors.txt index 1e11dc792f122..f7ea6fbc2a014 100644 --- a/tests/baselines/reference/mergedInterfacesWithMultipleBases4.errors.txt +++ b/tests/baselines/reference/mergedInterfacesWithMultipleBases4.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithMultipleBases4.ts(19,11): error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C'. - Named properties 'a' of types 'C' and 'C' are not identical. + Named property 'a' of types 'C' and 'C' are not identical. ==== tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithMultipleBases4.ts (1 errors) ==== @@ -24,7 +24,7 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithMultip interface A extends C, C3 { // error ~ !!! error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C'. -!!! error TS2320: Named properties 'a' of types 'C' and 'C' are not identical. +!!! error TS2320: Named property 'a' of types 'C' and 'C' are not identical. y: T; } diff --git a/tests/baselines/reference/multipleBaseInterfaesWithIncompatibleProperties.errors.txt b/tests/baselines/reference/multipleBaseInterfaesWithIncompatibleProperties.errors.txt index 633f544a67bb2..70db70de97b8c 100644 --- a/tests/baselines/reference/multipleBaseInterfaesWithIncompatibleProperties.errors.txt +++ b/tests/baselines/reference/multipleBaseInterfaesWithIncompatibleProperties.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/multipleBaseInterfaesWithIncompatibleProperties.ts(6,11): error TS2320: Interface 'C' cannot simultaneously extend types 'A' and 'A'. - Named properties 'x' of types 'A' and 'A' are not identical. + Named property 'x' of types 'A' and 'A' are not identical. ==== tests/cases/compiler/multipleBaseInterfaesWithIncompatibleProperties.ts (1 errors) ==== @@ -11,5 +11,5 @@ tests/cases/compiler/multipleBaseInterfaesWithIncompatibleProperties.ts(6,11): e interface C extends A, A { } ~ !!! error TS2320: Interface 'C' cannot simultaneously extend types 'A' and 'A'. -!!! error TS2320: Named properties 'x' of types 'A' and 'A' are not identical. +!!! error TS2320: Named property 'x' of types 'A' and 'A' are not identical. \ No newline at end of file diff --git a/tests/baselines/reference/objectCreationOfElementAccessExpression.errors.txt b/tests/baselines/reference/objectCreationOfElementAccessExpression.errors.txt index 73332ff8926ee..b2f3bd9d82479 100644 --- a/tests/baselines/reference/objectCreationOfElementAccessExpression.errors.txt +++ b/tests/baselines/reference/objectCreationOfElementAccessExpression.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/objectCreationOfElementAccessExpression.ts(53,17): error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +tests/cases/compiler/objectCreationOfElementAccessExpression.ts(53,17): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. tests/cases/compiler/objectCreationOfElementAccessExpression.ts(53,63): error TS2348: Value of type 'typeof Cookie' is not callable. Did you mean to include 'new'? -tests/cases/compiler/objectCreationOfElementAccessExpression.ts(54,33): error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +tests/cases/compiler/objectCreationOfElementAccessExpression.ts(54,33): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. tests/cases/compiler/objectCreationOfElementAccessExpression.ts(54,79): error TS2348: Value of type 'typeof Cookie' is not callable. Did you mean to include 'new'? @@ -59,12 +59,12 @@ tests/cases/compiler/objectCreationOfElementAccessExpression.ts(54,79): error TS // ElementAccessExpressions can only contain one expression. There should be a parse error here. var foods = new PetFood[new IceCream('Mint chocolate chip') , Cookie('Chocolate chip', false) , new Cookie('Peanut butter', true)]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2348: Value of type 'typeof Cookie' is not callable. Did you mean to include 'new'? var foods2: MonsterFood[] = new PetFood[new IceCream('Mint chocolate chip') , Cookie('Chocolate chip', false) , new Cookie('Peanut butter', true)]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2348: Value of type 'typeof Cookie' is not callable. Did you mean to include 'new'? \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName10.errors.txt b/tests/baselines/reference/parserComputedPropertyName10.errors.txt index 061e2c40c2db8..a9b5396781aa5 100644 --- a/tests/baselines/reference/parserComputedPropertyName10.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName10.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName10.ts(2,4): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName10.ts(2,4): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName10.ts(2,5): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP class C { [e] = 1 ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName11.errors.txt b/tests/baselines/reference/parserComputedPropertyName11.errors.txt index 65748f72b2425..2a7a606f4bfcb 100644 --- a/tests/baselines/reference/parserComputedPropertyName11.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName11.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName11.ts(2,4): error TS1168: Computed property names are not allowed in method overloads. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName11.ts(2,4): error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName11.ts(2,5): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP class C { [e](); ~~~ -!!! error TS1168: Computed property names are not allowed in method overloads. +!!! error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName13.errors.txt b/tests/baselines/reference/parserComputedPropertyName13.errors.txt index b209f3c7d0184..a7a77cf12440f 100644 --- a/tests/baselines/reference/parserComputedPropertyName13.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName13.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName13.ts(1,10): error TS1170: Computed property names are not allowed in type literals. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName13.ts(1,10): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName13.ts(1,11): error TS2304: Cannot find name 'e'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName13.ts (2 errors) ==== var v: { [e]: number }; ~~~ -!!! error TS1170: Computed property names are not allowed in type literals. +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName14.errors.txt b/tests/baselines/reference/parserComputedPropertyName14.errors.txt index 6ac2d276a8010..50a6d1bc689ac 100644 --- a/tests/baselines/reference/parserComputedPropertyName14.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName14.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName14.ts(1,10): error TS1170: Computed property names are not allowed in type literals. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName14.ts(1,10): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName14.ts(1,11): error TS2304: Cannot find name 'e'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName14.ts (2 errors) ==== var v: { [e](): number }; ~~~ -!!! error TS1170: Computed property names are not allowed in type literals. +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName15.errors.txt b/tests/baselines/reference/parserComputedPropertyName15.errors.txt index f66e5930c26f4..9635178af1673 100644 --- a/tests/baselines/reference/parserComputedPropertyName15.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName15.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName15.ts(1,31): error TS1170: Computed property names are not allowed in type literals. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName15.ts(1,31): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName15.ts(1,32): error TS2304: Cannot find name 'e'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName15.ts (2 errors) ==== var v: { [e: number]: string; [e]: number }; ~~~ -!!! error TS1170: Computed property names are not allowed in type literals. +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName18.errors.txt b/tests/baselines/reference/parserComputedPropertyName18.errors.txt index f7485a127cbd1..9e64ddd0d28db 100644 --- a/tests/baselines/reference/parserComputedPropertyName18.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName18.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName18.ts(1,10): error TS1170: Computed property names are not allowed in type literals. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName18.ts(1,10): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName18.ts(1,11): error TS2304: Cannot find name 'e'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName18.ts (2 errors) ==== var v: { [e]?(): number }; ~~~ -!!! error TS1170: Computed property names are not allowed in type literals. +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName19.errors.txt b/tests/baselines/reference/parserComputedPropertyName19.errors.txt index 65c22ff36c39a..86bb591011e36 100644 --- a/tests/baselines/reference/parserComputedPropertyName19.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName19.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName19.ts(1,10): error TS1170: Computed property names are not allowed in type literals. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName19.ts(1,10): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName19.ts(1,11): error TS2304: Cannot find name 'e'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName19.ts (2 errors) ==== var v: { [e]? }; ~~~ -!!! error TS1170: Computed property names are not allowed in type literals. +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName20.errors.txt b/tests/baselines/reference/parserComputedPropertyName20.errors.txt index d65dfede1d241..035e494af332c 100644 --- a/tests/baselines/reference/parserComputedPropertyName20.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName20.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName20.ts(2,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName20.ts(2,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName20.ts(2,6): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP interface I { [e](): number ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName21.errors.txt b/tests/baselines/reference/parserComputedPropertyName21.errors.txt index 5a9738a23a697..4ebc321cc8032 100644 --- a/tests/baselines/reference/parserComputedPropertyName21.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName21.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName21.ts(2,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName21.ts(2,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName21.ts(2,6): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP interface I { [e]: number ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName22.errors.txt b/tests/baselines/reference/parserComputedPropertyName22.errors.txt index ce20dd0c58759..fd9e37970187c 100644 --- a/tests/baselines/reference/parserComputedPropertyName22.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName22.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName22.ts(2,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName22.ts(2,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName22.ts(2,6): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP declare class C { [e]: number ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName25.errors.txt b/tests/baselines/reference/parserComputedPropertyName25.errors.txt index 8d26c8afdb7f1..0d0a2a8d8332b 100644 --- a/tests/baselines/reference/parserComputedPropertyName25.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName25.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName25.ts(3,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName25.ts(3,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName25.ts(3,6): error TS2304: Cannot find name 'e'. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName25.ts(4,6): error TS2304: Cannot find name 'e2'. @@ -8,7 +8,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP // No ASI [e] = 0 ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. [e2] = 1 diff --git a/tests/baselines/reference/parserComputedPropertyName28.errors.txt b/tests/baselines/reference/parserComputedPropertyName28.errors.txt index c522ec031ebdc..a84f3b7d16b96 100644 --- a/tests/baselines/reference/parserComputedPropertyName28.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName28.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(2,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(2,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(2,6): error TS2304: Cannot find name 'e'. -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(3,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(3,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(3,6): error TS2304: Cannot find name 'e2'. @@ -8,12 +8,12 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP class C { [e]: number = 0; ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. [e2]: number ~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~~ !!! error TS2304: Cannot find name 'e2'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName29.errors.txt b/tests/baselines/reference/parserComputedPropertyName29.errors.txt index 5e6baed0f0674..3d886eacc5063 100644 --- a/tests/baselines/reference/parserComputedPropertyName29.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName29.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(3,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(3,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(3,6): error TS2304: Cannot find name 'e'. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(3,11): error TS2304: Cannot find name 'id'. -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(4,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(4,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(4,6): error TS2304: Cannot find name 'e2'. @@ -10,14 +10,14 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP // yes ASI [e] = id++ ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. ~~ !!! error TS2304: Cannot find name 'id'. [e2]: number ~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~~ !!! error TS2304: Cannot find name 'e2'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName31.errors.txt b/tests/baselines/reference/parserComputedPropertyName31.errors.txt index 97a3b1ee18758..4661b0797af98 100644 --- a/tests/baselines/reference/parserComputedPropertyName31.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName31.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(3,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(3,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(3,6): error TS2304: Cannot find name 'e'. -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(4,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(4,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(4,6): error TS2304: Cannot find name 'e2'. @@ -9,12 +9,12 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP // yes ASI [e]: number ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. [e2]: number ~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~~ !!! error TS2304: Cannot find name 'e2'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName32.errors.txt b/tests/baselines/reference/parserComputedPropertyName32.errors.txt index da423baaa0523..4be8d70383e19 100644 --- a/tests/baselines/reference/parserComputedPropertyName32.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName32.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName32.ts(2,5): error TS1165: Computed property names are not allowed in an ambient context. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName32.ts(2,5): error TS1165: A computed property name in an ambient context must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName32.ts(2,6): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP declare class C { [e](): number ~~~ -!!! error TS1165: Computed property names are not allowed in an ambient context. +!!! error TS1165: A computed property name in an ambient context must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName36.errors.txt b/tests/baselines/reference/parserComputedPropertyName36.errors.txt index 1b4130b0e2734..07e937b3b42a6 100644 --- a/tests/baselines/reference/parserComputedPropertyName36.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName36.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName36.ts(2,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName36.ts(2,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName36.ts(2,6): error TS2304: Cannot find name 'public'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP class C { [public ]: string; ~~~~~~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~~~~~~ !!! error TS2304: Cannot find name 'public'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName41.errors.txt b/tests/baselines/reference/parserComputedPropertyName41.errors.txt index 65d4ec8627f6a..5389b187cad38 100644 --- a/tests/baselines/reference/parserComputedPropertyName41.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName41.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName41.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName41.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName41.ts (1 errors) ==== var v = { [0 in []]: true ~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName7.errors.txt b/tests/baselines/reference/parserComputedPropertyName7.errors.txt index bcf39b0ca0ac7..056fa3d82fdd4 100644 --- a/tests/baselines/reference/parserComputedPropertyName7.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName7.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName7.ts(2,4): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName7.ts(2,4): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName7.ts(2,5): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP class C { [e] ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName8.errors.txt b/tests/baselines/reference/parserComputedPropertyName8.errors.txt index 250c7a52c6e38..32bb490635357 100644 --- a/tests/baselines/reference/parserComputedPropertyName8.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName8.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName8.ts(2,11): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName8.ts(2,11): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName8.ts(2,12): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP class C { public [e] ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName9.errors.txt b/tests/baselines/reference/parserComputedPropertyName9.errors.txt index fd43404656462..9db0cbde3bd29 100644 --- a/tests/baselines/reference/parserComputedPropertyName9.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName9.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName9.ts(2,4): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName9.ts(2,4): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName9.ts(2,5): error TS2304: Cannot find name 'e'. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName9.ts(2,9): error TS2304: Cannot find name 'Type'. @@ -7,7 +7,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP class C { [e]: Type ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. ~~~~ diff --git a/tests/baselines/reference/parserES5ComputedPropertyName1.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName1.errors.txt index 55af923e54b8d..2c8f1d2ab4f0e 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName1.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName1.ts(2,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName1.ts(2,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName1.ts(2,6): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5Comput declare class C { [e]: number ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName10.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName10.errors.txt index 7db85cdef3519..31d3f9985abae 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName10.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName10.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName10.ts(2,4): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName10.ts(2,4): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName10.ts(2,5): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5Comput class C { [e] = 1 ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName11.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName11.errors.txt index ead27a994d105..b4808607ab06d 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName11.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName11.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName11.ts(2,4): error TS1168: Computed property names are not allowed in method overloads. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName11.ts(2,4): error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName11.ts(2,5): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5Comput class C { [e](); ~~~ -!!! error TS1168: Computed property names are not allowed in method overloads. +!!! error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName5.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName5.errors.txt index 122ca20a0e439..9125ce7b58f42 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName5.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName5.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName5.ts(2,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName5.ts(2,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName5.ts(2,6): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5Comput interface I { [e]: number ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName7.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName7.errors.txt index d38d57d87be75..277bdcd3c94a5 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName7.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName7.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName7.ts(2,4): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName7.ts(2,4): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName7.ts(2,5): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5Comput class C { [e] ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName8.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName8.errors.txt index e52727c6929bc..6b674a1d2c05b 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName8.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName8.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName8.ts(1,10): error TS1170: Computed property names are not allowed in type literals. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName8.ts(1,10): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName8.ts(1,11): error TS2304: Cannot find name 'e'. ==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName8.ts (2 errors) ==== var v: { [e]: number }; ~~~ -!!! error TS1170: Computed property names are not allowed in type literals. +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName9.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName9.errors.txt index 8cbe0ffcf8dc3..fb087a4d82fcc 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName9.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName9.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName9.ts(2,4): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName9.ts(2,4): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName9.ts(2,5): error TS2304: Cannot find name 'e'. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName9.ts(2,9): error TS2304: Cannot find name 'Type'. @@ -7,7 +7,7 @@ tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5Comput class C { [e]: Type ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. ~~~~ diff --git a/tests/baselines/reference/parserES5SymbolIndexer1.errors.txt b/tests/baselines/reference/parserES5SymbolIndexer1.errors.txt new file mode 100644 index 0000000000000..adfac8f700f2f --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolIndexer1.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts(2,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts (1 errors) ==== + interface I { + [s: symbol]: string; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolIndexer1.js b/tests/baselines/reference/parserES5SymbolIndexer1.js new file mode 100644 index 0000000000000..641d93b1170bd --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolIndexer1.js @@ -0,0 +1,6 @@ +//// [parserES5SymbolIndexer1.ts] +interface I { + [s: symbol]: string; +} + +//// [parserES5SymbolIndexer1.js] diff --git a/tests/baselines/reference/parserES5SymbolIndexer2.errors.txt b/tests/baselines/reference/parserES5SymbolIndexer2.errors.txt new file mode 100644 index 0000000000000..12eef8ec04967 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolIndexer2.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts(2,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts (1 errors) ==== + class C { + [s: symbol]: string; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolIndexer2.js b/tests/baselines/reference/parserES5SymbolIndexer2.js new file mode 100644 index 0000000000000..c511b6acafae2 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolIndexer2.js @@ -0,0 +1,11 @@ +//// [parserES5SymbolIndexer2.ts] +class C { + [s: symbol]: string; +} + +//// [parserES5SymbolIndexer2.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserES5SymbolIndexer3.errors.txt b/tests/baselines/reference/parserES5SymbolIndexer3.errors.txt new file mode 100644 index 0000000000000..c9cd9db4fab8b --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolIndexer3.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts(2,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts (1 errors) ==== + var x: { + [s: symbol]: string; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolIndexer3.js b/tests/baselines/reference/parserES5SymbolIndexer3.js new file mode 100644 index 0000000000000..daffb51a6d76a --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolIndexer3.js @@ -0,0 +1,7 @@ +//// [parserES5SymbolIndexer3.ts] +var x: { + [s: symbol]: string; +} + +//// [parserES5SymbolIndexer3.js] +var x; diff --git a/tests/baselines/reference/parserES5SymbolProperty1.errors.txt b/tests/baselines/reference/parserES5SymbolProperty1.errors.txt new file mode 100644 index 0000000000000..e82ac4c3bc6c2 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty1.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty1.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty1.ts(2,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty1.ts (2 errors) ==== + interface I { + [Symbol.iterator]: string; + ~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty1.js b/tests/baselines/reference/parserES5SymbolProperty1.js new file mode 100644 index 0000000000000..36030aec105bc --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty1.js @@ -0,0 +1,6 @@ +//// [parserES5SymbolProperty1.ts] +interface I { + [Symbol.iterator]: string; +} + +//// [parserES5SymbolProperty1.js] diff --git a/tests/baselines/reference/parserES5SymbolProperty2.errors.txt b/tests/baselines/reference/parserES5SymbolProperty2.errors.txt new file mode 100644 index 0000000000000..c8ca6613da8bb --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty2.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty2.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty2.ts(2,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty2.ts (2 errors) ==== + interface I { + [Symbol.unscopables](): string; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty2.js b/tests/baselines/reference/parserES5SymbolProperty2.js new file mode 100644 index 0000000000000..d600b05ea52dd --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty2.js @@ -0,0 +1,6 @@ +//// [parserES5SymbolProperty2.ts] +interface I { + [Symbol.unscopables](): string; +} + +//// [parserES5SymbolProperty2.js] diff --git a/tests/baselines/reference/parserES5SymbolProperty3.errors.txt b/tests/baselines/reference/parserES5SymbolProperty3.errors.txt new file mode 100644 index 0000000000000..4bd883b44b73b --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty3.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty3.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty3.ts(2,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty3.ts (2 errors) ==== + declare class C { + [Symbol.unscopables](): string; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty3.js b/tests/baselines/reference/parserES5SymbolProperty3.js new file mode 100644 index 0000000000000..0d0fb18313fb7 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty3.js @@ -0,0 +1,6 @@ +//// [parserES5SymbolProperty3.ts] +declare class C { + [Symbol.unscopables](): string; +} + +//// [parserES5SymbolProperty3.js] diff --git a/tests/baselines/reference/parserES5SymbolProperty4.errors.txt b/tests/baselines/reference/parserES5SymbolProperty4.errors.txt new file mode 100644 index 0000000000000..cdc5510766e0d --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty4.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty4.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty4.ts(2,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty4.ts (2 errors) ==== + declare class C { + [Symbol.isRegExp]: string; + ~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty4.js b/tests/baselines/reference/parserES5SymbolProperty4.js new file mode 100644 index 0000000000000..d8f55358e73ce --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty4.js @@ -0,0 +1,6 @@ +//// [parserES5SymbolProperty4.ts] +declare class C { + [Symbol.isRegExp]: string; +} + +//// [parserES5SymbolProperty4.js] diff --git a/tests/baselines/reference/parserES5SymbolProperty5.errors.txt b/tests/baselines/reference/parserES5SymbolProperty5.errors.txt new file mode 100644 index 0000000000000..2e80a55b47e06 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty5.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty5.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty5.ts(2,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty5.ts (2 errors) ==== + class C { + [Symbol.isRegExp]: string; + ~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty5.js b/tests/baselines/reference/parserES5SymbolProperty5.js new file mode 100644 index 0000000000000..e2448432542c5 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty5.js @@ -0,0 +1,11 @@ +//// [parserES5SymbolProperty5.ts] +class C { + [Symbol.isRegExp]: string; +} + +//// [parserES5SymbolProperty5.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserES5SymbolProperty6.errors.txt b/tests/baselines/reference/parserES5SymbolProperty6.errors.txt new file mode 100644 index 0000000000000..615be8ca8da51 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty6.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty6.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty6.ts(2,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty6.ts (2 errors) ==== + class C { + [Symbol.toStringTag]: string = ""; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty6.js b/tests/baselines/reference/parserES5SymbolProperty6.js new file mode 100644 index 0000000000000..ce2050688c3a1 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty6.js @@ -0,0 +1,12 @@ +//// [parserES5SymbolProperty6.ts] +class C { + [Symbol.toStringTag]: string = ""; +} + +//// [parserES5SymbolProperty6.js] +var C = (function () { + function C() { + this[Symbol.toStringTag] = ""; + } + return C; +})(); diff --git a/tests/baselines/reference/parserES5SymbolProperty7.errors.txt b/tests/baselines/reference/parserES5SymbolProperty7.errors.txt new file mode 100644 index 0000000000000..fa43310f0a7ea --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty7.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty7.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty7.ts(2,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty7.ts (2 errors) ==== + class C { + [Symbol.toStringTag](): void { } + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty7.js b/tests/baselines/reference/parserES5SymbolProperty7.js new file mode 100644 index 0000000000000..102d10af417d5 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty7.js @@ -0,0 +1,12 @@ +//// [parserES5SymbolProperty7.ts] +class C { + [Symbol.toStringTag](): void { } +} + +//// [parserES5SymbolProperty7.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.toStringTag] = function () { }; + return C; +})(); diff --git a/tests/baselines/reference/parserES5SymbolProperty8.errors.txt b/tests/baselines/reference/parserES5SymbolProperty8.errors.txt new file mode 100644 index 0000000000000..ce7ce5b83190e --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty8.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty8.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty8.ts(2,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty8.ts (2 errors) ==== + var x: { + [Symbol.toPrimitive](): string + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty8.js b/tests/baselines/reference/parserES5SymbolProperty8.js new file mode 100644 index 0000000000000..ed3a55db0f2df --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty8.js @@ -0,0 +1,7 @@ +//// [parserES5SymbolProperty8.ts] +var x: { + [Symbol.toPrimitive](): string +} + +//// [parserES5SymbolProperty8.js] +var x; diff --git a/tests/baselines/reference/parserES5SymbolProperty9.errors.txt b/tests/baselines/reference/parserES5SymbolProperty9.errors.txt new file mode 100644 index 0000000000000..90c3785c93845 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty9.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty9.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty9.ts(2,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty9.ts (2 errors) ==== + var x: { + [Symbol.toPrimitive]: string + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty9.js b/tests/baselines/reference/parserES5SymbolProperty9.js new file mode 100644 index 0000000000000..4728765e5533e --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty9.js @@ -0,0 +1,7 @@ +//// [parserES5SymbolProperty9.ts] +var x: { + [Symbol.toPrimitive]: string +} + +//// [parserES5SymbolProperty9.js] +var x; diff --git a/tests/baselines/reference/parserForStatement3.errors.txt b/tests/baselines/reference/parserForStatement3.errors.txt index 533958505c11e..06c3f083d45ce 100644 --- a/tests/baselines/reference/parserForStatement3.errors.txt +++ b/tests/baselines/reference/parserForStatement3.errors.txt @@ -1,5 +1,4 @@ tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement3.ts(1,5): error TS2304: Cannot find name 'd'. -tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement3.ts(1,5): error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement3.ts(1,10): error TS2304: Cannot find name '_'. tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement3.ts(1,15): error TS2304: Cannot find name 'a'. tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement3.ts(1,18): error TS2304: Cannot find name '_'. @@ -7,12 +6,10 @@ tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement3.ts(1,2 tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement3.ts(1,30): error TS2304: Cannot find name 'b'. -==== tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement3.ts (7 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement3.ts (6 errors) ==== for(d in _.jh[a]=_.jh[a]||[],b); ~ !!! error TS2304: Cannot find name 'd'. - ~ -!!! error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. ~ !!! error TS2304: Cannot find name '_'. ~ diff --git a/tests/baselines/reference/parserForStatement6.errors.txt b/tests/baselines/reference/parserForStatement6.errors.txt index a098141c81b3d..a41f103e929ca 100644 --- a/tests/baselines/reference/parserForStatement6.errors.txt +++ b/tests/baselines/reference/parserForStatement6.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement6.ts(1,6): error TS2304: Cannot find name 'foo'. -tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement6.ts(1,6): error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. +tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement6.ts(1,6): error TS2406: Invalid left-hand side in 'for...in' statement. tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement6.ts(1,15): error TS2304: Cannot find name 'b'. @@ -8,7 +8,7 @@ tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement6.ts(1,1 ~~~ !!! error TS2304: Cannot find name 'foo'. ~~~~~ -!!! error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. +!!! error TS2406: Invalid left-hand side in 'for...in' statement. ~ !!! error TS2304: Cannot find name 'b'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForStatement7.errors.txt b/tests/baselines/reference/parserForStatement7.errors.txt index da1f1ce6808f7..3aa67480105aa 100644 --- a/tests/baselines/reference/parserForStatement7.errors.txt +++ b/tests/baselines/reference/parserForStatement7.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement7.ts(1,6): error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. +tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement7.ts(1,6): error TS2406: Invalid left-hand side in 'for...in' statement. tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement7.ts(1,10): error TS2304: Cannot find name 'foo'. tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement7.ts(1,19): error TS2304: Cannot find name 'b'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement7.ts(1,1 ==== tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement7.ts (3 errors) ==== for (new foo() in b) { ~~~~~~~~~ -!!! error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. +!!! error TS2406: Invalid left-hand side in 'for...in' statement. ~~~ !!! error TS2304: Cannot find name 'foo'. ~ diff --git a/tests/baselines/reference/parserIndexSignature11.errors.txt b/tests/baselines/reference/parserIndexSignature11.errors.txt index 8cf474b19bb1d..f1f2a4a00f465 100644 --- a/tests/baselines/reference/parserIndexSignature11.errors.txt +++ b/tests/baselines/reference/parserIndexSignature11.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts(2,9): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts(2,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts(2,10): error TS2304: Cannot find name 'p'. tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts(3,9): error TS1021: An index signature must have a type annotation. tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts(4,10): error TS1096: An index signature must have exactly one parameter. @@ -8,7 +8,7 @@ tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature1 interface I { [p]; // Used to be indexer, now it is a computed property ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; diff --git a/tests/baselines/reference/parserIndexSignature4.errors.txt b/tests/baselines/reference/parserIndexSignature4.errors.txt index d625f27eb6fc6..bd73b4d2bf451 100644 --- a/tests/baselines/reference/parserIndexSignature4.errors.txt +++ b/tests/baselines/reference/parserIndexSignature4.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature4.ts(2,3): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature4.ts(2,3): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature4.ts(2,4): error TS2304: Cannot find name 'a'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature4 interface I { [a = 0] // Used to be indexer, now it is a computed property ~~~~~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'a'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserIndexSignature5.errors.txt b/tests/baselines/reference/parserIndexSignature5.errors.txt index 3f3415973d962..54ccd05f4f99f 100644 --- a/tests/baselines/reference/parserIndexSignature5.errors.txt +++ b/tests/baselines/reference/parserIndexSignature5.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature5.ts(2,3): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature5.ts(2,3): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature5.ts(2,4): error TS2304: Cannot find name 'a'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature5 interface I { [a] // Used to be indexer, now it is a computed property ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'a'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolIndexer1.errors.txt b/tests/baselines/reference/parserSymbolIndexer1.errors.txt new file mode 100644 index 0000000000000..5c6c38d52b122 --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer1.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer1.ts(2,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer1.ts (1 errors) ==== + interface I { + [s: symbol]: string; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolIndexer1.js b/tests/baselines/reference/parserSymbolIndexer1.js new file mode 100644 index 0000000000000..752391dad5355 --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer1.js @@ -0,0 +1,6 @@ +//// [parserSymbolIndexer1.ts] +interface I { + [s: symbol]: string; +} + +//// [parserSymbolIndexer1.js] diff --git a/tests/baselines/reference/parserSymbolIndexer2.errors.txt b/tests/baselines/reference/parserSymbolIndexer2.errors.txt new file mode 100644 index 0000000000000..3961f4942de4b --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer2.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer2.ts(2,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer2.ts (1 errors) ==== + class C { + [s: symbol]: string; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolIndexer2.js b/tests/baselines/reference/parserSymbolIndexer2.js new file mode 100644 index 0000000000000..563614e1c8cf7 --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer2.js @@ -0,0 +1,11 @@ +//// [parserSymbolIndexer2.ts] +class C { + [s: symbol]: string; +} + +//// [parserSymbolIndexer2.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserSymbolIndexer3.errors.txt b/tests/baselines/reference/parserSymbolIndexer3.errors.txt new file mode 100644 index 0000000000000..5484a096d4ce0 --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer3.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer3.ts(2,13): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer3.ts (1 errors) ==== + class C { + static [s: symbol]: string; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolIndexer3.js b/tests/baselines/reference/parserSymbolIndexer3.js new file mode 100644 index 0000000000000..917945193aee0 --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer3.js @@ -0,0 +1,11 @@ +//// [parserSymbolIndexer3.ts] +class C { + static [s: symbol]: string; +} + +//// [parserSymbolIndexer3.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserSymbolIndexer4.errors.txt b/tests/baselines/reference/parserSymbolIndexer4.errors.txt new file mode 100644 index 0000000000000..1cf184a48472b --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer4.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer4.ts(2,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer4.ts (1 errors) ==== + var x: { + [s: symbol]: string; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolIndexer4.js b/tests/baselines/reference/parserSymbolIndexer4.js new file mode 100644 index 0000000000000..21367ca596955 --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer4.js @@ -0,0 +1,7 @@ +//// [parserSymbolIndexer4.ts] +var x: { + [s: symbol]: string; +} + +//// [parserSymbolIndexer4.js] +var x; diff --git a/tests/baselines/reference/parserSymbolIndexer5.errors.txt b/tests/baselines/reference/parserSymbolIndexer5.errors.txt new file mode 100644 index 0000000000000..a8c19338e017b --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer5.errors.txt @@ -0,0 +1,24 @@ +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts(2,6): error TS2304: Cannot find name 's'. +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts(2,7): error TS1005: ']' expected. +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts(2,9): error TS2304: Cannot find name 'symbol'. +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts(2,15): error TS1005: ',' expected. +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts(2,16): error TS1136: Property assignment expected. +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts(3,1): error TS1005: ':' expected. + + +==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts (6 errors) ==== + var x = { + [s: symbol]: "" + ~ +!!! error TS2304: Cannot find name 's'. + ~ +!!! error TS1005: ']' expected. + ~~~~~~ +!!! error TS2304: Cannot find name 'symbol'. + ~ +!!! error TS1005: ',' expected. + ~ +!!! error TS1136: Property assignment expected. + } + ~ +!!! error TS1005: ':' expected. \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolIndexer5.js b/tests/baselines/reference/parserSymbolIndexer5.js new file mode 100644 index 0000000000000..43c456b64aa23 --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer5.js @@ -0,0 +1,10 @@ +//// [parserSymbolIndexer5.ts] +var x = { + [s: symbol]: "" +} + +//// [parserSymbolIndexer5.js] +var x = { + [s]: symbol, + "": +}; diff --git a/tests/baselines/reference/parserSymbolProperty1.js b/tests/baselines/reference/parserSymbolProperty1.js new file mode 100644 index 0000000000000..6bcede608fbf9 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty1.js @@ -0,0 +1,6 @@ +//// [parserSymbolProperty1.ts] +interface I { + [Symbol.iterator]: string; +} + +//// [parserSymbolProperty1.js] diff --git a/tests/baselines/reference/parserSymbolProperty1.types b/tests/baselines/reference/parserSymbolProperty1.types new file mode 100644 index 0000000000000..6c0cd75cf59a7 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty1.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty1.ts === +interface I { +>I : I + + [Symbol.iterator]: string; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +} diff --git a/tests/baselines/reference/parserSymbolProperty2.js b/tests/baselines/reference/parserSymbolProperty2.js new file mode 100644 index 0000000000000..6530072d46f5b --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty2.js @@ -0,0 +1,6 @@ +//// [parserSymbolProperty2.ts] +interface I { + [Symbol.unscopables](): string; +} + +//// [parserSymbolProperty2.js] diff --git a/tests/baselines/reference/parserSymbolProperty2.types b/tests/baselines/reference/parserSymbolProperty2.types new file mode 100644 index 0000000000000..bcf14b83a2ae2 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty2.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty2.ts === +interface I { +>I : I + + [Symbol.unscopables](): string; +>Symbol.unscopables : symbol +>Symbol : SymbolConstructor +>unscopables : symbol +} diff --git a/tests/baselines/reference/parserSymbolProperty3.js b/tests/baselines/reference/parserSymbolProperty3.js new file mode 100644 index 0000000000000..5b1b48254b1ee --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty3.js @@ -0,0 +1,6 @@ +//// [parserSymbolProperty3.ts] +declare class C { + [Symbol.unscopables](): string; +} + +//// [parserSymbolProperty3.js] diff --git a/tests/baselines/reference/parserSymbolProperty3.types b/tests/baselines/reference/parserSymbolProperty3.types new file mode 100644 index 0000000000000..977375d7393f9 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty3.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty3.ts === +declare class C { +>C : C + + [Symbol.unscopables](): string; +>Symbol.unscopables : symbol +>Symbol : SymbolConstructor +>unscopables : symbol +} diff --git a/tests/baselines/reference/parserSymbolProperty4.js b/tests/baselines/reference/parserSymbolProperty4.js new file mode 100644 index 0000000000000..f79db0b1d79b0 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty4.js @@ -0,0 +1,6 @@ +//// [parserSymbolProperty4.ts] +declare class C { + [Symbol.isRegExp]: string; +} + +//// [parserSymbolProperty4.js] diff --git a/tests/baselines/reference/parserSymbolProperty4.types b/tests/baselines/reference/parserSymbolProperty4.types new file mode 100644 index 0000000000000..a9070897fa879 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty4.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty4.ts === +declare class C { +>C : C + + [Symbol.isRegExp]: string; +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol +} diff --git a/tests/baselines/reference/parserSymbolProperty5.js b/tests/baselines/reference/parserSymbolProperty5.js new file mode 100644 index 0000000000000..922e1fb0323ba --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty5.js @@ -0,0 +1,11 @@ +//// [parserSymbolProperty5.ts] +class C { + [Symbol.isRegExp]: string; +} + +//// [parserSymbolProperty5.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserSymbolProperty5.types b/tests/baselines/reference/parserSymbolProperty5.types new file mode 100644 index 0000000000000..8a171598e8342 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty5.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty5.ts === +class C { +>C : C + + [Symbol.isRegExp]: string; +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol +} diff --git a/tests/baselines/reference/parserSymbolProperty6.js b/tests/baselines/reference/parserSymbolProperty6.js new file mode 100644 index 0000000000000..cbc06cd295173 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty6.js @@ -0,0 +1,12 @@ +//// [parserSymbolProperty6.ts] +class C { + [Symbol.toStringTag]: string = ""; +} + +//// [parserSymbolProperty6.js] +var C = (function () { + function C() { + this[Symbol.toStringTag] = ""; + } + return C; +})(); diff --git a/tests/baselines/reference/parserSymbolProperty6.types b/tests/baselines/reference/parserSymbolProperty6.types new file mode 100644 index 0000000000000..660cbf4e545ac --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty6.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty6.ts === +class C { +>C : C + + [Symbol.toStringTag]: string = ""; +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol +} diff --git a/tests/baselines/reference/parserSymbolProperty7.js b/tests/baselines/reference/parserSymbolProperty7.js new file mode 100644 index 0000000000000..9368fd1285564 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty7.js @@ -0,0 +1,12 @@ +//// [parserSymbolProperty7.ts] +class C { + [Symbol.toStringTag](): void { } +} + +//// [parserSymbolProperty7.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.toStringTag] = function () { }; + return C; +})(); diff --git a/tests/baselines/reference/parserSymbolProperty7.types b/tests/baselines/reference/parserSymbolProperty7.types new file mode 100644 index 0000000000000..f8dc2523692f0 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty7.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty7.ts === +class C { +>C : C + + [Symbol.toStringTag](): void { } +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol +} diff --git a/tests/baselines/reference/parserSymbolProperty8.js b/tests/baselines/reference/parserSymbolProperty8.js new file mode 100644 index 0000000000000..f312ede6b1d3e --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty8.js @@ -0,0 +1,7 @@ +//// [parserSymbolProperty8.ts] +var x: { + [Symbol.toPrimitive](): string +} + +//// [parserSymbolProperty8.js] +var x; diff --git a/tests/baselines/reference/parserSymbolProperty8.types b/tests/baselines/reference/parserSymbolProperty8.types new file mode 100644 index 0000000000000..06387c9c231e0 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty8.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty8.ts === +var x: { +>x : { [Symbol.toPrimitive](): string; } + + [Symbol.toPrimitive](): string +>Symbol.toPrimitive : symbol +>Symbol : SymbolConstructor +>toPrimitive : symbol +} diff --git a/tests/baselines/reference/parserSymbolProperty9.js b/tests/baselines/reference/parserSymbolProperty9.js new file mode 100644 index 0000000000000..6efc6650ea0d0 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty9.js @@ -0,0 +1,7 @@ +//// [parserSymbolProperty9.ts] +var x: { + [Symbol.toPrimitive]: string +} + +//// [parserSymbolProperty9.js] +var x; diff --git a/tests/baselines/reference/parserSymbolProperty9.types b/tests/baselines/reference/parserSymbolProperty9.types new file mode 100644 index 0000000000000..40fbde2acff65 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty9.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty9.ts === +var x: { +>x : { [Symbol.toPrimitive]: string; } + + [Symbol.toPrimitive]: string +>Symbol.toPrimitive : symbol +>Symbol : SymbolConstructor +>toPrimitive : symbol +} diff --git a/tests/baselines/reference/propertyAccess.errors.txt b/tests/baselines/reference/propertyAccess.errors.txt index 5cffcbec64c40..d9cd90a48fcd9 100644 --- a/tests/baselines/reference/propertyAccess.errors.txt +++ b/tests/baselines/reference/propertyAccess.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(45,14): error TS2339: Property 'qqq' does not exist on type '{ 10: string; x: string; y: number; z: { n: string; m: number; o: () => boolean; }; 'literal property': number; }'. -tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(80,10): error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. -tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(117,10): error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. -tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(140,12): error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(80,10): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. +tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(117,10): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. +tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(140,12): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. ==== tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts (4 errors) ==== @@ -88,7 +88,7 @@ tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(140,12): er // Bracket notation property access using value of other type on type with numeric index signature and no string index signature var ll = numIndex[someObject]; // Error ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. // Bracket notation property access using string value on type with string index signature and no numeric index signature var mm = strIndex['N']; @@ -127,7 +127,7 @@ tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(140,12): er // Bracket notation property access using values of other types on type with no index signatures var uu = noIndex[someObject]; // Error ~~~~~~~~~~~~~~~~~~~ -!!! error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. // Bracket notation property access using numeric value on type with numeric index signature and string index signature var vv = noIndex[32]; @@ -152,7 +152,7 @@ tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(140,12): er // Bracket notation property access using value of other type on type with numeric index signature and no string index signature and string index signature var zzzz = bothIndex[someObject]; // Error ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. var x1 = numIndex[stringOrNumber]; var x1: any; diff --git a/tests/baselines/reference/propertyAssignment.errors.txt b/tests/baselines/reference/propertyAssignment.errors.txt index 51850754a9aa0..47359caf9c255 100644 --- a/tests/baselines/reference/propertyAssignment.errors.txt +++ b/tests/baselines/reference/propertyAssignment.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/propertyAssignment.ts(6,13): error TS1170: Computed property names are not allowed in type literals. +tests/cases/compiler/propertyAssignment.ts(6,13): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. tests/cases/compiler/propertyAssignment.ts(6,14): error TS2304: Cannot find name 'index'. tests/cases/compiler/propertyAssignment.ts(14,1): error TS2322: Type '{ x: number; }' is not assignable to type 'new () => any'. tests/cases/compiler/propertyAssignment.ts(16,1): error TS2322: Type '{ x: number; }' is not assignable to type '() => void'. @@ -12,7 +12,7 @@ tests/cases/compiler/propertyAssignment.ts(16,1): error TS2322: Type '{ x: numbe var foo2: { [index]; } // should be an error, used to be indexer, now it is a computed property ~~~~~~~ -!!! error TS1170: Computed property names are not allowed in type literals. +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. ~~~~~ !!! error TS2304: Cannot find name 'index'. var bar2: { x : number; } diff --git a/tests/baselines/reference/shadowingViaLocalValue.errors.txt b/tests/baselines/reference/shadowingViaLocalValue.errors.txt index 5e683d3ee6ff8..8e6f16b91ccf5 100644 --- a/tests/baselines/reference/shadowingViaLocalValue.errors.txt +++ b/tests/baselines/reference/shadowingViaLocalValue.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/shadowingViaLocalValue.ts(2,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. -tests/cases/compiler/shadowingViaLocalValue.ts(4,13): error TS2477: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. +tests/cases/compiler/shadowingViaLocalValue.ts(4,13): error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. tests/cases/compiler/shadowingViaLocalValue.ts(9,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. -tests/cases/compiler/shadowingViaLocalValue.ts(11,18): error TS2477: Cannot initialize outer scoped variable 'x1' in the same scope as block scoped declaration 'x1'. +tests/cases/compiler/shadowingViaLocalValue.ts(11,18): error TS2481: Cannot initialize outer scoped variable 'x1' in the same scope as block scoped declaration 'x1'. ==== tests/cases/compiler/shadowingViaLocalValue.ts (4 errors) ==== @@ -12,7 +12,7 @@ tests/cases/compiler/shadowingViaLocalValue.ts(11,18): error TS2477: Cannot init { var x = 1; ~ -!!! error TS2477: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. +!!! error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. } } @@ -23,7 +23,7 @@ tests/cases/compiler/shadowingViaLocalValue.ts(11,18): error TS2477: Cannot init { for (var x1 = 0; ;); ~~ -!!! error TS2477: Cannot initialize outer scoped variable 'x1' in the same scope as block scoped declaration 'x1'. +!!! error TS2481: Cannot initialize outer scoped variable 'x1' in the same scope as block scoped declaration 'x1'. } } diff --git a/tests/baselines/reference/symbolDeclarationEmit1.js b/tests/baselines/reference/symbolDeclarationEmit1.js new file mode 100644 index 0000000000000..16d208db5eb86 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit1.js @@ -0,0 +1,17 @@ +//// [symbolDeclarationEmit1.ts] +class C { + [Symbol.isRegExp]: number; +} + +//// [symbolDeclarationEmit1.js] +var C = (function () { + function C() { + } + return C; +})(); + + +//// [symbolDeclarationEmit1.d.ts] +declare class C { + [Symbol.isRegExp]: number; +} diff --git a/tests/baselines/reference/symbolDeclarationEmit1.types b/tests/baselines/reference/symbolDeclarationEmit1.types new file mode 100644 index 0000000000000..e35bbfe886136 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit1.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit1.ts === +class C { +>C : C + + [Symbol.isRegExp]: number; +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol +} diff --git a/tests/baselines/reference/symbolDeclarationEmit10.js b/tests/baselines/reference/symbolDeclarationEmit10.js new file mode 100644 index 0000000000000..090adc03a1cf3 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit10.js @@ -0,0 +1,19 @@ +//// [symbolDeclarationEmit10.ts] +var obj = { + get [Symbol.isConcatSpreadable]() { return '' }, + set [Symbol.isConcatSpreadable](x) { } +} + +//// [symbolDeclarationEmit10.js] +var obj = { + get [Symbol.isConcatSpreadable]() { + return ''; + }, + set [Symbol.isConcatSpreadable](x) { } +}; + + +//// [symbolDeclarationEmit10.d.ts] +declare var obj: { + [Symbol.isConcatSpreadable]: string; +}; diff --git a/tests/baselines/reference/symbolDeclarationEmit10.types b/tests/baselines/reference/symbolDeclarationEmit10.types new file mode 100644 index 0000000000000..194893ef00f80 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit10.types @@ -0,0 +1,16 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit10.ts === +var obj = { +>obj : { [Symbol.isConcatSpreadable]: string; } +>{ get [Symbol.isConcatSpreadable]() { return '' }, set [Symbol.isConcatSpreadable](x) { }} : { [Symbol.isConcatSpreadable]: string; } + + get [Symbol.isConcatSpreadable]() { return '' }, +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol + + set [Symbol.isConcatSpreadable](x) { } +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol +>x : string +} diff --git a/tests/baselines/reference/symbolDeclarationEmit11.js b/tests/baselines/reference/symbolDeclarationEmit11.js new file mode 100644 index 0000000000000..eeaf66db3e058 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit11.js @@ -0,0 +1,32 @@ +//// [symbolDeclarationEmit11.ts] +class C { + static [Symbol.iterator] = 0; + static [Symbol.toPrimitive]() { } + static get [Symbol.isRegExp]() { return ""; } + static set [Symbol.isRegExp](x) { } +} + +//// [symbolDeclarationEmit11.js] +var C = (function () { + function C() { + } + C[Symbol.toPrimitive] = function () { }; + Object.defineProperty(C, Symbol.isRegExp, { + get: function () { + return ""; + }, + set: function (x) { }, + enumerable: true, + configurable: true + }); + C[Symbol.iterator] = 0; + return C; +})(); + + +//// [symbolDeclarationEmit11.d.ts] +declare class C { + static [Symbol.iterator]: number; + static [Symbol.toPrimitive](): void; + static [Symbol.isRegExp]: string; +} diff --git a/tests/baselines/reference/symbolDeclarationEmit11.types b/tests/baselines/reference/symbolDeclarationEmit11.types new file mode 100644 index 0000000000000..1bf58f205d1da --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit11.types @@ -0,0 +1,25 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit11.ts === +class C { +>C : C + + static [Symbol.iterator] = 0; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + + static [Symbol.toPrimitive]() { } +>Symbol.toPrimitive : symbol +>Symbol : SymbolConstructor +>toPrimitive : symbol + + static get [Symbol.isRegExp]() { return ""; } +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol + + static set [Symbol.isRegExp](x) { } +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol +>x : string +} diff --git a/tests/baselines/reference/symbolDeclarationEmit12.errors.txt b/tests/baselines/reference/symbolDeclarationEmit12.errors.txt new file mode 100644 index 0000000000000..0e2f6b828f656 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit12.errors.txt @@ -0,0 +1,27 @@ +tests/cases/conformance/es6/Symbols/symbolDeclarationEmit12.ts(4,28): error TS4031: Public property '[Symbol.iterator]' of exported class has or is using private name 'I'. +tests/cases/conformance/es6/Symbols/symbolDeclarationEmit12.ts(5,33): error TS4073: Parameter 'x' of public method from exported class has or is using private name 'I'. +tests/cases/conformance/es6/Symbols/symbolDeclarationEmit12.ts(6,40): error TS4055: Return type of public method from exported class has or is using private name 'I'. +tests/cases/conformance/es6/Symbols/symbolDeclarationEmit12.ts(10,34): error TS4037: Parameter '[Symbol.isRegExp]' of public property setter from exported class has or is using private name 'I'. + + +==== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit12.ts (4 errors) ==== + module M { + interface I { } + export class C { + [Symbol.iterator]: I; + ~ +!!! error TS4031: Public property '[Symbol.iterator]' of exported class has or is using private name 'I'. + [Symbol.toPrimitive](x: I) { } + ~ +!!! error TS4073: Parameter 'x' of public method from exported class has or is using private name 'I'. + [Symbol.isConcatSpreadable](): I { + ~ +!!! error TS4055: Return type of public method from exported class has or is using private name 'I'. + return undefined + } + get [Symbol.isRegExp]() { return undefined; } + set [Symbol.isRegExp](x: I) { } + ~ +!!! error TS4037: Parameter '[Symbol.isRegExp]' of public property setter from exported class has or is using private name 'I'. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolDeclarationEmit12.js b/tests/baselines/reference/symbolDeclarationEmit12.js new file mode 100644 index 0000000000000..e39e62f62ed3d --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit12.js @@ -0,0 +1,36 @@ +//// [symbolDeclarationEmit12.ts] +module M { + interface I { } + export class C { + [Symbol.iterator]: I; + [Symbol.toPrimitive](x: I) { } + [Symbol.isConcatSpreadable](): I { + return undefined + } + get [Symbol.isRegExp]() { return undefined; } + set [Symbol.isRegExp](x: I) { } + } +} + +//// [symbolDeclarationEmit12.js] +var M; +(function (M) { + var C = (function () { + function C() { + } + C.prototype[Symbol.toPrimitive] = function (x) { }; + C.prototype[Symbol.isConcatSpreadable] = function () { + return undefined; + }; + Object.defineProperty(C.prototype, Symbol.isRegExp, { + get: function () { + return undefined; + }, + set: function (x) { }, + enumerable: true, + configurable: true + }); + return C; + })(); + M.C = C; +})(M || (M = {})); diff --git a/tests/baselines/reference/symbolDeclarationEmit13.js b/tests/baselines/reference/symbolDeclarationEmit13.js new file mode 100644 index 0000000000000..83e2a2501e4c9 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit13.js @@ -0,0 +1,31 @@ +//// [symbolDeclarationEmit13.ts] +class C { + get [Symbol.isRegExp]() { return ""; } + set [Symbol.toStringTag](x) { } +} + +//// [symbolDeclarationEmit13.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, Symbol.isRegExp, { + get: function () { + return ""; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, Symbol.toStringTag, { + set: function (x) { }, + enumerable: true, + configurable: true + }); + return C; +})(); + + +//// [symbolDeclarationEmit13.d.ts] +declare class C { + [Symbol.isRegExp]: string; + [Symbol.toStringTag]: any; +} diff --git a/tests/baselines/reference/symbolDeclarationEmit13.types b/tests/baselines/reference/symbolDeclarationEmit13.types new file mode 100644 index 0000000000000..6579e49c42619 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit13.types @@ -0,0 +1,15 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit13.ts === +class C { +>C : C + + get [Symbol.isRegExp]() { return ""; } +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol + + set [Symbol.toStringTag](x) { } +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol +>x : any +} diff --git a/tests/baselines/reference/symbolDeclarationEmit14.js b/tests/baselines/reference/symbolDeclarationEmit14.js new file mode 100644 index 0000000000000..d81bc329927d0 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit14.js @@ -0,0 +1,33 @@ +//// [symbolDeclarationEmit14.ts] +class C { + get [Symbol.isRegExp]() { return ""; } + get [Symbol.toStringTag]() { return ""; } +} + +//// [symbolDeclarationEmit14.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, Symbol.isRegExp, { + get: function () { + return ""; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, Symbol.toStringTag, { + get: function () { + return ""; + }, + enumerable: true, + configurable: true + }); + return C; +})(); + + +//// [symbolDeclarationEmit14.d.ts] +declare class C { + [Symbol.isRegExp]: string; + [Symbol.toStringTag]: string; +} diff --git a/tests/baselines/reference/symbolDeclarationEmit14.types b/tests/baselines/reference/symbolDeclarationEmit14.types new file mode 100644 index 0000000000000..f3e7c32047c10 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit14.types @@ -0,0 +1,14 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit14.ts === +class C { +>C : C + + get [Symbol.isRegExp]() { return ""; } +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol + + get [Symbol.toStringTag]() { return ""; } +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol +} diff --git a/tests/baselines/reference/symbolDeclarationEmit2.js b/tests/baselines/reference/symbolDeclarationEmit2.js new file mode 100644 index 0000000000000..2112f9e774874 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit2.js @@ -0,0 +1,18 @@ +//// [symbolDeclarationEmit2.ts] +class C { + [Symbol.isRegExp] = ""; +} + +//// [symbolDeclarationEmit2.js] +var C = (function () { + function C() { + this[Symbol.isRegExp] = ""; + } + return C; +})(); + + +//// [symbolDeclarationEmit2.d.ts] +declare class C { + [Symbol.isRegExp]: string; +} diff --git a/tests/baselines/reference/symbolDeclarationEmit2.types b/tests/baselines/reference/symbolDeclarationEmit2.types new file mode 100644 index 0000000000000..4844b2b8f848e --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit2.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit2.ts === +class C { +>C : C + + [Symbol.isRegExp] = ""; +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol +} diff --git a/tests/baselines/reference/symbolDeclarationEmit3.js b/tests/baselines/reference/symbolDeclarationEmit3.js new file mode 100644 index 0000000000000..e3b22d883c8f7 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit3.js @@ -0,0 +1,21 @@ +//// [symbolDeclarationEmit3.ts] +class C { + [Symbol.isRegExp](x: number); + [Symbol.isRegExp](x: string); + [Symbol.isRegExp](x: any) { } +} + +//// [symbolDeclarationEmit3.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.isRegExp] = function (x) { }; + return C; +})(); + + +//// [symbolDeclarationEmit3.d.ts] +declare class C { + [Symbol.isRegExp](x: number): any; + [Symbol.isRegExp](x: string): any; +} diff --git a/tests/baselines/reference/symbolDeclarationEmit3.types b/tests/baselines/reference/symbolDeclarationEmit3.types new file mode 100644 index 0000000000000..0ea55d876b3db --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit3.types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit3.ts === +class C { +>C : C + + [Symbol.isRegExp](x: number); +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol +>x : number + + [Symbol.isRegExp](x: string); +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol +>x : string + + [Symbol.isRegExp](x: any) { } +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol +>x : any +} diff --git a/tests/baselines/reference/symbolDeclarationEmit4.js b/tests/baselines/reference/symbolDeclarationEmit4.js new file mode 100644 index 0000000000000..85906167b11dd --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit4.js @@ -0,0 +1,26 @@ +//// [symbolDeclarationEmit4.ts] +class C { + get [Symbol.isRegExp]() { return ""; } + set [Symbol.isRegExp](x) { } +} + +//// [symbolDeclarationEmit4.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, Symbol.isRegExp, { + get: function () { + return ""; + }, + set: function (x) { }, + enumerable: true, + configurable: true + }); + return C; +})(); + + +//// [symbolDeclarationEmit4.d.ts] +declare class C { + [Symbol.isRegExp]: string; +} diff --git a/tests/baselines/reference/symbolDeclarationEmit4.types b/tests/baselines/reference/symbolDeclarationEmit4.types new file mode 100644 index 0000000000000..aeb24fc146cb9 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit4.types @@ -0,0 +1,15 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit4.ts === +class C { +>C : C + + get [Symbol.isRegExp]() { return ""; } +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol + + set [Symbol.isRegExp](x) { } +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol +>x : string +} diff --git a/tests/baselines/reference/symbolDeclarationEmit5.js b/tests/baselines/reference/symbolDeclarationEmit5.js new file mode 100644 index 0000000000000..ba1ef9a137c31 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit5.js @@ -0,0 +1,12 @@ +//// [symbolDeclarationEmit5.ts] +interface I { + [Symbol.isConcatSpreadable](): string; +} + +//// [symbolDeclarationEmit5.js] + + +//// [symbolDeclarationEmit5.d.ts] +interface I { + [Symbol.isConcatSpreadable](): string; +} diff --git a/tests/baselines/reference/symbolDeclarationEmit5.types b/tests/baselines/reference/symbolDeclarationEmit5.types new file mode 100644 index 0000000000000..557483cf63631 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit5.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit5.ts === +interface I { +>I : I + + [Symbol.isConcatSpreadable](): string; +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol +} diff --git a/tests/baselines/reference/symbolDeclarationEmit6.js b/tests/baselines/reference/symbolDeclarationEmit6.js new file mode 100644 index 0000000000000..2aac05bb6eac3 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit6.js @@ -0,0 +1,12 @@ +//// [symbolDeclarationEmit6.ts] +interface I { + [Symbol.isConcatSpreadable]: string; +} + +//// [symbolDeclarationEmit6.js] + + +//// [symbolDeclarationEmit6.d.ts] +interface I { + [Symbol.isConcatSpreadable]: string; +} diff --git a/tests/baselines/reference/symbolDeclarationEmit6.types b/tests/baselines/reference/symbolDeclarationEmit6.types new file mode 100644 index 0000000000000..714467aba1207 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit6.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit6.ts === +interface I { +>I : I + + [Symbol.isConcatSpreadable]: string; +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol +} diff --git a/tests/baselines/reference/symbolDeclarationEmit7.js b/tests/baselines/reference/symbolDeclarationEmit7.js new file mode 100644 index 0000000000000..c53c2110d1178 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit7.js @@ -0,0 +1,13 @@ +//// [symbolDeclarationEmit7.ts] +var obj: { + [Symbol.isConcatSpreadable]: string; +} + +//// [symbolDeclarationEmit7.js] +var obj; + + +//// [symbolDeclarationEmit7.d.ts] +declare var obj: { + [Symbol.isConcatSpreadable]: string; +}; diff --git a/tests/baselines/reference/symbolDeclarationEmit7.types b/tests/baselines/reference/symbolDeclarationEmit7.types new file mode 100644 index 0000000000000..dff109e81275f --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit7.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit7.ts === +var obj: { +>obj : { [Symbol.isConcatSpreadable]: string; } + + [Symbol.isConcatSpreadable]: string; +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol +} diff --git a/tests/baselines/reference/symbolDeclarationEmit8.js b/tests/baselines/reference/symbolDeclarationEmit8.js new file mode 100644 index 0000000000000..428d0a0d60c57 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit8.js @@ -0,0 +1,15 @@ +//// [symbolDeclarationEmit8.ts] +var obj = { + [Symbol.isConcatSpreadable]: 0 +} + +//// [symbolDeclarationEmit8.js] +var obj = { + [Symbol.isConcatSpreadable]: 0 +}; + + +//// [symbolDeclarationEmit8.d.ts] +declare var obj: { + [Symbol.isConcatSpreadable]: number; +}; diff --git a/tests/baselines/reference/symbolDeclarationEmit8.types b/tests/baselines/reference/symbolDeclarationEmit8.types new file mode 100644 index 0000000000000..75d39748e22ae --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit8.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit8.ts === +var obj = { +>obj : { [Symbol.isConcatSpreadable]: number; } +>{ [Symbol.isConcatSpreadable]: 0} : { [Symbol.isConcatSpreadable]: number; } + + [Symbol.isConcatSpreadable]: 0 +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol +} diff --git a/tests/baselines/reference/symbolDeclarationEmit9.js b/tests/baselines/reference/symbolDeclarationEmit9.js new file mode 100644 index 0000000000000..d38171767a588 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit9.js @@ -0,0 +1,15 @@ +//// [symbolDeclarationEmit9.ts] +var obj = { + [Symbol.isConcatSpreadable]() { } +} + +//// [symbolDeclarationEmit9.js] +var obj = { + [Symbol.isConcatSpreadable]() { } +}; + + +//// [symbolDeclarationEmit9.d.ts] +declare var obj: { + [Symbol.isConcatSpreadable](): void; +}; diff --git a/tests/baselines/reference/symbolDeclarationEmit9.types b/tests/baselines/reference/symbolDeclarationEmit9.types new file mode 100644 index 0000000000000..a7a6b459fcc06 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit9.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit9.ts === +var obj = { +>obj : { [Symbol.isConcatSpreadable](): void; } +>{ [Symbol.isConcatSpreadable]() { }} : { [Symbol.isConcatSpreadable](): void; } + + [Symbol.isConcatSpreadable]() { } +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol +} diff --git a/tests/baselines/reference/symbolProperty1.js b/tests/baselines/reference/symbolProperty1.js new file mode 100644 index 0000000000000..0117dd3b1c2a2 --- /dev/null +++ b/tests/baselines/reference/symbolProperty1.js @@ -0,0 +1,19 @@ +//// [symbolProperty1.ts] +var s: symbol; +var x = { + [s]: 0, + [s]() { }, + get [s]() { + return 0; + } +} + +//// [symbolProperty1.js] +var s; +var x = { + [s]: 0, + [s]() { }, + get [s]() { + return 0; + } +}; diff --git a/tests/baselines/reference/symbolProperty1.types b/tests/baselines/reference/symbolProperty1.types new file mode 100644 index 0000000000000..55c86c14f6e36 --- /dev/null +++ b/tests/baselines/reference/symbolProperty1.types @@ -0,0 +1,20 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty1.ts === +var s: symbol; +>s : symbol + +var x = { +>x : {} +>{ [s]: 0, [s]() { }, get [s]() { return 0; }} : {} + + [s]: 0, +>s : symbol + + [s]() { }, +>s : symbol + + get [s]() { +>s : symbol + + return 0; + } +} diff --git a/tests/baselines/reference/symbolProperty10.errors.txt b/tests/baselines/reference/symbolProperty10.errors.txt new file mode 100644 index 0000000000000..513d5792c5eaf --- /dev/null +++ b/tests/baselines/reference/symbolProperty10.errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/es6/Symbols/symbolProperty10.ts(10,5): error TS2322: Type 'I' is not assignable to type 'C'. + Types of property '[Symbol.iterator]' are incompatible. + Type '{ x: any; }' is not assignable to type '{ x: any; y: any; }'. + Property 'y' is missing in type '{ x: any; }'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty10.ts (1 errors) ==== + class C { + [Symbol.iterator]: { x; y }; + } + interface I { + [Symbol.iterator]?: { x }; + } + + var i: I; + i = new C; + var c: C = i; + ~ +!!! error TS2322: Type 'I' is not assignable to type 'C'. +!!! error TS2322: Types of property '[Symbol.iterator]' are incompatible. +!!! error TS2322: Type '{ x: any; }' is not assignable to type '{ x: any; y: any; }'. +!!! error TS2322: Property 'y' is missing in type '{ x: any; }'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty10.js b/tests/baselines/reference/symbolProperty10.js new file mode 100644 index 0000000000000..5b4e44f11abd8 --- /dev/null +++ b/tests/baselines/reference/symbolProperty10.js @@ -0,0 +1,21 @@ +//// [symbolProperty10.ts] +class C { + [Symbol.iterator]: { x; y }; +} +interface I { + [Symbol.iterator]?: { x }; +} + +var i: I; +i = new C; +var c: C = i; + +//// [symbolProperty10.js] +var C = (function () { + function C() { + } + return C; +})(); +var i; +i = new C; +var c = i; diff --git a/tests/baselines/reference/symbolProperty11.js b/tests/baselines/reference/symbolProperty11.js new file mode 100644 index 0000000000000..83a380c79e7c3 --- /dev/null +++ b/tests/baselines/reference/symbolProperty11.js @@ -0,0 +1,19 @@ +//// [symbolProperty11.ts] +class C { } +interface I { + [Symbol.iterator]?: { x }; +} + +var i: I; +i = new C; +var c: C = i; + +//// [symbolProperty11.js] +var C = (function () { + function C() { + } + return C; +})(); +var i; +i = new C; +var c = i; diff --git a/tests/baselines/reference/symbolProperty11.types b/tests/baselines/reference/symbolProperty11.types new file mode 100644 index 0000000000000..109bd969d5589 --- /dev/null +++ b/tests/baselines/reference/symbolProperty11.types @@ -0,0 +1,29 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty11.ts === +class C { } +>C : C + +interface I { +>I : I + + [Symbol.iterator]?: { x }; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : any +} + +var i: I; +>i : I +>I : I + +i = new C; +>i = new C : C +>i : I +>new C : C +>C : typeof C + +var c: C = i; +>c : C +>C : C +>i : I + diff --git a/tests/baselines/reference/symbolProperty12.errors.txt b/tests/baselines/reference/symbolProperty12.errors.txt new file mode 100644 index 0000000000000..5ec8d6452035f --- /dev/null +++ b/tests/baselines/reference/symbolProperty12.errors.txt @@ -0,0 +1,23 @@ +tests/cases/conformance/es6/Symbols/symbolProperty12.ts(9,1): error TS2322: Type 'C' is not assignable to type 'I'. + Property '[Symbol.iterator]' is private in type 'C' but not in type 'I'. +tests/cases/conformance/es6/Symbols/symbolProperty12.ts(10,5): error TS2322: Type 'I' is not assignable to type 'C'. + Property '[Symbol.iterator]' is private in type 'C' but not in type 'I'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty12.ts (2 errors) ==== + class C { + private [Symbol.iterator]: { x }; + } + interface I { + [Symbol.iterator]: { x }; + } + + var i: I; + i = new C; + ~ +!!! error TS2322: Type 'C' is not assignable to type 'I'. +!!! error TS2322: Property '[Symbol.iterator]' is private in type 'C' but not in type 'I'. + var c: C = i; + ~ +!!! error TS2322: Type 'I' is not assignable to type 'C'. +!!! error TS2322: Property '[Symbol.iterator]' is private in type 'C' but not in type 'I'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty12.js b/tests/baselines/reference/symbolProperty12.js new file mode 100644 index 0000000000000..9f63f86bc182b --- /dev/null +++ b/tests/baselines/reference/symbolProperty12.js @@ -0,0 +1,21 @@ +//// [symbolProperty12.ts] +class C { + private [Symbol.iterator]: { x }; +} +interface I { + [Symbol.iterator]: { x }; +} + +var i: I; +i = new C; +var c: C = i; + +//// [symbolProperty12.js] +var C = (function () { + function C() { + } + return C; +})(); +var i; +i = new C; +var c = i; diff --git a/tests/baselines/reference/symbolProperty13.js b/tests/baselines/reference/symbolProperty13.js new file mode 100644 index 0000000000000..1cf24a49c7e2c --- /dev/null +++ b/tests/baselines/reference/symbolProperty13.js @@ -0,0 +1,27 @@ +//// [symbolProperty13.ts] +class C { + [Symbol.iterator]: { x; y }; +} +interface I { + [Symbol.iterator]: { x }; +} + +declare function foo(i: I): I; +declare function foo(a: any): any; + +declare function bar(i: C): C; +declare function bar(a: any): any; + +foo(new C); +var i: I; +bar(i); + +//// [symbolProperty13.js] +var C = (function () { + function C() { + } + return C; +})(); +foo(new C); +var i; +bar(i); diff --git a/tests/baselines/reference/symbolProperty13.types b/tests/baselines/reference/symbolProperty13.types new file mode 100644 index 0000000000000..1e890a9108566 --- /dev/null +++ b/tests/baselines/reference/symbolProperty13.types @@ -0,0 +1,56 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty13.ts === +class C { +>C : C + + [Symbol.iterator]: { x; y }; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : any +>y : any +} +interface I { +>I : I + + [Symbol.iterator]: { x }; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : any +} + +declare function foo(i: I): I; +>foo : { (i: I): I; (a: any): any; } +>i : I +>I : I +>I : I + +declare function foo(a: any): any; +>foo : { (i: I): I; (a: any): any; } +>a : any + +declare function bar(i: C): C; +>bar : { (i: C): C; (a: any): any; } +>i : C +>C : C +>C : C + +declare function bar(a: any): any; +>bar : { (i: C): C; (a: any): any; } +>a : any + +foo(new C); +>foo(new C) : I +>foo : { (i: I): I; (a: any): any; } +>new C : C +>C : typeof C + +var i: I; +>i : I +>I : I + +bar(i); +>bar(i) : any +>bar : { (i: C): C; (a: any): any; } +>i : I + diff --git a/tests/baselines/reference/symbolProperty14.js b/tests/baselines/reference/symbolProperty14.js new file mode 100644 index 0000000000000..0283cb01b792a --- /dev/null +++ b/tests/baselines/reference/symbolProperty14.js @@ -0,0 +1,27 @@ +//// [symbolProperty14.ts] +class C { + [Symbol.iterator]: { x; y }; +} +interface I { + [Symbol.iterator]?: { x }; +} + +declare function foo(i: I): I; +declare function foo(a: any): any; + +declare function bar(i: C): C; +declare function bar(a: any): any; + +foo(new C); +var i: I; +bar(i); + +//// [symbolProperty14.js] +var C = (function () { + function C() { + } + return C; +})(); +foo(new C); +var i; +bar(i); diff --git a/tests/baselines/reference/symbolProperty14.types b/tests/baselines/reference/symbolProperty14.types new file mode 100644 index 0000000000000..5e5469ad9158b --- /dev/null +++ b/tests/baselines/reference/symbolProperty14.types @@ -0,0 +1,56 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty14.ts === +class C { +>C : C + + [Symbol.iterator]: { x; y }; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : any +>y : any +} +interface I { +>I : I + + [Symbol.iterator]?: { x }; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : any +} + +declare function foo(i: I): I; +>foo : { (i: I): I; (a: any): any; } +>i : I +>I : I +>I : I + +declare function foo(a: any): any; +>foo : { (i: I): I; (a: any): any; } +>a : any + +declare function bar(i: C): C; +>bar : { (i: C): C; (a: any): any; } +>i : C +>C : C +>C : C + +declare function bar(a: any): any; +>bar : { (i: C): C; (a: any): any; } +>a : any + +foo(new C); +>foo(new C) : I +>foo : { (i: I): I; (a: any): any; } +>new C : C +>C : typeof C + +var i: I; +>i : I +>I : I + +bar(i); +>bar(i) : any +>bar : { (i: C): C; (a: any): any; } +>i : I + diff --git a/tests/baselines/reference/symbolProperty15.js b/tests/baselines/reference/symbolProperty15.js new file mode 100644 index 0000000000000..0c1980370937a --- /dev/null +++ b/tests/baselines/reference/symbolProperty15.js @@ -0,0 +1,25 @@ +//// [symbolProperty15.ts] +class C { } +interface I { + [Symbol.iterator]?: { x }; +} + +declare function foo(i: I): I; +declare function foo(a: any): any; + +declare function bar(i: C): C; +declare function bar(a: any): any; + +foo(new C); +var i: I; +bar(i); + +//// [symbolProperty15.js] +var C = (function () { + function C() { + } + return C; +})(); +foo(new C); +var i; +bar(i); diff --git a/tests/baselines/reference/symbolProperty15.types b/tests/baselines/reference/symbolProperty15.types new file mode 100644 index 0000000000000..b2baa3fcceeb7 --- /dev/null +++ b/tests/baselines/reference/symbolProperty15.types @@ -0,0 +1,49 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty15.ts === +class C { } +>C : C + +interface I { +>I : I + + [Symbol.iterator]?: { x }; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : any +} + +declare function foo(i: I): I; +>foo : { (i: I): I; (a: any): any; } +>i : I +>I : I +>I : I + +declare function foo(a: any): any; +>foo : { (i: I): I; (a: any): any; } +>a : any + +declare function bar(i: C): C; +>bar : { (i: C): C; (a: any): any; } +>i : C +>C : C +>C : C + +declare function bar(a: any): any; +>bar : { (i: C): C; (a: any): any; } +>a : any + +foo(new C); +>foo(new C) : any +>foo : { (i: I): I; (a: any): any; } +>new C : C +>C : typeof C + +var i: I; +>i : I +>I : I + +bar(i); +>bar(i) : C +>bar : { (i: C): C; (a: any): any; } +>i : I + diff --git a/tests/baselines/reference/symbolProperty16.js b/tests/baselines/reference/symbolProperty16.js new file mode 100644 index 0000000000000..1a1f3f857af97 --- /dev/null +++ b/tests/baselines/reference/symbolProperty16.js @@ -0,0 +1,27 @@ +//// [symbolProperty16.ts] +class C { + private [Symbol.iterator]: { x }; +} +interface I { + [Symbol.iterator]: { x }; +} + +declare function foo(i: I): I; +declare function foo(a: any): any; + +declare function bar(i: C): C; +declare function bar(a: any): any; + +foo(new C); +var i: I; +bar(i); + +//// [symbolProperty16.js] +var C = (function () { + function C() { + } + return C; +})(); +foo(new C); +var i; +bar(i); diff --git a/tests/baselines/reference/symbolProperty16.types b/tests/baselines/reference/symbolProperty16.types new file mode 100644 index 0000000000000..041770aea0438 --- /dev/null +++ b/tests/baselines/reference/symbolProperty16.types @@ -0,0 +1,55 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty16.ts === +class C { +>C : C + + private [Symbol.iterator]: { x }; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : any +} +interface I { +>I : I + + [Symbol.iterator]: { x }; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : any +} + +declare function foo(i: I): I; +>foo : { (i: I): I; (a: any): any; } +>i : I +>I : I +>I : I + +declare function foo(a: any): any; +>foo : { (i: I): I; (a: any): any; } +>a : any + +declare function bar(i: C): C; +>bar : { (i: C): C; (a: any): any; } +>i : C +>C : C +>C : C + +declare function bar(a: any): any; +>bar : { (i: C): C; (a: any): any; } +>a : any + +foo(new C); +>foo(new C) : any +>foo : { (i: I): I; (a: any): any; } +>new C : C +>C : typeof C + +var i: I; +>i : I +>I : I + +bar(i); +>bar(i) : any +>bar : { (i: C): C; (a: any): any; } +>i : I + diff --git a/tests/baselines/reference/symbolProperty17.errors.txt b/tests/baselines/reference/symbolProperty17.errors.txt new file mode 100644 index 0000000000000..51f77646f0db7 --- /dev/null +++ b/tests/baselines/reference/symbolProperty17.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/Symbols/symbolProperty17.ts(3,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty17.ts (1 errors) ==== + interface I { + [Symbol.iterator]: number; + [s: symbol]: string; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + "__@iterator": string; + } + + var i: I; + var it = i[Symbol.iterator]; \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty17.js b/tests/baselines/reference/symbolProperty17.js new file mode 100644 index 0000000000000..549577c8d6c26 --- /dev/null +++ b/tests/baselines/reference/symbolProperty17.js @@ -0,0 +1,13 @@ +//// [symbolProperty17.ts] +interface I { + [Symbol.iterator]: number; + [s: symbol]: string; + "__@iterator": string; +} + +var i: I; +var it = i[Symbol.iterator]; + +//// [symbolProperty17.js] +var i; +var it = i[Symbol.iterator]; diff --git a/tests/baselines/reference/symbolProperty18.js b/tests/baselines/reference/symbolProperty18.js new file mode 100644 index 0000000000000..17570e2f007a6 --- /dev/null +++ b/tests/baselines/reference/symbolProperty18.js @@ -0,0 +1,22 @@ +//// [symbolProperty18.ts] +var i = { + [Symbol.iterator]: 0, + [Symbol.toStringTag]() { return "" }, + set [Symbol.toPrimitive](p: boolean) { } +} + +var it = i[Symbol.iterator]; +var str = i[Symbol.toStringTag](); +i[Symbol.toPrimitive] = false; + +//// [symbolProperty18.js] +var i = { + [Symbol.iterator]: 0, + [Symbol.toStringTag]() { + return ""; + }, + set [Symbol.toPrimitive](p) { } +}; +var it = i[Symbol.iterator]; +var str = i[Symbol.toStringTag](); +i[Symbol.toPrimitive] = false; diff --git a/tests/baselines/reference/symbolProperty18.types b/tests/baselines/reference/symbolProperty18.types new file mode 100644 index 0000000000000..8dd74112a8d4e --- /dev/null +++ b/tests/baselines/reference/symbolProperty18.types @@ -0,0 +1,47 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty18.ts === +var i = { +>i : { [Symbol.iterator]: number; [Symbol.toStringTag](): string; [Symbol.toPrimitive]: boolean; } +>{ [Symbol.iterator]: 0, [Symbol.toStringTag]() { return "" }, set [Symbol.toPrimitive](p: boolean) { }} : { [Symbol.iterator]: number; [Symbol.toStringTag](): string; [Symbol.toPrimitive]: boolean; } + + [Symbol.iterator]: 0, +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + + [Symbol.toStringTag]() { return "" }, +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol + + set [Symbol.toPrimitive](p: boolean) { } +>Symbol.toPrimitive : symbol +>Symbol : SymbolConstructor +>toPrimitive : symbol +>p : boolean +} + +var it = i[Symbol.iterator]; +>it : number +>i[Symbol.iterator] : number +>i : { [Symbol.iterator]: number; [Symbol.toStringTag](): string; [Symbol.toPrimitive]: boolean; } +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + +var str = i[Symbol.toStringTag](); +>str : string +>i[Symbol.toStringTag]() : string +>i[Symbol.toStringTag] : () => string +>i : { [Symbol.iterator]: number; [Symbol.toStringTag](): string; [Symbol.toPrimitive]: boolean; } +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol + +i[Symbol.toPrimitive] = false; +>i[Symbol.toPrimitive] = false : boolean +>i[Symbol.toPrimitive] : boolean +>i : { [Symbol.iterator]: number; [Symbol.toStringTag](): string; [Symbol.toPrimitive]: boolean; } +>Symbol.toPrimitive : symbol +>Symbol : SymbolConstructor +>toPrimitive : symbol + diff --git a/tests/baselines/reference/symbolProperty19.js b/tests/baselines/reference/symbolProperty19.js new file mode 100644 index 0000000000000..c64541691ccda --- /dev/null +++ b/tests/baselines/reference/symbolProperty19.js @@ -0,0 +1,18 @@ +//// [symbolProperty19.ts] +var i = { + [Symbol.iterator]: { p: null }, + [Symbol.toStringTag]() { return { p: undefined }; } +} + +var it = i[Symbol.iterator]; +var str = i[Symbol.toStringTag](); + +//// [symbolProperty19.js] +var i = { + [Symbol.iterator]: { p: null }, + [Symbol.toStringTag]() { + return { p: undefined }; + } +}; +var it = i[Symbol.iterator]; +var str = i[Symbol.toStringTag](); diff --git a/tests/baselines/reference/symbolProperty19.types b/tests/baselines/reference/symbolProperty19.types new file mode 100644 index 0000000000000..705c2b8bdf7ab --- /dev/null +++ b/tests/baselines/reference/symbolProperty19.types @@ -0,0 +1,38 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty19.ts === +var i = { +>i : { [Symbol.iterator]: { p: any; }; [Symbol.toStringTag](): { p: any; }; } +>{ [Symbol.iterator]: { p: null }, [Symbol.toStringTag]() { return { p: undefined }; }} : { [Symbol.iterator]: { p: null; }; [Symbol.toStringTag](): { p: any; }; } + + [Symbol.iterator]: { p: null }, +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>{ p: null } : { p: null; } +>p : null + + [Symbol.toStringTag]() { return { p: undefined }; } +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol +>{ p: undefined } : { p: undefined; } +>p : undefined +>undefined : undefined +} + +var it = i[Symbol.iterator]; +>it : { p: any; } +>i[Symbol.iterator] : { p: any; } +>i : { [Symbol.iterator]: { p: any; }; [Symbol.toStringTag](): { p: any; }; } +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + +var str = i[Symbol.toStringTag](); +>str : { p: any; } +>i[Symbol.toStringTag]() : { p: any; } +>i[Symbol.toStringTag] : () => { p: any; } +>i : { [Symbol.iterator]: { p: any; }; [Symbol.toStringTag](): { p: any; }; } +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol + diff --git a/tests/baselines/reference/symbolProperty2.js b/tests/baselines/reference/symbolProperty2.js new file mode 100644 index 0000000000000..0158366f9d51f --- /dev/null +++ b/tests/baselines/reference/symbolProperty2.js @@ -0,0 +1,19 @@ +//// [symbolProperty2.ts] +var s = Symbol(); +var x = { + [s]: 0, + [s]() { }, + get [s]() { + return 0; + } +} + +//// [symbolProperty2.js] +var s = Symbol(); +var x = { + [s]: 0, + [s]() { }, + get [s]() { + return 0; + } +}; diff --git a/tests/baselines/reference/symbolProperty2.types b/tests/baselines/reference/symbolProperty2.types new file mode 100644 index 0000000000000..37fe9d13bdbb7 --- /dev/null +++ b/tests/baselines/reference/symbolProperty2.types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty2.ts === +var s = Symbol(); +>s : symbol +>Symbol() : symbol +>Symbol : SymbolConstructor + +var x = { +>x : {} +>{ [s]: 0, [s]() { }, get [s]() { return 0; }} : {} + + [s]: 0, +>s : symbol + + [s]() { }, +>s : symbol + + get [s]() { +>s : symbol + + return 0; + } +} diff --git a/tests/baselines/reference/symbolProperty20.js b/tests/baselines/reference/symbolProperty20.js new file mode 100644 index 0000000000000..558305a577dca --- /dev/null +++ b/tests/baselines/reference/symbolProperty20.js @@ -0,0 +1,18 @@ +//// [symbolProperty20.ts] +interface I { + [Symbol.iterator]: (s: string) => string; + [Symbol.toStringTag](s: number): number; +} + +var i: I = { + [Symbol.iterator]: s => s, + [Symbol.toStringTag](n) { return n; } +} + +//// [symbolProperty20.js] +var i = { + [Symbol.iterator]: s => { return s; }, + [Symbol.toStringTag](n) { + return n; + } +}; diff --git a/tests/baselines/reference/symbolProperty20.types b/tests/baselines/reference/symbolProperty20.types new file mode 100644 index 0000000000000..745401142d835 --- /dev/null +++ b/tests/baselines/reference/symbolProperty20.types @@ -0,0 +1,37 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty20.ts === +interface I { +>I : I + + [Symbol.iterator]: (s: string) => string; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>s : string + + [Symbol.toStringTag](s: number): number; +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol +>s : number +} + +var i: I = { +>i : I +>I : I +>{ [Symbol.iterator]: s => s, [Symbol.toStringTag](n) { return n; }} : { [Symbol.iterator]: (s: string) => string; [Symbol.toStringTag](n: number): number; } + + [Symbol.iterator]: s => s, +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>s => s : (s: string) => string +>s : string +>s : string + + [Symbol.toStringTag](n) { return n; } +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol +>n : number +>n : number +} diff --git a/tests/baselines/reference/symbolProperty21.js b/tests/baselines/reference/symbolProperty21.js new file mode 100644 index 0000000000000..13eaf06a97b5b --- /dev/null +++ b/tests/baselines/reference/symbolProperty21.js @@ -0,0 +1,20 @@ +//// [symbolProperty21.ts] +interface I { + [Symbol.unscopables]: T; + [Symbol.isConcatSpreadable]: U; +} + +declare function foo(p: I): { t: T; u: U }; + +foo({ + [Symbol.isConcatSpreadable]: "", + [Symbol.isRegExp]: 0, + [Symbol.unscopables]: true +}); + +//// [symbolProperty21.js] +foo({ + [Symbol.isConcatSpreadable]: "", + [Symbol.isRegExp]: 0, + [Symbol.unscopables]: true +}); diff --git a/tests/baselines/reference/symbolProperty21.types b/tests/baselines/reference/symbolProperty21.types new file mode 100644 index 0000000000000..053dae46479c5 --- /dev/null +++ b/tests/baselines/reference/symbolProperty21.types @@ -0,0 +1,53 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty21.ts === +interface I { +>I : I +>T : T +>U : U + + [Symbol.unscopables]: T; +>Symbol.unscopables : symbol +>Symbol : SymbolConstructor +>unscopables : symbol +>T : T + + [Symbol.isConcatSpreadable]: U; +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol +>U : U +} + +declare function foo(p: I): { t: T; u: U }; +>foo : (p: I) => { t: T; u: U; } +>T : T +>U : U +>p : I +>I : I +>T : T +>U : U +>t : T +>T : T +>u : U +>U : U + +foo({ +>foo({ [Symbol.isConcatSpreadable]: "", [Symbol.isRegExp]: 0, [Symbol.unscopables]: true}) : { t: boolean; u: string; } +>foo : (p: I) => { t: T; u: U; } +>{ [Symbol.isConcatSpreadable]: "", [Symbol.isRegExp]: 0, [Symbol.unscopables]: true} : { [Symbol.isConcatSpreadable]: string; [Symbol.isRegExp]: number; [Symbol.unscopables]: boolean; } + + [Symbol.isConcatSpreadable]: "", +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol + + [Symbol.isRegExp]: 0, +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol + + [Symbol.unscopables]: true +>Symbol.unscopables : symbol +>Symbol : SymbolConstructor +>unscopables : symbol + +}); diff --git a/tests/baselines/reference/symbolProperty22.js b/tests/baselines/reference/symbolProperty22.js new file mode 100644 index 0000000000000..35757182143b1 --- /dev/null +++ b/tests/baselines/reference/symbolProperty22.js @@ -0,0 +1,11 @@ +//// [symbolProperty22.ts] +interface I { + [Symbol.unscopables](x: T): U; +} + +declare function foo(p1: T, p2: I): U; + +foo("", { [Symbol.unscopables]: s => s.length }); + +//// [symbolProperty22.js] +foo("", { [Symbol.unscopables]: s => { return s.length; } }); diff --git a/tests/baselines/reference/symbolProperty22.types b/tests/baselines/reference/symbolProperty22.types new file mode 100644 index 0000000000000..64fb5fc234c81 --- /dev/null +++ b/tests/baselines/reference/symbolProperty22.types @@ -0,0 +1,40 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty22.ts === +interface I { +>I : I +>T : T +>U : U + + [Symbol.unscopables](x: T): U; +>Symbol.unscopables : symbol +>Symbol : SymbolConstructor +>unscopables : symbol +>x : T +>T : T +>U : U +} + +declare function foo(p1: T, p2: I): U; +>foo : (p1: T, p2: I) => U +>T : T +>U : U +>p1 : T +>T : T +>p2 : I +>I : I +>T : T +>U : U +>U : U + +foo("", { [Symbol.unscopables]: s => s.length }); +>foo("", { [Symbol.unscopables]: s => s.length }) : number +>foo : (p1: T, p2: I) => U +>{ [Symbol.unscopables]: s => s.length } : { [Symbol.unscopables]: (s: string) => number; } +>Symbol.unscopables : symbol +>Symbol : SymbolConstructor +>unscopables : symbol +>s => s.length : (s: string) => number +>s : string +>s.length : number +>s : string +>length : number + diff --git a/tests/baselines/reference/symbolProperty23.js b/tests/baselines/reference/symbolProperty23.js new file mode 100644 index 0000000000000..b3291ad34e8bc --- /dev/null +++ b/tests/baselines/reference/symbolProperty23.js @@ -0,0 +1,20 @@ +//// [symbolProperty23.ts] +interface I { + [Symbol.toPrimitive]: () => boolean; +} + +class C implements I { + [Symbol.toPrimitive]() { + return true; + } +} + +//// [symbolProperty23.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.toPrimitive] = function () { + return true; + }; + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty23.types b/tests/baselines/reference/symbolProperty23.types new file mode 100644 index 0000000000000..b28ecb2dbe435 --- /dev/null +++ b/tests/baselines/reference/symbolProperty23.types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty23.ts === +interface I { +>I : I + + [Symbol.toPrimitive]: () => boolean; +>Symbol.toPrimitive : symbol +>Symbol : SymbolConstructor +>toPrimitive : symbol +} + +class C implements I { +>C : C +>I : I + + [Symbol.toPrimitive]() { +>Symbol.toPrimitive : symbol +>Symbol : SymbolConstructor +>toPrimitive : symbol + + return true; + } +} diff --git a/tests/baselines/reference/symbolProperty24.errors.txt b/tests/baselines/reference/symbolProperty24.errors.txt new file mode 100644 index 0000000000000..25cba184e2567 --- /dev/null +++ b/tests/baselines/reference/symbolProperty24.errors.txt @@ -0,0 +1,21 @@ +tests/cases/conformance/es6/Symbols/symbolProperty24.ts(5,7): error TS2420: Class 'C' incorrectly implements interface 'I'. + Types of property '[Symbol.toPrimitive]' are incompatible. + Type '() => string' is not assignable to type '() => boolean'. + Type 'string' is not assignable to type 'boolean'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty24.ts (1 errors) ==== + interface I { + [Symbol.toPrimitive]: () => boolean; + } + + class C implements I { + ~ +!!! error TS2420: Class 'C' incorrectly implements interface 'I'. +!!! error TS2420: Types of property '[Symbol.toPrimitive]' are incompatible. +!!! error TS2420: Type '() => string' is not assignable to type '() => boolean'. +!!! error TS2420: Type 'string' is not assignable to type 'boolean'. + [Symbol.toPrimitive]() { + return ""; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty24.js b/tests/baselines/reference/symbolProperty24.js new file mode 100644 index 0000000000000..b5d059dd29f1a --- /dev/null +++ b/tests/baselines/reference/symbolProperty24.js @@ -0,0 +1,20 @@ +//// [symbolProperty24.ts] +interface I { + [Symbol.toPrimitive]: () => boolean; +} + +class C implements I { + [Symbol.toPrimitive]() { + return ""; + } +} + +//// [symbolProperty24.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.toPrimitive] = function () { + return ""; + }; + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty25.errors.txt b/tests/baselines/reference/symbolProperty25.errors.txt new file mode 100644 index 0000000000000..a6cde31c1adcd --- /dev/null +++ b/tests/baselines/reference/symbolProperty25.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/Symbols/symbolProperty25.ts(5,7): error TS2420: Class 'C' incorrectly implements interface 'I'. + Property '[Symbol.toPrimitive]' is missing in type 'C'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty25.ts (1 errors) ==== + interface I { + [Symbol.toPrimitive]: () => boolean; + } + + class C implements I { + ~ +!!! error TS2420: Class 'C' incorrectly implements interface 'I'. +!!! error TS2420: Property '[Symbol.toPrimitive]' is missing in type 'C'. + [Symbol.toStringTag]() { + return ""; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty25.js b/tests/baselines/reference/symbolProperty25.js new file mode 100644 index 0000000000000..c932da1e3ebea --- /dev/null +++ b/tests/baselines/reference/symbolProperty25.js @@ -0,0 +1,20 @@ +//// [symbolProperty25.ts] +interface I { + [Symbol.toPrimitive]: () => boolean; +} + +class C implements I { + [Symbol.toStringTag]() { + return ""; + } +} + +//// [symbolProperty25.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.toStringTag] = function () { + return ""; + }; + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty26.js b/tests/baselines/reference/symbolProperty26.js new file mode 100644 index 0000000000000..9e98027603d43 --- /dev/null +++ b/tests/baselines/reference/symbolProperty26.js @@ -0,0 +1,38 @@ +//// [symbolProperty26.ts] +class C1 { + [Symbol.toStringTag]() { + return ""; + } +} + +class C2 extends C1 { + [Symbol.toStringTag]() { + return ""; + } +} + +//// [symbolProperty26.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C1 = (function () { + function C1() { + } + C1.prototype[Symbol.toStringTag] = function () { + return ""; + }; + return C1; +})(); +var C2 = (function (_super) { + __extends(C2, _super); + function C2() { + _super.apply(this, arguments); + } + C2.prototype[Symbol.toStringTag] = function () { + return ""; + }; + return C2; +})(C1); diff --git a/tests/baselines/reference/symbolProperty26.types b/tests/baselines/reference/symbolProperty26.types new file mode 100644 index 0000000000000..3971ccb402d94 --- /dev/null +++ b/tests/baselines/reference/symbolProperty26.types @@ -0,0 +1,25 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty26.ts === +class C1 { +>C1 : C1 + + [Symbol.toStringTag]() { +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol + + return ""; + } +} + +class C2 extends C1 { +>C2 : C2 +>C1 : C1 + + [Symbol.toStringTag]() { +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol + + return ""; + } +} diff --git a/tests/baselines/reference/symbolProperty27.js b/tests/baselines/reference/symbolProperty27.js new file mode 100644 index 0000000000000..f19d05233cb28 --- /dev/null +++ b/tests/baselines/reference/symbolProperty27.js @@ -0,0 +1,38 @@ +//// [symbolProperty27.ts] +class C1 { + [Symbol.toStringTag]() { + return {}; + } +} + +class C2 extends C1 { + [Symbol.toStringTag]() { + return ""; + } +} + +//// [symbolProperty27.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C1 = (function () { + function C1() { + } + C1.prototype[Symbol.toStringTag] = function () { + return {}; + }; + return C1; +})(); +var C2 = (function (_super) { + __extends(C2, _super); + function C2() { + _super.apply(this, arguments); + } + C2.prototype[Symbol.toStringTag] = function () { + return ""; + }; + return C2; +})(C1); diff --git a/tests/baselines/reference/symbolProperty27.types b/tests/baselines/reference/symbolProperty27.types new file mode 100644 index 0000000000000..5a5261a11b592 --- /dev/null +++ b/tests/baselines/reference/symbolProperty27.types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty27.ts === +class C1 { +>C1 : C1 + + [Symbol.toStringTag]() { +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol + + return {}; +>{} : {} + } +} + +class C2 extends C1 { +>C2 : C2 +>C1 : C1 + + [Symbol.toStringTag]() { +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol + + return ""; + } +} diff --git a/tests/baselines/reference/symbolProperty28.js b/tests/baselines/reference/symbolProperty28.js new file mode 100644 index 0000000000000..219a192e381cd --- /dev/null +++ b/tests/baselines/reference/symbolProperty28.js @@ -0,0 +1,36 @@ +//// [symbolProperty28.ts] +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} + +class C2 extends C1 { } + +var c: C2; +var obj = c[Symbol.toStringTag]().x; + +//// [symbolProperty28.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C1 = (function () { + function C1() { + } + C1.prototype[Symbol.toStringTag] = function () { + return { x: "" }; + }; + return C1; +})(); +var C2 = (function (_super) { + __extends(C2, _super); + function C2() { + _super.apply(this, arguments); + } + return C2; +})(C1); +var c; +var obj = c[Symbol.toStringTag]().x; diff --git a/tests/baselines/reference/symbolProperty28.types b/tests/baselines/reference/symbolProperty28.types new file mode 100644 index 0000000000000..ef5aa0f30034a --- /dev/null +++ b/tests/baselines/reference/symbolProperty28.types @@ -0,0 +1,34 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty28.ts === +class C1 { +>C1 : C1 + + [Symbol.toStringTag]() { +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol + + return { x: "" }; +>{ x: "" } : { x: string; } +>x : string + } +} + +class C2 extends C1 { } +>C2 : C2 +>C1 : C1 + +var c: C2; +>c : C2 +>C2 : C2 + +var obj = c[Symbol.toStringTag]().x; +>obj : string +>c[Symbol.toStringTag]().x : string +>c[Symbol.toStringTag]() : { x: string; } +>c[Symbol.toStringTag] : () => { x: string; } +>c : C2 +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol +>x : string + diff --git a/tests/baselines/reference/symbolProperty29.errors.txt b/tests/baselines/reference/symbolProperty29.errors.txt new file mode 100644 index 0000000000000..1efaeb2b3bfb8 --- /dev/null +++ b/tests/baselines/reference/symbolProperty29.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/es6/Symbols/symbolProperty29.ts(5,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty29.ts (1 errors) ==== + class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } + [s: symbol]: () => { x: string }; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty29.js b/tests/baselines/reference/symbolProperty29.js new file mode 100644 index 0000000000000..f7fee99f6a1f0 --- /dev/null +++ b/tests/baselines/reference/symbolProperty29.js @@ -0,0 +1,17 @@ +//// [symbolProperty29.ts] +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } + [s: symbol]: () => { x: string }; +} + +//// [symbolProperty29.js] +var C1 = (function () { + function C1() { + } + C1.prototype[Symbol.toStringTag] = function () { + return { x: "" }; + }; + return C1; +})(); diff --git a/tests/baselines/reference/symbolProperty3.errors.txt b/tests/baselines/reference/symbolProperty3.errors.txt new file mode 100644 index 0000000000000..ed557c85a633c --- /dev/null +++ b/tests/baselines/reference/symbolProperty3.errors.txt @@ -0,0 +1,20 @@ +tests/cases/conformance/es6/Symbols/symbolProperty3.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/Symbols/symbolProperty3.ts(4,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/Symbols/symbolProperty3.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty3.ts (3 errors) ==== + var s = Symbol; + var x = { + [s]: 0, + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + [s]() { }, + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + get [s]() { + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + return 0; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty3.js b/tests/baselines/reference/symbolProperty3.js new file mode 100644 index 0000000000000..dda9ca23d3286 --- /dev/null +++ b/tests/baselines/reference/symbolProperty3.js @@ -0,0 +1,19 @@ +//// [symbolProperty3.ts] +var s = Symbol; +var x = { + [s]: 0, + [s]() { }, + get [s]() { + return 0; + } +} + +//// [symbolProperty3.js] +var s = Symbol; +var x = { + [s]: 0, + [s]() { }, + get [s]() { + return 0; + } +}; diff --git a/tests/baselines/reference/symbolProperty30.errors.txt b/tests/baselines/reference/symbolProperty30.errors.txt new file mode 100644 index 0000000000000..b839d11d1b803 --- /dev/null +++ b/tests/baselines/reference/symbolProperty30.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/es6/Symbols/symbolProperty30.ts(5,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty30.ts (1 errors) ==== + class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } + [s: symbol]: () => { x: number }; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty30.js b/tests/baselines/reference/symbolProperty30.js new file mode 100644 index 0000000000000..bdb108015cff5 --- /dev/null +++ b/tests/baselines/reference/symbolProperty30.js @@ -0,0 +1,17 @@ +//// [symbolProperty30.ts] +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } + [s: symbol]: () => { x: number }; +} + +//// [symbolProperty30.js] +var C1 = (function () { + function C1() { + } + C1.prototype[Symbol.toStringTag] = function () { + return { x: "" }; + }; + return C1; +})(); diff --git a/tests/baselines/reference/symbolProperty31.errors.txt b/tests/baselines/reference/symbolProperty31.errors.txt new file mode 100644 index 0000000000000..39735c017b2ad --- /dev/null +++ b/tests/baselines/reference/symbolProperty31.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/Symbols/symbolProperty31.ts(7,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty31.ts (1 errors) ==== + class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } + } + class C2 extends C1 { + [s: symbol]: () => { x: string }; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty31.js b/tests/baselines/reference/symbolProperty31.js new file mode 100644 index 0000000000000..cf53277465273 --- /dev/null +++ b/tests/baselines/reference/symbolProperty31.js @@ -0,0 +1,32 @@ +//// [symbolProperty31.ts] +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} +class C2 extends C1 { + [s: symbol]: () => { x: string }; +} + +//// [symbolProperty31.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C1 = (function () { + function C1() { + } + C1.prototype[Symbol.toStringTag] = function () { + return { x: "" }; + }; + return C1; +})(); +var C2 = (function (_super) { + __extends(C2, _super); + function C2() { + _super.apply(this, arguments); + } + return C2; +})(C1); diff --git a/tests/baselines/reference/symbolProperty32.errors.txt b/tests/baselines/reference/symbolProperty32.errors.txt new file mode 100644 index 0000000000000..4051f8f91c84b --- /dev/null +++ b/tests/baselines/reference/symbolProperty32.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/Symbols/symbolProperty32.ts(7,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty32.ts (1 errors) ==== + class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } + } + class C2 extends C1 { + [s: symbol]: () => { x: number }; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty32.js b/tests/baselines/reference/symbolProperty32.js new file mode 100644 index 0000000000000..73e4bffdc01f8 --- /dev/null +++ b/tests/baselines/reference/symbolProperty32.js @@ -0,0 +1,32 @@ +//// [symbolProperty32.ts] +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} +class C2 extends C1 { + [s: symbol]: () => { x: number }; +} + +//// [symbolProperty32.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C1 = (function () { + function C1() { + } + C1.prototype[Symbol.toStringTag] = function () { + return { x: "" }; + }; + return C1; +})(); +var C2 = (function (_super) { + __extends(C2, _super); + function C2() { + _super.apply(this, arguments); + } + return C2; +})(C1); diff --git a/tests/baselines/reference/symbolProperty33.errors.txt b/tests/baselines/reference/symbolProperty33.errors.txt new file mode 100644 index 0000000000000..25a16b045abe6 --- /dev/null +++ b/tests/baselines/reference/symbolProperty33.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/Symbols/symbolProperty33.ts(7,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty33.ts (1 errors) ==== + class C1 extends C2 { + [Symbol.toStringTag]() { + return { x: "" }; + } + } + class C2 { + [s: symbol]: () => { x: string }; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty33.js b/tests/baselines/reference/symbolProperty33.js new file mode 100644 index 0000000000000..f5a0801033858 --- /dev/null +++ b/tests/baselines/reference/symbolProperty33.js @@ -0,0 +1,32 @@ +//// [symbolProperty33.ts] +class C1 extends C2 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} +class C2 { + [s: symbol]: () => { x: string }; +} + +//// [symbolProperty33.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C1 = (function (_super) { + __extends(C1, _super); + function C1() { + _super.apply(this, arguments); + } + C1.prototype[Symbol.toStringTag] = function () { + return { x: "" }; + }; + return C1; +})(C2); +var C2 = (function () { + function C2() { + } + return C2; +})(); diff --git a/tests/baselines/reference/symbolProperty34.errors.txt b/tests/baselines/reference/symbolProperty34.errors.txt new file mode 100644 index 0000000000000..4339af94788c3 --- /dev/null +++ b/tests/baselines/reference/symbolProperty34.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/Symbols/symbolProperty34.ts(7,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty34.ts (1 errors) ==== + class C1 extends C2 { + [Symbol.toStringTag]() { + return { x: "" }; + } + } + class C2 { + [s: symbol]: () => { x: number }; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty34.js b/tests/baselines/reference/symbolProperty34.js new file mode 100644 index 0000000000000..5b25f487fbf26 --- /dev/null +++ b/tests/baselines/reference/symbolProperty34.js @@ -0,0 +1,32 @@ +//// [symbolProperty34.ts] +class C1 extends C2 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} +class C2 { + [s: symbol]: () => { x: number }; +} + +//// [symbolProperty34.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C1 = (function (_super) { + __extends(C1, _super); + function C1() { + _super.apply(this, arguments); + } + C1.prototype[Symbol.toStringTag] = function () { + return { x: "" }; + }; + return C1; +})(C2); +var C2 = (function () { + function C2() { + } + return C2; +})(); diff --git a/tests/baselines/reference/symbolProperty35.errors.txt b/tests/baselines/reference/symbolProperty35.errors.txt new file mode 100644 index 0000000000000..1558f5a3409bc --- /dev/null +++ b/tests/baselines/reference/symbolProperty35.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/Symbols/symbolProperty35.ts(8,11): error TS2320: Interface 'I3' cannot simultaneously extend types 'I1' and 'I2'. + Named property '[Symbol.toStringTag]' of types 'I1' and 'I2' are not identical. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty35.ts (1 errors) ==== + interface I1 { + [Symbol.toStringTag](): { x: string } + } + interface I2 { + [Symbol.toStringTag](): { x: number } + } + + interface I3 extends I1, I2 { } + ~~ +!!! error TS2320: Interface 'I3' cannot simultaneously extend types 'I1' and 'I2'. +!!! error TS2320: Named property '[Symbol.toStringTag]' of types 'I1' and 'I2' are not identical. \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty35.js b/tests/baselines/reference/symbolProperty35.js new file mode 100644 index 0000000000000..c96e4ce28b17e --- /dev/null +++ b/tests/baselines/reference/symbolProperty35.js @@ -0,0 +1,11 @@ +//// [symbolProperty35.ts] +interface I1 { + [Symbol.toStringTag](): { x: string } +} +interface I2 { + [Symbol.toStringTag](): { x: number } +} + +interface I3 extends I1, I2 { } + +//// [symbolProperty35.js] diff --git a/tests/baselines/reference/symbolProperty36.errors.txt b/tests/baselines/reference/symbolProperty36.errors.txt new file mode 100644 index 0000000000000..6fe3299ab905e --- /dev/null +++ b/tests/baselines/reference/symbolProperty36.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/es6/Symbols/symbolProperty36.ts(2,5): error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. +tests/cases/conformance/es6/Symbols/symbolProperty36.ts(3,5): error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty36.ts (2 errors) ==== + var x = { + [Symbol.isConcatSpreadable]: 0, + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. + [Symbol.isConcatSpreadable]: 1 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty36.js b/tests/baselines/reference/symbolProperty36.js new file mode 100644 index 0000000000000..35d29d4892d51 --- /dev/null +++ b/tests/baselines/reference/symbolProperty36.js @@ -0,0 +1,11 @@ +//// [symbolProperty36.ts] +var x = { + [Symbol.isConcatSpreadable]: 0, + [Symbol.isConcatSpreadable]: 1 +} + +//// [symbolProperty36.js] +var x = { + [Symbol.isConcatSpreadable]: 0, + [Symbol.isConcatSpreadable]: 1 +}; diff --git a/tests/baselines/reference/symbolProperty37.errors.txt b/tests/baselines/reference/symbolProperty37.errors.txt new file mode 100644 index 0000000000000..96e10e7f2a4e2 --- /dev/null +++ b/tests/baselines/reference/symbolProperty37.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/es6/Symbols/symbolProperty37.ts(2,5): error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. +tests/cases/conformance/es6/Symbols/symbolProperty37.ts(3,5): error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty37.ts (2 errors) ==== + interface I { + [Symbol.isConcatSpreadable]: string; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. + [Symbol.isConcatSpreadable]: string; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty37.js b/tests/baselines/reference/symbolProperty37.js new file mode 100644 index 0000000000000..2aaf97ef3008d --- /dev/null +++ b/tests/baselines/reference/symbolProperty37.js @@ -0,0 +1,7 @@ +//// [symbolProperty37.ts] +interface I { + [Symbol.isConcatSpreadable]: string; + [Symbol.isConcatSpreadable]: string; +} + +//// [symbolProperty37.js] diff --git a/tests/baselines/reference/symbolProperty38.errors.txt b/tests/baselines/reference/symbolProperty38.errors.txt new file mode 100644 index 0000000000000..a519f7eb9a3d5 --- /dev/null +++ b/tests/baselines/reference/symbolProperty38.errors.txt @@ -0,0 +1,15 @@ +tests/cases/conformance/es6/Symbols/symbolProperty38.ts(2,5): error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. +tests/cases/conformance/es6/Symbols/symbolProperty38.ts(5,5): error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty38.ts (2 errors) ==== + interface I { + [Symbol.isConcatSpreadable]: string; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. + } + interface I { + [Symbol.isConcatSpreadable]: string; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty38.js b/tests/baselines/reference/symbolProperty38.js new file mode 100644 index 0000000000000..b90b4d8081d38 --- /dev/null +++ b/tests/baselines/reference/symbolProperty38.js @@ -0,0 +1,9 @@ +//// [symbolProperty38.ts] +interface I { + [Symbol.isConcatSpreadable]: string; +} +interface I { + [Symbol.isConcatSpreadable]: string; +} + +//// [symbolProperty38.js] diff --git a/tests/baselines/reference/symbolProperty39.errors.txt b/tests/baselines/reference/symbolProperty39.errors.txt new file mode 100644 index 0000000000000..62dbdfc591c9a --- /dev/null +++ b/tests/baselines/reference/symbolProperty39.errors.txt @@ -0,0 +1,25 @@ +tests/cases/conformance/es6/Symbols/symbolProperty39.ts(2,5): error TS2393: Duplicate function implementation. +tests/cases/conformance/es6/Symbols/symbolProperty39.ts(3,5): error TS2393: Duplicate function implementation. +tests/cases/conformance/es6/Symbols/symbolProperty39.ts(4,5): error TS2393: Duplicate function implementation. +tests/cases/conformance/es6/Symbols/symbolProperty39.ts(7,5): error TS2393: Duplicate function implementation. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty39.ts (4 errors) ==== + class C { + [Symbol.iterator](x: string): string; + ~~~~~~~~~~~~~~~~~ +!!! error TS2393: Duplicate function implementation. + [Symbol.iterator](x: number): number; + ~~~~~~~~~~~~~~~~~ +!!! error TS2393: Duplicate function implementation. + [Symbol.iterator](x: any) { + ~~~~~~~~~~~~~~~~~ +!!! error TS2393: Duplicate function implementation. + return undefined; + } + [Symbol.iterator](x: any) { + ~~~~~~~~~~~~~~~~~ +!!! error TS2393: Duplicate function implementation. + return undefined; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty39.js b/tests/baselines/reference/symbolProperty39.js new file mode 100644 index 0000000000000..18551d20c0b33 --- /dev/null +++ b/tests/baselines/reference/symbolProperty39.js @@ -0,0 +1,24 @@ +//// [symbolProperty39.ts] +class C { + [Symbol.iterator](x: string): string; + [Symbol.iterator](x: number): number; + [Symbol.iterator](x: any) { + return undefined; + } + [Symbol.iterator](x: any) { + return undefined; + } +} + +//// [symbolProperty39.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function (x) { + return undefined; + }; + C.prototype[Symbol.iterator] = function (x) { + return undefined; + }; + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty4.js b/tests/baselines/reference/symbolProperty4.js new file mode 100644 index 0000000000000..6072d6bbf725e --- /dev/null +++ b/tests/baselines/reference/symbolProperty4.js @@ -0,0 +1,17 @@ +//// [symbolProperty4.ts] +var x = { + [Symbol()]: 0, + [Symbol()]() { }, + get [Symbol()]() { + return 0; + } +} + +//// [symbolProperty4.js] +var x = { + [Symbol()]: 0, + [Symbol()]() { }, + get [Symbol()]() { + return 0; + } +}; diff --git a/tests/baselines/reference/symbolProperty4.types b/tests/baselines/reference/symbolProperty4.types new file mode 100644 index 0000000000000..b8aac1f2770fe --- /dev/null +++ b/tests/baselines/reference/symbolProperty4.types @@ -0,0 +1,20 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty4.ts === +var x = { +>x : {} +>{ [Symbol()]: 0, [Symbol()]() { }, get [Symbol()]() { return 0; }} : {} + + [Symbol()]: 0, +>Symbol() : symbol +>Symbol : SymbolConstructor + + [Symbol()]() { }, +>Symbol() : symbol +>Symbol : SymbolConstructor + + get [Symbol()]() { +>Symbol() : symbol +>Symbol : SymbolConstructor + + return 0; + } +} diff --git a/tests/baselines/reference/symbolProperty40.js b/tests/baselines/reference/symbolProperty40.js new file mode 100644 index 0000000000000..15d8c5c6fba81 --- /dev/null +++ b/tests/baselines/reference/symbolProperty40.js @@ -0,0 +1,26 @@ +//// [symbolProperty40.ts] +class C { + [Symbol.iterator](x: string): string; + [Symbol.iterator](x: number): number; + [Symbol.iterator](x: any) { + return undefined; + } +} + +var c = new C; +c[Symbol.iterator](""); +c[Symbol.iterator](0); + + +//// [symbolProperty40.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function (x) { + return undefined; + }; + return C; +})(); +var c = new C; +c[Symbol.iterator](""); +c[Symbol.iterator](0); diff --git a/tests/baselines/reference/symbolProperty40.types b/tests/baselines/reference/symbolProperty40.types new file mode 100644 index 0000000000000..a87a6ea28a806 --- /dev/null +++ b/tests/baselines/reference/symbolProperty40.types @@ -0,0 +1,48 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty40.ts === +class C { +>C : C + + [Symbol.iterator](x: string): string; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : string + + [Symbol.iterator](x: number): number; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : number + + [Symbol.iterator](x: any) { +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : any + + return undefined; +>undefined : undefined + } +} + +var c = new C; +>c : C +>new C : C +>C : typeof C + +c[Symbol.iterator](""); +>c[Symbol.iterator]("") : string +>c[Symbol.iterator] : { (x: string): string; (x: number): number; } +>c : C +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + +c[Symbol.iterator](0); +>c[Symbol.iterator](0) : number +>c[Symbol.iterator] : { (x: string): string; (x: number): number; } +>c : C +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + diff --git a/tests/baselines/reference/symbolProperty41.js b/tests/baselines/reference/symbolProperty41.js new file mode 100644 index 0000000000000..d26b2c7682aee --- /dev/null +++ b/tests/baselines/reference/symbolProperty41.js @@ -0,0 +1,26 @@ +//// [symbolProperty41.ts] +class C { + [Symbol.iterator](x: string): { x: string }; + [Symbol.iterator](x: "hello"): { x: string; hello: string }; + [Symbol.iterator](x: any) { + return undefined; + } +} + +var c = new C; +c[Symbol.iterator](""); +c[Symbol.iterator]("hello"); + + +//// [symbolProperty41.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function (x) { + return undefined; + }; + return C; +})(); +var c = new C; +c[Symbol.iterator](""); +c[Symbol.iterator]("hello"); diff --git a/tests/baselines/reference/symbolProperty41.types b/tests/baselines/reference/symbolProperty41.types new file mode 100644 index 0000000000000..94032c194d683 --- /dev/null +++ b/tests/baselines/reference/symbolProperty41.types @@ -0,0 +1,51 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty41.ts === +class C { +>C : C + + [Symbol.iterator](x: string): { x: string }; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : string +>x : string + + [Symbol.iterator](x: "hello"): { x: string; hello: string }; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : "hello" +>x : string +>hello : string + + [Symbol.iterator](x: any) { +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : any + + return undefined; +>undefined : undefined + } +} + +var c = new C; +>c : C +>new C : C +>C : typeof C + +c[Symbol.iterator](""); +>c[Symbol.iterator]("") : { x: string; } +>c[Symbol.iterator] : { (x: string): { x: string; }; (x: "hello"): { x: string; hello: string; }; } +>c : C +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + +c[Symbol.iterator]("hello"); +>c[Symbol.iterator]("hello") : { x: string; hello: string; } +>c[Symbol.iterator] : { (x: string): { x: string; }; (x: "hello"): { x: string; hello: string; }; } +>c : C +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + diff --git a/tests/baselines/reference/symbolProperty42.errors.txt b/tests/baselines/reference/symbolProperty42.errors.txt new file mode 100644 index 0000000000000..291c1c1cc5083 --- /dev/null +++ b/tests/baselines/reference/symbolProperty42.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/Symbols/symbolProperty42.ts(3,12): error TS2388: Function overload must not be static. +tests/cases/conformance/es6/Symbols/symbolProperty42.ts(4,5): error TS2387: Function overload must be static. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty42.ts (2 errors) ==== + class C { + [Symbol.iterator](x: string): string; + static [Symbol.iterator](x: number): number; + ~~~~~~~~~~~~~~~~~ +!!! error TS2388: Function overload must not be static. + [Symbol.iterator](x: any) { + ~~~~~~~~~~~~~~~~~ +!!! error TS2387: Function overload must be static. + return undefined; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty42.js b/tests/baselines/reference/symbolProperty42.js new file mode 100644 index 0000000000000..1990f54066c6c --- /dev/null +++ b/tests/baselines/reference/symbolProperty42.js @@ -0,0 +1,18 @@ +//// [symbolProperty42.ts] +class C { + [Symbol.iterator](x: string): string; + static [Symbol.iterator](x: number): number; + [Symbol.iterator](x: any) { + return undefined; + } +} + +//// [symbolProperty42.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function (x) { + return undefined; + }; + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty43.errors.txt b/tests/baselines/reference/symbolProperty43.errors.txt new file mode 100644 index 0000000000000..c5124c4cd2265 --- /dev/null +++ b/tests/baselines/reference/symbolProperty43.errors.txt @@ -0,0 +1,10 @@ +tests/cases/conformance/es6/Symbols/symbolProperty43.ts(3,5): error TS2391: Function implementation is missing or not immediately following the declaration. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty43.ts (1 errors) ==== + class C { + [Symbol.iterator](x: string): string; + [Symbol.iterator](x: number): number; + ~~~~~~~~~~~~~~~~~ +!!! error TS2391: Function implementation is missing or not immediately following the declaration. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty43.js b/tests/baselines/reference/symbolProperty43.js new file mode 100644 index 0000000000000..fcb1fd3f8e511 --- /dev/null +++ b/tests/baselines/reference/symbolProperty43.js @@ -0,0 +1,12 @@ +//// [symbolProperty43.ts] +class C { + [Symbol.iterator](x: string): string; + [Symbol.iterator](x: number): number; +} + +//// [symbolProperty43.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty44.errors.txt b/tests/baselines/reference/symbolProperty44.errors.txt new file mode 100644 index 0000000000000..2cef480e73664 --- /dev/null +++ b/tests/baselines/reference/symbolProperty44.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/Symbols/symbolProperty44.ts(2,9): error TS2300: Duplicate identifier '[Symbol.hasInstance]'. +tests/cases/conformance/es6/Symbols/symbolProperty44.ts(5,9): error TS2300: Duplicate identifier '[Symbol.hasInstance]'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty44.ts (2 errors) ==== + class C { + get [Symbol.hasInstance]() { + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier '[Symbol.hasInstance]'. + return ""; + } + get [Symbol.hasInstance]() { + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier '[Symbol.hasInstance]'. + return ""; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty44.js b/tests/baselines/reference/symbolProperty44.js new file mode 100644 index 0000000000000..d4824e79318a3 --- /dev/null +++ b/tests/baselines/reference/symbolProperty44.js @@ -0,0 +1,23 @@ +//// [symbolProperty44.ts] +class C { + get [Symbol.hasInstance]() { + return ""; + } + get [Symbol.hasInstance]() { + return ""; + } +} + +//// [symbolProperty44.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, Symbol.hasInstance, { + get: function () { + return ""; + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty45.js b/tests/baselines/reference/symbolProperty45.js new file mode 100644 index 0000000000000..d056aba9f560d --- /dev/null +++ b/tests/baselines/reference/symbolProperty45.js @@ -0,0 +1,30 @@ +//// [symbolProperty45.ts] +class C { + get [Symbol.hasInstance]() { + return ""; + } + get [Symbol.toPrimitive]() { + return ""; + } +} + +//// [symbolProperty45.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, Symbol.hasInstance, { + get: function () { + return ""; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, Symbol.toPrimitive, { + get: function () { + return ""; + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty45.types b/tests/baselines/reference/symbolProperty45.types new file mode 100644 index 0000000000000..24a74729aecab --- /dev/null +++ b/tests/baselines/reference/symbolProperty45.types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty45.ts === +class C { +>C : C + + get [Symbol.hasInstance]() { +>Symbol.hasInstance : symbol +>Symbol : SymbolConstructor +>hasInstance : symbol + + return ""; + } + get [Symbol.toPrimitive]() { +>Symbol.toPrimitive : symbol +>Symbol : SymbolConstructor +>toPrimitive : symbol + + return ""; + } +} diff --git a/tests/baselines/reference/symbolProperty46.errors.txt b/tests/baselines/reference/symbolProperty46.errors.txt new file mode 100644 index 0000000000000..68f86afc31549 --- /dev/null +++ b/tests/baselines/reference/symbolProperty46.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/Symbols/symbolProperty46.ts(10,1): error TS2322: Type 'number' is not assignable to type 'string'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty46.ts (1 errors) ==== + class C { + get [Symbol.hasInstance]() { + return ""; + } + // Should take a string + set [Symbol.hasInstance](x) { + } + } + + (new C)[Symbol.hasInstance] = 0; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. + (new C)[Symbol.hasInstance] = ""; \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty46.js b/tests/baselines/reference/symbolProperty46.js new file mode 100644 index 0000000000000..255fbac080944 --- /dev/null +++ b/tests/baselines/reference/symbolProperty46.js @@ -0,0 +1,31 @@ +//// [symbolProperty46.ts] +class C { + get [Symbol.hasInstance]() { + return ""; + } + // Should take a string + set [Symbol.hasInstance](x) { + } +} + +(new C)[Symbol.hasInstance] = 0; +(new C)[Symbol.hasInstance] = ""; + +//// [symbolProperty46.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, Symbol.hasInstance, { + get: function () { + return ""; + }, + // Should take a string + set: function (x) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); +(new C)[Symbol.hasInstance] = 0; +(new C)[Symbol.hasInstance] = ""; diff --git a/tests/baselines/reference/symbolProperty47.errors.txt b/tests/baselines/reference/symbolProperty47.errors.txt new file mode 100644 index 0000000000000..b35650f94bb3f --- /dev/null +++ b/tests/baselines/reference/symbolProperty47.errors.txt @@ -0,0 +1,20 @@ +tests/cases/conformance/es6/Symbols/symbolProperty47.ts(3,16): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/es6/Symbols/symbolProperty47.ts(11,1): error TS2322: Type 'string' is not assignable to type 'number'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty47.ts (2 errors) ==== + class C { + get [Symbol.hasInstance]() { + return ""; + ~~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. + } + // Should take a string + set [Symbol.hasInstance](x: number) { + } + } + + (new C)[Symbol.hasInstance] = 0; + (new C)[Symbol.hasInstance] = ""; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty47.js b/tests/baselines/reference/symbolProperty47.js new file mode 100644 index 0000000000000..92429c720c19e --- /dev/null +++ b/tests/baselines/reference/symbolProperty47.js @@ -0,0 +1,31 @@ +//// [symbolProperty47.ts] +class C { + get [Symbol.hasInstance]() { + return ""; + } + // Should take a string + set [Symbol.hasInstance](x: number) { + } +} + +(new C)[Symbol.hasInstance] = 0; +(new C)[Symbol.hasInstance] = ""; + +//// [symbolProperty47.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, Symbol.hasInstance, { + get: function () { + return ""; + }, + // Should take a string + set: function (x) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); +(new C)[Symbol.hasInstance] = 0; +(new C)[Symbol.hasInstance] = ""; diff --git a/tests/baselines/reference/symbolProperty48.errors.txt b/tests/baselines/reference/symbolProperty48.errors.txt new file mode 100644 index 0000000000000..8d52fa48a0728 --- /dev/null +++ b/tests/baselines/reference/symbolProperty48.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/es6/Symbols/symbolProperty48.ts(5,10): error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty48.ts (1 errors) ==== + module M { + var Symbol; + + class C { + [Symbol.iterator]() { } + ~~~~~~~~~~~~~~~ +!!! error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty48.js b/tests/baselines/reference/symbolProperty48.js new file mode 100644 index 0000000000000..48717470f2fe5 --- /dev/null +++ b/tests/baselines/reference/symbolProperty48.js @@ -0,0 +1,20 @@ +//// [symbolProperty48.ts] +module M { + var Symbol; + + class C { + [Symbol.iterator]() { } + } +} + +//// [symbolProperty48.js] +var M; +(function (M) { + var Symbol; + var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function () { }; + return C; + })(); +})(M || (M = {})); diff --git a/tests/baselines/reference/symbolProperty49.errors.txt b/tests/baselines/reference/symbolProperty49.errors.txt new file mode 100644 index 0000000000000..8a15b359ee7e8 --- /dev/null +++ b/tests/baselines/reference/symbolProperty49.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/es6/Symbols/symbolProperty49.ts(5,10): error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty49.ts (1 errors) ==== + module M { + export var Symbol; + + class C { + [Symbol.iterator]() { } + ~~~~~~~~~~~~~~~ +!!! error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty49.js b/tests/baselines/reference/symbolProperty49.js new file mode 100644 index 0000000000000..6c115a89ae403 --- /dev/null +++ b/tests/baselines/reference/symbolProperty49.js @@ -0,0 +1,20 @@ +//// [symbolProperty49.ts] +module M { + export var Symbol; + + class C { + [Symbol.iterator]() { } + } +} + +//// [symbolProperty49.js] +var M; +(function (M) { + M.Symbol; + var C = (function () { + function C() { + } + C.prototype[M.Symbol.iterator] = function () { }; + return C; + })(); +})(M || (M = {})); diff --git a/tests/baselines/reference/symbolProperty5.js b/tests/baselines/reference/symbolProperty5.js new file mode 100644 index 0000000000000..c7c88681f8a4c --- /dev/null +++ b/tests/baselines/reference/symbolProperty5.js @@ -0,0 +1,17 @@ +//// [symbolProperty5.ts] +var x = { + [Symbol.iterator]: 0, + [Symbol.isRegExp]() { }, + get [Symbol.toStringTag]() { + return 0; + } +} + +//// [symbolProperty5.js] +var x = { + [Symbol.iterator]: 0, + [Symbol.isRegExp]() { }, + get [Symbol.toStringTag]() { + return 0; + } +}; diff --git a/tests/baselines/reference/symbolProperty5.types b/tests/baselines/reference/symbolProperty5.types new file mode 100644 index 0000000000000..7d6a9f0585855 --- /dev/null +++ b/tests/baselines/reference/symbolProperty5.types @@ -0,0 +1,23 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty5.ts === +var x = { +>x : { [Symbol.iterator]: number; [Symbol.isRegExp](): void; [Symbol.toStringTag]: number; } +>{ [Symbol.iterator]: 0, [Symbol.isRegExp]() { }, get [Symbol.toStringTag]() { return 0; }} : { [Symbol.iterator]: number; [Symbol.isRegExp](): void; [Symbol.toStringTag]: number; } + + [Symbol.iterator]: 0, +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + + [Symbol.isRegExp]() { }, +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol + + get [Symbol.toStringTag]() { +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol + + return 0; + } +} diff --git a/tests/baselines/reference/symbolProperty50.js b/tests/baselines/reference/symbolProperty50.js new file mode 100644 index 0000000000000..61ded053938f6 --- /dev/null +++ b/tests/baselines/reference/symbolProperty50.js @@ -0,0 +1,19 @@ +//// [symbolProperty50.ts] +module M { + interface Symbol { } + + class C { + [Symbol.iterator]() { } + } +} + +//// [symbolProperty50.js] +var M; +(function (M) { + var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function () { }; + return C; + })(); +})(M || (M = {})); diff --git a/tests/baselines/reference/symbolProperty50.types b/tests/baselines/reference/symbolProperty50.types new file mode 100644 index 0000000000000..8258dfe1b72b8 --- /dev/null +++ b/tests/baselines/reference/symbolProperty50.types @@ -0,0 +1,16 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty50.ts === +module M { +>M : typeof M + + interface Symbol { } +>Symbol : Symbol + + class C { +>C : C + + [Symbol.iterator]() { } +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + } +} diff --git a/tests/baselines/reference/symbolProperty51.js b/tests/baselines/reference/symbolProperty51.js new file mode 100644 index 0000000000000..246dbaaa1734c --- /dev/null +++ b/tests/baselines/reference/symbolProperty51.js @@ -0,0 +1,19 @@ +//// [symbolProperty51.ts] +module M { + module Symbol { } + + class C { + [Symbol.iterator]() { } + } +} + +//// [symbolProperty51.js] +var M; +(function (M) { + var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function () { }; + return C; + })(); +})(M || (M = {})); diff --git a/tests/baselines/reference/symbolProperty51.types b/tests/baselines/reference/symbolProperty51.types new file mode 100644 index 0000000000000..6677b3b2e2d37 --- /dev/null +++ b/tests/baselines/reference/symbolProperty51.types @@ -0,0 +1,16 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty51.ts === +module M { +>M : typeof M + + module Symbol { } +>Symbol : unknown + + class C { +>C : C + + [Symbol.iterator]() { } +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + } +} diff --git a/tests/baselines/reference/symbolProperty52.errors.txt b/tests/baselines/reference/symbolProperty52.errors.txt new file mode 100644 index 0000000000000..5a44918d56489 --- /dev/null +++ b/tests/baselines/reference/symbolProperty52.errors.txt @@ -0,0 +1,21 @@ +tests/cases/conformance/es6/Symbols/symbolProperty52.ts(2,13): error TS2339: Property 'nonsense' does not exist on type 'SymbolConstructor'. +tests/cases/conformance/es6/Symbols/symbolProperty52.ts(5,1): error TS2322: Type '{}' is not assignable to type '{ [Symbol.nonsense]: number; }'. + Property '[Symbol.nonsense]' is missing in type '{}'. +tests/cases/conformance/es6/Symbols/symbolProperty52.ts(7,12): error TS2339: Property 'nonsense' does not exist on type 'SymbolConstructor'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty52.ts (3 errors) ==== + var obj = { + [Symbol.nonsense]: 0 + ~~~~~~~~ +!!! error TS2339: Property 'nonsense' does not exist on type 'SymbolConstructor'. + }; + + obj = {}; + ~~~ +!!! error TS2322: Type '{}' is not assignable to type '{ [Symbol.nonsense]: number; }'. +!!! error TS2322: Property '[Symbol.nonsense]' is missing in type '{}'. + + obj[Symbol.nonsense]; + ~~~~~~~~ +!!! error TS2339: Property 'nonsense' does not exist on type 'SymbolConstructor'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty52.js b/tests/baselines/reference/symbolProperty52.js new file mode 100644 index 0000000000000..1bf4a47de7fa1 --- /dev/null +++ b/tests/baselines/reference/symbolProperty52.js @@ -0,0 +1,15 @@ +//// [symbolProperty52.ts] +var obj = { + [Symbol.nonsense]: 0 +}; + +obj = {}; + +obj[Symbol.nonsense]; + +//// [symbolProperty52.js] +var obj = { + [Symbol.nonsense]: 0 +}; +obj = {}; +obj[Symbol.nonsense]; diff --git a/tests/baselines/reference/symbolProperty53.errors.txt b/tests/baselines/reference/symbolProperty53.errors.txt new file mode 100644 index 0000000000000..7658744eb55f0 --- /dev/null +++ b/tests/baselines/reference/symbolProperty53.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/Symbols/symbolProperty53.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/Symbols/symbolProperty53.ts(5,1): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty53.ts (2 errors) ==== + var obj = { + [Symbol.for]: 0 + ~~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + }; + + obj[Symbol.for]; + ~~~~~~~~~~~~~~~ +!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty53.js b/tests/baselines/reference/symbolProperty53.js new file mode 100644 index 0000000000000..71c82d14917ca --- /dev/null +++ b/tests/baselines/reference/symbolProperty53.js @@ -0,0 +1,12 @@ +//// [symbolProperty53.ts] +var obj = { + [Symbol.for]: 0 +}; + +obj[Symbol.for]; + +//// [symbolProperty53.js] +var obj = { + [Symbol.for]: 0 +}; +obj[Symbol.for]; diff --git a/tests/baselines/reference/symbolProperty54.errors.txt b/tests/baselines/reference/symbolProperty54.errors.txt new file mode 100644 index 0000000000000..b634b4edb0f94 --- /dev/null +++ b/tests/baselines/reference/symbolProperty54.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/Symbols/symbolProperty54.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty54.ts (1 errors) ==== + var obj = { + [Symbol.prototype]: 0 + ~~~~~~~~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + }; \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty54.js b/tests/baselines/reference/symbolProperty54.js new file mode 100644 index 0000000000000..ace8a7ca9269d --- /dev/null +++ b/tests/baselines/reference/symbolProperty54.js @@ -0,0 +1,9 @@ +//// [symbolProperty54.ts] +var obj = { + [Symbol.prototype]: 0 +}; + +//// [symbolProperty54.js] +var obj = { + [Symbol.prototype]: 0 +}; diff --git a/tests/baselines/reference/symbolProperty55.js b/tests/baselines/reference/symbolProperty55.js new file mode 100644 index 0000000000000..e19e2d8e2f65c --- /dev/null +++ b/tests/baselines/reference/symbolProperty55.js @@ -0,0 +1,23 @@ +//// [symbolProperty55.ts] +var obj = { + [Symbol.iterator]: 0 +}; + +module M { + var Symbol: SymbolConstructor; + // The following should be of type 'any'. This is because even though obj has a property keyed by Symbol.iterator, + // the key passed in here is the *wrong* Symbol.iterator. It is not the iterator property of the global Symbol. + obj[Symbol.iterator]; +} + +//// [symbolProperty55.js] +var obj = { + [Symbol.iterator]: 0 +}; +var M; +(function (M) { + var Symbol; + // The following should be of type 'any'. This is because even though obj has a property keyed by Symbol.iterator, + // the key passed in here is the *wrong* Symbol.iterator. It is not the iterator property of the global Symbol. + obj[Symbol.iterator]; +})(M || (M = {})); diff --git a/tests/baselines/reference/symbolProperty55.types b/tests/baselines/reference/symbolProperty55.types new file mode 100644 index 0000000000000..34b32e27eae52 --- /dev/null +++ b/tests/baselines/reference/symbolProperty55.types @@ -0,0 +1,28 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty55.ts === +var obj = { +>obj : { [Symbol.iterator]: number; } +>{ [Symbol.iterator]: 0} : { [Symbol.iterator]: number; } + + [Symbol.iterator]: 0 +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + +}; + +module M { +>M : typeof M + + var Symbol: SymbolConstructor; +>Symbol : SymbolConstructor +>SymbolConstructor : SymbolConstructor + + // The following should be of type 'any'. This is because even though obj has a property keyed by Symbol.iterator, + // the key passed in here is the *wrong* Symbol.iterator. It is not the iterator property of the global Symbol. + obj[Symbol.iterator]; +>obj[Symbol.iterator] : any +>obj : { [Symbol.iterator]: number; } +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +} diff --git a/tests/baselines/reference/symbolProperty56.js b/tests/baselines/reference/symbolProperty56.js new file mode 100644 index 0000000000000..fea4520c2f8d9 --- /dev/null +++ b/tests/baselines/reference/symbolProperty56.js @@ -0,0 +1,23 @@ +//// [symbolProperty56.ts] +var obj = { + [Symbol.iterator]: 0 +}; + +module M { + var Symbol: {}; + // The following should be of type 'any'. This is because even though obj has a property keyed by Symbol.iterator, + // the key passed in here is the *wrong* Symbol.iterator. It is not the iterator property of the global Symbol. + obj[Symbol["iterator"]]; +} + +//// [symbolProperty56.js] +var obj = { + [Symbol.iterator]: 0 +}; +var M; +(function (M) { + var Symbol; + // The following should be of type 'any'. This is because even though obj has a property keyed by Symbol.iterator, + // the key passed in here is the *wrong* Symbol.iterator. It is not the iterator property of the global Symbol. + obj[Symbol["iterator"]]; +})(M || (M = {})); diff --git a/tests/baselines/reference/symbolProperty56.types b/tests/baselines/reference/symbolProperty56.types new file mode 100644 index 0000000000000..8fc2e97b7517a --- /dev/null +++ b/tests/baselines/reference/symbolProperty56.types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty56.ts === +var obj = { +>obj : { [Symbol.iterator]: number; } +>{ [Symbol.iterator]: 0} : { [Symbol.iterator]: number; } + + [Symbol.iterator]: 0 +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + +}; + +module M { +>M : typeof M + + var Symbol: {}; +>Symbol : {} + + // The following should be of type 'any'. This is because even though obj has a property keyed by Symbol.iterator, + // the key passed in here is the *wrong* Symbol.iterator. It is not the iterator property of the global Symbol. + obj[Symbol["iterator"]]; +>obj[Symbol["iterator"]] : any +>obj : { [Symbol.iterator]: number; } +>Symbol["iterator"] : any +>Symbol : {} +} diff --git a/tests/baselines/reference/symbolProperty57.js b/tests/baselines/reference/symbolProperty57.js new file mode 100644 index 0000000000000..8fffcba3e27e9 --- /dev/null +++ b/tests/baselines/reference/symbolProperty57.js @@ -0,0 +1,14 @@ +//// [symbolProperty57.ts] +var obj = { + [Symbol.iterator]: 0 +}; + +// Should give type 'any'. +obj[Symbol["nonsense"]]; + +//// [symbolProperty57.js] +var obj = { + [Symbol.iterator]: 0 +}; +// Should give type 'any'. +obj[Symbol["nonsense"]]; diff --git a/tests/baselines/reference/symbolProperty57.types b/tests/baselines/reference/symbolProperty57.types new file mode 100644 index 0000000000000..013c008ce125a --- /dev/null +++ b/tests/baselines/reference/symbolProperty57.types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty57.ts === +var obj = { +>obj : { [Symbol.iterator]: number; } +>{ [Symbol.iterator]: 0} : { [Symbol.iterator]: number; } + + [Symbol.iterator]: 0 +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + +}; + +// Should give type 'any'. +obj[Symbol["nonsense"]]; +>obj[Symbol["nonsense"]] : any +>obj : { [Symbol.iterator]: number; } +>Symbol["nonsense"] : any +>Symbol : SymbolConstructor + diff --git a/tests/baselines/reference/symbolProperty58.errors.txt b/tests/baselines/reference/symbolProperty58.errors.txt new file mode 100644 index 0000000000000..5f8b117a74c1b --- /dev/null +++ b/tests/baselines/reference/symbolProperty58.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/es6/Symbols/symbolProperty58.ts(6,6): error TS2471: A computed property name of the form 'Symbol.foo' must be of type 'symbol'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty58.ts (1 errors) ==== + interface SymbolConstructor { + foo: string; + } + + var obj = { + [Symbol.foo]: 0 + ~~~~~~~~~~ +!!! error TS2471: A computed property name of the form 'Symbol.foo' must be of type 'symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty58.js b/tests/baselines/reference/symbolProperty58.js new file mode 100644 index 0000000000000..94b22156b1a21 --- /dev/null +++ b/tests/baselines/reference/symbolProperty58.js @@ -0,0 +1,13 @@ +//// [symbolProperty58.ts] +interface SymbolConstructor { + foo: string; +} + +var obj = { + [Symbol.foo]: 0 +} + +//// [symbolProperty58.js] +var obj = { + [Symbol.foo]: 0 +}; diff --git a/tests/baselines/reference/symbolProperty59.errors.txt b/tests/baselines/reference/symbolProperty59.errors.txt new file mode 100644 index 0000000000000..dfb2ece3d21f1 --- /dev/null +++ b/tests/baselines/reference/symbolProperty59.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/Symbols/symbolProperty59.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty59.ts (1 errors) ==== + interface I { + [Symbol.keyFor]: string; + ~~~~~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty59.js b/tests/baselines/reference/symbolProperty59.js new file mode 100644 index 0000000000000..78d1d212f2819 --- /dev/null +++ b/tests/baselines/reference/symbolProperty59.js @@ -0,0 +1,6 @@ +//// [symbolProperty59.ts] +interface I { + [Symbol.keyFor]: string; +} + +//// [symbolProperty59.js] diff --git a/tests/baselines/reference/symbolProperty6.js b/tests/baselines/reference/symbolProperty6.js new file mode 100644 index 0000000000000..aee61b97435b8 --- /dev/null +++ b/tests/baselines/reference/symbolProperty6.js @@ -0,0 +1,25 @@ +//// [symbolProperty6.ts] +class C { + [Symbol.iterator] = 0; + [Symbol.unscopables]: number; + [Symbol.isRegExp]() { } + get [Symbol.toStringTag]() { + return 0; + } +} + +//// [symbolProperty6.js] +var C = (function () { + function C() { + this[Symbol.iterator] = 0; + } + C.prototype[Symbol.isRegExp] = function () { }; + Object.defineProperty(C.prototype, Symbol.toStringTag, { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty6.types b/tests/baselines/reference/symbolProperty6.types new file mode 100644 index 0000000000000..e5aac6f48daeb --- /dev/null +++ b/tests/baselines/reference/symbolProperty6.types @@ -0,0 +1,27 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty6.ts === +class C { +>C : C + + [Symbol.iterator] = 0; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + + [Symbol.unscopables]: number; +>Symbol.unscopables : symbol +>Symbol : SymbolConstructor +>unscopables : symbol + + [Symbol.isRegExp]() { } +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol + + get [Symbol.toStringTag]() { +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol + + return 0; + } +} diff --git a/tests/baselines/reference/symbolProperty7.errors.txt b/tests/baselines/reference/symbolProperty7.errors.txt new file mode 100644 index 0000000000000..652f637d852d0 --- /dev/null +++ b/tests/baselines/reference/symbolProperty7.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/Symbols/symbolProperty7.ts(2,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/Symbols/symbolProperty7.ts(3,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty7.ts (2 errors) ==== + class C { + [Symbol()] = 0; + ~~~~~~~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + [Symbol()]: number; + ~~~~~~~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + [Symbol()]() { } + get [Symbol()]() { + return 0; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty7.js b/tests/baselines/reference/symbolProperty7.js new file mode 100644 index 0000000000000..781113572a177 --- /dev/null +++ b/tests/baselines/reference/symbolProperty7.js @@ -0,0 +1,25 @@ +//// [symbolProperty7.ts] +class C { + [Symbol()] = 0; + [Symbol()]: number; + [Symbol()]() { } + get [Symbol()]() { + return 0; + } +} + +//// [symbolProperty7.js] +var C = (function () { + function C() { + this[Symbol()] = 0; + } + C.prototype[Symbol()] = function () { }; + Object.defineProperty(C.prototype, Symbol(), { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty8.js b/tests/baselines/reference/symbolProperty8.js new file mode 100644 index 0000000000000..6f3ec6cfa2685 --- /dev/null +++ b/tests/baselines/reference/symbolProperty8.js @@ -0,0 +1,7 @@ +//// [symbolProperty8.ts] +interface I { + [Symbol.unscopables]: number; + [Symbol.isRegExp](); +} + +//// [symbolProperty8.js] diff --git a/tests/baselines/reference/symbolProperty8.types b/tests/baselines/reference/symbolProperty8.types new file mode 100644 index 0000000000000..d6c2f464b5305 --- /dev/null +++ b/tests/baselines/reference/symbolProperty8.types @@ -0,0 +1,14 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty8.ts === +interface I { +>I : I + + [Symbol.unscopables]: number; +>Symbol.unscopables : symbol +>Symbol : SymbolConstructor +>unscopables : symbol + + [Symbol.isRegExp](); +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol +} diff --git a/tests/baselines/reference/symbolProperty9.errors.txt b/tests/baselines/reference/symbolProperty9.errors.txt new file mode 100644 index 0000000000000..e621ab6c5a6ee --- /dev/null +++ b/tests/baselines/reference/symbolProperty9.errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/es6/Symbols/symbolProperty9.ts(10,5): error TS2322: Type 'I' is not assignable to type 'C'. + Types of property '[Symbol.iterator]' are incompatible. + Type '{ x: any; }' is not assignable to type '{ x: any; y: any; }'. + Property 'y' is missing in type '{ x: any; }'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty9.ts (1 errors) ==== + class C { + [Symbol.iterator]: { x; y }; + } + interface I { + [Symbol.iterator]: { x }; + } + + var i: I; + i = new C; + var c: C = i; + ~ +!!! error TS2322: Type 'I' is not assignable to type 'C'. +!!! error TS2322: Types of property '[Symbol.iterator]' are incompatible. +!!! error TS2322: Type '{ x: any; }' is not assignable to type '{ x: any; y: any; }'. +!!! error TS2322: Property 'y' is missing in type '{ x: any; }'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty9.js b/tests/baselines/reference/symbolProperty9.js new file mode 100644 index 0000000000000..f97a1d44a21df --- /dev/null +++ b/tests/baselines/reference/symbolProperty9.js @@ -0,0 +1,21 @@ +//// [symbolProperty9.ts] +class C { + [Symbol.iterator]: { x; y }; +} +interface I { + [Symbol.iterator]: { x }; +} + +var i: I; +i = new C; +var c: C = i; + +//// [symbolProperty9.js] +var C = (function () { + function C() { + } + return C; +})(); +var i; +i = new C; +var c = i; diff --git a/tests/baselines/reference/symbolType1.errors.txt b/tests/baselines/reference/symbolType1.errors.txt new file mode 100644 index 0000000000000..00873ccc87179 --- /dev/null +++ b/tests/baselines/reference/symbolType1.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/Symbols/symbolType1.ts(1,1): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. +tests/cases/conformance/es6/Symbols/symbolType1.ts(2,19): error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. +tests/cases/conformance/es6/Symbols/symbolType1.ts(4,19): error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. + + +==== tests/cases/conformance/es6/Symbols/symbolType1.ts (3 errors) ==== + Symbol() instanceof Symbol; + ~~~~~~~~ +!!! error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. + Symbol instanceof Symbol(); + ~~~~~~~~ +!!! error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. + (Symbol() || {}) instanceof Object; // This one should be okay, it's a valid way of distinguishing types + Symbol instanceof (Symbol() || {}); + ~~~~~~~~~~~~~~~~ +!!! error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType1.js b/tests/baselines/reference/symbolType1.js new file mode 100644 index 0000000000000..90fb540516228 --- /dev/null +++ b/tests/baselines/reference/symbolType1.js @@ -0,0 +1,11 @@ +//// [symbolType1.ts] +Symbol() instanceof Symbol; +Symbol instanceof Symbol(); +(Symbol() || {}) instanceof Object; // This one should be okay, it's a valid way of distinguishing types +Symbol instanceof (Symbol() || {}); + +//// [symbolType1.js] +Symbol() instanceof Symbol; +Symbol instanceof Symbol(); +(Symbol() || {}) instanceof Object; // This one should be okay, it's a valid way of distinguishing types +Symbol instanceof (Symbol() || {}); diff --git a/tests/baselines/reference/symbolType10.errors.txt b/tests/baselines/reference/symbolType10.errors.txt new file mode 100644 index 0000000000000..852f863bae852 --- /dev/null +++ b/tests/baselines/reference/symbolType10.errors.txt @@ -0,0 +1,34 @@ +tests/cases/conformance/es6/Symbols/symbolType10.ts(2,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType10.ts(2,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType10.ts(3,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType10.ts(3,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType10.ts(4,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType10.ts(4,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType10.ts(6,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType10.ts(7,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + +==== tests/cases/conformance/es6/Symbols/symbolType10.ts (8 errors) ==== + var s = Symbol.for("bitwise"); + s & s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s | s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s ^ s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + s & 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + 0 | s; + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType10.js b/tests/baselines/reference/symbolType10.js new file mode 100644 index 0000000000000..378479fb70fc2 --- /dev/null +++ b/tests/baselines/reference/symbolType10.js @@ -0,0 +1,16 @@ +//// [symbolType10.ts] +var s = Symbol.for("bitwise"); +s & s; +s | s; +s ^ s; + +s & 0; +0 | s; + +//// [symbolType10.js] +var s = Symbol.for("bitwise"); +s & s; +s | s; +s ^ s; +s & 0; +0 | s; diff --git a/tests/baselines/reference/symbolType11.js b/tests/baselines/reference/symbolType11.js new file mode 100644 index 0000000000000..3328be28d154c --- /dev/null +++ b/tests/baselines/reference/symbolType11.js @@ -0,0 +1,17 @@ +//// [symbolType11.ts] +var s = Symbol.for("logical"); +s && s; +s && []; +0 && s; +s || s; +s || 1; +({}) || s; + +//// [symbolType11.js] +var s = Symbol.for("logical"); +s && s; +s && []; +0 && s; +s || s; +s || 1; +({}) || s; diff --git a/tests/baselines/reference/symbolType11.types b/tests/baselines/reference/symbolType11.types new file mode 100644 index 0000000000000..21de110854cde --- /dev/null +++ b/tests/baselines/reference/symbolType11.types @@ -0,0 +1,37 @@ +=== tests/cases/conformance/es6/Symbols/symbolType11.ts === +var s = Symbol.for("logical"); +>s : symbol +>Symbol.for("logical") : symbol +>Symbol.for : (key: string) => symbol +>Symbol : SymbolConstructor +>for : (key: string) => symbol + +s && s; +>s && s : symbol +>s : symbol +>s : symbol + +s && []; +>s && [] : undefined[] +>s : symbol +>[] : undefined[] + +0 && s; +>0 && s : symbol +>s : symbol + +s || s; +>s || s : symbol +>s : symbol +>s : symbol + +s || 1; +>s || 1 : number | symbol +>s : symbol + +({}) || s; +>({}) || s : {} +>({}) : {} +>{} : {} +>s : symbol + diff --git a/tests/baselines/reference/symbolType12.errors.txt b/tests/baselines/reference/symbolType12.errors.txt new file mode 100644 index 0000000000000..adceb58ae56d0 --- /dev/null +++ b/tests/baselines/reference/symbolType12.errors.txt @@ -0,0 +1,136 @@ +tests/cases/conformance/es6/Symbols/symbolType12.ts(3,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(3,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(4,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(5,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(5,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(6,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(7,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(7,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(8,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(9,1): error TS2365: Operator '+=' cannot be applied to types 'symbol' and 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType12.ts(10,1): error TS2365: Operator '+=' cannot be applied to types 'symbol' and 'number'. +tests/cases/conformance/es6/Symbols/symbolType12.ts(11,1): error TS2469: The '+=' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType12.ts(12,8): error TS2469: The '+=' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType12.ts(13,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(13,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(14,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(15,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(15,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(16,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(17,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(17,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(18,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(19,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(19,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(20,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(21,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(21,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(22,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(23,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(23,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(24,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(25,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(25,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(26,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(28,8): error TS2469: The '+=' operator cannot be applied to type 'symbol'. + + +==== tests/cases/conformance/es6/Symbols/symbolType12.ts (35 errors) ==== + var s = Symbol.for("assign"); + var str = ""; + s *= s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s *= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s /= s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s /= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s %= s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s %= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s += s; + ~~~~~~ +!!! error TS2365: Operator '+=' cannot be applied to types 'symbol' and 'symbol'. + s += 0; + ~~~~~~ +!!! error TS2365: Operator '+=' cannot be applied to types 'symbol' and 'number'. + s += ""; + ~ +!!! error TS2469: The '+=' operator cannot be applied to type 'symbol'. + str += s; + ~ +!!! error TS2469: The '+=' operator cannot be applied to type 'symbol'. + s -= s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s -= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s <<= s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s <<= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s >>= s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s >>= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s >>>= s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s >>>= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s &= s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s &= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s ^= s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s ^= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s |= s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s |= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + str += (s || str); + ~~~~~~~~~~ +!!! error TS2469: The '+=' operator cannot be applied to type 'symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType12.js b/tests/baselines/reference/symbolType12.js new file mode 100644 index 0000000000000..069846e136fdf --- /dev/null +++ b/tests/baselines/reference/symbolType12.js @@ -0,0 +1,58 @@ +//// [symbolType12.ts] +var s = Symbol.for("assign"); +var str = ""; +s *= s; +s *= 0; +s /= s; +s /= 0; +s %= s; +s %= 0; +s += s; +s += 0; +s += ""; +str += s; +s -= s; +s -= 0; +s <<= s; +s <<= 0; +s >>= s; +s >>= 0; +s >>>= s; +s >>>= 0; +s &= s; +s &= 0; +s ^= s; +s ^= 0; +s |= s; +s |= 0; + +str += (s || str); + +//// [symbolType12.js] +var s = Symbol.for("assign"); +var str = ""; +s *= s; +s *= 0; +s /= s; +s /= 0; +s %= s; +s %= 0; +s += s; +s += 0; +s += ""; +str += s; +s -= s; +s -= 0; +s <<= s; +s <<= 0; +s >>= s; +s >>= 0; +s >>>= s; +s >>>= 0; +s &= s; +s &= 0; +s ^= s; +s ^= 0; +s |= s; +s |= 0; +str += (s || str); diff --git a/tests/baselines/reference/symbolType13.errors.txt b/tests/baselines/reference/symbolType13.errors.txt new file mode 100644 index 0000000000000..68981d0072bb9 --- /dev/null +++ b/tests/baselines/reference/symbolType13.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/es6/Symbols/symbolType13.ts(4,6): error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. +tests/cases/conformance/es6/Symbols/symbolType13.ts(5,11): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. +tests/cases/conformance/es6/Symbols/symbolType13.ts(6,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. + + +==== tests/cases/conformance/es6/Symbols/symbolType13.ts (3 errors) ==== + var s = Symbol(); + var x: any; + + for (s in {}) { } + ~ +!!! error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. + for (x in s) { } + ~ +!!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. + for (var y in s) { } + ~ +!!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType13.js b/tests/baselines/reference/symbolType13.js new file mode 100644 index 0000000000000..afd62079bb5a8 --- /dev/null +++ b/tests/baselines/reference/symbolType13.js @@ -0,0 +1,14 @@ +//// [symbolType13.ts] +var s = Symbol(); +var x: any; + +for (s in {}) { } +for (x in s) { } +for (var y in s) { } + +//// [symbolType13.js] +var s = Symbol(); +var x; +for (s in {}) { } +for (x in s) { } +for (var y in s) { } diff --git a/tests/baselines/reference/symbolType14.errors.txt b/tests/baselines/reference/symbolType14.errors.txt new file mode 100644 index 0000000000000..a31230efe2351 --- /dev/null +++ b/tests/baselines/reference/symbolType14.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/es6/Symbols/symbolType14.ts(1,1): error TS2350: Only a void function can be called with the 'new' keyword. + + +==== tests/cases/conformance/es6/Symbols/symbolType14.ts (1 errors) ==== + new Symbol(); + ~~~~~~~~~~~~ +!!! error TS2350: Only a void function can be called with the 'new' keyword. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType14.js b/tests/baselines/reference/symbolType14.js new file mode 100644 index 0000000000000..4bbd24f30d96a --- /dev/null +++ b/tests/baselines/reference/symbolType14.js @@ -0,0 +1,5 @@ +//// [symbolType14.ts] +new Symbol(); + +//// [symbolType14.js] +new Symbol(); diff --git a/tests/baselines/reference/symbolType15.errors.txt b/tests/baselines/reference/symbolType15.errors.txt new file mode 100644 index 0000000000000..eb63e5798d5e2 --- /dev/null +++ b/tests/baselines/reference/symbolType15.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/es6/Symbols/symbolType15.ts(5,1): error TS2322: Type 'Symbol' is not assignable to type 'symbol'. + + +==== tests/cases/conformance/es6/Symbols/symbolType15.ts (1 errors) ==== + var sym: symbol; + var symObj: Symbol; + + symObj = sym; + sym = symObj; + ~~~ +!!! error TS2322: Type 'Symbol' is not assignable to type 'symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType15.js b/tests/baselines/reference/symbolType15.js new file mode 100644 index 0000000000000..1c3519d603e95 --- /dev/null +++ b/tests/baselines/reference/symbolType15.js @@ -0,0 +1,12 @@ +//// [symbolType15.ts] +var sym: symbol; +var symObj: Symbol; + +symObj = sym; +sym = symObj; + +//// [symbolType15.js] +var sym; +var symObj; +symObj = sym; +sym = symObj; diff --git a/tests/baselines/reference/symbolType16.js b/tests/baselines/reference/symbolType16.js new file mode 100644 index 0000000000000..65a95dd8365d6 --- /dev/null +++ b/tests/baselines/reference/symbolType16.js @@ -0,0 +1,11 @@ +//// [symbolType16.ts] +interface Symbol { + newSymbolProp: number; +} + +var sym: symbol; +sym.newSymbolProp; + +//// [symbolType16.js] +var sym; +sym.newSymbolProp; diff --git a/tests/baselines/reference/symbolType16.types b/tests/baselines/reference/symbolType16.types new file mode 100644 index 0000000000000..91fdc9978da08 --- /dev/null +++ b/tests/baselines/reference/symbolType16.types @@ -0,0 +1,16 @@ +=== tests/cases/conformance/es6/Symbols/symbolType16.ts === +interface Symbol { +>Symbol : Symbol + + newSymbolProp: number; +>newSymbolProp : number +} + +var sym: symbol; +>sym : symbol + +sym.newSymbolProp; +>sym.newSymbolProp : number +>sym : symbol +>newSymbolProp : number + diff --git a/tests/baselines/reference/symbolType17.js b/tests/baselines/reference/symbolType17.js new file mode 100644 index 0000000000000..a00d2cb36f773 --- /dev/null +++ b/tests/baselines/reference/symbolType17.js @@ -0,0 +1,21 @@ +//// [symbolType17.ts] +interface Foo { prop } +var x: symbol | Foo; + +x; +if (typeof x === "symbol") { + x; +} +else { + x; +} + +//// [symbolType17.js] +var x; +x; +if (typeof x === "symbol") { + x; +} +else { + x; +} diff --git a/tests/baselines/reference/symbolType17.types b/tests/baselines/reference/symbolType17.types new file mode 100644 index 0000000000000..b86d5a70ff796 --- /dev/null +++ b/tests/baselines/reference/symbolType17.types @@ -0,0 +1,24 @@ +=== tests/cases/conformance/es6/Symbols/symbolType17.ts === +interface Foo { prop } +>Foo : Foo +>prop : any + +var x: symbol | Foo; +>x : symbol | Foo +>Foo : Foo + +x; +>x : symbol | Foo + +if (typeof x === "symbol") { +>typeof x === "symbol" : boolean +>typeof x : string +>x : symbol | Foo + + x; +>x : symbol +} +else { + x; +>x : Foo +} diff --git a/tests/baselines/reference/symbolType18.js b/tests/baselines/reference/symbolType18.js new file mode 100644 index 0000000000000..f8a784d2500bc --- /dev/null +++ b/tests/baselines/reference/symbolType18.js @@ -0,0 +1,21 @@ +//// [symbolType18.ts] +interface Foo { prop } +var x: symbol | Foo; + +x; +if (typeof x === "object") { + x; +} +else { + x; +} + +//// [symbolType18.js] +var x; +x; +if (typeof x === "object") { + x; +} +else { + x; +} diff --git a/tests/baselines/reference/symbolType18.types b/tests/baselines/reference/symbolType18.types new file mode 100644 index 0000000000000..1693c6e2499bc --- /dev/null +++ b/tests/baselines/reference/symbolType18.types @@ -0,0 +1,24 @@ +=== tests/cases/conformance/es6/Symbols/symbolType18.ts === +interface Foo { prop } +>Foo : Foo +>prop : any + +var x: symbol | Foo; +>x : symbol | Foo +>Foo : Foo + +x; +>x : symbol | Foo + +if (typeof x === "object") { +>typeof x === "object" : boolean +>typeof x : string +>x : symbol | Foo + + x; +>x : Foo +} +else { + x; +>x : symbol | Foo +} diff --git a/tests/baselines/reference/symbolType19.js b/tests/baselines/reference/symbolType19.js new file mode 100644 index 0000000000000..f3ba0e12472ff --- /dev/null +++ b/tests/baselines/reference/symbolType19.js @@ -0,0 +1,24 @@ +//// [symbolType19.ts] +enum E { } +var x: symbol | E; + +x; +if (typeof x === "number") { + x; +} +else { + x; +} + +//// [symbolType19.js] +var E; +(function (E) { +})(E || (E = {})); +var x; +x; +if (typeof x === "number") { + x; +} +else { + x; +} diff --git a/tests/baselines/reference/symbolType19.types b/tests/baselines/reference/symbolType19.types new file mode 100644 index 0000000000000..d01fbfa87fe98 --- /dev/null +++ b/tests/baselines/reference/symbolType19.types @@ -0,0 +1,23 @@ +=== tests/cases/conformance/es6/Symbols/symbolType19.ts === +enum E { } +>E : E + +var x: symbol | E; +>x : symbol | E +>E : E + +x; +>x : symbol | E + +if (typeof x === "number") { +>typeof x === "number" : boolean +>typeof x : string +>x : symbol | E + + x; +>x : E +} +else { + x; +>x : symbol +} diff --git a/tests/baselines/reference/symbolType2.errors.txt b/tests/baselines/reference/symbolType2.errors.txt new file mode 100644 index 0000000000000..441db91771833 --- /dev/null +++ b/tests/baselines/reference/symbolType2.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/es6/Symbols/symbolType2.ts(2,7): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter + + +==== tests/cases/conformance/es6/Symbols/symbolType2.ts (1 errors) ==== + Symbol.isConcatSpreadable in {}; + "" in Symbol.toPrimitive; + ~~~~~~~~~~~~~~~~~~ +!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter \ No newline at end of file diff --git a/tests/baselines/reference/symbolType2.js b/tests/baselines/reference/symbolType2.js new file mode 100644 index 0000000000000..e15e4da626e7e --- /dev/null +++ b/tests/baselines/reference/symbolType2.js @@ -0,0 +1,7 @@ +//// [symbolType2.ts] +Symbol.isConcatSpreadable in {}; +"" in Symbol.toPrimitive; + +//// [symbolType2.js] +Symbol.isConcatSpreadable in {}; +"" in Symbol.toPrimitive; diff --git a/tests/baselines/reference/symbolType20.errors.txt b/tests/baselines/reference/symbolType20.errors.txt new file mode 100644 index 0000000000000..41345e371f8f2 --- /dev/null +++ b/tests/baselines/reference/symbolType20.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/es6/Symbols/symbolType20.ts(1,11): error TS2427: Interface name cannot be 'symbol' + + +==== tests/cases/conformance/es6/Symbols/symbolType20.ts (1 errors) ==== + interface symbol { } + ~~~~~~ +!!! error TS2427: Interface name cannot be 'symbol' \ No newline at end of file diff --git a/tests/baselines/reference/symbolType20.js b/tests/baselines/reference/symbolType20.js new file mode 100644 index 0000000000000..cf80d0d30acc9 --- /dev/null +++ b/tests/baselines/reference/symbolType20.js @@ -0,0 +1,4 @@ +//// [symbolType20.ts] +interface symbol { } + +//// [symbolType20.js] diff --git a/tests/baselines/reference/symbolType3.errors.txt b/tests/baselines/reference/symbolType3.errors.txt new file mode 100644 index 0000000000000..7cc9e82b3b3da --- /dev/null +++ b/tests/baselines/reference/symbolType3.errors.txt @@ -0,0 +1,33 @@ +tests/cases/conformance/es6/Symbols/symbolType3.ts(5,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType3.ts(6,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType3.ts(7,3): error TS2469: The '+' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType3.ts(8,3): error TS2469: The '-' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType3.ts(9,3): error TS2469: The '~' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType3.ts(12,2): error TS2469: The '+' operator cannot be applied to type 'symbol'. + + +==== tests/cases/conformance/es6/Symbols/symbolType3.ts (6 errors) ==== + var s = Symbol(); + delete Symbol.iterator; + void Symbol.toPrimitive; + typeof Symbol.toStringTag; + ++s; + ~ +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. + --s; + ~ +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. + + Symbol(); + ~~~~~~~~ +!!! error TS2469: The '+' operator cannot be applied to type 'symbol'. + - Symbol(); + ~~~~~~~~ +!!! error TS2469: The '-' operator cannot be applied to type 'symbol'. + ~ Symbol(); + ~~~~~~~~ +!!! error TS2469: The '~' operator cannot be applied to type 'symbol'. + ! Symbol(); + + +(Symbol() || 0); + ~~~~~~~~~~~~~~~ +!!! error TS2469: The '+' operator cannot be applied to type 'symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType3.js b/tests/baselines/reference/symbolType3.js new file mode 100644 index 0000000000000..4f599dacbe0a1 --- /dev/null +++ b/tests/baselines/reference/symbolType3.js @@ -0,0 +1,26 @@ +//// [symbolType3.ts] +var s = Symbol(); +delete Symbol.iterator; +void Symbol.toPrimitive; +typeof Symbol.toStringTag; +++s; +--s; ++ Symbol(); +- Symbol(); +~ Symbol(); +! Symbol(); + ++(Symbol() || 0); + +//// [symbolType3.js] +var s = Symbol(); +delete Symbol.iterator; +void Symbol.toPrimitive; +typeof Symbol.toStringTag; +++s; +--s; ++Symbol(); +-Symbol(); +~Symbol(); +!Symbol(); ++(Symbol() || 0); diff --git a/tests/baselines/reference/symbolType4.errors.txt b/tests/baselines/reference/symbolType4.errors.txt new file mode 100644 index 0000000000000..210fe94b8d7f0 --- /dev/null +++ b/tests/baselines/reference/symbolType4.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/es6/Symbols/symbolType4.ts(2,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType4.ts(3,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. + + +==== tests/cases/conformance/es6/Symbols/symbolType4.ts (2 errors) ==== + var s = Symbol.for("postfix"); + s++; + ~ +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. + s--; + ~ +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType4.js b/tests/baselines/reference/symbolType4.js new file mode 100644 index 0000000000000..321de5a3bf9c0 --- /dev/null +++ b/tests/baselines/reference/symbolType4.js @@ -0,0 +1,9 @@ +//// [symbolType4.ts] +var s = Symbol.for("postfix"); +s++; +s--; + +//// [symbolType4.js] +var s = Symbol.for("postfix"); +s++; +s--; diff --git a/tests/baselines/reference/symbolType5.errors.txt b/tests/baselines/reference/symbolType5.errors.txt new file mode 100644 index 0000000000000..af70aad0f2690 --- /dev/null +++ b/tests/baselines/reference/symbolType5.errors.txt @@ -0,0 +1,34 @@ +tests/cases/conformance/es6/Symbols/symbolType5.ts(2,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType5.ts(2,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType5.ts(3,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType5.ts(3,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType5.ts(4,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType5.ts(4,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType5.ts(6,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType5.ts(7,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + +==== tests/cases/conformance/es6/Symbols/symbolType5.ts (8 errors) ==== + var s = Symbol.for("multiply"); + s * s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s / s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s % s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + s * 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + 0 / s; + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType5.js b/tests/baselines/reference/symbolType5.js new file mode 100644 index 0000000000000..ce76e034bd95a --- /dev/null +++ b/tests/baselines/reference/symbolType5.js @@ -0,0 +1,16 @@ +//// [symbolType5.ts] +var s = Symbol.for("multiply"); +s * s; +s / s; +s % s; + +s * 0; +0 / s; + +//// [symbolType5.js] +var s = Symbol.for("multiply"); +s * s; +s / s; +s % s; +s * 0; +0 / s; diff --git a/tests/baselines/reference/symbolType6.errors.txt b/tests/baselines/reference/symbolType6.errors.txt new file mode 100644 index 0000000000000..29d894c2afb3f --- /dev/null +++ b/tests/baselines/reference/symbolType6.errors.txt @@ -0,0 +1,57 @@ +tests/cases/conformance/es6/Symbols/symbolType6.ts(3,1): error TS2365: Operator '+' cannot be applied to types 'symbol' and 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType6.ts(4,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType6.ts(4,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType6.ts(5,1): error TS2469: The '+' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType6.ts(6,1): error TS2469: The '+' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType6.ts(7,1): error TS2365: Operator '+' cannot be applied to types 'symbol' and 'number'. +tests/cases/conformance/es6/Symbols/symbolType6.ts(8,6): error TS2469: The '+' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType6.ts(9,5): error TS2469: The '+' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType6.ts(10,1): error TS2365: Operator '+' cannot be applied to types 'number' and 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType6.ts(11,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType6.ts(12,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType6.ts(14,1): error TS2469: The '+' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType6.ts(15,6): error TS2469: The '+' operator cannot be applied to type 'symbol'. + + +==== tests/cases/conformance/es6/Symbols/symbolType6.ts (13 errors) ==== + var s = Symbol.for("add"); + var a: any; + s + s; + ~~~~~ +!!! error TS2365: Operator '+' cannot be applied to types 'symbol' and 'symbol'. + s - s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s + ""; + ~ +!!! error TS2469: The '+' operator cannot be applied to type 'symbol'. + s + a; + ~ +!!! error TS2469: The '+' operator cannot be applied to type 'symbol'. + s + 0; + ~~~~~ +!!! error TS2365: Operator '+' cannot be applied to types 'symbol' and 'number'. + "" + s; + ~ +!!! error TS2469: The '+' operator cannot be applied to type 'symbol'. + a + s; + ~ +!!! error TS2469: The '+' operator cannot be applied to type 'symbol'. + 0 + s; + ~~~~~ +!!! error TS2365: Operator '+' cannot be applied to types 'number' and 'symbol'. + s - 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + 0 - s; + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + (s || "") + ""; + ~~~~~~~~~ +!!! error TS2469: The '+' operator cannot be applied to type 'symbol'. + "" + (s || ""); + ~~~~~~~~~ +!!! error TS2469: The '+' operator cannot be applied to type 'symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType6.js b/tests/baselines/reference/symbolType6.js new file mode 100644 index 0000000000000..b316f48cf0346 --- /dev/null +++ b/tests/baselines/reference/symbolType6.js @@ -0,0 +1,32 @@ +//// [symbolType6.ts] +var s = Symbol.for("add"); +var a: any; +s + s; +s - s; +s + ""; +s + a; +s + 0; +"" + s; +a + s; +0 + s; +s - 0; +0 - s; + +(s || "") + ""; +"" + (s || ""); + +//// [symbolType6.js] +var s = Symbol.for("add"); +var a; +s + s; +s - s; +s + ""; +s + a; +s + 0; +"" + s; +a + s; +0 + s; +s - 0; +0 - s; +(s || "") + ""; +"" + (s || ""); diff --git a/tests/baselines/reference/symbolType7.errors.txt b/tests/baselines/reference/symbolType7.errors.txt new file mode 100644 index 0000000000000..80ecd2486ff74 --- /dev/null +++ b/tests/baselines/reference/symbolType7.errors.txt @@ -0,0 +1,37 @@ +tests/cases/conformance/es6/Symbols/symbolType7.ts(2,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType7.ts(2,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType7.ts(3,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType7.ts(4,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType7.ts(4,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType7.ts(5,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType7.ts(6,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType7.ts(6,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType7.ts(7,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + +==== tests/cases/conformance/es6/Symbols/symbolType7.ts (9 errors) ==== + var s = Symbol.for("shift"); + s << s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s << 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s >> s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s >> 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s >>> s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s >>> 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType7.js b/tests/baselines/reference/symbolType7.js new file mode 100644 index 0000000000000..47ace567a3d73 --- /dev/null +++ b/tests/baselines/reference/symbolType7.js @@ -0,0 +1,17 @@ +//// [symbolType7.ts] +var s = Symbol.for("shift"); +s << s; +s << 0; +s >> s; +s >> 0; +s >>> s; +s >>> 0; + +//// [symbolType7.js] +var s = Symbol.for("shift"); +s << s; +s << 0; +s >> s; +s >> 0; +s >>> s; +s >>> 0; diff --git a/tests/baselines/reference/symbolType8.errors.txt b/tests/baselines/reference/symbolType8.errors.txt new file mode 100644 index 0000000000000..8df7db61feb5b --- /dev/null +++ b/tests/baselines/reference/symbolType8.errors.txt @@ -0,0 +1,45 @@ +tests/cases/conformance/es6/Symbols/symbolType8.ts(2,1): error TS2469: The '<' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(3,1): error TS2469: The '<' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(4,1): error TS2469: The '>' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(5,1): error TS2469: The '>' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(6,1): error TS2469: The '<=' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(7,1): error TS2469: The '<=' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(8,1): error TS2469: The '>=' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(9,1): error TS2469: The '>=' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(11,6): error TS2469: The '>=' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(12,1): error TS2469: The '>=' operator cannot be applied to type 'symbol'. + + +==== tests/cases/conformance/es6/Symbols/symbolType8.ts (10 errors) ==== + var s = Symbol.for("compare"); + s < s; + ~ +!!! error TS2469: The '<' operator cannot be applied to type 'symbol'. + s < 0; + ~ +!!! error TS2469: The '<' operator cannot be applied to type 'symbol'. + s > s; + ~ +!!! error TS2469: The '>' operator cannot be applied to type 'symbol'. + s > 0; + ~ +!!! error TS2469: The '>' operator cannot be applied to type 'symbol'. + s <= s; + ~ +!!! error TS2469: The '<=' operator cannot be applied to type 'symbol'. + s <= 0; + ~ +!!! error TS2469: The '<=' operator cannot be applied to type 'symbol'. + s >= s; + ~ +!!! error TS2469: The '>=' operator cannot be applied to type 'symbol'. + s >= 0; + ~ +!!! error TS2469: The '>=' operator cannot be applied to type 'symbol'. + + 0 >= (s || 0); + ~~~~~~~~ +!!! error TS2469: The '>=' operator cannot be applied to type 'symbol'. + (s || 0) >= s; + ~~~~~~~~ +!!! error TS2469: The '>=' operator cannot be applied to type 'symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType8.js b/tests/baselines/reference/symbolType8.js new file mode 100644 index 0000000000000..7e56416ca841d --- /dev/null +++ b/tests/baselines/reference/symbolType8.js @@ -0,0 +1,26 @@ +//// [symbolType8.ts] +var s = Symbol.for("compare"); +s < s; +s < 0; +s > s; +s > 0; +s <= s; +s <= 0; +s >= s; +s >= 0; + +0 >= (s || 0); +(s || 0) >= s; + +//// [symbolType8.js] +var s = Symbol.for("compare"); +s < s; +s < 0; +s > s; +s > 0; +s <= s; +s <= 0; +s >= s; +s >= 0; +0 >= (s || 0); +(s || 0) >= s; diff --git a/tests/baselines/reference/symbolType9.errors.txt b/tests/baselines/reference/symbolType9.errors.txt new file mode 100644 index 0000000000000..5506fdc6f9dac --- /dev/null +++ b/tests/baselines/reference/symbolType9.errors.txt @@ -0,0 +1,24 @@ +tests/cases/conformance/es6/Symbols/symbolType9.ts(3,1): error TS2365: Operator '==' cannot be applied to types 'symbol' and 'boolean'. +tests/cases/conformance/es6/Symbols/symbolType9.ts(5,1): error TS2365: Operator '!=' cannot be applied to types 'number' and 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType9.ts(7,1): error TS2365: Operator '===' cannot be applied to types 'symbol' and 'number'. +tests/cases/conformance/es6/Symbols/symbolType9.ts(9,1): error TS2365: Operator '!==' cannot be applied to types 'boolean' and 'symbol'. + + +==== tests/cases/conformance/es6/Symbols/symbolType9.ts (4 errors) ==== + var s = Symbol.for("equal"); + s == s; + s == true; + ~~~~~~~~~ +!!! error TS2365: Operator '==' cannot be applied to types 'symbol' and 'boolean'. + s != s; + 0 != s; + ~~~~~~ +!!! error TS2365: Operator '!=' cannot be applied to types 'number' and 'symbol'. + s === s; + s === 1; + ~~~~~~~ +!!! error TS2365: Operator '===' cannot be applied to types 'symbol' and 'number'. + s !== s; + false !== s; + ~~~~~~~~~~~ +!!! error TS2365: Operator '!==' cannot be applied to types 'boolean' and 'symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType9.js b/tests/baselines/reference/symbolType9.js new file mode 100644 index 0000000000000..c9b0c801cc830 --- /dev/null +++ b/tests/baselines/reference/symbolType9.js @@ -0,0 +1,21 @@ +//// [symbolType9.ts] +var s = Symbol.for("equal"); +s == s; +s == true; +s != s; +0 != s; +s === s; +s === 1; +s !== s; +false !== s; + +//// [symbolType9.js] +var s = Symbol.for("equal"); +s == s; +s == true; +s != s; +0 != s; +s === s; +s === 1; +s !== s; +false !== s; diff --git a/tests/baselines/reference/widenedTypes.errors.txt b/tests/baselines/reference/widenedTypes.errors.txt index 7374bd23b7799..2277ef6eea75a 100644 --- a/tests/baselines/reference/widenedTypes.errors.txt +++ b/tests/baselines/reference/widenedTypes.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/widenedTypes.ts(2,1): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. -tests/cases/compiler/widenedTypes.ts(5,1): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +tests/cases/compiler/widenedTypes.ts(5,1): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. tests/cases/compiler/widenedTypes.ts(6,7): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter tests/cases/compiler/widenedTypes.ts(8,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. tests/cases/compiler/widenedTypes.ts(11,1): error TS2322: Type 'string' is not assignable to type 'number'. @@ -20,7 +20,7 @@ tests/cases/compiler/widenedTypes.ts(24,5): error TS2322: Type '{ [x: string]: n null in {}; ~~~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. "" in null; ~~~~ !!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter diff --git a/tests/cases/conformance/Symbols/ES5SymbolProperty1.ts b/tests/cases/conformance/Symbols/ES5SymbolProperty1.ts new file mode 100644 index 0000000000000..8a9276416c5e4 --- /dev/null +++ b/tests/cases/conformance/Symbols/ES5SymbolProperty1.ts @@ -0,0 +1,11 @@ +//@target: ES5 +interface SymbolConstructor { + foo: string; +} +var Symbol: SymbolConstructor; + +var obj = { + [Symbol.foo]: 0 +} + +obj[Symbol.foo]; \ No newline at end of file diff --git a/tests/cases/conformance/Symbols/ES5SymbolProperty2.ts b/tests/cases/conformance/Symbols/ES5SymbolProperty2.ts new file mode 100644 index 0000000000000..07c95eb27d99e --- /dev/null +++ b/tests/cases/conformance/Symbols/ES5SymbolProperty2.ts @@ -0,0 +1,11 @@ +//@target: ES5 +module M { + var Symbol; + + export class C { + [Symbol.iterator]() { } + } + (new C)[Symbol.iterator]; +} + +(new M.C)[Symbol.iterator]; \ No newline at end of file diff --git a/tests/cases/conformance/Symbols/ES5SymbolProperty3.ts b/tests/cases/conformance/Symbols/ES5SymbolProperty3.ts new file mode 100644 index 0000000000000..262e47557f8b9 --- /dev/null +++ b/tests/cases/conformance/Symbols/ES5SymbolProperty3.ts @@ -0,0 +1,8 @@ +//@target: ES5 +var Symbol; + +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator] \ No newline at end of file diff --git a/tests/cases/conformance/Symbols/ES5SymbolProperty4.ts b/tests/cases/conformance/Symbols/ES5SymbolProperty4.ts new file mode 100644 index 0000000000000..2b14e64a33ced --- /dev/null +++ b/tests/cases/conformance/Symbols/ES5SymbolProperty4.ts @@ -0,0 +1,8 @@ +//@target: ES5 +var Symbol: { iterator: string }; + +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator] \ No newline at end of file diff --git a/tests/cases/conformance/Symbols/ES5SymbolProperty5.ts b/tests/cases/conformance/Symbols/ES5SymbolProperty5.ts new file mode 100644 index 0000000000000..ec46ddad21dc1 --- /dev/null +++ b/tests/cases/conformance/Symbols/ES5SymbolProperty5.ts @@ -0,0 +1,8 @@ +//@target: ES5 +var Symbol: { iterator: symbol }; + +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator](0) // Should error \ No newline at end of file diff --git a/tests/cases/conformance/Symbols/ES5SymbolProperty6.ts b/tests/cases/conformance/Symbols/ES5SymbolProperty6.ts new file mode 100644 index 0000000000000..59b7d2291aada --- /dev/null +++ b/tests/cases/conformance/Symbols/ES5SymbolProperty6.ts @@ -0,0 +1,6 @@ +//@target: ES5 +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator] \ No newline at end of file diff --git a/tests/cases/conformance/Symbols/ES5SymbolProperty7.ts b/tests/cases/conformance/Symbols/ES5SymbolProperty7.ts new file mode 100644 index 0000000000000..766b86f9b5d33 --- /dev/null +++ b/tests/cases/conformance/Symbols/ES5SymbolProperty7.ts @@ -0,0 +1,8 @@ +//@target: ES5 +var Symbol: { iterator: any }; + +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator] \ No newline at end of file diff --git a/tests/cases/conformance/Symbols/ES5SymbolType1.ts b/tests/cases/conformance/Symbols/ES5SymbolType1.ts new file mode 100644 index 0000000000000..bfd5592f8e4c2 --- /dev/null +++ b/tests/cases/conformance/Symbols/ES5SymbolType1.ts @@ -0,0 +1,3 @@ +//@target: ES5 +var s: symbol; +s.toString(); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit1.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit1.ts new file mode 100644 index 0000000000000..b99806a1eee23 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit1.ts @@ -0,0 +1,5 @@ +//@target: ES6 +//@declaration: true +class C { + [Symbol.isRegExp]: number; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit10.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit10.ts new file mode 100644 index 0000000000000..cf3496c2553e2 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit10.ts @@ -0,0 +1,6 @@ +//@target: ES6 +//@declaration: true +var obj = { + get [Symbol.isConcatSpreadable]() { return '' }, + set [Symbol.isConcatSpreadable](x) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit11.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit11.ts new file mode 100644 index 0000000000000..4b88ab559804a --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit11.ts @@ -0,0 +1,8 @@ +//@target: ES6 +//@declaration: true +class C { + static [Symbol.iterator] = 0; + static [Symbol.toPrimitive]() { } + static get [Symbol.isRegExp]() { return ""; } + static set [Symbol.isRegExp](x) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit12.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit12.ts new file mode 100644 index 0000000000000..c18b470d35de3 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit12.ts @@ -0,0 +1,14 @@ +//@target: ES6 +//@declaration: true +module M { + interface I { } + export class C { + [Symbol.iterator]: I; + [Symbol.toPrimitive](x: I) { } + [Symbol.isConcatSpreadable](): I { + return undefined + } + get [Symbol.isRegExp]() { return undefined; } + set [Symbol.isRegExp](x: I) { } + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit13.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit13.ts new file mode 100644 index 0000000000000..18568e853e834 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit13.ts @@ -0,0 +1,6 @@ +//@target: ES6 +//@declaration: true +class C { + get [Symbol.isRegExp]() { return ""; } + set [Symbol.toStringTag](x) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit14.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit14.ts new file mode 100644 index 0000000000000..312476628b88d --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit14.ts @@ -0,0 +1,6 @@ +//@target: ES6 +//@declaration: true +class C { + get [Symbol.isRegExp]() { return ""; } + get [Symbol.toStringTag]() { return ""; } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit2.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit2.ts new file mode 100644 index 0000000000000..420e1c849060d --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit2.ts @@ -0,0 +1,5 @@ +//@target: ES6 +//@declaration: true +class C { + [Symbol.isRegExp] = ""; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit3.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit3.ts new file mode 100644 index 0000000000000..b70ee3c15acf8 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit3.ts @@ -0,0 +1,7 @@ +//@target: ES6 +//@declaration: true +class C { + [Symbol.isRegExp](x: number); + [Symbol.isRegExp](x: string); + [Symbol.isRegExp](x: any) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit4.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit4.ts new file mode 100644 index 0000000000000..dde80577fa49a --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit4.ts @@ -0,0 +1,6 @@ +//@target: ES6 +//@declaration: true +class C { + get [Symbol.isRegExp]() { return ""; } + set [Symbol.isRegExp](x) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit5.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit5.ts new file mode 100644 index 0000000000000..e5acf9c9f7c67 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit5.ts @@ -0,0 +1,5 @@ +//@target: ES6 +//@declaration: true +interface I { + [Symbol.isConcatSpreadable](): string; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit6.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit6.ts new file mode 100644 index 0000000000000..1d0059f954f5d --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit6.ts @@ -0,0 +1,5 @@ +//@target: ES6 +//@declaration: true +interface I { + [Symbol.isConcatSpreadable]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit7.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit7.ts new file mode 100644 index 0000000000000..01f91681b1591 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit7.ts @@ -0,0 +1,5 @@ +//@target: ES6 +//@declaration: true +var obj: { + [Symbol.isConcatSpreadable]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit8.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit8.ts new file mode 100644 index 0000000000000..2682a4940f986 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit8.ts @@ -0,0 +1,5 @@ +//@target: ES6 +//@declaration: true +var obj = { + [Symbol.isConcatSpreadable]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit9.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit9.ts new file mode 100644 index 0000000000000..2c35a55360052 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit9.ts @@ -0,0 +1,5 @@ +//@target: ES6 +//@declaration: true +var obj = { + [Symbol.isConcatSpreadable]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty1.ts b/tests/cases/conformance/es6/Symbols/symbolProperty1.ts new file mode 100644 index 0000000000000..0e008511be3fe --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty1.ts @@ -0,0 +1,9 @@ +//@target: ES6 +var s: symbol; +var x = { + [s]: 0, + [s]() { }, + get [s]() { + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty10.ts b/tests/cases/conformance/es6/Symbols/symbolProperty10.ts new file mode 100644 index 0000000000000..0f63356eaf686 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty10.ts @@ -0,0 +1,11 @@ +//@target: ES6 +class C { + [Symbol.iterator]: { x; y }; +} +interface I { + [Symbol.iterator]?: { x }; +} + +var i: I; +i = new C; +var c: C = i; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty11.ts b/tests/cases/conformance/es6/Symbols/symbolProperty11.ts new file mode 100644 index 0000000000000..1377970613ddf --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty11.ts @@ -0,0 +1,9 @@ +//@target: ES6 +class C { } +interface I { + [Symbol.iterator]?: { x }; +} + +var i: I; +i = new C; +var c: C = i; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty12.ts b/tests/cases/conformance/es6/Symbols/symbolProperty12.ts new file mode 100644 index 0000000000000..5a835a34b629f --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty12.ts @@ -0,0 +1,11 @@ +//@target: ES6 +class C { + private [Symbol.iterator]: { x }; +} +interface I { + [Symbol.iterator]: { x }; +} + +var i: I; +i = new C; +var c: C = i; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty13.ts b/tests/cases/conformance/es6/Symbols/symbolProperty13.ts new file mode 100644 index 0000000000000..4b5023e1d0655 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty13.ts @@ -0,0 +1,17 @@ +//@target: ES6 +class C { + [Symbol.iterator]: { x; y }; +} +interface I { + [Symbol.iterator]: { x }; +} + +declare function foo(i: I): I; +declare function foo(a: any): any; + +declare function bar(i: C): C; +declare function bar(a: any): any; + +foo(new C); +var i: I; +bar(i); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty14.ts b/tests/cases/conformance/es6/Symbols/symbolProperty14.ts new file mode 100644 index 0000000000000..0109ec3be251e --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty14.ts @@ -0,0 +1,17 @@ +//@target: ES6 +class C { + [Symbol.iterator]: { x; y }; +} +interface I { + [Symbol.iterator]?: { x }; +} + +declare function foo(i: I): I; +declare function foo(a: any): any; + +declare function bar(i: C): C; +declare function bar(a: any): any; + +foo(new C); +var i: I; +bar(i); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty15.ts b/tests/cases/conformance/es6/Symbols/symbolProperty15.ts new file mode 100644 index 0000000000000..3ec6c6ecc7a9a --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty15.ts @@ -0,0 +1,15 @@ +//@target: ES6 +class C { } +interface I { + [Symbol.iterator]?: { x }; +} + +declare function foo(i: I): I; +declare function foo(a: any): any; + +declare function bar(i: C): C; +declare function bar(a: any): any; + +foo(new C); +var i: I; +bar(i); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty16.ts b/tests/cases/conformance/es6/Symbols/symbolProperty16.ts new file mode 100644 index 0000000000000..2b3a976df9883 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty16.ts @@ -0,0 +1,17 @@ +//@target: ES6 +class C { + private [Symbol.iterator]: { x }; +} +interface I { + [Symbol.iterator]: { x }; +} + +declare function foo(i: I): I; +declare function foo(a: any): any; + +declare function bar(i: C): C; +declare function bar(a: any): any; + +foo(new C); +var i: I; +bar(i); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty17.ts b/tests/cases/conformance/es6/Symbols/symbolProperty17.ts new file mode 100644 index 0000000000000..737059d0e3bcf --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty17.ts @@ -0,0 +1,9 @@ +//@target: ES6 +interface I { + [Symbol.iterator]: number; + [s: symbol]: string; + "__@iterator": string; +} + +var i: I; +var it = i[Symbol.iterator]; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty18.ts b/tests/cases/conformance/es6/Symbols/symbolProperty18.ts new file mode 100644 index 0000000000000..2fabea34960f0 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty18.ts @@ -0,0 +1,10 @@ +//@target: ES6 +var i = { + [Symbol.iterator]: 0, + [Symbol.toStringTag]() { return "" }, + set [Symbol.toPrimitive](p: boolean) { } +} + +var it = i[Symbol.iterator]; +var str = i[Symbol.toStringTag](); +i[Symbol.toPrimitive] = false; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty19.ts b/tests/cases/conformance/es6/Symbols/symbolProperty19.ts new file mode 100644 index 0000000000000..df9b99f5ca427 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty19.ts @@ -0,0 +1,8 @@ +//@target: ES6 +var i = { + [Symbol.iterator]: { p: null }, + [Symbol.toStringTag]() { return { p: undefined }; } +} + +var it = i[Symbol.iterator]; +var str = i[Symbol.toStringTag](); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty2.ts b/tests/cases/conformance/es6/Symbols/symbolProperty2.ts new file mode 100644 index 0000000000000..44a2ba1387464 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty2.ts @@ -0,0 +1,9 @@ +//@target: ES6 +var s = Symbol(); +var x = { + [s]: 0, + [s]() { }, + get [s]() { + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty20.ts b/tests/cases/conformance/es6/Symbols/symbolProperty20.ts new file mode 100644 index 0000000000000..7180ceec87dbe --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty20.ts @@ -0,0 +1,10 @@ +//@target: ES6 +interface I { + [Symbol.iterator]: (s: string) => string; + [Symbol.toStringTag](s: number): number; +} + +var i: I = { + [Symbol.iterator]: s => s, + [Symbol.toStringTag](n) { return n; } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty21.ts b/tests/cases/conformance/es6/Symbols/symbolProperty21.ts new file mode 100644 index 0000000000000..52e84a004254a --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty21.ts @@ -0,0 +1,13 @@ +//@target: ES6 +interface I { + [Symbol.unscopables]: T; + [Symbol.isConcatSpreadable]: U; +} + +declare function foo(p: I): { t: T; u: U }; + +foo({ + [Symbol.isConcatSpreadable]: "", + [Symbol.isRegExp]: 0, + [Symbol.unscopables]: true +}); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty22.ts b/tests/cases/conformance/es6/Symbols/symbolProperty22.ts new file mode 100644 index 0000000000000..a0eec6dd471ae --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty22.ts @@ -0,0 +1,8 @@ +//@target: ES6 +interface I { + [Symbol.unscopables](x: T): U; +} + +declare function foo(p1: T, p2: I): U; + +foo("", { [Symbol.unscopables]: s => s.length }); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty23.ts b/tests/cases/conformance/es6/Symbols/symbolProperty23.ts new file mode 100644 index 0000000000000..6d8a210872032 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty23.ts @@ -0,0 +1,10 @@ +//@target: ES6 +interface I { + [Symbol.toPrimitive]: () => boolean; +} + +class C implements I { + [Symbol.toPrimitive]() { + return true; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty24.ts b/tests/cases/conformance/es6/Symbols/symbolProperty24.ts new file mode 100644 index 0000000000000..8e1c35879ab5e --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty24.ts @@ -0,0 +1,10 @@ +//@target: ES6 +interface I { + [Symbol.toPrimitive]: () => boolean; +} + +class C implements I { + [Symbol.toPrimitive]() { + return ""; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty25.ts b/tests/cases/conformance/es6/Symbols/symbolProperty25.ts new file mode 100644 index 0000000000000..ee5711749333c --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty25.ts @@ -0,0 +1,10 @@ +//@target: ES6 +interface I { + [Symbol.toPrimitive]: () => boolean; +} + +class C implements I { + [Symbol.toStringTag]() { + return ""; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty26.ts b/tests/cases/conformance/es6/Symbols/symbolProperty26.ts new file mode 100644 index 0000000000000..88b7d168d648f --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty26.ts @@ -0,0 +1,12 @@ +//@target: ES6 +class C1 { + [Symbol.toStringTag]() { + return ""; + } +} + +class C2 extends C1 { + [Symbol.toStringTag]() { + return ""; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty27.ts b/tests/cases/conformance/es6/Symbols/symbolProperty27.ts new file mode 100644 index 0000000000000..c6283595575e1 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty27.ts @@ -0,0 +1,12 @@ +//@target: ES6 +class C1 { + [Symbol.toStringTag]() { + return {}; + } +} + +class C2 extends C1 { + [Symbol.toStringTag]() { + return ""; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty28.ts b/tests/cases/conformance/es6/Symbols/symbolProperty28.ts new file mode 100644 index 0000000000000..7f68444a75e7c --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty28.ts @@ -0,0 +1,11 @@ +//@target: ES6 +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} + +class C2 extends C1 { } + +var c: C2; +var obj = c[Symbol.toStringTag]().x; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty29.ts b/tests/cases/conformance/es6/Symbols/symbolProperty29.ts new file mode 100644 index 0000000000000..8d1b8491d3792 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty29.ts @@ -0,0 +1,7 @@ +//@target: ES6 +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } + [s: symbol]: () => { x: string }; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty3.ts b/tests/cases/conformance/es6/Symbols/symbolProperty3.ts new file mode 100644 index 0000000000000..027e93a86adfb --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty3.ts @@ -0,0 +1,9 @@ +//@target: ES6 +var s = Symbol; +var x = { + [s]: 0, + [s]() { }, + get [s]() { + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty30.ts b/tests/cases/conformance/es6/Symbols/symbolProperty30.ts new file mode 100644 index 0000000000000..a75f77d6056a2 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty30.ts @@ -0,0 +1,7 @@ +//@target: ES6 +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } + [s: symbol]: () => { x: number }; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty31.ts b/tests/cases/conformance/es6/Symbols/symbolProperty31.ts new file mode 100644 index 0000000000000..d41f5d6b0fe48 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty31.ts @@ -0,0 +1,9 @@ +//@target: ES6 +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} +class C2 extends C1 { + [s: symbol]: () => { x: string }; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty32.ts b/tests/cases/conformance/es6/Symbols/symbolProperty32.ts new file mode 100644 index 0000000000000..52da68fc57c58 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty32.ts @@ -0,0 +1,9 @@ +//@target: ES6 +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} +class C2 extends C1 { + [s: symbol]: () => { x: number }; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty33.ts b/tests/cases/conformance/es6/Symbols/symbolProperty33.ts new file mode 100644 index 0000000000000..8c7a4d274f329 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty33.ts @@ -0,0 +1,9 @@ +//@target: ES6 +class C1 extends C2 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} +class C2 { + [s: symbol]: () => { x: string }; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty34.ts b/tests/cases/conformance/es6/Symbols/symbolProperty34.ts new file mode 100644 index 0000000000000..6e8bb521f0a79 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty34.ts @@ -0,0 +1,9 @@ +//@target: ES6 +class C1 extends C2 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} +class C2 { + [s: symbol]: () => { x: number }; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty35.ts b/tests/cases/conformance/es6/Symbols/symbolProperty35.ts new file mode 100644 index 0000000000000..2d9527e2fd46b --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty35.ts @@ -0,0 +1,9 @@ +//@target: ES6 +interface I1 { + [Symbol.toStringTag](): { x: string } +} +interface I2 { + [Symbol.toStringTag](): { x: number } +} + +interface I3 extends I1, I2 { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty36.ts b/tests/cases/conformance/es6/Symbols/symbolProperty36.ts new file mode 100644 index 0000000000000..709ea39cd5dfa --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty36.ts @@ -0,0 +1,5 @@ +//@target: ES6 +var x = { + [Symbol.isConcatSpreadable]: 0, + [Symbol.isConcatSpreadable]: 1 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty37.ts b/tests/cases/conformance/es6/Symbols/symbolProperty37.ts new file mode 100644 index 0000000000000..7a6c86a7beaa8 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty37.ts @@ -0,0 +1,5 @@ +//@target: ES6 +interface I { + [Symbol.isConcatSpreadable]: string; + [Symbol.isConcatSpreadable]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty38.ts b/tests/cases/conformance/es6/Symbols/symbolProperty38.ts new file mode 100644 index 0000000000000..c8683344edcc9 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty38.ts @@ -0,0 +1,7 @@ +//@target: ES6 +interface I { + [Symbol.isConcatSpreadable]: string; +} +interface I { + [Symbol.isConcatSpreadable]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty39.ts b/tests/cases/conformance/es6/Symbols/symbolProperty39.ts new file mode 100644 index 0000000000000..af3a95eb155ab --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty39.ts @@ -0,0 +1,11 @@ +//@target: ES6 +class C { + [Symbol.iterator](x: string): string; + [Symbol.iterator](x: number): number; + [Symbol.iterator](x: any) { + return undefined; + } + [Symbol.iterator](x: any) { + return undefined; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty4.ts b/tests/cases/conformance/es6/Symbols/symbolProperty4.ts new file mode 100644 index 0000000000000..b6079bb31b350 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty4.ts @@ -0,0 +1,8 @@ +//@target: ES6 +var x = { + [Symbol()]: 0, + [Symbol()]() { }, + get [Symbol()]() { + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty40.ts b/tests/cases/conformance/es6/Symbols/symbolProperty40.ts new file mode 100644 index 0000000000000..91fd953a4d77a --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty40.ts @@ -0,0 +1,12 @@ +//@target: ES6 +class C { + [Symbol.iterator](x: string): string; + [Symbol.iterator](x: number): number; + [Symbol.iterator](x: any) { + return undefined; + } +} + +var c = new C; +c[Symbol.iterator](""); +c[Symbol.iterator](0); diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty41.ts b/tests/cases/conformance/es6/Symbols/symbolProperty41.ts new file mode 100644 index 0000000000000..9c9583264cd7f --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty41.ts @@ -0,0 +1,12 @@ +//@target: ES6 +class C { + [Symbol.iterator](x: string): { x: string }; + [Symbol.iterator](x: "hello"): { x: string; hello: string }; + [Symbol.iterator](x: any) { + return undefined; + } +} + +var c = new C; +c[Symbol.iterator](""); +c[Symbol.iterator]("hello"); diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty42.ts b/tests/cases/conformance/es6/Symbols/symbolProperty42.ts new file mode 100644 index 0000000000000..79fbce7bb90cd --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty42.ts @@ -0,0 +1,8 @@ +//@target: ES6 +class C { + [Symbol.iterator](x: string): string; + static [Symbol.iterator](x: number): number; + [Symbol.iterator](x: any) { + return undefined; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty43.ts b/tests/cases/conformance/es6/Symbols/symbolProperty43.ts new file mode 100644 index 0000000000000..c524b6423a537 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty43.ts @@ -0,0 +1,5 @@ +//@target: ES6 +class C { + [Symbol.iterator](x: string): string; + [Symbol.iterator](x: number): number; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty44.ts b/tests/cases/conformance/es6/Symbols/symbolProperty44.ts new file mode 100644 index 0000000000000..a6281592605d6 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty44.ts @@ -0,0 +1,9 @@ +//@target: ES6 +class C { + get [Symbol.hasInstance]() { + return ""; + } + get [Symbol.hasInstance]() { + return ""; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty45.ts b/tests/cases/conformance/es6/Symbols/symbolProperty45.ts new file mode 100644 index 0000000000000..cfdcc31764608 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty45.ts @@ -0,0 +1,9 @@ +//@target: ES6 +class C { + get [Symbol.hasInstance]() { + return ""; + } + get [Symbol.toPrimitive]() { + return ""; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty46.ts b/tests/cases/conformance/es6/Symbols/symbolProperty46.ts new file mode 100644 index 0000000000000..84ce050ac1c48 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty46.ts @@ -0,0 +1,12 @@ +//@target: ES6 +class C { + get [Symbol.hasInstance]() { + return ""; + } + // Should take a string + set [Symbol.hasInstance](x) { + } +} + +(new C)[Symbol.hasInstance] = 0; +(new C)[Symbol.hasInstance] = ""; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty47.ts b/tests/cases/conformance/es6/Symbols/symbolProperty47.ts new file mode 100644 index 0000000000000..05e46aaee75c0 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty47.ts @@ -0,0 +1,12 @@ +//@target: ES6 +class C { + get [Symbol.hasInstance]() { + return ""; + } + // Should take a string + set [Symbol.hasInstance](x: number) { + } +} + +(new C)[Symbol.hasInstance] = 0; +(new C)[Symbol.hasInstance] = ""; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty48.ts b/tests/cases/conformance/es6/Symbols/symbolProperty48.ts new file mode 100644 index 0000000000000..77ce9303b4425 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty48.ts @@ -0,0 +1,8 @@ +//@target: ES6 +module M { + var Symbol; + + class C { + [Symbol.iterator]() { } + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty49.ts b/tests/cases/conformance/es6/Symbols/symbolProperty49.ts new file mode 100644 index 0000000000000..bc34e146f2c2e --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty49.ts @@ -0,0 +1,8 @@ +//@target: ES6 +module M { + export var Symbol; + + class C { + [Symbol.iterator]() { } + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty5.ts b/tests/cases/conformance/es6/Symbols/symbolProperty5.ts new file mode 100644 index 0000000000000..84cb12a9de818 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty5.ts @@ -0,0 +1,8 @@ +//@target: ES6 +var x = { + [Symbol.iterator]: 0, + [Symbol.isRegExp]() { }, + get [Symbol.toStringTag]() { + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty50.ts b/tests/cases/conformance/es6/Symbols/symbolProperty50.ts new file mode 100644 index 0000000000000..8bcf25fab2906 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty50.ts @@ -0,0 +1,8 @@ +//@target: ES6 +module M { + interface Symbol { } + + class C { + [Symbol.iterator]() { } + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty51.ts b/tests/cases/conformance/es6/Symbols/symbolProperty51.ts new file mode 100644 index 0000000000000..3da5d45bf8403 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty51.ts @@ -0,0 +1,8 @@ +//@target: ES6 +module M { + module Symbol { } + + class C { + [Symbol.iterator]() { } + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty52.ts b/tests/cases/conformance/es6/Symbols/symbolProperty52.ts new file mode 100644 index 0000000000000..b14838a6914b4 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty52.ts @@ -0,0 +1,8 @@ +//@target: ES6 +var obj = { + [Symbol.nonsense]: 0 +}; + +obj = {}; + +obj[Symbol.nonsense]; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty53.ts b/tests/cases/conformance/es6/Symbols/symbolProperty53.ts new file mode 100644 index 0000000000000..c58b6e885afcc --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty53.ts @@ -0,0 +1,6 @@ +//@target: ES6 +var obj = { + [Symbol.for]: 0 +}; + +obj[Symbol.for]; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty54.ts b/tests/cases/conformance/es6/Symbols/symbolProperty54.ts new file mode 100644 index 0000000000000..b3eab2a54a154 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty54.ts @@ -0,0 +1,4 @@ +//@target: ES6 +var obj = { + [Symbol.prototype]: 0 +}; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty55.ts b/tests/cases/conformance/es6/Symbols/symbolProperty55.ts new file mode 100644 index 0000000000000..3c6ceb69b0e44 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty55.ts @@ -0,0 +1,11 @@ +//@target: ES6 +var obj = { + [Symbol.iterator]: 0 +}; + +module M { + var Symbol: SymbolConstructor; + // The following should be of type 'any'. This is because even though obj has a property keyed by Symbol.iterator, + // the key passed in here is the *wrong* Symbol.iterator. It is not the iterator property of the global Symbol. + obj[Symbol.iterator]; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty56.ts b/tests/cases/conformance/es6/Symbols/symbolProperty56.ts new file mode 100644 index 0000000000000..ae9e5232b9bd4 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty56.ts @@ -0,0 +1,11 @@ +//@target: ES6 +var obj = { + [Symbol.iterator]: 0 +}; + +module M { + var Symbol: {}; + // The following should be of type 'any'. This is because even though obj has a property keyed by Symbol.iterator, + // the key passed in here is the *wrong* Symbol.iterator. It is not the iterator property of the global Symbol. + obj[Symbol["iterator"]]; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty57.ts b/tests/cases/conformance/es6/Symbols/symbolProperty57.ts new file mode 100644 index 0000000000000..b60c18a05ee47 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty57.ts @@ -0,0 +1,7 @@ +//@target: ES6 +var obj = { + [Symbol.iterator]: 0 +}; + +// Should give type 'any'. +obj[Symbol["nonsense"]]; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty58.ts b/tests/cases/conformance/es6/Symbols/symbolProperty58.ts new file mode 100644 index 0000000000000..48cc6eb90f32c --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty58.ts @@ -0,0 +1,8 @@ +//@target: ES6 +interface SymbolConstructor { + foo: string; +} + +var obj = { + [Symbol.foo]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty59.ts b/tests/cases/conformance/es6/Symbols/symbolProperty59.ts new file mode 100644 index 0000000000000..bdea9dab62c28 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty59.ts @@ -0,0 +1,4 @@ +//@target: ES6 +interface I { + [Symbol.keyFor]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty6.ts b/tests/cases/conformance/es6/Symbols/symbolProperty6.ts new file mode 100644 index 0000000000000..ff17b977c3898 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty6.ts @@ -0,0 +1,9 @@ +//@target: ES6 +class C { + [Symbol.iterator] = 0; + [Symbol.unscopables]: number; + [Symbol.isRegExp]() { } + get [Symbol.toStringTag]() { + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty7.ts b/tests/cases/conformance/es6/Symbols/symbolProperty7.ts new file mode 100644 index 0000000000000..972e96c282b34 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty7.ts @@ -0,0 +1,9 @@ +//@target: ES6 +class C { + [Symbol()] = 0; + [Symbol()]: number; + [Symbol()]() { } + get [Symbol()]() { + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty8.ts b/tests/cases/conformance/es6/Symbols/symbolProperty8.ts new file mode 100644 index 0000000000000..14b4a32688f1e --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty8.ts @@ -0,0 +1,5 @@ +//@target: ES6 +interface I { + [Symbol.unscopables]: number; + [Symbol.isRegExp](); +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty9.ts b/tests/cases/conformance/es6/Symbols/symbolProperty9.ts new file mode 100644 index 0000000000000..33ffcb5ee2501 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty9.ts @@ -0,0 +1,11 @@ +//@target: ES6 +class C { + [Symbol.iterator]: { x; y }; +} +interface I { + [Symbol.iterator]: { x }; +} + +var i: I; +i = new C; +var c: C = i; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType1.ts b/tests/cases/conformance/es6/Symbols/symbolType1.ts new file mode 100644 index 0000000000000..3a7339fbeb7aa --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType1.ts @@ -0,0 +1,5 @@ +//@target: ES6 +Symbol() instanceof Symbol; +Symbol instanceof Symbol(); +(Symbol() || {}) instanceof Object; // This one should be okay, it's a valid way of distinguishing types +Symbol instanceof (Symbol() || {}); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType10.ts b/tests/cases/conformance/es6/Symbols/symbolType10.ts new file mode 100644 index 0000000000000..a1ee87de159f8 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType10.ts @@ -0,0 +1,8 @@ +//@target: ES6 +var s = Symbol.for("bitwise"); +s & s; +s | s; +s ^ s; + +s & 0; +0 | s; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType11.ts b/tests/cases/conformance/es6/Symbols/symbolType11.ts new file mode 100644 index 0000000000000..8b9661bb046b2 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType11.ts @@ -0,0 +1,8 @@ +//@target: ES6 +var s = Symbol.for("logical"); +s && s; +s && []; +0 && s; +s || s; +s || 1; +({}) || s; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType12.ts b/tests/cases/conformance/es6/Symbols/symbolType12.ts new file mode 100644 index 0000000000000..44852bc10e6f7 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType12.ts @@ -0,0 +1,29 @@ +//@target: ES6 +var s = Symbol.for("assign"); +var str = ""; +s *= s; +s *= 0; +s /= s; +s /= 0; +s %= s; +s %= 0; +s += s; +s += 0; +s += ""; +str += s; +s -= s; +s -= 0; +s <<= s; +s <<= 0; +s >>= s; +s >>= 0; +s >>>= s; +s >>>= 0; +s &= s; +s &= 0; +s ^= s; +s ^= 0; +s |= s; +s |= 0; + +str += (s || str); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType13.ts b/tests/cases/conformance/es6/Symbols/symbolType13.ts new file mode 100644 index 0000000000000..4b657c4c37acb --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType13.ts @@ -0,0 +1,7 @@ +//@target: ES6 +var s = Symbol(); +var x: any; + +for (s in {}) { } +for (x in s) { } +for (var y in s) { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType14.ts b/tests/cases/conformance/es6/Symbols/symbolType14.ts new file mode 100644 index 0000000000000..c20a8be874b97 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType14.ts @@ -0,0 +1,2 @@ +//@target: ES6 +new Symbol(); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType15.ts b/tests/cases/conformance/es6/Symbols/symbolType15.ts new file mode 100644 index 0000000000000..22f1f9662c0ed --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType15.ts @@ -0,0 +1,6 @@ +//@target: ES6 +var sym: symbol; +var symObj: Symbol; + +symObj = sym; +sym = symObj; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType16.ts b/tests/cases/conformance/es6/Symbols/symbolType16.ts new file mode 100644 index 0000000000000..0421e0ccc0266 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType16.ts @@ -0,0 +1,7 @@ +//@target: ES6 +interface Symbol { + newSymbolProp: number; +} + +var sym: symbol; +sym.newSymbolProp; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType17.ts b/tests/cases/conformance/es6/Symbols/symbolType17.ts new file mode 100644 index 0000000000000..95824f1794bd7 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType17.ts @@ -0,0 +1,11 @@ +//@target: ES6 +interface Foo { prop } +var x: symbol | Foo; + +x; +if (typeof x === "symbol") { + x; +} +else { + x; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType18.ts b/tests/cases/conformance/es6/Symbols/symbolType18.ts new file mode 100644 index 0000000000000..caa841717371b --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType18.ts @@ -0,0 +1,11 @@ +//@target: ES6 +interface Foo { prop } +var x: symbol | Foo; + +x; +if (typeof x === "object") { + x; +} +else { + x; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType19.ts b/tests/cases/conformance/es6/Symbols/symbolType19.ts new file mode 100644 index 0000000000000..85d13b2cbdd14 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType19.ts @@ -0,0 +1,11 @@ +//@target: ES6 +enum E { } +var x: symbol | E; + +x; +if (typeof x === "number") { + x; +} +else { + x; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType2.ts b/tests/cases/conformance/es6/Symbols/symbolType2.ts new file mode 100644 index 0000000000000..54954c17bd35d --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType2.ts @@ -0,0 +1,3 @@ +//@target: ES6 +Symbol.isConcatSpreadable in {}; +"" in Symbol.toPrimitive; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType20.ts b/tests/cases/conformance/es6/Symbols/symbolType20.ts new file mode 100644 index 0000000000000..ef14e34048bb0 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType20.ts @@ -0,0 +1,2 @@ +//@target: ES6 +interface symbol { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType3.ts b/tests/cases/conformance/es6/Symbols/symbolType3.ts new file mode 100644 index 0000000000000..b5855ecab41bd --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType3.ts @@ -0,0 +1,13 @@ +//@target: ES6 +var s = Symbol(); +delete Symbol.iterator; +void Symbol.toPrimitive; +typeof Symbol.toStringTag; +++s; +--s; ++ Symbol(); +- Symbol(); +~ Symbol(); +! Symbol(); + ++(Symbol() || 0); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType4.ts b/tests/cases/conformance/es6/Symbols/symbolType4.ts new file mode 100644 index 0000000000000..bd5b5ba1a06ea --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType4.ts @@ -0,0 +1,4 @@ +//@target: ES6 +var s = Symbol.for("postfix"); +s++; +s--; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType5.ts b/tests/cases/conformance/es6/Symbols/symbolType5.ts new file mode 100644 index 0000000000000..302cfcafdf34a --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType5.ts @@ -0,0 +1,8 @@ +//@target: ES6 +var s = Symbol.for("multiply"); +s * s; +s / s; +s % s; + +s * 0; +0 / s; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType6.ts b/tests/cases/conformance/es6/Symbols/symbolType6.ts new file mode 100644 index 0000000000000..2efa682b98fa6 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType6.ts @@ -0,0 +1,16 @@ +//@target: ES6 +var s = Symbol.for("add"); +var a: any; +s + s; +s - s; +s + ""; +s + a; +s + 0; +"" + s; +a + s; +0 + s; +s - 0; +0 - s; + +(s || "") + ""; +"" + (s || ""); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType7.ts b/tests/cases/conformance/es6/Symbols/symbolType7.ts new file mode 100644 index 0000000000000..841ca9e8b10da --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType7.ts @@ -0,0 +1,8 @@ +//@target: ES6 +var s = Symbol.for("shift"); +s << s; +s << 0; +s >> s; +s >> 0; +s >>> s; +s >>> 0; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType8.ts b/tests/cases/conformance/es6/Symbols/symbolType8.ts new file mode 100644 index 0000000000000..b3bc68094c7c4 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType8.ts @@ -0,0 +1,13 @@ +//@target: ES6 +var s = Symbol.for("compare"); +s < s; +s < 0; +s > s; +s > 0; +s <= s; +s <= 0; +s >= s; +s >= 0; + +0 >= (s || 0); +(s || 0) >= s; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType9.ts b/tests/cases/conformance/es6/Symbols/symbolType9.ts new file mode 100644 index 0000000000000..1fa431436404e --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType9.ts @@ -0,0 +1,10 @@ +//@target: ES6 +var s = Symbol.for("equal"); +s == s; +s == true; +s != s; +0 != s; +s === s; +s === 1; +s !== s; +false !== s; \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts new file mode 100644 index 0000000000000..5c10e2d487be2 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts @@ -0,0 +1,4 @@ +//@target: ES5 +interface I { + [s: symbol]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts new file mode 100644 index 0000000000000..e5d29c08f7d84 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts @@ -0,0 +1,4 @@ +//@target: ES5 +class C { + [s: symbol]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts new file mode 100644 index 0000000000000..d4bd13aa1d6b4 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts @@ -0,0 +1,4 @@ +//@target: ES5 +var x: { + [s: symbol]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty1.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty1.ts new file mode 100644 index 0000000000000..64ca01bba6c80 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty1.ts @@ -0,0 +1,4 @@ +//@target: ES5 +interface I { + [Symbol.iterator]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty2.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty2.ts new file mode 100644 index 0000000000000..cc606c2e6a3d5 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty2.ts @@ -0,0 +1,4 @@ +//@target: ES5 +interface I { + [Symbol.unscopables](): string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty3.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty3.ts new file mode 100644 index 0000000000000..978d4ef95f018 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty3.ts @@ -0,0 +1,4 @@ +//@target: ES5 +declare class C { + [Symbol.unscopables](): string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty4.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty4.ts new file mode 100644 index 0000000000000..7f16672ebd254 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty4.ts @@ -0,0 +1,4 @@ +//@target: ES5 +declare class C { + [Symbol.isRegExp]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty5.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty5.ts new file mode 100644 index 0000000000000..fb7f00d769420 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty5.ts @@ -0,0 +1,4 @@ +//@target: ES5 +class C { + [Symbol.isRegExp]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty6.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty6.ts new file mode 100644 index 0000000000000..3fc8e6f897977 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty6.ts @@ -0,0 +1,4 @@ +//@target: ES5 +class C { + [Symbol.toStringTag]: string = ""; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty7.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty7.ts new file mode 100644 index 0000000000000..a27636388c074 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty7.ts @@ -0,0 +1,4 @@ +//@target: ES5 +class C { + [Symbol.toStringTag](): void { } +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty8.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty8.ts new file mode 100644 index 0000000000000..78e5738f7da8e --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty8.ts @@ -0,0 +1,4 @@ +//@target: ES5 +var x: { + [Symbol.toPrimitive](): string +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty9.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty9.ts new file mode 100644 index 0000000000000..7838df4d8fcbf --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty9.ts @@ -0,0 +1,4 @@ +//@target: ES5 +var x: { + [Symbol.toPrimitive]: string +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer1.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer1.ts new file mode 100644 index 0000000000000..805584ef078f1 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer1.ts @@ -0,0 +1,4 @@ +//@target: ES6 +interface I { + [s: symbol]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer2.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer2.ts new file mode 100644 index 0000000000000..c593d0a4b0ab8 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer2.ts @@ -0,0 +1,4 @@ +//@target: ES6 +class C { + [s: symbol]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer3.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer3.ts new file mode 100644 index 0000000000000..183ecea6e6342 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer3.ts @@ -0,0 +1,4 @@ +//@target: ES6 +class C { + static [s: symbol]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer4.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer4.ts new file mode 100644 index 0000000000000..c6f9077f64807 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer4.ts @@ -0,0 +1,4 @@ +//@target: ES6 +var x: { + [s: symbol]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts new file mode 100644 index 0000000000000..a028a3b648858 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts @@ -0,0 +1,4 @@ +//@target: ES6 +var x = { + [s: symbol]: "" +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty1.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty1.ts new file mode 100644 index 0000000000000..d29272fd561c4 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty1.ts @@ -0,0 +1,4 @@ +//@target: ES6 +interface I { + [Symbol.iterator]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty2.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty2.ts new file mode 100644 index 0000000000000..3ef11e99aa96a --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty2.ts @@ -0,0 +1,4 @@ +//@target: ES6 +interface I { + [Symbol.unscopables](): string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty3.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty3.ts new file mode 100644 index 0000000000000..d63302991d0cd --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty3.ts @@ -0,0 +1,4 @@ +//@target: ES6 +declare class C { + [Symbol.unscopables](): string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty4.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty4.ts new file mode 100644 index 0000000000000..6a0962f15cb34 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty4.ts @@ -0,0 +1,4 @@ +//@target: ES6 +declare class C { + [Symbol.isRegExp]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty5.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty5.ts new file mode 100644 index 0000000000000..5f3fbaeaaea10 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty5.ts @@ -0,0 +1,4 @@ +//@target: ES6 +class C { + [Symbol.isRegExp]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty6.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty6.ts new file mode 100644 index 0000000000000..24d67c8b707c2 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty6.ts @@ -0,0 +1,4 @@ +//@target: ES6 +class C { + [Symbol.toStringTag]: string = ""; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty7.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty7.ts new file mode 100644 index 0000000000000..69f2f4b30f801 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty7.ts @@ -0,0 +1,4 @@ +//@target: ES6 +class C { + [Symbol.toStringTag](): void { } +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty8.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty8.ts new file mode 100644 index 0000000000000..dcc6d5b761587 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty8.ts @@ -0,0 +1,4 @@ +//@target: ES6 +var x: { + [Symbol.toPrimitive](): string +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty9.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty9.ts new file mode 100644 index 0000000000000..b7093f188d26d --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty9.ts @@ -0,0 +1,4 @@ +//@target: ES6 +var x: { + [Symbol.toPrimitive]: string +} \ No newline at end of file diff --git a/tests/cases/fourslash/scriptLexicalStructureSymbols1.ts b/tests/cases/fourslash/scriptLexicalStructureSymbols1.ts new file mode 100644 index 0000000000000..e3dde6738e95b --- /dev/null +++ b/tests/cases/fourslash/scriptLexicalStructureSymbols1.ts @@ -0,0 +1,17 @@ +/// + +////{| "itemName": "C", "kind": "class", "parentName": "" |} +////class C { +//// {| "itemName": "[Symbol.isRegExp]", "kind": "property", "parentName": "C" |} +//// [Symbol.isRegExp] = 0; +//// {| "itemName": "[Symbol.iterator]", "kind": "method", "parentName": "C" |} +//// [Symbol.iterator]() { } +//// {| "itemName": "[Symbol.isConcatSpreadable]", "kind": "getter", "parentName": "C" |} +//// get [Symbol.isConcatSpreadable]() { } +////} + +test.markers().forEach(marker => { + verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); +}); + +verify.getScriptLexicalStructureListCount(test.markers().length); \ No newline at end of file diff --git a/tests/cases/fourslash/scriptLexicalStructureSymbols2.ts b/tests/cases/fourslash/scriptLexicalStructureSymbols2.ts new file mode 100644 index 0000000000000..d048de895ecce --- /dev/null +++ b/tests/cases/fourslash/scriptLexicalStructureSymbols2.ts @@ -0,0 +1,15 @@ +/// + +////{| "itemName": "I", "kind": "interface", "parentName": "" |} +////interface I { +//// {| "itemName": "[Symbol.isRegExp]", "kind": "property", "parentName": "I" |} +//// [Symbol.isRegExp]: string; +//// {| "itemName": "[Symbol.iterator]", "kind": "method", "parentName": "I" |} +//// [Symbol.iterator](): string; +////} + +test.markers().forEach(marker => { + verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); +}); + +verify.getScriptLexicalStructureListCount(test.markers().length); \ No newline at end of file diff --git a/tests/cases/fourslash/scriptLexicalStructureSymbols3.ts b/tests/cases/fourslash/scriptLexicalStructureSymbols3.ts new file mode 100644 index 0000000000000..19f81037559b3 --- /dev/null +++ b/tests/cases/fourslash/scriptLexicalStructureSymbols3.ts @@ -0,0 +1,13 @@ +/// + +////{| "itemName": "E", "kind": "enum", "parentName": "" |} +////enum E { +//// // No nav bar entry for this +//// [Symbol.isRegExp] = 0 +////} + +test.markers().forEach(marker => { + verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); +}); + +verify.getScriptLexicalStructureListCount(test.markers().length); \ No newline at end of file