diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index a0146740678df..1f3470cc73054 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -1680,7 +1680,7 @@ namespace ts { function bindAnonymousDeclaration(node: Declaration, symbolFlags: SymbolFlags, name: __String) { const symbol = createSymbol(symbolFlags, name); - if (symbolFlags & SymbolFlags.EnumMember) { + if (symbolFlags & (SymbolFlags.EnumMember | SymbolFlags.ClassMember)) { symbol.parent = container.symbol; } addDeclarationToSymbol(symbol, node, symbolFlags); diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 631960f24ba08..a33c958ad6768 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -526,6 +526,18 @@ namespace ts { Optional = 1 << 1, } + const enum ExpandingFlags { + None = 0, + Source = 1, + Target = 1 << 1, + Both = Source | Target, + } + + const enum MembersOrExportsResolutionKind { + resolvedExports = "resolvedExports", + resolvedMembers = "resolvedMembers" + } + const builtinGlobals = createSymbolTable(); builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol); @@ -565,10 +577,10 @@ namespace ts { diagnostics.add(diagnostic); } - function createSymbol(flags: SymbolFlags, name: __String) { + function createSymbol(flags: SymbolFlags, name: __String, checkFlags?: CheckFlags) { symbolCount++; const symbol = (new Symbol(flags | SymbolFlags.Transient, name)); - symbol.checkFlags = 0; + symbol.checkFlags = checkFlags || 0; return symbol; } @@ -656,6 +668,15 @@ namespace ts { } } + function combineSymbolTables(first: SymbolTable | undefined, second: SymbolTable | undefined): SymbolTable | undefined { + if (!first || first.size === 0) return second; + if (!second || second.size === 0) return first; + const combined = createSymbolTable(); + mergeSymbolTable(combined, first); + mergeSymbolTable(combined, second); + return combined; + } + function mergeSymbolTable(target: SymbolTable, source: SymbolTable) { source.forEach((sourceSymbol, id) => { let targetSymbol = target.get(id); @@ -777,7 +798,7 @@ namespace ts { const classDeclaration = parameter.parent.parent; const parameterSymbol = getSymbol(constructorDeclaration.locals, parameterName, SymbolFlags.Value); - const propertySymbol = getSymbol(classDeclaration.symbol.members, parameterName, SymbolFlags.Value); + const propertySymbol = getSymbol(getMembersOfSymbol(classDeclaration.symbol), parameterName, SymbolFlags.Value); if (parameterSymbol && propertySymbol) { return [parameterSymbol, propertySymbol]; @@ -1042,7 +1063,7 @@ namespace ts { case SyntaxKind.ClassDeclaration: case SyntaxKind.ClassExpression: case SyntaxKind.InterfaceDeclaration: - if (result = lookup(getSymbolOfNode(location).members, name, meaning & SymbolFlags.Type)) { + if (result = lookup(getMembersOfSymbol(getSymbolOfNode(location)), name, meaning & SymbolFlags.Type)) { if (!isTypeParameterSymbolDeclaredInContainer(result, location)) { // ignore type parameters not declared in this container result = undefined; @@ -1885,7 +1906,9 @@ namespace ts { } function getExportsOfSymbol(symbol: Symbol): SymbolTable { - return symbol.flags & SymbolFlags.Module ? getExportsOfModule(symbol) : symbol.exports || emptySymbols; + return symbol.flags & SymbolFlags.Class ? getResolvedMembersOrExportsOfSymbol(symbol, MembersOrExportsResolutionKind.resolvedExports) : + symbol.flags & SymbolFlags.Module ? getExportsOfModule(symbol) : + symbol.exports || emptySymbols; } function getExportsOfModule(moduleSymbol: Symbol): SymbolTable { @@ -1986,11 +2009,11 @@ namespace ts { } function getSymbolOfNode(node: Node): Symbol { - return getMergedSymbol(node.symbol); + return getMergedSymbol(node.symbol && getLateBoundSymbol(node.symbol)); } function getParentOfSymbol(symbol: Symbol): Symbol { - return getMergedSymbol(symbol.parent); + return getMergedSymbol(symbol.parent && getLateBoundSymbol(symbol.parent)); } function getExportSymbolOfValueSymbolIfExported(symbol: Symbol): Symbol { @@ -2347,7 +2370,9 @@ namespace ts { function isEntityNameVisible(entityName: EntityNameOrEntityNameExpression, enclosingDeclaration: Node): SymbolVisibilityResult { // get symbol of the first identifier of the entityName let meaning: SymbolFlags; - if (entityName.parent.kind === SyntaxKind.TypeQuery || isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { + if (entityName.parent.kind === SyntaxKind.TypeQuery || + isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent) || + entityName.parent.kind === SyntaxKind.ComputedPropertyName) { // Typeof value meaning = SymbolFlags.Value | SymbolFlags.ExportValue; } @@ -2512,6 +2537,9 @@ namespace ts { if (type.flags & TypeFlags.BooleanLiteral) { return (type).intrinsicName === "true" ? createTrue() : createFalse(); } + if (type.flags & TypeFlags.UniqueESSymbol) { + return createTypeOperatorNode(SyntaxKind.UniqueKeyword, createKeywordTypeNode(SyntaxKind.SymbolKeyword)); + } if (type.flags & TypeFlags.Void) { return createKeywordTypeNode(SyntaxKind.VoidKeyword); } @@ -3177,14 +3205,18 @@ namespace ts { const needsElementAccess = !isIdentifierStart(firstChar, languageVersion); if (needsElementAccess) { - writePunctuation(writer, SyntaxKind.OpenBracketToken); + if (firstChar !== CharacterCodes.openBracket) { + writePunctuation(writer, SyntaxKind.OpenBracketToken); + } if (isSingleOrDoubleQuote(firstChar)) { writer.writeStringLiteral(symbolName); } else { writer.writeSymbol(symbolName, symbol); } - writePunctuation(writer, SyntaxKind.CloseBracketToken); + if (firstChar !== CharacterCodes.openBracket) { + writePunctuation(writer, SyntaxKind.CloseBracketToken); + } } else { writePunctuation(writer, SyntaxKind.DotToken); @@ -3318,6 +3350,16 @@ namespace ts { else if (getObjectFlags(type) & (ObjectFlags.Anonymous | ObjectFlags.Mapped)) { writeAnonymousType(type, nextFlags); } + else if (type.flags & TypeFlags.UniqueESSymbol) { + if (flags & TypeFormatFlags.AllowUniqueESSymbolType) { + writeKeyword(writer, SyntaxKind.UniqueKeyword); + writeSpace(writer); + } + else { + writer.reportInaccessibleUniqueSymbolError(); + } + writeKeyword(writer, SyntaxKind.SymbolKeyword); + } else if (type.flags & TypeFlags.StringOrNumberLiteral) { writer.writeStringLiteral(literalTypeToString(type)); } @@ -3450,10 +3492,10 @@ namespace ts { !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration.kind === SyntaxKind.ClassExpression && flags & TypeFormatFlags.WriteClassExpressionAsTypeLiteral) || symbol.flags & (SymbolFlags.Enum | SymbolFlags.ValueModule)) { - writeTypeOfSymbol(type, flags); + writeTypeOfSymbol(type.symbol, flags); } else if (shouldWriteTypeOfFunctionSymbol()) { - writeTypeOfSymbol(type, flags); + writeTypeOfSymbol(type.symbol, flags); } else if (contains(symbolStack, symbol)) { // If type is an anonymous type literal in a type alias declaration, use type alias name @@ -3507,13 +3549,13 @@ namespace ts { } } - function writeTypeOfSymbol(type: ObjectType, typeFormatFlags?: TypeFormatFlags) { + function writeTypeOfSymbol(symbol: Symbol, typeFormatFlags?: TypeFormatFlags) { if (typeFormatFlags & TypeFormatFlags.InArrayType) { writePunctuation(writer, SyntaxKind.OpenParenToken); } writeKeyword(writer, SyntaxKind.TypeOfKeyword); writeSpace(writer); - buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, SymbolFlags.Value, SymbolFormatFlags.None, typeFormatFlags); + buildSymbolDisplay(symbol, writer, enclosingDeclaration, SymbolFlags.Value, SymbolFormatFlags.None, typeFormatFlags); if (typeFormatFlags & TypeFormatFlags.InArrayType) { writePunctuation(writer, SyntaxKind.CloseParenToken); } @@ -3524,6 +3566,13 @@ namespace ts { writeKeyword(writer, SyntaxKind.ReadonlyKeyword); writeSpace(writer); } + if (getCheckFlags(prop) & CheckFlags.Late) { + const decl = firstOrUndefined(prop.declarations); + const name = hasLateBindableName(decl) && resolveEntityName(decl.name.expression, SymbolFlags.Value); + if (name) { + writer.trackSymbol(name, enclosingDeclaration, SymbolFlags.Value); + } + } buildSymbolDisplay(prop, writer); if (prop.flags & SymbolFlags.Optional) { writePunctuation(writer, SyntaxKind.QuestionToken); @@ -4332,8 +4381,8 @@ namespace ts { if (declaration.kind === SyntaxKind.Parameter) { const func = declaration.parent; // For a parameter of a set accessor, use the type of the get accessor if one is present - if (func.kind === SyntaxKind.SetAccessor && !hasDynamicName(func)) { - const getter = getDeclarationOfKind(declaration.parent.symbol, SyntaxKind.GetAccessor); + if (func.kind === SyntaxKind.SetAccessor && !hasNonBindableDynamicName(func)) { + const getter = getDeclarationOfKind(getSymbolOfNode(declaration.parent), SyntaxKind.GetAccessor); if (getter) { const getterSignature = getSignatureFromDeclaration(getter); const thisParameter = getAccessorThisParameter(func as AccessorDeclaration); @@ -4415,7 +4464,7 @@ namespace ts { jsDocType = declarationType; } else if (jsDocType !== unknownType && declarationType !== unknownType && !isTypeIdenticalTo(jsDocType, declarationType)) { - errorNextVariableDeclarationMustHaveSameType(symbol.valueDeclaration, jsDocType, declaration, declarationType); + errorNextVariableOrPropertyDeclarationMustHaveSameType(symbol.valueDeclaration, jsDocType, declaration, declarationType); } } else if (!jsDocType) { @@ -4523,6 +4572,12 @@ namespace ts { if (reportErrors) { reportErrorsFromWidening(declaration, type); } + + // always widen a 'unique symbol' type if the type was created for a different declaration. + if (type.flags & TypeFlags.UniqueESSymbol && !declaration.type && type.symbol !== getSymbolOfNode(declaration)) { + type = esSymbolType; + } + // During a normal type check we'll never get to here with a property assignment (the check of the containing // object literal uses a different path). We exclude widening only so that language services and type verification // tools see the actual type. @@ -5395,15 +5450,226 @@ namespace ts { function resolveDeclaredMembers(type: InterfaceType): InterfaceTypeWithDeclaredMembers { if (!(type).declaredProperties) { const symbol = type.symbol; - (type).declaredProperties = getNamedMembers(symbol.members); - (type).declaredCallSignatures = getSignaturesOfSymbol(symbol.members.get(InternalSymbolName.Call)); - (type).declaredConstructSignatures = getSignaturesOfSymbol(symbol.members.get(InternalSymbolName.New)); + const members = getMembersOfSymbol(symbol); + (type).declaredProperties = getNamedMembers(members); + (type).declaredCallSignatures = getSignaturesOfSymbol(members.get(InternalSymbolName.Call)); + (type).declaredConstructSignatures = getSignaturesOfSymbol(members.get(InternalSymbolName.New)); (type).declaredStringIndexInfo = getIndexInfoOfSymbol(symbol, IndexKind.String); (type).declaredNumberIndexInfo = getIndexInfoOfSymbol(symbol, IndexKind.Number); } return type; } + /** + * Indicates whether a type can be used as a late-bound name. + */ + function isTypeUsableAsLateBoundName(type: Type): type is LiteralType | UniqueESSymbolType { + return !!(type.flags & TypeFlags.StringOrNumberLiteralOrUnique); + } + + /** + * Indicates whether a declaration name is definitely late-bindable. + * A declaration name is only late-bindable if: + * - It is a `ComputedPropertyName`. + * - Its expression is an `Identifier` or either a `PropertyAccessExpression` an + * `ElementAccessExpression` consisting only of these same three types of nodes. + * - The type of its expression is a string or numeric literal type, or is a `unique symbol` type. + */ + function isLateBindableName(node: DeclarationName): node is LateBoundName { + return isComputedPropertyName(node) + && isEntityNameExpression(node.expression) + && isTypeUsableAsLateBoundName(checkComputedPropertyName(node)); + } + + /** + * Indicates whether a declaration has a late-bindable dynamic name. + */ + function hasLateBindableName(node: Declaration): node is LateBoundDeclaration { + const name = getNameOfDeclaration(node); + return name && isLateBindableName(name); + } + + /** + * Indicates whether a declaration has a dynamic name that cannot be late-bound. + */ + function hasNonBindableDynamicName(node: Declaration) { + return hasDynamicName(node) && !hasLateBindableName(node); + } + + /** + * Indicates whether a declaration name is a dynamic name that cannot be late-bound. + */ + function isNonBindableDynamicName(node: DeclarationName) { + return isDynamicName(node) && !isLateBindableName(node); + } + + /** + * Gets the symbolic name for a late-bound member from its type. + */ + function getLateBoundNameFromType(type: LiteralType | UniqueESSymbolType) { + if (type.flags & TypeFlags.UniqueESSymbol) { + return `__@${type.symbol.escapedName}@${getSymbolId(type.symbol)}` as __String; + } + if (type.flags & TypeFlags.StringOrNumberLiteral) { + return escapeLeadingUnderscores("" + (type).value); + } + } + + /** + * Adds a declaration to a late-bound dynamic member. This performs the same function for + * late-bound members that `addDeclarationToSymbol` in binder.ts performs for early-bound + * members. + */ + function addDeclarationToLateBoundSymbol(symbol: Symbol, member: LateBoundDeclaration, symbolFlags: SymbolFlags) { + Debug.assert(!!(getCheckFlags(symbol) & CheckFlags.Late), "Expected a late-bound symbol."); + symbol.flags |= symbolFlags; + getSymbolLinks(member.symbol).lateSymbol = symbol; + if (!symbol.declarations) { + symbol.declarations = [member]; + } + else { + symbol.declarations.push(member); + } + if (symbolFlags & SymbolFlags.Value) { + const valueDeclaration = symbol.valueDeclaration; + if (!valueDeclaration || valueDeclaration.kind !== member.kind) { + symbol.valueDeclaration = member; + } + } + } + + /** + * Performs late-binding of a dynamic member. This performs the same function for + * late-bound members that `declareSymbol` in binder.ts performs for early-bound + * members. + * + * If a symbol is a dynamic name from a computed property, we perform an additional "late" + * binding phase to attempt to resolve the name for the symbol from the type of the computed + * property's expression. If the type of the expression is a string-literal, numeric-literal, + * or unique symbol type, we can use that type as the name of the symbol. + * + * For example, given: + * + * const x = Symbol(); + * + * interface I { + * [x]: number; + * } + * + * The binder gives the property `[x]: number` a special symbol with the name "__computed". + * In the late-binding phase we can type-check the expression `x` and see that it has a + * unique symbol type which we can then use as the name of the member. This allows users + * to define custom symbols that can be used in the members of an object type. + * + * @param parent The containing symbol for the member. + * @param earlySymbols The early-bound symbols of the parent. + * @param lateSymbols The late-bound symbols of the parent. + * @param decl The member to bind. + */ + function lateBindMember(parent: Symbol, earlySymbols: SymbolTable | undefined, lateSymbols: SymbolTable, decl: LateBoundDeclaration) { + Debug.assert(!!decl.symbol, "The member is expected to have a symbol."); + const links = getNodeLinks(decl); + if (!links.resolvedSymbol) { + // In the event we attempt to resolve the late-bound name of this member recursively, + // fall back to the early-bound name of this member. + links.resolvedSymbol = decl.symbol; + const type = checkComputedPropertyName(decl.name); + if (isTypeUsableAsLateBoundName(type)) { + const memberName = getLateBoundNameFromType(type); + const symbolFlags = decl.symbol.flags; + + // Get or add a late-bound symbol for the member. This allows us to merge late-bound accessor declarations. + let lateSymbol = lateSymbols.get(memberName); + if (!lateSymbol) lateSymbols.set(memberName, lateSymbol = createSymbol(SymbolFlags.None, memberName, CheckFlags.Late)); + + // Report an error if a late-bound member has the same name as an early-bound member, + // or if we have another early-bound symbol declaration with the same name and + // conflicting flags. + const earlySymbol = earlySymbols && earlySymbols.get(memberName); + if (lateSymbol.flags & getExcludedSymbolFlags(symbolFlags) || earlySymbol) { + // If we have an existing early-bound member, combine its declarations so that we can + // report an error at each declaration. + const declarations = earlySymbol ? concatenate(earlySymbol.declarations, lateSymbol.declarations) : lateSymbol.declarations; + const name = declarationNameToString(decl.name); + forEach(declarations, declaration => error(getNameOfDeclaration(declaration) || declaration, Diagnostics.Duplicate_declaration_0, name)); + error(decl.name || decl, Diagnostics.Duplicate_declaration_0, name); + lateSymbol = createSymbol(SymbolFlags.None, memberName, CheckFlags.Late); + } + + addDeclarationToLateBoundSymbol(lateSymbol, decl, symbolFlags); + lateSymbol.parent = parent; + return links.resolvedSymbol = lateSymbol; + } + } + return links.resolvedSymbol; + } + + function getResolvedMembersOrExportsOfSymbol(symbol: Symbol, resolutionKind: MembersOrExportsResolutionKind) { + const links = getSymbolLinks(symbol); + if (!links[resolutionKind]) { + const isStatic = resolutionKind === MembersOrExportsResolutionKind.resolvedExports; + const earlySymbols = !isStatic ? symbol.members : + symbol.flags & SymbolFlags.Module ? getExportsOfModuleWorker(symbol) : + symbol.exports; + + // In the event we recursively resolve the members/exports of the symbol, we + // set the initial value of resolvedMembers/resolvedExports to the early-bound + // members/exports of the symbol. + links[resolutionKind] = earlySymbols || emptySymbols; + + // fill in any as-yet-unresolved late-bound members. + const lateSymbols = createSymbolTable(); + for (const decl of symbol.declarations) { + const members = getMembersOfDeclaration(decl); + if (members) { + for (const member of members) { + if (isStatic === hasStaticModifier(member) && hasLateBindableName(member)) { + lateBindMember(symbol, earlySymbols, lateSymbols, member); + } + } + } + } + + links[resolutionKind] = combineSymbolTables(earlySymbols, lateSymbols) || emptySymbols; + } + + return links[resolutionKind]; + } + + /** + * Gets a SymbolTable containing both the early- and late-bound members of a symbol. + * + * For a description of late-binding, see `lateBindMember`. + */ + function getMembersOfSymbol(symbol: Symbol) { + return symbol.flags & SymbolFlags.LateBindingContainer + ? getResolvedMembersOrExportsOfSymbol(symbol, MembersOrExportsResolutionKind.resolvedMembers) + : symbol.members || emptySymbols; + } + + /** + * If a symbol is the dynamic name of the member of an object type, get the late-bound + * symbol of the member. + * + * For a description of late-binding, see `lateBindMember`. + */ + function getLateBoundSymbol(symbol: Symbol): Symbol { + if (symbol.flags & SymbolFlags.ClassMember && symbol.escapedName === InternalSymbolName.Computed) { + const links = getSymbolLinks(symbol); + if (!links.lateSymbol && some(symbol.declarations, hasLateBindableName)) { + // force late binding of members/exports. This will set the late-bound symbol + if (some(symbol.declarations, hasStaticModifier)) { + getExportsOfSymbol(symbol.parent); + } + else { + getMembersOfSymbol(symbol.parent); + } + } + return links.lateSymbol || (links.lateSymbol = symbol); + } + return symbol; + } + function getTypeWithThisArgument(type: Type, thisArgument?: Type): Type { if (getObjectFlags(type) & ObjectFlags.Reference) { const target = (type).target; @@ -5427,7 +5693,7 @@ namespace ts { let numberIndexInfo: IndexInfo; if (rangeEquals(typeParameters, typeArguments, 0, typeParameters.length)) { mapper = identityMapper; - members = source.symbol ? source.symbol.members : createSymbolTable(source.declaredProperties); + members = source.symbol ? getMembersOfSymbol(source.symbol) : createSymbolTable(source.declaredProperties); callSignatures = source.declaredCallSignatures; constructSignatures = source.declaredConstructSignatures; stringIndexInfo = source.declaredStringIndexInfo; @@ -5443,7 +5709,7 @@ namespace ts { } const baseTypes = getBaseTypes(source); if (baseTypes.length) { - if (source.symbol && members === source.symbol.members) { + if (source.symbol && members === getMembersOfSymbol(source.symbol)) { members = createSymbolTable(source.declaredProperties); } const thisArgument = lastOrUndefined(typeArguments); @@ -5685,7 +5951,7 @@ namespace ts { setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } else if (symbol.flags & SymbolFlags.TypeLiteral) { - const members = symbol.members; + const members = getMembersOfSymbol(symbol); const callSignatures = getSignaturesOfSymbol(members.get(InternalSymbolName.Call)); const constructSignatures = getSignaturesOfSymbol(members.get(InternalSymbolName.New)); const stringIndexInfo = getIndexInfoOfSymbol(symbol, IndexKind.String); @@ -5745,7 +6011,9 @@ namespace ts { const modifiersType = getApparentType(getModifiersTypeFromMappedType(type)); // The 'T' in 'keyof T' const templateReadonly = !!type.declaration.readonlyToken; const templateOptional = !!type.declaration.questionToken; - if (type.declaration.typeParameter.constraint.kind === SyntaxKind.TypeOperator) { + const constraintDeclaration = type.declaration.typeParameter.constraint; + if (constraintDeclaration.kind === SyntaxKind.TypeOperator && + (constraintDeclaration).operator === SyntaxKind.KeyOfKeyword) { // We have a { [P in keyof T]: X } for (const propertySymbol of getPropertiesOfType(modifiersType)) { addMemberForKeyType(getLiteralTypeFromPropertyName(propertySymbol), propertySymbol); @@ -5784,8 +6052,8 @@ namespace ts { const propName = escapeLeadingUnderscores((t).value); const modifiersProp = getPropertyOfType(modifiersType, propName); const isOptional = templateOptional || !!(modifiersProp && modifiersProp.flags & SymbolFlags.Optional); - const prop = createSymbol(SymbolFlags.Property | (isOptional ? SymbolFlags.Optional : 0), propName); - prop.checkFlags = templateReadonly || modifiersProp && isReadonlySymbol(modifiersProp) ? CheckFlags.Readonly : 0; + const checkFlags = templateReadonly || modifiersProp && isReadonlySymbol(modifiersProp) ? CheckFlags.Readonly : 0; + const prop = createSymbol(SymbolFlags.Property | (isOptional ? SymbolFlags.Optional : 0), propName, checkFlags); prop.type = propType; if (propertySymbol) { prop.syntheticOrigin = propertySymbol; @@ -5820,7 +6088,8 @@ namespace ts { function getModifiersTypeFromMappedType(type: MappedType) { if (!type.modifiersType) { const constraintDeclaration = type.declaration.typeParameter.constraint; - if (constraintDeclaration.kind === SyntaxKind.TypeOperator) { + if (constraintDeclaration.kind === SyntaxKind.TypeOperator && + (constraintDeclaration).operator === SyntaxKind.KeyOfKeyword) { // If the constraint declaration is a 'keyof T' node, the modifiers type is T. We check // AST nodes here because, when T is a non-generic type, the logic below eagerly resolves // 'keyof T' to a literal union type and we can't recover T from that type. @@ -6116,7 +6385,7 @@ namespace ts { t.flags & TypeFlags.StringLike ? globalStringType : t.flags & TypeFlags.NumberLike ? globalNumberType : t.flags & TypeFlags.BooleanLike ? globalBooleanType : - t.flags & TypeFlags.ESSymbol ? getGlobalESSymbolType(/*reportErrors*/ languageVersion >= ScriptTarget.ES2015) : + t.flags & TypeFlags.ESSymbolLike ? getGlobalESSymbolType(/*reportErrors*/ languageVersion >= ScriptTarget.ES2015) : t.flags & TypeFlags.NonPrimitive ? emptyObjectType : t; } @@ -6174,8 +6443,7 @@ namespace ts { } propTypes.push(type); } - const result = createSymbol(SymbolFlags.Property | commonFlags, name); - result.checkFlags = syntheticFlag | checkFlags; + const result = createSymbol(SymbolFlags.Property | commonFlags, name, syntheticFlag | checkFlags); result.containingType = containingType; result.declarations = declarations; result.type = isUnion ? getUnionType(propTypes) : getIntersectionType(propTypes); @@ -6480,10 +6748,10 @@ namespace ts { // If only one accessor includes a this-type annotation, the other behaves as if it had the same type annotation if ((declaration.kind === SyntaxKind.GetAccessor || declaration.kind === SyntaxKind.SetAccessor) && - !hasDynamicName(declaration) && + !hasNonBindableDynamicName(declaration) && (!hasThisParameter || !thisParameter)) { const otherKind = declaration.kind === SyntaxKind.GetAccessor ? SyntaxKind.SetAccessor : SyntaxKind.GetAccessor; - const other = getDeclarationOfKind(declaration.symbol, otherKind); + const other = getDeclarationOfKind(getSymbolOfNode(declaration), otherKind); if (other) { thisParameter = getAnnotatedAccessorThisParameter(other); } @@ -6541,8 +6809,8 @@ namespace ts { // TypeScript 1.0 spec (April 2014): // If only one accessor includes a type annotation, the other behaves as if it had the same type annotation. - if (declaration.kind === SyntaxKind.GetAccessor && !hasDynamicName(declaration)) { - const setter = getDeclarationOfKind(declaration.symbol, SyntaxKind.SetAccessor); + if (declaration.kind === SyntaxKind.GetAccessor && !hasNonBindableDynamicName(declaration)) { + const setter = getDeclarationOfKind(getSymbolOfNode(declaration), SyntaxKind.SetAccessor); return getAnnotatedAccessorType(setter); } @@ -7339,7 +7607,8 @@ namespace ts { containsNonWideningType?: boolean; containsString?: boolean; containsNumber?: boolean; - containsStringOrNumberLiteral?: boolean; + containsESSymbol?: boolean; + containsLiteralOrUniqueESSymbol?: boolean; containsObjectType?: boolean; containsEmptyObject?: boolean; unionIndex?: number; @@ -7389,7 +7658,8 @@ namespace ts { // easier to reason about their origin. if (flags & TypeFlags.String) typeSet.containsString = true; if (flags & TypeFlags.Number) typeSet.containsNumber = true; - if (flags & TypeFlags.StringOrNumberLiteral) typeSet.containsStringOrNumberLiteral = true; + if (flags & TypeFlags.ESSymbol) typeSet.containsESSymbol = true; + if (flags & TypeFlags.StringOrNumberLiteralOrUnique) typeSet.containsLiteralOrUniqueESSymbol = true; const len = typeSet.length; const index = len && type.id > typeSet[len - 1].id ? ~len : binarySearch(typeSet, type, getTypeId, compareValues); if (index < 0) { @@ -7467,6 +7737,7 @@ namespace ts { const remove = t.flags & TypeFlags.StringLiteral && types.containsString || t.flags & TypeFlags.NumberLiteral && types.containsNumber || + t.flags & TypeFlags.UniqueESSymbol && types.containsESSymbol || t.flags & TypeFlags.StringOrNumberLiteral && t.flags & TypeFlags.FreshLiteral && containsType(types, (t).regularType); if (remove) { orderedRemoveItemAt(types, i); @@ -7496,7 +7767,7 @@ namespace ts { if (subtypeReduction) { removeSubtypes(typeSet); } - else if (typeSet.containsStringOrNumberLiteral) { + else if (typeSet.containsLiteralOrUniqueESSymbol) { removeRedundantLiteralTypes(typeSet); } if (typeSet.length === 0) { @@ -7669,7 +7940,16 @@ namespace ts { function getTypeFromTypeOperatorNode(node: TypeOperatorNode) { const links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = getIndexType(getTypeFromTypeNode(node.type)); + switch (node.operator) { + case SyntaxKind.KeyOfKeyword: + links.resolvedType = getIndexType(getTypeFromTypeNode(node.type)); + break; + case SyntaxKind.UniqueKeyword: + links.resolvedType = node.type.kind === SyntaxKind.SymbolKeyword + ? getESSymbolLikeTypeForNode(walkUpParenthesizedTypes(node.parent)) + : unknownType; + break; + } } return links.resolvedType; } @@ -7683,8 +7963,7 @@ namespace ts { function getPropertyTypeForIndexType(objectType: Type, indexType: Type, accessNode: ElementAccessExpression | IndexedAccessTypeNode, cacheSymbol: boolean) { const accessExpression = accessNode && accessNode.kind === SyntaxKind.ElementAccessExpression ? accessNode : undefined; - const propName = indexType.flags & TypeFlags.StringOrNumberLiteral ? - escapeLeadingUnderscores("" + (indexType).value) : + const propName = isTypeUsableAsLateBoundName(indexType) ? getLateBoundNameFromType(indexType) : accessExpression && checkThatExpressionIsProperSymbolReference(accessExpression.argumentExpression, indexType, /*reportError*/ false) ? getPropertyNameForKnownSymbolName(idText(((accessExpression.argumentExpression).name))) : undefined; @@ -7703,7 +7982,7 @@ namespace ts { return getTypeOfSymbol(prop); } } - if (!(indexType.flags & TypeFlags.Nullable) && isTypeAssignableToKind(indexType, TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.ESSymbol)) { + if (!(indexType.flags & TypeFlags.Nullable) && isTypeAssignableToKind(indexType, TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.ESSymbolLike)) { if (isTypeAny(objectType)) { return anyType; } @@ -7869,7 +8148,7 @@ namespace ts { if (!links.resolvedType) { // Deferred resolution of members is handled by resolveObjectTypeMembers const aliasSymbol = getAliasSymbolForTypeNode(node); - if (node.symbol.members.size === 0 && !aliasSymbol) { + if (getMembersOfSymbol(node.symbol).size === 0 && !aliasSymbol) { links.resolvedType = emptyTypeLiteralType; } else { @@ -8018,7 +8297,7 @@ namespace ts { function getFreshTypeOfLiteralType(type: Type) { if (type.flags & TypeFlags.StringOrNumberLiteral && !(type.flags & TypeFlags.FreshLiteral)) { if (!(type).freshType) { - const freshType = createLiteralType(type.flags | TypeFlags.FreshLiteral, (type).value, (type).symbol); + const freshType = createLiteralType(type.flags | TypeFlags.FreshLiteral, (type).value, (type).symbol); freshType.regularType = type; (type).freshType = freshType; } @@ -8054,6 +8333,21 @@ namespace ts { return links.resolvedType; } + function createUniqueESSymbolType(symbol: Symbol) { + const type = createType(TypeFlags.UniqueESSymbol); + type.symbol = symbol; + return type; + } + + function getESSymbolLikeTypeForNode(node: Node) { + if (isValidESSymbolDeclaration(node)) { + const symbol = getSymbolOfNode(node); + const links = getSymbolLinks(symbol); + return links.type || (links.type = createUniqueESSymbolType(symbol)); + } + return esSymbolType; + } + function getThisType(node: Node): Type { const container = getThisContainer(node, /*includeArrowFunctions*/ false); const parent = container && container.parent; @@ -8289,8 +8583,7 @@ namespace ts { } // Keep the flags from the symbol we're instantiating. Mark that is instantiated, and // also transient so that we can just store data on it directly. - const result = createSymbol(symbol.flags, symbol.escapedName); - result.checkFlags = CheckFlags.Instantiated; + const result = createSymbol(symbol.flags, symbol.escapedName, CheckFlags.Instantiated); result.declarations = symbol.declarations; result.parent = symbol.parent; result.target = symbol; @@ -8854,6 +9147,7 @@ namespace ts { t & TypeFlags.NumberLiteral && !(t & TypeFlags.EnumLiteral) && (source).value === (target).value) return true; if (s & TypeFlags.BooleanLike && t & TypeFlags.Boolean) return true; + if (s & TypeFlags.ESSymbolLike && t & TypeFlags.ESSymbol) return true; if (s & TypeFlags.Enum && t & TypeFlags.Enum && isEnumTypeRelatedTo(source.symbol, target.symbol, errorReporter)) return true; if (s & TypeFlags.EnumLiteral && t & TypeFlags.EnumLiteral) { if (s & TypeFlags.Union && t & TypeFlags.Union && isEnumTypeRelatedTo(source.symbol, target.symbol, errorReporter)) return true; @@ -8864,6 +9158,7 @@ namespace ts { if (s & TypeFlags.Undefined && (!strictNullChecks || t & (TypeFlags.Undefined | TypeFlags.Void))) return true; if (s & TypeFlags.Null && (!strictNullChecks || t & TypeFlags.Null)) return true; if (s & TypeFlags.Object && t & TypeFlags.NonPrimitive) return true; + if (s & TypeFlags.UniqueESSymbol || t & TypeFlags.UniqueESSymbol) return false; if (relation === assignableRelation || relation === comparableRelation) { if (s & TypeFlags.Any) return true; // Type number or any numeric literal type is assignable to any numeric enum type or any @@ -8923,12 +9218,6 @@ namespace ts { let targetStack: Type[]; let maybeCount = 0; let depth = 0; - const enum ExpandingFlags { - None = 0, - Source = 1, - Target = 1 << 1, - Both = Source | Target, - } let expandingFlags = ExpandingFlags.None; let overflow = false; let isIntersectionConstituent = false; @@ -10353,6 +10642,19 @@ namespace ts { type; } + function getWidenedUniqueESSymbolType(type: Type): Type { + return type.flags & TypeFlags.UniqueESSymbol ? esSymbolType : + type.flags & TypeFlags.Union ? getUnionType(sameMap((type).types, getWidenedUniqueESSymbolType)) : + type; + } + + function getWidenedLiteralLikeTypeForContextualType(type: Type, contextualType: Type) { + if (!isLiteralLikeContextualType(contextualType)) { + type = getWidenedUniqueESSymbolType(getWidenedLiteralType(type)); + } + return type; + } + /** * Check if a Type was written as a tuple type literal. * Prefer using isTupleLikeType() unless the use of `elementTypes` is required. @@ -10787,8 +11089,8 @@ namespace ts { if (propType.flags & TypeFlags.ContainsAnyFunctionType) { return undefined; } - const inferredProp = createSymbol(SymbolFlags.Property | prop.flags & optionalMask, prop.escapedName); - inferredProp.checkFlags = readonlyMask && isReadonlySymbol(prop) ? CheckFlags.Readonly : 0; + const checkFlags = readonlyMask && isReadonlySymbol(prop) ? CheckFlags.Readonly : 0; + const inferredProp = createSymbol(SymbolFlags.Property | prop.flags & optionalMask, prop.escapedName, checkFlags); inferredProp.declarations = prop.declarations; inferredProp.type = inferTargetType(propType); members.set(prop.escapedName, inferredProp); @@ -11198,16 +11500,19 @@ namespace ts { inferredType = getDefaultTypeArgumentType(!!(context.flags & InferenceFlags.AnyDefault)); } } + + inferredType = getWidenedUniqueESSymbolType(inferredType); inference.inferredType = inferredType; const constraint = getConstraintOfTypeParameter(context.signature.typeParameters[index]); if (constraint) { const instantiatedConstraint = instantiateType(constraint, context); if (!context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) { - inference.inferredType = inferredType = instantiatedConstraint; + inference.inferredType = inferredType = getWidenedUniqueESSymbolType(instantiatedConstraint); } } } + return inferredType; } @@ -11496,7 +11801,7 @@ namespace ts { if (flags & TypeFlags.Null) { return TypeFacts.NullFacts; } - if (flags & TypeFlags.ESSymbol) { + if (flags & TypeFlags.ESSymbolLike) { return strictNullChecks ? TypeFacts.SymbolStrictFacts : TypeFacts.SymbolFacts; } if (flags & TypeFlags.NonPrimitive) { @@ -13581,7 +13886,7 @@ namespace ts { const objectLiteral = element.parent; const type = getApparentTypeOfContextualType(objectLiteral); if (type) { - if (!hasDynamicName(element)) { + if (!hasNonBindableDynamicName(element)) { // For a (non-symbol) computed property, there is no reason to look up the name // in the type. It will just be "__computed", which does not appear in any // SymbolTable. @@ -14015,7 +14320,7 @@ namespace ts { // 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 (links.resolvedType.flags & TypeFlags.Nullable || - !isTypeAssignableToKind(links.resolvedType, TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.ESSymbol) && + !isTypeAssignableToKind(links.resolvedType, TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.ESSymbolLike) && !isTypeAssignableTo(links.resolvedType, getUnionType([stringType, numberType, esSymbolType]))) { error(node, Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any); } @@ -14061,7 +14366,7 @@ namespace ts { let offset = 0; for (let i = 0; i < node.properties.length; i++) { const memberDecl = node.properties[i]; - let member = memberDecl.symbol; + let member = getSymbolOfNode(memberDecl); let literalName: __String | undefined; if (memberDecl.kind === SyntaxKind.PropertyAssignment || memberDecl.kind === SyntaxKind.ShorthandPropertyAssignment || @@ -14095,7 +14400,12 @@ namespace ts { } typeFlags |= type.flags; - const prop = createSymbol(SymbolFlags.Property | member.flags, literalName || member.escapedName); + + const nameType = hasLateBindableName(memberDecl) ? checkComputedPropertyName(memberDecl.name) : undefined; + const prop = nameType && isTypeUsableAsLateBoundName(nameType) + ? createSymbol(SymbolFlags.Property | member.flags, getLateBoundNameFromType(nameType), CheckFlags.Late) + : createSymbol(SymbolFlags.Property | member.flags, literalName || member.escapedName); + if (inDestructuringPattern) { // If object literal is an assignment pattern and if the assignment pattern specifies a default value // for the property, make the property optional. @@ -14163,7 +14473,7 @@ namespace ts { checkNodeDeferred(memberDecl); } - if (!literalName && hasDynamicName(memberDecl)) { + if (!literalName && hasNonBindableDynamicName(memberDecl)) { if (isNumericName(memberDecl.name)) { hasComputedNumberProperty = true; } @@ -15578,7 +15888,7 @@ namespace ts { } // Make sure the property type is the primitive symbol type - if ((expressionType.flags & TypeFlags.ESSymbol) === 0) { + if ((expressionType.flags & TypeFlags.ESSymbolLike) === 0) { if (reportError) { error(expression, Diagnostics.A_computed_property_name_of_the_form_0_must_be_of_type_symbol, getTextOfNode(expression)); } @@ -16210,7 +16520,7 @@ namespace ts { case SyntaxKind.ComputedPropertyName: const nameType = checkComputedPropertyName(element.name); - if (isTypeAssignableToKind(nameType, TypeFlags.ESSymbol)) { + if (isTypeAssignableToKind(nameType, TypeFlags.ESSymbolLike)) { return nameType; } else { @@ -17018,7 +17328,7 @@ namespace ts { function getInferredClassType(symbol: Symbol) { const links = getSymbolLinks(symbol); if (!links.inferredClassType) { - links.inferredClassType = createAnonymousType(symbol, symbol.members || emptySymbols, emptyArray, emptyArray, /*stringIndexType*/ undefined, /*numberIndexType*/ undefined); + links.inferredClassType = createAnonymousType(symbol, getMembersOfSymbol(symbol) || emptySymbols, emptyArray, emptyArray, /*stringIndexType*/ undefined, /*numberIndexType*/ undefined); } return links.inferredClassType; } @@ -17077,7 +17387,32 @@ namespace ts { return resolveExternalModuleTypeByLiteral(node.arguments[0]); } - return getReturnTypeOfSignature(signature); + const returnType = getReturnTypeOfSignature(signature); + // Treat any call to the global 'Symbol' function that is part of a const variable or readonly property + // as a fresh unique symbol literal type. + if (returnType.flags & TypeFlags.ESSymbolLike && isSymbolOrSymbolForCall(node)) { + return getESSymbolLikeTypeForNode(walkUpParenthesizedExpressions(node.parent)); + } + return returnType; + } + + function isSymbolOrSymbolForCall(node: Node) { + if (!isCallExpression(node)) return false; + let left = node.expression; + if (isPropertyAccessExpression(left) && left.name.escapedText === "for") { + left = left.expression; + } + if (!isIdentifier(left) || left.escapedText !== "Symbol") { + return false; + } + + // make sure `Symbol` is the global symbol + const globalESSymbol = getGlobalESSymbolConstructorSymbol(/*reportErrors*/ false); + if (!globalESSymbol) { + return false; + } + + return globalESSymbol === resolveName(left, "Symbol" as __String, SymbolFlags.Value, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false); } function checkImportCallExpression(node: ImportCall): Type { @@ -17136,6 +17471,7 @@ namespace ts { if (!isRequireCall(node, /*checkArgumentIsStringLiteral*/ true)) { return false; } + // Make sure require is not a local function if (!isIdentifier(node.expression)) throw Debug.fail(); const resolvedRequire = resolveName(node.expression, node.expression.escapedText, SymbolFlags.Value, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true); @@ -17378,34 +17714,49 @@ namespace ts { : voidType; // Normal function } } + // Return a union of the return expression types. type = getUnionType(types, /*subtypeReduction*/ true); - - if (functionFlags & FunctionFlags.Generator) { // AsyncGenerator function or Generator function - type = functionFlags & FunctionFlags.Async - ? createAsyncIterableIteratorType(type) // AsyncGenerator function - : createIterableIteratorType(type); // Generator function - } } if (!contextualSignature) { reportErrorsFromWidening(func, type); } - if (isUnitType(type) && - !(contextualSignature && - isLiteralContextualType( - contextualSignature === getSignatureFromDeclaration(func) ? type : getReturnTypeOfSignature(contextualSignature)))) { - type = getWidenedLiteralType(type); + if (isUnitType(type)) { + let contextualType = !contextualSignature ? undefined : + contextualSignature === getSignatureFromDeclaration(func) ? type : + getReturnTypeOfSignature(contextualSignature); + if (contextualType) { + switch (functionFlags & FunctionFlags.AsyncGenerator) { + case FunctionFlags.AsyncGenerator: + contextualType = getIteratedTypeOfGenerator(contextualType, /*isAsyncGenerator*/ true); + break; + case FunctionFlags.Generator: + contextualType = getIteratedTypeOfGenerator(contextualType, /*isAsyncGenerator*/ false); + break; + case FunctionFlags.Async: + contextualType = getPromisedTypeOfPromise(contextualType); + break; + } + } + type = getWidenedLiteralLikeTypeForContextualType(type, contextualType); } const widenedType = getWidenedType(type); - // From within an async function you can return either a non-promise value or a promise. Any - // Promise/A+ compatible implementation will always assimilate any foreign promise, so the - // return type of the body is awaited type of the body, wrapped in a native Promise type. - return (functionFlags & FunctionFlags.AsyncGenerator) === FunctionFlags.Async - ? createPromiseReturnType(func, widenedType) // Async function - : widenedType; // Generator function, AsyncGenerator function, or normal function + switch (functionFlags & FunctionFlags.AsyncGenerator) { + case FunctionFlags.AsyncGenerator: + return createAsyncIterableIteratorType(widenedType); + case FunctionFlags.Generator: + return createIterableIteratorType(widenedType); + case FunctionFlags.Async: + // From within an async function you can return either a non-promise value or a promise. Any + // Promise/A+ compatible implementation will always assimilate any foreign promise, so the + // return type of the body is awaited type of the body, wrapped in a native Promise type. + return createPromiseType(widenedType); + default: + return widenedType; + } } function checkAndAggregateYieldOperandTypes(func: FunctionLikeDeclaration, checkMode: CheckMode): Type[] { @@ -17781,7 +18132,7 @@ namespace ts { case SyntaxKind.MinusToken: case SyntaxKind.TildeToken: checkNonNullType(operandType, node.operand); - if (maybeTypeOfKind(operandType, TypeFlags.ESSymbol)) { + if (maybeTypeOfKind(operandType, TypeFlags.ESSymbolLike)) { error(node.operand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(node.operator)); } return numberType; @@ -17894,7 +18245,7 @@ namespace 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 (!(isTypeComparableTo(leftType, stringType) || isTypeAssignableToKind(leftType, TypeFlags.NumberLike | TypeFlags.ESSymbol))) { + if (!(isTypeComparableTo(leftType, stringType) || isTypeAssignableToKind(leftType, TypeFlags.NumberLike | TypeFlags.ESSymbolLike))) { error(left, Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); } if (!isTypeAssignableToKind(rightType, TypeFlags.NonPrimitive | TypeFlags.TypeVariable)) { @@ -18288,8 +18639,8 @@ namespace ts { // Return true if there was no error, false if there was an error. function checkForDisallowedESSymbolOperand(operator: SyntaxKind): boolean { const offendingSymbolOperand = - maybeTypeOfKind(leftType, TypeFlags.ESSymbol) ? left : - maybeTypeOfKind(rightType, TypeFlags.ESSymbol) ? right : + maybeTypeOfKind(leftType, TypeFlags.ESSymbolLike) ? left : + maybeTypeOfKind(rightType, TypeFlags.ESSymbolLike) ? right : undefined; if (offendingSymbolOperand) { error(offendingSymbolOperand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(operator)); @@ -18480,23 +18831,23 @@ namespace ts { function checkDeclarationInitializer(declaration: VariableLikeDeclaration) { const type = getTypeOfExpression(declaration.initializer, /*cache*/ true); return getCombinedNodeFlags(declaration) & NodeFlags.Const || - getCombinedModifierFlags(declaration) & ModifierFlags.Readonly && !isParameterPropertyDeclaration(declaration) || + (getCombinedModifierFlags(declaration) & ModifierFlags.Readonly && !isParameterPropertyDeclaration(declaration)) || isTypeAssertion(declaration.initializer) ? type : getWidenedLiteralType(type); } - function isLiteralContextualType(contextualType: Type) { + function isLiteralLikeContextualType(contextualType: Type) { if (contextualType) { if (contextualType.flags & TypeFlags.TypeVariable) { const constraint = getBaseConstraintOfType(contextualType) || emptyObjectType; // If the type parameter is constrained to the base primitive type we're checking for, // consider this a literal context. For example, given a type parameter 'T extends string', // this causes us to infer string literal types for T. - if (constraint.flags & (TypeFlags.String | TypeFlags.Number | TypeFlags.Boolean | TypeFlags.Enum)) { + if (constraint.flags & (TypeFlags.String | TypeFlags.Number | TypeFlags.Boolean | TypeFlags.Enum | TypeFlags.ESSymbol)) { return true; } contextualType = constraint; } - return maybeTypeOfKind(contextualType, (TypeFlags.Literal | TypeFlags.Index)); + return maybeTypeOfKind(contextualType, (TypeFlags.Literal | TypeFlags.Index | TypeFlags.UniqueESSymbol)); } return false; } @@ -18506,8 +18857,8 @@ namespace ts { contextualType = getContextualType(node); } const type = checkExpression(node, checkMode); - const shouldWiden = isTypeAssertion(node) || isLiteralContextualType(contextualType); - return shouldWiden ? type : getWidenedLiteralType(type); + return isTypeAssertion(node) ? type : + getWidenedLiteralLikeTypeForContextualType(type, contextualType); } function checkPropertyAssignment(node: PropertyAssignment, checkMode?: CheckMode): Type { @@ -18562,7 +18913,7 @@ namespace ts { function getTypeOfExpression(node: Expression, cache?: boolean) { // Optimize for the common case of a call to a function with a single non-generic call // signature where we can just fetch the return type without checking the arguments. - if (node.kind === SyntaxKind.CallExpression && (node).expression.kind !== SyntaxKind.SuperKeyword && !isRequireCall(node, /*checkArgumentIsStringLiteral*/ true)) { + if (node.kind === SyntaxKind.CallExpression && (node).expression.kind !== SyntaxKind.SuperKeyword && !isRequireCall(node, /*checkArgumentIsStringLiteral*/ true) && !isSymbolOrSymbolForCall(node)) { const funcType = checkNonNullExpression((node).expression); const signature = getSingleCallSignature(funcType); if (signature && !signature.typeParameters) { @@ -19283,11 +19634,11 @@ namespace ts { if (node.name.kind === SyntaxKind.ComputedPropertyName) { checkComputedPropertyName(node.name); } - if (!hasDynamicName(node)) { + if (!hasNonBindableDynamicName(node)) { // TypeScript 1.0 spec (April 2014): 8.4.3 // Accessors for the same member name must specify the same accessibility. const otherKind = node.kind === SyntaxKind.GetAccessor ? SyntaxKind.SetAccessor : SyntaxKind.GetAccessor; - const otherAccessor = getDeclarationOfKind(node.symbol, otherKind); + const otherAccessor = getDeclarationOfKind(getSymbolOfNode(node), otherKind); if (otherAccessor) { const nodeFlags = getModifierFlags(node); const otherFlags = getModifierFlags(otherAccessor); @@ -19453,6 +19804,11 @@ namespace ts { checkTypeAssignableTo(constraintType, stringType, node.typeParameter.constraint); } + function checkTypeOperator(node: TypeOperatorNode) { + checkGrammarTypeOperatorNode(node); + checkSourceElement(node.type); + } + function isPrivateWithinAmbient(node: Node): boolean { return hasModifier(node, ModifierFlags.Private) && !!(node.flags & NodeFlags.Ambient); } @@ -20358,7 +20714,7 @@ namespace ts { checkComputedPropertyName(node.name); } - if (!hasDynamicName(node)) { + if (!hasNonBindableDynamicName(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 @@ -20969,7 +21325,7 @@ namespace ts { // initializer is consistent with type associated with the node const declarationType = convertAutoToAny(getWidenedTypeForVariableLikeDeclaration(node)); if (type !== unknownType && declarationType !== unknownType && !isTypeIdenticalTo(type, declarationType)) { - errorNextVariableDeclarationMustHaveSameType(symbol.valueDeclaration, type, node, declarationType); + errorNextVariableOrPropertyDeclarationMustHaveSameType(symbol.valueDeclaration, type, node, declarationType); } if (node.initializer) { checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, /*headMessage*/ undefined); @@ -20993,15 +21349,18 @@ namespace ts { } } - function errorNextVariableDeclarationMustHaveSameType(firstDeclaration: Declaration, firstType: Type, nextDeclaration: Declaration, nextType: Type): void { + function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstDeclaration: Declaration, firstType: Type, nextDeclaration: Declaration, nextType: Type): void { const firstSourceFile = getSourceFileOfNode(firstDeclaration); const firstSpan = getErrorSpanForNode(firstSourceFile, getNameOfDeclaration(firstDeclaration) || firstDeclaration); const firstLocation = getLineAndCharacterOfPosition(firstSourceFile, firstSpan.start); const firstLocationDescription = firstSourceFile.fileName + " " + firstLocation.line + ":" + firstLocation.character; const nextDeclarationName = getNameOfDeclaration(nextDeclaration); + const message = nextDeclaration.kind === SyntaxKind.PropertyDeclaration || nextDeclaration.kind === SyntaxKind.PropertySignature + ? Diagnostics.Subsequent_property_declarations_must_have_the_same_type_Property_0_has_type_1_at_2_but_here_has_type_3 + : Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_has_type_1_at_2_but_here_has_type_3; error( nextDeclarationName, - Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_has_type_1_at_2_but_here_has_type_3, + message, declarationNameToString(nextDeclarationName), typeToString(firstType), firstLocationDescription, @@ -21778,10 +22137,11 @@ namespace ts { // Only process instance properties with computed names here. // Static properties cannot be in conflict with indexers, // and properties with literal names were already checked. - if (!hasModifier(member, ModifierFlags.Static) && hasDynamicName(member)) { - const propType = getTypeOfSymbol(member.symbol); - checkIndexConstraintForProperty(member.symbol, propType, type, declaredStringIndexer, stringIndexType, IndexKind.String); - checkIndexConstraintForProperty(member.symbol, propType, type, declaredNumberIndexer, numberIndexType, IndexKind.Number); + if (!hasModifier(member, ModifierFlags.Static) && hasNonBindableDynamicName(member)) { + const symbol = getSymbolOfNode(member); + const propType = getTypeOfSymbol(symbol); + checkIndexConstraintForProperty(symbol, propType, type, declaredStringIndexer, stringIndexType, IndexKind.String); + checkIndexConstraintForProperty(symbol, propType, type, declaredNumberIndexer, numberIndexType, IndexKind.Number); } } } @@ -23051,8 +23411,9 @@ namespace ts { case SyntaxKind.IntersectionType: return checkUnionOrIntersectionType(node); case SyntaxKind.ParenthesizedType: - case SyntaxKind.TypeOperator: return checkSourceElement((node).type); + case SyntaxKind.TypeOperator: + return checkTypeOperator(node); case SyntaxKind.JSDocAugmentsTag: return checkJSDocAugmentsTag(node as JSDocAugmentsTag); case SyntaxKind.JSDocTypedefTag: @@ -23403,7 +23764,7 @@ namespace ts { // (type parameters of classDeclaration/classExpression and interface are in member property of the symbol. // Note: that the memberFlags come from previous iteration. if (!isStatic) { - copySymbols(getSymbolOfNode(location).members, meaning & SymbolFlags.Type); + copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & SymbolFlags.Type); } break; case SyntaxKind.FunctionExpression: @@ -24313,7 +24674,7 @@ namespace ts { else if (isTupleType(type)) { return TypeReferenceSerializationKind.ArrayLikeType; } - else if (isTypeAssignableToKind(type, TypeFlags.ESSymbol)) { + else if (isTypeAssignableToKind(type, TypeFlags.ESSymbolLike)) { return TypeReferenceSerializationKind.ESSymbolType; } else if (isFunctionType(type)) { @@ -24333,9 +24694,14 @@ namespace ts { let type = symbol && !(symbol.flags & (SymbolFlags.TypeLiteral | SymbolFlags.Signature)) ? getWidenedLiteralType(getTypeOfSymbol(symbol)) : unknownType; + if (type.flags & TypeFlags.UniqueESSymbol && + type.symbol === symbol) { + flags |= TypeFormatFlags.AllowUniqueESSymbolType; + } if (flags & TypeFormatFlags.AddUndefined) { type = getOptionalType(type); } + getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } @@ -24459,6 +24825,11 @@ namespace ts { getTypeReferenceDirectivesForEntityName, getTypeReferenceDirectivesForSymbol, isLiteralConstDeclaration, + isLateBound: (node: Declaration): node is LateBoundDeclaration => { + node = getParseTreeNode(node, isDeclaration); + const symbol = node && getSymbolOfNode(node); + return !!(symbol && getCheckFlags(symbol) & CheckFlags.Late); + }, writeLiteralConstValue, getJsxFactoryEntity: () => _jsxFactoryEntity }; @@ -25447,8 +25818,48 @@ namespace ts { } } - function checkGrammarForNonSymbolComputedProperty(node: DeclarationName, message: DiagnosticMessage) { - if (isDynamicName(node)) { + function checkGrammarTypeOperatorNode(node: TypeOperatorNode) { + if (node.operator === SyntaxKind.UniqueKeyword) { + if (node.type.kind !== SyntaxKind.SymbolKeyword) { + return grammarErrorOnNode(node.type, Diagnostics._0_expected, tokenToString(SyntaxKind.SymbolKeyword)); + } + + const parent = walkUpParenthesizedTypes(node.parent); + switch (parent.kind) { + case SyntaxKind.VariableDeclaration: + const decl = parent as VariableDeclaration; + if (decl.name.kind !== SyntaxKind.Identifier) { + return grammarErrorOnNode(node, Diagnostics.unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name); + } + if (!isVariableDeclarationInVariableStatement(decl)) { + return grammarErrorOnNode(node, Diagnostics.unique_symbol_types_are_only_allowed_on_variables_in_a_variable_statement); + } + if (!(decl.parent.flags & NodeFlags.Const)) { + return grammarErrorOnNode((parent).name, Diagnostics.A_variable_whose_type_is_a_unique_symbol_type_must_be_const); + } + break; + + case SyntaxKind.PropertyDeclaration: + if (!hasModifier(parent, ModifierFlags.Static) || + !hasModifier(parent, ModifierFlags.Readonly)) { + return grammarErrorOnNode((parent).name, Diagnostics.A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly); + } + break; + + case SyntaxKind.PropertySignature: + if (!hasModifier(parent, ModifierFlags.Readonly)) { + return grammarErrorOnNode((parent).name, Diagnostics.A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly); + } + break; + + default: + return grammarErrorOnNode(node, Diagnostics.unique_symbol_types_are_not_allowed_here); + } + } + } + + function checkGrammarForInvalidDynamicName(node: DeclarationName, message: DiagnosticMessage) { + if (isNonBindableDynamicName(node)) { return grammarErrorOnNode(node, message); } } @@ -25476,17 +25887,17 @@ namespace ts { // and accessors are not allowed in ambient contexts in general, // so this error only really matters for methods. if (node.flags & NodeFlags.Ambient) { - return checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol); + return checkGrammarForInvalidDynamicName(node.name, Diagnostics.A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } else if (!node.body) { - return checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol); + return checkGrammarForInvalidDynamicName(node.name, Diagnostics.A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } } else if (node.parent.kind === SyntaxKind.InterfaceDeclaration) { - return checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol); + return checkGrammarForInvalidDynamicName(node.name, Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } else if (node.parent.kind === SyntaxKind.TypeLiteral) { - return checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol); + return checkGrammarForInvalidDynamicName(node.name, Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } } @@ -25738,12 +26149,12 @@ namespace ts { function checkGrammarProperty(node: PropertyDeclaration) { if (isClassLike(node.parent)) { - if (checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { + if (checkGrammarForInvalidDynamicName(node.name, Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) { return true; } } else if (node.parent.kind === SyntaxKind.InterfaceDeclaration) { - if (checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { + if (checkGrammarForInvalidDynamicName(node.name, Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) { return true; } if (node.initializer) { @@ -25751,7 +26162,7 @@ namespace ts { } } else if (node.parent.kind === SyntaxKind.TypeLiteral) { - if (checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { + if (checkGrammarForInvalidDynamicName(node.name, Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) { return true; } if (node.initializer) { diff --git a/src/compiler/declarationEmitter.ts b/src/compiler/declarationEmitter.ts index 3276e68b2ac59..ebd2985dd45c2 100644 --- a/src/compiler/declarationEmitter.ts +++ b/src/compiler/declarationEmitter.ts @@ -190,6 +190,7 @@ namespace ts { const writer = createTextWriter(newLine); writer.trackSymbol = trackSymbol; writer.reportInaccessibleThisError = reportInaccessibleThisError; + writer.reportInaccessibleUniqueSymbolError = reportInaccessibleUniqueSymbolError; writer.reportPrivateInBaseOfClassExpression = reportPrivateInBaseOfClassExpression; writer.writeKeyword = writer.write; writer.writeOperator = writer.write; @@ -322,11 +323,21 @@ namespace ts { } } + function reportInaccessibleUniqueSymbolError() { + if (errorNameNode) { + reportedDeclarationError = true; + emitterDiagnostics.add(createDiagnosticForNode(errorNameNode, Diagnostics.The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary, + declarationNameToString(errorNameNode), + "unique symbol")); + } + } + function reportInaccessibleThisError() { if (errorNameNode) { reportedDeclarationError = true; - emitterDiagnostics.add(createDiagnosticForNode(errorNameNode, Diagnostics.The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary, - declarationNameToString(errorNameNode))); + emitterDiagnostics.add(createDiagnosticForNode(errorNameNode, Diagnostics.The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary, + declarationNameToString(errorNameNode), + "this")); } } @@ -1227,7 +1238,7 @@ namespace ts { } function emitPropertyDeclaration(node: Declaration) { - if (hasDynamicName(node)) { + if (hasDynamicName(node) && !resolver.isLateBound(node)) { return; } @@ -1246,10 +1257,8 @@ namespace ts { emitBindingPattern(node.name); } else { - // If this node is a computed name, it can only be a symbol, because we've already skipped - // it if it's not a well known symbol. In that case, the text of the name will be exactly - // what we want, namely the name expression enclosed in brackets. - writeTextOfNode(currentText, node.name); + writeNameOfDeclaration(node, getVariableDeclarationTypeVisibilityError); + // If optional property emit ? but in the case of parameterProperty declaration with "?" indicating optional parameter for the constructor // we don't want to emit property declaration with "?" if ((node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertySignature || @@ -1387,7 +1396,7 @@ namespace ts { } function emitAccessorDeclaration(node: AccessorDeclaration) { - if (hasDynamicName(node)) { + if (hasDynamicName(node) && !resolver.isLateBound(node)) { return; } @@ -1398,7 +1407,7 @@ namespace ts { emitJsDocComments(accessors.getAccessor); emitJsDocComments(accessors.setAccessor); emitClassMemberDeclarationFlags(getModifierFlags(node) | (accessors.setAccessor ? 0 : ModifierFlags.Readonly)); - writeTextOfNode(currentText, node.name); + writeNameOfDeclaration(node, getAccessorNameVisibilityError); if (!hasModifier(node, ModifierFlags.Private)) { accessorWithTypeAnnotation = node; let type = getTypeAnnotationFromAccessor(node); @@ -1426,6 +1435,37 @@ namespace ts { } } + function getAccessorNameVisibilityError(symbolAccessibilityResult: SymbolAccessibilityResult) { + const diagnosticMessage = getAccessorNameVisibilityDiagnosticMessage(symbolAccessibilityResult); + return diagnosticMessage !== undefined ? { + diagnosticMessage, + errorNode: node, + typeName: node.name + } : undefined; + } + + function getAccessorNameVisibilityDiagnosticMessage(symbolAccessibilityResult: SymbolAccessibilityResult) { + if (hasModifier(node, ModifierFlags.Static)) { + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ? + Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : + Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; + } + else if (node.parent.kind === SyntaxKind.ClassDeclaration) { + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ? + Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : + Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; + } + else { + return symbolAccessibilityResult.errorModuleName ? + Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : + Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; + } + } + function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult: SymbolAccessibilityResult): SymbolAccessibilityDiagnostic { let diagnosticMessage: DiagnosticMessage; if (accessorWithTypeAnnotation.kind === SyntaxKind.SetAccessor) { @@ -1467,7 +1507,7 @@ namespace ts { } function writeFunctionDeclaration(node: FunctionLikeDeclaration) { - if (hasDynamicName(node)) { + if (hasDynamicName(node) && !resolver.isLateBound(node)) { return; } @@ -1489,13 +1529,69 @@ namespace ts { write("constructor"); } else { - writeTextOfNode(currentText, node.name); + writeNameOfDeclaration(node, getMethodNameVisibilityError); if (hasQuestionToken(node)) { write("?"); } } emitSignatureDeclaration(node); } + + function getMethodNameVisibilityError(symbolAccessibilityResult: SymbolAccessibilityResult): SymbolAccessibilityDiagnostic { + const diagnosticMessage = getMethodNameVisibilityDiagnosticMessage(symbolAccessibilityResult); + return diagnosticMessage !== undefined ? { + diagnosticMessage, + errorNode: node, + typeName: node.name + } : undefined; + } + + function getMethodNameVisibilityDiagnosticMessage(symbolAccessibilityResult: SymbolAccessibilityResult) { + if (hasModifier(node, ModifierFlags.Static)) { + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ? + Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : + Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_private_name_1; + } + else if (node.parent.kind === SyntaxKind.ClassDeclaration) { + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ? + Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : + Diagnostics.Public_method_0_of_exported_class_has_or_is_using_private_name_1; + } + else { + return symbolAccessibilityResult.errorModuleName ? + Diagnostics.Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : + Diagnostics.Method_0_of_exported_interface_has_or_is_using_private_name_1; + } + } + } + + function writeNameOfDeclaration(node: NamedDeclaration, getSymbolAccessibilityDiagnostic: GetSymbolAccessibilityDiagnostic) { + if (hasDynamicName(node)) { + // If this node has a dynamic name, it can only be an identifier or property access because + // we've already skipped it otherwise. + Debug.assert(resolver.isLateBound(node)); + + writeLateBoundNameOfDeclaration(node as LateBoundDeclaration, getSymbolAccessibilityDiagnostic); + } + else { + // If this node is a computed name, it can only be a symbol, because we've already skipped + // it if it's not a well known symbol. In that case, the text of the name will be exactly + // what we want, namely the name expression enclosed in brackets. + writeTextOfNode(currentText, node.name); + } + } + + function writeLateBoundNameOfDeclaration(node: LateBoundDeclaration, getSymbolAccessibilityDiagnostic: GetSymbolAccessibilityDiagnostic) { + writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic; + const entityName = node.name.expression; + const visibilityResult = resolver.isEntityNameVisible(entityName, enclosingDeclaration); + handleSymbolAccessibilityError(visibilityResult); + recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName)); + writeTextOfNode(currentText, node.name); } function emitSignatureDeclarationWithJsDocComments(node: SignatureDeclaration) { diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index a552122609ac8..f3c6948687190 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -491,23 +491,23 @@ "category": "Error", "code": 1164 }, - "A computed property name in an ambient context must directly refer to a built-in symbol.": { + "A computed property name in an ambient context must refer to an expression whose type is a literal type or a 'unique symbol' type.": { "category": "Error", "code": 1165 }, - "A computed property name in a class property declaration must directly refer to a built-in symbol.": { + "A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type.": { "category": "Error", "code": 1166 }, - "A computed property name in a method overload must directly refer to a built-in symbol.": { + "A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type.": { "category": "Error", "code": 1168 }, - "A computed property name in an interface must directly refer to a built-in symbol.": { + "A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type.": { "category": "Error", "code": 1169 }, - "A computed property name in a type literal must directly refer to a built-in symbol.": { + "A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type.": { "category": "Error", "code": 1170 }, @@ -911,6 +911,30 @@ "category": "Error", "code": 1329 }, + "A property of an interface or type literal whose type is a 'unique symbol' type must be 'readonly'.": { + "category": "Error", + "code": 1330 + }, + "A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'.": { + "category": "Error", + "code": 1331 + }, + "A variable whose type is a 'unique symbol' type must be 'const'.": { + "category": "Error", + "code": 1332 + }, + "'unique symbol' types may not be used on a variable declaration with a binding name.": { + "category": "Error", + "code": 1333 + }, + "'unique symbol' types are only allowed on variables in a variable statement.": { + "category": "Error", + "code": 1334 + }, + "'unique symbol' types are not allowed here.": { + "category": "Error", + "code": 1335 + }, "Duplicate identifier '{0}'.": { "category": "Error", @@ -1780,7 +1804,7 @@ "category": "Error", "code": 2526 }, - "The inferred type of '{0}' references an inaccessible 'this' type. A type annotation is necessary.": { + "The inferred type of '{0}' references an inaccessible '{1}' type. A type annotation is necessary.": { "category": "Error", "code": 2527 }, @@ -2228,6 +2252,14 @@ "category": "Error", "code": 2716 }, + "Subsequent property declarations must have the same type. Property '{0}' has type '{1}' at {2}, but here has type '{3}'.": { + "category": "Error", + "code": 2717 + }, + "Duplicate declaration '{0}'.": { + "category": "Error", + "code": 2718 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", @@ -2530,6 +2562,39 @@ "code": 4094 }, + "Public static method '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named.": { + "category": "Error", + "code": 4095 + }, + "Public static method '{0}' of exported class has or is using name '{1}' from private module '{2}'.": { + "category": "Error", + "code": 4096 + }, + "Public static method '{0}' of exported class has or is using private name '{1}'.": { + "category": "Error", + "code": 4097 + }, + "Public method '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named.": { + "category": "Error", + "code": 4098 + }, + "Public method '{0}' of exported class has or is using name '{1}' from private module '{2}'.": { + "category": "Error", + "code": 4099 + }, + "Public method '{0}' of exported class has or is using private name '{1}'.": { + "category": "Error", + "code": 4100 + }, + "Method '{0}' of exported interface has or is using name '{1}' from private module '{2}'.": { + "category": "Error", + "code": 4101 + }, + "Method '{0}' of exported interface has or is using private name '{1}'.": { + "category": "Error", + "code": 4102 + }, + "The current host does not support the '{0}' option.": { "category": "Error", "code": 5001 diff --git a/src/compiler/factory.ts b/src/compiler/factory.ts index 35d35b4082608..dfc22e3183374 100644 --- a/src/compiler/factory.ts +++ b/src/compiler/factory.ts @@ -736,15 +736,17 @@ namespace ts { return createSynthesizedNode(SyntaxKind.ThisType); } - export function createTypeOperatorNode(type: TypeNode) { + export function createTypeOperatorNode(type: TypeNode): TypeOperatorNode; + export function createTypeOperatorNode(operator: SyntaxKind.KeyOfKeyword | SyntaxKind.UniqueKeyword, type: TypeNode): TypeOperatorNode; + export function createTypeOperatorNode(operatorOrType: SyntaxKind.KeyOfKeyword | SyntaxKind.UniqueKeyword | TypeNode, type?: TypeNode) { const node = createSynthesizedNode(SyntaxKind.TypeOperator) as TypeOperatorNode; - node.operator = SyntaxKind.KeyOfKeyword; - node.type = parenthesizeElementTypeMember(type); + node.operator = typeof operatorOrType === "number" ? operatorOrType : SyntaxKind.KeyOfKeyword; + node.type = parenthesizeElementTypeMember(typeof operatorOrType === "number" ? type : operatorOrType); return node; } export function updateTypeOperatorNode(node: TypeOperatorNode, type: TypeNode) { - return node.type !== type ? updateNode(createTypeOperatorNode(type), node) : node; + return node.type !== type ? updateNode(createTypeOperatorNode(node.operator, type), node) : node; } export function createIndexedAccessTypeNode(objectType: TypeNode, indexType: TypeNode) { diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 6f1a9e1a561c0..3c586392e6350 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -2665,8 +2665,8 @@ namespace ts { case SyntaxKind.AnyKeyword: case SyntaxKind.StringKeyword: case SyntaxKind.NumberKeyword: - case SyntaxKind.BooleanKeyword: case SyntaxKind.SymbolKeyword: + case SyntaxKind.BooleanKeyword: case SyntaxKind.UndefinedKeyword: case SyntaxKind.NeverKeyword: case SyntaxKind.ObjectKeyword: @@ -2720,6 +2720,7 @@ namespace ts { case SyntaxKind.NumberKeyword: case SyntaxKind.BooleanKeyword: case SyntaxKind.SymbolKeyword: + case SyntaxKind.UniqueKeyword: case SyntaxKind.VoidKeyword: case SyntaxKind.UndefinedKeyword: case SyntaxKind.NullKeyword: @@ -2805,7 +2806,7 @@ namespace ts { return finishNode(postfix); } - function parseTypeOperator(operator: SyntaxKind.KeyOfKeyword) { + function parseTypeOperator(operator: SyntaxKind.KeyOfKeyword | SyntaxKind.UniqueKeyword) { const node = createNode(SyntaxKind.TypeOperator); parseExpected(operator); node.operator = operator; @@ -2814,9 +2815,11 @@ namespace ts { } function parseTypeOperatorOrHigher(): TypeNode { - switch (token()) { + const operator = token(); + switch (operator) { case SyntaxKind.KeyOfKeyword: - return parseTypeOperator(SyntaxKind.KeyOfKeyword); + case SyntaxKind.UniqueKeyword: + return parseTypeOperator(operator); case SyntaxKind.DotDotDotToken: { const result = createNode(SyntaxKind.JSDocVariadicType) as JSDocVariadicType; nextToken(); diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 9fddece11d01a..153b3693b46a8 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -125,6 +125,7 @@ namespace ts { "type": SyntaxKind.TypeKeyword, "typeof": SyntaxKind.TypeOfKeyword, "undefined": SyntaxKind.UndefinedKeyword, + "unique": SyntaxKind.UniqueKeyword, "var": SyntaxKind.VarKeyword, "void": SyntaxKind.VoidKeyword, "while": SyntaxKind.WhileKeyword, diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 3141e3f22d924..df06606e3162c 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -212,6 +212,7 @@ namespace ts { SymbolKeyword, TypeKeyword, UndefinedKeyword, + UniqueKeyword, FromKeyword, GlobalKeyword, OfKeyword, // LastKeyword and LastToken and LastContextualKeyword @@ -681,6 +682,17 @@ namespace ts { name?: DeclarationName; } + /* @internal */ + export interface DynamicNamedDeclaration extends NamedDeclaration { + name: ComputedPropertyName; + } + + /* @internal */ + // A declaration that supports late-binding (used in checker) + export interface LateBoundDeclaration extends DynamicNamedDeclaration { + name: LateBoundName; + } + export interface DeclarationStatement extends NamedDeclaration, Statement { name?: Identifier | StringLiteral | NumericLiteral; } @@ -690,6 +702,12 @@ namespace ts { expression: Expression; } + /* @internal */ + // A name that supports late-binding (used in checker) + export interface LateBoundName extends ComputedPropertyName { + expression: EntityNameExpression; + } + export interface Decorator extends Node { kind: SyntaxKind.Decorator; parent?: NamedDeclaration; @@ -1049,10 +1067,15 @@ namespace ts { export interface TypeOperatorNode extends TypeNode { kind: SyntaxKind.TypeOperator; - operator: SyntaxKind.KeyOfKeyword; + operator: SyntaxKind.KeyOfKeyword | SyntaxKind.UniqueKeyword; type: TypeNode; } + /* @internal */ + export interface UniqueTypeOperatorNode extends TypeOperatorNode { + operator: SyntaxKind.UniqueKeyword; + } + export interface IndexedAccessTypeNode extends TypeNode { kind: SyntaxKind.IndexedAccessType; objectType: TypeNode; @@ -2849,6 +2872,7 @@ namespace ts { trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void; reportInaccessibleThisError(): void; reportPrivateInBaseOfClassExpression(propertyName: string): void; + reportInaccessibleUniqueSymbolError(): void; } export const enum TypeFormatFlags { @@ -2869,6 +2893,7 @@ namespace ts { InArrayType = 1 << 15, // Writing an array element type UseAliasDefinedOutsideCurrentScope = 1 << 16, // For a `type T = ... ` defined in a different file, write `T` instead of its value, // even though `T` can't be accessed in the current scope. + AllowUniqueESSymbolType = 1 << 17, } export const enum SymbolFormatFlags { @@ -2970,6 +2995,7 @@ namespace ts { isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean; getNodeCheckFlags(node: Node): NodeCheckFlags; isDeclarationVisible(node: Declaration): boolean; + isLateBound(node: Declaration): node is LateBoundDeclaration; collectLinkedAliases(node: Identifier): Node[]; isImplementationOfOverload(node: FunctionLikeDeclaration): boolean | undefined; isRequiredInitializedParameter(node: ParameterDeclaration): boolean; @@ -3077,6 +3103,9 @@ namespace ts { // The set of things we consider semantically classifiable. Used to speed up the LS during // classification. Classifiable = Class | Enum | TypeAlias | Interface | TypeParameter | Module, + + /* @internal */ + LateBindingContainer = Class | Interface | TypeLiteral | ObjectLiteral, } export interface Symbol { @@ -3108,19 +3137,21 @@ namespace ts { instantiations?: Map; // Instantiations of generic type alias (undefined if non-generic) mapper?: TypeMapper; // Type mapper for instantiation alias referenced?: boolean; // True if alias symbol has been referenced as a value - containingType?: UnionOrIntersectionType; // Containing union or intersection type for synthetic property + containingType?: UnionOrIntersectionType; // Containing union or intersection type for synthetic property leftSpread?: Symbol; // Left source for synthetic spread property rightSpread?: Symbol; // Right source for synthetic spread property syntheticOrigin?: Symbol; // For a property on a mapped or spread type, points back to the original property syntheticLiteralTypeOrigin?: StringLiteralType; // For a property on a mapped type, indicates the type whose text to use as the declaration name, instead of the symbol name isDiscriminantProperty?: boolean; // True if discriminant synthetic property - resolvedExports?: SymbolTable; // Resolved exports of module + resolvedExports?: SymbolTable; // Resolved exports of module or combined early- and late-bound static members of a class. + resolvedMembers?: SymbolTable; // Combined early- and late-bound members of a symbol exportsChecked?: boolean; // True if exports of external module have been checked typeParametersChecked?: boolean; // True if type parameters of merged class and interface declarations have been checked. - isDeclarationWithCollidingName?: boolean; // True if symbol is block scoped redeclaration + isDeclarationWithCollidingName?: boolean; // True if symbol is block scoped redeclaration bindingElement?: BindingElement; // Binding element associated with property symbol exportsSomeValue?: boolean; // True if module exports some value (not just types) enumKind?: EnumKind; // Enum declaration classification + lateSymbol?: Symbol; // Late-bound symbol for a computed property } /* @internal */ @@ -3141,6 +3172,7 @@ namespace ts { ContainsProtected = 1 << 7, // Synthetic property with protected constituent(s) ContainsPrivate = 1 << 8, // Synthetic property with private constituent(s) ContainsStatic = 1 << 9, // Synthetic property with static constituent(s) + Late = 1 << 10, // Late-bound symbol for a computed property with a dynamic name Synthetic = SyntheticProperty | SyntheticMethod } @@ -3270,45 +3302,49 @@ namespace ts { BooleanLiteral = 1 << 7, EnumLiteral = 1 << 8, // Always combined with StringLiteral, NumberLiteral, or Union ESSymbol = 1 << 9, // Type of symbol primitive introduced in ES6 - Void = 1 << 10, - Undefined = 1 << 11, - Null = 1 << 12, - Never = 1 << 13, // Never type - TypeParameter = 1 << 14, // Type parameter - Object = 1 << 15, // Object type - Union = 1 << 16, // Union (T | U) - Intersection = 1 << 17, // Intersection (T & U) - Index = 1 << 18, // keyof T - IndexedAccess = 1 << 19, // T[K] + UniqueESSymbol = 1 << 10, // unique symbol + Void = 1 << 11, + Undefined = 1 << 12, + Null = 1 << 13, + Never = 1 << 14, // Never type + TypeParameter = 1 << 15, // Type parameter + Object = 1 << 16, // Object type + Union = 1 << 17, // Union (T | U) + Intersection = 1 << 18, // Intersection (T & U) + Index = 1 << 19, // keyof T + IndexedAccess = 1 << 20, // T[K] /* @internal */ - FreshLiteral = 1 << 20, // Fresh literal type + FreshLiteral = 1 << 21, // Fresh literal or unique type /* @internal */ - ContainsWideningType = 1 << 21, // Type is or contains undefined or null widening type + ContainsWideningType = 1 << 22, // Type is or contains undefined or null widening type /* @internal */ - ContainsObjectLiteral = 1 << 22, // Type is or contains object literal type + ContainsObjectLiteral = 1 << 23, // Type is or contains object literal type /* @internal */ - ContainsAnyFunctionType = 1 << 23, // Type is or contains the anyFunctionType - NonPrimitive = 1 << 24, // intrinsic object type + ContainsAnyFunctionType = 1 << 24, // Type is or contains the anyFunctionType + NonPrimitive = 1 << 25, // intrinsic object type /* @internal */ - JsxAttributes = 1 << 25, // Jsx attributes type - MarkerType = 1 << 26, // Marker type used for variance probing + JsxAttributes = 1 << 26, // Jsx attributes type + MarkerType = 1 << 27, // Marker type used for variance probing /* @internal */ Nullable = Undefined | Null, Literal = StringLiteral | NumberLiteral | BooleanLiteral, - Unit = Literal | Nullable, + Unit = Literal | UniqueESSymbol | Nullable, StringOrNumberLiteral = StringLiteral | NumberLiteral, /* @internal */ + StringOrNumberLiteralOrUnique = StringOrNumberLiteral | UniqueESSymbol, + /* @internal */ DefinitelyFalsy = StringLiteral | NumberLiteral | BooleanLiteral | Void | Undefined | Null, PossiblyFalsy = DefinitelyFalsy | String | Number | Boolean, /* @internal */ Intrinsic = Any | String | Number | Boolean | BooleanLiteral | ESSymbol | Void | Undefined | Null | Never | NonPrimitive, /* @internal */ - Primitive = String | Number | Boolean | Enum | EnumLiteral | ESSymbol | Void | Undefined | Null | Literal, + Primitive = String | Number | Boolean | Enum | EnumLiteral | ESSymbol | Void | Undefined | Null | Literal | UniqueESSymbol, StringLike = String | StringLiteral | Index, NumberLike = Number | NumberLiteral | Enum, BooleanLike = Boolean | BooleanLiteral, EnumLike = Enum | EnumLiteral, + ESSymbolLike = ESSymbol | UniqueESSymbol, UnionOrIntersection = Union | Intersection, StructuredType = Object | Union | Intersection, StructuredOrTypeVariable = StructuredType | TypeParameter | Index | IndexedAccess, @@ -3316,12 +3352,12 @@ namespace ts { // 'Narrowable' types are types where narrowing actually narrows. // This *should* be every type other than null, undefined, void, and never - Narrowable = Any | StructuredType | TypeParameter | Index | IndexedAccess | StringLike | NumberLike | BooleanLike | ESSymbol | NonPrimitive, + Narrowable = Any | StructuredType | TypeParameter | Index | IndexedAccess | StringLike | NumberLike | BooleanLike | ESSymbol | UniqueESSymbol | NonPrimitive, NotUnionOrUnit = Any | ESSymbol | Object | NonPrimitive, /* @internal */ RequiresWidening = ContainsWideningType | ContainsObjectLiteral, /* @internal */ - PropagatingFlags = ContainsWideningType | ContainsObjectLiteral | ContainsAnyFunctionType + PropagatingFlags = ContainsWideningType | ContainsObjectLiteral | ContainsAnyFunctionType, } export type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression; @@ -3351,6 +3387,11 @@ namespace ts { regularType?: LiteralType; // Regular version of type } + // Unique symbol types (TypeFlags.UniqueESSymbol) + export interface UniqueESSymbolType extends Type { + symbol: Symbol; + } + export interface StringLiteralType extends LiteralType { value: string; } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 1857ca10bd296..48bb0a6dc11e5 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -56,6 +56,7 @@ namespace ts { clear: () => str = "", trackSymbol: noop, reportInaccessibleThisError: noop, + reportInaccessibleUniqueSymbolError: noop, reportPrivateInBaseOfClassExpression: noop, }; } @@ -913,6 +914,18 @@ namespace ts { } } + export function getMembersOfDeclaration(node: Declaration): NodeArray | undefined { + switch (node.kind) { + case SyntaxKind.InterfaceDeclaration: + case SyntaxKind.ClassDeclaration: + case SyntaxKind.ClassExpression: + case SyntaxKind.TypeLiteral: + return (node).members; + case SyntaxKind.ObjectLiteralExpression: + return (node).properties; + } + } + export function isVariableLike(node: Node): node is VariableLikeDeclaration { if (node) { switch (node.kind) { @@ -930,6 +943,17 @@ namespace ts { return false; } + export function isVariableDeclarationInVariableStatement(node: VariableDeclaration) { + return node.parent.kind === SyntaxKind.VariableDeclarationList + && node.parent.parent.kind === SyntaxKind.VariableStatement; + } + + export function isValidESSymbolDeclaration(node: Node) { + return isVariableDeclaration(node) ? isConst(node) && isIdentifier(node.name) && isVariableDeclarationInVariableStatement(node) : + isPropertyDeclaration(node) ? hasReadonlyModifier(node) && hasStaticModifier(node) : + isPropertySignature(node) && hasReadonlyModifier(node); + } + export function introducesArgumentsExoticObject(node: Node) { switch (node.kind) { case SyntaxKind.MethodDeclaration: @@ -1716,15 +1740,27 @@ namespace ts { return getAssignmentTargetKind(node) !== AssignmentKind.None; } + function walkUp(node: Node, kind: SyntaxKind) { + while (node && node.kind === kind) { + node = node.parent; + } + return node; + } + + export function walkUpParenthesizedTypes(node: Node) { + return walkUp(node, SyntaxKind.ParenthesizedType); + } + + export function walkUpParenthesizedExpressions(node: Node) { + return walkUp(node, SyntaxKind.ParenthesizedExpression); + } + // a node is delete target iff. it is PropertyAccessExpression/ElementAccessExpression with parentheses skipped export function isDeleteTarget(node: Node): boolean { if (node.kind !== SyntaxKind.PropertyAccessExpression && node.kind !== SyntaxKind.ElementAccessExpression) { return false; } - node = node.parent; - while (node && node.kind === SyntaxKind.ParenthesizedExpression) { - node = node.parent; - } + node = walkUpParenthesizedExpressions(node.parent); return node && node.kind === SyntaxKind.DeleteExpression; } @@ -1985,7 +2021,7 @@ namespace ts { * is a property of the Symbol constructor that denotes a built in * Symbol. */ - export function hasDynamicName(declaration: Declaration): boolean { + export function hasDynamicName(declaration: Declaration): declaration is DynamicNamedDeclaration { const name = getNameOfDeclaration(declaration); return name && isDynamicName(name); } @@ -3031,6 +3067,14 @@ namespace ts { return !!getSelectedModifierFlags(node, flags); } + export function hasStaticModifier(node: Node): boolean { + return hasModifier(node, ModifierFlags.Static); + } + + export function hasReadonlyModifier(node: Node): boolean { + return hasModifier(node, ModifierFlags.Readonly); + } + export function getSelectedModifierFlags(node: Node, flags: ModifierFlags): ModifierFlags { return getModifierFlags(node) & flags; } diff --git a/src/services/codefixes/inferFromUsage.ts b/src/services/codefixes/inferFromUsage.ts index 378c73f2f756e..3f03180360d2e 100644 --- a/src/services/codefixes/inferFromUsage.ts +++ b/src/services/codefixes/inferFromUsage.ts @@ -246,6 +246,7 @@ namespace ts.codefix { }, reportInaccessibleThisError: () => { typeIsAccessible = false; }, reportPrivateInBaseOfClassExpression: () => { typeIsAccessible = false; }, + reportInaccessibleUniqueSymbolError: () => { typeIsAccessible = false; } }; } writer.clear(); diff --git a/src/services/utilities.ts b/src/services/utilities.ts index be925e5c170e2..99c9276ad5ba9 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1131,6 +1131,7 @@ namespace ts { clear: resetWriter, trackSymbol: noop, reportInaccessibleThisError: noop, + reportInaccessibleUniqueSymbolError: noop, reportPrivateInBaseOfClassExpression: noop, }; diff --git a/tests/baselines/reference/YieldStarExpression4_es6.types b/tests/baselines/reference/YieldStarExpression4_es6.types index 1d72e6dc50651..86b727306d473 100644 --- a/tests/baselines/reference/YieldStarExpression4_es6.types +++ b/tests/baselines/reference/YieldStarExpression4_es6.types @@ -1,6 +1,6 @@ === tests/cases/conformance/es6/yieldExpressions/YieldStarExpression4_es6.ts === function *g() { ->g : () => IterableIterator +>g : () => IterableIterator yield * []; >yield * [] : any diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 096ad71c89424..23520f42952cf 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -200,162 +200,163 @@ declare namespace ts { SymbolKeyword = 137, TypeKeyword = 138, UndefinedKeyword = 139, - FromKeyword = 140, - GlobalKeyword = 141, - OfKeyword = 142, - QualifiedName = 143, - ComputedPropertyName = 144, - TypeParameter = 145, - Parameter = 146, - Decorator = 147, - PropertySignature = 148, - PropertyDeclaration = 149, - MethodSignature = 150, - MethodDeclaration = 151, - Constructor = 152, - GetAccessor = 153, - SetAccessor = 154, - CallSignature = 155, - ConstructSignature = 156, - IndexSignature = 157, - TypePredicate = 158, - TypeReference = 159, - FunctionType = 160, - ConstructorType = 161, - TypeQuery = 162, - TypeLiteral = 163, - ArrayType = 164, - TupleType = 165, - UnionType = 166, - IntersectionType = 167, - ParenthesizedType = 168, - ThisType = 169, - TypeOperator = 170, - IndexedAccessType = 171, - MappedType = 172, - LiteralType = 173, - ObjectBindingPattern = 174, - ArrayBindingPattern = 175, - BindingElement = 176, - ArrayLiteralExpression = 177, - ObjectLiteralExpression = 178, - PropertyAccessExpression = 179, - ElementAccessExpression = 180, - CallExpression = 181, - NewExpression = 182, - TaggedTemplateExpression = 183, - TypeAssertionExpression = 184, - ParenthesizedExpression = 185, - FunctionExpression = 186, - ArrowFunction = 187, - DeleteExpression = 188, - TypeOfExpression = 189, - VoidExpression = 190, - AwaitExpression = 191, - PrefixUnaryExpression = 192, - PostfixUnaryExpression = 193, - BinaryExpression = 194, - ConditionalExpression = 195, - TemplateExpression = 196, - YieldExpression = 197, - SpreadElement = 198, - ClassExpression = 199, - OmittedExpression = 200, - ExpressionWithTypeArguments = 201, - AsExpression = 202, - NonNullExpression = 203, - MetaProperty = 204, - TemplateSpan = 205, - SemicolonClassElement = 206, - Block = 207, - VariableStatement = 208, - EmptyStatement = 209, - ExpressionStatement = 210, - IfStatement = 211, - DoStatement = 212, - WhileStatement = 213, - ForStatement = 214, - ForInStatement = 215, - ForOfStatement = 216, - ContinueStatement = 217, - BreakStatement = 218, - ReturnStatement = 219, - WithStatement = 220, - SwitchStatement = 221, - LabeledStatement = 222, - ThrowStatement = 223, - TryStatement = 224, - DebuggerStatement = 225, - VariableDeclaration = 226, - VariableDeclarationList = 227, - FunctionDeclaration = 228, - ClassDeclaration = 229, - InterfaceDeclaration = 230, - TypeAliasDeclaration = 231, - EnumDeclaration = 232, - ModuleDeclaration = 233, - ModuleBlock = 234, - CaseBlock = 235, - NamespaceExportDeclaration = 236, - ImportEqualsDeclaration = 237, - ImportDeclaration = 238, - ImportClause = 239, - NamespaceImport = 240, - NamedImports = 241, - ImportSpecifier = 242, - ExportAssignment = 243, - ExportDeclaration = 244, - NamedExports = 245, - ExportSpecifier = 246, - MissingDeclaration = 247, - ExternalModuleReference = 248, - JsxElement = 249, - JsxSelfClosingElement = 250, - JsxOpeningElement = 251, - JsxClosingElement = 252, - JsxFragment = 253, - JsxOpeningFragment = 254, - JsxClosingFragment = 255, - JsxAttribute = 256, - JsxAttributes = 257, - JsxSpreadAttribute = 258, - JsxExpression = 259, - CaseClause = 260, - DefaultClause = 261, - HeritageClause = 262, - CatchClause = 263, - PropertyAssignment = 264, - ShorthandPropertyAssignment = 265, - SpreadAssignment = 266, - EnumMember = 267, - SourceFile = 268, - Bundle = 269, - JSDocTypeExpression = 270, - JSDocAllType = 271, - JSDocUnknownType = 272, - JSDocNullableType = 273, - JSDocNonNullableType = 274, - JSDocOptionalType = 275, - JSDocFunctionType = 276, - JSDocVariadicType = 277, - JSDocComment = 278, - JSDocTypeLiteral = 279, - JSDocTag = 280, - JSDocAugmentsTag = 281, - JSDocClassTag = 282, - JSDocParameterTag = 283, - JSDocReturnTag = 284, - JSDocTypeTag = 285, - JSDocTemplateTag = 286, - JSDocTypedefTag = 287, - JSDocPropertyTag = 288, - SyntaxList = 289, - NotEmittedStatement = 290, - PartiallyEmittedExpression = 291, - CommaListExpression = 292, - MergeDeclarationMarker = 293, - EndOfDeclarationMarker = 294, - Count = 295, + UniqueKeyword = 140, + FromKeyword = 141, + GlobalKeyword = 142, + OfKeyword = 143, + QualifiedName = 144, + ComputedPropertyName = 145, + TypeParameter = 146, + Parameter = 147, + Decorator = 148, + PropertySignature = 149, + PropertyDeclaration = 150, + MethodSignature = 151, + MethodDeclaration = 152, + Constructor = 153, + GetAccessor = 154, + SetAccessor = 155, + CallSignature = 156, + ConstructSignature = 157, + IndexSignature = 158, + TypePredicate = 159, + TypeReference = 160, + FunctionType = 161, + ConstructorType = 162, + TypeQuery = 163, + TypeLiteral = 164, + ArrayType = 165, + TupleType = 166, + UnionType = 167, + IntersectionType = 168, + ParenthesizedType = 169, + ThisType = 170, + TypeOperator = 171, + IndexedAccessType = 172, + MappedType = 173, + LiteralType = 174, + ObjectBindingPattern = 175, + ArrayBindingPattern = 176, + BindingElement = 177, + ArrayLiteralExpression = 178, + ObjectLiteralExpression = 179, + PropertyAccessExpression = 180, + ElementAccessExpression = 181, + CallExpression = 182, + NewExpression = 183, + TaggedTemplateExpression = 184, + TypeAssertionExpression = 185, + ParenthesizedExpression = 186, + FunctionExpression = 187, + ArrowFunction = 188, + DeleteExpression = 189, + TypeOfExpression = 190, + VoidExpression = 191, + AwaitExpression = 192, + PrefixUnaryExpression = 193, + PostfixUnaryExpression = 194, + BinaryExpression = 195, + ConditionalExpression = 196, + TemplateExpression = 197, + YieldExpression = 198, + SpreadElement = 199, + ClassExpression = 200, + OmittedExpression = 201, + ExpressionWithTypeArguments = 202, + AsExpression = 203, + NonNullExpression = 204, + MetaProperty = 205, + TemplateSpan = 206, + SemicolonClassElement = 207, + Block = 208, + VariableStatement = 209, + EmptyStatement = 210, + ExpressionStatement = 211, + IfStatement = 212, + DoStatement = 213, + WhileStatement = 214, + ForStatement = 215, + ForInStatement = 216, + ForOfStatement = 217, + ContinueStatement = 218, + BreakStatement = 219, + ReturnStatement = 220, + WithStatement = 221, + SwitchStatement = 222, + LabeledStatement = 223, + ThrowStatement = 224, + TryStatement = 225, + DebuggerStatement = 226, + VariableDeclaration = 227, + VariableDeclarationList = 228, + FunctionDeclaration = 229, + ClassDeclaration = 230, + InterfaceDeclaration = 231, + TypeAliasDeclaration = 232, + EnumDeclaration = 233, + ModuleDeclaration = 234, + ModuleBlock = 235, + CaseBlock = 236, + NamespaceExportDeclaration = 237, + ImportEqualsDeclaration = 238, + ImportDeclaration = 239, + ImportClause = 240, + NamespaceImport = 241, + NamedImports = 242, + ImportSpecifier = 243, + ExportAssignment = 244, + ExportDeclaration = 245, + NamedExports = 246, + ExportSpecifier = 247, + MissingDeclaration = 248, + ExternalModuleReference = 249, + JsxElement = 250, + JsxSelfClosingElement = 251, + JsxOpeningElement = 252, + JsxClosingElement = 253, + JsxFragment = 254, + JsxOpeningFragment = 255, + JsxClosingFragment = 256, + JsxAttribute = 257, + JsxAttributes = 258, + JsxSpreadAttribute = 259, + JsxExpression = 260, + CaseClause = 261, + DefaultClause = 262, + HeritageClause = 263, + CatchClause = 264, + PropertyAssignment = 265, + ShorthandPropertyAssignment = 266, + SpreadAssignment = 267, + EnumMember = 268, + SourceFile = 269, + Bundle = 270, + JSDocTypeExpression = 271, + JSDocAllType = 272, + JSDocUnknownType = 273, + JSDocNullableType = 274, + JSDocNonNullableType = 275, + JSDocOptionalType = 276, + JSDocFunctionType = 277, + JSDocVariadicType = 278, + JSDocComment = 279, + JSDocTypeLiteral = 280, + JSDocTag = 281, + JSDocAugmentsTag = 282, + JSDocClassTag = 283, + JSDocParameterTag = 284, + JSDocReturnTag = 285, + JSDocTypeTag = 286, + JSDocTemplateTag = 287, + JSDocTypedefTag = 288, + JSDocPropertyTag = 289, + SyntaxList = 290, + NotEmittedStatement = 291, + PartiallyEmittedExpression = 292, + CommaListExpression = 293, + MergeDeclarationMarker = 294, + EndOfDeclarationMarker = 295, + Count = 296, FirstAssignment = 58, LastAssignment = 70, FirstCompoundAssignment = 59, @@ -363,15 +364,15 @@ declare namespace ts { FirstReservedWord = 72, LastReservedWord = 107, FirstKeyword = 72, - LastKeyword = 142, + LastKeyword = 143, FirstFutureReservedWord = 108, LastFutureReservedWord = 116, - FirstTypeNode = 158, - LastTypeNode = 173, + FirstTypeNode = 159, + LastTypeNode = 174, FirstPunctuation = 17, LastPunctuation = 70, FirstToken = 0, - LastToken = 142, + LastToken = 143, FirstTriviaToken = 2, LastTriviaToken = 7, FirstLiteralToken = 8, @@ -380,11 +381,11 @@ declare namespace ts { LastTemplateToken = 16, FirstBinaryOperator = 27, LastBinaryOperator = 70, - FirstNode = 143, - FirstJSDocNode = 270, - LastJSDocNode = 288, - FirstJSDocTagNode = 280, - LastJSDocTagNode = 288, + FirstNode = 144, + FirstJSDocNode = 271, + LastJSDocNode = 289, + FirstJSDocTagNode = 281, + LastJSDocTagNode = 289, } enum NodeFlags { None = 0, @@ -739,7 +740,7 @@ declare namespace ts { } interface TypeOperatorNode extends TypeNode { kind: SyntaxKind.TypeOperator; - operator: SyntaxKind.KeyOfKeyword; + operator: SyntaxKind.KeyOfKeyword | SyntaxKind.UniqueKeyword; type: TypeNode; } interface IndexedAccessTypeNode extends TypeNode { @@ -1825,6 +1826,7 @@ declare namespace ts { trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void; reportInaccessibleThisError(): void; reportPrivateInBaseOfClassExpression(propertyName: string): void; + reportInaccessibleUniqueSymbolError(): void; } enum TypeFormatFlags { None = 0, @@ -1843,6 +1845,7 @@ declare namespace ts { WriteClassExpressionAsTypeLiteral = 16384, InArrayType = 32768, UseAliasDefinedOutsideCurrentScope = 65536, + AllowUniqueESSymbolType = 131072, } enum SymbolFormatFlags { None = 0, @@ -1996,32 +1999,34 @@ declare namespace ts { BooleanLiteral = 128, EnumLiteral = 256, ESSymbol = 512, - Void = 1024, - Undefined = 2048, - Null = 4096, - Never = 8192, - TypeParameter = 16384, - Object = 32768, - Union = 65536, - Intersection = 131072, - Index = 262144, - IndexedAccess = 524288, - NonPrimitive = 16777216, - MarkerType = 67108864, + UniqueESSymbol = 1024, + Void = 2048, + Undefined = 4096, + Null = 8192, + Never = 16384, + TypeParameter = 32768, + Object = 65536, + Union = 131072, + Intersection = 262144, + Index = 524288, + IndexedAccess = 1048576, + NonPrimitive = 33554432, + MarkerType = 134217728, Literal = 224, - Unit = 6368, + Unit = 13536, StringOrNumberLiteral = 96, - PossiblyFalsy = 7406, - StringLike = 262178, + PossiblyFalsy = 14574, + StringLike = 524322, NumberLike = 84, BooleanLike = 136, EnumLike = 272, - UnionOrIntersection = 196608, - StructuredType = 229376, - StructuredOrTypeVariable = 1032192, - TypeVariable = 540672, - Narrowable = 17810175, - NotUnionOrUnit = 16810497, + ESSymbolLike = 1536, + UnionOrIntersection = 393216, + StructuredType = 458752, + StructuredOrTypeVariable = 2064384, + TypeVariable = 1081344, + Narrowable = 35620607, + NotUnionOrUnit = 33620481, } type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression; interface Type { @@ -2036,6 +2041,9 @@ declare namespace ts { freshType?: LiteralType; regularType?: LiteralType; } + interface UniqueESSymbolType extends Type { + symbol: Symbol; + } interface StringLiteralType extends LiteralType { value: string; } @@ -3350,6 +3358,7 @@ declare namespace ts { function updateParenthesizedType(node: ParenthesizedTypeNode, type: TypeNode): ParenthesizedTypeNode; function createThisTypeNode(): ThisTypeNode; function createTypeOperatorNode(type: TypeNode): TypeOperatorNode; + function createTypeOperatorNode(operator: SyntaxKind.KeyOfKeyword | SyntaxKind.UniqueKeyword, type: TypeNode): TypeOperatorNode; function updateTypeOperatorNode(node: TypeOperatorNode, type: TypeNode): TypeOperatorNode; function createIndexedAccessTypeNode(objectType: TypeNode, indexType: TypeNode): IndexedAccessTypeNode; function updateIndexedAccessTypeNode(node: IndexedAccessTypeNode, objectType: TypeNode, indexType: TypeNode): IndexedAccessTypeNode; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index dcc077d2cd700..68c2ed14f2b39 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -200,162 +200,163 @@ declare namespace ts { SymbolKeyword = 137, TypeKeyword = 138, UndefinedKeyword = 139, - FromKeyword = 140, - GlobalKeyword = 141, - OfKeyword = 142, - QualifiedName = 143, - ComputedPropertyName = 144, - TypeParameter = 145, - Parameter = 146, - Decorator = 147, - PropertySignature = 148, - PropertyDeclaration = 149, - MethodSignature = 150, - MethodDeclaration = 151, - Constructor = 152, - GetAccessor = 153, - SetAccessor = 154, - CallSignature = 155, - ConstructSignature = 156, - IndexSignature = 157, - TypePredicate = 158, - TypeReference = 159, - FunctionType = 160, - ConstructorType = 161, - TypeQuery = 162, - TypeLiteral = 163, - ArrayType = 164, - TupleType = 165, - UnionType = 166, - IntersectionType = 167, - ParenthesizedType = 168, - ThisType = 169, - TypeOperator = 170, - IndexedAccessType = 171, - MappedType = 172, - LiteralType = 173, - ObjectBindingPattern = 174, - ArrayBindingPattern = 175, - BindingElement = 176, - ArrayLiteralExpression = 177, - ObjectLiteralExpression = 178, - PropertyAccessExpression = 179, - ElementAccessExpression = 180, - CallExpression = 181, - NewExpression = 182, - TaggedTemplateExpression = 183, - TypeAssertionExpression = 184, - ParenthesizedExpression = 185, - FunctionExpression = 186, - ArrowFunction = 187, - DeleteExpression = 188, - TypeOfExpression = 189, - VoidExpression = 190, - AwaitExpression = 191, - PrefixUnaryExpression = 192, - PostfixUnaryExpression = 193, - BinaryExpression = 194, - ConditionalExpression = 195, - TemplateExpression = 196, - YieldExpression = 197, - SpreadElement = 198, - ClassExpression = 199, - OmittedExpression = 200, - ExpressionWithTypeArguments = 201, - AsExpression = 202, - NonNullExpression = 203, - MetaProperty = 204, - TemplateSpan = 205, - SemicolonClassElement = 206, - Block = 207, - VariableStatement = 208, - EmptyStatement = 209, - ExpressionStatement = 210, - IfStatement = 211, - DoStatement = 212, - WhileStatement = 213, - ForStatement = 214, - ForInStatement = 215, - ForOfStatement = 216, - ContinueStatement = 217, - BreakStatement = 218, - ReturnStatement = 219, - WithStatement = 220, - SwitchStatement = 221, - LabeledStatement = 222, - ThrowStatement = 223, - TryStatement = 224, - DebuggerStatement = 225, - VariableDeclaration = 226, - VariableDeclarationList = 227, - FunctionDeclaration = 228, - ClassDeclaration = 229, - InterfaceDeclaration = 230, - TypeAliasDeclaration = 231, - EnumDeclaration = 232, - ModuleDeclaration = 233, - ModuleBlock = 234, - CaseBlock = 235, - NamespaceExportDeclaration = 236, - ImportEqualsDeclaration = 237, - ImportDeclaration = 238, - ImportClause = 239, - NamespaceImport = 240, - NamedImports = 241, - ImportSpecifier = 242, - ExportAssignment = 243, - ExportDeclaration = 244, - NamedExports = 245, - ExportSpecifier = 246, - MissingDeclaration = 247, - ExternalModuleReference = 248, - JsxElement = 249, - JsxSelfClosingElement = 250, - JsxOpeningElement = 251, - JsxClosingElement = 252, - JsxFragment = 253, - JsxOpeningFragment = 254, - JsxClosingFragment = 255, - JsxAttribute = 256, - JsxAttributes = 257, - JsxSpreadAttribute = 258, - JsxExpression = 259, - CaseClause = 260, - DefaultClause = 261, - HeritageClause = 262, - CatchClause = 263, - PropertyAssignment = 264, - ShorthandPropertyAssignment = 265, - SpreadAssignment = 266, - EnumMember = 267, - SourceFile = 268, - Bundle = 269, - JSDocTypeExpression = 270, - JSDocAllType = 271, - JSDocUnknownType = 272, - JSDocNullableType = 273, - JSDocNonNullableType = 274, - JSDocOptionalType = 275, - JSDocFunctionType = 276, - JSDocVariadicType = 277, - JSDocComment = 278, - JSDocTypeLiteral = 279, - JSDocTag = 280, - JSDocAugmentsTag = 281, - JSDocClassTag = 282, - JSDocParameterTag = 283, - JSDocReturnTag = 284, - JSDocTypeTag = 285, - JSDocTemplateTag = 286, - JSDocTypedefTag = 287, - JSDocPropertyTag = 288, - SyntaxList = 289, - NotEmittedStatement = 290, - PartiallyEmittedExpression = 291, - CommaListExpression = 292, - MergeDeclarationMarker = 293, - EndOfDeclarationMarker = 294, - Count = 295, + UniqueKeyword = 140, + FromKeyword = 141, + GlobalKeyword = 142, + OfKeyword = 143, + QualifiedName = 144, + ComputedPropertyName = 145, + TypeParameter = 146, + Parameter = 147, + Decorator = 148, + PropertySignature = 149, + PropertyDeclaration = 150, + MethodSignature = 151, + MethodDeclaration = 152, + Constructor = 153, + GetAccessor = 154, + SetAccessor = 155, + CallSignature = 156, + ConstructSignature = 157, + IndexSignature = 158, + TypePredicate = 159, + TypeReference = 160, + FunctionType = 161, + ConstructorType = 162, + TypeQuery = 163, + TypeLiteral = 164, + ArrayType = 165, + TupleType = 166, + UnionType = 167, + IntersectionType = 168, + ParenthesizedType = 169, + ThisType = 170, + TypeOperator = 171, + IndexedAccessType = 172, + MappedType = 173, + LiteralType = 174, + ObjectBindingPattern = 175, + ArrayBindingPattern = 176, + BindingElement = 177, + ArrayLiteralExpression = 178, + ObjectLiteralExpression = 179, + PropertyAccessExpression = 180, + ElementAccessExpression = 181, + CallExpression = 182, + NewExpression = 183, + TaggedTemplateExpression = 184, + TypeAssertionExpression = 185, + ParenthesizedExpression = 186, + FunctionExpression = 187, + ArrowFunction = 188, + DeleteExpression = 189, + TypeOfExpression = 190, + VoidExpression = 191, + AwaitExpression = 192, + PrefixUnaryExpression = 193, + PostfixUnaryExpression = 194, + BinaryExpression = 195, + ConditionalExpression = 196, + TemplateExpression = 197, + YieldExpression = 198, + SpreadElement = 199, + ClassExpression = 200, + OmittedExpression = 201, + ExpressionWithTypeArguments = 202, + AsExpression = 203, + NonNullExpression = 204, + MetaProperty = 205, + TemplateSpan = 206, + SemicolonClassElement = 207, + Block = 208, + VariableStatement = 209, + EmptyStatement = 210, + ExpressionStatement = 211, + IfStatement = 212, + DoStatement = 213, + WhileStatement = 214, + ForStatement = 215, + ForInStatement = 216, + ForOfStatement = 217, + ContinueStatement = 218, + BreakStatement = 219, + ReturnStatement = 220, + WithStatement = 221, + SwitchStatement = 222, + LabeledStatement = 223, + ThrowStatement = 224, + TryStatement = 225, + DebuggerStatement = 226, + VariableDeclaration = 227, + VariableDeclarationList = 228, + FunctionDeclaration = 229, + ClassDeclaration = 230, + InterfaceDeclaration = 231, + TypeAliasDeclaration = 232, + EnumDeclaration = 233, + ModuleDeclaration = 234, + ModuleBlock = 235, + CaseBlock = 236, + NamespaceExportDeclaration = 237, + ImportEqualsDeclaration = 238, + ImportDeclaration = 239, + ImportClause = 240, + NamespaceImport = 241, + NamedImports = 242, + ImportSpecifier = 243, + ExportAssignment = 244, + ExportDeclaration = 245, + NamedExports = 246, + ExportSpecifier = 247, + MissingDeclaration = 248, + ExternalModuleReference = 249, + JsxElement = 250, + JsxSelfClosingElement = 251, + JsxOpeningElement = 252, + JsxClosingElement = 253, + JsxFragment = 254, + JsxOpeningFragment = 255, + JsxClosingFragment = 256, + JsxAttribute = 257, + JsxAttributes = 258, + JsxSpreadAttribute = 259, + JsxExpression = 260, + CaseClause = 261, + DefaultClause = 262, + HeritageClause = 263, + CatchClause = 264, + PropertyAssignment = 265, + ShorthandPropertyAssignment = 266, + SpreadAssignment = 267, + EnumMember = 268, + SourceFile = 269, + Bundle = 270, + JSDocTypeExpression = 271, + JSDocAllType = 272, + JSDocUnknownType = 273, + JSDocNullableType = 274, + JSDocNonNullableType = 275, + JSDocOptionalType = 276, + JSDocFunctionType = 277, + JSDocVariadicType = 278, + JSDocComment = 279, + JSDocTypeLiteral = 280, + JSDocTag = 281, + JSDocAugmentsTag = 282, + JSDocClassTag = 283, + JSDocParameterTag = 284, + JSDocReturnTag = 285, + JSDocTypeTag = 286, + JSDocTemplateTag = 287, + JSDocTypedefTag = 288, + JSDocPropertyTag = 289, + SyntaxList = 290, + NotEmittedStatement = 291, + PartiallyEmittedExpression = 292, + CommaListExpression = 293, + MergeDeclarationMarker = 294, + EndOfDeclarationMarker = 295, + Count = 296, FirstAssignment = 58, LastAssignment = 70, FirstCompoundAssignment = 59, @@ -363,15 +364,15 @@ declare namespace ts { FirstReservedWord = 72, LastReservedWord = 107, FirstKeyword = 72, - LastKeyword = 142, + LastKeyword = 143, FirstFutureReservedWord = 108, LastFutureReservedWord = 116, - FirstTypeNode = 158, - LastTypeNode = 173, + FirstTypeNode = 159, + LastTypeNode = 174, FirstPunctuation = 17, LastPunctuation = 70, FirstToken = 0, - LastToken = 142, + LastToken = 143, FirstTriviaToken = 2, LastTriviaToken = 7, FirstLiteralToken = 8, @@ -380,11 +381,11 @@ declare namespace ts { LastTemplateToken = 16, FirstBinaryOperator = 27, LastBinaryOperator = 70, - FirstNode = 143, - FirstJSDocNode = 270, - LastJSDocNode = 288, - FirstJSDocTagNode = 280, - LastJSDocTagNode = 288, + FirstNode = 144, + FirstJSDocNode = 271, + LastJSDocNode = 289, + FirstJSDocTagNode = 281, + LastJSDocTagNode = 289, } enum NodeFlags { None = 0, @@ -739,7 +740,7 @@ declare namespace ts { } interface TypeOperatorNode extends TypeNode { kind: SyntaxKind.TypeOperator; - operator: SyntaxKind.KeyOfKeyword; + operator: SyntaxKind.KeyOfKeyword | SyntaxKind.UniqueKeyword; type: TypeNode; } interface IndexedAccessTypeNode extends TypeNode { @@ -1825,6 +1826,7 @@ declare namespace ts { trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void; reportInaccessibleThisError(): void; reportPrivateInBaseOfClassExpression(propertyName: string): void; + reportInaccessibleUniqueSymbolError(): void; } enum TypeFormatFlags { None = 0, @@ -1843,6 +1845,7 @@ declare namespace ts { WriteClassExpressionAsTypeLiteral = 16384, InArrayType = 32768, UseAliasDefinedOutsideCurrentScope = 65536, + AllowUniqueESSymbolType = 131072, } enum SymbolFormatFlags { None = 0, @@ -1996,32 +1999,34 @@ declare namespace ts { BooleanLiteral = 128, EnumLiteral = 256, ESSymbol = 512, - Void = 1024, - Undefined = 2048, - Null = 4096, - Never = 8192, - TypeParameter = 16384, - Object = 32768, - Union = 65536, - Intersection = 131072, - Index = 262144, - IndexedAccess = 524288, - NonPrimitive = 16777216, - MarkerType = 67108864, + UniqueESSymbol = 1024, + Void = 2048, + Undefined = 4096, + Null = 8192, + Never = 16384, + TypeParameter = 32768, + Object = 65536, + Union = 131072, + Intersection = 262144, + Index = 524288, + IndexedAccess = 1048576, + NonPrimitive = 33554432, + MarkerType = 134217728, Literal = 224, - Unit = 6368, + Unit = 13536, StringOrNumberLiteral = 96, - PossiblyFalsy = 7406, - StringLike = 262178, + PossiblyFalsy = 14574, + StringLike = 524322, NumberLike = 84, BooleanLike = 136, EnumLike = 272, - UnionOrIntersection = 196608, - StructuredType = 229376, - StructuredOrTypeVariable = 1032192, - TypeVariable = 540672, - Narrowable = 17810175, - NotUnionOrUnit = 16810497, + ESSymbolLike = 1536, + UnionOrIntersection = 393216, + StructuredType = 458752, + StructuredOrTypeVariable = 2064384, + TypeVariable = 1081344, + Narrowable = 35620607, + NotUnionOrUnit = 33620481, } type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression; interface Type { @@ -2036,6 +2041,9 @@ declare namespace ts { freshType?: LiteralType; regularType?: LiteralType; } + interface UniqueESSymbolType extends Type { + symbol: Symbol; + } interface StringLiteralType extends LiteralType { value: string; } @@ -3297,6 +3305,7 @@ declare namespace ts { function updateParenthesizedType(node: ParenthesizedTypeNode, type: TypeNode): ParenthesizedTypeNode; function createThisTypeNode(): ThisTypeNode; function createTypeOperatorNode(type: TypeNode): TypeOperatorNode; + function createTypeOperatorNode(operator: SyntaxKind.KeyOfKeyword | SyntaxKind.UniqueKeyword, type: TypeNode): TypeOperatorNode; function updateTypeOperatorNode(node: TypeOperatorNode, type: TypeNode): TypeOperatorNode; function createIndexedAccessTypeNode(objectType: TypeNode, indexType: TypeNode): IndexedAccessTypeNode; function updateIndexedAccessTypeNode(node: IndexedAccessTypeNode, objectType: TypeNode, indexType: TypeNode): IndexedAccessTypeNode; diff --git a/tests/baselines/reference/asyncImportNestedYield.types b/tests/baselines/reference/asyncImportNestedYield.types index 872e314150030..f7fbfa8f96200 100644 --- a/tests/baselines/reference/asyncImportNestedYield.types +++ b/tests/baselines/reference/asyncImportNestedYield.types @@ -1,6 +1,6 @@ === tests/cases/compiler/asyncImportNestedYield.ts === async function* foo() { ->foo : () => AsyncIterableIterator<"foo"> +>foo : () => AsyncIterableIterator import((await import(yield "foo")).default); >import((await import(yield "foo")).default) : Promise diff --git a/tests/baselines/reference/capturedParametersInInitializers2.errors.txt b/tests/baselines/reference/capturedParametersInInitializers2.errors.txt index 9e9f48e539086..70435b77cee84 100644 --- a/tests/baselines/reference/capturedParametersInInitializers2.errors.txt +++ b/tests/baselines/reference/capturedParametersInInitializers2.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/capturedParametersInInitializers2.ts(1,36): error TS2373: Initializer of parameter 'y' cannot reference identifier 'x' declared after it. -tests/cases/compiler/capturedParametersInInitializers2.ts(4,26): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/compiler/capturedParametersInInitializers2.ts(4,26): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. ==== tests/cases/compiler/capturedParametersInInitializers2.ts (2 errors) ==== @@ -10,5 +10,5 @@ tests/cases/compiler/capturedParametersInInitializers2.ts(4,26): error TS1166: A } function foo2(y = class {[x] = x}, x = 1) { ~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. } \ No newline at end of file diff --git a/tests/baselines/reference/classWithDuplicateIdentifier.errors.txt b/tests/baselines/reference/classWithDuplicateIdentifier.errors.txt index 55e9714ee59b5..de862cf387fee 100644 --- a/tests/baselines/reference/classWithDuplicateIdentifier.errors.txt +++ b/tests/baselines/reference/classWithDuplicateIdentifier.errors.txt @@ -2,7 +2,7 @@ tests/cases/compiler/classWithDuplicateIdentifier.ts(3,5): error TS2300: Duplica tests/cases/compiler/classWithDuplicateIdentifier.ts(6,5): error TS2300: Duplicate identifier 'b'. tests/cases/compiler/classWithDuplicateIdentifier.ts(7,5): error TS2300: Duplicate identifier 'b'. tests/cases/compiler/classWithDuplicateIdentifier.ts(11,5): error TS2300: Duplicate identifier 'c'. -tests/cases/compiler/classWithDuplicateIdentifier.ts(11,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'c' has type 'number' at tests/cases/compiler/classWithDuplicateIdentifier.ts 9:4, but here has type 'string'. +tests/cases/compiler/classWithDuplicateIdentifier.ts(11,5): error TS2717: Subsequent property declarations must have the same type. Property 'c' has type 'number' at tests/cases/compiler/classWithDuplicateIdentifier.ts 9:4, but here has type 'string'. ==== tests/cases/compiler/classWithDuplicateIdentifier.ts (5 errors) ==== @@ -26,6 +26,6 @@ tests/cases/compiler/classWithDuplicateIdentifier.ts(11,5): error TS2403: Subseq ~ !!! error TS2300: Duplicate identifier 'c'. ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'c' has type 'number' at tests/cases/compiler/classWithDuplicateIdentifier.ts 9:4, but here has type 'string'. +!!! error TS2717: Subsequent property declarations must have the same type. Property 'c' has type 'number' at tests/cases/compiler/classWithDuplicateIdentifier.ts 9:4, but here has type 'string'. } \ No newline at end of file diff --git a/tests/baselines/reference/complicatedPrivacy.errors.txt b/tests/baselines/reference/complicatedPrivacy.errors.txt index 661b0693807c4..750beb1994d3d 100644 --- a/tests/baselines/reference/complicatedPrivacy.errors.txt +++ b/tests/baselines/reference/complicatedPrivacy.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/complicatedPrivacy.ts(11,24): error TS1054: A 'get' accessor cannot have parameters. -tests/cases/compiler/complicatedPrivacy.ts(35,5): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. +tests/cases/compiler/complicatedPrivacy.ts(35,5): error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type. tests/cases/compiler/complicatedPrivacy.ts(35,6): error TS2693: 'number' only refers to a type, but is being used as a value here. tests/cases/compiler/complicatedPrivacy.ts(73,55): error TS2694: Namespace 'mglo5' has no exported member 'i6'. @@ -43,7 +43,7 @@ tests/cases/compiler/complicatedPrivacy.ts(73,55): error TS2694: Namespace 'mglo { [number]: C1; // Used to be indexer, now it is a computed property ~~~~~~~~ -!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. +!!! error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type. ~~~~~~ !!! error TS2693: 'number' only refers to a type, but is being used as a value here. }) { diff --git a/tests/baselines/reference/computedPropertyNames12_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames12_ES5.errors.txt index 71f81c27245f9..309b734dfeaf7 100644 --- a/tests/baselines/reference/computedPropertyNames12_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames12_ES5.errors.txt @@ -1,12 +1,12 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.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_ES5.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_ES5.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_ES5.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_ES5.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_ES5.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_ES5.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_ES5.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_ES5.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_ES5.ts(5,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(6,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(7,12): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(8,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(9,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(12,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(13,12): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(14,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(15,12): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts (9 errors) ==== @@ -16,31 +16,31 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(15 class C { [s]: number; ~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. [n] = n; ~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. static [s + s]: string; ~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. [s + n] = 2; ~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. [+s]: typeof s; ~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. static [""]: number; [0]: number; [a]: number; ~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. static [true]: number; ~~~~~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. [`hello bye`] = 0; ~~~~~~~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. static [`hello ${a} bye`] = 0 ~~~~~~~~~~~~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames12_ES5.symbols b/tests/baselines/reference/computedPropertyNames12_ES5.symbols index a6519a5dedf55..619a54c76c9ee 100644 --- a/tests/baselines/reference/computedPropertyNames12_ES5.symbols +++ b/tests/baselines/reference/computedPropertyNames12_ES5.symbols @@ -31,10 +31,10 @@ class C { >s : Symbol(s, Decl(computedPropertyNames12_ES5.ts, 0, 3)) static [""]: number; ->"" : Symbol(C[[""]], Decl(computedPropertyNames12_ES5.ts, 8, 19)) +>"" : Symbol(C[""], Decl(computedPropertyNames12_ES5.ts, 8, 19)) [0]: number; ->0 : Symbol(C[[0]], Decl(computedPropertyNames12_ES5.ts, 9, 24)) +>0 : Symbol(C[0], Decl(computedPropertyNames12_ES5.ts, 9, 24)) [a]: number; >a : Symbol(a, Decl(computedPropertyNames12_ES5.ts, 2, 3)) diff --git a/tests/baselines/reference/computedPropertyNames12_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames12_ES6.errors.txt index 8d8cce7e1408d..13920995eaa9a 100644 --- a/tests/baselines/reference/computedPropertyNames12_ES6.errors.txt +++ b/tests/baselines/reference/computedPropertyNames12_ES6.errors.txt @@ -1,12 +1,12 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.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_ES6.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_ES6.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_ES6.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_ES6.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_ES6.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_ES6.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_ES6.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_ES6.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_ES6.ts(5,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(6,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(7,12): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(8,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(9,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(12,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(13,12): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(14,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(15,12): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts (9 errors) ==== @@ -16,31 +16,31 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(15 class C { [s]: number; ~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. [n] = n; ~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. static [s + s]: string; ~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. [s + n] = 2; ~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. [+s]: typeof s; ~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. static [""]: number; [0]: number; [a]: number; ~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. static [true]: number; ~~~~~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. [`hello bye`] = 0; ~~~~~~~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. static [`hello ${a} bye`] = 0 ~~~~~~~~~~~~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames12_ES6.symbols b/tests/baselines/reference/computedPropertyNames12_ES6.symbols index 3ba128eb1c26e..9cb6fb3fa4bf7 100644 --- a/tests/baselines/reference/computedPropertyNames12_ES6.symbols +++ b/tests/baselines/reference/computedPropertyNames12_ES6.symbols @@ -31,10 +31,10 @@ class C { >s : Symbol(s, Decl(computedPropertyNames12_ES6.ts, 0, 3)) static [""]: number; ->"" : Symbol(C[[""]], Decl(computedPropertyNames12_ES6.ts, 8, 19)) +>"" : Symbol(C[""], Decl(computedPropertyNames12_ES6.ts, 8, 19)) [0]: number; ->0 : Symbol(C[[0]], Decl(computedPropertyNames12_ES6.ts, 9, 24)) +>0 : Symbol(C[0], Decl(computedPropertyNames12_ES6.ts, 9, 24)) [a]: number; >a : Symbol(a, Decl(computedPropertyNames12_ES6.ts, 2, 3)) diff --git a/tests/baselines/reference/computedPropertyNames13_ES5.symbols b/tests/baselines/reference/computedPropertyNames13_ES5.symbols index 493ea44b3399d..4fae0886ca2ef 100644 --- a/tests/baselines/reference/computedPropertyNames13_ES5.symbols +++ b/tests/baselines/reference/computedPropertyNames13_ES5.symbols @@ -29,10 +29,10 @@ class C { >s : Symbol(s, Decl(computedPropertyNames13_ES5.ts, 0, 3)) static [""]() { } ->"" : Symbol(C[[""]], Decl(computedPropertyNames13_ES5.ts, 8, 14)) +>"" : Symbol(C[""], Decl(computedPropertyNames13_ES5.ts, 8, 14)) [0]() { } ->0 : Symbol(C[[0]], Decl(computedPropertyNames13_ES5.ts, 9, 21)) +>0 : Symbol(C[0], Decl(computedPropertyNames13_ES5.ts, 9, 21)) [a]() { } >a : Symbol(a, Decl(computedPropertyNames13_ES5.ts, 2, 3)) diff --git a/tests/baselines/reference/computedPropertyNames13_ES6.symbols b/tests/baselines/reference/computedPropertyNames13_ES6.symbols index 7c421d3f9f77c..1f3a1c1460c9a 100644 --- a/tests/baselines/reference/computedPropertyNames13_ES6.symbols +++ b/tests/baselines/reference/computedPropertyNames13_ES6.symbols @@ -29,10 +29,10 @@ class C { >s : Symbol(s, Decl(computedPropertyNames13_ES6.ts, 0, 3)) static [""]() { } ->"" : Symbol(C[[""]], Decl(computedPropertyNames13_ES6.ts, 8, 14)) +>"" : Symbol(C[""], Decl(computedPropertyNames13_ES6.ts, 8, 14)) [0]() { } ->0 : Symbol(C[[0]], Decl(computedPropertyNames13_ES6.ts, 9, 21)) +>0 : Symbol(C[0], Decl(computedPropertyNames13_ES6.ts, 9, 21)) [a]() { } >a : Symbol(a, Decl(computedPropertyNames13_ES6.ts, 2, 3)) diff --git a/tests/baselines/reference/computedPropertyNames16_ES5.symbols b/tests/baselines/reference/computedPropertyNames16_ES5.symbols index 43f6e208957f7..dff21e3cd97cc 100644 --- a/tests/baselines/reference/computedPropertyNames16_ES5.symbols +++ b/tests/baselines/reference/computedPropertyNames16_ES5.symbols @@ -31,11 +31,11 @@ class C { >s : Symbol(s, Decl(computedPropertyNames16_ES5.ts, 0, 3)) static set [""](v) { } ->"" : Symbol(C[[""]], Decl(computedPropertyNames16_ES5.ts, 8, 28)) +>"" : Symbol(C[""], Decl(computedPropertyNames16_ES5.ts, 8, 28)) >v : Symbol(v, Decl(computedPropertyNames16_ES5.ts, 9, 20)) get [0]() { return 0; } ->0 : Symbol(C[[0]], Decl(computedPropertyNames16_ES5.ts, 9, 26)) +>0 : Symbol(C[0], Decl(computedPropertyNames16_ES5.ts, 9, 26)) set [a](v) { } >a : Symbol(a, Decl(computedPropertyNames16_ES5.ts, 2, 3)) diff --git a/tests/baselines/reference/computedPropertyNames16_ES6.symbols b/tests/baselines/reference/computedPropertyNames16_ES6.symbols index 4febdc01b9b7f..3e1af442b2ddd 100644 --- a/tests/baselines/reference/computedPropertyNames16_ES6.symbols +++ b/tests/baselines/reference/computedPropertyNames16_ES6.symbols @@ -31,11 +31,11 @@ class C { >s : Symbol(s, Decl(computedPropertyNames16_ES6.ts, 0, 3)) static set [""](v) { } ->"" : Symbol(C[[""]], Decl(computedPropertyNames16_ES6.ts, 8, 28)) +>"" : Symbol(C[""], Decl(computedPropertyNames16_ES6.ts, 8, 28)) >v : Symbol(v, Decl(computedPropertyNames16_ES6.ts, 9, 20)) get [0]() { return 0; } ->0 : Symbol(C[[0]], Decl(computedPropertyNames16_ES6.ts, 9, 26)) +>0 : Symbol(C[0], Decl(computedPropertyNames16_ES6.ts, 9, 26)) set [a](v) { } >a : Symbol(a, Decl(computedPropertyNames16_ES6.ts, 2, 3)) diff --git a/tests/baselines/reference/computedPropertyNames35_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames35_ES5.errors.txt index aaf5648702865..47ad09c51e3de 100644 --- a/tests/baselines/reference/computedPropertyNames35_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames35_ES5.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES5.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_ES5.ts(4,5): error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES5.ts(4,10): error TS2467: A computed property name cannot reference a type parameter from its containing type. @@ -8,7 +8,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES5.ts(4, bar(): string; [foo()](): void; ~~~~~~~~~~ -!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. +!!! error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' 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_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames35_ES6.errors.txt index c8ef5efac31f5..8a0be33325c9c 100644 --- a/tests/baselines/reference/computedPropertyNames35_ES6.errors.txt +++ b/tests/baselines/reference/computedPropertyNames35_ES6.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES6.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_ES6.ts(4,5): error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES6.ts(4,10): error TS2467: A computed property name cannot reference a type parameter from its containing type. @@ -8,7 +8,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES6.ts(4, bar(): string; [foo()](): void; ~~~~~~~~~~ -!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. +!!! error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' 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/computedPropertyNames36_ES5.symbols b/tests/baselines/reference/computedPropertyNames36_ES5.symbols index b0ee9a5a6c335..f0c9adbf22f1b 100644 --- a/tests/baselines/reference/computedPropertyNames36_ES5.symbols +++ b/tests/baselines/reference/computedPropertyNames36_ES5.symbols @@ -17,11 +17,11 @@ class C { // Computed properties get ["get1"]() { return new Foo } ->"get1" : Symbol(C[["get1"]], Decl(computedPropertyNames36_ES5.ts, 4, 22)) +>"get1" : Symbol(C["get1"], Decl(computedPropertyNames36_ES5.ts, 4, 22)) >Foo : Symbol(Foo, Decl(computedPropertyNames36_ES5.ts, 0, 0)) set ["set1"](p: Foo2) { } ->"set1" : Symbol(C[["set1"]], Decl(computedPropertyNames36_ES5.ts, 7, 37)) +>"set1" : Symbol(C["set1"], Decl(computedPropertyNames36_ES5.ts, 7, 37)) >p : Symbol(p, Decl(computedPropertyNames36_ES5.ts, 8, 17)) >Foo2 : Symbol(Foo2, Decl(computedPropertyNames36_ES5.ts, 0, 15)) } diff --git a/tests/baselines/reference/computedPropertyNames36_ES6.symbols b/tests/baselines/reference/computedPropertyNames36_ES6.symbols index 5a7fa1cdb8dc1..ad406fa526612 100644 --- a/tests/baselines/reference/computedPropertyNames36_ES6.symbols +++ b/tests/baselines/reference/computedPropertyNames36_ES6.symbols @@ -17,11 +17,11 @@ class C { // Computed properties get ["get1"]() { return new Foo } ->"get1" : Symbol(C[["get1"]], Decl(computedPropertyNames36_ES6.ts, 4, 22)) +>"get1" : Symbol(C["get1"], Decl(computedPropertyNames36_ES6.ts, 4, 22)) >Foo : Symbol(Foo, Decl(computedPropertyNames36_ES6.ts, 0, 0)) set ["set1"](p: Foo2) { } ->"set1" : Symbol(C[["set1"]], Decl(computedPropertyNames36_ES6.ts, 7, 37)) +>"set1" : Symbol(C["set1"], Decl(computedPropertyNames36_ES6.ts, 7, 37)) >p : Symbol(p, Decl(computedPropertyNames36_ES6.ts, 8, 17)) >Foo2 : Symbol(Foo2, Decl(computedPropertyNames36_ES6.ts, 0, 15)) } diff --git a/tests/baselines/reference/computedPropertyNames37_ES5.symbols b/tests/baselines/reference/computedPropertyNames37_ES5.symbols index 7763c5970a35f..5d9ea09078038 100644 --- a/tests/baselines/reference/computedPropertyNames37_ES5.symbols +++ b/tests/baselines/reference/computedPropertyNames37_ES5.symbols @@ -17,11 +17,11 @@ class C { // Computed properties get ["get1"]() { return new Foo } ->"get1" : Symbol(C[["get1"]], Decl(computedPropertyNames37_ES5.ts, 4, 22)) +>"get1" : Symbol(C["get1"], Decl(computedPropertyNames37_ES5.ts, 4, 22)) >Foo : Symbol(Foo, Decl(computedPropertyNames37_ES5.ts, 0, 0)) set ["set1"](p: Foo2) { } ->"set1" : Symbol(C[["set1"]], Decl(computedPropertyNames37_ES5.ts, 7, 37)) +>"set1" : Symbol(C["set1"], Decl(computedPropertyNames37_ES5.ts, 7, 37)) >p : Symbol(p, Decl(computedPropertyNames37_ES5.ts, 8, 17)) >Foo2 : Symbol(Foo2, Decl(computedPropertyNames37_ES5.ts, 0, 15)) } diff --git a/tests/baselines/reference/computedPropertyNames37_ES6.symbols b/tests/baselines/reference/computedPropertyNames37_ES6.symbols index d2e1e2fdc6e69..f30cd6cad377e 100644 --- a/tests/baselines/reference/computedPropertyNames37_ES6.symbols +++ b/tests/baselines/reference/computedPropertyNames37_ES6.symbols @@ -17,11 +17,11 @@ class C { // Computed properties get ["get1"]() { return new Foo } ->"get1" : Symbol(C[["get1"]], Decl(computedPropertyNames37_ES6.ts, 4, 22)) +>"get1" : Symbol(C["get1"], Decl(computedPropertyNames37_ES6.ts, 4, 22)) >Foo : Symbol(Foo, Decl(computedPropertyNames37_ES6.ts, 0, 0)) set ["set1"](p: Foo2) { } ->"set1" : Symbol(C[["set1"]], Decl(computedPropertyNames37_ES6.ts, 7, 37)) +>"set1" : Symbol(C["set1"], Decl(computedPropertyNames37_ES6.ts, 7, 37)) >p : Symbol(p, Decl(computedPropertyNames37_ES6.ts, 8, 17)) >Foo2 : Symbol(Foo2, Decl(computedPropertyNames37_ES6.ts, 0, 15)) } diff --git a/tests/baselines/reference/computedPropertyNames40_ES5.symbols b/tests/baselines/reference/computedPropertyNames40_ES5.symbols index 67535664576f1..d59a516b5e280 100644 --- a/tests/baselines/reference/computedPropertyNames40_ES5.symbols +++ b/tests/baselines/reference/computedPropertyNames40_ES5.symbols @@ -17,10 +17,10 @@ class C { // Computed properties [""]() { return new Foo } ->"" : Symbol(C[[""]], Decl(computedPropertyNames40_ES5.ts, 4, 28), Decl(computedPropertyNames40_ES5.ts, 7, 29)) +>"" : Symbol(C[""], Decl(computedPropertyNames40_ES5.ts, 4, 28), Decl(computedPropertyNames40_ES5.ts, 7, 29)) >Foo : Symbol(Foo, Decl(computedPropertyNames40_ES5.ts, 0, 0)) [""]() { return new Foo2 } ->"" : Symbol(C[[""]], Decl(computedPropertyNames40_ES5.ts, 4, 28), Decl(computedPropertyNames40_ES5.ts, 7, 29)) +>"" : Symbol(C[""], Decl(computedPropertyNames40_ES5.ts, 4, 28), Decl(computedPropertyNames40_ES5.ts, 7, 29)) >Foo2 : Symbol(Foo2, Decl(computedPropertyNames40_ES5.ts, 0, 15)) } diff --git a/tests/baselines/reference/computedPropertyNames40_ES6.symbols b/tests/baselines/reference/computedPropertyNames40_ES6.symbols index 71cb41642fc66..f5881fa6a6b59 100644 --- a/tests/baselines/reference/computedPropertyNames40_ES6.symbols +++ b/tests/baselines/reference/computedPropertyNames40_ES6.symbols @@ -17,10 +17,10 @@ class C { // Computed properties [""]() { return new Foo } ->"" : Symbol(C[[""]], Decl(computedPropertyNames40_ES6.ts, 4, 28), Decl(computedPropertyNames40_ES6.ts, 7, 29)) +>"" : Symbol(C[""], Decl(computedPropertyNames40_ES6.ts, 4, 28), Decl(computedPropertyNames40_ES6.ts, 7, 29)) >Foo : Symbol(Foo, Decl(computedPropertyNames40_ES6.ts, 0, 0)) [""]() { return new Foo2 } ->"" : Symbol(C[[""]], Decl(computedPropertyNames40_ES6.ts, 4, 28), Decl(computedPropertyNames40_ES6.ts, 7, 29)) +>"" : Symbol(C[""], Decl(computedPropertyNames40_ES6.ts, 4, 28), Decl(computedPropertyNames40_ES6.ts, 7, 29)) >Foo2 : Symbol(Foo2, Decl(computedPropertyNames40_ES6.ts, 0, 15)) } diff --git a/tests/baselines/reference/computedPropertyNames41_ES5.symbols b/tests/baselines/reference/computedPropertyNames41_ES5.symbols index 821a39c8d594f..c0642d6b0a6a7 100644 --- a/tests/baselines/reference/computedPropertyNames41_ES5.symbols +++ b/tests/baselines/reference/computedPropertyNames41_ES5.symbols @@ -17,6 +17,6 @@ class C { // Computed properties static [""]() { return new Foo } ->"" : Symbol(C[[""]], Decl(computedPropertyNames41_ES5.ts, 4, 28)) +>"" : Symbol(C[""], Decl(computedPropertyNames41_ES5.ts, 4, 28)) >Foo : Symbol(Foo, Decl(computedPropertyNames41_ES5.ts, 0, 0)) } diff --git a/tests/baselines/reference/computedPropertyNames41_ES6.symbols b/tests/baselines/reference/computedPropertyNames41_ES6.symbols index a075603e252c7..10ef48e4d16c9 100644 --- a/tests/baselines/reference/computedPropertyNames41_ES6.symbols +++ b/tests/baselines/reference/computedPropertyNames41_ES6.symbols @@ -17,6 +17,6 @@ class C { // Computed properties static [""]() { return new Foo } ->"" : Symbol(C[[""]], Decl(computedPropertyNames41_ES6.ts, 4, 28)) +>"" : Symbol(C[""], Decl(computedPropertyNames41_ES6.ts, 4, 28)) >Foo : Symbol(Foo, Decl(computedPropertyNames41_ES6.ts, 0, 0)) } diff --git a/tests/baselines/reference/computedPropertyNames42_ES5.symbols b/tests/baselines/reference/computedPropertyNames42_ES5.symbols index c4fc11571f0de..7c3fa50362a1a 100644 --- a/tests/baselines/reference/computedPropertyNames42_ES5.symbols +++ b/tests/baselines/reference/computedPropertyNames42_ES5.symbols @@ -17,6 +17,6 @@ class C { // Computed properties [""]: Foo; ->"" : Symbol(C[[""]], Decl(computedPropertyNames42_ES5.ts, 4, 22)) +>"" : Symbol(C[""], Decl(computedPropertyNames42_ES5.ts, 4, 22)) >Foo : Symbol(Foo, Decl(computedPropertyNames42_ES5.ts, 0, 0)) } diff --git a/tests/baselines/reference/computedPropertyNames42_ES6.symbols b/tests/baselines/reference/computedPropertyNames42_ES6.symbols index fef7d3c50089d..2055a90e07406 100644 --- a/tests/baselines/reference/computedPropertyNames42_ES6.symbols +++ b/tests/baselines/reference/computedPropertyNames42_ES6.symbols @@ -17,6 +17,6 @@ class C { // Computed properties [""]: Foo; ->"" : Symbol(C[[""]], Decl(computedPropertyNames42_ES6.ts, 4, 22)) +>"" : Symbol(C[""], Decl(computedPropertyNames42_ES6.ts, 4, 22)) >Foo : Symbol(Foo, Decl(computedPropertyNames42_ES6.ts, 0, 0)) } diff --git a/tests/baselines/reference/computedPropertyNames43_ES5.symbols b/tests/baselines/reference/computedPropertyNames43_ES5.symbols index 3765c9af51d63..3fe757202806d 100644 --- a/tests/baselines/reference/computedPropertyNames43_ES5.symbols +++ b/tests/baselines/reference/computedPropertyNames43_ES5.symbols @@ -22,11 +22,11 @@ class D extends C { // Computed properties get ["get1"]() { return new Foo } ->"get1" : Symbol(D[["get1"]], Decl(computedPropertyNames43_ES5.ts, 7, 19)) +>"get1" : Symbol(D["get1"], Decl(computedPropertyNames43_ES5.ts, 7, 19)) >Foo : Symbol(Foo, Decl(computedPropertyNames43_ES5.ts, 0, 0)) set ["set1"](p: Foo2) { } ->"set1" : Symbol(D[["set1"]], Decl(computedPropertyNames43_ES5.ts, 9, 37)) +>"set1" : Symbol(D["set1"], Decl(computedPropertyNames43_ES5.ts, 9, 37)) >p : Symbol(p, Decl(computedPropertyNames43_ES5.ts, 10, 17)) >Foo2 : Symbol(Foo2, Decl(computedPropertyNames43_ES5.ts, 0, 15)) } diff --git a/tests/baselines/reference/computedPropertyNames43_ES6.symbols b/tests/baselines/reference/computedPropertyNames43_ES6.symbols index f37c0943bfd6b..4c2c808277104 100644 --- a/tests/baselines/reference/computedPropertyNames43_ES6.symbols +++ b/tests/baselines/reference/computedPropertyNames43_ES6.symbols @@ -22,11 +22,11 @@ class D extends C { // Computed properties get ["get1"]() { return new Foo } ->"get1" : Symbol(D[["get1"]], Decl(computedPropertyNames43_ES6.ts, 7, 19)) +>"get1" : Symbol(D["get1"], Decl(computedPropertyNames43_ES6.ts, 7, 19)) >Foo : Symbol(Foo, Decl(computedPropertyNames43_ES6.ts, 0, 0)) set ["set1"](p: Foo2) { } ->"set1" : Symbol(D[["set1"]], Decl(computedPropertyNames43_ES6.ts, 9, 37)) +>"set1" : Symbol(D["set1"], Decl(computedPropertyNames43_ES6.ts, 9, 37)) >p : Symbol(p, Decl(computedPropertyNames43_ES6.ts, 10, 17)) >Foo2 : Symbol(Foo2, Decl(computedPropertyNames43_ES6.ts, 0, 15)) } diff --git a/tests/baselines/reference/computedPropertyNames44_ES5.symbols b/tests/baselines/reference/computedPropertyNames44_ES5.symbols index ed097da110a70..ca3841411a099 100644 --- a/tests/baselines/reference/computedPropertyNames44_ES5.symbols +++ b/tests/baselines/reference/computedPropertyNames44_ES5.symbols @@ -16,7 +16,7 @@ class C { >Foo2 : Symbol(Foo2, Decl(computedPropertyNames44_ES5.ts, 0, 15)) get ["get1"]() { return new Foo } ->"get1" : Symbol(C[["get1"]], Decl(computedPropertyNames44_ES5.ts, 4, 22)) +>"get1" : Symbol(C["get1"], Decl(computedPropertyNames44_ES5.ts, 4, 22)) >Foo : Symbol(Foo, Decl(computedPropertyNames44_ES5.ts, 0, 0)) } @@ -25,7 +25,7 @@ class D extends C { >C : Symbol(C, Decl(computedPropertyNames44_ES5.ts, 1, 19)) set ["set1"](p: Foo) { } ->"set1" : Symbol(D[["set1"]], Decl(computedPropertyNames44_ES5.ts, 8, 19)) +>"set1" : Symbol(D["set1"], Decl(computedPropertyNames44_ES5.ts, 8, 19)) >p : Symbol(p, Decl(computedPropertyNames44_ES5.ts, 9, 17)) >Foo : Symbol(Foo, Decl(computedPropertyNames44_ES5.ts, 0, 0)) } diff --git a/tests/baselines/reference/computedPropertyNames44_ES6.symbols b/tests/baselines/reference/computedPropertyNames44_ES6.symbols index 7ac6914fe5a6c..13abd6f8f24a9 100644 --- a/tests/baselines/reference/computedPropertyNames44_ES6.symbols +++ b/tests/baselines/reference/computedPropertyNames44_ES6.symbols @@ -16,7 +16,7 @@ class C { >Foo2 : Symbol(Foo2, Decl(computedPropertyNames44_ES6.ts, 0, 15)) get ["get1"]() { return new Foo } ->"get1" : Symbol(C[["get1"]], Decl(computedPropertyNames44_ES6.ts, 4, 22)) +>"get1" : Symbol(C["get1"], Decl(computedPropertyNames44_ES6.ts, 4, 22)) >Foo : Symbol(Foo, Decl(computedPropertyNames44_ES6.ts, 0, 0)) } @@ -25,7 +25,7 @@ class D extends C { >C : Symbol(C, Decl(computedPropertyNames44_ES6.ts, 1, 19)) set ["set1"](p: Foo) { } ->"set1" : Symbol(D[["set1"]], Decl(computedPropertyNames44_ES6.ts, 8, 19)) +>"set1" : Symbol(D["set1"], Decl(computedPropertyNames44_ES6.ts, 8, 19)) >p : Symbol(p, Decl(computedPropertyNames44_ES6.ts, 9, 17)) >Foo : Symbol(Foo, Decl(computedPropertyNames44_ES6.ts, 0, 0)) } diff --git a/tests/baselines/reference/computedPropertyNames45_ES5.symbols b/tests/baselines/reference/computedPropertyNames45_ES5.symbols index 3028174bb4f3e..04887f8e9ffec 100644 --- a/tests/baselines/reference/computedPropertyNames45_ES5.symbols +++ b/tests/baselines/reference/computedPropertyNames45_ES5.symbols @@ -12,7 +12,7 @@ class C { >C : Symbol(C, Decl(computedPropertyNames45_ES5.ts, 1, 19)) get ["get1"]() { return new Foo } ->"get1" : Symbol(C[["get1"]], Decl(computedPropertyNames45_ES5.ts, 3, 9)) +>"get1" : Symbol(C["get1"], Decl(computedPropertyNames45_ES5.ts, 3, 9)) >Foo : Symbol(Foo, Decl(computedPropertyNames45_ES5.ts, 0, 0)) } @@ -26,7 +26,7 @@ class D extends C { >Foo2 : Symbol(Foo2, Decl(computedPropertyNames45_ES5.ts, 0, 15)) set ["set1"](p: Foo) { } ->"set1" : Symbol(D[["set1"]], Decl(computedPropertyNames45_ES5.ts, 9, 22)) +>"set1" : Symbol(D["set1"], Decl(computedPropertyNames45_ES5.ts, 9, 22)) >p : Symbol(p, Decl(computedPropertyNames45_ES5.ts, 10, 17)) >Foo : Symbol(Foo, Decl(computedPropertyNames45_ES5.ts, 0, 0)) } diff --git a/tests/baselines/reference/computedPropertyNames45_ES6.symbols b/tests/baselines/reference/computedPropertyNames45_ES6.symbols index 110fe23aeef38..5e01cb0201e80 100644 --- a/tests/baselines/reference/computedPropertyNames45_ES6.symbols +++ b/tests/baselines/reference/computedPropertyNames45_ES6.symbols @@ -12,7 +12,7 @@ class C { >C : Symbol(C, Decl(computedPropertyNames45_ES6.ts, 1, 19)) get ["get1"]() { return new Foo } ->"get1" : Symbol(C[["get1"]], Decl(computedPropertyNames45_ES6.ts, 3, 9)) +>"get1" : Symbol(C["get1"], Decl(computedPropertyNames45_ES6.ts, 3, 9)) >Foo : Symbol(Foo, Decl(computedPropertyNames45_ES6.ts, 0, 0)) } @@ -26,7 +26,7 @@ class D extends C { >Foo2 : Symbol(Foo2, Decl(computedPropertyNames45_ES6.ts, 0, 15)) set ["set1"](p: Foo) { } ->"set1" : Symbol(D[["set1"]], Decl(computedPropertyNames45_ES6.ts, 9, 22)) +>"set1" : Symbol(D["set1"], Decl(computedPropertyNames45_ES6.ts, 9, 22)) >p : Symbol(p, Decl(computedPropertyNames45_ES6.ts, 10, 17)) >Foo : Symbol(Foo, Decl(computedPropertyNames45_ES6.ts, 0, 0)) } diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.errors.txt index b6effe98a91ec..8ac89ebdb1976 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES5.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_ES5.ts(2,5): error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES5.ts (1 errors) ==== interface I { ["" + ""](): void; ~~~~~~~~~ -!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. +!!! error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES6.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES6.errors.txt index 99832a42e37ac..79b0971d0b7b4 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES6.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES6.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES6.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_ES6.ts(2,5): error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES6.ts (1 errors) ==== interface I { ["" + ""](): void; ~~~~~~~~~ -!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. +!!! error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.errors.txt index fd84ac72270b9..be1543e81eb41 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES5.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_ES5.ts(2,5): error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES5.ts (1 errors) ==== var v: { ["" + ""](): void; ~~~~~~~~~ -!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. +!!! error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES6.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES6.errors.txt index 7cdd26576cb99..51daaef725f1b 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES6.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES6.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES6.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_ES6.ts(2,5): error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES6.ts (1 errors) ==== var v: { ["" + ""](): void; ~~~~~~~~~ -!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. +!!! error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.errors.txt index 2a17d7da81570..cdd5577f01100 100644 --- a/tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.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_ES5.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_ES5.ts(4,5): error TS1168: A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts(5,5): error TS1168: A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts (2 errors) ==== @@ -8,9 +8,9 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ class C { [methodName](v: string); ~~~~~~~~~~~~ -!!! error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. +!!! error TS1168: A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type. [methodName](); ~~~~~~~~~~~~ -!!! error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. +!!! error TS1168: A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type. [methodName](v?: string) { } } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesOnOverloads_ES6.errors.txt b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES6.errors.txt index 381ee7c17bac9..3f31d4088106c 100644 --- a/tests/baselines/reference/computedPropertyNamesOnOverloads_ES6.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES6.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES6.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_ES6.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_ES6.ts(4,5): error TS1168: A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES6.ts(5,5): error TS1168: A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES6.ts (2 errors) ==== @@ -8,9 +8,9 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ class C { [methodName](v: string); ~~~~~~~~~~~~ -!!! error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. +!!! error TS1168: A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type. [methodName](); ~~~~~~~~~~~~ -!!! error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. +!!! error TS1168: A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type. [methodName](v?: string) { } } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.symbols b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.symbols index 9f4f5110e8fcb..cdb193e3bd394 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.symbols +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.symbols @@ -3,12 +3,12 @@ class C { >C : Symbol(C, Decl(computedPropertyNamesSourceMap1_ES5.ts, 0, 0)) ["hello"]() { ->"hello" : Symbol(C[["hello"]], Decl(computedPropertyNamesSourceMap1_ES5.ts, 0, 9)) +>"hello" : Symbol(C["hello"], Decl(computedPropertyNamesSourceMap1_ES5.ts, 0, 9)) debugger; } get ["goodbye"]() { ->"goodbye" : Symbol(C[["goodbye"]], Decl(computedPropertyNamesSourceMap1_ES5.ts, 3, 5)) +>"goodbye" : Symbol(C["goodbye"], Decl(computedPropertyNamesSourceMap1_ES5.ts, 3, 5)) return 0; } diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.symbols b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.symbols index 447bbaebb7cc8..e8ebdab2fd8b4 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.symbols +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.symbols @@ -3,12 +3,12 @@ class C { >C : Symbol(C, Decl(computedPropertyNamesSourceMap1_ES6.ts, 0, 0)) ["hello"]() { ->"hello" : Symbol(C[["hello"]], Decl(computedPropertyNamesSourceMap1_ES6.ts, 0, 9)) +>"hello" : Symbol(C["hello"], Decl(computedPropertyNamesSourceMap1_ES6.ts, 0, 9)) debugger; } get ["goodbye"]() { ->"goodbye" : Symbol(C[["goodbye"]], Decl(computedPropertyNamesSourceMap1_ES6.ts, 3, 2)) +>"goodbye" : Symbol(C["goodbye"], Decl(computedPropertyNamesSourceMap1_ES6.ts, 3, 2)) return 0; } diff --git a/tests/baselines/reference/decoratorOnClassMethod13.symbols b/tests/baselines/reference/decoratorOnClassMethod13.symbols index 7cd369be14421..5700e6a3bf3a0 100644 --- a/tests/baselines/reference/decoratorOnClassMethod13.symbols +++ b/tests/baselines/reference/decoratorOnClassMethod13.symbols @@ -15,9 +15,9 @@ class C { @dec ["1"]() { } >dec : Symbol(dec, Decl(decoratorOnClassMethod13.ts, 0, 0)) ->"1" : Symbol(C[["1"]], Decl(decoratorOnClassMethod13.ts, 2, 9)) +>"1" : Symbol(C["1"], Decl(decoratorOnClassMethod13.ts, 2, 9)) @dec ["b"]() { } >dec : Symbol(dec, Decl(decoratorOnClassMethod13.ts, 0, 0)) ->"b" : Symbol(C[["b"]], Decl(decoratorOnClassMethod13.ts, 3, 20)) +>"b" : Symbol(C["b"], Decl(decoratorOnClassMethod13.ts, 3, 20)) } diff --git a/tests/baselines/reference/decoratorOnClassMethod4.symbols b/tests/baselines/reference/decoratorOnClassMethod4.symbols index da0e9eafca7f6..30d300a937a79 100644 --- a/tests/baselines/reference/decoratorOnClassMethod4.symbols +++ b/tests/baselines/reference/decoratorOnClassMethod4.symbols @@ -15,5 +15,5 @@ class C { @dec ["method"]() {} >dec : Symbol(dec, Decl(decoratorOnClassMethod4.ts, 0, 0)) ->"method" : Symbol(C[["method"]], Decl(decoratorOnClassMethod4.ts, 2, 9)) +>"method" : Symbol(C["method"], Decl(decoratorOnClassMethod4.ts, 2, 9)) } diff --git a/tests/baselines/reference/decoratorOnClassMethod5.symbols b/tests/baselines/reference/decoratorOnClassMethod5.symbols index bd895deeea808..004af8b9f8e8a 100644 --- a/tests/baselines/reference/decoratorOnClassMethod5.symbols +++ b/tests/baselines/reference/decoratorOnClassMethod5.symbols @@ -15,5 +15,5 @@ class C { @dec() ["method"]() {} >dec : Symbol(dec, Decl(decoratorOnClassMethod5.ts, 0, 0)) ->"method" : Symbol(C[["method"]], Decl(decoratorOnClassMethod5.ts, 2, 9)) +>"method" : Symbol(C["method"], Decl(decoratorOnClassMethod5.ts, 2, 9)) } diff --git a/tests/baselines/reference/decoratorOnClassMethod6.symbols b/tests/baselines/reference/decoratorOnClassMethod6.symbols index 6391192ece3de..bc9046aa666a6 100644 --- a/tests/baselines/reference/decoratorOnClassMethod6.symbols +++ b/tests/baselines/reference/decoratorOnClassMethod6.symbols @@ -15,5 +15,5 @@ class C { @dec ["method"]() {} >dec : Symbol(dec, Decl(decoratorOnClassMethod6.ts, 0, 0)) ->"method" : Symbol(C[["method"]], Decl(decoratorOnClassMethod6.ts, 2, 9)) +>"method" : Symbol(C["method"], Decl(decoratorOnClassMethod6.ts, 2, 9)) } diff --git a/tests/baselines/reference/decoratorOnClassMethod7.symbols b/tests/baselines/reference/decoratorOnClassMethod7.symbols index 9ec0de0c205f9..90e538ebfc4f7 100644 --- a/tests/baselines/reference/decoratorOnClassMethod7.symbols +++ b/tests/baselines/reference/decoratorOnClassMethod7.symbols @@ -15,5 +15,5 @@ class C { @dec public ["method"]() {} >dec : Symbol(dec, Decl(decoratorOnClassMethod7.ts, 0, 0)) ->"method" : Symbol(C[["method"]], Decl(decoratorOnClassMethod7.ts, 2, 9)) +>"method" : Symbol(C["method"], Decl(decoratorOnClassMethod7.ts, 2, 9)) } diff --git a/tests/baselines/reference/decoratorsOnComputedProperties.errors.txt b/tests/baselines/reference/decoratorsOnComputedProperties.errors.txt index 2aef827d4f514..42b678e088f7f 100644 --- a/tests/baselines/reference/decoratorsOnComputedProperties.errors.txt +++ b/tests/baselines/reference/decoratorsOnComputedProperties.errors.txt @@ -1,82 +1,82 @@ -tests/cases/compiler/decoratorsOnComputedProperties.ts(18,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/compiler/decoratorsOnComputedProperties.ts(19,8): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/compiler/decoratorsOnComputedProperties.ts(20,8): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/compiler/decoratorsOnComputedProperties.ts(21,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/compiler/decoratorsOnComputedProperties.ts(22,8): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/compiler/decoratorsOnComputedProperties.ts(23,8): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/compiler/decoratorsOnComputedProperties.ts(18,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/compiler/decoratorsOnComputedProperties.ts(19,8): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/compiler/decoratorsOnComputedProperties.ts(20,8): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/compiler/decoratorsOnComputedProperties.ts(21,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/compiler/decoratorsOnComputedProperties.ts(22,8): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/compiler/decoratorsOnComputedProperties.ts(23,8): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. tests/cases/compiler/decoratorsOnComputedProperties.ts(27,5): error TS1206: Decorators are not valid here. tests/cases/compiler/decoratorsOnComputedProperties.ts(28,5): error TS1206: Decorators are not valid here. tests/cases/compiler/decoratorsOnComputedProperties.ts(29,5): error TS1206: Decorators are not valid here. tests/cases/compiler/decoratorsOnComputedProperties.ts(30,5): error TS1206: Decorators are not valid here. -tests/cases/compiler/decoratorsOnComputedProperties.ts(35,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/compiler/decoratorsOnComputedProperties.ts(35,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. tests/cases/compiler/decoratorsOnComputedProperties.ts(36,5): error TS1206: Decorators are not valid here. tests/cases/compiler/decoratorsOnComputedProperties.ts(37,5): error TS1206: Decorators are not valid here. -tests/cases/compiler/decoratorsOnComputedProperties.ts(38,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/compiler/decoratorsOnComputedProperties.ts(38,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. tests/cases/compiler/decoratorsOnComputedProperties.ts(39,5): error TS1206: Decorators are not valid here. tests/cases/compiler/decoratorsOnComputedProperties.ts(40,5): error TS1206: Decorators are not valid here. -tests/cases/compiler/decoratorsOnComputedProperties.ts(52,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/compiler/decoratorsOnComputedProperties.ts(53,8): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/compiler/decoratorsOnComputedProperties.ts(54,8): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/compiler/decoratorsOnComputedProperties.ts(55,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/compiler/decoratorsOnComputedProperties.ts(56,8): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/compiler/decoratorsOnComputedProperties.ts(57,8): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/compiler/decoratorsOnComputedProperties.ts(52,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/compiler/decoratorsOnComputedProperties.ts(53,8): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/compiler/decoratorsOnComputedProperties.ts(54,8): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/compiler/decoratorsOnComputedProperties.ts(55,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/compiler/decoratorsOnComputedProperties.ts(56,8): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/compiler/decoratorsOnComputedProperties.ts(57,8): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. tests/cases/compiler/decoratorsOnComputedProperties.ts(62,5): error TS1206: Decorators are not valid here. tests/cases/compiler/decoratorsOnComputedProperties.ts(63,5): error TS1206: Decorators are not valid here. tests/cases/compiler/decoratorsOnComputedProperties.ts(64,5): error TS1206: Decorators are not valid here. tests/cases/compiler/decoratorsOnComputedProperties.ts(65,5): error TS1206: Decorators are not valid here. -tests/cases/compiler/decoratorsOnComputedProperties.ts(70,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/compiler/decoratorsOnComputedProperties.ts(70,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. tests/cases/compiler/decoratorsOnComputedProperties.ts(71,5): error TS1206: Decorators are not valid here. tests/cases/compiler/decoratorsOnComputedProperties.ts(72,5): error TS1206: Decorators are not valid here. -tests/cases/compiler/decoratorsOnComputedProperties.ts(73,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/compiler/decoratorsOnComputedProperties.ts(73,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. tests/cases/compiler/decoratorsOnComputedProperties.ts(74,5): error TS1206: Decorators are not valid here. tests/cases/compiler/decoratorsOnComputedProperties.ts(75,5): error TS1206: Decorators are not valid here. -tests/cases/compiler/decoratorsOnComputedProperties.ts(88,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/compiler/decoratorsOnComputedProperties.ts(89,8): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/compiler/decoratorsOnComputedProperties.ts(90,8): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/compiler/decoratorsOnComputedProperties.ts(92,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/compiler/decoratorsOnComputedProperties.ts(93,8): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/compiler/decoratorsOnComputedProperties.ts(94,8): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/compiler/decoratorsOnComputedProperties.ts(88,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/compiler/decoratorsOnComputedProperties.ts(89,8): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/compiler/decoratorsOnComputedProperties.ts(90,8): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/compiler/decoratorsOnComputedProperties.ts(92,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/compiler/decoratorsOnComputedProperties.ts(93,8): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/compiler/decoratorsOnComputedProperties.ts(94,8): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. tests/cases/compiler/decoratorsOnComputedProperties.ts(98,5): error TS1206: Decorators are not valid here. tests/cases/compiler/decoratorsOnComputedProperties.ts(99,5): error TS1206: Decorators are not valid here. tests/cases/compiler/decoratorsOnComputedProperties.ts(100,5): error TS1206: Decorators are not valid here. tests/cases/compiler/decoratorsOnComputedProperties.ts(101,5): error TS1206: Decorators are not valid here. -tests/cases/compiler/decoratorsOnComputedProperties.ts(106,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/compiler/decoratorsOnComputedProperties.ts(106,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. tests/cases/compiler/decoratorsOnComputedProperties.ts(107,5): error TS1206: Decorators are not valid here. tests/cases/compiler/decoratorsOnComputedProperties.ts(108,5): error TS1206: Decorators are not valid here. -tests/cases/compiler/decoratorsOnComputedProperties.ts(110,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/compiler/decoratorsOnComputedProperties.ts(110,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. tests/cases/compiler/decoratorsOnComputedProperties.ts(111,5): error TS1206: Decorators are not valid here. tests/cases/compiler/decoratorsOnComputedProperties.ts(112,5): error TS1206: Decorators are not valid here. -tests/cases/compiler/decoratorsOnComputedProperties.ts(124,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/compiler/decoratorsOnComputedProperties.ts(125,8): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/compiler/decoratorsOnComputedProperties.ts(126,8): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/compiler/decoratorsOnComputedProperties.ts(128,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/compiler/decoratorsOnComputedProperties.ts(129,8): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/compiler/decoratorsOnComputedProperties.ts(131,8): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/compiler/decoratorsOnComputedProperties.ts(124,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/compiler/decoratorsOnComputedProperties.ts(125,8): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/compiler/decoratorsOnComputedProperties.ts(126,8): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/compiler/decoratorsOnComputedProperties.ts(128,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/compiler/decoratorsOnComputedProperties.ts(129,8): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/compiler/decoratorsOnComputedProperties.ts(131,8): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. tests/cases/compiler/decoratorsOnComputedProperties.ts(135,5): error TS1206: Decorators are not valid here. tests/cases/compiler/decoratorsOnComputedProperties.ts(136,5): error TS1206: Decorators are not valid here. tests/cases/compiler/decoratorsOnComputedProperties.ts(137,5): error TS1206: Decorators are not valid here. tests/cases/compiler/decoratorsOnComputedProperties.ts(138,5): error TS1206: Decorators are not valid here. -tests/cases/compiler/decoratorsOnComputedProperties.ts(143,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/compiler/decoratorsOnComputedProperties.ts(143,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. tests/cases/compiler/decoratorsOnComputedProperties.ts(144,5): error TS1206: Decorators are not valid here. tests/cases/compiler/decoratorsOnComputedProperties.ts(145,5): error TS1206: Decorators are not valid here. -tests/cases/compiler/decoratorsOnComputedProperties.ts(147,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/compiler/decoratorsOnComputedProperties.ts(147,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. tests/cases/compiler/decoratorsOnComputedProperties.ts(148,5): error TS1206: Decorators are not valid here. tests/cases/compiler/decoratorsOnComputedProperties.ts(150,5): error TS1206: Decorators are not valid here. -tests/cases/compiler/decoratorsOnComputedProperties.ts(162,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/compiler/decoratorsOnComputedProperties.ts(163,8): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/compiler/decoratorsOnComputedProperties.ts(164,8): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/compiler/decoratorsOnComputedProperties.ts(166,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/compiler/decoratorsOnComputedProperties.ts(167,8): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/compiler/decoratorsOnComputedProperties.ts(169,8): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/compiler/decoratorsOnComputedProperties.ts(162,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/compiler/decoratorsOnComputedProperties.ts(163,8): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/compiler/decoratorsOnComputedProperties.ts(164,8): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/compiler/decoratorsOnComputedProperties.ts(166,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/compiler/decoratorsOnComputedProperties.ts(167,8): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/compiler/decoratorsOnComputedProperties.ts(169,8): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. tests/cases/compiler/decoratorsOnComputedProperties.ts(173,5): error TS1206: Decorators are not valid here. tests/cases/compiler/decoratorsOnComputedProperties.ts(174,5): error TS1206: Decorators are not valid here. tests/cases/compiler/decoratorsOnComputedProperties.ts(175,5): error TS1206: Decorators are not valid here. tests/cases/compiler/decoratorsOnComputedProperties.ts(176,5): error TS1206: Decorators are not valid here. -tests/cases/compiler/decoratorsOnComputedProperties.ts(181,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/compiler/decoratorsOnComputedProperties.ts(181,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. tests/cases/compiler/decoratorsOnComputedProperties.ts(182,5): error TS1206: Decorators are not valid here. tests/cases/compiler/decoratorsOnComputedProperties.ts(183,5): error TS1206: Decorators are not valid here. tests/cases/compiler/decoratorsOnComputedProperties.ts(184,5): error TS1206: Decorators are not valid here. -tests/cases/compiler/decoratorsOnComputedProperties.ts(185,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/compiler/decoratorsOnComputedProperties.ts(185,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. tests/cases/compiler/decoratorsOnComputedProperties.ts(186,5): error TS1206: Decorators are not valid here. tests/cases/compiler/decoratorsOnComputedProperties.ts(188,5): error TS1206: Decorators are not valid here. @@ -101,22 +101,22 @@ tests/cases/compiler/decoratorsOnComputedProperties.ts(188,5): error TS1206: Dec [Symbol.match]: any = null; [foo()]: any; ~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. @x [foo()]: any; ~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. @x [foo()]: any = null; ~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. [fieldNameA]: any; ~~~~~~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. @x [fieldNameB]: any; ~~~~~~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. @x [fieldNameC]: any = null; ~~~~~~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. } void class B { @@ -138,7 +138,7 @@ tests/cases/compiler/decoratorsOnComputedProperties.ts(188,5): error TS1206: Dec [Symbol.match]: any = null; [foo()]: any; ~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. @x [foo()]: any; ~ !!! error TS1206: Decorators are not valid here. @@ -147,7 +147,7 @@ tests/cases/compiler/decoratorsOnComputedProperties.ts(188,5): error TS1206: Dec !!! error TS1206: Decorators are not valid here. [fieldNameA]: any; ~~~~~~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. @x [fieldNameB]: any; ~ !!! error TS1206: Decorators are not valid here. @@ -167,22 +167,22 @@ tests/cases/compiler/decoratorsOnComputedProperties.ts(188,5): error TS1206: Dec [Symbol.match]: any = null; [foo()]: any; ~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. @x [foo()]: any; ~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. @x [foo()]: any = null; ~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. [fieldNameA]: any; ~~~~~~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. @x [fieldNameB]: any; ~~~~~~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. @x [fieldNameC]: any = null; ~~~~~~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. ["some" + "method"]() {} } @@ -205,7 +205,7 @@ tests/cases/compiler/decoratorsOnComputedProperties.ts(188,5): error TS1206: Dec [Symbol.match]: any = null; [foo()]: any; ~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. @x [foo()]: any; ~ !!! error TS1206: Decorators are not valid here. @@ -214,7 +214,7 @@ tests/cases/compiler/decoratorsOnComputedProperties.ts(188,5): error TS1206: Dec !!! error TS1206: Decorators are not valid here. [fieldNameA]: any; ~~~~~~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. @x [fieldNameB]: any; ~ !!! error TS1206: Decorators are not valid here. @@ -235,23 +235,23 @@ tests/cases/compiler/decoratorsOnComputedProperties.ts(188,5): error TS1206: Dec [Symbol.match]: any = null; [foo()]: any; ~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. @x [foo()]: any; ~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. @x [foo()]: any = null; ~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. ["some" + "method"]() {} [fieldNameA]: any; ~~~~~~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. @x [fieldNameB]: any; ~~~~~~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. @x [fieldNameC]: any = null; ~~~~~~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. } void class F { @@ -273,7 +273,7 @@ tests/cases/compiler/decoratorsOnComputedProperties.ts(188,5): error TS1206: Dec [Symbol.match]: any = null; [foo()]: any; ~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. @x [foo()]: any; ~ !!! error TS1206: Decorators are not valid here. @@ -283,7 +283,7 @@ tests/cases/compiler/decoratorsOnComputedProperties.ts(188,5): error TS1206: Dec ["some" + "method"]() {} [fieldNameA]: any; ~~~~~~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. @x [fieldNameB]: any; ~ !!! error TS1206: Decorators are not valid here. @@ -303,24 +303,24 @@ tests/cases/compiler/decoratorsOnComputedProperties.ts(188,5): error TS1206: Dec [Symbol.match]: any = null; [foo()]: any; ~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. @x [foo()]: any; ~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. @x [foo()]: any = null; ~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. ["some" + "method"]() {} [fieldNameA]: any; ~~~~~~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. @x [fieldNameB]: any; ~~~~~~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. ["some" + "method2"]() {} @x [fieldNameC]: any = null; ~~~~~~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. } void class H { @@ -342,7 +342,7 @@ tests/cases/compiler/decoratorsOnComputedProperties.ts(188,5): error TS1206: Dec [Symbol.match]: any = null; [foo()]: any; ~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. @x [foo()]: any; ~ !!! error TS1206: Decorators are not valid here. @@ -352,7 +352,7 @@ tests/cases/compiler/decoratorsOnComputedProperties.ts(188,5): error TS1206: Dec ["some" + "method"]() {} [fieldNameA]: any; ~~~~~~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. @x [fieldNameB]: any; ~ !!! error TS1206: Decorators are not valid here. @@ -373,24 +373,24 @@ tests/cases/compiler/decoratorsOnComputedProperties.ts(188,5): error TS1206: Dec [Symbol.match]: any = null; [foo()]: any; ~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. @x [foo()]: any; ~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. @x [foo()]: any = null; ~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. @x ["some" + "method"]() {} [fieldNameA]: any; ~~~~~~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. @x [fieldNameB]: any; ~~~~~~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. ["some" + "method2"]() {} @x [fieldNameC]: any = null; ~~~~~~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. } void class J { @@ -412,7 +412,7 @@ tests/cases/compiler/decoratorsOnComputedProperties.ts(188,5): error TS1206: Dec [Symbol.match]: any = null; [foo()]: any; ~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. @x [foo()]: any; ~ !!! error TS1206: Decorators are not valid here. @@ -424,7 +424,7 @@ tests/cases/compiler/decoratorsOnComputedProperties.ts(188,5): error TS1206: Dec !!! error TS1206: Decorators are not valid here. [fieldNameA]: any; ~~~~~~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. @x [fieldNameB]: any; ~ !!! error TS1206: Decorators are not valid here. diff --git a/tests/baselines/reference/decoratorsOnComputedProperties.symbols b/tests/baselines/reference/decoratorsOnComputedProperties.symbols index a9fb280f96ed1..f55f60b3f4eb7 100644 --- a/tests/baselines/reference/decoratorsOnComputedProperties.symbols +++ b/tests/baselines/reference/decoratorsOnComputedProperties.symbols @@ -26,7 +26,7 @@ class A { @x ["property"]: any; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) ->"property" : Symbol(A[["property"]], Decl(decoratorsOnComputedProperties.ts, 8, 9)) +>"property" : Symbol(A["property"], Decl(decoratorsOnComputedProperties.ts, 8, 9)) @x [Symbol.toStringTag]: any; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) @@ -36,7 +36,7 @@ class A { @x ["property2"]: any = 2; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) ->"property2" : Symbol(A[["property2"]], Decl(decoratorsOnComputedProperties.ts, 10, 33)) +>"property2" : Symbol(A["property2"], Decl(decoratorsOnComputedProperties.ts, 10, 33)) @x [Symbol.iterator]: any = null; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) @@ -45,7 +45,7 @@ class A { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) ["property3"]: any; ->"property3" : Symbol(A[["property3"]], Decl(decoratorsOnComputedProperties.ts, 12, 37)) +>"property3" : Symbol(A["property3"], Decl(decoratorsOnComputedProperties.ts, 12, 37)) [Symbol.isConcatSpreadable]: any; >Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) @@ -53,7 +53,7 @@ class A { >isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) ["property4"]: any = 2; ->"property4" : Symbol(A[["property4"]], Decl(decoratorsOnComputedProperties.ts, 14, 37)) +>"property4" : Symbol(A["property4"], Decl(decoratorsOnComputedProperties.ts, 14, 37)) [Symbol.match]: any = null; >Symbol.match : Symbol(SymbolConstructor.match, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) @@ -88,7 +88,7 @@ void class B { @x ["property"]: any; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) ->"property" : Symbol(B[["property"]], Decl(decoratorsOnComputedProperties.ts, 25, 14)) +>"property" : Symbol(B["property"], Decl(decoratorsOnComputedProperties.ts, 25, 14)) @x [Symbol.toStringTag]: any; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) @@ -98,7 +98,7 @@ void class B { @x ["property2"]: any = 2; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) ->"property2" : Symbol(B[["property2"]], Decl(decoratorsOnComputedProperties.ts, 27, 33)) +>"property2" : Symbol(B["property2"], Decl(decoratorsOnComputedProperties.ts, 27, 33)) @x [Symbol.iterator]: any = null; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) @@ -107,7 +107,7 @@ void class B { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) ["property3"]: any; ->"property3" : Symbol(B[["property3"]], Decl(decoratorsOnComputedProperties.ts, 29, 37)) +>"property3" : Symbol(B["property3"], Decl(decoratorsOnComputedProperties.ts, 29, 37)) [Symbol.isConcatSpreadable]: any; >Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) @@ -115,7 +115,7 @@ void class B { >isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) ["property4"]: any = 2; ->"property4" : Symbol(B[["property4"]], Decl(decoratorsOnComputedProperties.ts, 31, 37)) +>"property4" : Symbol(B["property4"], Decl(decoratorsOnComputedProperties.ts, 31, 37)) [Symbol.match]: any = null; >Symbol.match : Symbol(SymbolConstructor.match, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) @@ -151,7 +151,7 @@ class C { @x ["property"]: any; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) ->"property" : Symbol(C[["property"]], Decl(decoratorsOnComputedProperties.ts, 42, 9)) +>"property" : Symbol(C["property"], Decl(decoratorsOnComputedProperties.ts, 42, 9)) @x [Symbol.toStringTag]: any; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) @@ -161,7 +161,7 @@ class C { @x ["property2"]: any = 2; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) ->"property2" : Symbol(C[["property2"]], Decl(decoratorsOnComputedProperties.ts, 44, 33)) +>"property2" : Symbol(C["property2"], Decl(decoratorsOnComputedProperties.ts, 44, 33)) @x [Symbol.iterator]: any = null; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) @@ -170,7 +170,7 @@ class C { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) ["property3"]: any; ->"property3" : Symbol(C[["property3"]], Decl(decoratorsOnComputedProperties.ts, 46, 37)) +>"property3" : Symbol(C["property3"], Decl(decoratorsOnComputedProperties.ts, 46, 37)) [Symbol.isConcatSpreadable]: any; >Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) @@ -178,7 +178,7 @@ class C { >isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) ["property4"]: any = 2; ->"property4" : Symbol(C[["property4"]], Decl(decoratorsOnComputedProperties.ts, 48, 37)) +>"property4" : Symbol(C["property4"], Decl(decoratorsOnComputedProperties.ts, 48, 37)) [Symbol.match]: any = null; >Symbol.match : Symbol(SymbolConstructor.match, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) @@ -215,7 +215,7 @@ void class D { @x ["property"]: any; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) ->"property" : Symbol(D[["property"]], Decl(decoratorsOnComputedProperties.ts, 60, 14)) +>"property" : Symbol(D["property"], Decl(decoratorsOnComputedProperties.ts, 60, 14)) @x [Symbol.toStringTag]: any; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) @@ -225,7 +225,7 @@ void class D { @x ["property2"]: any = 2; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) ->"property2" : Symbol(D[["property2"]], Decl(decoratorsOnComputedProperties.ts, 62, 33)) +>"property2" : Symbol(D["property2"], Decl(decoratorsOnComputedProperties.ts, 62, 33)) @x [Symbol.iterator]: any = null; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) @@ -234,7 +234,7 @@ void class D { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) ["property3"]: any; ->"property3" : Symbol(D[["property3"]], Decl(decoratorsOnComputedProperties.ts, 64, 37)) +>"property3" : Symbol(D["property3"], Decl(decoratorsOnComputedProperties.ts, 64, 37)) [Symbol.isConcatSpreadable]: any; >Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) @@ -242,7 +242,7 @@ void class D { >isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) ["property4"]: any = 2; ->"property4" : Symbol(D[["property4"]], Decl(decoratorsOnComputedProperties.ts, 66, 37)) +>"property4" : Symbol(D["property4"], Decl(decoratorsOnComputedProperties.ts, 66, 37)) [Symbol.match]: any = null; >Symbol.match : Symbol(SymbolConstructor.match, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) @@ -279,7 +279,7 @@ class E { @x ["property"]: any; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) ->"property" : Symbol(E[["property"]], Decl(decoratorsOnComputedProperties.ts, 78, 9)) +>"property" : Symbol(E["property"], Decl(decoratorsOnComputedProperties.ts, 78, 9)) @x [Symbol.toStringTag]: any; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) @@ -289,7 +289,7 @@ class E { @x ["property2"]: any = 2; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) ->"property2" : Symbol(E[["property2"]], Decl(decoratorsOnComputedProperties.ts, 80, 33)) +>"property2" : Symbol(E["property2"], Decl(decoratorsOnComputedProperties.ts, 80, 33)) @x [Symbol.iterator]: any = null; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) @@ -298,7 +298,7 @@ class E { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) ["property3"]: any; ->"property3" : Symbol(E[["property3"]], Decl(decoratorsOnComputedProperties.ts, 82, 37)) +>"property3" : Symbol(E["property3"], Decl(decoratorsOnComputedProperties.ts, 82, 37)) [Symbol.isConcatSpreadable]: any; >Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) @@ -306,7 +306,7 @@ class E { >isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) ["property4"]: any = 2; ->"property4" : Symbol(E[["property4"]], Decl(decoratorsOnComputedProperties.ts, 84, 37)) +>"property4" : Symbol(E["property4"], Decl(decoratorsOnComputedProperties.ts, 84, 37)) [Symbol.match]: any = null; >Symbol.match : Symbol(SymbolConstructor.match, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) @@ -342,7 +342,7 @@ void class F { @x ["property"]: any; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) ->"property" : Symbol(F[["property"]], Decl(decoratorsOnComputedProperties.ts, 96, 14)) +>"property" : Symbol(F["property"], Decl(decoratorsOnComputedProperties.ts, 96, 14)) @x [Symbol.toStringTag]: any; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) @@ -352,7 +352,7 @@ void class F { @x ["property2"]: any = 2; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) ->"property2" : Symbol(F[["property2"]], Decl(decoratorsOnComputedProperties.ts, 98, 33)) +>"property2" : Symbol(F["property2"], Decl(decoratorsOnComputedProperties.ts, 98, 33)) @x [Symbol.iterator]: any = null; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) @@ -361,7 +361,7 @@ void class F { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) ["property3"]: any; ->"property3" : Symbol(F[["property3"]], Decl(decoratorsOnComputedProperties.ts, 100, 37)) +>"property3" : Symbol(F["property3"], Decl(decoratorsOnComputedProperties.ts, 100, 37)) [Symbol.isConcatSpreadable]: any; >Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) @@ -369,7 +369,7 @@ void class F { >isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) ["property4"]: any = 2; ->"property4" : Symbol(F[["property4"]], Decl(decoratorsOnComputedProperties.ts, 102, 37)) +>"property4" : Symbol(F["property4"], Decl(decoratorsOnComputedProperties.ts, 102, 37)) [Symbol.match]: any = null; >Symbol.match : Symbol(SymbolConstructor.match, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) @@ -406,7 +406,7 @@ class G { @x ["property"]: any; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) ->"property" : Symbol(G[["property"]], Decl(decoratorsOnComputedProperties.ts, 114, 9)) +>"property" : Symbol(G["property"], Decl(decoratorsOnComputedProperties.ts, 114, 9)) @x [Symbol.toStringTag]: any; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) @@ -416,7 +416,7 @@ class G { @x ["property2"]: any = 2; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) ->"property2" : Symbol(G[["property2"]], Decl(decoratorsOnComputedProperties.ts, 116, 33)) +>"property2" : Symbol(G["property2"], Decl(decoratorsOnComputedProperties.ts, 116, 33)) @x [Symbol.iterator]: any = null; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) @@ -425,7 +425,7 @@ class G { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) ["property3"]: any; ->"property3" : Symbol(G[["property3"]], Decl(decoratorsOnComputedProperties.ts, 118, 37)) +>"property3" : Symbol(G["property3"], Decl(decoratorsOnComputedProperties.ts, 118, 37)) [Symbol.isConcatSpreadable]: any; >Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) @@ -433,7 +433,7 @@ class G { >isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) ["property4"]: any = 2; ->"property4" : Symbol(G[["property4"]], Decl(decoratorsOnComputedProperties.ts, 120, 37)) +>"property4" : Symbol(G["property4"], Decl(decoratorsOnComputedProperties.ts, 120, 37)) [Symbol.match]: any = null; >Symbol.match : Symbol(SymbolConstructor.match, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) @@ -470,7 +470,7 @@ void class H { @x ["property"]: any; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) ->"property" : Symbol(H[["property"]], Decl(decoratorsOnComputedProperties.ts, 133, 14)) +>"property" : Symbol(H["property"], Decl(decoratorsOnComputedProperties.ts, 133, 14)) @x [Symbol.toStringTag]: any; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) @@ -480,7 +480,7 @@ void class H { @x ["property2"]: any = 2; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) ->"property2" : Symbol(H[["property2"]], Decl(decoratorsOnComputedProperties.ts, 135, 33)) +>"property2" : Symbol(H["property2"], Decl(decoratorsOnComputedProperties.ts, 135, 33)) @x [Symbol.iterator]: any = null; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) @@ -489,7 +489,7 @@ void class H { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) ["property3"]: any; ->"property3" : Symbol(H[["property3"]], Decl(decoratorsOnComputedProperties.ts, 137, 37)) +>"property3" : Symbol(H["property3"], Decl(decoratorsOnComputedProperties.ts, 137, 37)) [Symbol.isConcatSpreadable]: any; >Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) @@ -497,7 +497,7 @@ void class H { >isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) ["property4"]: any = 2; ->"property4" : Symbol(H[["property4"]], Decl(decoratorsOnComputedProperties.ts, 139, 37)) +>"property4" : Symbol(H["property4"], Decl(decoratorsOnComputedProperties.ts, 139, 37)) [Symbol.match]: any = null; >Symbol.match : Symbol(SymbolConstructor.match, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) @@ -535,7 +535,7 @@ class I { @x ["property"]: any; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) ->"property" : Symbol(I[["property"]], Decl(decoratorsOnComputedProperties.ts, 152, 9)) +>"property" : Symbol(I["property"], Decl(decoratorsOnComputedProperties.ts, 152, 9)) @x [Symbol.toStringTag]: any; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) @@ -545,7 +545,7 @@ class I { @x ["property2"]: any = 2; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) ->"property2" : Symbol(I[["property2"]], Decl(decoratorsOnComputedProperties.ts, 154, 33)) +>"property2" : Symbol(I["property2"], Decl(decoratorsOnComputedProperties.ts, 154, 33)) @x [Symbol.iterator]: any = null; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) @@ -554,7 +554,7 @@ class I { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) ["property3"]: any; ->"property3" : Symbol(I[["property3"]], Decl(decoratorsOnComputedProperties.ts, 156, 37)) +>"property3" : Symbol(I["property3"], Decl(decoratorsOnComputedProperties.ts, 156, 37)) [Symbol.isConcatSpreadable]: any; >Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) @@ -562,7 +562,7 @@ class I { >isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) ["property4"]: any = 2; ->"property4" : Symbol(I[["property4"]], Decl(decoratorsOnComputedProperties.ts, 158, 37)) +>"property4" : Symbol(I["property4"], Decl(decoratorsOnComputedProperties.ts, 158, 37)) [Symbol.match]: any = null; >Symbol.match : Symbol(SymbolConstructor.match, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) @@ -601,7 +601,7 @@ void class J { @x ["property"]: any; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) ->"property" : Symbol(J[["property"]], Decl(decoratorsOnComputedProperties.ts, 171, 14)) +>"property" : Symbol(J["property"], Decl(decoratorsOnComputedProperties.ts, 171, 14)) @x [Symbol.toStringTag]: any; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) @@ -611,7 +611,7 @@ void class J { @x ["property2"]: any = 2; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) ->"property2" : Symbol(J[["property2"]], Decl(decoratorsOnComputedProperties.ts, 173, 33)) +>"property2" : Symbol(J["property2"], Decl(decoratorsOnComputedProperties.ts, 173, 33)) @x [Symbol.iterator]: any = null; >x : Symbol(x, Decl(decoratorsOnComputedProperties.ts, 0, 0)) @@ -620,7 +620,7 @@ void class J { >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --)) ["property3"]: any; ->"property3" : Symbol(J[["property3"]], Decl(decoratorsOnComputedProperties.ts, 175, 37)) +>"property3" : Symbol(J["property3"], Decl(decoratorsOnComputedProperties.ts, 175, 37)) [Symbol.isConcatSpreadable]: any; >Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) @@ -628,7 +628,7 @@ void class J { >isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) ["property4"]: any = 2; ->"property4" : Symbol(J[["property4"]], Decl(decoratorsOnComputedProperties.ts, 177, 37)) +>"property4" : Symbol(J["property4"], Decl(decoratorsOnComputedProperties.ts, 177, 37)) [Symbol.match]: any = null; >Symbol.match : Symbol(SymbolConstructor.match, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) diff --git a/tests/baselines/reference/duplicateClassElements.errors.txt b/tests/baselines/reference/duplicateClassElements.errors.txt index f30b4a193f131..be7e5a7770d64 100644 --- a/tests/baselines/reference/duplicateClassElements.errors.txt +++ b/tests/baselines/reference/duplicateClassElements.errors.txt @@ -16,7 +16,7 @@ tests/cases/compiler/duplicateClassElements.ts(26,9): error TS2300: Duplicate id tests/cases/compiler/duplicateClassElements.ts(29,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/duplicateClassElements.ts(32,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/duplicateClassElements.ts(34,12): error TS2300: Duplicate identifier 'x2'. -tests/cases/compiler/duplicateClassElements.ts(34,12): error TS2403: Subsequent variable declarations must have the same type. Variable 'x2' has type 'number' at tests/cases/compiler/duplicateClassElements.ts 28:8, but here has type 'any'. +tests/cases/compiler/duplicateClassElements.ts(34,12): error TS2717: Subsequent property declarations must have the same type. Property 'x2' has type 'number' at tests/cases/compiler/duplicateClassElements.ts 28:8, but here has type 'any'. tests/cases/compiler/duplicateClassElements.ts(36,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/duplicateClassElements.ts(36,9): error TS2300: Duplicate identifier 'z2'. tests/cases/compiler/duplicateClassElements.ts(39,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -96,7 +96,7 @@ tests/cases/compiler/duplicateClassElements.ts(41,12): error TS2300: Duplicate i ~~ !!! error TS2300: Duplicate identifier 'x2'. ~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x2' has type 'number' at tests/cases/compiler/duplicateClassElements.ts 28:8, but here has type 'any'. +!!! error TS2717: Subsequent property declarations must have the same type. Property 'x2' has type 'number' at tests/cases/compiler/duplicateClassElements.ts 28:8, but here has type 'any'. get z2() { ~~ diff --git a/tests/baselines/reference/duplicateIdentifierComputedName.symbols b/tests/baselines/reference/duplicateIdentifierComputedName.symbols index 0f5753e0eb6bd..efe01b6a34940 100644 --- a/tests/baselines/reference/duplicateIdentifierComputedName.symbols +++ b/tests/baselines/reference/duplicateIdentifierComputedName.symbols @@ -3,9 +3,9 @@ class C { >C : Symbol(C, Decl(duplicateIdentifierComputedName.ts, 0, 0)) ["a"]: string; ->"a" : Symbol(C[["a"]], Decl(duplicateIdentifierComputedName.ts, 0, 9), Decl(duplicateIdentifierComputedName.ts, 1, 18)) +>"a" : Symbol(C["a"], Decl(duplicateIdentifierComputedName.ts, 0, 9), Decl(duplicateIdentifierComputedName.ts, 1, 18)) ["a"]: string; ->"a" : Symbol(C[["a"]], Decl(duplicateIdentifierComputedName.ts, 0, 9), Decl(duplicateIdentifierComputedName.ts, 1, 18)) +>"a" : Symbol(C["a"], Decl(duplicateIdentifierComputedName.ts, 0, 9), Decl(duplicateIdentifierComputedName.ts, 1, 18)) } diff --git a/tests/baselines/reference/dynamicNames.js b/tests/baselines/reference/dynamicNames.js new file mode 100644 index 0000000000000..6582dab44d47d --- /dev/null +++ b/tests/baselines/reference/dynamicNames.js @@ -0,0 +1,244 @@ +//// [tests/cases/compiler/dynamicNames.ts] //// + +//// [module.ts] +export const c0 = "a"; +export const c1 = 1; +export const s0 = Symbol(); +export interface T0 { + [c0]: number; + [c1]: string; + [s0]: boolean; +} +export declare class T1 implements T2 { + [c0]: number; + [c1]: string; + [s0]: boolean; +} +export declare class T2 extends T1 { +} +export declare type T3 = { + [c0]: number; + [c1]: string; + [s0]: boolean; +}; + +//// [main.ts] +import { c0, c1, s0, T0, T1, T2, T3 } from "./module"; +import * as M from "./module"; + +namespace N { + export const c2 = "a"; + export const c3 = 1; + export const s1: typeof s0 = s0; + + export interface T4 { + [N.c2]: number; + [N.c3]: string; + [N.s1]: boolean; + } + export declare class T5 implements T4 { + [N.c2]: number; + [N.c3]: string; + [N.s1]: boolean; + } + export declare class T6 extends T5 { + } + export declare type T7 = { + [N.c2]: number; + [N.c3]: string; + [N.s1]: boolean; + }; +} + +export const c4 = "a"; +export const c5 = 1; +export const s2: typeof s0 = s0; + +interface T8 { + [c4]: number; + [c5]: string; + [s2]: boolean; +} +declare class T9 implements T8 { + [c4]: number; + [c5]: string; + [s2]: boolean; +} +declare class T10 extends T9 { +} +declare type T11 = { + [c4]: number; + [c5]: string; + [s2]: boolean; +}; + +interface T12 { + a: number; + 1: string; + [s2]: boolean; +} +declare class T13 implements T2 { + a: number; + 1: string; + [s2]: boolean; +} +declare class T14 extends T13 { +} +declare type T15 = { + a: number; + 1: string; + [s2]: boolean; +}; + +declare class C { + static a: number; + static 1: string; + static [s2]: boolean; +} + +let t0: T0; +let t1: T1; +let t2: T2; +let t3: T3; +let t0_1: M.T0; +let t1_1: M.T1; +let t2_1: M.T2; +let t3_1: M.T3; +let t4: N.T4; +let t5: N.T5; +let t6: N.T6; +let t7: N.T7; +let t8: T8; +let t9: T9; +let t10: T10; +let t11: T11; +let t12: T12; +let t13: T13; +let t14: T14; +let t15: T15; + +// assignability +t0 = t1, t0 = t2, t0 = t3, t1 = t0, t1 = t2, t1 = t3, t2 = t0, t2 = t1, t2 = t3, t3 = t0, t3 = t1, t3 = t2; +t4 = t5, t4 = t6, t4 = t7, t5 = t4, t5 = t6, t5 = t7, t6 = t4, t6 = t5, t6 = t7, t7 = t4, t7 = t5, t7 = t6; +t0 = t12, t0 = t13, t0 = t14, t0 = t15, t12 = t0, t13 = t0, t14 = t0, t15 = t0; +t0 = C; // static side + +// object literals +export const o1 = { + [c4]: 1, + [c5]: "a", + [s2]: true +}; + +// check element access types +export const o1_c4 = o1[c4]; +export const o1_c5 = o1[c5]; +export const o1_s2 = o1[s2]; + +export const o2: T0 = o1; + +// recursive declarations +declare const rI: RI; +interface RI { + x: "a"; + [rI.x]: "b"; +} + +declare const rC: RC; +declare class RC { + x: "a"; + [rC.x]: "b"; +} + +//// [module.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.c0 = "a"; +exports.c1 = 1; +exports.s0 = Symbol(); +//// [main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const module_1 = require("./module"); +var N; +(function (N) { + N.c2 = "a"; + N.c3 = 1; + N.s1 = module_1.s0; +})(N || (N = {})); +exports.c4 = "a"; +exports.c5 = 1; +exports.s2 = module_1.s0; +let t0; +let t1; +let t2; +let t3; +let t0_1; +let t1_1; +let t2_1; +let t3_1; +let t4; +let t5; +let t6; +let t7; +let t8; +let t9; +let t10; +let t11; +let t12; +let t13; +let t14; +let t15; +// assignability +t0 = t1, t0 = t2, t0 = t3, t1 = t0, t1 = t2, t1 = t3, t2 = t0, t2 = t1, t2 = t3, t3 = t0, t3 = t1, t3 = t2; +t4 = t5, t4 = t6, t4 = t7, t5 = t4, t5 = t6, t5 = t7, t6 = t4, t6 = t5, t6 = t7, t7 = t4, t7 = t5, t7 = t6; +t0 = t12, t0 = t13, t0 = t14, t0 = t15, t12 = t0, t13 = t0, t14 = t0, t15 = t0; +t0 = C; // static side +// object literals +exports.o1 = { + [exports.c4]: 1, + [exports.c5]: "a", + [exports.s2]: true +}; +// check element access types +exports.o1_c4 = exports.o1[exports.c4]; +exports.o1_c5 = exports.o1[exports.c5]; +exports.o1_s2 = exports.o1[exports.s2]; +exports.o2 = exports.o1; + + +//// [module.d.ts] +export declare const c0 = "a"; +export declare const c1 = 1; +export declare const s0: unique symbol; +export interface T0 { + [c0]: number; + [c1]: string; + [s0]: boolean; +} +export declare class T1 implements T2 { + [c0]: number; + [c1]: string; + [s0]: boolean; +} +export declare class T2 extends T1 { +} +export declare type T3 = { + [c0]: number; + [c1]: string; + [s0]: boolean; +}; +//// [main.d.ts] +import { s0, T0 } from "./module"; +export declare const c4 = "a"; +export declare const c5 = 1; +export declare const s2: typeof s0; +export declare const o1: { + [c4]: number; + [c5]: string; + [s2]: boolean; +}; +export declare const o1_c4: number; +export declare const o1_c5: string; +export declare const o1_s2: boolean; +export declare const o2: T0; diff --git a/tests/baselines/reference/dynamicNames.symbols b/tests/baselines/reference/dynamicNames.symbols new file mode 100644 index 0000000000000..e030a9686e5e0 --- /dev/null +++ b/tests/baselines/reference/dynamicNames.symbols @@ -0,0 +1,476 @@ +=== tests/cases/compiler/module.ts === +export const c0 = "a"; +>c0 : Symbol(c0, Decl(module.ts, 0, 12)) + +export const c1 = 1; +>c1 : Symbol(c1, Decl(module.ts, 1, 12)) + +export const s0 = Symbol(); +>s0 : Symbol(s0, Decl(module.ts, 2, 12)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) + +export interface T0 { +>T0 : Symbol(T0, Decl(module.ts, 2, 27)) + + [c0]: number; +>c0 : Symbol(c0, Decl(module.ts, 0, 12)) + + [c1]: string; +>c1 : Symbol(c1, Decl(module.ts, 1, 12)) + + [s0]: boolean; +>s0 : Symbol(s0, Decl(module.ts, 2, 12)) +} +export declare class T1 implements T2 { +>T1 : Symbol(T1, Decl(module.ts, 7, 1)) +>T2 : Symbol(T2, Decl(module.ts, 12, 1)) + + [c0]: number; +>c0 : Symbol(c0, Decl(module.ts, 0, 12)) + + [c1]: string; +>c1 : Symbol(c1, Decl(module.ts, 1, 12)) + + [s0]: boolean; +>s0 : Symbol(s0, Decl(module.ts, 2, 12)) +} +export declare class T2 extends T1 { +>T2 : Symbol(T2, Decl(module.ts, 12, 1)) +>T1 : Symbol(T1, Decl(module.ts, 7, 1)) +} +export declare type T3 = { +>T3 : Symbol(T3, Decl(module.ts, 14, 1)) + + [c0]: number; +>c0 : Symbol(c0, Decl(module.ts, 0, 12)) + + [c1]: string; +>c1 : Symbol(c1, Decl(module.ts, 1, 12)) + + [s0]: boolean; +>s0 : Symbol(s0, Decl(module.ts, 2, 12)) + +}; + +=== tests/cases/compiler/main.ts === +import { c0, c1, s0, T0, T1, T2, T3 } from "./module"; +>c0 : Symbol(c0, Decl(main.ts, 0, 8)) +>c1 : Symbol(c1, Decl(main.ts, 0, 12)) +>s0 : Symbol(s0, Decl(main.ts, 0, 16)) +>T0 : Symbol(T0, Decl(main.ts, 0, 20)) +>T1 : Symbol(T1, Decl(main.ts, 0, 24)) +>T2 : Symbol(T2, Decl(main.ts, 0, 28)) +>T3 : Symbol(T3, Decl(main.ts, 0, 32)) + +import * as M from "./module"; +>M : Symbol(M, Decl(main.ts, 1, 6)) + +namespace N { +>N : Symbol(N, Decl(main.ts, 1, 30)) + + export const c2 = "a"; +>c2 : Symbol(c2, Decl(main.ts, 4, 16)) + + export const c3 = 1; +>c3 : Symbol(c3, Decl(main.ts, 5, 16)) + + export const s1: typeof s0 = s0; +>s1 : Symbol(s1, Decl(main.ts, 6, 16)) +>s0 : Symbol(s0, Decl(main.ts, 0, 16)) +>s0 : Symbol(s0, Decl(main.ts, 0, 16)) + + export interface T4 { +>T4 : Symbol(T4, Decl(main.ts, 6, 36)) + + [N.c2]: number; +>N.c2 : Symbol(c2, Decl(main.ts, 4, 16)) +>N : Symbol(N, Decl(main.ts, 1, 30)) +>c2 : Symbol(c2, Decl(main.ts, 4, 16)) + + [N.c3]: string; +>N.c3 : Symbol(c3, Decl(main.ts, 5, 16)) +>N : Symbol(N, Decl(main.ts, 1, 30)) +>c3 : Symbol(c3, Decl(main.ts, 5, 16)) + + [N.s1]: boolean; +>N.s1 : Symbol(s1, Decl(main.ts, 6, 16)) +>N : Symbol(N, Decl(main.ts, 1, 30)) +>s1 : Symbol(s1, Decl(main.ts, 6, 16)) + } + export declare class T5 implements T4 { +>T5 : Symbol(T5, Decl(main.ts, 12, 5)) +>T4 : Symbol(T4, Decl(main.ts, 6, 36)) + + [N.c2]: number; +>N.c2 : Symbol(c2, Decl(main.ts, 4, 16)) +>N : Symbol(N, Decl(main.ts, 1, 30)) +>c2 : Symbol(c2, Decl(main.ts, 4, 16)) + + [N.c3]: string; +>N.c3 : Symbol(c3, Decl(main.ts, 5, 16)) +>N : Symbol(N, Decl(main.ts, 1, 30)) +>c3 : Symbol(c3, Decl(main.ts, 5, 16)) + + [N.s1]: boolean; +>N.s1 : Symbol(s1, Decl(main.ts, 6, 16)) +>N : Symbol(N, Decl(main.ts, 1, 30)) +>s1 : Symbol(s1, Decl(main.ts, 6, 16)) + } + export declare class T6 extends T5 { +>T6 : Symbol(T6, Decl(main.ts, 17, 5)) +>T5 : Symbol(T5, Decl(main.ts, 12, 5)) + } + export declare type T7 = { +>T7 : Symbol(T7, Decl(main.ts, 19, 5)) + + [N.c2]: number; +>N.c2 : Symbol(c2, Decl(main.ts, 4, 16)) +>N : Symbol(N, Decl(main.ts, 1, 30)) +>c2 : Symbol(c2, Decl(main.ts, 4, 16)) + + [N.c3]: string; +>N.c3 : Symbol(c3, Decl(main.ts, 5, 16)) +>N : Symbol(N, Decl(main.ts, 1, 30)) +>c3 : Symbol(c3, Decl(main.ts, 5, 16)) + + [N.s1]: boolean; +>N.s1 : Symbol(s1, Decl(main.ts, 6, 16)) +>N : Symbol(N, Decl(main.ts, 1, 30)) +>s1 : Symbol(s1, Decl(main.ts, 6, 16)) + + }; +} + +export const c4 = "a"; +>c4 : Symbol(c4, Decl(main.ts, 27, 12)) + +export const c5 = 1; +>c5 : Symbol(c5, Decl(main.ts, 28, 12)) + +export const s2: typeof s0 = s0; +>s2 : Symbol(s2, Decl(main.ts, 29, 12)) +>s0 : Symbol(s0, Decl(main.ts, 0, 16)) +>s0 : Symbol(s0, Decl(main.ts, 0, 16)) + +interface T8 { +>T8 : Symbol(T8, Decl(main.ts, 29, 32)) + + [c4]: number; +>c4 : Symbol(c4, Decl(main.ts, 27, 12)) + + [c5]: string; +>c5 : Symbol(c5, Decl(main.ts, 28, 12)) + + [s2]: boolean; +>s2 : Symbol(s2, Decl(main.ts, 29, 12)) +} +declare class T9 implements T8 { +>T9 : Symbol(T9, Decl(main.ts, 35, 1)) +>T8 : Symbol(T8, Decl(main.ts, 29, 32)) + + [c4]: number; +>c4 : Symbol(c4, Decl(main.ts, 27, 12)) + + [c5]: string; +>c5 : Symbol(c5, Decl(main.ts, 28, 12)) + + [s2]: boolean; +>s2 : Symbol(s2, Decl(main.ts, 29, 12)) +} +declare class T10 extends T9 { +>T10 : Symbol(T10, Decl(main.ts, 40, 1)) +>T9 : Symbol(T9, Decl(main.ts, 35, 1)) +} +declare type T11 = { +>T11 : Symbol(T11, Decl(main.ts, 42, 1)) + + [c4]: number; +>c4 : Symbol(c4, Decl(main.ts, 27, 12)) + + [c5]: string; +>c5 : Symbol(c5, Decl(main.ts, 28, 12)) + + [s2]: boolean; +>s2 : Symbol(s2, Decl(main.ts, 29, 12)) + +}; + +interface T12 { +>T12 : Symbol(T12, Decl(main.ts, 47, 2)) + + a: number; +>a : Symbol(T12.a, Decl(main.ts, 49, 15)) + + 1: string; + [s2]: boolean; +>s2 : Symbol(s2, Decl(main.ts, 29, 12)) +} +declare class T13 implements T2 { +>T13 : Symbol(T13, Decl(main.ts, 53, 1)) +>T2 : Symbol(T2, Decl(main.ts, 0, 28)) + + a: number; +>a : Symbol(T13.a, Decl(main.ts, 54, 33)) + + 1: string; + [s2]: boolean; +>s2 : Symbol(s2, Decl(main.ts, 29, 12)) +} +declare class T14 extends T13 { +>T14 : Symbol(T14, Decl(main.ts, 58, 1)) +>T13 : Symbol(T13, Decl(main.ts, 53, 1)) +} +declare type T15 = { +>T15 : Symbol(T15, Decl(main.ts, 60, 1)) + + a: number; +>a : Symbol(a, Decl(main.ts, 61, 20)) + + 1: string; + [s2]: boolean; +>s2 : Symbol(s2, Decl(main.ts, 29, 12)) + +}; + +declare class C { +>C : Symbol(C, Decl(main.ts, 65, 2)) + + static a: number; +>a : Symbol(C.a, Decl(main.ts, 67, 17)) + + static 1: string; + static [s2]: boolean; +>s2 : Symbol(s2, Decl(main.ts, 29, 12)) +} + +let t0: T0; +>t0 : Symbol(t0, Decl(main.ts, 73, 3)) +>T0 : Symbol(T0, Decl(main.ts, 0, 20)) + +let t1: T1; +>t1 : Symbol(t1, Decl(main.ts, 74, 3)) +>T1 : Symbol(T1, Decl(main.ts, 0, 24)) + +let t2: T2; +>t2 : Symbol(t2, Decl(main.ts, 75, 3)) +>T2 : Symbol(T2, Decl(main.ts, 0, 28)) + +let t3: T3; +>t3 : Symbol(t3, Decl(main.ts, 76, 3)) +>T3 : Symbol(T3, Decl(main.ts, 0, 32)) + +let t0_1: M.T0; +>t0_1 : Symbol(t0_1, Decl(main.ts, 77, 3)) +>M : Symbol(M, Decl(main.ts, 1, 6)) +>T0 : Symbol(T0, Decl(module.ts, 2, 27)) + +let t1_1: M.T1; +>t1_1 : Symbol(t1_1, Decl(main.ts, 78, 3)) +>M : Symbol(M, Decl(main.ts, 1, 6)) +>T1 : Symbol(T1, Decl(module.ts, 7, 1)) + +let t2_1: M.T2; +>t2_1 : Symbol(t2_1, Decl(main.ts, 79, 3)) +>M : Symbol(M, Decl(main.ts, 1, 6)) +>T2 : Symbol(T2, Decl(module.ts, 12, 1)) + +let t3_1: M.T3; +>t3_1 : Symbol(t3_1, Decl(main.ts, 80, 3)) +>M : Symbol(M, Decl(main.ts, 1, 6)) +>T3 : Symbol(T3, Decl(module.ts, 14, 1)) + +let t4: N.T4; +>t4 : Symbol(t4, Decl(main.ts, 81, 3)) +>N : Symbol(N, Decl(main.ts, 1, 30)) +>T4 : Symbol(N.T4, Decl(main.ts, 6, 36)) + +let t5: N.T5; +>t5 : Symbol(t5, Decl(main.ts, 82, 3)) +>N : Symbol(N, Decl(main.ts, 1, 30)) +>T5 : Symbol(N.T5, Decl(main.ts, 12, 5)) + +let t6: N.T6; +>t6 : Symbol(t6, Decl(main.ts, 83, 3)) +>N : Symbol(N, Decl(main.ts, 1, 30)) +>T6 : Symbol(N.T6, Decl(main.ts, 17, 5)) + +let t7: N.T7; +>t7 : Symbol(t7, Decl(main.ts, 84, 3)) +>N : Symbol(N, Decl(main.ts, 1, 30)) +>T7 : Symbol(N.T7, Decl(main.ts, 19, 5)) + +let t8: T8; +>t8 : Symbol(t8, Decl(main.ts, 85, 3)) +>T8 : Symbol(T8, Decl(main.ts, 29, 32)) + +let t9: T9; +>t9 : Symbol(t9, Decl(main.ts, 86, 3)) +>T9 : Symbol(T9, Decl(main.ts, 35, 1)) + +let t10: T10; +>t10 : Symbol(t10, Decl(main.ts, 87, 3)) +>T10 : Symbol(T10, Decl(main.ts, 40, 1)) + +let t11: T11; +>t11 : Symbol(t11, Decl(main.ts, 88, 3)) +>T11 : Symbol(T11, Decl(main.ts, 42, 1)) + +let t12: T12; +>t12 : Symbol(t12, Decl(main.ts, 89, 3)) +>T12 : Symbol(T12, Decl(main.ts, 47, 2)) + +let t13: T13; +>t13 : Symbol(t13, Decl(main.ts, 90, 3)) +>T13 : Symbol(T13, Decl(main.ts, 53, 1)) + +let t14: T14; +>t14 : Symbol(t14, Decl(main.ts, 91, 3)) +>T14 : Symbol(T14, Decl(main.ts, 58, 1)) + +let t15: T15; +>t15 : Symbol(t15, Decl(main.ts, 92, 3)) +>T15 : Symbol(T15, Decl(main.ts, 60, 1)) + +// assignability +t0 = t1, t0 = t2, t0 = t3, t1 = t0, t1 = t2, t1 = t3, t2 = t0, t2 = t1, t2 = t3, t3 = t0, t3 = t1, t3 = t2; +>t0 : Symbol(t0, Decl(main.ts, 73, 3)) +>t1 : Symbol(t1, Decl(main.ts, 74, 3)) +>t0 : Symbol(t0, Decl(main.ts, 73, 3)) +>t2 : Symbol(t2, Decl(main.ts, 75, 3)) +>t0 : Symbol(t0, Decl(main.ts, 73, 3)) +>t3 : Symbol(t3, Decl(main.ts, 76, 3)) +>t1 : Symbol(t1, Decl(main.ts, 74, 3)) +>t0 : Symbol(t0, Decl(main.ts, 73, 3)) +>t1 : Symbol(t1, Decl(main.ts, 74, 3)) +>t2 : Symbol(t2, Decl(main.ts, 75, 3)) +>t1 : Symbol(t1, Decl(main.ts, 74, 3)) +>t3 : Symbol(t3, Decl(main.ts, 76, 3)) +>t2 : Symbol(t2, Decl(main.ts, 75, 3)) +>t0 : Symbol(t0, Decl(main.ts, 73, 3)) +>t2 : Symbol(t2, Decl(main.ts, 75, 3)) +>t1 : Symbol(t1, Decl(main.ts, 74, 3)) +>t2 : Symbol(t2, Decl(main.ts, 75, 3)) +>t3 : Symbol(t3, Decl(main.ts, 76, 3)) +>t3 : Symbol(t3, Decl(main.ts, 76, 3)) +>t0 : Symbol(t0, Decl(main.ts, 73, 3)) +>t3 : Symbol(t3, Decl(main.ts, 76, 3)) +>t1 : Symbol(t1, Decl(main.ts, 74, 3)) +>t3 : Symbol(t3, Decl(main.ts, 76, 3)) +>t2 : Symbol(t2, Decl(main.ts, 75, 3)) + +t4 = t5, t4 = t6, t4 = t7, t5 = t4, t5 = t6, t5 = t7, t6 = t4, t6 = t5, t6 = t7, t7 = t4, t7 = t5, t7 = t6; +>t4 : Symbol(t4, Decl(main.ts, 81, 3)) +>t5 : Symbol(t5, Decl(main.ts, 82, 3)) +>t4 : Symbol(t4, Decl(main.ts, 81, 3)) +>t6 : Symbol(t6, Decl(main.ts, 83, 3)) +>t4 : Symbol(t4, Decl(main.ts, 81, 3)) +>t7 : Symbol(t7, Decl(main.ts, 84, 3)) +>t5 : Symbol(t5, Decl(main.ts, 82, 3)) +>t4 : Symbol(t4, Decl(main.ts, 81, 3)) +>t5 : Symbol(t5, Decl(main.ts, 82, 3)) +>t6 : Symbol(t6, Decl(main.ts, 83, 3)) +>t5 : Symbol(t5, Decl(main.ts, 82, 3)) +>t7 : Symbol(t7, Decl(main.ts, 84, 3)) +>t6 : Symbol(t6, Decl(main.ts, 83, 3)) +>t4 : Symbol(t4, Decl(main.ts, 81, 3)) +>t6 : Symbol(t6, Decl(main.ts, 83, 3)) +>t5 : Symbol(t5, Decl(main.ts, 82, 3)) +>t6 : Symbol(t6, Decl(main.ts, 83, 3)) +>t7 : Symbol(t7, Decl(main.ts, 84, 3)) +>t7 : Symbol(t7, Decl(main.ts, 84, 3)) +>t4 : Symbol(t4, Decl(main.ts, 81, 3)) +>t7 : Symbol(t7, Decl(main.ts, 84, 3)) +>t5 : Symbol(t5, Decl(main.ts, 82, 3)) +>t7 : Symbol(t7, Decl(main.ts, 84, 3)) +>t6 : Symbol(t6, Decl(main.ts, 83, 3)) + +t0 = t12, t0 = t13, t0 = t14, t0 = t15, t12 = t0, t13 = t0, t14 = t0, t15 = t0; +>t0 : Symbol(t0, Decl(main.ts, 73, 3)) +>t12 : Symbol(t12, Decl(main.ts, 89, 3)) +>t0 : Symbol(t0, Decl(main.ts, 73, 3)) +>t13 : Symbol(t13, Decl(main.ts, 90, 3)) +>t0 : Symbol(t0, Decl(main.ts, 73, 3)) +>t14 : Symbol(t14, Decl(main.ts, 91, 3)) +>t0 : Symbol(t0, Decl(main.ts, 73, 3)) +>t15 : Symbol(t15, Decl(main.ts, 92, 3)) +>t12 : Symbol(t12, Decl(main.ts, 89, 3)) +>t0 : Symbol(t0, Decl(main.ts, 73, 3)) +>t13 : Symbol(t13, Decl(main.ts, 90, 3)) +>t0 : Symbol(t0, Decl(main.ts, 73, 3)) +>t14 : Symbol(t14, Decl(main.ts, 91, 3)) +>t0 : Symbol(t0, Decl(main.ts, 73, 3)) +>t15 : Symbol(t15, Decl(main.ts, 92, 3)) +>t0 : Symbol(t0, Decl(main.ts, 73, 3)) + +t0 = C; // static side +>t0 : Symbol(t0, Decl(main.ts, 73, 3)) +>C : Symbol(C, Decl(main.ts, 65, 2)) + +// object literals +export const o1 = { +>o1 : Symbol(o1, Decl(main.ts, 101, 12)) + + [c4]: 1, +>c4 : Symbol(c4, Decl(main.ts, 27, 12)) + + [c5]: "a", +>c5 : Symbol(c5, Decl(main.ts, 28, 12)) + + [s2]: true +>s2 : Symbol(s2, Decl(main.ts, 29, 12)) + +}; + +// check element access types +export const o1_c4 = o1[c4]; +>o1_c4 : Symbol(o1_c4, Decl(main.ts, 108, 12)) +>o1 : Symbol(o1, Decl(main.ts, 101, 12)) +>c4 : Symbol(c4, Decl(main.ts, 27, 12)) + +export const o1_c5 = o1[c5]; +>o1_c5 : Symbol(o1_c5, Decl(main.ts, 109, 12)) +>o1 : Symbol(o1, Decl(main.ts, 101, 12)) +>c5 : Symbol(c5, Decl(main.ts, 28, 12)) + +export const o1_s2 = o1[s2]; +>o1_s2 : Symbol(o1_s2, Decl(main.ts, 110, 12)) +>o1 : Symbol(o1, Decl(main.ts, 101, 12)) +>s2 : Symbol(s2, Decl(main.ts, 29, 12)) + +export const o2: T0 = o1; +>o2 : Symbol(o2, Decl(main.ts, 112, 12)) +>T0 : Symbol(T0, Decl(main.ts, 0, 20)) +>o1 : Symbol(o1, Decl(main.ts, 101, 12)) + +// recursive declarations +declare const rI: RI; +>rI : Symbol(rI, Decl(main.ts, 115, 13)) +>RI : Symbol(RI, Decl(main.ts, 115, 21)) + +interface RI { +>RI : Symbol(RI, Decl(main.ts, 115, 21)) + + x: "a"; +>x : Symbol(RI.x, Decl(main.ts, 116, 14)) + + [rI.x]: "b"; +>rI.x : Symbol(RI.x, Decl(main.ts, 116, 14)) +>rI : Symbol(rI, Decl(main.ts, 115, 13)) +>x : Symbol(RI.x, Decl(main.ts, 116, 14)) +} + +declare const rC: RC; +>rC : Symbol(rC, Decl(main.ts, 121, 13)) +>RC : Symbol(RC, Decl(main.ts, 121, 21)) + +declare class RC { +>RC : Symbol(RC, Decl(main.ts, 121, 21)) + + x: "a"; +>x : Symbol(RC.x, Decl(main.ts, 122, 18)) + + [rC.x]: "b"; +>rC.x : Symbol(RC.x, Decl(main.ts, 122, 18)) +>rC : Symbol(rC, Decl(main.ts, 121, 13)) +>x : Symbol(RC.x, Decl(main.ts, 122, 18)) +} diff --git a/tests/baselines/reference/dynamicNames.types b/tests/baselines/reference/dynamicNames.types new file mode 100644 index 0000000000000..b2125d673069c --- /dev/null +++ b/tests/baselines/reference/dynamicNames.types @@ -0,0 +1,552 @@ +=== tests/cases/compiler/module.ts === +export const c0 = "a"; +>c0 : "a" +>"a" : "a" + +export const c1 = 1; +>c1 : 1 +>1 : 1 + +export const s0 = Symbol(); +>s0 : unique symbol +>Symbol() : unique symbol +>Symbol : SymbolConstructor + +export interface T0 { +>T0 : T0 + + [c0]: number; +>c0 : "a" + + [c1]: string; +>c1 : 1 + + [s0]: boolean; +>s0 : unique symbol +} +export declare class T1 implements T2 { +>T1 : T1 +>T2 : T2 + + [c0]: number; +>c0 : "a" + + [c1]: string; +>c1 : 1 + + [s0]: boolean; +>s0 : unique symbol +} +export declare class T2 extends T1 { +>T2 : T2 +>T1 : T1 +} +export declare type T3 = { +>T3 : T3 + + [c0]: number; +>c0 : "a" + + [c1]: string; +>c1 : 1 + + [s0]: boolean; +>s0 : unique symbol + +}; + +=== tests/cases/compiler/main.ts === +import { c0, c1, s0, T0, T1, T2, T3 } from "./module"; +>c0 : "a" +>c1 : 1 +>s0 : unique symbol +>T0 : any +>T1 : typeof T1 +>T2 : typeof T2 +>T3 : any + +import * as M from "./module"; +>M : typeof M + +namespace N { +>N : typeof N + + export const c2 = "a"; +>c2 : "a" +>"a" : "a" + + export const c3 = 1; +>c3 : 1 +>1 : 1 + + export const s1: typeof s0 = s0; +>s1 : unique symbol +>s0 : unique symbol +>s0 : unique symbol + + export interface T4 { +>T4 : T4 + + [N.c2]: number; +>N.c2 : "a" +>N : typeof N +>c2 : "a" + + [N.c3]: string; +>N.c3 : 1 +>N : typeof N +>c3 : 1 + + [N.s1]: boolean; +>N.s1 : unique symbol +>N : typeof N +>s1 : unique symbol + } + export declare class T5 implements T4 { +>T5 : T5 +>T4 : T4 + + [N.c2]: number; +>N.c2 : "a" +>N : typeof N +>c2 : "a" + + [N.c3]: string; +>N.c3 : 1 +>N : typeof N +>c3 : 1 + + [N.s1]: boolean; +>N.s1 : unique symbol +>N : typeof N +>s1 : unique symbol + } + export declare class T6 extends T5 { +>T6 : T6 +>T5 : T5 + } + export declare type T7 = { +>T7 : { [N.c2]: number; [N.c3]: string; [N.s1]: boolean; } + + [N.c2]: number; +>N.c2 : "a" +>N : typeof N +>c2 : "a" + + [N.c3]: string; +>N.c3 : 1 +>N : typeof N +>c3 : 1 + + [N.s1]: boolean; +>N.s1 : unique symbol +>N : typeof N +>s1 : unique symbol + + }; +} + +export const c4 = "a"; +>c4 : "a" +>"a" : "a" + +export const c5 = 1; +>c5 : 1 +>1 : 1 + +export const s2: typeof s0 = s0; +>s2 : unique symbol +>s0 : unique symbol +>s0 : unique symbol + +interface T8 { +>T8 : T8 + + [c4]: number; +>c4 : "a" + + [c5]: string; +>c5 : 1 + + [s2]: boolean; +>s2 : unique symbol +} +declare class T9 implements T8 { +>T9 : T9 +>T8 : T8 + + [c4]: number; +>c4 : "a" + + [c5]: string; +>c5 : 1 + + [s2]: boolean; +>s2 : unique symbol +} +declare class T10 extends T9 { +>T10 : T10 +>T9 : T9 +} +declare type T11 = { +>T11 : { [c4]: number; [c5]: string; [s2]: boolean; } + + [c4]: number; +>c4 : "a" + + [c5]: string; +>c5 : 1 + + [s2]: boolean; +>s2 : unique symbol + +}; + +interface T12 { +>T12 : T12 + + a: number; +>a : number + + 1: string; + [s2]: boolean; +>s2 : unique symbol +} +declare class T13 implements T2 { +>T13 : T13 +>T2 : T2 + + a: number; +>a : number + + 1: string; + [s2]: boolean; +>s2 : unique symbol +} +declare class T14 extends T13 { +>T14 : T14 +>T13 : T13 +} +declare type T15 = { +>T15 : { a: number; 1: string; [s2]: boolean; } + + a: number; +>a : number + + 1: string; + [s2]: boolean; +>s2 : unique symbol + +}; + +declare class C { +>C : C + + static a: number; +>a : number + + static 1: string; + static [s2]: boolean; +>s2 : unique symbol +} + +let t0: T0; +>t0 : T0 +>T0 : T0 + +let t1: T1; +>t1 : T1 +>T1 : T1 + +let t2: T2; +>t2 : T2 +>T2 : T2 + +let t3: T3; +>t3 : T3 +>T3 : T3 + +let t0_1: M.T0; +>t0_1 : T0 +>M : any +>T0 : T0 + +let t1_1: M.T1; +>t1_1 : T1 +>M : any +>T1 : T1 + +let t2_1: M.T2; +>t2_1 : T2 +>M : any +>T2 : T2 + +let t3_1: M.T3; +>t3_1 : T3 +>M : any +>T3 : T3 + +let t4: N.T4; +>t4 : N.T4 +>N : any +>T4 : N.T4 + +let t5: N.T5; +>t5 : N.T5 +>N : any +>T5 : N.T5 + +let t6: N.T6; +>t6 : N.T6 +>N : any +>T6 : N.T6 + +let t7: N.T7; +>t7 : { [N.c2]: number; [N.c3]: string; [N.s1]: boolean; } +>N : any +>T7 : { [N.c2]: number; [N.c3]: string; [N.s1]: boolean; } + +let t8: T8; +>t8 : T8 +>T8 : T8 + +let t9: T9; +>t9 : T9 +>T9 : T9 + +let t10: T10; +>t10 : T10 +>T10 : T10 + +let t11: T11; +>t11 : { [c4]: number; [c5]: string; [s2]: boolean; } +>T11 : { [c4]: number; [c5]: string; [s2]: boolean; } + +let t12: T12; +>t12 : T12 +>T12 : T12 + +let t13: T13; +>t13 : T13 +>T13 : T13 + +let t14: T14; +>t14 : T14 +>T14 : T14 + +let t15: T15; +>t15 : { a: number; 1: string; [s2]: boolean; } +>T15 : { a: number; 1: string; [s2]: boolean; } + +// assignability +t0 = t1, t0 = t2, t0 = t3, t1 = t0, t1 = t2, t1 = t3, t2 = t0, t2 = t1, t2 = t3, t3 = t0, t3 = t1, t3 = t2; +>t0 = t1, t0 = t2, t0 = t3, t1 = t0, t1 = t2, t1 = t3, t2 = t0, t2 = t1, t2 = t3, t3 = t0, t3 = t1, t3 = t2 : T2 +>t0 = t1, t0 = t2, t0 = t3, t1 = t0, t1 = t2, t1 = t3, t2 = t0, t2 = t1, t2 = t3, t3 = t0, t3 = t1 : T1 +>t0 = t1, t0 = t2, t0 = t3, t1 = t0, t1 = t2, t1 = t3, t2 = t0, t2 = t1, t2 = t3, t3 = t0 : T0 +>t0 = t1, t0 = t2, t0 = t3, t1 = t0, t1 = t2, t1 = t3, t2 = t0, t2 = t1, t2 = t3 : T3 +>t0 = t1, t0 = t2, t0 = t3, t1 = t0, t1 = t2, t1 = t3, t2 = t0, t2 = t1 : T1 +>t0 = t1, t0 = t2, t0 = t3, t1 = t0, t1 = t2, t1 = t3, t2 = t0 : T0 +>t0 = t1, t0 = t2, t0 = t3, t1 = t0, t1 = t2, t1 = t3 : T3 +>t0 = t1, t0 = t2, t0 = t3, t1 = t0, t1 = t2 : T2 +>t0 = t1, t0 = t2, t0 = t3, t1 = t0 : T0 +>t0 = t1, t0 = t2, t0 = t3 : T3 +>t0 = t1, t0 = t2 : T2 +>t0 = t1 : T1 +>t0 : T0 +>t1 : T1 +>t0 = t2 : T2 +>t0 : T0 +>t2 : T2 +>t0 = t3 : T3 +>t0 : T0 +>t3 : T3 +>t1 = t0 : T0 +>t1 : T1 +>t0 : T0 +>t1 = t2 : T2 +>t1 : T1 +>t2 : T2 +>t1 = t3 : T3 +>t1 : T1 +>t3 : T3 +>t2 = t0 : T0 +>t2 : T2 +>t0 : T0 +>t2 = t1 : T1 +>t2 : T2 +>t1 : T1 +>t2 = t3 : T3 +>t2 : T2 +>t3 : T3 +>t3 = t0 : T0 +>t3 : T3 +>t0 : T0 +>t3 = t1 : T1 +>t3 : T3 +>t1 : T1 +>t3 = t2 : T2 +>t3 : T3 +>t2 : T2 + +t4 = t5, t4 = t6, t4 = t7, t5 = t4, t5 = t6, t5 = t7, t6 = t4, t6 = t5, t6 = t7, t7 = t4, t7 = t5, t7 = t6; +>t4 = t5, t4 = t6, t4 = t7, t5 = t4, t5 = t6, t5 = t7, t6 = t4, t6 = t5, t6 = t7, t7 = t4, t7 = t5, t7 = t6 : N.T6 +>t4 = t5, t4 = t6, t4 = t7, t5 = t4, t5 = t6, t5 = t7, t6 = t4, t6 = t5, t6 = t7, t7 = t4, t7 = t5 : N.T5 +>t4 = t5, t4 = t6, t4 = t7, t5 = t4, t5 = t6, t5 = t7, t6 = t4, t6 = t5, t6 = t7, t7 = t4 : N.T4 +>t4 = t5, t4 = t6, t4 = t7, t5 = t4, t5 = t6, t5 = t7, t6 = t4, t6 = t5, t6 = t7 : { [N.c2]: number; [N.c3]: string; [N.s1]: boolean; } +>t4 = t5, t4 = t6, t4 = t7, t5 = t4, t5 = t6, t5 = t7, t6 = t4, t6 = t5 : N.T5 +>t4 = t5, t4 = t6, t4 = t7, t5 = t4, t5 = t6, t5 = t7, t6 = t4 : N.T4 +>t4 = t5, t4 = t6, t4 = t7, t5 = t4, t5 = t6, t5 = t7 : { [N.c2]: number; [N.c3]: string; [N.s1]: boolean; } +>t4 = t5, t4 = t6, t4 = t7, t5 = t4, t5 = t6 : N.T6 +>t4 = t5, t4 = t6, t4 = t7, t5 = t4 : N.T4 +>t4 = t5, t4 = t6, t4 = t7 : { [N.c2]: number; [N.c3]: string; [N.s1]: boolean; } +>t4 = t5, t4 = t6 : N.T6 +>t4 = t5 : N.T5 +>t4 : N.T4 +>t5 : N.T5 +>t4 = t6 : N.T6 +>t4 : N.T4 +>t6 : N.T6 +>t4 = t7 : { [N.c2]: number; [N.c3]: string; [N.s1]: boolean; } +>t4 : N.T4 +>t7 : { [N.c2]: number; [N.c3]: string; [N.s1]: boolean; } +>t5 = t4 : N.T4 +>t5 : N.T5 +>t4 : N.T4 +>t5 = t6 : N.T6 +>t5 : N.T5 +>t6 : N.T6 +>t5 = t7 : { [N.c2]: number; [N.c3]: string; [N.s1]: boolean; } +>t5 : N.T5 +>t7 : { [N.c2]: number; [N.c3]: string; [N.s1]: boolean; } +>t6 = t4 : N.T4 +>t6 : N.T6 +>t4 : N.T4 +>t6 = t5 : N.T5 +>t6 : N.T6 +>t5 : N.T5 +>t6 = t7 : { [N.c2]: number; [N.c3]: string; [N.s1]: boolean; } +>t6 : N.T6 +>t7 : { [N.c2]: number; [N.c3]: string; [N.s1]: boolean; } +>t7 = t4 : N.T4 +>t7 : { [N.c2]: number; [N.c3]: string; [N.s1]: boolean; } +>t4 : N.T4 +>t7 = t5 : N.T5 +>t7 : { [N.c2]: number; [N.c3]: string; [N.s1]: boolean; } +>t5 : N.T5 +>t7 = t6 : N.T6 +>t7 : { [N.c2]: number; [N.c3]: string; [N.s1]: boolean; } +>t6 : N.T6 + +t0 = t12, t0 = t13, t0 = t14, t0 = t15, t12 = t0, t13 = t0, t14 = t0, t15 = t0; +>t0 = t12, t0 = t13, t0 = t14, t0 = t15, t12 = t0, t13 = t0, t14 = t0, t15 = t0 : T0 +>t0 = t12, t0 = t13, t0 = t14, t0 = t15, t12 = t0, t13 = t0, t14 = t0 : T0 +>t0 = t12, t0 = t13, t0 = t14, t0 = t15, t12 = t0, t13 = t0 : T0 +>t0 = t12, t0 = t13, t0 = t14, t0 = t15, t12 = t0 : T0 +>t0 = t12, t0 = t13, t0 = t14, t0 = t15 : { a: number; 1: string; [s2]: boolean; } +>t0 = t12, t0 = t13, t0 = t14 : T14 +>t0 = t12, t0 = t13 : T13 +>t0 = t12 : T12 +>t0 : T0 +>t12 : T12 +>t0 = t13 : T13 +>t0 : T0 +>t13 : T13 +>t0 = t14 : T14 +>t0 : T0 +>t14 : T14 +>t0 = t15 : { a: number; 1: string; [s2]: boolean; } +>t0 : T0 +>t15 : { a: number; 1: string; [s2]: boolean; } +>t12 = t0 : T0 +>t12 : T12 +>t0 : T0 +>t13 = t0 : T0 +>t13 : T13 +>t0 : T0 +>t14 = t0 : T0 +>t14 : T14 +>t0 : T0 +>t15 = t0 : T0 +>t15 : { a: number; 1: string; [s2]: boolean; } +>t0 : T0 + +t0 = C; // static side +>t0 = C : typeof C +>t0 : T0 +>C : typeof C + +// object literals +export const o1 = { +>o1 : { [c4]: number; [c5]: string; [s2]: boolean; } +>{ [c4]: 1, [c5]: "a", [s2]: true} : { [c4]: number; [c5]: string; [s2]: boolean; } + + [c4]: 1, +>c4 : "a" +>1 : 1 + + [c5]: "a", +>c5 : 1 +>"a" : "a" + + [s2]: true +>s2 : unique symbol +>true : true + +}; + +// check element access types +export const o1_c4 = o1[c4]; +>o1_c4 : number +>o1[c4] : number +>o1 : { [c4]: number; [c5]: string; [s2]: boolean; } +>c4 : "a" + +export const o1_c5 = o1[c5]; +>o1_c5 : string +>o1[c5] : string +>o1 : { [c4]: number; [c5]: string; [s2]: boolean; } +>c5 : 1 + +export const o1_s2 = o1[s2]; +>o1_s2 : boolean +>o1[s2] : boolean +>o1 : { [c4]: number; [c5]: string; [s2]: boolean; } +>s2 : unique symbol + +export const o2: T0 = o1; +>o2 : T0 +>T0 : T0 +>o1 : { [c4]: number; [c5]: string; [s2]: boolean; } + +// recursive declarations +declare const rI: RI; +>rI : RI +>RI : RI + +interface RI { +>RI : RI + + x: "a"; +>x : "a" + + [rI.x]: "b"; +>rI.x : "a" +>rI : RI +>x : "a" +} + +declare const rC: RC; +>rC : RC +>RC : RC + +declare class RC { +>RC : RC + + x: "a"; +>x : "a" + + [rC.x]: "b"; +>rC.x : "a" +>rC : RC +>x : "a" +} diff --git a/tests/baselines/reference/dynamicNamesErrors.errors.txt b/tests/baselines/reference/dynamicNamesErrors.errors.txt new file mode 100644 index 0000000000000..15722ed1a4982 --- /dev/null +++ b/tests/baselines/reference/dynamicNamesErrors.errors.txt @@ -0,0 +1,133 @@ +tests/cases/compiler/dynamicNamesErrors.ts(5,5): error TS2718: Duplicate declaration '[c0]'. +tests/cases/compiler/dynamicNamesErrors.ts(6,5): error TS2718: Duplicate declaration '[c0]'. +tests/cases/compiler/dynamicNamesErrors.ts(19,5): error TS2717: Subsequent property declarations must have the same type. Property '[c1]' has type 'number' at tests/cases/compiler/dynamicNamesErrors.ts 17:4, but here has type 'string'. +tests/cases/compiler/dynamicNamesErrors.ts(24,1): error TS2322: Type 'T2' is not assignable to type 'T1'. + Types of property '[c0]' are incompatible. + Type 'string' is not assignable to type 'number'. +tests/cases/compiler/dynamicNamesErrors.ts(25,1): error TS2322: Type 'T1' is not assignable to type 'T2'. + Types of property '[c0]' are incompatible. + Type 'number' is not assignable to type 'string'. +tests/cases/compiler/dynamicNamesErrors.ts(33,6): error TS4033: Property '[x]' of exported interface has or is using private name 'x'. +tests/cases/compiler/dynamicNamesErrors.ts(34,6): error TS4102: Method '[y]' of exported interface has or is using private name 'y'. +tests/cases/compiler/dynamicNamesErrors.ts(38,13): error TS4028: Public static property '[x]' of exported class has or is using private name 'x'. +tests/cases/compiler/dynamicNamesErrors.ts(39,13): error TS4097: Public static method '[y]' of exported class has or is using private name 'y'. +tests/cases/compiler/dynamicNamesErrors.ts(40,17): error TS4028: Public static property '[z]' of exported class has or is using private name 'z'. +tests/cases/compiler/dynamicNamesErrors.ts(41,17): error TS4028: Public static property '[w]' of exported class has or is using private name 'w'. +tests/cases/compiler/dynamicNamesErrors.ts(43,6): error TS4031: Public property '[x]' of exported class has or is using private name 'x'. +tests/cases/compiler/dynamicNamesErrors.ts(44,6): error TS4100: Public method '[y]' of exported class has or is using private name 'y'. +tests/cases/compiler/dynamicNamesErrors.ts(45,10): error TS4031: Public property '[z]' of exported class has or is using private name 'z'. +tests/cases/compiler/dynamicNamesErrors.ts(46,10): error TS4031: Public property '[w]' of exported class has or is using private name 'w'. +tests/cases/compiler/dynamicNamesErrors.ts(50,6): error TS4033: Property '[x]' of exported interface has or is using private name 'x'. +tests/cases/compiler/dynamicNamesErrors.ts(51,6): error TS4102: Method '[y]' of exported interface has or is using private name 'y'. +tests/cases/compiler/dynamicNamesErrors.ts(54,14): error TS4025: Exported variable 'ObjectLiteralVisibility' has or is using private name 'w'. +tests/cases/compiler/dynamicNamesErrors.ts(54,14): error TS4025: Exported variable 'ObjectLiteralVisibility' has or is using private name 'x'. +tests/cases/compiler/dynamicNamesErrors.ts(54,14): error TS4025: Exported variable 'ObjectLiteralVisibility' has or is using private name 'y'. +tests/cases/compiler/dynamicNamesErrors.ts(54,14): error TS4025: Exported variable 'ObjectLiteralVisibility' has or is using private name 'z'. + + +==== tests/cases/compiler/dynamicNamesErrors.ts (21 errors) ==== + const c0 = "1"; + const c1 = 1; + + interface T0 { + [c0]: number; + ~~~~ +!!! error TS2718: Duplicate declaration '[c0]'. + 1: number; + ~ +!!! error TS2718: Duplicate declaration '[c0]'. + } + + interface T1 { + [c0]: number; + } + + interface T2 { + [c0]: string; + } + + interface T3 { + [c0]: number; + [c1]: string; + ~~~~ +!!! error TS2717: Subsequent property declarations must have the same type. Property '[c1]' has type 'number' at tests/cases/compiler/dynamicNamesErrors.ts 17:4, but here has type 'string'. + } + + let t1: T1; + let t2: T2; + t1 = t2; + ~~ +!!! error TS2322: Type 'T2' is not assignable to type 'T1'. +!!! error TS2322: Types of property '[c0]' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type 'number'. + t2 = t1; + ~~ +!!! error TS2322: Type 'T1' is not assignable to type 'T2'. +!!! error TS2322: Types of property '[c0]' are incompatible. +!!! error TS2322: Type 'number' is not assignable to type 'string'. + + const x = Symbol(); + const y = Symbol(); + const z = Symbol(); + const w = Symbol(); + + export interface InterfaceMemberVisibility { + [x]: number; + ~ +!!! error TS4033: Property '[x]' of exported interface has or is using private name 'x'. + [y](): number; + ~ +!!! error TS4102: Method '[y]' of exported interface has or is using private name 'y'. + } + + export class ClassMemberVisibility { + static [x]: number; + ~ +!!! error TS4028: Public static property '[x]' of exported class has or is using private name 'x'. + static [y](): number { return 0; } + ~ +!!! error TS4097: Public static method '[y]' of exported class has or is using private name 'y'. + static get [z](): number { return 0; } + ~ +!!! error TS4028: Public static property '[z]' of exported class has or is using private name 'z'. + static set [w](value: number) { } + ~ +!!! error TS4028: Public static property '[w]' of exported class has or is using private name 'w'. + + [x]: number; + ~ +!!! error TS4031: Public property '[x]' of exported class has or is using private name 'x'. + [y](): number { return 0; } + ~ +!!! error TS4100: Public method '[y]' of exported class has or is using private name 'y'. + get [z](): number { return 0; } + ~ +!!! error TS4031: Public property '[z]' of exported class has or is using private name 'z'. + set [w](value: number) { } + ~ +!!! error TS4031: Public property '[w]' of exported class has or is using private name 'w'. + } + + export type ObjectTypeVisibility = { + [x]: number; + ~ +!!! error TS4033: Property '[x]' of exported interface has or is using private name 'x'. + [y](): number; + ~ +!!! error TS4102: Method '[y]' of exported interface has or is using private name 'y'. + }; + + export const ObjectLiteralVisibility = { + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4025: Exported variable 'ObjectLiteralVisibility' has or is using private name 'w'. + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4025: Exported variable 'ObjectLiteralVisibility' has or is using private name 'x'. + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4025: Exported variable 'ObjectLiteralVisibility' has or is using private name 'y'. + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4025: Exported variable 'ObjectLiteralVisibility' has or is using private name 'z'. + [x]: 0, + [y](): number { return 0; }, + get [z](): number { return 0; }, + set [w](value: number) { }, + }; \ No newline at end of file diff --git a/tests/baselines/reference/dynamicNamesErrors.js b/tests/baselines/reference/dynamicNamesErrors.js new file mode 100644 index 0000000000000..dbea91fcb0153 --- /dev/null +++ b/tests/baselines/reference/dynamicNamesErrors.js @@ -0,0 +1,89 @@ +//// [dynamicNamesErrors.ts] +const c0 = "1"; +const c1 = 1; + +interface T0 { + [c0]: number; + 1: number; +} + +interface T1 { + [c0]: number; +} + +interface T2 { + [c0]: string; +} + +interface T3 { + [c0]: number; + [c1]: string; +} + +let t1: T1; +let t2: T2; +t1 = t2; +t2 = t1; + +const x = Symbol(); +const y = Symbol(); +const z = Symbol(); +const w = Symbol(); + +export interface InterfaceMemberVisibility { + [x]: number; + [y](): number; +} + +export class ClassMemberVisibility { + static [x]: number; + static [y](): number { return 0; } + static get [z](): number { return 0; } + static set [w](value: number) { } + + [x]: number; + [y](): number { return 0; } + get [z](): number { return 0; } + set [w](value: number) { } +} + +export type ObjectTypeVisibility = { + [x]: number; + [y](): number; +}; + +export const ObjectLiteralVisibility = { + [x]: 0, + [y](): number { return 0; }, + get [z](): number { return 0; }, + set [w](value: number) { }, +}; + +//// [dynamicNamesErrors.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const c0 = "1"; +const c1 = 1; +let t1; +let t2; +t1 = t2; +t2 = t1; +const x = Symbol(); +const y = Symbol(); +const z = Symbol(); +const w = Symbol(); +class ClassMemberVisibility { + static [y]() { return 0; } + static get [z]() { return 0; } + static set [w](value) { } + [y]() { return 0; } + get [z]() { return 0; } + set [w](value) { } +} +exports.ClassMemberVisibility = ClassMemberVisibility; +exports.ObjectLiteralVisibility = { + [x]: 0, + [y]() { return 0; }, + get [z]() { return 0; }, + set [w](value) { }, +}; diff --git a/tests/baselines/reference/dynamicNamesErrors.symbols b/tests/baselines/reference/dynamicNamesErrors.symbols new file mode 100644 index 0000000000000..30ba78a99a311 --- /dev/null +++ b/tests/baselines/reference/dynamicNamesErrors.symbols @@ -0,0 +1,140 @@ +=== tests/cases/compiler/dynamicNamesErrors.ts === +const c0 = "1"; +>c0 : Symbol(c0, Decl(dynamicNamesErrors.ts, 0, 5)) + +const c1 = 1; +>c1 : Symbol(c1, Decl(dynamicNamesErrors.ts, 1, 5)) + +interface T0 { +>T0 : Symbol(T0, Decl(dynamicNamesErrors.ts, 1, 13)) + + [c0]: number; +>c0 : Symbol(c0, Decl(dynamicNamesErrors.ts, 0, 5)) + + 1: number; +} + +interface T1 { +>T1 : Symbol(T1, Decl(dynamicNamesErrors.ts, 6, 1)) + + [c0]: number; +>c0 : Symbol(c0, Decl(dynamicNamesErrors.ts, 0, 5)) +} + +interface T2 { +>T2 : Symbol(T2, Decl(dynamicNamesErrors.ts, 10, 1)) + + [c0]: string; +>c0 : Symbol(c0, Decl(dynamicNamesErrors.ts, 0, 5)) +} + +interface T3 { +>T3 : Symbol(T3, Decl(dynamicNamesErrors.ts, 14, 1)) + + [c0]: number; +>c0 : Symbol(c0, Decl(dynamicNamesErrors.ts, 0, 5)) + + [c1]: string; +>c1 : Symbol(c1, Decl(dynamicNamesErrors.ts, 1, 5)) +} + +let t1: T1; +>t1 : Symbol(t1, Decl(dynamicNamesErrors.ts, 21, 3)) +>T1 : Symbol(T1, Decl(dynamicNamesErrors.ts, 6, 1)) + +let t2: T2; +>t2 : Symbol(t2, Decl(dynamicNamesErrors.ts, 22, 3)) +>T2 : Symbol(T2, Decl(dynamicNamesErrors.ts, 10, 1)) + +t1 = t2; +>t1 : Symbol(t1, Decl(dynamicNamesErrors.ts, 21, 3)) +>t2 : Symbol(t2, Decl(dynamicNamesErrors.ts, 22, 3)) + +t2 = t1; +>t2 : Symbol(t2, Decl(dynamicNamesErrors.ts, 22, 3)) +>t1 : Symbol(t1, Decl(dynamicNamesErrors.ts, 21, 3)) + +const x = Symbol(); +>x : Symbol(x, Decl(dynamicNamesErrors.ts, 26, 5)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) + +const y = Symbol(); +>y : Symbol(y, Decl(dynamicNamesErrors.ts, 27, 5)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) + +const z = Symbol(); +>z : Symbol(z, Decl(dynamicNamesErrors.ts, 28, 5)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) + +const w = Symbol(); +>w : Symbol(w, Decl(dynamicNamesErrors.ts, 29, 5)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) + +export interface InterfaceMemberVisibility { +>InterfaceMemberVisibility : Symbol(InterfaceMemberVisibility, Decl(dynamicNamesErrors.ts, 29, 19)) + + [x]: number; +>x : Symbol(x, Decl(dynamicNamesErrors.ts, 26, 5)) + + [y](): number; +>y : Symbol(y, Decl(dynamicNamesErrors.ts, 27, 5)) +} + +export class ClassMemberVisibility { +>ClassMemberVisibility : Symbol(ClassMemberVisibility, Decl(dynamicNamesErrors.ts, 34, 1)) + + static [x]: number; +>x : Symbol(x, Decl(dynamicNamesErrors.ts, 26, 5)) + + static [y](): number { return 0; } +>y : Symbol(y, Decl(dynamicNamesErrors.ts, 27, 5)) + + static get [z](): number { return 0; } +>z : Symbol(z, Decl(dynamicNamesErrors.ts, 28, 5)) + + static set [w](value: number) { } +>w : Symbol(w, Decl(dynamicNamesErrors.ts, 29, 5)) +>value : Symbol(value, Decl(dynamicNamesErrors.ts, 40, 19)) + + [x]: number; +>x : Symbol(x, Decl(dynamicNamesErrors.ts, 26, 5)) + + [y](): number { return 0; } +>y : Symbol(y, Decl(dynamicNamesErrors.ts, 27, 5)) + + get [z](): number { return 0; } +>z : Symbol(z, Decl(dynamicNamesErrors.ts, 28, 5)) + + set [w](value: number) { } +>w : Symbol(w, Decl(dynamicNamesErrors.ts, 29, 5)) +>value : Symbol(value, Decl(dynamicNamesErrors.ts, 45, 12)) +} + +export type ObjectTypeVisibility = { +>ObjectTypeVisibility : Symbol(ObjectTypeVisibility, Decl(dynamicNamesErrors.ts, 46, 1)) + + [x]: number; +>x : Symbol(x, Decl(dynamicNamesErrors.ts, 26, 5)) + + [y](): number; +>y : Symbol(y, Decl(dynamicNamesErrors.ts, 27, 5)) + +}; + +export const ObjectLiteralVisibility = { +>ObjectLiteralVisibility : Symbol(ObjectLiteralVisibility, Decl(dynamicNamesErrors.ts, 53, 12)) + + [x]: 0, +>x : Symbol(x, Decl(dynamicNamesErrors.ts, 26, 5)) + + [y](): number { return 0; }, +>y : Symbol(y, Decl(dynamicNamesErrors.ts, 27, 5)) + + get [z](): number { return 0; }, +>z : Symbol(z, Decl(dynamicNamesErrors.ts, 28, 5)) + + set [w](value: number) { }, +>w : Symbol(w, Decl(dynamicNamesErrors.ts, 29, 5)) +>value : Symbol(value, Decl(dynamicNamesErrors.ts, 57, 12)) + +}; diff --git a/tests/baselines/reference/dynamicNamesErrors.types b/tests/baselines/reference/dynamicNamesErrors.types new file mode 100644 index 0000000000000..3e3f71ec1410e --- /dev/null +++ b/tests/baselines/reference/dynamicNamesErrors.types @@ -0,0 +1,156 @@ +=== tests/cases/compiler/dynamicNamesErrors.ts === +const c0 = "1"; +>c0 : "1" +>"1" : "1" + +const c1 = 1; +>c1 : 1 +>1 : 1 + +interface T0 { +>T0 : T0 + + [c0]: number; +>c0 : "1" + + 1: number; +} + +interface T1 { +>T1 : T1 + + [c0]: number; +>c0 : "1" +} + +interface T2 { +>T2 : T2 + + [c0]: string; +>c0 : "1" +} + +interface T3 { +>T3 : T3 + + [c0]: number; +>c0 : "1" + + [c1]: string; +>c1 : 1 +} + +let t1: T1; +>t1 : T1 +>T1 : T1 + +let t2: T2; +>t2 : T2 +>T2 : T2 + +t1 = t2; +>t1 = t2 : T2 +>t1 : T1 +>t2 : T2 + +t2 = t1; +>t2 = t1 : T1 +>t2 : T2 +>t1 : T1 + +const x = Symbol(); +>x : unique symbol +>Symbol() : unique symbol +>Symbol : SymbolConstructor + +const y = Symbol(); +>y : unique symbol +>Symbol() : unique symbol +>Symbol : SymbolConstructor + +const z = Symbol(); +>z : unique symbol +>Symbol() : unique symbol +>Symbol : SymbolConstructor + +const w = Symbol(); +>w : unique symbol +>Symbol() : unique symbol +>Symbol : SymbolConstructor + +export interface InterfaceMemberVisibility { +>InterfaceMemberVisibility : InterfaceMemberVisibility + + [x]: number; +>x : unique symbol + + [y](): number; +>y : unique symbol +} + +export class ClassMemberVisibility { +>ClassMemberVisibility : ClassMemberVisibility + + static [x]: number; +>x : unique symbol + + static [y](): number { return 0; } +>y : unique symbol +>0 : 0 + + static get [z](): number { return 0; } +>z : unique symbol +>0 : 0 + + static set [w](value: number) { } +>w : unique symbol +>value : number + + [x]: number; +>x : unique symbol + + [y](): number { return 0; } +>y : unique symbol +>0 : 0 + + get [z](): number { return 0; } +>z : unique symbol +>0 : 0 + + set [w](value: number) { } +>w : unique symbol +>value : number +} + +export type ObjectTypeVisibility = { +>ObjectTypeVisibility : ObjectTypeVisibility + + [x]: number; +>x : unique symbol + + [y](): number; +>y : unique symbol + +}; + +export const ObjectLiteralVisibility = { +>ObjectLiteralVisibility : { [x]: number; [y](): number; readonly [z]: number; [w]: number; } +>{ [x]: 0, [y](): number { return 0; }, get [z](): number { return 0; }, set [w](value: number) { },} : { [x]: number; [y](): number; readonly [z]: number; [w]: number; } + + [x]: 0, +>x : unique symbol +>0 : 0 + + [y](): number { return 0; }, +>y : unique symbol +>0 : 0 + + get [z](): number { return 0; }, +>z : unique symbol +>0 : 0 + + set [w](value: number) { }, +>w : unique symbol +>value : number + +}; diff --git a/tests/baselines/reference/emitClassDeclarationWithGetterSetterInES6.symbols b/tests/baselines/reference/emitClassDeclarationWithGetterSetterInES6.symbols index 89c49123e7757..b6a267e596f52 100644 --- a/tests/baselines/reference/emitClassDeclarationWithGetterSetterInES6.symbols +++ b/tests/baselines/reference/emitClassDeclarationWithGetterSetterInES6.symbols @@ -19,27 +19,27 @@ class C { return "BYE"; } static get ["computedname"]() { ->"computedname" : Symbol(C[["computedname"]], Decl(emitClassDeclarationWithGetterSetterInES6.ts, 7, 5), Decl(emitClassDeclarationWithGetterSetterInES6.ts, 24, 33)) +>"computedname" : Symbol(C["computedname"], Decl(emitClassDeclarationWithGetterSetterInES6.ts, 7, 5), Decl(emitClassDeclarationWithGetterSetterInES6.ts, 24, 33)) return ""; } get ["computedname1"]() { ->"computedname1" : Symbol(C[["computedname1"]], Decl(emitClassDeclarationWithGetterSetterInES6.ts, 10, 5)) +>"computedname1" : Symbol(C["computedname1"], Decl(emitClassDeclarationWithGetterSetterInES6.ts, 10, 5)) return ""; } get ["computedname2"]() { ->"computedname2" : Symbol(C[["computedname2"]], Decl(emitClassDeclarationWithGetterSetterInES6.ts, 13, 5)) +>"computedname2" : Symbol(C["computedname2"], Decl(emitClassDeclarationWithGetterSetterInES6.ts, 13, 5)) return ""; } set ["computedname3"](x: any) { ->"computedname3" : Symbol(C[["computedname3"]], Decl(emitClassDeclarationWithGetterSetterInES6.ts, 16, 5)) +>"computedname3" : Symbol(C["computedname3"], Decl(emitClassDeclarationWithGetterSetterInES6.ts, 16, 5)) >x : Symbol(x, Decl(emitClassDeclarationWithGetterSetterInES6.ts, 18, 26)) } set ["computedname4"](y: string) { ->"computedname4" : Symbol(C[["computedname4"]], Decl(emitClassDeclarationWithGetterSetterInES6.ts, 19, 5)) +>"computedname4" : Symbol(C["computedname4"], Decl(emitClassDeclarationWithGetterSetterInES6.ts, 19, 5)) >y : Symbol(y, Decl(emitClassDeclarationWithGetterSetterInES6.ts, 20, 26)) } @@ -52,6 +52,6 @@ class C { >b : Symbol(b, Decl(emitClassDeclarationWithGetterSetterInES6.ts, 24, 19)) static set ["computedname"](b: string) { } ->"computedname" : Symbol(C[["computedname"]], Decl(emitClassDeclarationWithGetterSetterInES6.ts, 7, 5), Decl(emitClassDeclarationWithGetterSetterInES6.ts, 24, 33)) +>"computedname" : Symbol(C["computedname"], Decl(emitClassDeclarationWithGetterSetterInES6.ts, 7, 5), Decl(emitClassDeclarationWithGetterSetterInES6.ts, 24, 33)) >b : Symbol(b, Decl(emitClassDeclarationWithGetterSetterInES6.ts, 25, 32)) } diff --git a/tests/baselines/reference/emitClassDeclarationWithMethodInES6.symbols b/tests/baselines/reference/emitClassDeclarationWithMethodInES6.symbols index 54522c5834ad0..5328b892ded81 100644 --- a/tests/baselines/reference/emitClassDeclarationWithMethodInES6.symbols +++ b/tests/baselines/reference/emitClassDeclarationWithMethodInES6.symbols @@ -9,14 +9,14 @@ class D { >foo : Symbol(D.foo, Decl(emitClassDeclarationWithMethodInES6.ts, 1, 17)) ["computedName1"]() { } ->"computedName1" : Symbol(D[["computedName1"]], Decl(emitClassDeclarationWithMethodInES6.ts, 2, 13)) +>"computedName1" : Symbol(D["computedName1"], Decl(emitClassDeclarationWithMethodInES6.ts, 2, 13)) ["computedName2"](a: string) { } ->"computedName2" : Symbol(D[["computedName2"]], Decl(emitClassDeclarationWithMethodInES6.ts, 3, 27)) +>"computedName2" : Symbol(D["computedName2"], Decl(emitClassDeclarationWithMethodInES6.ts, 3, 27)) >a : Symbol(a, Decl(emitClassDeclarationWithMethodInES6.ts, 4, 22)) ["computedName3"](a: string): number { return 1; } ->"computedName3" : Symbol(D[["computedName3"]], Decl(emitClassDeclarationWithMethodInES6.ts, 4, 36)) +>"computedName3" : Symbol(D["computedName3"], Decl(emitClassDeclarationWithMethodInES6.ts, 4, 36)) >a : Symbol(a, Decl(emitClassDeclarationWithMethodInES6.ts, 5, 22)) bar(): string { @@ -35,14 +35,14 @@ class D { return "HELLO"; } static ["computedname4"]() { } ->"computedname4" : Symbol(D[["computedname4"]], Decl(emitClassDeclarationWithMethodInES6.ts, 11, 5)) +>"computedname4" : Symbol(D["computedname4"], Decl(emitClassDeclarationWithMethodInES6.ts, 11, 5)) static ["computedname5"](a: string) { } ->"computedname5" : Symbol(D[["computedname5"]], Decl(emitClassDeclarationWithMethodInES6.ts, 12, 34)) +>"computedname5" : Symbol(D["computedname5"], Decl(emitClassDeclarationWithMethodInES6.ts, 12, 34)) >a : Symbol(a, Decl(emitClassDeclarationWithMethodInES6.ts, 13, 29)) static ["computedname6"](a: string): boolean { return true; } ->"computedname6" : Symbol(D[["computedname6"]], Decl(emitClassDeclarationWithMethodInES6.ts, 13, 43)) +>"computedname6" : Symbol(D["computedname6"], Decl(emitClassDeclarationWithMethodInES6.ts, 13, 43)) >a : Symbol(a, Decl(emitClassDeclarationWithMethodInES6.ts, 14, 29)) static staticMethod() { diff --git a/tests/baselines/reference/emitter.asyncGenerators.classMethods.es2015.types b/tests/baselines/reference/emitter.asyncGenerators.classMethods.es2015.types index c375fb6f45522..c6d6fb6758d13 100644 --- a/tests/baselines/reference/emitter.asyncGenerators.classMethods.es2015.types +++ b/tests/baselines/reference/emitter.asyncGenerators.classMethods.es2015.types @@ -23,7 +23,7 @@ class C3 { >C3 : C3 async * f() { ->f : () => AsyncIterableIterator<1> +>f : () => AsyncIterableIterator const x = yield 1; >x : any @@ -50,14 +50,14 @@ class C5 { >C5 : C5 async * f() { ->f : () => AsyncIterableIterator<1> +>f : () => AsyncIterableIterator const x = yield* (async function*() { yield 1; })(); >x : any >yield* (async function*() { yield 1; })() : any ->(async function*() { yield 1; })() : AsyncIterableIterator<1> ->(async function*() { yield 1; }) : () => AsyncIterableIterator<1> ->async function*() { yield 1; } : () => AsyncIterableIterator<1> +>(async function*() { yield 1; })() : AsyncIterableIterator +>(async function*() { yield 1; }) : () => AsyncIterableIterator +>async function*() { yield 1; } : () => AsyncIterableIterator >yield 1 : any >1 : 1 } @@ -80,7 +80,7 @@ class C7 { >C7 : C7 async * f() { ->f : () => AsyncIterableIterator<1> +>f : () => AsyncIterableIterator return 1; >1 : 1 diff --git a/tests/baselines/reference/emitter.asyncGenerators.classMethods.es5.types b/tests/baselines/reference/emitter.asyncGenerators.classMethods.es5.types index e4be9f80d4ae6..5d636d2400c6f 100644 --- a/tests/baselines/reference/emitter.asyncGenerators.classMethods.es5.types +++ b/tests/baselines/reference/emitter.asyncGenerators.classMethods.es5.types @@ -23,7 +23,7 @@ class C3 { >C3 : C3 async * f() { ->f : () => AsyncIterableIterator<1> +>f : () => AsyncIterableIterator const x = yield 1; >x : any @@ -50,14 +50,14 @@ class C5 { >C5 : C5 async * f() { ->f : () => AsyncIterableIterator<1> +>f : () => AsyncIterableIterator const x = yield* (async function*() { yield 1; })(); >x : any >yield* (async function*() { yield 1; })() : any ->(async function*() { yield 1; })() : AsyncIterableIterator<1> ->(async function*() { yield 1; }) : () => AsyncIterableIterator<1> ->async function*() { yield 1; } : () => AsyncIterableIterator<1> +>(async function*() { yield 1; })() : AsyncIterableIterator +>(async function*() { yield 1; }) : () => AsyncIterableIterator +>async function*() { yield 1; } : () => AsyncIterableIterator >yield 1 : any >1 : 1 } @@ -80,7 +80,7 @@ class C7 { >C7 : C7 async * f() { ->f : () => AsyncIterableIterator<1> +>f : () => AsyncIterableIterator return 1; >1 : 1 diff --git a/tests/baselines/reference/emitter.asyncGenerators.classMethods.esnext.types b/tests/baselines/reference/emitter.asyncGenerators.classMethods.esnext.types index 1232130a389a3..f2f5f4d7503bd 100644 --- a/tests/baselines/reference/emitter.asyncGenerators.classMethods.esnext.types +++ b/tests/baselines/reference/emitter.asyncGenerators.classMethods.esnext.types @@ -23,7 +23,7 @@ class C3 { >C3 : C3 async * f() { ->f : () => AsyncIterableIterator<1> +>f : () => AsyncIterableIterator const x = yield 1; >x : any @@ -50,14 +50,14 @@ class C5 { >C5 : C5 async * f() { ->f : () => AsyncIterableIterator<1> +>f : () => AsyncIterableIterator const x = yield* (async function*() { yield 1; })(); >x : any >yield* (async function*() { yield 1; })() : any ->(async function*() { yield 1; })() : AsyncIterableIterator<1> ->(async function*() { yield 1; }) : () => AsyncIterableIterator<1> ->async function*() { yield 1; } : () => AsyncIterableIterator<1> +>(async function*() { yield 1; })() : AsyncIterableIterator +>(async function*() { yield 1; }) : () => AsyncIterableIterator +>async function*() { yield 1; } : () => AsyncIterableIterator >yield 1 : any >1 : 1 } @@ -80,7 +80,7 @@ class C7 { >C7 : C7 async * f() { ->f : () => AsyncIterableIterator<1> +>f : () => AsyncIterableIterator return 1; >1 : 1 diff --git a/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es2015.types b/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es2015.types index 0e43463990629..15ff1298b21ac 100644 --- a/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es2015.types +++ b/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es2015.types @@ -12,7 +12,7 @@ async function * f2() { } === tests/cases/conformance/emitter/es2015/asyncGenerators/F3.ts === async function * f3() { ->f3 : () => AsyncIterableIterator<1> +>f3 : () => AsyncIterableIterator const x = yield 1; >x : any @@ -31,14 +31,14 @@ async function * f4() { } === tests/cases/conformance/emitter/es2015/asyncGenerators/F5.ts === async function * f5() { ->f5 : () => AsyncIterableIterator<1> +>f5 : () => AsyncIterableIterator const x = yield* (async function*() { yield 1; })(); >x : any >yield* (async function*() { yield 1; })() : any ->(async function*() { yield 1; })() : AsyncIterableIterator<1> ->(async function*() { yield 1; }) : () => AsyncIterableIterator<1> ->async function*() { yield 1; } : () => AsyncIterableIterator<1> +>(async function*() { yield 1; })() : AsyncIterableIterator +>(async function*() { yield 1; }) : () => AsyncIterableIterator +>async function*() { yield 1; } : () => AsyncIterableIterator >yield 1 : any >1 : 1 } @@ -53,7 +53,7 @@ async function * f6() { } === tests/cases/conformance/emitter/es2015/asyncGenerators/F7.ts === async function * f7() { ->f7 : () => AsyncIterableIterator<1> +>f7 : () => AsyncIterableIterator return 1; >1 : 1 diff --git a/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es5.types b/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es5.types index 9ebd2659ef4ab..6220f5efd1eca 100644 --- a/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es5.types +++ b/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es5.types @@ -12,7 +12,7 @@ async function * f2() { } === tests/cases/conformance/emitter/es5/asyncGenerators/F3.ts === async function * f3() { ->f3 : () => AsyncIterableIterator<1> +>f3 : () => AsyncIterableIterator const x = yield 1; >x : any @@ -31,14 +31,14 @@ async function * f4() { } === tests/cases/conformance/emitter/es5/asyncGenerators/F5.ts === async function * f5() { ->f5 : () => AsyncIterableIterator<1> +>f5 : () => AsyncIterableIterator const x = yield* (async function*() { yield 1; })(); >x : any >yield* (async function*() { yield 1; })() : any ->(async function*() { yield 1; })() : AsyncIterableIterator<1> ->(async function*() { yield 1; }) : () => AsyncIterableIterator<1> ->async function*() { yield 1; } : () => AsyncIterableIterator<1> +>(async function*() { yield 1; })() : AsyncIterableIterator +>(async function*() { yield 1; }) : () => AsyncIterableIterator +>async function*() { yield 1; } : () => AsyncIterableIterator >yield 1 : any >1 : 1 } @@ -53,7 +53,7 @@ async function * f6() { } === tests/cases/conformance/emitter/es5/asyncGenerators/F7.ts === async function * f7() { ->f7 : () => AsyncIterableIterator<1> +>f7 : () => AsyncIterableIterator return 1; >1 : 1 diff --git a/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.esnext.types b/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.esnext.types index 4e61c9032273c..c0d8011774655 100644 --- a/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.esnext.types +++ b/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.esnext.types @@ -12,7 +12,7 @@ async function * f2() { } === tests/cases/conformance/emitter/esnext/asyncGenerators/F3.ts === async function * f3() { ->f3 : () => AsyncIterableIterator<1> +>f3 : () => AsyncIterableIterator const x = yield 1; >x : any @@ -31,14 +31,14 @@ async function * f4() { } === tests/cases/conformance/emitter/esnext/asyncGenerators/F5.ts === async function * f5() { ->f5 : () => AsyncIterableIterator<1> +>f5 : () => AsyncIterableIterator const x = yield* (async function*() { yield 1; })(); >x : any >yield* (async function*() { yield 1; })() : any ->(async function*() { yield 1; })() : AsyncIterableIterator<1> ->(async function*() { yield 1; }) : () => AsyncIterableIterator<1> ->async function*() { yield 1; } : () => AsyncIterableIterator<1> +>(async function*() { yield 1; })() : AsyncIterableIterator +>(async function*() { yield 1; }) : () => AsyncIterableIterator +>async function*() { yield 1; } : () => AsyncIterableIterator >yield 1 : any >1 : 1 } @@ -53,7 +53,7 @@ async function * f6() { } === tests/cases/conformance/emitter/esnext/asyncGenerators/F7.ts === async function * f7() { ->f7 : () => AsyncIterableIterator<1> +>f7 : () => AsyncIterableIterator return 1; >1 : 1 diff --git a/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es2015.types b/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es2015.types index 83d65ce524624..1db2126b7ed83 100644 --- a/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es2015.types +++ b/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es2015.types @@ -14,8 +14,8 @@ const f2 = async function * () { } === tests/cases/conformance/emitter/es2015/asyncGenerators/F3.ts === const f3 = async function * () { ->f3 : () => AsyncIterableIterator<1> ->async function * () { const x = yield 1;} : () => AsyncIterableIterator<1> +>f3 : () => AsyncIterableIterator +>async function * () { const x = yield 1;} : () => AsyncIterableIterator const x = yield 1; >x : any @@ -35,15 +35,15 @@ const f4 = async function * () { } === tests/cases/conformance/emitter/es2015/asyncGenerators/F5.ts === const f5 = async function * () { ->f5 : () => AsyncIterableIterator<1> ->async function * () { const x = yield* (async function*() { yield 1; })();} : () => AsyncIterableIterator<1> +>f5 : () => AsyncIterableIterator +>async function * () { const x = yield* (async function*() { yield 1; })();} : () => AsyncIterableIterator const x = yield* (async function*() { yield 1; })(); >x : any >yield* (async function*() { yield 1; })() : any ->(async function*() { yield 1; })() : AsyncIterableIterator<1> ->(async function*() { yield 1; }) : () => AsyncIterableIterator<1> ->async function*() { yield 1; } : () => AsyncIterableIterator<1> +>(async function*() { yield 1; })() : AsyncIterableIterator +>(async function*() { yield 1; }) : () => AsyncIterableIterator +>async function*() { yield 1; } : () => AsyncIterableIterator >yield 1 : any >1 : 1 } @@ -59,8 +59,8 @@ const f6 = async function * () { } === tests/cases/conformance/emitter/es2015/asyncGenerators/F7.ts === const f7 = async function * () { ->f7 : () => AsyncIterableIterator<1> ->async function * () { return 1;} : () => AsyncIterableIterator<1> +>f7 : () => AsyncIterableIterator +>async function * () { return 1;} : () => AsyncIterableIterator return 1; >1 : 1 diff --git a/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es5.types b/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es5.types index 7d736b2327c9a..e9da600bdbf1c 100644 --- a/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es5.types +++ b/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es5.types @@ -14,8 +14,8 @@ const f2 = async function * () { } === tests/cases/conformance/emitter/es5/asyncGenerators/F3.ts === const f3 = async function * () { ->f3 : () => AsyncIterableIterator<1> ->async function * () { const x = yield 1;} : () => AsyncIterableIterator<1> +>f3 : () => AsyncIterableIterator +>async function * () { const x = yield 1;} : () => AsyncIterableIterator const x = yield 1; >x : any @@ -35,15 +35,15 @@ const f4 = async function * () { } === tests/cases/conformance/emitter/es5/asyncGenerators/F5.ts === const f5 = async function * () { ->f5 : () => AsyncIterableIterator<1> ->async function * () { const x = yield* (async function*() { yield 1; })();} : () => AsyncIterableIterator<1> +>f5 : () => AsyncIterableIterator +>async function * () { const x = yield* (async function*() { yield 1; })();} : () => AsyncIterableIterator const x = yield* (async function*() { yield 1; })(); >x : any >yield* (async function*() { yield 1; })() : any ->(async function*() { yield 1; })() : AsyncIterableIterator<1> ->(async function*() { yield 1; }) : () => AsyncIterableIterator<1> ->async function*() { yield 1; } : () => AsyncIterableIterator<1> +>(async function*() { yield 1; })() : AsyncIterableIterator +>(async function*() { yield 1; }) : () => AsyncIterableIterator +>async function*() { yield 1; } : () => AsyncIterableIterator >yield 1 : any >1 : 1 } @@ -59,8 +59,8 @@ const f6 = async function * () { } === tests/cases/conformance/emitter/es5/asyncGenerators/F7.ts === const f7 = async function * () { ->f7 : () => AsyncIterableIterator<1> ->async function * () { return 1;} : () => AsyncIterableIterator<1> +>f7 : () => AsyncIterableIterator +>async function * () { return 1;} : () => AsyncIterableIterator return 1; >1 : 1 diff --git a/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.esnext.types b/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.esnext.types index 6c40f9cebb169..5802bc10a2d9e 100644 --- a/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.esnext.types +++ b/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.esnext.types @@ -14,8 +14,8 @@ const f2 = async function * () { } === tests/cases/conformance/emitter/esnext/asyncGenerators/F3.ts === const f3 = async function * () { ->f3 : () => AsyncIterableIterator<1> ->async function * () { const x = yield 1;} : () => AsyncIterableIterator<1> +>f3 : () => AsyncIterableIterator +>async function * () { const x = yield 1;} : () => AsyncIterableIterator const x = yield 1; >x : any @@ -35,15 +35,15 @@ const f4 = async function * () { } === tests/cases/conformance/emitter/esnext/asyncGenerators/F5.ts === const f5 = async function * () { ->f5 : () => AsyncIterableIterator<1> ->async function * () { const x = yield* (async function*() { yield 1; })();} : () => AsyncIterableIterator<1> +>f5 : () => AsyncIterableIterator +>async function * () { const x = yield* (async function*() { yield 1; })();} : () => AsyncIterableIterator const x = yield* (async function*() { yield 1; })(); >x : any >yield* (async function*() { yield 1; })() : any ->(async function*() { yield 1; })() : AsyncIterableIterator<1> ->(async function*() { yield 1; }) : () => AsyncIterableIterator<1> ->async function*() { yield 1; } : () => AsyncIterableIterator<1> +>(async function*() { yield 1; })() : AsyncIterableIterator +>(async function*() { yield 1; }) : () => AsyncIterableIterator +>async function*() { yield 1; } : () => AsyncIterableIterator >yield 1 : any >1 : 1 } @@ -59,8 +59,8 @@ const f6 = async function * () { } === tests/cases/conformance/emitter/esnext/asyncGenerators/F7.ts === const f7 = async function * () { ->f7 : () => AsyncIterableIterator<1> ->async function * () { return 1;} : () => AsyncIterableIterator<1> +>f7 : () => AsyncIterableIterator +>async function * () { return 1;} : () => AsyncIterableIterator return 1; >1 : 1 diff --git a/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es2015.types b/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es2015.types index 59c5bcfa16716..9e47fc9d98932 100644 --- a/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es2015.types +++ b/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es2015.types @@ -22,11 +22,11 @@ const o2 = { } === tests/cases/conformance/emitter/es2015/asyncGenerators/O3.ts === const o3 = { ->o3 : { f(): AsyncIterableIterator<1>; } ->{ async * f() { const x = yield 1; }} : { f(): AsyncIterableIterator<1>; } +>o3 : { f(): AsyncIterableIterator; } +>{ async * f() { const x = yield 1; }} : { f(): AsyncIterableIterator; } async * f() { ->f : () => AsyncIterableIterator<1> +>f : () => AsyncIterableIterator const x = yield 1; >x : any @@ -51,18 +51,18 @@ const o4 = { } === tests/cases/conformance/emitter/es2015/asyncGenerators/O5.ts === const o5 = { ->o5 : { f(): AsyncIterableIterator<1>; } ->{ async * f() { const x = yield* (async function*() { yield 1; })(); }} : { f(): AsyncIterableIterator<1>; } +>o5 : { f(): AsyncIterableIterator; } +>{ async * f() { const x = yield* (async function*() { yield 1; })(); }} : { f(): AsyncIterableIterator; } async * f() { ->f : () => AsyncIterableIterator<1> +>f : () => AsyncIterableIterator const x = yield* (async function*() { yield 1; })(); >x : any >yield* (async function*() { yield 1; })() : any ->(async function*() { yield 1; })() : AsyncIterableIterator<1> ->(async function*() { yield 1; }) : () => AsyncIterableIterator<1> ->async function*() { yield 1; } : () => AsyncIterableIterator<1> +>(async function*() { yield 1; })() : AsyncIterableIterator +>(async function*() { yield 1; }) : () => AsyncIterableIterator +>async function*() { yield 1; } : () => AsyncIterableIterator >yield 1 : any >1 : 1 } @@ -83,11 +83,11 @@ const o6 = { } === tests/cases/conformance/emitter/es2015/asyncGenerators/O7.ts === const o7 = { ->o7 : { f(): AsyncIterableIterator<1>; } ->{ async * f() { return 1; }} : { f(): AsyncIterableIterator<1>; } +>o7 : { f(): AsyncIterableIterator; } +>{ async * f() { return 1; }} : { f(): AsyncIterableIterator; } async * f() { ->f : () => AsyncIterableIterator<1> +>f : () => AsyncIterableIterator return 1; >1 : 1 diff --git a/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es5.types b/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es5.types index 3e7ead2f73796..390007605083d 100644 --- a/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es5.types +++ b/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es5.types @@ -22,11 +22,11 @@ const o2 = { } === tests/cases/conformance/emitter/es5/asyncGenerators/O3.ts === const o3 = { ->o3 : { f(): AsyncIterableIterator<1>; } ->{ async * f() { const x = yield 1; }} : { f(): AsyncIterableIterator<1>; } +>o3 : { f(): AsyncIterableIterator; } +>{ async * f() { const x = yield 1; }} : { f(): AsyncIterableIterator; } async * f() { ->f : () => AsyncIterableIterator<1> +>f : () => AsyncIterableIterator const x = yield 1; >x : any @@ -51,18 +51,18 @@ const o4 = { } === tests/cases/conformance/emitter/es5/asyncGenerators/O5.ts === const o5 = { ->o5 : { f(): AsyncIterableIterator<1>; } ->{ async * f() { const x = yield* (async function*() { yield 1; })(); }} : { f(): AsyncIterableIterator<1>; } +>o5 : { f(): AsyncIterableIterator; } +>{ async * f() { const x = yield* (async function*() { yield 1; })(); }} : { f(): AsyncIterableIterator; } async * f() { ->f : () => AsyncIterableIterator<1> +>f : () => AsyncIterableIterator const x = yield* (async function*() { yield 1; })(); >x : any >yield* (async function*() { yield 1; })() : any ->(async function*() { yield 1; })() : AsyncIterableIterator<1> ->(async function*() { yield 1; }) : () => AsyncIterableIterator<1> ->async function*() { yield 1; } : () => AsyncIterableIterator<1> +>(async function*() { yield 1; })() : AsyncIterableIterator +>(async function*() { yield 1; }) : () => AsyncIterableIterator +>async function*() { yield 1; } : () => AsyncIterableIterator >yield 1 : any >1 : 1 } @@ -83,11 +83,11 @@ const o6 = { } === tests/cases/conformance/emitter/es5/asyncGenerators/O7.ts === const o7 = { ->o7 : { f(): AsyncIterableIterator<1>; } ->{ async * f() { return 1; }} : { f(): AsyncIterableIterator<1>; } +>o7 : { f(): AsyncIterableIterator; } +>{ async * f() { return 1; }} : { f(): AsyncIterableIterator; } async * f() { ->f : () => AsyncIterableIterator<1> +>f : () => AsyncIterableIterator return 1; >1 : 1 diff --git a/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.esnext.types b/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.esnext.types index 9e5aad8af2367..a05b5326b2c8e 100644 --- a/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.esnext.types +++ b/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.esnext.types @@ -22,11 +22,11 @@ const o2 = { } === tests/cases/conformance/emitter/esnext/asyncGenerators/O3.ts === const o3 = { ->o3 : { f(): AsyncIterableIterator<1>; } ->{ async * f() { const x = yield 1; }} : { f(): AsyncIterableIterator<1>; } +>o3 : { f(): AsyncIterableIterator; } +>{ async * f() { const x = yield 1; }} : { f(): AsyncIterableIterator; } async * f() { ->f : () => AsyncIterableIterator<1> +>f : () => AsyncIterableIterator const x = yield 1; >x : any @@ -51,18 +51,18 @@ const o4 = { } === tests/cases/conformance/emitter/esnext/asyncGenerators/O5.ts === const o5 = { ->o5 : { f(): AsyncIterableIterator<1>; } ->{ async * f() { const x = yield* (async function*() { yield 1; })(); }} : { f(): AsyncIterableIterator<1>; } +>o5 : { f(): AsyncIterableIterator; } +>{ async * f() { const x = yield* (async function*() { yield 1; })(); }} : { f(): AsyncIterableIterator; } async * f() { ->f : () => AsyncIterableIterator<1> +>f : () => AsyncIterableIterator const x = yield* (async function*() { yield 1; })(); >x : any >yield* (async function*() { yield 1; })() : any ->(async function*() { yield 1; })() : AsyncIterableIterator<1> ->(async function*() { yield 1; }) : () => AsyncIterableIterator<1> ->async function*() { yield 1; } : () => AsyncIterableIterator<1> +>(async function*() { yield 1; })() : AsyncIterableIterator +>(async function*() { yield 1; }) : () => AsyncIterableIterator +>async function*() { yield 1; } : () => AsyncIterableIterator >yield 1 : any >1 : 1 } @@ -83,11 +83,11 @@ const o6 = { } === tests/cases/conformance/emitter/esnext/asyncGenerators/O7.ts === const o7 = { ->o7 : { f(): AsyncIterableIterator<1>; } ->{ async * f() { return 1; }} : { f(): AsyncIterableIterator<1>; } +>o7 : { f(): AsyncIterableIterator; } +>{ async * f() { return 1; }} : { f(): AsyncIterableIterator; } async * f() { ->f : () => AsyncIterableIterator<1> +>f : () => AsyncIterableIterator return 1; >1 : 1 diff --git a/tests/baselines/reference/generatorES6_2.types b/tests/baselines/reference/generatorES6_2.types index 61a2adbc697fa..a95a0008d4fe4 100644 --- a/tests/baselines/reference/generatorES6_2.types +++ b/tests/baselines/reference/generatorES6_2.types @@ -3,7 +3,7 @@ class C { >C : C public * foo() { ->foo : () => IterableIterator<1> +>foo : () => IterableIterator yield 1 >yield 1 : any diff --git a/tests/baselines/reference/generatorES6_3.types b/tests/baselines/reference/generatorES6_3.types index 9ecd01d6e23bb..e237cbd3510a2 100644 --- a/tests/baselines/reference/generatorES6_3.types +++ b/tests/baselines/reference/generatorES6_3.types @@ -1,7 +1,7 @@ === tests/cases/compiler/generatorES6_3.ts === var v = function*() { ->v : () => IterableIterator<0> ->function*() { yield 0} : () => IterableIterator<0> +>v : () => IterableIterator +>function*() { yield 0} : () => IterableIterator yield 0 >yield 0 : any diff --git a/tests/baselines/reference/generatorES6_4.types b/tests/baselines/reference/generatorES6_4.types index 786e7b64020fd..fa19d8f3ae2d5 100644 --- a/tests/baselines/reference/generatorES6_4.types +++ b/tests/baselines/reference/generatorES6_4.types @@ -1,10 +1,10 @@ === tests/cases/compiler/generatorES6_4.ts === var v = { ->v : { foo(): IterableIterator<0>; } ->{ *foo() { yield 0 }} : { foo(): IterableIterator<0>; } +>v : { foo(): IterableIterator; } +>{ *foo() { yield 0 }} : { foo(): IterableIterator; } *foo() { ->foo : () => IterableIterator<0> +>foo : () => IterableIterator yield 0 >yield 0 : any diff --git a/tests/baselines/reference/generatorTypeCheck15.types b/tests/baselines/reference/generatorTypeCheck15.types index 3851d8e56a416..33537836c120f 100644 --- a/tests/baselines/reference/generatorTypeCheck15.types +++ b/tests/baselines/reference/generatorTypeCheck15.types @@ -1,6 +1,6 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck15.ts === function* g() { ->g : () => IterableIterator<""> +>g : () => IterableIterator return ""; >"" : "" diff --git a/tests/baselines/reference/generatorTypeCheck33.types b/tests/baselines/reference/generatorTypeCheck33.types index 707bf7beccda2..d6b29936530d6 100644 --- a/tests/baselines/reference/generatorTypeCheck33.types +++ b/tests/baselines/reference/generatorTypeCheck33.types @@ -1,13 +1,13 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck33.ts === function* g() { ->g : () => IterableIterator<0> +>g : () => IterableIterator yield 0; >yield 0 : any >0 : 0 function* g2() { ->g2 : () => IterableIterator<""> +>g2 : () => IterableIterator yield ""; >yield "" : any diff --git a/tests/baselines/reference/generatorTypeCheck34.types b/tests/baselines/reference/generatorTypeCheck34.types index 239c5ff14936d..f25eefb72f7be 100644 --- a/tests/baselines/reference/generatorTypeCheck34.types +++ b/tests/baselines/reference/generatorTypeCheck34.types @@ -1,13 +1,13 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck34.ts === function* g() { ->g : () => IterableIterator<0> +>g : () => IterableIterator yield 0; >yield 0 : any >0 : 0 function* g2() { ->g2 : () => IterableIterator<""> +>g2 : () => IterableIterator return ""; >"" : "" diff --git a/tests/baselines/reference/generatorTypeCheck35.types b/tests/baselines/reference/generatorTypeCheck35.types index dcd5ab4be84bf..333b653a50148 100644 --- a/tests/baselines/reference/generatorTypeCheck35.types +++ b/tests/baselines/reference/generatorTypeCheck35.types @@ -1,6 +1,6 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck35.ts === function* g() { ->g : () => IterableIterator<0> +>g : () => IterableIterator yield 0; >yield 0 : any diff --git a/tests/baselines/reference/generatorTypeCheck38.types b/tests/baselines/reference/generatorTypeCheck38.types index 31fe452e65639..15b8528b345a6 100644 --- a/tests/baselines/reference/generatorTypeCheck38.types +++ b/tests/baselines/reference/generatorTypeCheck38.types @@ -3,7 +3,7 @@ var yield; >yield : any function* g() { ->g : () => IterableIterator<0> +>g : () => IterableIterator yield 0; >yield 0 : any diff --git a/tests/baselines/reference/generatorTypeCheck41.types b/tests/baselines/reference/generatorTypeCheck41.types index 1a9ea21f9786b..8e59ce188602e 100644 --- a/tests/baselines/reference/generatorTypeCheck41.types +++ b/tests/baselines/reference/generatorTypeCheck41.types @@ -1,6 +1,6 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck41.ts === function* g() { ->g : () => IterableIterator<0> +>g : () => IterableIterator let x = { >x : { [x: number]: number; } diff --git a/tests/baselines/reference/generatorTypeCheck42.types b/tests/baselines/reference/generatorTypeCheck42.types index 79b2516051e79..f7281d60afe1b 100644 --- a/tests/baselines/reference/generatorTypeCheck42.types +++ b/tests/baselines/reference/generatorTypeCheck42.types @@ -1,6 +1,6 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck42.ts === function* g() { ->g : () => IterableIterator<0> +>g : () => IterableIterator let x = { >x : { [x: number]: () => void; } diff --git a/tests/baselines/reference/generatorTypeCheck43.types b/tests/baselines/reference/generatorTypeCheck43.types index 754d3fee814c8..3e8ec02672a2f 100644 --- a/tests/baselines/reference/generatorTypeCheck43.types +++ b/tests/baselines/reference/generatorTypeCheck43.types @@ -1,6 +1,6 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck43.ts === function* g() { ->g : () => IterableIterator<0> +>g : () => IterableIterator let x = { >x : { [x: number]: () => IterableIterator; } diff --git a/tests/baselines/reference/generatorTypeCheck44.types b/tests/baselines/reference/generatorTypeCheck44.types index e06b8961ca07a..381feb30f3c67 100644 --- a/tests/baselines/reference/generatorTypeCheck44.types +++ b/tests/baselines/reference/generatorTypeCheck44.types @@ -1,6 +1,6 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck44.ts === function* g() { ->g : () => IterableIterator<0> +>g : () => IterableIterator let x = { >x : { [x: number]: number; } diff --git a/tests/baselines/reference/generatorTypeCheck49.types b/tests/baselines/reference/generatorTypeCheck49.types index 6ac2b6acce861..f73978d1a095a 100644 --- a/tests/baselines/reference/generatorTypeCheck49.types +++ b/tests/baselines/reference/generatorTypeCheck49.types @@ -1,6 +1,6 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck49.ts === function* g() { ->g : () => IterableIterator<0> +>g : () => IterableIterator yield 0; >yield 0 : any diff --git a/tests/baselines/reference/generatorTypeCheck51.types b/tests/baselines/reference/generatorTypeCheck51.types index ca50f640301d4..1563ee5e7d317 100644 --- a/tests/baselines/reference/generatorTypeCheck51.types +++ b/tests/baselines/reference/generatorTypeCheck51.types @@ -3,7 +3,7 @@ function* g() { >g : () => IterableIterator function* h() { ->h : () => IterableIterator<0> +>h : () => IterableIterator yield 0; >yield 0 : any diff --git a/tests/baselines/reference/generatorTypeCheck63.errors.txt b/tests/baselines/reference/generatorTypeCheck63.errors.txt index 1466530dd0c65..2a1935fd90633 100644 --- a/tests/baselines/reference/generatorTypeCheck63.errors.txt +++ b/tests/baselines/reference/generatorTypeCheck63.errors.txt @@ -3,9 +3,9 @@ tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck63.ts(24,61): err Type 'State | 1' is not assignable to type 'StrategicState'. Type '1' has no properties in common with type 'StrategicState'. tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck63.ts(29,70): error TS7025: Generator implicitly has type 'IterableIterator' because it does not yield any values. Consider supplying a return type. -tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck63.ts(32,62): error TS2345: Argument of type '(state: State) => IterableIterator<1>' is not assignable to parameter of type '(a: State) => IterableIterator'. - Type 'IterableIterator<1>' is not assignable to type 'IterableIterator'. - Type '1' is not assignable to type 'State'. +tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck63.ts(32,62): error TS2345: Argument of type '(state: State) => IterableIterator' is not assignable to parameter of type '(a: State) => IterableIterator'. + Type 'IterableIterator' is not assignable to type 'IterableIterator'. + Type 'number' is not assignable to type 'State'. tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck63.ts(36,62): error TS2345: Argument of type '(state: State) => IterableIterator' is not assignable to parameter of type '(a: StrategicState) => IterableIterator'. Type 'IterableIterator' is not assignable to type 'IterableIterator'. @@ -51,9 +51,9 @@ tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck63.ts(36,62): err export const Nothing2: Strategy = strategy("Nothing", function* (state: State) { ~~~~~~~~ -!!! error TS2345: Argument of type '(state: State) => IterableIterator<1>' is not assignable to parameter of type '(a: State) => IterableIterator'. -!!! error TS2345: Type 'IterableIterator<1>' is not assignable to type 'IterableIterator'. -!!! error TS2345: Type '1' is not assignable to type 'State'. +!!! error TS2345: Argument of type '(state: State) => IterableIterator' is not assignable to parameter of type '(a: State) => IterableIterator'. +!!! error TS2345: Type 'IterableIterator' is not assignable to type 'IterableIterator'. +!!! error TS2345: Type 'number' is not assignable to type 'State'. return 1; }); diff --git a/tests/baselines/reference/generatorTypeCheck63.types b/tests/baselines/reference/generatorTypeCheck63.types index cd41a1776b865..8fc2054bd6e74 100644 --- a/tests/baselines/reference/generatorTypeCheck63.types +++ b/tests/baselines/reference/generatorTypeCheck63.types @@ -107,7 +107,7 @@ export const Nothing2: Strategy = strategy("Nothing", function* (state: S >strategy("Nothing", function* (state: State) { return 1;}) : any >strategy : (stratName: string, gen: (a: T) => IterableIterator) => (a: T) => IterableIterator >"Nothing" : "Nothing" ->function* (state: State) { return 1;} : (state: State) => IterableIterator<1> +>function* (state: State) { return 1;} : (state: State) => IterableIterator >state : State >State : State diff --git a/tests/baselines/reference/gettersAndSettersErrors.errors.txt b/tests/baselines/reference/gettersAndSettersErrors.errors.txt index 3d762c6270f99..594c9d0bf621f 100644 --- a/tests/baselines/reference/gettersAndSettersErrors.errors.txt +++ b/tests/baselines/reference/gettersAndSettersErrors.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/gettersAndSettersErrors.ts(2,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/gettersAndSettersErrors.ts(3,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/gettersAndSettersErrors.ts(5,12): error TS2300: Duplicate identifier 'Foo'. -tests/cases/compiler/gettersAndSettersErrors.ts(5,12): error TS2403: Subsequent variable declarations must have the same type. Variable 'Foo' has type 'string' at tests/cases/compiler/gettersAndSettersErrors.ts 1:15, but here has type 'number'. +tests/cases/compiler/gettersAndSettersErrors.ts(5,12): error TS2717: Subsequent property declarations must have the same type. Property 'Foo' has type 'string' at tests/cases/compiler/gettersAndSettersErrors.ts 1:15, but here has type 'number'. tests/cases/compiler/gettersAndSettersErrors.ts(6,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/gettersAndSettersErrors.ts(7,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/gettersAndSettersErrors.ts(11,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -23,7 +23,7 @@ tests/cases/compiler/gettersAndSettersErrors.ts(12,16): error TS2379: Getter and ~~~ !!! error TS2300: Duplicate identifier 'Foo'. ~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Foo' has type 'string' at tests/cases/compiler/gettersAndSettersErrors.ts 1:15, but here has type 'number'. +!!! error TS2717: Subsequent property declarations must have the same type. Property 'Foo' has type 'string' at tests/cases/compiler/gettersAndSettersErrors.ts 1:15, but here has type 'number'. public get Goo(v:string):string {return null;} // error - getters must not have a parameter ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. diff --git a/tests/baselines/reference/giant.errors.txt b/tests/baselines/reference/giant.errors.txt index 809ae03635824..eb899ff132e6d 100644 --- a/tests/baselines/reference/giant.errors.txt +++ b/tests/baselines/reference/giant.errors.txt @@ -16,7 +16,7 @@ tests/cases/compiler/giant.ts(33,16): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(34,12): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(35,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(35,16): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(60,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. +tests/cases/compiler/giant.ts(60,5): error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. tests/cases/compiler/giant.ts(60,6): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(61,5): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(62,6): error TS1096: An index signature must have exactly one parameter. @@ -39,7 +39,7 @@ tests/cases/compiler/giant.ts(97,20): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(98,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(99,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(99,20): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(124,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. +tests/cases/compiler/giant.ts(124,9): error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. tests/cases/compiler/giant.ts(124,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(125,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(126,10): error TS1096: An index signature must have exactly one parameter. @@ -63,7 +63,7 @@ tests/cases/compiler/giant.ts(176,20): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(177,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(178,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(178,20): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(203,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. +tests/cases/compiler/giant.ts(203,9): error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. tests/cases/compiler/giant.ts(203,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(204,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(205,10): error TS1096: An index signature must have exactly one parameter. @@ -119,7 +119,7 @@ tests/cases/compiler/giant.ts(291,16): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(292,12): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(293,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(293,16): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(318,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. +tests/cases/compiler/giant.ts(318,5): error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. tests/cases/compiler/giant.ts(318,6): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(319,5): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(320,6): error TS1096: An index signature must have exactly one parameter. @@ -142,7 +142,7 @@ tests/cases/compiler/giant.ts(355,20): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(356,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(357,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(357,20): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(382,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. +tests/cases/compiler/giant.ts(382,9): error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. tests/cases/compiler/giant.ts(382,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(383,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(384,10): error TS1096: An index signature must have exactly one parameter. @@ -166,7 +166,7 @@ tests/cases/compiler/giant.ts(434,20): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(435,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(436,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(436,20): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(461,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. +tests/cases/compiler/giant.ts(461,9): error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. tests/cases/compiler/giant.ts(461,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(462,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(463,10): error TS1096: An index signature must have exactly one parameter. @@ -238,7 +238,7 @@ tests/cases/compiler/giant.ts(555,21): error TS1036: Statements are not allowed tests/cases/compiler/giant.ts(557,24): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(560,21): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(562,21): error TS1183: An implementation cannot be declared in ambient contexts. -tests/cases/compiler/giant.ts(586,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. +tests/cases/compiler/giant.ts(586,9): error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. tests/cases/compiler/giant.ts(586,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(587,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(588,10): error TS1096: An index signature must have exactly one parameter. @@ -255,7 +255,7 @@ tests/cases/compiler/giant.ts(620,26): error TS1183: An implementation cannot be tests/cases/compiler/giant.ts(622,24): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(625,21): error TS1183: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(627,21): error TS1183: An implementation cannot be declared in ambient contexts. -tests/cases/compiler/giant.ts(652,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. +tests/cases/compiler/giant.ts(652,9): error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. tests/cases/compiler/giant.ts(652,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(653,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(654,10): error TS1096: An index signature must have exactly one parameter. @@ -363,7 +363,7 @@ tests/cases/compiler/giant.ts(675,30): error TS1183: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. +!!! error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -473,7 +473,7 @@ tests/cases/compiler/giant.ts(675,30): error TS1183: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. +!!! error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -600,7 +600,7 @@ tests/cases/compiler/giant.ts(675,30): error TS1183: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. +!!! error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -827,7 +827,7 @@ tests/cases/compiler/giant.ts(675,30): error TS1183: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. +!!! error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -937,7 +937,7 @@ tests/cases/compiler/giant.ts(675,30): error TS1183: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. +!!! error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -1064,7 +1064,7 @@ tests/cases/compiler/giant.ts(675,30): error TS1183: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. +!!! error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -1333,7 +1333,7 @@ tests/cases/compiler/giant.ts(675,30): error TS1183: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. +!!! error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -1433,7 +1433,7 @@ tests/cases/compiler/giant.ts(675,30): error TS1183: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. +!!! error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; diff --git a/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt b/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt index 88e09d7746b92..bc18e0fb08486 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: A computed property name in an interface must directly refer to a built-in symbol. +tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(3,5): error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. 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: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(9,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. 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: A computed property name in an interface must directly refer to a built-in symbol. +!!! error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! 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: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! error TS2304: Cannot find name 'x'. diff --git a/tests/baselines/reference/indexSignatureWithInitializer.errors.txt b/tests/baselines/reference/indexSignatureWithInitializer.errors.txt index 4a49de69393ac..a2e78df0ed83f 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: A computed property name in an interface must directly refer to a built-in symbol. +tests/cases/compiler/indexSignatureWithInitializer.ts(3,5): error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. tests/cases/compiler/indexSignatureWithInitializer.ts(3,6): error TS2304: Cannot find name 'x'. -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,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. 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: A computed property name in an interface must directly refer to a built-in symbol. +!!! error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! 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: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! error TS2304: Cannot find name 'x'. } \ No newline at end of file diff --git a/tests/baselines/reference/indexWithoutParamType2.errors.txt b/tests/baselines/reference/indexWithoutParamType2.errors.txt index 7e72b7804e29c..5463980d66d68 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: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/compiler/indexWithoutParamType2.ts(3,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. 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: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! error TS2304: Cannot find name 'x'. } \ No newline at end of file diff --git a/tests/baselines/reference/interfaceDeclaration1.errors.txt b/tests/baselines/reference/interfaceDeclaration1.errors.txt index 7a31aec7c6a3f..86e4647edde1c 100644 --- a/tests/baselines/reference/interfaceDeclaration1.errors.txt +++ b/tests/baselines/reference/interfaceDeclaration1.errors.txt @@ -2,7 +2,7 @@ tests/cases/compiler/interfaceDeclaration1.ts(2,5): error TS2300: Duplicate iden tests/cases/compiler/interfaceDeclaration1.ts(3,5): error TS2300: Duplicate identifier 'item'. tests/cases/compiler/interfaceDeclaration1.ts(7,5): error TS2300: Duplicate identifier 'item'. tests/cases/compiler/interfaceDeclaration1.ts(8,5): error TS2300: Duplicate identifier 'item'. -tests/cases/compiler/interfaceDeclaration1.ts(8,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'item' has type 'any' at tests/cases/compiler/interfaceDeclaration1.ts 6:4, but here has type 'number'. +tests/cases/compiler/interfaceDeclaration1.ts(8,5): error TS2717: Subsequent property declarations must have the same type. Property 'item' has type 'any' at tests/cases/compiler/interfaceDeclaration1.ts 6:4, but here has type 'number'. tests/cases/compiler/interfaceDeclaration1.ts(22,11): error TS2310: Type 'I5' recursively references itself as a base type. tests/cases/compiler/interfaceDeclaration1.ts(35,7): error TS2420: Class 'C1' incorrectly implements interface 'I3'. Property 'prototype' is missing in type 'C1'. @@ -29,7 +29,7 @@ tests/cases/compiler/interfaceDeclaration1.ts(52,11): error TS2320: Interface 'i ~~~~ !!! error TS2300: Duplicate identifier 'item'. ~~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'item' has type 'any' at tests/cases/compiler/interfaceDeclaration1.ts 6:4, but here has type 'number'. +!!! error TS2717: Subsequent property declarations must have the same type. Property 'item' has type 'any' at tests/cases/compiler/interfaceDeclaration1.ts 6:4, but here has type 'number'. } interface I3 { diff --git a/tests/baselines/reference/literalsInComputedProperties1.symbols b/tests/baselines/reference/literalsInComputedProperties1.symbols index e0f22d39e8d32..501b969706ab7 100644 --- a/tests/baselines/reference/literalsInComputedProperties1.symbols +++ b/tests/baselines/reference/literalsInComputedProperties1.symbols @@ -39,11 +39,11 @@ interface A { 1:number; [2]:number; ->2 : Symbol(A[[2]], Decl(literalsInComputedProperties1.ts, 12, 13)) +>2 : Symbol(A[2], Decl(literalsInComputedProperties1.ts, 12, 13)) "3":number; ["4"]:number; ->"4" : Symbol(A[["4"]], Decl(literalsInComputedProperties1.ts, 14, 15)) +>"4" : Symbol(A["4"], Decl(literalsInComputedProperties1.ts, 14, 15)) } let y:A; @@ -59,7 +59,7 @@ y[1].toExponential(); y[2].toExponential(); >y[2].toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) >y : Symbol(y, Decl(literalsInComputedProperties1.ts, 18, 3)) ->2 : Symbol(A[[2]], Decl(literalsInComputedProperties1.ts, 12, 13)) +>2 : Symbol(A[2], Decl(literalsInComputedProperties1.ts, 12, 13)) >toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) y[3].toExponential(); @@ -71,7 +71,7 @@ y[3].toExponential(); y[4].toExponential(); >y[4].toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) >y : Symbol(y, Decl(literalsInComputedProperties1.ts, 18, 3)) ->4 : Symbol(A[["4"]], Decl(literalsInComputedProperties1.ts, 14, 15)) +>4 : Symbol(A["4"], Decl(literalsInComputedProperties1.ts, 14, 15)) >toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) class C { @@ -79,11 +79,11 @@ class C { 1:number; [2]:number; ->2 : Symbol(C[[2]], Decl(literalsInComputedProperties1.ts, 25, 13)) +>2 : Symbol(C[2], Decl(literalsInComputedProperties1.ts, 25, 13)) "3":number; ["4"]:number; ->"4" : Symbol(C[["4"]], Decl(literalsInComputedProperties1.ts, 27, 15)) +>"4" : Symbol(C["4"], Decl(literalsInComputedProperties1.ts, 27, 15)) } let z:C; @@ -99,7 +99,7 @@ z[1].toExponential(); z[2].toExponential(); >z[2].toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) >z : Symbol(z, Decl(literalsInComputedProperties1.ts, 31, 3)) ->2 : Symbol(C[[2]], Decl(literalsInComputedProperties1.ts, 25, 13)) +>2 : Symbol(C[2], Decl(literalsInComputedProperties1.ts, 25, 13)) >toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) z[3].toExponential(); @@ -111,7 +111,7 @@ z[3].toExponential(); z[4].toExponential(); >z[4].toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) >z : Symbol(z, Decl(literalsInComputedProperties1.ts, 31, 3)) ->4 : Symbol(C[["4"]], Decl(literalsInComputedProperties1.ts, 27, 15)) +>4 : Symbol(C["4"], Decl(literalsInComputedProperties1.ts, 27, 15)) >toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) enum X { @@ -119,15 +119,15 @@ enum X { 1 = 1, [2] = 2, ->2 : Symbol(X[[2]], Decl(literalsInComputedProperties1.ts, 38, 10)) +>2 : Symbol(X[2], Decl(literalsInComputedProperties1.ts, 38, 10)) "3" = 3, ["4"] = 4, ->"4" : Symbol(X[["4"]], Decl(literalsInComputedProperties1.ts, 40, 12)) +>"4" : Symbol(X["4"], Decl(literalsInComputedProperties1.ts, 40, 12)) "foo" = 5, ["bar"] = 6 ->"bar" : Symbol(X[["bar"]], Decl(literalsInComputedProperties1.ts, 42, 14)) +>"bar" : Symbol(X["bar"], Decl(literalsInComputedProperties1.ts, 42, 14)) } let a = X["foo"]; @@ -138,6 +138,6 @@ let a = X["foo"]; let a0 = X["bar"]; >a0 : Symbol(a0, Decl(literalsInComputedProperties1.ts, 47, 3)) >X : Symbol(X, Decl(literalsInComputedProperties1.ts, 35, 21)) ->"bar" : Symbol(X[["bar"]], Decl(literalsInComputedProperties1.ts, 42, 14)) +>"bar" : Symbol(X["bar"], Decl(literalsInComputedProperties1.ts, 42, 14)) // TODO: make sure that enum still disallow template literals as member names diff --git a/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames.errors.txt b/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames.errors.txt index c4a6cb926d6d1..6bfdc149a6d04 100644 --- a/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames.errors.txt +++ b/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(6,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'string' at tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts 1:4, but here has type 'number'. -tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(15,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'T' at tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts 10:8, but here has type 'number'. -tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(39,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'T' at tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts 32:8, but here has type 'number'. +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(6,5): error TS2717: Subsequent property declarations must have the same type. Property 'x' has type 'string' at tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts 1:4, but here has type 'number'. +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(15,9): error TS2717: Subsequent property declarations must have the same type. Property 'x' has type 'T' at tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts 10:8, but here has type 'number'. +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(39,9): error TS2717: Subsequent property declarations must have the same type. Property 'x' has type 'T' at tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts 32:8, but here has type 'number'. ==== tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts (3 errors) ==== @@ -11,7 +11,7 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConfli interface A { x: number; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'string' at tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts 1:4, but here has type 'number'. +!!! error TS2717: Subsequent property declarations must have the same type. Property 'x' has type 'string' at tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts 1:4, but here has type 'number'. } module M { @@ -22,7 +22,7 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConfli interface A { x: number; // error ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'T' at tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts 10:8, but here has type 'number'. +!!! error TS2717: Subsequent property declarations must have the same type. Property 'x' has type 'T' at tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts 10:8, but here has type 'number'. } } @@ -48,6 +48,6 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConfli export interface A { x: number; // error ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'T' at tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts 32:8, but here has type 'number'. +!!! error TS2717: Subsequent property declarations must have the same type. Property 'x' has type 'T' at tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts 32:8, but here has type 'number'. } } \ No newline at end of file diff --git a/tests/baselines/reference/numericStringNamedPropertyEquivalence.errors.txt b/tests/baselines/reference/numericStringNamedPropertyEquivalence.errors.txt index 172576cdde1da..87e491fbd5da6 100644 --- a/tests/baselines/reference/numericStringNamedPropertyEquivalence.errors.txt +++ b/tests/baselines/reference/numericStringNamedPropertyEquivalence.errors.txt @@ -3,7 +3,7 @@ tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericString tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(12,5): error TS2300: Duplicate identifier '1'. tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(16,5): error TS2300: Duplicate identifier '1'. tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(17,5): error TS2300: Duplicate identifier '1'. -tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(17,5): error TS2403: Subsequent variable declarations must have the same type. Variable '1.0' has type 'number' at tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts 15:4, but here has type 'string'. +tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(17,5): error TS2717: Subsequent property declarations must have the same type. Property '1.0' has type 'number' at tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts 15:4, but here has type 'string'. tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(22,5): error TS2300: Duplicate identifier '0'. @@ -36,7 +36,7 @@ tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericString ~~~ !!! error TS2300: Duplicate identifier '1'. ~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable '1.0' has type 'number' at tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts 15:4, but here has type 'string'. +!!! error TS2717: Subsequent property declarations must have the same type. Property '1.0' has type 'number' at tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts 15:4, but here has type 'string'. } var b = { diff --git a/tests/baselines/reference/parser.asyncGenerators.classMethods.esnext.types b/tests/baselines/reference/parser.asyncGenerators.classMethods.esnext.types index ad6d810b0cb11..254d983caaa80 100644 --- a/tests/baselines/reference/parser.asyncGenerators.classMethods.esnext.types +++ b/tests/baselines/reference/parser.asyncGenerators.classMethods.esnext.types @@ -151,7 +151,7 @@ class C14 { >C14 : C14 async * f() { ->f : () => AsyncIterableIterator<1> +>f : () => AsyncIterableIterator yield 1; >yield 1 : any @@ -175,7 +175,7 @@ class C16 { >C16 : C16 async * f() { ->f : () => AsyncIterableIterator +>f : () => AsyncIterableIterator yield * []; >yield * [] : any diff --git a/tests/baselines/reference/parser.asyncGenerators.functionDeclarations.esnext.types b/tests/baselines/reference/parser.asyncGenerators.functionDeclarations.esnext.types index 772de158358ea..c27e9209611f2 100644 --- a/tests/baselines/reference/parser.asyncGenerators.functionDeclarations.esnext.types +++ b/tests/baselines/reference/parser.asyncGenerators.functionDeclarations.esnext.types @@ -95,7 +95,7 @@ async function * f13() { } === tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldWithValueIsOk.ts === async function * f14() { ->f14 : () => AsyncIterableIterator<1> +>f14 : () => AsyncIterableIterator yield 1; >yield 1 : any @@ -111,7 +111,7 @@ async function * f15() { } === tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldStarWithValueIsOk.ts === async function * f16() { ->f16 : () => AsyncIterableIterator +>f16 : () => AsyncIterableIterator yield * []; >yield * [] : any diff --git a/tests/baselines/reference/parser.asyncGenerators.functionExpressions.esnext.types b/tests/baselines/reference/parser.asyncGenerators.functionExpressions.esnext.types index 6524ee9008caf..7b9ddf152d599 100644 --- a/tests/baselines/reference/parser.asyncGenerators.functionExpressions.esnext.types +++ b/tests/baselines/reference/parser.asyncGenerators.functionExpressions.esnext.types @@ -122,8 +122,8 @@ const f13 = async function * () { }; === tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldWithValueIsOk.ts === const f14 = async function * () { ->f14 : () => AsyncIterableIterator<1> ->async function * () { yield 1;} : () => AsyncIterableIterator<1> +>f14 : () => AsyncIterableIterator +>async function * () { yield 1;} : () => AsyncIterableIterator yield 1; >yield 1 : any @@ -142,8 +142,8 @@ const f15 = async function * () { }; === tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldStarWithValueIsOk.ts === const f16 = async function * () { ->f16 : () => AsyncIterableIterator ->async function * () { yield * [];} : () => AsyncIterableIterator +>f16 : () => AsyncIterableIterator +>async function * () { yield * [];} : () => AsyncIterableIterator yield * []; >yield * [] : any diff --git a/tests/baselines/reference/parser.asyncGenerators.objectLiteralMethods.esnext.types b/tests/baselines/reference/parser.asyncGenerators.objectLiteralMethods.esnext.types index d352b54158549..59ed6e16745a5 100644 --- a/tests/baselines/reference/parser.asyncGenerators.objectLiteralMethods.esnext.types +++ b/tests/baselines/reference/parser.asyncGenerators.objectLiteralMethods.esnext.types @@ -163,11 +163,11 @@ const o13 = { }; === tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldWithValueIsOk.ts === const o14 = { ->o14 : { f(): AsyncIterableIterator<1>; } ->{ async * f() { yield 1; }} : { f(): AsyncIterableIterator<1>; } +>o14 : { f(): AsyncIterableIterator; } +>{ async * f() { yield 1; }} : { f(): AsyncIterableIterator; } async * f() { ->f : () => AsyncIterableIterator<1> +>f : () => AsyncIterableIterator yield 1; >yield 1 : any @@ -189,11 +189,11 @@ const o15 = { }; === tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldStarWithValueIsOk.ts === const o16 = { ->o16 : { f(): AsyncIterableIterator; } ->{ async * f() { yield * []; }} : { f(): AsyncIterableIterator; } +>o16 : { f(): AsyncIterableIterator; } +>{ async * f() { yield * []; }} : { f(): AsyncIterableIterator; } async * f() { ->f : () => AsyncIterableIterator +>f : () => AsyncIterableIterator yield * []; >yield * [] : any diff --git a/tests/baselines/reference/parserComputedPropertyName10.errors.txt b/tests/baselines/reference/parserComputedPropertyName10.errors.txt index a9b5396781aa5..c8ca89f400214 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: 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,4): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. 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: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! 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 2a7a606f4bfcb..abbb667723b7e 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: 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,4): error TS1168: A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type. 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: A computed property name in a method overload must directly refer to a built-in symbol. +!!! error TS1168: A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! 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 a7a77cf12440f..65fa109c34878 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: 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,10): error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type. 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: A computed property name in a type literal must directly refer to a built-in symbol. +!!! error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! 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 50a6d1bc689ac..668e1542c6250 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: 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,10): error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type. 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: A computed property name in a type literal must directly refer to a built-in symbol. +!!! error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! 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 9635178af1673..2311fcafc348c 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: 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,31): error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type. 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: A computed property name in a type literal must directly refer to a built-in symbol. +!!! error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! 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 9e64ddd0d28db..8730dd6077468 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: 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,10): error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type. 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: A computed property name in a type literal must directly refer to a built-in symbol. +!!! error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! 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 86bb591011e36..d7b2e25377d20 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: 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,10): error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type. 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: A computed property name in a type literal must directly refer to a built-in symbol. +!!! error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! 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 035e494af332c..972457d8fbb88 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: A computed property name in an interface must directly refer to a built-in symbol. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName20.ts(2,5): error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. 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: A computed property name in an interface must directly refer to a built-in symbol. +!!! error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! 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 4ebc321cc8032..52c26498999fa 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: A computed property name in an interface must directly refer to a built-in symbol. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName21.ts(2,5): error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. 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: A computed property name in an interface must directly refer to a built-in symbol. +!!! error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! 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 fd9e37970187c..866468aa53d93 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: 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,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. 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: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! 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 0d0a2a8d8332b..d6bbb52ff7ce9 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: 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,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. 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: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! 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 a84f3b7d16b96..df9202df567db 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: 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,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. 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: 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,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. 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: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! error TS2304: Cannot find name 'e'. [e2]: number ~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. ~~ !!! 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 3d886eacc5063..53800078b5eb7 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: 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,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. 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: 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,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. 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: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! error TS2304: Cannot find name 'e'. ~~ !!! error TS2304: Cannot find name 'id'. [e2]: number ~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. ~~ !!! 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 4661b0797af98..57591fd4d946f 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: 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,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. 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: 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,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. 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: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! error TS2304: Cannot find name 'e'. [e2]: number ~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. ~~ !!! 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 4be8d70383e19..5d762d5ecc8e8 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: 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,5): error TS1165: A computed property name in an ambient context must refer to an expression whose type is a literal type or a 'unique symbol' type. 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: A computed property name in an ambient context must directly refer to a built-in symbol. +!!! error TS1165: A computed property name in an ambient context must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! 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 6bcb5b5278998..9fbd7f565ad8f 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: 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,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName36.ts(2,6): error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName36.ts(2,6): error TS2304: Cannot find name 'public'. @@ -7,7 +7,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP class C { [public ]: string; ~~~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. ~~~~~~ !!! error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode. ~~~~~~ diff --git a/tests/baselines/reference/parserComputedPropertyName7.errors.txt b/tests/baselines/reference/parserComputedPropertyName7.errors.txt index 056fa3d82fdd4..4fd7f320f266e 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: 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,4): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. 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: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! 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 32bb490635357..a846f858ea78d 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: 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,11): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. 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: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! 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 9db0cbde3bd29..8d0390053f121 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: 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,4): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. 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: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! error TS2304: Cannot find name 'e'. ~~~~ diff --git a/tests/baselines/reference/parserES5ComputedPropertyName1.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName1.errors.txt index 2c8f1d2ab4f0e..7b1f9cb183248 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: 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,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. 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: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! 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 31d3f9985abae..6fcb462d9e332 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: 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,4): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. 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: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! 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 b4808607ab06d..2bd17b3f4ca10 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: 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,4): error TS1168: A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type. 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: A computed property name in a method overload must directly refer to a built-in symbol. +!!! error TS1168: A computed property name in a method overload must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! 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 9125ce7b58f42..3c7cdfd38a34e 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: A computed property name in an interface must directly refer to a built-in symbol. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName5.ts(2,5): error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. 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: A computed property name in an interface must directly refer to a built-in symbol. +!!! error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! 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 277bdcd3c94a5..487e84cccbf40 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: 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,4): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. 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: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! 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 6b674a1d2c05b..6057d4f7cd339 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: 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,10): error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type. 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: A computed property name in a type literal must directly refer to a built-in symbol. +!!! error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! 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 fb087a4d82fcc..cb08a497e1cd4 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: 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,4): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. 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: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! error TS2304: Cannot find name 'e'. ~~~~ diff --git a/tests/baselines/reference/parserIndexSignature11.errors.txt b/tests/baselines/reference/parserIndexSignature11.errors.txt index f1f2a4a00f465..1f52552235743 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: A computed property name in an interface must directly refer to a built-in symbol. +tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts(2,9): error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. 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: A computed property name in an interface must directly refer to a built-in symbol. +!!! error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! 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 bd73b4d2bf451..8bc0d9c40eac6 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: A computed property name in an interface must directly refer to a built-in symbol. +tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature4.ts(2,3): error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. 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: A computed property name in an interface must directly refer to a built-in symbol. +!!! error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! 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 54ccd05f4f99f..c868ecc48e312 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: A computed property name in an interface must directly refer to a built-in symbol. +tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature5.ts(2,3): error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. 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: A computed property name in an interface must directly refer to a built-in symbol. +!!! error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type. ~ !!! error TS2304: Cannot find name 'a'. } \ No newline at end of file diff --git a/tests/baselines/reference/propertyAssignment.errors.txt b/tests/baselines/reference/propertyAssignment.errors.txt index 6aa34c15ac90e..cb1b31ddb4d4c 100644 --- a/tests/baselines/reference/propertyAssignment.errors.txt +++ b/tests/baselines/reference/propertyAssignment.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/propertyAssignment.ts(4,13): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. +tests/cases/compiler/propertyAssignment.ts(4,13): error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type. tests/cases/compiler/propertyAssignment.ts(4,14): error TS2304: Cannot find name 'index'. tests/cases/compiler/propertyAssignment.ts(12,1): error TS2322: Type '{ x: number; }' is not assignable to type 'new () => any'. Type '{ x: number; }' provides no match for the signature 'new (): any'. @@ -12,7 +12,7 @@ tests/cases/compiler/propertyAssignment.ts(14,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: A computed property name in a type literal must directly refer to a built-in symbol. +!!! error TS1170: A computed property name in a type literal must refer to an expression whose type is a literal type or a 'unique symbol' type. ~~~~~ !!! error TS2304: Cannot find name 'index'. var bar2: { x : number; } diff --git a/tests/baselines/reference/reassignStaticProp.errors.txt b/tests/baselines/reference/reassignStaticProp.errors.txt index 4a698eddab760..bc54e6a7b35b6 100644 --- a/tests/baselines/reference/reassignStaticProp.errors.txt +++ b/tests/baselines/reference/reassignStaticProp.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/reassignStaticProp.ts(5,12): error TS2300: Duplicate identifier 'bar'. -tests/cases/compiler/reassignStaticProp.ts(5,12): error TS2403: Subsequent variable declarations must have the same type. Variable 'bar' has type 'number' at tests/cases/compiler/reassignStaticProp.ts 2:11, but here has type 'string'. +tests/cases/compiler/reassignStaticProp.ts(5,12): error TS2717: Subsequent property declarations must have the same type. Property 'bar' has type 'number' at tests/cases/compiler/reassignStaticProp.ts 2:11, but here has type 'string'. ==== tests/cases/compiler/reassignStaticProp.ts (2 errors) ==== @@ -11,7 +11,7 @@ tests/cases/compiler/reassignStaticProp.ts(5,12): error TS2403: Subsequent varia ~~~ !!! error TS2300: Duplicate identifier 'bar'. ~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'bar' has type 'number' at tests/cases/compiler/reassignStaticProp.ts 2:11, but here has type 'string'. +!!! error TS2717: Subsequent property declarations must have the same type. Property 'bar' has type 'number' at tests/cases/compiler/reassignStaticProp.ts 2:11, but here has type 'string'. } diff --git a/tests/baselines/reference/symbolProperty7.errors.txt b/tests/baselines/reference/symbolProperty7.errors.txt index 652f637d852d0..bf6065a89d9ed 100644 --- a/tests/baselines/reference/symbolProperty7.errors.txt +++ b/tests/baselines/reference/symbolProperty7.errors.txt @@ -1,15 +1,15 @@ -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,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. +tests/cases/conformance/es6/Symbols/symbolProperty7.ts(3,5): error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. ==== 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. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. [Symbol()]: number; ~~~~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +!!! error TS1166: A computed property name in a class property declaration must refer to an expression whose type is a literal type or a 'unique symbol' type. [Symbol()]() { } get [Symbol()]() { return 0; diff --git a/tests/baselines/reference/templateStringWithEmbeddedYieldKeywordES6.types b/tests/baselines/reference/templateStringWithEmbeddedYieldKeywordES6.types index e4496aa4e8ba8..dfd4e522def17 100644 --- a/tests/baselines/reference/templateStringWithEmbeddedYieldKeywordES6.types +++ b/tests/baselines/reference/templateStringWithEmbeddedYieldKeywordES6.types @@ -1,6 +1,6 @@ === tests/cases/conformance/es6/templates/templateStringWithEmbeddedYieldKeywordES6.ts === function* gen() { ->gen : () => IterableIterator<10> +>gen : () => IterableIterator // Once this is supported, yield *must* be parenthesized. var x = `abc${ yield 10 }def`; diff --git a/tests/baselines/reference/types.asyncGenerators.esnext.1.types b/tests/baselines/reference/types.asyncGenerators.esnext.1.types index 1a72da228e762..6e29e9cc95cab 100644 --- a/tests/baselines/reference/types.asyncGenerators.esnext.1.types +++ b/tests/baselines/reference/types.asyncGenerators.esnext.1.types @@ -9,7 +9,7 @@ async function * inferReturnType2() { >yield : any } async function * inferReturnType3() { ->inferReturnType3 : () => AsyncIterableIterator<1> +>inferReturnType3 : () => AsyncIterableIterator yield 1; >yield 1 : any @@ -63,20 +63,20 @@ async function * inferReturnType7() { >1 : 1 } async function * inferReturnType8() { ->inferReturnType8 : () => AsyncIterableIterator<1> +>inferReturnType8 : () => AsyncIterableIterator yield* (async function * () { yield 1; })(); >yield* (async function * () { yield 1; })() : any ->(async function * () { yield 1; })() : AsyncIterableIterator<1> ->(async function * () { yield 1; }) : () => AsyncIterableIterator<1> ->async function * () { yield 1; } : () => AsyncIterableIterator<1> +>(async function * () { yield 1; })() : AsyncIterableIterator +>(async function * () { yield 1; }) : () => AsyncIterableIterator +>async function * () { yield 1; } : () => AsyncIterableIterator >yield 1 : any >1 : 1 } const assignability1: () => AsyncIterableIterator = async function * () { >assignability1 : () => AsyncIterableIterator >AsyncIterableIterator : AsyncIterableIterator ->async function * () { yield 1;} : () => AsyncIterableIterator<1> +>async function * () { yield 1;} : () => AsyncIterableIterator yield 1; >yield 1 : any @@ -127,13 +127,13 @@ const assignability4: () => AsyncIterableIterator = async function * () const assignability5: () => AsyncIterableIterator = async function * () { >assignability5 : () => AsyncIterableIterator >AsyncIterableIterator : AsyncIterableIterator ->async function * () { yield* (async function * () { yield 1; })();} : () => AsyncIterableIterator<1> +>async function * () { yield* (async function * () { yield 1; })();} : () => AsyncIterableIterator yield* (async function * () { yield 1; })(); >yield* (async function * () { yield 1; })() : any ->(async function * () { yield 1; })() : AsyncIterableIterator<1> ->(async function * () { yield 1; }) : () => AsyncIterableIterator<1> ->async function * () { yield 1; } : () => AsyncIterableIterator<1> +>(async function * () { yield 1; })() : AsyncIterableIterator +>(async function * () { yield 1; }) : () => AsyncIterableIterator +>async function * () { yield 1; } : () => AsyncIterableIterator >yield 1 : any >1 : 1 @@ -141,7 +141,7 @@ const assignability5: () => AsyncIterableIterator = async function * () const assignability6: () => AsyncIterable = async function * () { >assignability6 : () => AsyncIterable >AsyncIterable : AsyncIterable ->async function * () { yield 1;} : () => AsyncIterableIterator<1> +>async function * () { yield 1;} : () => AsyncIterableIterator yield 1; >yield 1 : any @@ -192,13 +192,13 @@ const assignability9: () => AsyncIterable = async function * () { const assignability10: () => AsyncIterable = async function * () { >assignability10 : () => AsyncIterable >AsyncIterable : AsyncIterable ->async function * () { yield* (async function * () { yield 1; })();} : () => AsyncIterableIterator<1> +>async function * () { yield* (async function * () { yield 1; })();} : () => AsyncIterableIterator yield* (async function * () { yield 1; })(); >yield* (async function * () { yield 1; })() : any ->(async function * () { yield 1; })() : AsyncIterableIterator<1> ->(async function * () { yield 1; }) : () => AsyncIterableIterator<1> ->async function * () { yield 1; } : () => AsyncIterableIterator<1> +>(async function * () { yield 1; })() : AsyncIterableIterator +>(async function * () { yield 1; }) : () => AsyncIterableIterator +>async function * () { yield 1; } : () => AsyncIterableIterator >yield 1 : any >1 : 1 @@ -206,7 +206,7 @@ const assignability10: () => AsyncIterable = async function * () { const assignability11: () => AsyncIterator = async function * () { >assignability11 : () => AsyncIterator >AsyncIterator : AsyncIterator ->async function * () { yield 1;} : () => AsyncIterableIterator<1> +>async function * () { yield 1;} : () => AsyncIterableIterator yield 1; >yield 1 : any @@ -257,13 +257,13 @@ const assignability14: () => AsyncIterator = async function * () { const assignability15: () => AsyncIterator = async function * () { >assignability15 : () => AsyncIterator >AsyncIterator : AsyncIterator ->async function * () { yield* (async function * () { yield 1; })();} : () => AsyncIterableIterator<1> +>async function * () { yield* (async function * () { yield 1; })();} : () => AsyncIterableIterator yield* (async function * () { yield 1; })(); >yield* (async function * () { yield 1; })() : any ->(async function * () { yield 1; })() : AsyncIterableIterator<1> ->(async function * () { yield 1; }) : () => AsyncIterableIterator<1> ->async function * () { yield 1; } : () => AsyncIterableIterator<1> +>(async function * () { yield 1; })() : AsyncIterableIterator +>(async function * () { yield 1; }) : () => AsyncIterableIterator +>async function * () { yield 1; } : () => AsyncIterableIterator >yield 1 : any >1 : 1 @@ -317,9 +317,9 @@ async function * explicitReturnType5(): AsyncIterableIterator { yield* (async function * () { yield 1; })(); >yield* (async function * () { yield 1; })() : any ->(async function * () { yield 1; })() : AsyncIterableIterator<1> ->(async function * () { yield 1; }) : () => AsyncIterableIterator<1> ->async function * () { yield 1; } : () => AsyncIterableIterator<1> +>(async function * () { yield 1; })() : AsyncIterableIterator +>(async function * () { yield 1; }) : () => AsyncIterableIterator +>async function * () { yield 1; } : () => AsyncIterableIterator >yield 1 : any >1 : 1 } @@ -372,9 +372,9 @@ async function * explicitReturnType10(): AsyncIterable { yield* (async function * () { yield 1; })(); >yield* (async function * () { yield 1; })() : any ->(async function * () { yield 1; })() : AsyncIterableIterator<1> ->(async function * () { yield 1; }) : () => AsyncIterableIterator<1> ->async function * () { yield 1; } : () => AsyncIterableIterator<1> +>(async function * () { yield 1; })() : AsyncIterableIterator +>(async function * () { yield 1; }) : () => AsyncIterableIterator +>async function * () { yield 1; } : () => AsyncIterableIterator >yield 1 : any >1 : 1 } @@ -427,9 +427,9 @@ async function * explicitReturnType15(): AsyncIterator { yield* (async function * () { yield 1; })(); >yield* (async function * () { yield 1; })() : any ->(async function * () { yield 1; })() : AsyncIterableIterator<1> ->(async function * () { yield 1; }) : () => AsyncIterableIterator<1> ->async function * () { yield 1; } : () => AsyncIterableIterator<1> +>(async function * () { yield 1; })() : AsyncIterableIterator +>(async function * () { yield 1; }) : () => AsyncIterableIterator +>async function * () { yield 1; } : () => AsyncIterableIterator >yield 1 : any >1 : 1 } diff --git a/tests/baselines/reference/types.asyncGenerators.esnext.2.errors.txt b/tests/baselines/reference/types.asyncGenerators.esnext.2.errors.txt index 64d7980578c28..a6a0243ded606 100644 --- a/tests/baselines/reference/types.asyncGenerators.esnext.2.errors.txt +++ b/tests/baselines/reference/types.asyncGenerators.esnext.2.errors.txt @@ -1,24 +1,13 @@ tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(2,12): error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator. tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(8,12): error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator. -tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(10,7): error TS2322: Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterableIterator'. - Type 'AsyncIterableIterator<"a">' is not assignable to type 'AsyncIterableIterator'. - Type '"a"' is not assignable to type 'number'. -tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(13,7): error TS2322: Type '() => AsyncIterableIterator' is not assignable to type '() => AsyncIterableIterator'. +tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(10,7): error TS2322: Type '() => AsyncIterableIterator' is not assignable to type '() => AsyncIterableIterator'. Type 'AsyncIterableIterator' is not assignable to type 'AsyncIterableIterator'. Type 'string' is not assignable to type 'number'. -tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(16,7): error TS2322: Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterableIterator'. - Type 'AsyncIterableIterator<"a">' is not assignable to type 'AsyncIterableIterator'. -tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(19,7): error TS2322: Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterable'. - Type 'AsyncIterableIterator<"a">' is not assignable to type 'AsyncIterable'. - Types of property '[Symbol.asyncIterator]' are incompatible. - Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterator'. - Type 'AsyncIterableIterator<"a">' is not assignable to type 'AsyncIterator'. - Types of property 'next' are incompatible. - Type '(value?: any) => Promise>' is not assignable to type '(value?: any) => Promise>'. - Type 'Promise>' is not assignable to type 'Promise>'. - Type 'IteratorResult<"a">' is not assignable to type 'IteratorResult'. - Type '"a"' is not assignable to type 'number'. -tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(22,7): error TS2322: Type '() => AsyncIterableIterator' is not assignable to type '() => AsyncIterable'. +tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(13,7): error TS2322: Type '() => AsyncIterableIterator' is not assignable to type '() => AsyncIterableIterator'. + Type 'AsyncIterableIterator' is not assignable to type 'AsyncIterableIterator'. +tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(16,7): error TS2322: Type '() => AsyncIterableIterator' is not assignable to type '() => AsyncIterableIterator'. + Type 'AsyncIterableIterator' is not assignable to type 'AsyncIterableIterator'. +tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(19,7): error TS2322: Type '() => AsyncIterableIterator' is not assignable to type '() => AsyncIterable'. Type 'AsyncIterableIterator' is not assignable to type 'AsyncIterable'. Types of property '[Symbol.asyncIterator]' are incompatible. Type '() => AsyncIterableIterator' is not assignable to type '() => AsyncIterator'. @@ -28,23 +17,25 @@ tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts( Type 'Promise>' is not assignable to type 'Promise>'. Type 'IteratorResult' is not assignable to type 'IteratorResult'. Type 'string' is not assignable to type 'number'. -tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(25,7): error TS2322: Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterable'. - Type 'AsyncIterableIterator<"a">' is not assignable to type 'AsyncIterable'. -tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(28,7): error TS2322: Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterator'. - Type 'AsyncIterableIterator<"a">' is not assignable to type 'AsyncIterator'. +tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(22,7): error TS2322: Type '() => AsyncIterableIterator' is not assignable to type '() => AsyncIterable'. + Type 'AsyncIterableIterator' is not assignable to type 'AsyncIterable'. +tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(25,7): error TS2322: Type '() => AsyncIterableIterator' is not assignable to type '() => AsyncIterable'. + Type 'AsyncIterableIterator' is not assignable to type 'AsyncIterable'. +tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(28,7): error TS2322: Type '() => AsyncIterableIterator' is not assignable to type '() => AsyncIterator'. + Type 'AsyncIterableIterator' is not assignable to type 'AsyncIterator'. tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(31,7): error TS2322: Type '() => AsyncIterableIterator' is not assignable to type '() => AsyncIterator'. Type 'AsyncIterableIterator' is not assignable to type 'AsyncIterator'. -tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(34,7): error TS2322: Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterator'. - Type 'AsyncIterableIterator<"a">' is not assignable to type 'AsyncIterator'. +tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(34,7): error TS2322: Type '() => AsyncIterableIterator' is not assignable to type '() => AsyncIterator'. + Type 'AsyncIterableIterator' is not assignable to type 'AsyncIterator'. tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(38,11): error TS2322: Type '"a"' is not assignable to type 'number'. tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(41,12): error TS2322: Type 'string' is not assignable to type 'number'. -tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(44,12): error TS2322: Type '"a"' is not assignable to type 'number'. +tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(44,12): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(47,11): error TS2322: Type '"a"' is not assignable to type 'number'. tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(50,12): error TS2322: Type 'string' is not assignable to type 'number'. -tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(53,12): error TS2322: Type '"a"' is not assignable to type 'number'. +tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(53,12): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(56,11): error TS2322: Type '"a"' is not assignable to type 'number'. tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(59,12): error TS2322: Type 'string' is not assignable to type 'number'. -tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(62,12): error TS2322: Type '"a"' is not assignable to type 'number'. +tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(62,12): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(64,42): error TS2322: Type 'AsyncIterableIterator' is not assignable to type 'IterableIterator'. Property '[Symbol.iterator]' is missing in type 'AsyncIterableIterator'. tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(67,42): error TS2322: Type 'AsyncIterableIterator' is not assignable to type 'Iterable'. @@ -73,40 +64,25 @@ tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts( } const assignability1: () => AsyncIterableIterator = async function * () { ~~~~~~~~~~~~~~ -!!! error TS2322: Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterableIterator'. -!!! error TS2322: Type 'AsyncIterableIterator<"a">' is not assignable to type 'AsyncIterableIterator'. -!!! error TS2322: Type '"a"' is not assignable to type 'number'. +!!! error TS2322: Type '() => AsyncIterableIterator' is not assignable to type '() => AsyncIterableIterator'. +!!! error TS2322: Type 'AsyncIterableIterator' is not assignable to type 'AsyncIterableIterator'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. yield "a"; }; const assignability2: () => AsyncIterableIterator = async function * () { ~~~~~~~~~~~~~~ !!! error TS2322: Type '() => AsyncIterableIterator' is not assignable to type '() => AsyncIterableIterator'. !!! error TS2322: Type 'AsyncIterableIterator' is not assignable to type 'AsyncIterableIterator'. -!!! error TS2322: Type 'string' is not assignable to type 'number'. yield* ["a", "b"]; }; const assignability3: () => AsyncIterableIterator = async function * () { ~~~~~~~~~~~~~~ -!!! error TS2322: Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterableIterator'. -!!! error TS2322: Type 'AsyncIterableIterator<"a">' is not assignable to type 'AsyncIterableIterator'. +!!! error TS2322: Type '() => AsyncIterableIterator' is not assignable to type '() => AsyncIterableIterator'. +!!! error TS2322: Type 'AsyncIterableIterator' is not assignable to type 'AsyncIterableIterator'. yield* (async function * () { yield "a"; })(); }; const assignability4: () => AsyncIterable = async function * () { ~~~~~~~~~~~~~~ -!!! error TS2322: Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterable'. -!!! error TS2322: Type 'AsyncIterableIterator<"a">' is not assignable to type 'AsyncIterable'. -!!! error TS2322: Types of property '[Symbol.asyncIterator]' are incompatible. -!!! error TS2322: Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterator'. -!!! error TS2322: Type 'AsyncIterableIterator<"a">' is not assignable to type 'AsyncIterator'. -!!! error TS2322: Types of property 'next' are incompatible. -!!! error TS2322: Type '(value?: any) => Promise>' is not assignable to type '(value?: any) => Promise>'. -!!! error TS2322: Type 'Promise>' is not assignable to type 'Promise>'. -!!! error TS2322: Type 'IteratorResult<"a">' is not assignable to type 'IteratorResult'. -!!! error TS2322: Type '"a"' is not assignable to type 'number'. - yield "a"; - }; - const assignability5: () => AsyncIterable = async function * () { - ~~~~~~~~~~~~~~ !!! error TS2322: Type '() => AsyncIterableIterator' is not assignable to type '() => AsyncIterable'. !!! error TS2322: Type 'AsyncIterableIterator' is not assignable to type 'AsyncIterable'. !!! error TS2322: Types of property '[Symbol.asyncIterator]' are incompatible. @@ -117,18 +93,24 @@ tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts( !!! error TS2322: Type 'Promise>' is not assignable to type 'Promise>'. !!! error TS2322: Type 'IteratorResult' is not assignable to type 'IteratorResult'. !!! error TS2322: Type 'string' is not assignable to type 'number'. + yield "a"; + }; + const assignability5: () => AsyncIterable = async function * () { + ~~~~~~~~~~~~~~ +!!! error TS2322: Type '() => AsyncIterableIterator' is not assignable to type '() => AsyncIterable'. +!!! error TS2322: Type 'AsyncIterableIterator' is not assignable to type 'AsyncIterable'. yield* ["a", "b"]; }; const assignability6: () => AsyncIterable = async function * () { ~~~~~~~~~~~~~~ -!!! error TS2322: Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterable'. -!!! error TS2322: Type 'AsyncIterableIterator<"a">' is not assignable to type 'AsyncIterable'. +!!! error TS2322: Type '() => AsyncIterableIterator' is not assignable to type '() => AsyncIterable'. +!!! error TS2322: Type 'AsyncIterableIterator' is not assignable to type 'AsyncIterable'. yield* (async function * () { yield "a"; })(); }; const assignability7: () => AsyncIterator = async function * () { ~~~~~~~~~~~~~~ -!!! error TS2322: Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterator'. -!!! error TS2322: Type 'AsyncIterableIterator<"a">' is not assignable to type 'AsyncIterator'. +!!! error TS2322: Type '() => AsyncIterableIterator' is not assignable to type '() => AsyncIterator'. +!!! error TS2322: Type 'AsyncIterableIterator' is not assignable to type 'AsyncIterator'. yield "a"; }; const assignability8: () => AsyncIterator = async function * () { @@ -139,8 +121,8 @@ tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts( }; const assignability9: () => AsyncIterator = async function * () { ~~~~~~~~~~~~~~ -!!! error TS2322: Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterator'. -!!! error TS2322: Type 'AsyncIterableIterator<"a">' is not assignable to type 'AsyncIterator'. +!!! error TS2322: Type '() => AsyncIterableIterator' is not assignable to type '() => AsyncIterator'. +!!! error TS2322: Type 'AsyncIterableIterator' is not assignable to type 'AsyncIterator'. yield* (async function * () { yield "a"; })(); }; async function * explicitReturnType1(): AsyncIterableIterator { @@ -156,7 +138,7 @@ tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts( async function * explicitReturnType3(): AsyncIterableIterator { yield* (async function * () { yield "a"; })(); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '"a"' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. } async function * explicitReturnType4(): AsyncIterable { yield "a"; @@ -171,7 +153,7 @@ tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts( async function * explicitReturnType6(): AsyncIterable { yield* (async function * () { yield "a"; })(); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '"a"' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. } async function * explicitReturnType7(): AsyncIterator { yield "a"; @@ -186,7 +168,7 @@ tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts( async function * explicitReturnType9(): AsyncIterator { yield* (async function * () { yield "a"; })(); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type '"a"' is not assignable to type 'number'. +!!! error TS2322: Type 'string' is not assignable to type 'number'. } async function * explicitReturnType10(): IterableIterator { ~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/types.asyncGenerators.esnext.2.types b/tests/baselines/reference/types.asyncGenerators.esnext.2.types index 2d29f5a7e1d97..c9f8e9216c4a8 100644 --- a/tests/baselines/reference/types.asyncGenerators.esnext.2.types +++ b/tests/baselines/reference/types.asyncGenerators.esnext.2.types @@ -30,7 +30,7 @@ async function * inferReturnType3() { const assignability1: () => AsyncIterableIterator = async function * () { >assignability1 : () => AsyncIterableIterator >AsyncIterableIterator : AsyncIterableIterator ->async function * () { yield "a";} : () => AsyncIterableIterator<"a"> +>async function * () { yield "a";} : () => AsyncIterableIterator yield "a"; >yield "a" : any @@ -52,13 +52,13 @@ const assignability2: () => AsyncIterableIterator = async function * () const assignability3: () => AsyncIterableIterator = async function * () { >assignability3 : () => AsyncIterableIterator >AsyncIterableIterator : AsyncIterableIterator ->async function * () { yield* (async function * () { yield "a"; })();} : () => AsyncIterableIterator<"a"> +>async function * () { yield* (async function * () { yield "a"; })();} : () => AsyncIterableIterator yield* (async function * () { yield "a"; })(); >yield* (async function * () { yield "a"; })() : any ->(async function * () { yield "a"; })() : AsyncIterableIterator<"a"> ->(async function * () { yield "a"; }) : () => AsyncIterableIterator<"a"> ->async function * () { yield "a"; } : () => AsyncIterableIterator<"a"> +>(async function * () { yield "a"; })() : AsyncIterableIterator +>(async function * () { yield "a"; }) : () => AsyncIterableIterator +>async function * () { yield "a"; } : () => AsyncIterableIterator >yield "a" : any >"a" : "a" @@ -66,7 +66,7 @@ const assignability3: () => AsyncIterableIterator = async function * () const assignability4: () => AsyncIterable = async function * () { >assignability4 : () => AsyncIterable >AsyncIterable : AsyncIterable ->async function * () { yield "a";} : () => AsyncIterableIterator<"a"> +>async function * () { yield "a";} : () => AsyncIterableIterator yield "a"; >yield "a" : any @@ -88,13 +88,13 @@ const assignability5: () => AsyncIterable = async function * () { const assignability6: () => AsyncIterable = async function * () { >assignability6 : () => AsyncIterable >AsyncIterable : AsyncIterable ->async function * () { yield* (async function * () { yield "a"; })();} : () => AsyncIterableIterator<"a"> +>async function * () { yield* (async function * () { yield "a"; })();} : () => AsyncIterableIterator yield* (async function * () { yield "a"; })(); >yield* (async function * () { yield "a"; })() : any ->(async function * () { yield "a"; })() : AsyncIterableIterator<"a"> ->(async function * () { yield "a"; }) : () => AsyncIterableIterator<"a"> ->async function * () { yield "a"; } : () => AsyncIterableIterator<"a"> +>(async function * () { yield "a"; })() : AsyncIterableIterator +>(async function * () { yield "a"; }) : () => AsyncIterableIterator +>async function * () { yield "a"; } : () => AsyncIterableIterator >yield "a" : any >"a" : "a" @@ -102,7 +102,7 @@ const assignability6: () => AsyncIterable = async function * () { const assignability7: () => AsyncIterator = async function * () { >assignability7 : () => AsyncIterator >AsyncIterator : AsyncIterator ->async function * () { yield "a";} : () => AsyncIterableIterator<"a"> +>async function * () { yield "a";} : () => AsyncIterableIterator yield "a"; >yield "a" : any @@ -124,13 +124,13 @@ const assignability8: () => AsyncIterator = async function * () { const assignability9: () => AsyncIterator = async function * () { >assignability9 : () => AsyncIterator >AsyncIterator : AsyncIterator ->async function * () { yield* (async function * () { yield "a"; })();} : () => AsyncIterableIterator<"a"> +>async function * () { yield* (async function * () { yield "a"; })();} : () => AsyncIterableIterator yield* (async function * () { yield "a"; })(); >yield* (async function * () { yield "a"; })() : any ->(async function * () { yield "a"; })() : AsyncIterableIterator<"a"> ->(async function * () { yield "a"; }) : () => AsyncIterableIterator<"a"> ->async function * () { yield "a"; } : () => AsyncIterableIterator<"a"> +>(async function * () { yield "a"; })() : AsyncIterableIterator +>(async function * () { yield "a"; }) : () => AsyncIterableIterator +>async function * () { yield "a"; } : () => AsyncIterableIterator >yield "a" : any >"a" : "a" @@ -159,9 +159,9 @@ async function * explicitReturnType3(): AsyncIterableIterator { yield* (async function * () { yield "a"; })(); >yield* (async function * () { yield "a"; })() : any ->(async function * () { yield "a"; })() : AsyncIterableIterator<"a"> ->(async function * () { yield "a"; }) : () => AsyncIterableIterator<"a"> ->async function * () { yield "a"; } : () => AsyncIterableIterator<"a"> +>(async function * () { yield "a"; })() : AsyncIterableIterator +>(async function * () { yield "a"; }) : () => AsyncIterableIterator +>async function * () { yield "a"; } : () => AsyncIterableIterator >yield "a" : any >"a" : "a" } @@ -189,9 +189,9 @@ async function * explicitReturnType6(): AsyncIterable { yield* (async function * () { yield "a"; })(); >yield* (async function * () { yield "a"; })() : any ->(async function * () { yield "a"; })() : AsyncIterableIterator<"a"> ->(async function * () { yield "a"; }) : () => AsyncIterableIterator<"a"> ->async function * () { yield "a"; } : () => AsyncIterableIterator<"a"> +>(async function * () { yield "a"; })() : AsyncIterableIterator +>(async function * () { yield "a"; }) : () => AsyncIterableIterator +>async function * () { yield "a"; } : () => AsyncIterableIterator >yield "a" : any >"a" : "a" } @@ -219,9 +219,9 @@ async function * explicitReturnType9(): AsyncIterator { yield* (async function * () { yield "a"; })(); >yield* (async function * () { yield "a"; })() : any ->(async function * () { yield "a"; })() : AsyncIterableIterator<"a"> ->(async function * () { yield "a"; }) : () => AsyncIterableIterator<"a"> ->async function * () { yield "a"; } : () => AsyncIterableIterator<"a"> +>(async function * () { yield "a"; })() : AsyncIterableIterator +>(async function * () { yield "a"; }) : () => AsyncIterableIterator +>async function * () { yield "a"; } : () => AsyncIterableIterator >yield "a" : any >"a" : "a" } diff --git a/tests/baselines/reference/uniqueSymbols.js b/tests/baselines/reference/uniqueSymbols.js new file mode 100644 index 0000000000000..6c723c8dec17d --- /dev/null +++ b/tests/baselines/reference/uniqueSymbols.js @@ -0,0 +1,450 @@ +//// [uniqueSymbols.ts] +// declarations with call initializer +const constCall = Symbol(); +let letCall = Symbol(); +var varCall = Symbol(); + +// ambient declaration with type +declare const constType: unique symbol; + +// declaration with type and call initializer +const constTypeAndCall: unique symbol = Symbol(); + +// declaration from initializer +const constInitToConstCall = constCall; +const constInitToLetCall = letCall; +const constInitToVarCall = varCall; +const constInitToConstDeclAmbient = constType; +let letInitToConstCall = constCall; +let letInitToLetCall = letCall; +let letInitToVarCall = varCall; +let letInitToConstDeclAmbient = constType; +var varInitToConstCall = constCall; +var varInitToLetCall = letCall; +var varInitToVarCall = varCall; +var varInitToConstDeclAmbient = constType; + +// declaration from initializer with type query +const constInitToConstCallWithTypeQuery: typeof constCall = constCall; +const constInitToConstDeclAmbientWithTypeQuery: typeof constType = constType; + +// function return inference +function funcReturnConstCall() { return constCall; } +function funcReturnLetCall() { return letCall; } +function funcReturnVarCall() { return varCall; } + +// function return value with type query +function funcReturnConstCallWithTypeQuery(): typeof constCall { return constCall; } + +// generator function yield inference +function* genFuncYieldConstCall() { yield constCall; } +function* genFuncYieldLetCall() { yield letCall; } +function* genFuncYieldVarCall() { yield varCall; } + +// generator function yield with return type query +function* genFuncYieldConstCallWithTypeQuery(): IterableIterator { yield constCall; } + +// async function return inference +async function asyncFuncReturnConstCall() { return constCall; } +async function asyncFuncReturnLetCall() { return letCall; } +async function asyncFuncReturnVarCall() { return varCall; } + +// async generator function yield inference +async function* asyncGenFuncYieldConstCall() { yield constCall; } +async function* asyncGenFuncYieldLetCall() { yield letCall; } +async function* asyncGenFuncYieldVarCall() { yield varCall; } + +// classes +class C { + static readonly readonlyStaticCall = Symbol(); + static readonly readonlyStaticType: unique symbol; + static readonly readonlyStaticTypeAndCall: unique symbol = Symbol(); + static readwriteStaticCall = Symbol(); + + readonly readonlyCall = Symbol(); + readwriteCall = Symbol(); +} +declare const c: C; + +const constInitToCReadonlyStaticCall = C.readonlyStaticCall; +const constInitToCReadonlyStaticType = C.readonlyStaticType; +const constInitToCReadonlyStaticTypeAndCall = C.readonlyStaticTypeAndCall; +const constInitToCReadwriteStaticCall = C.readwriteStaticCall; + +const constInitToCReadonlyStaticCallWithTypeQuery: typeof C.readonlyStaticCall = C.readonlyStaticCall; +const constInitToCReadonlyStaticTypeWithTypeQuery: typeof C.readonlyStaticType = C.readonlyStaticType; +const constInitToCReadonlyStaticTypeAndCallWithTypeQuery: typeof C.readonlyStaticTypeAndCall = C.readonlyStaticTypeAndCall; +const constInitToCReadwriteStaticCallWithTypeQuery: typeof C.readwriteStaticCall = C.readwriteStaticCall; + +const constInitToCReadonlyCall = c.readonlyCall; +const constInitToCReadwriteCall = c.readwriteCall; +const constInitToCReadonlyCallWithTypeQuery: typeof c.readonlyCall = c.readonlyCall; +const constInitToCReadwriteCallWithTypeQuery: typeof c.readwriteCall = c.readwriteCall; +const constInitToCReadonlyCallWithIndexedAccess: C["readonlyCall"] = c.readonlyCall; +const constInitToCReadwriteCallWithIndexedAccess: C["readwriteCall"] = c.readwriteCall; + +// interfaces +interface I { + readonly readonlyType: unique symbol; +} +declare const i: I; + +const constInitToIReadonlyType = i.readonlyType; +const constInitToIReadonlyTypeWithTypeQuery: typeof i.readonlyType = i.readonlyType; +const constInitToIReadonlyTypeWithIndexedAccess: I["readonlyType"] = i.readonlyType; + +// type literals +type L = { + readonly readonlyType: unique symbol; + nested: { + readonly readonlyNestedType: unique symbol; + } +}; +declare const l: L; + +const constInitToLReadonlyType = l.readonlyType; +const constInitToLReadonlyNestedType = l.nested.readonlyNestedType; +const constInitToLReadonlyTypeWithTypeQuery: typeof l.readonlyType = l.readonlyType; +const constInitToLReadonlyNestedTypeWithTypeQuery: typeof l.nested.readonlyNestedType = l.nested.readonlyNestedType; +const constInitToLReadonlyTypeWithIndexedAccess: L["readonlyType"] = l.readonlyType; +const constInitToLReadonlyNestedTypeWithIndexedAccess: L["nested"]["readonlyNestedType"] = l.nested.readonlyNestedType; + +// type argument inference +const promiseForConstCall = Promise.resolve(constCall); +const arrayOfConstCall = [constCall]; + +// unique symbol widening in expressions +declare const s: unique symbol; +declare namespace N { const s: unique symbol; } +declare const o: { [s]: "a", [N.s]: "b" }; +declare function f(x: T): T; +declare function g(x: typeof s): void; +declare function g(x: typeof N.s): void; + +// widening positions + +// argument inference +f(s); +f(N.s); +f(N["s"]); + +// array literal elements +[s]; +[N.s]; +[N["s"]]; + +// property assignments/methods +const o2 = { + a: s, + b: N.s, + c: N["s"], + + method1() { return s; }, + async method2() { return s; }, + async * method3() { yield s; }, + * method4() { yield s; }, + method5(p = s) { return p; }, +}; + +// property initializers +class C0 { + static readonly a = s; + static readonly b = N.s; + static readonly c = N["s"]; + + static d = s; + static e = N.s; + static f = N["s"]; + + readonly a = s; + readonly b = N.s; + readonly c = N["s"]; + + d = s; + e = N.s; + f = N["s"]; + + method1() { return s; } + async method2() { return s; } + async * method3() { yield s; } + * method4() { yield s; } + method5(p = s) { return p; } +} + +// non-widening positions + +// element access +o[s]; +o[N.s]; +o[N["s"]]; + +// arguments (no-inference) +f(s); +f(N.s); +f(N["s"]); +g(s); +g(N.s); +g(N["s"]); + +// falsy expressions +s || ""; +N.s || ""; +N["s"] || ""; + +// conditionals +Math.random() * 2 ? s : "a"; +Math.random() * 2 ? N.s : "a"; +Math.random() * 2 ? N["s"] : "a"; + +// computed property names +({ + [s]: "a", + [N.s]: "b", +}); + +class C1 { + static [s]: "a"; + static [N.s]: "b"; + + [s]: "a"; + [N.s]: "b"; +} + +// contextual types + +interface Context { + method1(): typeof s; + method2(): Promise; + method3(): AsyncIterableIterator; + method4(): IterableIterator; + method5(p?: typeof s): typeof s; +} + +const o3: Context = { + method1() { + return s; // return type should not widen due to contextual type + }, + async method2() { + return s; // return type should not widen due to contextual type + }, + async * method3() { + yield s; // yield type should not widen due to contextual type + }, + * method4() { + yield s; // yield type should not widen due to contextual type + }, + method5(p = s) { // parameter should not widen due to contextual type + return p; + }, +}; + +// allowed when not emitting declarations + +const o4 = { + method1(p: typeof s): typeof s { + return p; + }, + method2(p: I["readonlyType"]): I["readonlyType"] { + return p; + } +}; + +const ce0 = class { + method1(p: typeof s): typeof s { + return p; + } + method2(p: I["readonlyType"]): I["readonlyType"] { + return p; + } +}; + +function funcInferredReturnType(obj: { method(p: typeof s): void }) { + return obj; +} + + +//// [uniqueSymbols.js] +// declarations with call initializer +const constCall = Symbol(); +let letCall = Symbol(); +var varCall = Symbol(); +// declaration with type and call initializer +const constTypeAndCall = Symbol(); +// declaration from initializer +const constInitToConstCall = constCall; +const constInitToLetCall = letCall; +const constInitToVarCall = varCall; +const constInitToConstDeclAmbient = constType; +let letInitToConstCall = constCall; +let letInitToLetCall = letCall; +let letInitToVarCall = varCall; +let letInitToConstDeclAmbient = constType; +var varInitToConstCall = constCall; +var varInitToLetCall = letCall; +var varInitToVarCall = varCall; +var varInitToConstDeclAmbient = constType; +// declaration from initializer with type query +const constInitToConstCallWithTypeQuery = constCall; +const constInitToConstDeclAmbientWithTypeQuery = constType; +// function return inference +function funcReturnConstCall() { return constCall; } +function funcReturnLetCall() { return letCall; } +function funcReturnVarCall() { return varCall; } +// function return value with type query +function funcReturnConstCallWithTypeQuery() { return constCall; } +// generator function yield inference +function* genFuncYieldConstCall() { yield constCall; } +function* genFuncYieldLetCall() { yield letCall; } +function* genFuncYieldVarCall() { yield varCall; } +// generator function yield with return type query +function* genFuncYieldConstCallWithTypeQuery() { yield constCall; } +// async function return inference +async function asyncFuncReturnConstCall() { return constCall; } +async function asyncFuncReturnLetCall() { return letCall; } +async function asyncFuncReturnVarCall() { return varCall; } +// async generator function yield inference +async function* asyncGenFuncYieldConstCall() { yield constCall; } +async function* asyncGenFuncYieldLetCall() { yield letCall; } +async function* asyncGenFuncYieldVarCall() { yield varCall; } +// classes +class C { + constructor() { + this.readonlyCall = Symbol(); + this.readwriteCall = Symbol(); + } +} +C.readonlyStaticCall = Symbol(); +C.readonlyStaticTypeAndCall = Symbol(); +C.readwriteStaticCall = Symbol(); +const constInitToCReadonlyStaticCall = C.readonlyStaticCall; +const constInitToCReadonlyStaticType = C.readonlyStaticType; +const constInitToCReadonlyStaticTypeAndCall = C.readonlyStaticTypeAndCall; +const constInitToCReadwriteStaticCall = C.readwriteStaticCall; +const constInitToCReadonlyStaticCallWithTypeQuery = C.readonlyStaticCall; +const constInitToCReadonlyStaticTypeWithTypeQuery = C.readonlyStaticType; +const constInitToCReadonlyStaticTypeAndCallWithTypeQuery = C.readonlyStaticTypeAndCall; +const constInitToCReadwriteStaticCallWithTypeQuery = C.readwriteStaticCall; +const constInitToCReadonlyCall = c.readonlyCall; +const constInitToCReadwriteCall = c.readwriteCall; +const constInitToCReadonlyCallWithTypeQuery = c.readonlyCall; +const constInitToCReadwriteCallWithTypeQuery = c.readwriteCall; +const constInitToCReadonlyCallWithIndexedAccess = c.readonlyCall; +const constInitToCReadwriteCallWithIndexedAccess = c.readwriteCall; +const constInitToIReadonlyType = i.readonlyType; +const constInitToIReadonlyTypeWithTypeQuery = i.readonlyType; +const constInitToIReadonlyTypeWithIndexedAccess = i.readonlyType; +const constInitToLReadonlyType = l.readonlyType; +const constInitToLReadonlyNestedType = l.nested.readonlyNestedType; +const constInitToLReadonlyTypeWithTypeQuery = l.readonlyType; +const constInitToLReadonlyNestedTypeWithTypeQuery = l.nested.readonlyNestedType; +const constInitToLReadonlyTypeWithIndexedAccess = l.readonlyType; +const constInitToLReadonlyNestedTypeWithIndexedAccess = l.nested.readonlyNestedType; +// type argument inference +const promiseForConstCall = Promise.resolve(constCall); +const arrayOfConstCall = [constCall]; +// widening positions +// argument inference +f(s); +f(N.s); +f(N["s"]); +// array literal elements +[s]; +[N.s]; +[N["s"]]; +// property assignments/methods +const o2 = { + a: s, + b: N.s, + c: N["s"], + method1() { return s; }, + async method2() { return s; }, + async *method3() { yield s; }, + *method4() { yield s; }, + method5(p = s) { return p; }, +}; +// property initializers +class C0 { + constructor() { + this.a = s; + this.b = N.s; + this.c = N["s"]; + this.d = s; + this.e = N.s; + this.f = N["s"]; + } + method1() { return s; } + async method2() { return s; } + async *method3() { yield s; } + *method4() { yield s; } + method5(p = s) { return p; } +} +C0.a = s; +C0.b = N.s; +C0.c = N["s"]; +C0.d = s; +C0.e = N.s; +C0.f = N["s"]; +// non-widening positions +// element access +o[s]; +o[N.s]; +o[N["s"]]; +// arguments (no-inference) +f(s); +f(N.s); +f(N["s"]); +g(s); +g(N.s); +g(N["s"]); +// falsy expressions +s || ""; +N.s || ""; +N["s"] || ""; +// conditionals +Math.random() * 2 ? s : "a"; +Math.random() * 2 ? N.s : "a"; +Math.random() * 2 ? N["s"] : "a"; +// computed property names +({ + [s]: "a", + [N.s]: "b", +}); +class C1 { +} +const o3 = { + method1() { + return s; // return type should not widen due to contextual type + }, + async method2() { + return s; // return type should not widen due to contextual type + }, + async *method3() { + yield s; // yield type should not widen due to contextual type + }, + *method4() { + yield s; // yield type should not widen due to contextual type + }, + method5(p = s) { + return p; + }, +}; +// allowed when not emitting declarations +const o4 = { + method1(p) { + return p; + }, + method2(p) { + return p; + } +}; +const ce0 = class { + method1(p) { + return p; + } + method2(p) { + return p; + } +}; +function funcInferredReturnType(obj) { + return obj; +} diff --git a/tests/baselines/reference/uniqueSymbols.symbols b/tests/baselines/reference/uniqueSymbols.symbols new file mode 100644 index 0000000000000..e798011683ae2 --- /dev/null +++ b/tests/baselines/reference/uniqueSymbols.symbols @@ -0,0 +1,850 @@ +=== tests/cases/conformance/types/uniqueSymbol/uniqueSymbols.ts === +// declarations with call initializer +const constCall = Symbol(); +>constCall : Symbol(constCall, Decl(uniqueSymbols.ts, 1, 5)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) + +let letCall = Symbol(); +>letCall : Symbol(letCall, Decl(uniqueSymbols.ts, 2, 3)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) + +var varCall = Symbol(); +>varCall : Symbol(varCall, Decl(uniqueSymbols.ts, 3, 3)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) + +// ambient declaration with type +declare const constType: unique symbol; +>constType : Symbol(constType, Decl(uniqueSymbols.ts, 6, 13)) + +// declaration with type and call initializer +const constTypeAndCall: unique symbol = Symbol(); +>constTypeAndCall : Symbol(constTypeAndCall, Decl(uniqueSymbols.ts, 9, 5)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) + +// declaration from initializer +const constInitToConstCall = constCall; +>constInitToConstCall : Symbol(constInitToConstCall, Decl(uniqueSymbols.ts, 12, 5)) +>constCall : Symbol(constCall, Decl(uniqueSymbols.ts, 1, 5)) + +const constInitToLetCall = letCall; +>constInitToLetCall : Symbol(constInitToLetCall, Decl(uniqueSymbols.ts, 13, 5)) +>letCall : Symbol(letCall, Decl(uniqueSymbols.ts, 2, 3)) + +const constInitToVarCall = varCall; +>constInitToVarCall : Symbol(constInitToVarCall, Decl(uniqueSymbols.ts, 14, 5)) +>varCall : Symbol(varCall, Decl(uniqueSymbols.ts, 3, 3)) + +const constInitToConstDeclAmbient = constType; +>constInitToConstDeclAmbient : Symbol(constInitToConstDeclAmbient, Decl(uniqueSymbols.ts, 15, 5)) +>constType : Symbol(constType, Decl(uniqueSymbols.ts, 6, 13)) + +let letInitToConstCall = constCall; +>letInitToConstCall : Symbol(letInitToConstCall, Decl(uniqueSymbols.ts, 16, 3)) +>constCall : Symbol(constCall, Decl(uniqueSymbols.ts, 1, 5)) + +let letInitToLetCall = letCall; +>letInitToLetCall : Symbol(letInitToLetCall, Decl(uniqueSymbols.ts, 17, 3)) +>letCall : Symbol(letCall, Decl(uniqueSymbols.ts, 2, 3)) + +let letInitToVarCall = varCall; +>letInitToVarCall : Symbol(letInitToVarCall, Decl(uniqueSymbols.ts, 18, 3)) +>varCall : Symbol(varCall, Decl(uniqueSymbols.ts, 3, 3)) + +let letInitToConstDeclAmbient = constType; +>letInitToConstDeclAmbient : Symbol(letInitToConstDeclAmbient, Decl(uniqueSymbols.ts, 19, 3)) +>constType : Symbol(constType, Decl(uniqueSymbols.ts, 6, 13)) + +var varInitToConstCall = constCall; +>varInitToConstCall : Symbol(varInitToConstCall, Decl(uniqueSymbols.ts, 20, 3)) +>constCall : Symbol(constCall, Decl(uniqueSymbols.ts, 1, 5)) + +var varInitToLetCall = letCall; +>varInitToLetCall : Symbol(varInitToLetCall, Decl(uniqueSymbols.ts, 21, 3)) +>letCall : Symbol(letCall, Decl(uniqueSymbols.ts, 2, 3)) + +var varInitToVarCall = varCall; +>varInitToVarCall : Symbol(varInitToVarCall, Decl(uniqueSymbols.ts, 22, 3)) +>varCall : Symbol(varCall, Decl(uniqueSymbols.ts, 3, 3)) + +var varInitToConstDeclAmbient = constType; +>varInitToConstDeclAmbient : Symbol(varInitToConstDeclAmbient, Decl(uniqueSymbols.ts, 23, 3)) +>constType : Symbol(constType, Decl(uniqueSymbols.ts, 6, 13)) + +// declaration from initializer with type query +const constInitToConstCallWithTypeQuery: typeof constCall = constCall; +>constInitToConstCallWithTypeQuery : Symbol(constInitToConstCallWithTypeQuery, Decl(uniqueSymbols.ts, 26, 5)) +>constCall : Symbol(constCall, Decl(uniqueSymbols.ts, 1, 5)) +>constCall : Symbol(constCall, Decl(uniqueSymbols.ts, 1, 5)) + +const constInitToConstDeclAmbientWithTypeQuery: typeof constType = constType; +>constInitToConstDeclAmbientWithTypeQuery : Symbol(constInitToConstDeclAmbientWithTypeQuery, Decl(uniqueSymbols.ts, 27, 5)) +>constType : Symbol(constType, Decl(uniqueSymbols.ts, 6, 13)) +>constType : Symbol(constType, Decl(uniqueSymbols.ts, 6, 13)) + +// function return inference +function funcReturnConstCall() { return constCall; } +>funcReturnConstCall : Symbol(funcReturnConstCall, Decl(uniqueSymbols.ts, 27, 77)) +>constCall : Symbol(constCall, Decl(uniqueSymbols.ts, 1, 5)) + +function funcReturnLetCall() { return letCall; } +>funcReturnLetCall : Symbol(funcReturnLetCall, Decl(uniqueSymbols.ts, 30, 52)) +>letCall : Symbol(letCall, Decl(uniqueSymbols.ts, 2, 3)) + +function funcReturnVarCall() { return varCall; } +>funcReturnVarCall : Symbol(funcReturnVarCall, Decl(uniqueSymbols.ts, 31, 48)) +>varCall : Symbol(varCall, Decl(uniqueSymbols.ts, 3, 3)) + +// function return value with type query +function funcReturnConstCallWithTypeQuery(): typeof constCall { return constCall; } +>funcReturnConstCallWithTypeQuery : Symbol(funcReturnConstCallWithTypeQuery, Decl(uniqueSymbols.ts, 32, 48)) +>constCall : Symbol(constCall, Decl(uniqueSymbols.ts, 1, 5)) +>constCall : Symbol(constCall, Decl(uniqueSymbols.ts, 1, 5)) + +// generator function yield inference +function* genFuncYieldConstCall() { yield constCall; } +>genFuncYieldConstCall : Symbol(genFuncYieldConstCall, Decl(uniqueSymbols.ts, 35, 83)) +>constCall : Symbol(constCall, Decl(uniqueSymbols.ts, 1, 5)) + +function* genFuncYieldLetCall() { yield letCall; } +>genFuncYieldLetCall : Symbol(genFuncYieldLetCall, Decl(uniqueSymbols.ts, 38, 54)) +>letCall : Symbol(letCall, Decl(uniqueSymbols.ts, 2, 3)) + +function* genFuncYieldVarCall() { yield varCall; } +>genFuncYieldVarCall : Symbol(genFuncYieldVarCall, Decl(uniqueSymbols.ts, 39, 50)) +>varCall : Symbol(varCall, Decl(uniqueSymbols.ts, 3, 3)) + +// generator function yield with return type query +function* genFuncYieldConstCallWithTypeQuery(): IterableIterator { yield constCall; } +>genFuncYieldConstCallWithTypeQuery : Symbol(genFuncYieldConstCallWithTypeQuery, Decl(uniqueSymbols.ts, 40, 50)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>constCall : Symbol(constCall, Decl(uniqueSymbols.ts, 1, 5)) +>constCall : Symbol(constCall, Decl(uniqueSymbols.ts, 1, 5)) + +// async function return inference +async function asyncFuncReturnConstCall() { return constCall; } +>asyncFuncReturnConstCall : Symbol(asyncFuncReturnConstCall, Decl(uniqueSymbols.ts, 43, 103)) +>constCall : Symbol(constCall, Decl(uniqueSymbols.ts, 1, 5)) + +async function asyncFuncReturnLetCall() { return letCall; } +>asyncFuncReturnLetCall : Symbol(asyncFuncReturnLetCall, Decl(uniqueSymbols.ts, 46, 63)) +>letCall : Symbol(letCall, Decl(uniqueSymbols.ts, 2, 3)) + +async function asyncFuncReturnVarCall() { return varCall; } +>asyncFuncReturnVarCall : Symbol(asyncFuncReturnVarCall, Decl(uniqueSymbols.ts, 47, 59)) +>varCall : Symbol(varCall, Decl(uniqueSymbols.ts, 3, 3)) + +// async generator function yield inference +async function* asyncGenFuncYieldConstCall() { yield constCall; } +>asyncGenFuncYieldConstCall : Symbol(asyncGenFuncYieldConstCall, Decl(uniqueSymbols.ts, 48, 59)) +>constCall : Symbol(constCall, Decl(uniqueSymbols.ts, 1, 5)) + +async function* asyncGenFuncYieldLetCall() { yield letCall; } +>asyncGenFuncYieldLetCall : Symbol(asyncGenFuncYieldLetCall, Decl(uniqueSymbols.ts, 51, 65)) +>letCall : Symbol(letCall, Decl(uniqueSymbols.ts, 2, 3)) + +async function* asyncGenFuncYieldVarCall() { yield varCall; } +>asyncGenFuncYieldVarCall : Symbol(asyncGenFuncYieldVarCall, Decl(uniqueSymbols.ts, 52, 61)) +>varCall : Symbol(varCall, Decl(uniqueSymbols.ts, 3, 3)) + +// classes +class C { +>C : Symbol(C, Decl(uniqueSymbols.ts, 53, 61)) + + static readonly readonlyStaticCall = Symbol(); +>readonlyStaticCall : Symbol(C.readonlyStaticCall, Decl(uniqueSymbols.ts, 56, 9)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) + + static readonly readonlyStaticType: unique symbol; +>readonlyStaticType : Symbol(C.readonlyStaticType, Decl(uniqueSymbols.ts, 57, 50)) + + static readonly readonlyStaticTypeAndCall: unique symbol = Symbol(); +>readonlyStaticTypeAndCall : Symbol(C.readonlyStaticTypeAndCall, Decl(uniqueSymbols.ts, 58, 54)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) + + static readwriteStaticCall = Symbol(); +>readwriteStaticCall : Symbol(C.readwriteStaticCall, Decl(uniqueSymbols.ts, 59, 72)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) + + readonly readonlyCall = Symbol(); +>readonlyCall : Symbol(C.readonlyCall, Decl(uniqueSymbols.ts, 60, 42)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) + + readwriteCall = Symbol(); +>readwriteCall : Symbol(C.readwriteCall, Decl(uniqueSymbols.ts, 62, 37)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +} +declare const c: C; +>c : Symbol(c, Decl(uniqueSymbols.ts, 65, 13)) +>C : Symbol(C, Decl(uniqueSymbols.ts, 53, 61)) + +const constInitToCReadonlyStaticCall = C.readonlyStaticCall; +>constInitToCReadonlyStaticCall : Symbol(constInitToCReadonlyStaticCall, Decl(uniqueSymbols.ts, 67, 5)) +>C.readonlyStaticCall : Symbol(C.readonlyStaticCall, Decl(uniqueSymbols.ts, 56, 9)) +>C : Symbol(C, Decl(uniqueSymbols.ts, 53, 61)) +>readonlyStaticCall : Symbol(C.readonlyStaticCall, Decl(uniqueSymbols.ts, 56, 9)) + +const constInitToCReadonlyStaticType = C.readonlyStaticType; +>constInitToCReadonlyStaticType : Symbol(constInitToCReadonlyStaticType, Decl(uniqueSymbols.ts, 68, 5)) +>C.readonlyStaticType : Symbol(C.readonlyStaticType, Decl(uniqueSymbols.ts, 57, 50)) +>C : Symbol(C, Decl(uniqueSymbols.ts, 53, 61)) +>readonlyStaticType : Symbol(C.readonlyStaticType, Decl(uniqueSymbols.ts, 57, 50)) + +const constInitToCReadonlyStaticTypeAndCall = C.readonlyStaticTypeAndCall; +>constInitToCReadonlyStaticTypeAndCall : Symbol(constInitToCReadonlyStaticTypeAndCall, Decl(uniqueSymbols.ts, 69, 5)) +>C.readonlyStaticTypeAndCall : Symbol(C.readonlyStaticTypeAndCall, Decl(uniqueSymbols.ts, 58, 54)) +>C : Symbol(C, Decl(uniqueSymbols.ts, 53, 61)) +>readonlyStaticTypeAndCall : Symbol(C.readonlyStaticTypeAndCall, Decl(uniqueSymbols.ts, 58, 54)) + +const constInitToCReadwriteStaticCall = C.readwriteStaticCall; +>constInitToCReadwriteStaticCall : Symbol(constInitToCReadwriteStaticCall, Decl(uniqueSymbols.ts, 70, 5)) +>C.readwriteStaticCall : Symbol(C.readwriteStaticCall, Decl(uniqueSymbols.ts, 59, 72)) +>C : Symbol(C, Decl(uniqueSymbols.ts, 53, 61)) +>readwriteStaticCall : Symbol(C.readwriteStaticCall, Decl(uniqueSymbols.ts, 59, 72)) + +const constInitToCReadonlyStaticCallWithTypeQuery: typeof C.readonlyStaticCall = C.readonlyStaticCall; +>constInitToCReadonlyStaticCallWithTypeQuery : Symbol(constInitToCReadonlyStaticCallWithTypeQuery, Decl(uniqueSymbols.ts, 72, 5)) +>C.readonlyStaticCall : Symbol(C.readonlyStaticCall, Decl(uniqueSymbols.ts, 56, 9)) +>C : Symbol(C, Decl(uniqueSymbols.ts, 53, 61)) +>readonlyStaticCall : Symbol(C.readonlyStaticCall, Decl(uniqueSymbols.ts, 56, 9)) +>C.readonlyStaticCall : Symbol(C.readonlyStaticCall, Decl(uniqueSymbols.ts, 56, 9)) +>C : Symbol(C, Decl(uniqueSymbols.ts, 53, 61)) +>readonlyStaticCall : Symbol(C.readonlyStaticCall, Decl(uniqueSymbols.ts, 56, 9)) + +const constInitToCReadonlyStaticTypeWithTypeQuery: typeof C.readonlyStaticType = C.readonlyStaticType; +>constInitToCReadonlyStaticTypeWithTypeQuery : Symbol(constInitToCReadonlyStaticTypeWithTypeQuery, Decl(uniqueSymbols.ts, 73, 5)) +>C.readonlyStaticType : Symbol(C.readonlyStaticType, Decl(uniqueSymbols.ts, 57, 50)) +>C : Symbol(C, Decl(uniqueSymbols.ts, 53, 61)) +>readonlyStaticType : Symbol(C.readonlyStaticType, Decl(uniqueSymbols.ts, 57, 50)) +>C.readonlyStaticType : Symbol(C.readonlyStaticType, Decl(uniqueSymbols.ts, 57, 50)) +>C : Symbol(C, Decl(uniqueSymbols.ts, 53, 61)) +>readonlyStaticType : Symbol(C.readonlyStaticType, Decl(uniqueSymbols.ts, 57, 50)) + +const constInitToCReadonlyStaticTypeAndCallWithTypeQuery: typeof C.readonlyStaticTypeAndCall = C.readonlyStaticTypeAndCall; +>constInitToCReadonlyStaticTypeAndCallWithTypeQuery : Symbol(constInitToCReadonlyStaticTypeAndCallWithTypeQuery, Decl(uniqueSymbols.ts, 74, 5)) +>C.readonlyStaticTypeAndCall : Symbol(C.readonlyStaticTypeAndCall, Decl(uniqueSymbols.ts, 58, 54)) +>C : Symbol(C, Decl(uniqueSymbols.ts, 53, 61)) +>readonlyStaticTypeAndCall : Symbol(C.readonlyStaticTypeAndCall, Decl(uniqueSymbols.ts, 58, 54)) +>C.readonlyStaticTypeAndCall : Symbol(C.readonlyStaticTypeAndCall, Decl(uniqueSymbols.ts, 58, 54)) +>C : Symbol(C, Decl(uniqueSymbols.ts, 53, 61)) +>readonlyStaticTypeAndCall : Symbol(C.readonlyStaticTypeAndCall, Decl(uniqueSymbols.ts, 58, 54)) + +const constInitToCReadwriteStaticCallWithTypeQuery: typeof C.readwriteStaticCall = C.readwriteStaticCall; +>constInitToCReadwriteStaticCallWithTypeQuery : Symbol(constInitToCReadwriteStaticCallWithTypeQuery, Decl(uniqueSymbols.ts, 75, 5)) +>C.readwriteStaticCall : Symbol(C.readwriteStaticCall, Decl(uniqueSymbols.ts, 59, 72)) +>C : Symbol(C, Decl(uniqueSymbols.ts, 53, 61)) +>readwriteStaticCall : Symbol(C.readwriteStaticCall, Decl(uniqueSymbols.ts, 59, 72)) +>C.readwriteStaticCall : Symbol(C.readwriteStaticCall, Decl(uniqueSymbols.ts, 59, 72)) +>C : Symbol(C, Decl(uniqueSymbols.ts, 53, 61)) +>readwriteStaticCall : Symbol(C.readwriteStaticCall, Decl(uniqueSymbols.ts, 59, 72)) + +const constInitToCReadonlyCall = c.readonlyCall; +>constInitToCReadonlyCall : Symbol(constInitToCReadonlyCall, Decl(uniqueSymbols.ts, 77, 5)) +>c.readonlyCall : Symbol(C.readonlyCall, Decl(uniqueSymbols.ts, 60, 42)) +>c : Symbol(c, Decl(uniqueSymbols.ts, 65, 13)) +>readonlyCall : Symbol(C.readonlyCall, Decl(uniqueSymbols.ts, 60, 42)) + +const constInitToCReadwriteCall = c.readwriteCall; +>constInitToCReadwriteCall : Symbol(constInitToCReadwriteCall, Decl(uniqueSymbols.ts, 78, 5)) +>c.readwriteCall : Symbol(C.readwriteCall, Decl(uniqueSymbols.ts, 62, 37)) +>c : Symbol(c, Decl(uniqueSymbols.ts, 65, 13)) +>readwriteCall : Symbol(C.readwriteCall, Decl(uniqueSymbols.ts, 62, 37)) + +const constInitToCReadonlyCallWithTypeQuery: typeof c.readonlyCall = c.readonlyCall; +>constInitToCReadonlyCallWithTypeQuery : Symbol(constInitToCReadonlyCallWithTypeQuery, Decl(uniqueSymbols.ts, 79, 5)) +>c.readonlyCall : Symbol(C.readonlyCall, Decl(uniqueSymbols.ts, 60, 42)) +>c : Symbol(c, Decl(uniqueSymbols.ts, 65, 13)) +>readonlyCall : Symbol(C.readonlyCall, Decl(uniqueSymbols.ts, 60, 42)) +>c.readonlyCall : Symbol(C.readonlyCall, Decl(uniqueSymbols.ts, 60, 42)) +>c : Symbol(c, Decl(uniqueSymbols.ts, 65, 13)) +>readonlyCall : Symbol(C.readonlyCall, Decl(uniqueSymbols.ts, 60, 42)) + +const constInitToCReadwriteCallWithTypeQuery: typeof c.readwriteCall = c.readwriteCall; +>constInitToCReadwriteCallWithTypeQuery : Symbol(constInitToCReadwriteCallWithTypeQuery, Decl(uniqueSymbols.ts, 80, 5)) +>c.readwriteCall : Symbol(C.readwriteCall, Decl(uniqueSymbols.ts, 62, 37)) +>c : Symbol(c, Decl(uniqueSymbols.ts, 65, 13)) +>readwriteCall : Symbol(C.readwriteCall, Decl(uniqueSymbols.ts, 62, 37)) +>c.readwriteCall : Symbol(C.readwriteCall, Decl(uniqueSymbols.ts, 62, 37)) +>c : Symbol(c, Decl(uniqueSymbols.ts, 65, 13)) +>readwriteCall : Symbol(C.readwriteCall, Decl(uniqueSymbols.ts, 62, 37)) + +const constInitToCReadonlyCallWithIndexedAccess: C["readonlyCall"] = c.readonlyCall; +>constInitToCReadonlyCallWithIndexedAccess : Symbol(constInitToCReadonlyCallWithIndexedAccess, Decl(uniqueSymbols.ts, 81, 5)) +>C : Symbol(C, Decl(uniqueSymbols.ts, 53, 61)) +>c.readonlyCall : Symbol(C.readonlyCall, Decl(uniqueSymbols.ts, 60, 42)) +>c : Symbol(c, Decl(uniqueSymbols.ts, 65, 13)) +>readonlyCall : Symbol(C.readonlyCall, Decl(uniqueSymbols.ts, 60, 42)) + +const constInitToCReadwriteCallWithIndexedAccess: C["readwriteCall"] = c.readwriteCall; +>constInitToCReadwriteCallWithIndexedAccess : Symbol(constInitToCReadwriteCallWithIndexedAccess, Decl(uniqueSymbols.ts, 82, 5)) +>C : Symbol(C, Decl(uniqueSymbols.ts, 53, 61)) +>c.readwriteCall : Symbol(C.readwriteCall, Decl(uniqueSymbols.ts, 62, 37)) +>c : Symbol(c, Decl(uniqueSymbols.ts, 65, 13)) +>readwriteCall : Symbol(C.readwriteCall, Decl(uniqueSymbols.ts, 62, 37)) + +// interfaces +interface I { +>I : Symbol(I, Decl(uniqueSymbols.ts, 82, 87)) + + readonly readonlyType: unique symbol; +>readonlyType : Symbol(I.readonlyType, Decl(uniqueSymbols.ts, 85, 13)) +} +declare const i: I; +>i : Symbol(i, Decl(uniqueSymbols.ts, 88, 13)) +>I : Symbol(I, Decl(uniqueSymbols.ts, 82, 87)) + +const constInitToIReadonlyType = i.readonlyType; +>constInitToIReadonlyType : Symbol(constInitToIReadonlyType, Decl(uniqueSymbols.ts, 90, 5)) +>i.readonlyType : Symbol(I.readonlyType, Decl(uniqueSymbols.ts, 85, 13)) +>i : Symbol(i, Decl(uniqueSymbols.ts, 88, 13)) +>readonlyType : Symbol(I.readonlyType, Decl(uniqueSymbols.ts, 85, 13)) + +const constInitToIReadonlyTypeWithTypeQuery: typeof i.readonlyType = i.readonlyType; +>constInitToIReadonlyTypeWithTypeQuery : Symbol(constInitToIReadonlyTypeWithTypeQuery, Decl(uniqueSymbols.ts, 91, 5)) +>i.readonlyType : Symbol(I.readonlyType, Decl(uniqueSymbols.ts, 85, 13)) +>i : Symbol(i, Decl(uniqueSymbols.ts, 88, 13)) +>readonlyType : Symbol(I.readonlyType, Decl(uniqueSymbols.ts, 85, 13)) +>i.readonlyType : Symbol(I.readonlyType, Decl(uniqueSymbols.ts, 85, 13)) +>i : Symbol(i, Decl(uniqueSymbols.ts, 88, 13)) +>readonlyType : Symbol(I.readonlyType, Decl(uniqueSymbols.ts, 85, 13)) + +const constInitToIReadonlyTypeWithIndexedAccess: I["readonlyType"] = i.readonlyType; +>constInitToIReadonlyTypeWithIndexedAccess : Symbol(constInitToIReadonlyTypeWithIndexedAccess, Decl(uniqueSymbols.ts, 92, 5)) +>I : Symbol(I, Decl(uniqueSymbols.ts, 82, 87)) +>i.readonlyType : Symbol(I.readonlyType, Decl(uniqueSymbols.ts, 85, 13)) +>i : Symbol(i, Decl(uniqueSymbols.ts, 88, 13)) +>readonlyType : Symbol(I.readonlyType, Decl(uniqueSymbols.ts, 85, 13)) + +// type literals +type L = { +>L : Symbol(L, Decl(uniqueSymbols.ts, 92, 84)) + + readonly readonlyType: unique symbol; +>readonlyType : Symbol(readonlyType, Decl(uniqueSymbols.ts, 95, 10)) + + nested: { +>nested : Symbol(nested, Decl(uniqueSymbols.ts, 96, 41)) + + readonly readonlyNestedType: unique symbol; +>readonlyNestedType : Symbol(readonlyNestedType, Decl(uniqueSymbols.ts, 97, 13)) + } +}; +declare const l: L; +>l : Symbol(l, Decl(uniqueSymbols.ts, 101, 13)) +>L : Symbol(L, Decl(uniqueSymbols.ts, 92, 84)) + +const constInitToLReadonlyType = l.readonlyType; +>constInitToLReadonlyType : Symbol(constInitToLReadonlyType, Decl(uniqueSymbols.ts, 103, 5)) +>l.readonlyType : Symbol(readonlyType, Decl(uniqueSymbols.ts, 95, 10)) +>l : Symbol(l, Decl(uniqueSymbols.ts, 101, 13)) +>readonlyType : Symbol(readonlyType, Decl(uniqueSymbols.ts, 95, 10)) + +const constInitToLReadonlyNestedType = l.nested.readonlyNestedType; +>constInitToLReadonlyNestedType : Symbol(constInitToLReadonlyNestedType, Decl(uniqueSymbols.ts, 104, 5)) +>l.nested.readonlyNestedType : Symbol(readonlyNestedType, Decl(uniqueSymbols.ts, 97, 13)) +>l.nested : Symbol(nested, Decl(uniqueSymbols.ts, 96, 41)) +>l : Symbol(l, Decl(uniqueSymbols.ts, 101, 13)) +>nested : Symbol(nested, Decl(uniqueSymbols.ts, 96, 41)) +>readonlyNestedType : Symbol(readonlyNestedType, Decl(uniqueSymbols.ts, 97, 13)) + +const constInitToLReadonlyTypeWithTypeQuery: typeof l.readonlyType = l.readonlyType; +>constInitToLReadonlyTypeWithTypeQuery : Symbol(constInitToLReadonlyTypeWithTypeQuery, Decl(uniqueSymbols.ts, 105, 5)) +>l.readonlyType : Symbol(readonlyType, Decl(uniqueSymbols.ts, 95, 10)) +>l : Symbol(l, Decl(uniqueSymbols.ts, 101, 13)) +>readonlyType : Symbol(readonlyType, Decl(uniqueSymbols.ts, 95, 10)) +>l.readonlyType : Symbol(readonlyType, Decl(uniqueSymbols.ts, 95, 10)) +>l : Symbol(l, Decl(uniqueSymbols.ts, 101, 13)) +>readonlyType : Symbol(readonlyType, Decl(uniqueSymbols.ts, 95, 10)) + +const constInitToLReadonlyNestedTypeWithTypeQuery: typeof l.nested.readonlyNestedType = l.nested.readonlyNestedType; +>constInitToLReadonlyNestedTypeWithTypeQuery : Symbol(constInitToLReadonlyNestedTypeWithTypeQuery, Decl(uniqueSymbols.ts, 106, 5)) +>l.nested.readonlyNestedType : Symbol(readonlyNestedType, Decl(uniqueSymbols.ts, 97, 13)) +>l.nested : Symbol(nested, Decl(uniqueSymbols.ts, 96, 41)) +>l : Symbol(l, Decl(uniqueSymbols.ts, 101, 13)) +>nested : Symbol(nested, Decl(uniqueSymbols.ts, 96, 41)) +>readonlyNestedType : Symbol(readonlyNestedType, Decl(uniqueSymbols.ts, 97, 13)) +>l.nested.readonlyNestedType : Symbol(readonlyNestedType, Decl(uniqueSymbols.ts, 97, 13)) +>l.nested : Symbol(nested, Decl(uniqueSymbols.ts, 96, 41)) +>l : Symbol(l, Decl(uniqueSymbols.ts, 101, 13)) +>nested : Symbol(nested, Decl(uniqueSymbols.ts, 96, 41)) +>readonlyNestedType : Symbol(readonlyNestedType, Decl(uniqueSymbols.ts, 97, 13)) + +const constInitToLReadonlyTypeWithIndexedAccess: L["readonlyType"] = l.readonlyType; +>constInitToLReadonlyTypeWithIndexedAccess : Symbol(constInitToLReadonlyTypeWithIndexedAccess, Decl(uniqueSymbols.ts, 107, 5)) +>L : Symbol(L, Decl(uniqueSymbols.ts, 92, 84)) +>l.readonlyType : Symbol(readonlyType, Decl(uniqueSymbols.ts, 95, 10)) +>l : Symbol(l, Decl(uniqueSymbols.ts, 101, 13)) +>readonlyType : Symbol(readonlyType, Decl(uniqueSymbols.ts, 95, 10)) + +const constInitToLReadonlyNestedTypeWithIndexedAccess: L["nested"]["readonlyNestedType"] = l.nested.readonlyNestedType; +>constInitToLReadonlyNestedTypeWithIndexedAccess : Symbol(constInitToLReadonlyNestedTypeWithIndexedAccess, Decl(uniqueSymbols.ts, 108, 5)) +>L : Symbol(L, Decl(uniqueSymbols.ts, 92, 84)) +>l.nested.readonlyNestedType : Symbol(readonlyNestedType, Decl(uniqueSymbols.ts, 97, 13)) +>l.nested : Symbol(nested, Decl(uniqueSymbols.ts, 96, 41)) +>l : Symbol(l, Decl(uniqueSymbols.ts, 101, 13)) +>nested : Symbol(nested, Decl(uniqueSymbols.ts, 96, 41)) +>readonlyNestedType : Symbol(readonlyNestedType, Decl(uniqueSymbols.ts, 97, 13)) + +// type argument inference +const promiseForConstCall = Promise.resolve(constCall); +>promiseForConstCall : Symbol(promiseForConstCall, Decl(uniqueSymbols.ts, 111, 5)) +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>constCall : Symbol(constCall, Decl(uniqueSymbols.ts, 1, 5)) + +const arrayOfConstCall = [constCall]; +>arrayOfConstCall : Symbol(arrayOfConstCall, Decl(uniqueSymbols.ts, 112, 5)) +>constCall : Symbol(constCall, Decl(uniqueSymbols.ts, 1, 5)) + +// unique symbol widening in expressions +declare const s: unique symbol; +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) + +declare namespace N { const s: unique symbol; } +>N : Symbol(N, Decl(uniqueSymbols.ts, 115, 31)) +>s : Symbol(s, Decl(uniqueSymbols.ts, 116, 27)) + +declare const o: { [s]: "a", [N.s]: "b" }; +>o : Symbol(o, Decl(uniqueSymbols.ts, 117, 13)) +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) +>N.s : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbols.ts, 115, 31)) +>s : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) + +declare function f(x: T): T; +>f : Symbol(f, Decl(uniqueSymbols.ts, 117, 42)) +>T : Symbol(T, Decl(uniqueSymbols.ts, 118, 19)) +>x : Symbol(x, Decl(uniqueSymbols.ts, 118, 22)) +>T : Symbol(T, Decl(uniqueSymbols.ts, 118, 19)) +>T : Symbol(T, Decl(uniqueSymbols.ts, 118, 19)) + +declare function g(x: typeof s): void; +>g : Symbol(g, Decl(uniqueSymbols.ts, 118, 31), Decl(uniqueSymbols.ts, 119, 38)) +>x : Symbol(x, Decl(uniqueSymbols.ts, 119, 19)) +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) + +declare function g(x: typeof N.s): void; +>g : Symbol(g, Decl(uniqueSymbols.ts, 118, 31), Decl(uniqueSymbols.ts, 119, 38)) +>x : Symbol(x, Decl(uniqueSymbols.ts, 120, 19)) +>N.s : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbols.ts, 115, 31)) +>s : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) + +// widening positions + +// argument inference +f(s); +>f : Symbol(f, Decl(uniqueSymbols.ts, 117, 42)) +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) + +f(N.s); +>f : Symbol(f, Decl(uniqueSymbols.ts, 117, 42)) +>N.s : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbols.ts, 115, 31)) +>s : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) + +f(N["s"]); +>f : Symbol(f, Decl(uniqueSymbols.ts, 117, 42)) +>N : Symbol(N, Decl(uniqueSymbols.ts, 115, 31)) +>"s" : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) + +// array literal elements +[s]; +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) + +[N.s]; +>N.s : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbols.ts, 115, 31)) +>s : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) + +[N["s"]]; +>N : Symbol(N, Decl(uniqueSymbols.ts, 115, 31)) +>"s" : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) + +// property assignments/methods +const o2 = { +>o2 : Symbol(o2, Decl(uniqueSymbols.ts, 135, 5)) + + a: s, +>a : Symbol(a, Decl(uniqueSymbols.ts, 135, 12)) +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) + + b: N.s, +>b : Symbol(b, Decl(uniqueSymbols.ts, 136, 9)) +>N.s : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbols.ts, 115, 31)) +>s : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) + + c: N["s"], +>c : Symbol(c, Decl(uniqueSymbols.ts, 137, 11)) +>N : Symbol(N, Decl(uniqueSymbols.ts, 115, 31)) +>"s" : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) + + method1() { return s; }, +>method1 : Symbol(method1, Decl(uniqueSymbols.ts, 138, 14)) +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) + + async method2() { return s; }, +>method2 : Symbol(method2, Decl(uniqueSymbols.ts, 140, 28)) +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) + + async * method3() { yield s; }, +>method3 : Symbol(method3, Decl(uniqueSymbols.ts, 141, 34)) +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) + + * method4() { yield s; }, +>method4 : Symbol(method4, Decl(uniqueSymbols.ts, 142, 35)) +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) + + method5(p = s) { return p; }, +>method5 : Symbol(method5, Decl(uniqueSymbols.ts, 143, 29)) +>p : Symbol(p, Decl(uniqueSymbols.ts, 144, 12)) +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) +>p : Symbol(p, Decl(uniqueSymbols.ts, 144, 12)) + +}; + +// property initializers +class C0 { +>C0 : Symbol(C0, Decl(uniqueSymbols.ts, 145, 2)) + + static readonly a = s; +>a : Symbol(C0.a, Decl(uniqueSymbols.ts, 148, 10)) +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) + + static readonly b = N.s; +>b : Symbol(C0.b, Decl(uniqueSymbols.ts, 149, 26)) +>N.s : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbols.ts, 115, 31)) +>s : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) + + static readonly c = N["s"]; +>c : Symbol(C0.c, Decl(uniqueSymbols.ts, 150, 28)) +>N : Symbol(N, Decl(uniqueSymbols.ts, 115, 31)) +>"s" : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) + + static d = s; +>d : Symbol(C0.d, Decl(uniqueSymbols.ts, 151, 31)) +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) + + static e = N.s; +>e : Symbol(C0.e, Decl(uniqueSymbols.ts, 153, 17)) +>N.s : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbols.ts, 115, 31)) +>s : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) + + static f = N["s"]; +>f : Symbol(C0.f, Decl(uniqueSymbols.ts, 154, 19)) +>N : Symbol(N, Decl(uniqueSymbols.ts, 115, 31)) +>"s" : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) + + readonly a = s; +>a : Symbol(C0.a, Decl(uniqueSymbols.ts, 155, 22)) +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) + + readonly b = N.s; +>b : Symbol(C0.b, Decl(uniqueSymbols.ts, 157, 19)) +>N.s : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbols.ts, 115, 31)) +>s : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) + + readonly c = N["s"]; +>c : Symbol(C0.c, Decl(uniqueSymbols.ts, 158, 21)) +>N : Symbol(N, Decl(uniqueSymbols.ts, 115, 31)) +>"s" : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) + + d = s; +>d : Symbol(C0.d, Decl(uniqueSymbols.ts, 159, 24)) +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) + + e = N.s; +>e : Symbol(C0.e, Decl(uniqueSymbols.ts, 161, 10)) +>N.s : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbols.ts, 115, 31)) +>s : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) + + f = N["s"]; +>f : Symbol(C0.f, Decl(uniqueSymbols.ts, 162, 12)) +>N : Symbol(N, Decl(uniqueSymbols.ts, 115, 31)) +>"s" : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) + + method1() { return s; } +>method1 : Symbol(C0.method1, Decl(uniqueSymbols.ts, 163, 15)) +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) + + async method2() { return s; } +>method2 : Symbol(C0.method2, Decl(uniqueSymbols.ts, 165, 27)) +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) + + async * method3() { yield s; } +>method3 : Symbol(C0.method3, Decl(uniqueSymbols.ts, 166, 33)) +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) + + * method4() { yield s; } +>method4 : Symbol(C0.method4, Decl(uniqueSymbols.ts, 167, 34)) +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) + + method5(p = s) { return p; } +>method5 : Symbol(C0.method5, Decl(uniqueSymbols.ts, 168, 28)) +>p : Symbol(p, Decl(uniqueSymbols.ts, 169, 12)) +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) +>p : Symbol(p, Decl(uniqueSymbols.ts, 169, 12)) +} + +// non-widening positions + +// element access +o[s]; +>o : Symbol(o, Decl(uniqueSymbols.ts, 117, 13)) +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) + +o[N.s]; +>o : Symbol(o, Decl(uniqueSymbols.ts, 117, 13)) +>N.s : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbols.ts, 115, 31)) +>s : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) + +o[N["s"]]; +>o : Symbol(o, Decl(uniqueSymbols.ts, 117, 13)) +>N : Symbol(N, Decl(uniqueSymbols.ts, 115, 31)) +>"s" : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) + +// arguments (no-inference) +f(s); +>f : Symbol(f, Decl(uniqueSymbols.ts, 117, 42)) +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) + +f(N.s); +>f : Symbol(f, Decl(uniqueSymbols.ts, 117, 42)) +>N.s : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbols.ts, 115, 31)) +>s : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) +>N.s : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbols.ts, 115, 31)) +>s : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) + +f(N["s"]); +>f : Symbol(f, Decl(uniqueSymbols.ts, 117, 42)) +>N.s : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbols.ts, 115, 31)) +>s : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbols.ts, 115, 31)) +>"s" : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) + +g(s); +>g : Symbol(g, Decl(uniqueSymbols.ts, 118, 31), Decl(uniqueSymbols.ts, 119, 38)) +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) + +g(N.s); +>g : Symbol(g, Decl(uniqueSymbols.ts, 118, 31), Decl(uniqueSymbols.ts, 119, 38)) +>N.s : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbols.ts, 115, 31)) +>s : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) + +g(N["s"]); +>g : Symbol(g, Decl(uniqueSymbols.ts, 118, 31), Decl(uniqueSymbols.ts, 119, 38)) +>N : Symbol(N, Decl(uniqueSymbols.ts, 115, 31)) +>"s" : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) + +// falsy expressions +s || ""; +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) + +N.s || ""; +>N.s : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbols.ts, 115, 31)) +>s : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) + +N["s"] || ""; +>N : Symbol(N, Decl(uniqueSymbols.ts, 115, 31)) +>"s" : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) + +// conditionals +Math.random() * 2 ? s : "a"; +>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) + +Math.random() * 2 ? N.s : "a"; +>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) +>N.s : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbols.ts, 115, 31)) +>s : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) + +Math.random() * 2 ? N["s"] : "a"; +>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) +>N : Symbol(N, Decl(uniqueSymbols.ts, 115, 31)) +>"s" : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) + +// computed property names +({ + [s]: "a", +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) + + [N.s]: "b", +>N.s : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbols.ts, 115, 31)) +>s : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) + +}); + +class C1 { +>C1 : Symbol(C1, Decl(uniqueSymbols.ts, 201, 3)) + + static [s]: "a"; +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) + + static [N.s]: "b"; +>N.s : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbols.ts, 115, 31)) +>s : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) + + [s]: "a"; +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) + + [N.s]: "b"; +>N.s : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbols.ts, 115, 31)) +>s : Symbol(N.s, Decl(uniqueSymbols.ts, 116, 27)) +} + +// contextual types + +interface Context { +>Context : Symbol(Context, Decl(uniqueSymbols.ts, 209, 1)) + + method1(): typeof s; +>method1 : Symbol(Context.method1, Decl(uniqueSymbols.ts, 213, 19)) +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) + + method2(): Promise; +>method2 : Symbol(Context.method2, Decl(uniqueSymbols.ts, 214, 24)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) + + method3(): AsyncIterableIterator; +>method3 : Symbol(Context.method3, Decl(uniqueSymbols.ts, 215, 33)) +>AsyncIterableIterator : Symbol(AsyncIterableIterator, Decl(lib.esnext.asynciterable.d.ts, --, --)) +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) + + method4(): IterableIterator; +>method4 : Symbol(Context.method4, Decl(uniqueSymbols.ts, 216, 47)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) + + method5(p?: typeof s): typeof s; +>method5 : Symbol(Context.method5, Decl(uniqueSymbols.ts, 217, 42)) +>p : Symbol(p, Decl(uniqueSymbols.ts, 218, 12)) +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) +} + +const o3: Context = { +>o3 : Symbol(o3, Decl(uniqueSymbols.ts, 221, 5)) +>Context : Symbol(Context, Decl(uniqueSymbols.ts, 209, 1)) + + method1() { +>method1 : Symbol(method1, Decl(uniqueSymbols.ts, 221, 21)) + + return s; // return type should not widen due to contextual type +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) + + }, + async method2() { +>method2 : Symbol(method2, Decl(uniqueSymbols.ts, 224, 6)) + + return s; // return type should not widen due to contextual type +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) + + }, + async * method3() { +>method3 : Symbol(method3, Decl(uniqueSymbols.ts, 227, 6)) + + yield s; // yield type should not widen due to contextual type +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) + + }, + * method4() { +>method4 : Symbol(method4, Decl(uniqueSymbols.ts, 230, 6)) + + yield s; // yield type should not widen due to contextual type +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) + + }, + method5(p = s) { // parameter should not widen due to contextual type +>method5 : Symbol(method5, Decl(uniqueSymbols.ts, 233, 6)) +>p : Symbol(p, Decl(uniqueSymbols.ts, 234, 12)) +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) + + return p; +>p : Symbol(p, Decl(uniqueSymbols.ts, 234, 12)) + + }, +}; + +// allowed when not emitting declarations + +const o4 = { +>o4 : Symbol(o4, Decl(uniqueSymbols.ts, 241, 5)) + + method1(p: typeof s): typeof s { +>method1 : Symbol(method1, Decl(uniqueSymbols.ts, 241, 12)) +>p : Symbol(p, Decl(uniqueSymbols.ts, 242, 12)) +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) + + return p; +>p : Symbol(p, Decl(uniqueSymbols.ts, 242, 12)) + + }, + method2(p: I["readonlyType"]): I["readonlyType"] { +>method2 : Symbol(method2, Decl(uniqueSymbols.ts, 244, 6)) +>p : Symbol(p, Decl(uniqueSymbols.ts, 245, 12)) +>I : Symbol(I, Decl(uniqueSymbols.ts, 82, 87)) +>I : Symbol(I, Decl(uniqueSymbols.ts, 82, 87)) + + return p; +>p : Symbol(p, Decl(uniqueSymbols.ts, 245, 12)) + } +}; + +const ce0 = class { +>ce0 : Symbol(ce0, Decl(uniqueSymbols.ts, 250, 5)) + + method1(p: typeof s): typeof s { +>method1 : Symbol(ce0.method1, Decl(uniqueSymbols.ts, 250, 19)) +>p : Symbol(p, Decl(uniqueSymbols.ts, 251, 12)) +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) + + return p; +>p : Symbol(p, Decl(uniqueSymbols.ts, 251, 12)) + } + method2(p: I["readonlyType"]): I["readonlyType"] { +>method2 : Symbol(ce0.method2, Decl(uniqueSymbols.ts, 253, 5)) +>p : Symbol(p, Decl(uniqueSymbols.ts, 254, 12)) +>I : Symbol(I, Decl(uniqueSymbols.ts, 82, 87)) +>I : Symbol(I, Decl(uniqueSymbols.ts, 82, 87)) + + return p; +>p : Symbol(p, Decl(uniqueSymbols.ts, 254, 12)) + } +}; + +function funcInferredReturnType(obj: { method(p: typeof s): void }) { +>funcInferredReturnType : Symbol(funcInferredReturnType, Decl(uniqueSymbols.ts, 257, 2)) +>obj : Symbol(obj, Decl(uniqueSymbols.ts, 259, 32)) +>method : Symbol(method, Decl(uniqueSymbols.ts, 259, 38)) +>p : Symbol(p, Decl(uniqueSymbols.ts, 259, 46)) +>s : Symbol(s, Decl(uniqueSymbols.ts, 115, 13)) + + return obj; +>obj : Symbol(obj, Decl(uniqueSymbols.ts, 259, 32)) +} + diff --git a/tests/baselines/reference/uniqueSymbols.types b/tests/baselines/reference/uniqueSymbols.types new file mode 100644 index 0000000000000..6516ee25dd06b --- /dev/null +++ b/tests/baselines/reference/uniqueSymbols.types @@ -0,0 +1,931 @@ +=== tests/cases/conformance/types/uniqueSymbol/uniqueSymbols.ts === +// declarations with call initializer +const constCall = Symbol(); +>constCall : unique symbol +>Symbol() : unique symbol +>Symbol : SymbolConstructor + +let letCall = Symbol(); +>letCall : symbol +>Symbol() : symbol +>Symbol : SymbolConstructor + +var varCall = Symbol(); +>varCall : symbol +>Symbol() : symbol +>Symbol : SymbolConstructor + +// ambient declaration with type +declare const constType: unique symbol; +>constType : unique symbol + +// declaration with type and call initializer +const constTypeAndCall: unique symbol = Symbol(); +>constTypeAndCall : unique symbol +>Symbol() : unique symbol +>Symbol : SymbolConstructor + +// declaration from initializer +const constInitToConstCall = constCall; +>constInitToConstCall : symbol +>constCall : unique symbol + +const constInitToLetCall = letCall; +>constInitToLetCall : symbol +>letCall : symbol + +const constInitToVarCall = varCall; +>constInitToVarCall : symbol +>varCall : symbol + +const constInitToConstDeclAmbient = constType; +>constInitToConstDeclAmbient : symbol +>constType : unique symbol + +let letInitToConstCall = constCall; +>letInitToConstCall : symbol +>constCall : unique symbol + +let letInitToLetCall = letCall; +>letInitToLetCall : symbol +>letCall : symbol + +let letInitToVarCall = varCall; +>letInitToVarCall : symbol +>varCall : symbol + +let letInitToConstDeclAmbient = constType; +>letInitToConstDeclAmbient : symbol +>constType : unique symbol + +var varInitToConstCall = constCall; +>varInitToConstCall : symbol +>constCall : unique symbol + +var varInitToLetCall = letCall; +>varInitToLetCall : symbol +>letCall : symbol + +var varInitToVarCall = varCall; +>varInitToVarCall : symbol +>varCall : symbol + +var varInitToConstDeclAmbient = constType; +>varInitToConstDeclAmbient : symbol +>constType : unique symbol + +// declaration from initializer with type query +const constInitToConstCallWithTypeQuery: typeof constCall = constCall; +>constInitToConstCallWithTypeQuery : unique symbol +>constCall : unique symbol +>constCall : unique symbol + +const constInitToConstDeclAmbientWithTypeQuery: typeof constType = constType; +>constInitToConstDeclAmbientWithTypeQuery : unique symbol +>constType : unique symbol +>constType : unique symbol + +// function return inference +function funcReturnConstCall() { return constCall; } +>funcReturnConstCall : () => symbol +>constCall : unique symbol + +function funcReturnLetCall() { return letCall; } +>funcReturnLetCall : () => symbol +>letCall : symbol + +function funcReturnVarCall() { return varCall; } +>funcReturnVarCall : () => symbol +>varCall : symbol + +// function return value with type query +function funcReturnConstCallWithTypeQuery(): typeof constCall { return constCall; } +>funcReturnConstCallWithTypeQuery : () => unique symbol +>constCall : unique symbol +>constCall : unique symbol + +// generator function yield inference +function* genFuncYieldConstCall() { yield constCall; } +>genFuncYieldConstCall : () => IterableIterator +>yield constCall : any +>constCall : unique symbol + +function* genFuncYieldLetCall() { yield letCall; } +>genFuncYieldLetCall : () => IterableIterator +>yield letCall : any +>letCall : symbol + +function* genFuncYieldVarCall() { yield varCall; } +>genFuncYieldVarCall : () => IterableIterator +>yield varCall : any +>varCall : symbol + +// generator function yield with return type query +function* genFuncYieldConstCallWithTypeQuery(): IterableIterator { yield constCall; } +>genFuncYieldConstCallWithTypeQuery : () => IterableIterator +>IterableIterator : IterableIterator +>constCall : unique symbol +>yield constCall : any +>constCall : unique symbol + +// async function return inference +async function asyncFuncReturnConstCall() { return constCall; } +>asyncFuncReturnConstCall : () => Promise +>constCall : unique symbol + +async function asyncFuncReturnLetCall() { return letCall; } +>asyncFuncReturnLetCall : () => Promise +>letCall : symbol + +async function asyncFuncReturnVarCall() { return varCall; } +>asyncFuncReturnVarCall : () => Promise +>varCall : symbol + +// async generator function yield inference +async function* asyncGenFuncYieldConstCall() { yield constCall; } +>asyncGenFuncYieldConstCall : () => AsyncIterableIterator +>yield constCall : any +>constCall : unique symbol + +async function* asyncGenFuncYieldLetCall() { yield letCall; } +>asyncGenFuncYieldLetCall : () => AsyncIterableIterator +>yield letCall : any +>letCall : symbol + +async function* asyncGenFuncYieldVarCall() { yield varCall; } +>asyncGenFuncYieldVarCall : () => AsyncIterableIterator +>yield varCall : any +>varCall : symbol + +// classes +class C { +>C : C + + static readonly readonlyStaticCall = Symbol(); +>readonlyStaticCall : unique symbol +>Symbol() : unique symbol +>Symbol : SymbolConstructor + + static readonly readonlyStaticType: unique symbol; +>readonlyStaticType : unique symbol + + static readonly readonlyStaticTypeAndCall: unique symbol = Symbol(); +>readonlyStaticTypeAndCall : unique symbol +>Symbol() : unique symbol +>Symbol : SymbolConstructor + + static readwriteStaticCall = Symbol(); +>readwriteStaticCall : symbol +>Symbol() : symbol +>Symbol : SymbolConstructor + + readonly readonlyCall = Symbol(); +>readonlyCall : symbol +>Symbol() : symbol +>Symbol : SymbolConstructor + + readwriteCall = Symbol(); +>readwriteCall : symbol +>Symbol() : symbol +>Symbol : SymbolConstructor +} +declare const c: C; +>c : C +>C : C + +const constInitToCReadonlyStaticCall = C.readonlyStaticCall; +>constInitToCReadonlyStaticCall : symbol +>C.readonlyStaticCall : unique symbol +>C : typeof C +>readonlyStaticCall : unique symbol + +const constInitToCReadonlyStaticType = C.readonlyStaticType; +>constInitToCReadonlyStaticType : symbol +>C.readonlyStaticType : unique symbol +>C : typeof C +>readonlyStaticType : unique symbol + +const constInitToCReadonlyStaticTypeAndCall = C.readonlyStaticTypeAndCall; +>constInitToCReadonlyStaticTypeAndCall : symbol +>C.readonlyStaticTypeAndCall : unique symbol +>C : typeof C +>readonlyStaticTypeAndCall : unique symbol + +const constInitToCReadwriteStaticCall = C.readwriteStaticCall; +>constInitToCReadwriteStaticCall : symbol +>C.readwriteStaticCall : symbol +>C : typeof C +>readwriteStaticCall : symbol + +const constInitToCReadonlyStaticCallWithTypeQuery: typeof C.readonlyStaticCall = C.readonlyStaticCall; +>constInitToCReadonlyStaticCallWithTypeQuery : unique symbol +>C.readonlyStaticCall : unique symbol +>C : typeof C +>readonlyStaticCall : unique symbol +>C.readonlyStaticCall : unique symbol +>C : typeof C +>readonlyStaticCall : unique symbol + +const constInitToCReadonlyStaticTypeWithTypeQuery: typeof C.readonlyStaticType = C.readonlyStaticType; +>constInitToCReadonlyStaticTypeWithTypeQuery : unique symbol +>C.readonlyStaticType : unique symbol +>C : typeof C +>readonlyStaticType : unique symbol +>C.readonlyStaticType : unique symbol +>C : typeof C +>readonlyStaticType : unique symbol + +const constInitToCReadonlyStaticTypeAndCallWithTypeQuery: typeof C.readonlyStaticTypeAndCall = C.readonlyStaticTypeAndCall; +>constInitToCReadonlyStaticTypeAndCallWithTypeQuery : unique symbol +>C.readonlyStaticTypeAndCall : unique symbol +>C : typeof C +>readonlyStaticTypeAndCall : unique symbol +>C.readonlyStaticTypeAndCall : unique symbol +>C : typeof C +>readonlyStaticTypeAndCall : unique symbol + +const constInitToCReadwriteStaticCallWithTypeQuery: typeof C.readwriteStaticCall = C.readwriteStaticCall; +>constInitToCReadwriteStaticCallWithTypeQuery : symbol +>C.readwriteStaticCall : symbol +>C : typeof C +>readwriteStaticCall : symbol +>C.readwriteStaticCall : symbol +>C : typeof C +>readwriteStaticCall : symbol + +const constInitToCReadonlyCall = c.readonlyCall; +>constInitToCReadonlyCall : symbol +>c.readonlyCall : symbol +>c : C +>readonlyCall : symbol + +const constInitToCReadwriteCall = c.readwriteCall; +>constInitToCReadwriteCall : symbol +>c.readwriteCall : symbol +>c : C +>readwriteCall : symbol + +const constInitToCReadonlyCallWithTypeQuery: typeof c.readonlyCall = c.readonlyCall; +>constInitToCReadonlyCallWithTypeQuery : symbol +>c.readonlyCall : symbol +>c : C +>readonlyCall : symbol +>c.readonlyCall : symbol +>c : C +>readonlyCall : symbol + +const constInitToCReadwriteCallWithTypeQuery: typeof c.readwriteCall = c.readwriteCall; +>constInitToCReadwriteCallWithTypeQuery : symbol +>c.readwriteCall : symbol +>c : C +>readwriteCall : symbol +>c.readwriteCall : symbol +>c : C +>readwriteCall : symbol + +const constInitToCReadonlyCallWithIndexedAccess: C["readonlyCall"] = c.readonlyCall; +>constInitToCReadonlyCallWithIndexedAccess : symbol +>C : C +>c.readonlyCall : symbol +>c : C +>readonlyCall : symbol + +const constInitToCReadwriteCallWithIndexedAccess: C["readwriteCall"] = c.readwriteCall; +>constInitToCReadwriteCallWithIndexedAccess : symbol +>C : C +>c.readwriteCall : symbol +>c : C +>readwriteCall : symbol + +// interfaces +interface I { +>I : I + + readonly readonlyType: unique symbol; +>readonlyType : unique symbol +} +declare const i: I; +>i : I +>I : I + +const constInitToIReadonlyType = i.readonlyType; +>constInitToIReadonlyType : symbol +>i.readonlyType : unique symbol +>i : I +>readonlyType : unique symbol + +const constInitToIReadonlyTypeWithTypeQuery: typeof i.readonlyType = i.readonlyType; +>constInitToIReadonlyTypeWithTypeQuery : unique symbol +>i.readonlyType : unique symbol +>i : I +>readonlyType : unique symbol +>i.readonlyType : unique symbol +>i : I +>readonlyType : unique symbol + +const constInitToIReadonlyTypeWithIndexedAccess: I["readonlyType"] = i.readonlyType; +>constInitToIReadonlyTypeWithIndexedAccess : unique symbol +>I : I +>i.readonlyType : unique symbol +>i : I +>readonlyType : unique symbol + +// type literals +type L = { +>L : L + + readonly readonlyType: unique symbol; +>readonlyType : unique symbol + + nested: { +>nested : { readonly readonlyNestedType: unique symbol; } + + readonly readonlyNestedType: unique symbol; +>readonlyNestedType : unique symbol + } +}; +declare const l: L; +>l : L +>L : L + +const constInitToLReadonlyType = l.readonlyType; +>constInitToLReadonlyType : symbol +>l.readonlyType : unique symbol +>l : L +>readonlyType : unique symbol + +const constInitToLReadonlyNestedType = l.nested.readonlyNestedType; +>constInitToLReadonlyNestedType : symbol +>l.nested.readonlyNestedType : unique symbol +>l.nested : { readonly readonlyNestedType: unique symbol; } +>l : L +>nested : { readonly readonlyNestedType: unique symbol; } +>readonlyNestedType : unique symbol + +const constInitToLReadonlyTypeWithTypeQuery: typeof l.readonlyType = l.readonlyType; +>constInitToLReadonlyTypeWithTypeQuery : unique symbol +>l.readonlyType : unique symbol +>l : L +>readonlyType : unique symbol +>l.readonlyType : unique symbol +>l : L +>readonlyType : unique symbol + +const constInitToLReadonlyNestedTypeWithTypeQuery: typeof l.nested.readonlyNestedType = l.nested.readonlyNestedType; +>constInitToLReadonlyNestedTypeWithTypeQuery : unique symbol +>l.nested.readonlyNestedType : unique symbol +>l.nested : { readonly readonlyNestedType: unique symbol; } +>l : L +>nested : { readonly readonlyNestedType: unique symbol; } +>readonlyNestedType : unique symbol +>l.nested.readonlyNestedType : unique symbol +>l.nested : { readonly readonlyNestedType: unique symbol; } +>l : L +>nested : { readonly readonlyNestedType: unique symbol; } +>readonlyNestedType : unique symbol + +const constInitToLReadonlyTypeWithIndexedAccess: L["readonlyType"] = l.readonlyType; +>constInitToLReadonlyTypeWithIndexedAccess : unique symbol +>L : L +>l.readonlyType : unique symbol +>l : L +>readonlyType : unique symbol + +const constInitToLReadonlyNestedTypeWithIndexedAccess: L["nested"]["readonlyNestedType"] = l.nested.readonlyNestedType; +>constInitToLReadonlyNestedTypeWithIndexedAccess : unique symbol +>L : L +>l.nested.readonlyNestedType : unique symbol +>l.nested : { readonly readonlyNestedType: unique symbol; } +>l : L +>nested : { readonly readonlyNestedType: unique symbol; } +>readonlyNestedType : unique symbol + +// type argument inference +const promiseForConstCall = Promise.resolve(constCall); +>promiseForConstCall : Promise +>Promise.resolve(constCall) : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>constCall : unique symbol + +const arrayOfConstCall = [constCall]; +>arrayOfConstCall : symbol[] +>[constCall] : symbol[] +>constCall : unique symbol + +// unique symbol widening in expressions +declare const s: unique symbol; +>s : unique symbol + +declare namespace N { const s: unique symbol; } +>N : typeof N +>s : unique symbol + +declare const o: { [s]: "a", [N.s]: "b" }; +>o : { [s]: "a"; [N.s]: "b"; } +>s : unique symbol +>N.s : unique symbol +>N : typeof N +>s : unique symbol + +declare function f(x: T): T; +>f : (x: T) => T +>T : T +>x : T +>T : T +>T : T + +declare function g(x: typeof s): void; +>g : { (x: unique symbol): void; (x: unique symbol): void; } +>x : unique symbol +>s : unique symbol + +declare function g(x: typeof N.s): void; +>g : { (x: unique symbol): void; (x: unique symbol): void; } +>x : unique symbol +>N.s : unique symbol +>N : typeof N +>s : unique symbol + +// widening positions + +// argument inference +f(s); +>f(s) : symbol +>f : (x: T) => T +>s : unique symbol + +f(N.s); +>f(N.s) : symbol +>f : (x: T) => T +>N.s : unique symbol +>N : typeof N +>s : unique symbol + +f(N["s"]); +>f(N["s"]) : symbol +>f : (x: T) => T +>N["s"] : unique symbol +>N : typeof N +>"s" : "s" + +// array literal elements +[s]; +>[s] : symbol[] +>s : unique symbol + +[N.s]; +>[N.s] : symbol[] +>N.s : unique symbol +>N : typeof N +>s : unique symbol + +[N["s"]]; +>[N["s"]] : symbol[] +>N["s"] : unique symbol +>N : typeof N +>"s" : "s" + +// property assignments/methods +const o2 = { +>o2 : { a: symbol; b: symbol; c: symbol; method1(): symbol; method2(): Promise; method3(): AsyncIterableIterator; method4(): IterableIterator; method5(p?: symbol): symbol; } +>{ a: s, b: N.s, c: N["s"], method1() { return s; }, async method2() { return s; }, async * method3() { yield s; }, * method4() { yield s; }, method5(p = s) { return p; },} : { a: symbol; b: symbol; c: symbol; method1(): symbol; method2(): Promise; method3(): AsyncIterableIterator; method4(): IterableIterator; method5(p?: symbol): symbol; } + + a: s, +>a : symbol +>s : unique symbol + + b: N.s, +>b : symbol +>N.s : unique symbol +>N : typeof N +>s : unique symbol + + c: N["s"], +>c : symbol +>N["s"] : unique symbol +>N : typeof N +>"s" : "s" + + method1() { return s; }, +>method1 : () => symbol +>s : unique symbol + + async method2() { return s; }, +>method2 : () => Promise +>s : unique symbol + + async * method3() { yield s; }, +>method3 : () => AsyncIterableIterator +>yield s : any +>s : unique symbol + + * method4() { yield s; }, +>method4 : () => IterableIterator +>yield s : any +>s : unique symbol + + method5(p = s) { return p; }, +>method5 : (p?: symbol) => symbol +>p : symbol +>s : unique symbol +>p : symbol + +}; + +// property initializers +class C0 { +>C0 : C0 + + static readonly a = s; +>a : symbol +>s : unique symbol + + static readonly b = N.s; +>b : symbol +>N.s : unique symbol +>N : typeof N +>s : unique symbol + + static readonly c = N["s"]; +>c : symbol +>N["s"] : unique symbol +>N : typeof N +>"s" : "s" + + static d = s; +>d : symbol +>s : unique symbol + + static e = N.s; +>e : symbol +>N.s : unique symbol +>N : typeof N +>s : unique symbol + + static f = N["s"]; +>f : symbol +>N["s"] : unique symbol +>N : typeof N +>"s" : "s" + + readonly a = s; +>a : symbol +>s : unique symbol + + readonly b = N.s; +>b : symbol +>N.s : unique symbol +>N : typeof N +>s : unique symbol + + readonly c = N["s"]; +>c : symbol +>N["s"] : unique symbol +>N : typeof N +>"s" : "s" + + d = s; +>d : symbol +>s : unique symbol + + e = N.s; +>e : symbol +>N.s : unique symbol +>N : typeof N +>s : unique symbol + + f = N["s"]; +>f : symbol +>N["s"] : unique symbol +>N : typeof N +>"s" : "s" + + method1() { return s; } +>method1 : () => symbol +>s : unique symbol + + async method2() { return s; } +>method2 : () => Promise +>s : unique symbol + + async * method3() { yield s; } +>method3 : () => AsyncIterableIterator +>yield s : any +>s : unique symbol + + * method4() { yield s; } +>method4 : () => IterableIterator +>yield s : any +>s : unique symbol + + method5(p = s) { return p; } +>method5 : (p?: symbol) => symbol +>p : symbol +>s : unique symbol +>p : symbol +} + +// non-widening positions + +// element access +o[s]; +>o[s] : "a" +>o : { [s]: "a"; [N.s]: "b"; } +>s : unique symbol + +o[N.s]; +>o[N.s] : "b" +>o : { [s]: "a"; [N.s]: "b"; } +>N.s : unique symbol +>N : typeof N +>s : unique symbol + +o[N["s"]]; +>o[N["s"]] : "b" +>o : { [s]: "a"; [N.s]: "b"; } +>N["s"] : unique symbol +>N : typeof N +>"s" : "s" + +// arguments (no-inference) +f(s); +>f(s) : unique symbol +>f : (x: T) => T +>s : unique symbol +>s : unique symbol + +f(N.s); +>f(N.s) : unique symbol +>f : (x: T) => T +>N.s : unique symbol +>N : typeof N +>s : unique symbol +>N.s : unique symbol +>N : typeof N +>s : unique symbol + +f(N["s"]); +>f(N["s"]) : unique symbol +>f : (x: T) => T +>N.s : unique symbol +>N : typeof N +>s : unique symbol +>N["s"] : unique symbol +>N : typeof N +>"s" : "s" + +g(s); +>g(s) : void +>g : { (x: unique symbol): void; (x: unique symbol): void; } +>s : unique symbol + +g(N.s); +>g(N.s) : void +>g : { (x: unique symbol): void; (x: unique symbol): void; } +>N.s : unique symbol +>N : typeof N +>s : unique symbol + +g(N["s"]); +>g(N["s"]) : void +>g : { (x: unique symbol): void; (x: unique symbol): void; } +>N["s"] : unique symbol +>N : typeof N +>"s" : "s" + +// falsy expressions +s || ""; +>s || "" : unique symbol | "" +>s : unique symbol +>"" : "" + +N.s || ""; +>N.s || "" : unique symbol | "" +>N.s : unique symbol +>N : typeof N +>s : unique symbol +>"" : "" + +N["s"] || ""; +>N["s"] || "" : unique symbol | "" +>N["s"] : unique symbol +>N : typeof N +>"s" : "s" +>"" : "" + +// conditionals +Math.random() * 2 ? s : "a"; +>Math.random() * 2 ? s : "a" : unique symbol | "a" +>Math.random() * 2 : number +>Math.random() : number +>Math.random : () => number +>Math : Math +>random : () => number +>2 : 2 +>s : unique symbol +>"a" : "a" + +Math.random() * 2 ? N.s : "a"; +>Math.random() * 2 ? N.s : "a" : unique symbol | "a" +>Math.random() * 2 : number +>Math.random() : number +>Math.random : () => number +>Math : Math +>random : () => number +>2 : 2 +>N.s : unique symbol +>N : typeof N +>s : unique symbol +>"a" : "a" + +Math.random() * 2 ? N["s"] : "a"; +>Math.random() * 2 ? N["s"] : "a" : unique symbol | "a" +>Math.random() * 2 : number +>Math.random() : number +>Math.random : () => number +>Math : Math +>random : () => number +>2 : 2 +>N["s"] : unique symbol +>N : typeof N +>"s" : "s" +>"a" : "a" + +// computed property names +({ +>({ [s]: "a", [N.s]: "b",}) : { [s]: string; [N.s]: string; } +>{ [s]: "a", [N.s]: "b",} : { [s]: string; [N.s]: string; } + + [s]: "a", +>s : unique symbol +>"a" : "a" + + [N.s]: "b", +>N.s : unique symbol +>N : typeof N +>s : unique symbol +>"b" : "b" + +}); + +class C1 { +>C1 : C1 + + static [s]: "a"; +>s : unique symbol + + static [N.s]: "b"; +>N.s : unique symbol +>N : typeof N +>s : unique symbol + + [s]: "a"; +>s : unique symbol + + [N.s]: "b"; +>N.s : unique symbol +>N : typeof N +>s : unique symbol +} + +// contextual types + +interface Context { +>Context : Context + + method1(): typeof s; +>method1 : () => unique symbol +>s : unique symbol + + method2(): Promise; +>method2 : () => Promise +>Promise : Promise +>s : unique symbol + + method3(): AsyncIterableIterator; +>method3 : () => AsyncIterableIterator +>AsyncIterableIterator : AsyncIterableIterator +>s : unique symbol + + method4(): IterableIterator; +>method4 : () => IterableIterator +>IterableIterator : IterableIterator +>s : unique symbol + + method5(p?: typeof s): typeof s; +>method5 : (p?: unique symbol) => unique symbol +>p : unique symbol +>s : unique symbol +>s : unique symbol +} + +const o3: Context = { +>o3 : Context +>Context : Context +>{ method1() { return s; // return type should not widen due to contextual type }, async method2() { return s; // return type should not widen due to contextual type }, async * method3() { yield s; // yield type should not widen due to contextual type }, * method4() { yield s; // yield type should not widen due to contextual type }, method5(p = s) { // parameter should not widen due to contextual type return p; },} : { method1(): unique symbol; method2(): Promise; method3(): AsyncIterableIterator; method4(): IterableIterator; method5(p?: unique symbol): unique symbol; } + + method1() { +>method1 : () => unique symbol + + return s; // return type should not widen due to contextual type +>s : unique symbol + + }, + async method2() { +>method2 : () => Promise + + return s; // return type should not widen due to contextual type +>s : unique symbol + + }, + async * method3() { +>method3 : () => AsyncIterableIterator + + yield s; // yield type should not widen due to contextual type +>yield s : any +>s : unique symbol + + }, + * method4() { +>method4 : () => IterableIterator + + yield s; // yield type should not widen due to contextual type +>yield s : any +>s : unique symbol + + }, + method5(p = s) { // parameter should not widen due to contextual type +>method5 : (p?: unique symbol) => unique symbol +>p : unique symbol +>s : unique symbol + + return p; +>p : unique symbol + + }, +}; + +// allowed when not emitting declarations + +const o4 = { +>o4 : { method1(p: unique symbol): unique symbol; method2(p: unique symbol): unique symbol; } +>{ method1(p: typeof s): typeof s { return p; }, method2(p: I["readonlyType"]): I["readonlyType"] { return p; }} : { method1(p: unique symbol): unique symbol; method2(p: unique symbol): unique symbol; } + + method1(p: typeof s): typeof s { +>method1 : (p: unique symbol) => unique symbol +>p : unique symbol +>s : unique symbol +>s : unique symbol + + return p; +>p : unique symbol + + }, + method2(p: I["readonlyType"]): I["readonlyType"] { +>method2 : (p: unique symbol) => unique symbol +>p : unique symbol +>I : I +>I : I + + return p; +>p : unique symbol + } +}; + +const ce0 = class { +>ce0 : typeof ce0 +>class { method1(p: typeof s): typeof s { return p; } method2(p: I["readonlyType"]): I["readonlyType"] { return p; }} : typeof ce0 + + method1(p: typeof s): typeof s { +>method1 : (p: unique symbol) => unique symbol +>p : unique symbol +>s : unique symbol +>s : unique symbol + + return p; +>p : unique symbol + } + method2(p: I["readonlyType"]): I["readonlyType"] { +>method2 : (p: unique symbol) => unique symbol +>p : unique symbol +>I : I +>I : I + + return p; +>p : unique symbol + } +}; + +function funcInferredReturnType(obj: { method(p: typeof s): void }) { +>funcInferredReturnType : (obj: { method(p: unique symbol): void; }) => { method(p: unique symbol): void; } +>obj : { method(p: unique symbol): void; } +>method : (p: unique symbol) => void +>p : unique symbol +>s : unique symbol + + return obj; +>obj : { method(p: unique symbol): void; } +} + diff --git a/tests/baselines/reference/uniqueSymbolsDeclarations.js b/tests/baselines/reference/uniqueSymbolsDeclarations.js new file mode 100644 index 0000000000000..6b52b2109772f --- /dev/null +++ b/tests/baselines/reference/uniqueSymbolsDeclarations.js @@ -0,0 +1,540 @@ +//// [uniqueSymbolsDeclarations.ts] +// declarations with call initializer +const constCall = Symbol(); +let letCall = Symbol(); +var varCall = Symbol(); + +// ambient declaration with type +declare const constType: unique symbol; + +// declaration with type and call initializer +const constTypeAndCall: unique symbol = Symbol(); + +// declaration from initializer +const constInitToConstCall = constCall; +const constInitToLetCall = letCall; +const constInitToVarCall = varCall; +const constInitToConstDeclAmbient = constType; +let letInitToConstCall = constCall; +let letInitToLetCall = letCall; +let letInitToVarCall = varCall; +let letInitToConstDeclAmbient = constType; +var varInitToConstCall = constCall; +var varInitToLetCall = letCall; +var varInitToVarCall = varCall; +var varInitToConstDeclAmbient = constType; + +// declaration from initializer with type query +const constInitToConstCallWithTypeQuery: typeof constCall = constCall; +const constInitToConstDeclAmbientWithTypeQuery: typeof constType = constType; + +// function return inference +function funcReturnConstCall() { return constCall; } +function funcReturnLetCall() { return letCall; } +function funcReturnVarCall() { return varCall; } + +// function return value with type query +function funcReturnConstCallWithTypeQuery(): typeof constCall { return constCall; } + +// generator function yield inference +function* genFuncYieldConstCall() { yield constCall; } +function* genFuncYieldLetCall() { yield letCall; } +function* genFuncYieldVarCall() { yield varCall; } + +// generator function yield with return type query +function* genFuncYieldConstCallWithTypeQuery(): IterableIterator { yield constCall; } + +// async function return inference +async function asyncFuncReturnConstCall() { return constCall; } +async function asyncFuncReturnLetCall() { return letCall; } +async function asyncFuncReturnVarCall() { return varCall; } + +// async generator function yield inference +async function* asyncGenFuncYieldConstCall() { yield constCall; } +async function* asyncGenFuncYieldLetCall() { yield letCall; } +async function* asyncGenFuncYieldVarCall() { yield varCall; } + +// classes +class C { + static readonly readonlyStaticCall = Symbol(); + static readonly readonlyStaticType: unique symbol; + static readonly readonlyStaticTypeAndCall: unique symbol = Symbol(); + static readwriteStaticCall = Symbol(); + + readonly readonlyCall = Symbol(); + readwriteCall = Symbol(); +} +declare const c: C; + +const constInitToCReadonlyStaticCall = C.readonlyStaticCall; +const constInitToCReadonlyStaticType = C.readonlyStaticType; +const constInitToCReadonlyStaticTypeAndCall = C.readonlyStaticTypeAndCall; +const constInitToCReadwriteStaticCall = C.readwriteStaticCall; + +const constInitToCReadonlyStaticCallWithTypeQuery: typeof C.readonlyStaticCall = C.readonlyStaticCall; +const constInitToCReadonlyStaticTypeWithTypeQuery: typeof C.readonlyStaticType = C.readonlyStaticType; +const constInitToCReadonlyStaticTypeAndCallWithTypeQuery: typeof C.readonlyStaticTypeAndCall = C.readonlyStaticTypeAndCall; +const constInitToCReadwriteStaticCallWithTypeQuery: typeof C.readwriteStaticCall = C.readwriteStaticCall; + +const constInitToCReadonlyCall = c.readonlyCall; +const constInitToCReadwriteCall = c.readwriteCall; +const constInitToCReadonlyCallWithTypeQuery: typeof c.readonlyCall = c.readonlyCall; +const constInitToCReadwriteCallWithTypeQuery: typeof c.readwriteCall = c.readwriteCall; +const constInitToCReadonlyCallWithIndexedAccess: C["readonlyCall"] = c.readonlyCall; +const constInitToCReadwriteCallWithIndexedAccess: C["readwriteCall"] = c.readwriteCall; + +// interfaces +interface I { + readonly readonlyType: unique symbol; +} +declare const i: I; + +const constInitToIReadonlyType = i.readonlyType; +const constInitToIReadonlyTypeWithTypeQuery: typeof i.readonlyType = i.readonlyType; +const constInitToIReadonlyTypeWithIndexedAccess: I["readonlyType"] = i.readonlyType; + +// type literals +type L = { + readonly readonlyType: unique symbol; + nested: { + readonly readonlyNestedType: unique symbol; + } +}; +declare const l: L; + +const constInitToLReadonlyType = l.readonlyType; +const constInitToLReadonlyNestedType = l.nested.readonlyNestedType; +const constInitToLReadonlyTypeWithTypeQuery: typeof l.readonlyType = l.readonlyType; +const constInitToLReadonlyNestedTypeWithTypeQuery: typeof l.nested.readonlyNestedType = l.nested.readonlyNestedType; +const constInitToLReadonlyTypeWithIndexedAccess: L["readonlyType"] = l.readonlyType; +const constInitToLReadonlyNestedTypeWithIndexedAccess: L["nested"]["readonlyNestedType"] = l.nested.readonlyNestedType; + +// type argument inference +const promiseForConstCall = Promise.resolve(constCall); +const arrayOfConstCall = [constCall]; + +// unique symbol widening in expressions +declare const s: unique symbol; +declare namespace N { const s: unique symbol; } +declare const o: { [s]: "a", [N.s]: "b" }; +declare function f(x: T): T; +declare function g(x: typeof s): void; +declare function g(x: typeof N.s): void; + +// widening positions + +// argument inference +f(s); +f(N.s); +f(N["s"]); + +// array literal elements +[s]; +[N.s]; +[N["s"]]; + +// property assignments/methods +const o2 = { + a: s, + b: N.s, + c: N["s"], + + method1() { return s; }, + async method2() { return s; }, + async * method3() { yield s; }, + * method4() { yield s; }, + method5(p = s) { return p; } +}; + +// property initializers +class C0 { + static readonly a = s; + static readonly b = N.s; + static readonly c = N["s"]; + + static d = s; + static e = N.s; + static f = N["s"]; + + readonly a = s; + readonly b = N.s; + readonly c = N["s"]; + + d = s; + e = N.s; + f = N["s"]; + + method1() { return s; } + async method2() { return s; } + async * method3() { yield s; } + * method4() { yield s; } + method5(p = s) { return p; } +} + +// non-widening positions + +// element access +o[s]; +o[N.s]; +o[N["s"]]; + +// arguments (no-inference) +f(s); +f(N.s); +f(N["s"]); +g(s); +g(N.s); +g(N["s"]); + +// falsy expressions +s || ""; +N.s || ""; +N["s"] || ""; + +// conditionals +Math.random() * 2 ? s : "a"; +Math.random() * 2 ? N.s : "a"; +Math.random() * 2 ? N["s"] : "a"; + +// computed property names +({ + [s]: "a", + [N.s]: "b", +}); + +class C1 { + static [s]: "a"; + static [N.s]: "b"; + + [s]: "a"; + [N.s]: "b"; +} + +// contextual types + +interface Context { + method1(): typeof s; + method2(): Promise; + method3(): AsyncIterableIterator; + method4(): IterableIterator; + method5(p?: typeof s): typeof s; +} + +const o4: Context = { + method1() { + return s; // return type should not widen due to contextual type + }, + async method2() { + return s; // return type should not widen due to contextual type + }, + async * method3() { + yield s; // yield type should not widen due to contextual type + }, + * method4() { + yield s; // yield type should not widen due to contextual type + }, + method5(p = s) { // parameter should not widen due to contextual type + return p; + } +}; + +//// [uniqueSymbolsDeclarations.js] +// declarations with call initializer +const constCall = Symbol(); +let letCall = Symbol(); +var varCall = Symbol(); +// declaration with type and call initializer +const constTypeAndCall = Symbol(); +// declaration from initializer +const constInitToConstCall = constCall; +const constInitToLetCall = letCall; +const constInitToVarCall = varCall; +const constInitToConstDeclAmbient = constType; +let letInitToConstCall = constCall; +let letInitToLetCall = letCall; +let letInitToVarCall = varCall; +let letInitToConstDeclAmbient = constType; +var varInitToConstCall = constCall; +var varInitToLetCall = letCall; +var varInitToVarCall = varCall; +var varInitToConstDeclAmbient = constType; +// declaration from initializer with type query +const constInitToConstCallWithTypeQuery = constCall; +const constInitToConstDeclAmbientWithTypeQuery = constType; +// function return inference +function funcReturnConstCall() { return constCall; } +function funcReturnLetCall() { return letCall; } +function funcReturnVarCall() { return varCall; } +// function return value with type query +function funcReturnConstCallWithTypeQuery() { return constCall; } +// generator function yield inference +function* genFuncYieldConstCall() { yield constCall; } +function* genFuncYieldLetCall() { yield letCall; } +function* genFuncYieldVarCall() { yield varCall; } +// generator function yield with return type query +function* genFuncYieldConstCallWithTypeQuery() { yield constCall; } +// async function return inference +async function asyncFuncReturnConstCall() { return constCall; } +async function asyncFuncReturnLetCall() { return letCall; } +async function asyncFuncReturnVarCall() { return varCall; } +// async generator function yield inference +async function* asyncGenFuncYieldConstCall() { yield constCall; } +async function* asyncGenFuncYieldLetCall() { yield letCall; } +async function* asyncGenFuncYieldVarCall() { yield varCall; } +// classes +class C { + constructor() { + this.readonlyCall = Symbol(); + this.readwriteCall = Symbol(); + } +} +C.readonlyStaticCall = Symbol(); +C.readonlyStaticTypeAndCall = Symbol(); +C.readwriteStaticCall = Symbol(); +const constInitToCReadonlyStaticCall = C.readonlyStaticCall; +const constInitToCReadonlyStaticType = C.readonlyStaticType; +const constInitToCReadonlyStaticTypeAndCall = C.readonlyStaticTypeAndCall; +const constInitToCReadwriteStaticCall = C.readwriteStaticCall; +const constInitToCReadonlyStaticCallWithTypeQuery = C.readonlyStaticCall; +const constInitToCReadonlyStaticTypeWithTypeQuery = C.readonlyStaticType; +const constInitToCReadonlyStaticTypeAndCallWithTypeQuery = C.readonlyStaticTypeAndCall; +const constInitToCReadwriteStaticCallWithTypeQuery = C.readwriteStaticCall; +const constInitToCReadonlyCall = c.readonlyCall; +const constInitToCReadwriteCall = c.readwriteCall; +const constInitToCReadonlyCallWithTypeQuery = c.readonlyCall; +const constInitToCReadwriteCallWithTypeQuery = c.readwriteCall; +const constInitToCReadonlyCallWithIndexedAccess = c.readonlyCall; +const constInitToCReadwriteCallWithIndexedAccess = c.readwriteCall; +const constInitToIReadonlyType = i.readonlyType; +const constInitToIReadonlyTypeWithTypeQuery = i.readonlyType; +const constInitToIReadonlyTypeWithIndexedAccess = i.readonlyType; +const constInitToLReadonlyType = l.readonlyType; +const constInitToLReadonlyNestedType = l.nested.readonlyNestedType; +const constInitToLReadonlyTypeWithTypeQuery = l.readonlyType; +const constInitToLReadonlyNestedTypeWithTypeQuery = l.nested.readonlyNestedType; +const constInitToLReadonlyTypeWithIndexedAccess = l.readonlyType; +const constInitToLReadonlyNestedTypeWithIndexedAccess = l.nested.readonlyNestedType; +// type argument inference +const promiseForConstCall = Promise.resolve(constCall); +const arrayOfConstCall = [constCall]; +// widening positions +// argument inference +f(s); +f(N.s); +f(N["s"]); +// array literal elements +[s]; +[N.s]; +[N["s"]]; +// property assignments/methods +const o2 = { + a: s, + b: N.s, + c: N["s"], + method1() { return s; }, + async method2() { return s; }, + async *method3() { yield s; }, + *method4() { yield s; }, + method5(p = s) { return p; } +}; +// property initializers +class C0 { + constructor() { + this.a = s; + this.b = N.s; + this.c = N["s"]; + this.d = s; + this.e = N.s; + this.f = N["s"]; + } + method1() { return s; } + async method2() { return s; } + async *method3() { yield s; } + *method4() { yield s; } + method5(p = s) { return p; } +} +C0.a = s; +C0.b = N.s; +C0.c = N["s"]; +C0.d = s; +C0.e = N.s; +C0.f = N["s"]; +// non-widening positions +// element access +o[s]; +o[N.s]; +o[N["s"]]; +// arguments (no-inference) +f(s); +f(N.s); +f(N["s"]); +g(s); +g(N.s); +g(N["s"]); +// falsy expressions +s || ""; +N.s || ""; +N["s"] || ""; +// conditionals +Math.random() * 2 ? s : "a"; +Math.random() * 2 ? N.s : "a"; +Math.random() * 2 ? N["s"] : "a"; +// computed property names +({ + [s]: "a", + [N.s]: "b", +}); +class C1 { +} +const o4 = { + method1() { + return s; // return type should not widen due to contextual type + }, + async method2() { + return s; // return type should not widen due to contextual type + }, + async *method3() { + yield s; // yield type should not widen due to contextual type + }, + *method4() { + yield s; // yield type should not widen due to contextual type + }, + method5(p = s) { + return p; + } +}; + + +//// [uniqueSymbolsDeclarations.d.ts] +declare const constCall: unique symbol; +declare let letCall: symbol; +declare var varCall: symbol; +declare const constType: unique symbol; +declare const constTypeAndCall: unique symbol; +declare const constInitToConstCall: symbol; +declare const constInitToLetCall: symbol; +declare const constInitToVarCall: symbol; +declare const constInitToConstDeclAmbient: symbol; +declare let letInitToConstCall: symbol; +declare let letInitToLetCall: symbol; +declare let letInitToVarCall: symbol; +declare let letInitToConstDeclAmbient: symbol; +declare var varInitToConstCall: symbol; +declare var varInitToLetCall: symbol; +declare var varInitToVarCall: symbol; +declare var varInitToConstDeclAmbient: symbol; +declare const constInitToConstCallWithTypeQuery: typeof constCall; +declare const constInitToConstDeclAmbientWithTypeQuery: typeof constType; +declare function funcReturnConstCall(): symbol; +declare function funcReturnLetCall(): symbol; +declare function funcReturnVarCall(): symbol; +declare function funcReturnConstCallWithTypeQuery(): typeof constCall; +declare function genFuncYieldConstCall(): IterableIterator; +declare function genFuncYieldLetCall(): IterableIterator; +declare function genFuncYieldVarCall(): IterableIterator; +declare function genFuncYieldConstCallWithTypeQuery(): IterableIterator; +declare function asyncFuncReturnConstCall(): Promise; +declare function asyncFuncReturnLetCall(): Promise; +declare function asyncFuncReturnVarCall(): Promise; +declare function asyncGenFuncYieldConstCall(): AsyncIterableIterator; +declare function asyncGenFuncYieldLetCall(): AsyncIterableIterator; +declare function asyncGenFuncYieldVarCall(): AsyncIterableIterator; +declare class C { + static readonly readonlyStaticCall: unique symbol; + static readonly readonlyStaticType: unique symbol; + static readonly readonlyStaticTypeAndCall: unique symbol; + static readwriteStaticCall: symbol; + readonly readonlyCall: symbol; + readwriteCall: symbol; +} +declare const c: C; +declare const constInitToCReadonlyStaticCall: symbol; +declare const constInitToCReadonlyStaticType: symbol; +declare const constInitToCReadonlyStaticTypeAndCall: symbol; +declare const constInitToCReadwriteStaticCall: symbol; +declare const constInitToCReadonlyStaticCallWithTypeQuery: typeof C.readonlyStaticCall; +declare const constInitToCReadonlyStaticTypeWithTypeQuery: typeof C.readonlyStaticType; +declare const constInitToCReadonlyStaticTypeAndCallWithTypeQuery: typeof C.readonlyStaticTypeAndCall; +declare const constInitToCReadwriteStaticCallWithTypeQuery: typeof C.readwriteStaticCall; +declare const constInitToCReadonlyCall: symbol; +declare const constInitToCReadwriteCall: symbol; +declare const constInitToCReadonlyCallWithTypeQuery: typeof c.readonlyCall; +declare const constInitToCReadwriteCallWithTypeQuery: typeof c.readwriteCall; +declare const constInitToCReadonlyCallWithIndexedAccess: C["readonlyCall"]; +declare const constInitToCReadwriteCallWithIndexedAccess: C["readwriteCall"]; +interface I { + readonly readonlyType: unique symbol; +} +declare const i: I; +declare const constInitToIReadonlyType: symbol; +declare const constInitToIReadonlyTypeWithTypeQuery: typeof i.readonlyType; +declare const constInitToIReadonlyTypeWithIndexedAccess: I["readonlyType"]; +declare type L = { + readonly readonlyType: unique symbol; + nested: { + readonly readonlyNestedType: unique symbol; + }; +}; +declare const l: L; +declare const constInitToLReadonlyType: symbol; +declare const constInitToLReadonlyNestedType: symbol; +declare const constInitToLReadonlyTypeWithTypeQuery: typeof l.readonlyType; +declare const constInitToLReadonlyNestedTypeWithTypeQuery: typeof l.nested.readonlyNestedType; +declare const constInitToLReadonlyTypeWithIndexedAccess: L["readonlyType"]; +declare const constInitToLReadonlyNestedTypeWithIndexedAccess: L["nested"]["readonlyNestedType"]; +declare const promiseForConstCall: Promise; +declare const arrayOfConstCall: symbol[]; +declare const s: unique symbol; +declare namespace N { + const s: unique symbol; +} +declare const o: { + [s]: "a"; + [N.s]: "b"; +}; +declare function f(x: T): T; +declare function g(x: typeof s): void; +declare function g(x: typeof N.s): void; +declare const o2: { + a: symbol; + b: symbol; + c: symbol; + method1(): symbol; + method2(): Promise; + method3(): AsyncIterableIterator; + method4(): IterableIterator; + method5(p?: symbol): symbol; +}; +declare class C0 { + static readonly a: symbol; + static readonly b: symbol; + static readonly c: symbol; + static d: symbol; + static e: symbol; + static f: symbol; + readonly a: symbol; + readonly b: symbol; + readonly c: symbol; + d: symbol; + e: symbol; + f: symbol; + method1(): symbol; + method2(): Promise; + method3(): AsyncIterableIterator; + method4(): IterableIterator; + method5(p?: symbol): symbol; +} +declare class C1 { + static [s]: "a"; + static [N.s]: "b"; + [s]: "a"; + [N.s]: "b"; +} +interface Context { + method1(): typeof s; + method2(): Promise; + method3(): AsyncIterableIterator; + method4(): IterableIterator; + method5(p?: typeof s): typeof s; +} +declare const o4: Context; diff --git a/tests/baselines/reference/uniqueSymbolsDeclarations.symbols b/tests/baselines/reference/uniqueSymbolsDeclarations.symbols new file mode 100644 index 0000000000000..ff433aa19d071 --- /dev/null +++ b/tests/baselines/reference/uniqueSymbolsDeclarations.symbols @@ -0,0 +1,788 @@ +=== tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarations.ts === +// declarations with call initializer +const constCall = Symbol(); +>constCall : Symbol(constCall, Decl(uniqueSymbolsDeclarations.ts, 1, 5)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) + +let letCall = Symbol(); +>letCall : Symbol(letCall, Decl(uniqueSymbolsDeclarations.ts, 2, 3)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) + +var varCall = Symbol(); +>varCall : Symbol(varCall, Decl(uniqueSymbolsDeclarations.ts, 3, 3)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) + +// ambient declaration with type +declare const constType: unique symbol; +>constType : Symbol(constType, Decl(uniqueSymbolsDeclarations.ts, 6, 13)) + +// declaration with type and call initializer +const constTypeAndCall: unique symbol = Symbol(); +>constTypeAndCall : Symbol(constTypeAndCall, Decl(uniqueSymbolsDeclarations.ts, 9, 5)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) + +// declaration from initializer +const constInitToConstCall = constCall; +>constInitToConstCall : Symbol(constInitToConstCall, Decl(uniqueSymbolsDeclarations.ts, 12, 5)) +>constCall : Symbol(constCall, Decl(uniqueSymbolsDeclarations.ts, 1, 5)) + +const constInitToLetCall = letCall; +>constInitToLetCall : Symbol(constInitToLetCall, Decl(uniqueSymbolsDeclarations.ts, 13, 5)) +>letCall : Symbol(letCall, Decl(uniqueSymbolsDeclarations.ts, 2, 3)) + +const constInitToVarCall = varCall; +>constInitToVarCall : Symbol(constInitToVarCall, Decl(uniqueSymbolsDeclarations.ts, 14, 5)) +>varCall : Symbol(varCall, Decl(uniqueSymbolsDeclarations.ts, 3, 3)) + +const constInitToConstDeclAmbient = constType; +>constInitToConstDeclAmbient : Symbol(constInitToConstDeclAmbient, Decl(uniqueSymbolsDeclarations.ts, 15, 5)) +>constType : Symbol(constType, Decl(uniqueSymbolsDeclarations.ts, 6, 13)) + +let letInitToConstCall = constCall; +>letInitToConstCall : Symbol(letInitToConstCall, Decl(uniqueSymbolsDeclarations.ts, 16, 3)) +>constCall : Symbol(constCall, Decl(uniqueSymbolsDeclarations.ts, 1, 5)) + +let letInitToLetCall = letCall; +>letInitToLetCall : Symbol(letInitToLetCall, Decl(uniqueSymbolsDeclarations.ts, 17, 3)) +>letCall : Symbol(letCall, Decl(uniqueSymbolsDeclarations.ts, 2, 3)) + +let letInitToVarCall = varCall; +>letInitToVarCall : Symbol(letInitToVarCall, Decl(uniqueSymbolsDeclarations.ts, 18, 3)) +>varCall : Symbol(varCall, Decl(uniqueSymbolsDeclarations.ts, 3, 3)) + +let letInitToConstDeclAmbient = constType; +>letInitToConstDeclAmbient : Symbol(letInitToConstDeclAmbient, Decl(uniqueSymbolsDeclarations.ts, 19, 3)) +>constType : Symbol(constType, Decl(uniqueSymbolsDeclarations.ts, 6, 13)) + +var varInitToConstCall = constCall; +>varInitToConstCall : Symbol(varInitToConstCall, Decl(uniqueSymbolsDeclarations.ts, 20, 3)) +>constCall : Symbol(constCall, Decl(uniqueSymbolsDeclarations.ts, 1, 5)) + +var varInitToLetCall = letCall; +>varInitToLetCall : Symbol(varInitToLetCall, Decl(uniqueSymbolsDeclarations.ts, 21, 3)) +>letCall : Symbol(letCall, Decl(uniqueSymbolsDeclarations.ts, 2, 3)) + +var varInitToVarCall = varCall; +>varInitToVarCall : Symbol(varInitToVarCall, Decl(uniqueSymbolsDeclarations.ts, 22, 3)) +>varCall : Symbol(varCall, Decl(uniqueSymbolsDeclarations.ts, 3, 3)) + +var varInitToConstDeclAmbient = constType; +>varInitToConstDeclAmbient : Symbol(varInitToConstDeclAmbient, Decl(uniqueSymbolsDeclarations.ts, 23, 3)) +>constType : Symbol(constType, Decl(uniqueSymbolsDeclarations.ts, 6, 13)) + +// declaration from initializer with type query +const constInitToConstCallWithTypeQuery: typeof constCall = constCall; +>constInitToConstCallWithTypeQuery : Symbol(constInitToConstCallWithTypeQuery, Decl(uniqueSymbolsDeclarations.ts, 26, 5)) +>constCall : Symbol(constCall, Decl(uniqueSymbolsDeclarations.ts, 1, 5)) +>constCall : Symbol(constCall, Decl(uniqueSymbolsDeclarations.ts, 1, 5)) + +const constInitToConstDeclAmbientWithTypeQuery: typeof constType = constType; +>constInitToConstDeclAmbientWithTypeQuery : Symbol(constInitToConstDeclAmbientWithTypeQuery, Decl(uniqueSymbolsDeclarations.ts, 27, 5)) +>constType : Symbol(constType, Decl(uniqueSymbolsDeclarations.ts, 6, 13)) +>constType : Symbol(constType, Decl(uniqueSymbolsDeclarations.ts, 6, 13)) + +// function return inference +function funcReturnConstCall() { return constCall; } +>funcReturnConstCall : Symbol(funcReturnConstCall, Decl(uniqueSymbolsDeclarations.ts, 27, 77)) +>constCall : Symbol(constCall, Decl(uniqueSymbolsDeclarations.ts, 1, 5)) + +function funcReturnLetCall() { return letCall; } +>funcReturnLetCall : Symbol(funcReturnLetCall, Decl(uniqueSymbolsDeclarations.ts, 30, 52)) +>letCall : Symbol(letCall, Decl(uniqueSymbolsDeclarations.ts, 2, 3)) + +function funcReturnVarCall() { return varCall; } +>funcReturnVarCall : Symbol(funcReturnVarCall, Decl(uniqueSymbolsDeclarations.ts, 31, 48)) +>varCall : Symbol(varCall, Decl(uniqueSymbolsDeclarations.ts, 3, 3)) + +// function return value with type query +function funcReturnConstCallWithTypeQuery(): typeof constCall { return constCall; } +>funcReturnConstCallWithTypeQuery : Symbol(funcReturnConstCallWithTypeQuery, Decl(uniqueSymbolsDeclarations.ts, 32, 48)) +>constCall : Symbol(constCall, Decl(uniqueSymbolsDeclarations.ts, 1, 5)) +>constCall : Symbol(constCall, Decl(uniqueSymbolsDeclarations.ts, 1, 5)) + +// generator function yield inference +function* genFuncYieldConstCall() { yield constCall; } +>genFuncYieldConstCall : Symbol(genFuncYieldConstCall, Decl(uniqueSymbolsDeclarations.ts, 35, 83)) +>constCall : Symbol(constCall, Decl(uniqueSymbolsDeclarations.ts, 1, 5)) + +function* genFuncYieldLetCall() { yield letCall; } +>genFuncYieldLetCall : Symbol(genFuncYieldLetCall, Decl(uniqueSymbolsDeclarations.ts, 38, 54)) +>letCall : Symbol(letCall, Decl(uniqueSymbolsDeclarations.ts, 2, 3)) + +function* genFuncYieldVarCall() { yield varCall; } +>genFuncYieldVarCall : Symbol(genFuncYieldVarCall, Decl(uniqueSymbolsDeclarations.ts, 39, 50)) +>varCall : Symbol(varCall, Decl(uniqueSymbolsDeclarations.ts, 3, 3)) + +// generator function yield with return type query +function* genFuncYieldConstCallWithTypeQuery(): IterableIterator { yield constCall; } +>genFuncYieldConstCallWithTypeQuery : Symbol(genFuncYieldConstCallWithTypeQuery, Decl(uniqueSymbolsDeclarations.ts, 40, 50)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>constCall : Symbol(constCall, Decl(uniqueSymbolsDeclarations.ts, 1, 5)) +>constCall : Symbol(constCall, Decl(uniqueSymbolsDeclarations.ts, 1, 5)) + +// async function return inference +async function asyncFuncReturnConstCall() { return constCall; } +>asyncFuncReturnConstCall : Symbol(asyncFuncReturnConstCall, Decl(uniqueSymbolsDeclarations.ts, 43, 103)) +>constCall : Symbol(constCall, Decl(uniqueSymbolsDeclarations.ts, 1, 5)) + +async function asyncFuncReturnLetCall() { return letCall; } +>asyncFuncReturnLetCall : Symbol(asyncFuncReturnLetCall, Decl(uniqueSymbolsDeclarations.ts, 46, 63)) +>letCall : Symbol(letCall, Decl(uniqueSymbolsDeclarations.ts, 2, 3)) + +async function asyncFuncReturnVarCall() { return varCall; } +>asyncFuncReturnVarCall : Symbol(asyncFuncReturnVarCall, Decl(uniqueSymbolsDeclarations.ts, 47, 59)) +>varCall : Symbol(varCall, Decl(uniqueSymbolsDeclarations.ts, 3, 3)) + +// async generator function yield inference +async function* asyncGenFuncYieldConstCall() { yield constCall; } +>asyncGenFuncYieldConstCall : Symbol(asyncGenFuncYieldConstCall, Decl(uniqueSymbolsDeclarations.ts, 48, 59)) +>constCall : Symbol(constCall, Decl(uniqueSymbolsDeclarations.ts, 1, 5)) + +async function* asyncGenFuncYieldLetCall() { yield letCall; } +>asyncGenFuncYieldLetCall : Symbol(asyncGenFuncYieldLetCall, Decl(uniqueSymbolsDeclarations.ts, 51, 65)) +>letCall : Symbol(letCall, Decl(uniqueSymbolsDeclarations.ts, 2, 3)) + +async function* asyncGenFuncYieldVarCall() { yield varCall; } +>asyncGenFuncYieldVarCall : Symbol(asyncGenFuncYieldVarCall, Decl(uniqueSymbolsDeclarations.ts, 52, 61)) +>varCall : Symbol(varCall, Decl(uniqueSymbolsDeclarations.ts, 3, 3)) + +// classes +class C { +>C : Symbol(C, Decl(uniqueSymbolsDeclarations.ts, 53, 61)) + + static readonly readonlyStaticCall = Symbol(); +>readonlyStaticCall : Symbol(C.readonlyStaticCall, Decl(uniqueSymbolsDeclarations.ts, 56, 9)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) + + static readonly readonlyStaticType: unique symbol; +>readonlyStaticType : Symbol(C.readonlyStaticType, Decl(uniqueSymbolsDeclarations.ts, 57, 50)) + + static readonly readonlyStaticTypeAndCall: unique symbol = Symbol(); +>readonlyStaticTypeAndCall : Symbol(C.readonlyStaticTypeAndCall, Decl(uniqueSymbolsDeclarations.ts, 58, 54)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) + + static readwriteStaticCall = Symbol(); +>readwriteStaticCall : Symbol(C.readwriteStaticCall, Decl(uniqueSymbolsDeclarations.ts, 59, 72)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) + + readonly readonlyCall = Symbol(); +>readonlyCall : Symbol(C.readonlyCall, Decl(uniqueSymbolsDeclarations.ts, 60, 42)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) + + readwriteCall = Symbol(); +>readwriteCall : Symbol(C.readwriteCall, Decl(uniqueSymbolsDeclarations.ts, 62, 37)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +} +declare const c: C; +>c : Symbol(c, Decl(uniqueSymbolsDeclarations.ts, 65, 13)) +>C : Symbol(C, Decl(uniqueSymbolsDeclarations.ts, 53, 61)) + +const constInitToCReadonlyStaticCall = C.readonlyStaticCall; +>constInitToCReadonlyStaticCall : Symbol(constInitToCReadonlyStaticCall, Decl(uniqueSymbolsDeclarations.ts, 67, 5)) +>C.readonlyStaticCall : Symbol(C.readonlyStaticCall, Decl(uniqueSymbolsDeclarations.ts, 56, 9)) +>C : Symbol(C, Decl(uniqueSymbolsDeclarations.ts, 53, 61)) +>readonlyStaticCall : Symbol(C.readonlyStaticCall, Decl(uniqueSymbolsDeclarations.ts, 56, 9)) + +const constInitToCReadonlyStaticType = C.readonlyStaticType; +>constInitToCReadonlyStaticType : Symbol(constInitToCReadonlyStaticType, Decl(uniqueSymbolsDeclarations.ts, 68, 5)) +>C.readonlyStaticType : Symbol(C.readonlyStaticType, Decl(uniqueSymbolsDeclarations.ts, 57, 50)) +>C : Symbol(C, Decl(uniqueSymbolsDeclarations.ts, 53, 61)) +>readonlyStaticType : Symbol(C.readonlyStaticType, Decl(uniqueSymbolsDeclarations.ts, 57, 50)) + +const constInitToCReadonlyStaticTypeAndCall = C.readonlyStaticTypeAndCall; +>constInitToCReadonlyStaticTypeAndCall : Symbol(constInitToCReadonlyStaticTypeAndCall, Decl(uniqueSymbolsDeclarations.ts, 69, 5)) +>C.readonlyStaticTypeAndCall : Symbol(C.readonlyStaticTypeAndCall, Decl(uniqueSymbolsDeclarations.ts, 58, 54)) +>C : Symbol(C, Decl(uniqueSymbolsDeclarations.ts, 53, 61)) +>readonlyStaticTypeAndCall : Symbol(C.readonlyStaticTypeAndCall, Decl(uniqueSymbolsDeclarations.ts, 58, 54)) + +const constInitToCReadwriteStaticCall = C.readwriteStaticCall; +>constInitToCReadwriteStaticCall : Symbol(constInitToCReadwriteStaticCall, Decl(uniqueSymbolsDeclarations.ts, 70, 5)) +>C.readwriteStaticCall : Symbol(C.readwriteStaticCall, Decl(uniqueSymbolsDeclarations.ts, 59, 72)) +>C : Symbol(C, Decl(uniqueSymbolsDeclarations.ts, 53, 61)) +>readwriteStaticCall : Symbol(C.readwriteStaticCall, Decl(uniqueSymbolsDeclarations.ts, 59, 72)) + +const constInitToCReadonlyStaticCallWithTypeQuery: typeof C.readonlyStaticCall = C.readonlyStaticCall; +>constInitToCReadonlyStaticCallWithTypeQuery : Symbol(constInitToCReadonlyStaticCallWithTypeQuery, Decl(uniqueSymbolsDeclarations.ts, 72, 5)) +>C.readonlyStaticCall : Symbol(C.readonlyStaticCall, Decl(uniqueSymbolsDeclarations.ts, 56, 9)) +>C : Symbol(C, Decl(uniqueSymbolsDeclarations.ts, 53, 61)) +>readonlyStaticCall : Symbol(C.readonlyStaticCall, Decl(uniqueSymbolsDeclarations.ts, 56, 9)) +>C.readonlyStaticCall : Symbol(C.readonlyStaticCall, Decl(uniqueSymbolsDeclarations.ts, 56, 9)) +>C : Symbol(C, Decl(uniqueSymbolsDeclarations.ts, 53, 61)) +>readonlyStaticCall : Symbol(C.readonlyStaticCall, Decl(uniqueSymbolsDeclarations.ts, 56, 9)) + +const constInitToCReadonlyStaticTypeWithTypeQuery: typeof C.readonlyStaticType = C.readonlyStaticType; +>constInitToCReadonlyStaticTypeWithTypeQuery : Symbol(constInitToCReadonlyStaticTypeWithTypeQuery, Decl(uniqueSymbolsDeclarations.ts, 73, 5)) +>C.readonlyStaticType : Symbol(C.readonlyStaticType, Decl(uniqueSymbolsDeclarations.ts, 57, 50)) +>C : Symbol(C, Decl(uniqueSymbolsDeclarations.ts, 53, 61)) +>readonlyStaticType : Symbol(C.readonlyStaticType, Decl(uniqueSymbolsDeclarations.ts, 57, 50)) +>C.readonlyStaticType : Symbol(C.readonlyStaticType, Decl(uniqueSymbolsDeclarations.ts, 57, 50)) +>C : Symbol(C, Decl(uniqueSymbolsDeclarations.ts, 53, 61)) +>readonlyStaticType : Symbol(C.readonlyStaticType, Decl(uniqueSymbolsDeclarations.ts, 57, 50)) + +const constInitToCReadonlyStaticTypeAndCallWithTypeQuery: typeof C.readonlyStaticTypeAndCall = C.readonlyStaticTypeAndCall; +>constInitToCReadonlyStaticTypeAndCallWithTypeQuery : Symbol(constInitToCReadonlyStaticTypeAndCallWithTypeQuery, Decl(uniqueSymbolsDeclarations.ts, 74, 5)) +>C.readonlyStaticTypeAndCall : Symbol(C.readonlyStaticTypeAndCall, Decl(uniqueSymbolsDeclarations.ts, 58, 54)) +>C : Symbol(C, Decl(uniqueSymbolsDeclarations.ts, 53, 61)) +>readonlyStaticTypeAndCall : Symbol(C.readonlyStaticTypeAndCall, Decl(uniqueSymbolsDeclarations.ts, 58, 54)) +>C.readonlyStaticTypeAndCall : Symbol(C.readonlyStaticTypeAndCall, Decl(uniqueSymbolsDeclarations.ts, 58, 54)) +>C : Symbol(C, Decl(uniqueSymbolsDeclarations.ts, 53, 61)) +>readonlyStaticTypeAndCall : Symbol(C.readonlyStaticTypeAndCall, Decl(uniqueSymbolsDeclarations.ts, 58, 54)) + +const constInitToCReadwriteStaticCallWithTypeQuery: typeof C.readwriteStaticCall = C.readwriteStaticCall; +>constInitToCReadwriteStaticCallWithTypeQuery : Symbol(constInitToCReadwriteStaticCallWithTypeQuery, Decl(uniqueSymbolsDeclarations.ts, 75, 5)) +>C.readwriteStaticCall : Symbol(C.readwriteStaticCall, Decl(uniqueSymbolsDeclarations.ts, 59, 72)) +>C : Symbol(C, Decl(uniqueSymbolsDeclarations.ts, 53, 61)) +>readwriteStaticCall : Symbol(C.readwriteStaticCall, Decl(uniqueSymbolsDeclarations.ts, 59, 72)) +>C.readwriteStaticCall : Symbol(C.readwriteStaticCall, Decl(uniqueSymbolsDeclarations.ts, 59, 72)) +>C : Symbol(C, Decl(uniqueSymbolsDeclarations.ts, 53, 61)) +>readwriteStaticCall : Symbol(C.readwriteStaticCall, Decl(uniqueSymbolsDeclarations.ts, 59, 72)) + +const constInitToCReadonlyCall = c.readonlyCall; +>constInitToCReadonlyCall : Symbol(constInitToCReadonlyCall, Decl(uniqueSymbolsDeclarations.ts, 77, 5)) +>c.readonlyCall : Symbol(C.readonlyCall, Decl(uniqueSymbolsDeclarations.ts, 60, 42)) +>c : Symbol(c, Decl(uniqueSymbolsDeclarations.ts, 65, 13)) +>readonlyCall : Symbol(C.readonlyCall, Decl(uniqueSymbolsDeclarations.ts, 60, 42)) + +const constInitToCReadwriteCall = c.readwriteCall; +>constInitToCReadwriteCall : Symbol(constInitToCReadwriteCall, Decl(uniqueSymbolsDeclarations.ts, 78, 5)) +>c.readwriteCall : Symbol(C.readwriteCall, Decl(uniqueSymbolsDeclarations.ts, 62, 37)) +>c : Symbol(c, Decl(uniqueSymbolsDeclarations.ts, 65, 13)) +>readwriteCall : Symbol(C.readwriteCall, Decl(uniqueSymbolsDeclarations.ts, 62, 37)) + +const constInitToCReadonlyCallWithTypeQuery: typeof c.readonlyCall = c.readonlyCall; +>constInitToCReadonlyCallWithTypeQuery : Symbol(constInitToCReadonlyCallWithTypeQuery, Decl(uniqueSymbolsDeclarations.ts, 79, 5)) +>c.readonlyCall : Symbol(C.readonlyCall, Decl(uniqueSymbolsDeclarations.ts, 60, 42)) +>c : Symbol(c, Decl(uniqueSymbolsDeclarations.ts, 65, 13)) +>readonlyCall : Symbol(C.readonlyCall, Decl(uniqueSymbolsDeclarations.ts, 60, 42)) +>c.readonlyCall : Symbol(C.readonlyCall, Decl(uniqueSymbolsDeclarations.ts, 60, 42)) +>c : Symbol(c, Decl(uniqueSymbolsDeclarations.ts, 65, 13)) +>readonlyCall : Symbol(C.readonlyCall, Decl(uniqueSymbolsDeclarations.ts, 60, 42)) + +const constInitToCReadwriteCallWithTypeQuery: typeof c.readwriteCall = c.readwriteCall; +>constInitToCReadwriteCallWithTypeQuery : Symbol(constInitToCReadwriteCallWithTypeQuery, Decl(uniqueSymbolsDeclarations.ts, 80, 5)) +>c.readwriteCall : Symbol(C.readwriteCall, Decl(uniqueSymbolsDeclarations.ts, 62, 37)) +>c : Symbol(c, Decl(uniqueSymbolsDeclarations.ts, 65, 13)) +>readwriteCall : Symbol(C.readwriteCall, Decl(uniqueSymbolsDeclarations.ts, 62, 37)) +>c.readwriteCall : Symbol(C.readwriteCall, Decl(uniqueSymbolsDeclarations.ts, 62, 37)) +>c : Symbol(c, Decl(uniqueSymbolsDeclarations.ts, 65, 13)) +>readwriteCall : Symbol(C.readwriteCall, Decl(uniqueSymbolsDeclarations.ts, 62, 37)) + +const constInitToCReadonlyCallWithIndexedAccess: C["readonlyCall"] = c.readonlyCall; +>constInitToCReadonlyCallWithIndexedAccess : Symbol(constInitToCReadonlyCallWithIndexedAccess, Decl(uniqueSymbolsDeclarations.ts, 81, 5)) +>C : Symbol(C, Decl(uniqueSymbolsDeclarations.ts, 53, 61)) +>c.readonlyCall : Symbol(C.readonlyCall, Decl(uniqueSymbolsDeclarations.ts, 60, 42)) +>c : Symbol(c, Decl(uniqueSymbolsDeclarations.ts, 65, 13)) +>readonlyCall : Symbol(C.readonlyCall, Decl(uniqueSymbolsDeclarations.ts, 60, 42)) + +const constInitToCReadwriteCallWithIndexedAccess: C["readwriteCall"] = c.readwriteCall; +>constInitToCReadwriteCallWithIndexedAccess : Symbol(constInitToCReadwriteCallWithIndexedAccess, Decl(uniqueSymbolsDeclarations.ts, 82, 5)) +>C : Symbol(C, Decl(uniqueSymbolsDeclarations.ts, 53, 61)) +>c.readwriteCall : Symbol(C.readwriteCall, Decl(uniqueSymbolsDeclarations.ts, 62, 37)) +>c : Symbol(c, Decl(uniqueSymbolsDeclarations.ts, 65, 13)) +>readwriteCall : Symbol(C.readwriteCall, Decl(uniqueSymbolsDeclarations.ts, 62, 37)) + +// interfaces +interface I { +>I : Symbol(I, Decl(uniqueSymbolsDeclarations.ts, 82, 87)) + + readonly readonlyType: unique symbol; +>readonlyType : Symbol(I.readonlyType, Decl(uniqueSymbolsDeclarations.ts, 85, 13)) +} +declare const i: I; +>i : Symbol(i, Decl(uniqueSymbolsDeclarations.ts, 88, 13)) +>I : Symbol(I, Decl(uniqueSymbolsDeclarations.ts, 82, 87)) + +const constInitToIReadonlyType = i.readonlyType; +>constInitToIReadonlyType : Symbol(constInitToIReadonlyType, Decl(uniqueSymbolsDeclarations.ts, 90, 5)) +>i.readonlyType : Symbol(I.readonlyType, Decl(uniqueSymbolsDeclarations.ts, 85, 13)) +>i : Symbol(i, Decl(uniqueSymbolsDeclarations.ts, 88, 13)) +>readonlyType : Symbol(I.readonlyType, Decl(uniqueSymbolsDeclarations.ts, 85, 13)) + +const constInitToIReadonlyTypeWithTypeQuery: typeof i.readonlyType = i.readonlyType; +>constInitToIReadonlyTypeWithTypeQuery : Symbol(constInitToIReadonlyTypeWithTypeQuery, Decl(uniqueSymbolsDeclarations.ts, 91, 5)) +>i.readonlyType : Symbol(I.readonlyType, Decl(uniqueSymbolsDeclarations.ts, 85, 13)) +>i : Symbol(i, Decl(uniqueSymbolsDeclarations.ts, 88, 13)) +>readonlyType : Symbol(I.readonlyType, Decl(uniqueSymbolsDeclarations.ts, 85, 13)) +>i.readonlyType : Symbol(I.readonlyType, Decl(uniqueSymbolsDeclarations.ts, 85, 13)) +>i : Symbol(i, Decl(uniqueSymbolsDeclarations.ts, 88, 13)) +>readonlyType : Symbol(I.readonlyType, Decl(uniqueSymbolsDeclarations.ts, 85, 13)) + +const constInitToIReadonlyTypeWithIndexedAccess: I["readonlyType"] = i.readonlyType; +>constInitToIReadonlyTypeWithIndexedAccess : Symbol(constInitToIReadonlyTypeWithIndexedAccess, Decl(uniqueSymbolsDeclarations.ts, 92, 5)) +>I : Symbol(I, Decl(uniqueSymbolsDeclarations.ts, 82, 87)) +>i.readonlyType : Symbol(I.readonlyType, Decl(uniqueSymbolsDeclarations.ts, 85, 13)) +>i : Symbol(i, Decl(uniqueSymbolsDeclarations.ts, 88, 13)) +>readonlyType : Symbol(I.readonlyType, Decl(uniqueSymbolsDeclarations.ts, 85, 13)) + +// type literals +type L = { +>L : Symbol(L, Decl(uniqueSymbolsDeclarations.ts, 92, 84)) + + readonly readonlyType: unique symbol; +>readonlyType : Symbol(readonlyType, Decl(uniqueSymbolsDeclarations.ts, 95, 10)) + + nested: { +>nested : Symbol(nested, Decl(uniqueSymbolsDeclarations.ts, 96, 41)) + + readonly readonlyNestedType: unique symbol; +>readonlyNestedType : Symbol(readonlyNestedType, Decl(uniqueSymbolsDeclarations.ts, 97, 13)) + } +}; +declare const l: L; +>l : Symbol(l, Decl(uniqueSymbolsDeclarations.ts, 101, 13)) +>L : Symbol(L, Decl(uniqueSymbolsDeclarations.ts, 92, 84)) + +const constInitToLReadonlyType = l.readonlyType; +>constInitToLReadonlyType : Symbol(constInitToLReadonlyType, Decl(uniqueSymbolsDeclarations.ts, 103, 5)) +>l.readonlyType : Symbol(readonlyType, Decl(uniqueSymbolsDeclarations.ts, 95, 10)) +>l : Symbol(l, Decl(uniqueSymbolsDeclarations.ts, 101, 13)) +>readonlyType : Symbol(readonlyType, Decl(uniqueSymbolsDeclarations.ts, 95, 10)) + +const constInitToLReadonlyNestedType = l.nested.readonlyNestedType; +>constInitToLReadonlyNestedType : Symbol(constInitToLReadonlyNestedType, Decl(uniqueSymbolsDeclarations.ts, 104, 5)) +>l.nested.readonlyNestedType : Symbol(readonlyNestedType, Decl(uniqueSymbolsDeclarations.ts, 97, 13)) +>l.nested : Symbol(nested, Decl(uniqueSymbolsDeclarations.ts, 96, 41)) +>l : Symbol(l, Decl(uniqueSymbolsDeclarations.ts, 101, 13)) +>nested : Symbol(nested, Decl(uniqueSymbolsDeclarations.ts, 96, 41)) +>readonlyNestedType : Symbol(readonlyNestedType, Decl(uniqueSymbolsDeclarations.ts, 97, 13)) + +const constInitToLReadonlyTypeWithTypeQuery: typeof l.readonlyType = l.readonlyType; +>constInitToLReadonlyTypeWithTypeQuery : Symbol(constInitToLReadonlyTypeWithTypeQuery, Decl(uniqueSymbolsDeclarations.ts, 105, 5)) +>l.readonlyType : Symbol(readonlyType, Decl(uniqueSymbolsDeclarations.ts, 95, 10)) +>l : Symbol(l, Decl(uniqueSymbolsDeclarations.ts, 101, 13)) +>readonlyType : Symbol(readonlyType, Decl(uniqueSymbolsDeclarations.ts, 95, 10)) +>l.readonlyType : Symbol(readonlyType, Decl(uniqueSymbolsDeclarations.ts, 95, 10)) +>l : Symbol(l, Decl(uniqueSymbolsDeclarations.ts, 101, 13)) +>readonlyType : Symbol(readonlyType, Decl(uniqueSymbolsDeclarations.ts, 95, 10)) + +const constInitToLReadonlyNestedTypeWithTypeQuery: typeof l.nested.readonlyNestedType = l.nested.readonlyNestedType; +>constInitToLReadonlyNestedTypeWithTypeQuery : Symbol(constInitToLReadonlyNestedTypeWithTypeQuery, Decl(uniqueSymbolsDeclarations.ts, 106, 5)) +>l.nested.readonlyNestedType : Symbol(readonlyNestedType, Decl(uniqueSymbolsDeclarations.ts, 97, 13)) +>l.nested : Symbol(nested, Decl(uniqueSymbolsDeclarations.ts, 96, 41)) +>l : Symbol(l, Decl(uniqueSymbolsDeclarations.ts, 101, 13)) +>nested : Symbol(nested, Decl(uniqueSymbolsDeclarations.ts, 96, 41)) +>readonlyNestedType : Symbol(readonlyNestedType, Decl(uniqueSymbolsDeclarations.ts, 97, 13)) +>l.nested.readonlyNestedType : Symbol(readonlyNestedType, Decl(uniqueSymbolsDeclarations.ts, 97, 13)) +>l.nested : Symbol(nested, Decl(uniqueSymbolsDeclarations.ts, 96, 41)) +>l : Symbol(l, Decl(uniqueSymbolsDeclarations.ts, 101, 13)) +>nested : Symbol(nested, Decl(uniqueSymbolsDeclarations.ts, 96, 41)) +>readonlyNestedType : Symbol(readonlyNestedType, Decl(uniqueSymbolsDeclarations.ts, 97, 13)) + +const constInitToLReadonlyTypeWithIndexedAccess: L["readonlyType"] = l.readonlyType; +>constInitToLReadonlyTypeWithIndexedAccess : Symbol(constInitToLReadonlyTypeWithIndexedAccess, Decl(uniqueSymbolsDeclarations.ts, 107, 5)) +>L : Symbol(L, Decl(uniqueSymbolsDeclarations.ts, 92, 84)) +>l.readonlyType : Symbol(readonlyType, Decl(uniqueSymbolsDeclarations.ts, 95, 10)) +>l : Symbol(l, Decl(uniqueSymbolsDeclarations.ts, 101, 13)) +>readonlyType : Symbol(readonlyType, Decl(uniqueSymbolsDeclarations.ts, 95, 10)) + +const constInitToLReadonlyNestedTypeWithIndexedAccess: L["nested"]["readonlyNestedType"] = l.nested.readonlyNestedType; +>constInitToLReadonlyNestedTypeWithIndexedAccess : Symbol(constInitToLReadonlyNestedTypeWithIndexedAccess, Decl(uniqueSymbolsDeclarations.ts, 108, 5)) +>L : Symbol(L, Decl(uniqueSymbolsDeclarations.ts, 92, 84)) +>l.nested.readonlyNestedType : Symbol(readonlyNestedType, Decl(uniqueSymbolsDeclarations.ts, 97, 13)) +>l.nested : Symbol(nested, Decl(uniqueSymbolsDeclarations.ts, 96, 41)) +>l : Symbol(l, Decl(uniqueSymbolsDeclarations.ts, 101, 13)) +>nested : Symbol(nested, Decl(uniqueSymbolsDeclarations.ts, 96, 41)) +>readonlyNestedType : Symbol(readonlyNestedType, Decl(uniqueSymbolsDeclarations.ts, 97, 13)) + +// type argument inference +const promiseForConstCall = Promise.resolve(constCall); +>promiseForConstCall : Symbol(promiseForConstCall, Decl(uniqueSymbolsDeclarations.ts, 111, 5)) +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>constCall : Symbol(constCall, Decl(uniqueSymbolsDeclarations.ts, 1, 5)) + +const arrayOfConstCall = [constCall]; +>arrayOfConstCall : Symbol(arrayOfConstCall, Decl(uniqueSymbolsDeclarations.ts, 112, 5)) +>constCall : Symbol(constCall, Decl(uniqueSymbolsDeclarations.ts, 1, 5)) + +// unique symbol widening in expressions +declare const s: unique symbol; +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) + +declare namespace N { const s: unique symbol; } +>N : Symbol(N, Decl(uniqueSymbolsDeclarations.ts, 115, 31)) +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) + +declare const o: { [s]: "a", [N.s]: "b" }; +>o : Symbol(o, Decl(uniqueSymbolsDeclarations.ts, 117, 13)) +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) +>N.s : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbolsDeclarations.ts, 115, 31)) +>s : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) + +declare function f(x: T): T; +>f : Symbol(f, Decl(uniqueSymbolsDeclarations.ts, 117, 42)) +>T : Symbol(T, Decl(uniqueSymbolsDeclarations.ts, 118, 19)) +>x : Symbol(x, Decl(uniqueSymbolsDeclarations.ts, 118, 22)) +>T : Symbol(T, Decl(uniqueSymbolsDeclarations.ts, 118, 19)) +>T : Symbol(T, Decl(uniqueSymbolsDeclarations.ts, 118, 19)) + +declare function g(x: typeof s): void; +>g : Symbol(g, Decl(uniqueSymbolsDeclarations.ts, 118, 31), Decl(uniqueSymbolsDeclarations.ts, 119, 38)) +>x : Symbol(x, Decl(uniqueSymbolsDeclarations.ts, 119, 19)) +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) + +declare function g(x: typeof N.s): void; +>g : Symbol(g, Decl(uniqueSymbolsDeclarations.ts, 118, 31), Decl(uniqueSymbolsDeclarations.ts, 119, 38)) +>x : Symbol(x, Decl(uniqueSymbolsDeclarations.ts, 120, 19)) +>N.s : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbolsDeclarations.ts, 115, 31)) +>s : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) + +// widening positions + +// argument inference +f(s); +>f : Symbol(f, Decl(uniqueSymbolsDeclarations.ts, 117, 42)) +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) + +f(N.s); +>f : Symbol(f, Decl(uniqueSymbolsDeclarations.ts, 117, 42)) +>N.s : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbolsDeclarations.ts, 115, 31)) +>s : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) + +f(N["s"]); +>f : Symbol(f, Decl(uniqueSymbolsDeclarations.ts, 117, 42)) +>N : Symbol(N, Decl(uniqueSymbolsDeclarations.ts, 115, 31)) +>"s" : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) + +// array literal elements +[s]; +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) + +[N.s]; +>N.s : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbolsDeclarations.ts, 115, 31)) +>s : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) + +[N["s"]]; +>N : Symbol(N, Decl(uniqueSymbolsDeclarations.ts, 115, 31)) +>"s" : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) + +// property assignments/methods +const o2 = { +>o2 : Symbol(o2, Decl(uniqueSymbolsDeclarations.ts, 135, 5)) + + a: s, +>a : Symbol(a, Decl(uniqueSymbolsDeclarations.ts, 135, 12)) +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) + + b: N.s, +>b : Symbol(b, Decl(uniqueSymbolsDeclarations.ts, 136, 9)) +>N.s : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbolsDeclarations.ts, 115, 31)) +>s : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) + + c: N["s"], +>c : Symbol(c, Decl(uniqueSymbolsDeclarations.ts, 137, 11)) +>N : Symbol(N, Decl(uniqueSymbolsDeclarations.ts, 115, 31)) +>"s" : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) + + method1() { return s; }, +>method1 : Symbol(method1, Decl(uniqueSymbolsDeclarations.ts, 138, 14)) +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) + + async method2() { return s; }, +>method2 : Symbol(method2, Decl(uniqueSymbolsDeclarations.ts, 140, 28)) +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) + + async * method3() { yield s; }, +>method3 : Symbol(method3, Decl(uniqueSymbolsDeclarations.ts, 141, 34)) +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) + + * method4() { yield s; }, +>method4 : Symbol(method4, Decl(uniqueSymbolsDeclarations.ts, 142, 35)) +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) + + method5(p = s) { return p; } +>method5 : Symbol(method5, Decl(uniqueSymbolsDeclarations.ts, 143, 29)) +>p : Symbol(p, Decl(uniqueSymbolsDeclarations.ts, 144, 12)) +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) +>p : Symbol(p, Decl(uniqueSymbolsDeclarations.ts, 144, 12)) + +}; + +// property initializers +class C0 { +>C0 : Symbol(C0, Decl(uniqueSymbolsDeclarations.ts, 145, 2)) + + static readonly a = s; +>a : Symbol(C0.a, Decl(uniqueSymbolsDeclarations.ts, 148, 10)) +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) + + static readonly b = N.s; +>b : Symbol(C0.b, Decl(uniqueSymbolsDeclarations.ts, 149, 26)) +>N.s : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbolsDeclarations.ts, 115, 31)) +>s : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) + + static readonly c = N["s"]; +>c : Symbol(C0.c, Decl(uniqueSymbolsDeclarations.ts, 150, 28)) +>N : Symbol(N, Decl(uniqueSymbolsDeclarations.ts, 115, 31)) +>"s" : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) + + static d = s; +>d : Symbol(C0.d, Decl(uniqueSymbolsDeclarations.ts, 151, 31)) +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) + + static e = N.s; +>e : Symbol(C0.e, Decl(uniqueSymbolsDeclarations.ts, 153, 17)) +>N.s : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbolsDeclarations.ts, 115, 31)) +>s : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) + + static f = N["s"]; +>f : Symbol(C0.f, Decl(uniqueSymbolsDeclarations.ts, 154, 19)) +>N : Symbol(N, Decl(uniqueSymbolsDeclarations.ts, 115, 31)) +>"s" : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) + + readonly a = s; +>a : Symbol(C0.a, Decl(uniqueSymbolsDeclarations.ts, 155, 22)) +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) + + readonly b = N.s; +>b : Symbol(C0.b, Decl(uniqueSymbolsDeclarations.ts, 157, 19)) +>N.s : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbolsDeclarations.ts, 115, 31)) +>s : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) + + readonly c = N["s"]; +>c : Symbol(C0.c, Decl(uniqueSymbolsDeclarations.ts, 158, 21)) +>N : Symbol(N, Decl(uniqueSymbolsDeclarations.ts, 115, 31)) +>"s" : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) + + d = s; +>d : Symbol(C0.d, Decl(uniqueSymbolsDeclarations.ts, 159, 24)) +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) + + e = N.s; +>e : Symbol(C0.e, Decl(uniqueSymbolsDeclarations.ts, 161, 10)) +>N.s : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbolsDeclarations.ts, 115, 31)) +>s : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) + + f = N["s"]; +>f : Symbol(C0.f, Decl(uniqueSymbolsDeclarations.ts, 162, 12)) +>N : Symbol(N, Decl(uniqueSymbolsDeclarations.ts, 115, 31)) +>"s" : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) + + method1() { return s; } +>method1 : Symbol(C0.method1, Decl(uniqueSymbolsDeclarations.ts, 163, 15)) +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) + + async method2() { return s; } +>method2 : Symbol(C0.method2, Decl(uniqueSymbolsDeclarations.ts, 165, 27)) +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) + + async * method3() { yield s; } +>method3 : Symbol(C0.method3, Decl(uniqueSymbolsDeclarations.ts, 166, 33)) +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) + + * method4() { yield s; } +>method4 : Symbol(C0.method4, Decl(uniqueSymbolsDeclarations.ts, 167, 34)) +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) + + method5(p = s) { return p; } +>method5 : Symbol(C0.method5, Decl(uniqueSymbolsDeclarations.ts, 168, 28)) +>p : Symbol(p, Decl(uniqueSymbolsDeclarations.ts, 169, 12)) +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) +>p : Symbol(p, Decl(uniqueSymbolsDeclarations.ts, 169, 12)) +} + +// non-widening positions + +// element access +o[s]; +>o : Symbol(o, Decl(uniqueSymbolsDeclarations.ts, 117, 13)) +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) + +o[N.s]; +>o : Symbol(o, Decl(uniqueSymbolsDeclarations.ts, 117, 13)) +>N.s : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbolsDeclarations.ts, 115, 31)) +>s : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) + +o[N["s"]]; +>o : Symbol(o, Decl(uniqueSymbolsDeclarations.ts, 117, 13)) +>N : Symbol(N, Decl(uniqueSymbolsDeclarations.ts, 115, 31)) +>"s" : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) + +// arguments (no-inference) +f(s); +>f : Symbol(f, Decl(uniqueSymbolsDeclarations.ts, 117, 42)) +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) + +f(N.s); +>f : Symbol(f, Decl(uniqueSymbolsDeclarations.ts, 117, 42)) +>N.s : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbolsDeclarations.ts, 115, 31)) +>s : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) +>N.s : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbolsDeclarations.ts, 115, 31)) +>s : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) + +f(N["s"]); +>f : Symbol(f, Decl(uniqueSymbolsDeclarations.ts, 117, 42)) +>N.s : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbolsDeclarations.ts, 115, 31)) +>s : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbolsDeclarations.ts, 115, 31)) +>"s" : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) + +g(s); +>g : Symbol(g, Decl(uniqueSymbolsDeclarations.ts, 118, 31), Decl(uniqueSymbolsDeclarations.ts, 119, 38)) +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) + +g(N.s); +>g : Symbol(g, Decl(uniqueSymbolsDeclarations.ts, 118, 31), Decl(uniqueSymbolsDeclarations.ts, 119, 38)) +>N.s : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbolsDeclarations.ts, 115, 31)) +>s : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) + +g(N["s"]); +>g : Symbol(g, Decl(uniqueSymbolsDeclarations.ts, 118, 31), Decl(uniqueSymbolsDeclarations.ts, 119, 38)) +>N : Symbol(N, Decl(uniqueSymbolsDeclarations.ts, 115, 31)) +>"s" : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) + +// falsy expressions +s || ""; +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) + +N.s || ""; +>N.s : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbolsDeclarations.ts, 115, 31)) +>s : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) + +N["s"] || ""; +>N : Symbol(N, Decl(uniqueSymbolsDeclarations.ts, 115, 31)) +>"s" : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) + +// conditionals +Math.random() * 2 ? s : "a"; +>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) + +Math.random() * 2 ? N.s : "a"; +>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) +>N.s : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbolsDeclarations.ts, 115, 31)) +>s : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) + +Math.random() * 2 ? N["s"] : "a"; +>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) +>N : Symbol(N, Decl(uniqueSymbolsDeclarations.ts, 115, 31)) +>"s" : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) + +// computed property names +({ + [s]: "a", +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) + + [N.s]: "b", +>N.s : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbolsDeclarations.ts, 115, 31)) +>s : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) + +}); + +class C1 { +>C1 : Symbol(C1, Decl(uniqueSymbolsDeclarations.ts, 201, 3)) + + static [s]: "a"; +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) + + static [N.s]: "b"; +>N.s : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbolsDeclarations.ts, 115, 31)) +>s : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) + + [s]: "a"; +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) + + [N.s]: "b"; +>N.s : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) +>N : Symbol(N, Decl(uniqueSymbolsDeclarations.ts, 115, 31)) +>s : Symbol(N.s, Decl(uniqueSymbolsDeclarations.ts, 116, 27)) +} + +// contextual types + +interface Context { +>Context : Symbol(Context, Decl(uniqueSymbolsDeclarations.ts, 209, 1)) + + method1(): typeof s; +>method1 : Symbol(Context.method1, Decl(uniqueSymbolsDeclarations.ts, 213, 19)) +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) + + method2(): Promise; +>method2 : Symbol(Context.method2, Decl(uniqueSymbolsDeclarations.ts, 214, 24)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) + + method3(): AsyncIterableIterator; +>method3 : Symbol(Context.method3, Decl(uniqueSymbolsDeclarations.ts, 215, 33)) +>AsyncIterableIterator : Symbol(AsyncIterableIterator, Decl(lib.esnext.asynciterable.d.ts, --, --)) +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) + + method4(): IterableIterator; +>method4 : Symbol(Context.method4, Decl(uniqueSymbolsDeclarations.ts, 216, 47)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.es2015.iterable.d.ts, --, --)) +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) + + method5(p?: typeof s): typeof s; +>method5 : Symbol(Context.method5, Decl(uniqueSymbolsDeclarations.ts, 217, 42)) +>p : Symbol(p, Decl(uniqueSymbolsDeclarations.ts, 218, 12)) +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) +} + +const o4: Context = { +>o4 : Symbol(o4, Decl(uniqueSymbolsDeclarations.ts, 221, 5)) +>Context : Symbol(Context, Decl(uniqueSymbolsDeclarations.ts, 209, 1)) + + method1() { +>method1 : Symbol(method1, Decl(uniqueSymbolsDeclarations.ts, 221, 21)) + + return s; // return type should not widen due to contextual type +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) + + }, + async method2() { +>method2 : Symbol(method2, Decl(uniqueSymbolsDeclarations.ts, 224, 6)) + + return s; // return type should not widen due to contextual type +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) + + }, + async * method3() { +>method3 : Symbol(method3, Decl(uniqueSymbolsDeclarations.ts, 227, 6)) + + yield s; // yield type should not widen due to contextual type +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) + + }, + * method4() { +>method4 : Symbol(method4, Decl(uniqueSymbolsDeclarations.ts, 230, 6)) + + yield s; // yield type should not widen due to contextual type +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) + + }, + method5(p = s) { // parameter should not widen due to contextual type +>method5 : Symbol(method5, Decl(uniqueSymbolsDeclarations.ts, 233, 6)) +>p : Symbol(p, Decl(uniqueSymbolsDeclarations.ts, 234, 12)) +>s : Symbol(s, Decl(uniqueSymbolsDeclarations.ts, 115, 13)) + + return p; +>p : Symbol(p, Decl(uniqueSymbolsDeclarations.ts, 234, 12)) + } +}; diff --git a/tests/baselines/reference/uniqueSymbolsDeclarations.types b/tests/baselines/reference/uniqueSymbolsDeclarations.types new file mode 100644 index 0000000000000..c4975d497cc11 --- /dev/null +++ b/tests/baselines/reference/uniqueSymbolsDeclarations.types @@ -0,0 +1,867 @@ +=== tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarations.ts === +// declarations with call initializer +const constCall = Symbol(); +>constCall : unique symbol +>Symbol() : unique symbol +>Symbol : SymbolConstructor + +let letCall = Symbol(); +>letCall : symbol +>Symbol() : symbol +>Symbol : SymbolConstructor + +var varCall = Symbol(); +>varCall : symbol +>Symbol() : symbol +>Symbol : SymbolConstructor + +// ambient declaration with type +declare const constType: unique symbol; +>constType : unique symbol + +// declaration with type and call initializer +const constTypeAndCall: unique symbol = Symbol(); +>constTypeAndCall : unique symbol +>Symbol() : unique symbol +>Symbol : SymbolConstructor + +// declaration from initializer +const constInitToConstCall = constCall; +>constInitToConstCall : symbol +>constCall : unique symbol + +const constInitToLetCall = letCall; +>constInitToLetCall : symbol +>letCall : symbol + +const constInitToVarCall = varCall; +>constInitToVarCall : symbol +>varCall : symbol + +const constInitToConstDeclAmbient = constType; +>constInitToConstDeclAmbient : symbol +>constType : unique symbol + +let letInitToConstCall = constCall; +>letInitToConstCall : symbol +>constCall : unique symbol + +let letInitToLetCall = letCall; +>letInitToLetCall : symbol +>letCall : symbol + +let letInitToVarCall = varCall; +>letInitToVarCall : symbol +>varCall : symbol + +let letInitToConstDeclAmbient = constType; +>letInitToConstDeclAmbient : symbol +>constType : unique symbol + +var varInitToConstCall = constCall; +>varInitToConstCall : symbol +>constCall : unique symbol + +var varInitToLetCall = letCall; +>varInitToLetCall : symbol +>letCall : symbol + +var varInitToVarCall = varCall; +>varInitToVarCall : symbol +>varCall : symbol + +var varInitToConstDeclAmbient = constType; +>varInitToConstDeclAmbient : symbol +>constType : unique symbol + +// declaration from initializer with type query +const constInitToConstCallWithTypeQuery: typeof constCall = constCall; +>constInitToConstCallWithTypeQuery : unique symbol +>constCall : unique symbol +>constCall : unique symbol + +const constInitToConstDeclAmbientWithTypeQuery: typeof constType = constType; +>constInitToConstDeclAmbientWithTypeQuery : unique symbol +>constType : unique symbol +>constType : unique symbol + +// function return inference +function funcReturnConstCall() { return constCall; } +>funcReturnConstCall : () => symbol +>constCall : unique symbol + +function funcReturnLetCall() { return letCall; } +>funcReturnLetCall : () => symbol +>letCall : symbol + +function funcReturnVarCall() { return varCall; } +>funcReturnVarCall : () => symbol +>varCall : symbol + +// function return value with type query +function funcReturnConstCallWithTypeQuery(): typeof constCall { return constCall; } +>funcReturnConstCallWithTypeQuery : () => unique symbol +>constCall : unique symbol +>constCall : unique symbol + +// generator function yield inference +function* genFuncYieldConstCall() { yield constCall; } +>genFuncYieldConstCall : () => IterableIterator +>yield constCall : any +>constCall : unique symbol + +function* genFuncYieldLetCall() { yield letCall; } +>genFuncYieldLetCall : () => IterableIterator +>yield letCall : any +>letCall : symbol + +function* genFuncYieldVarCall() { yield varCall; } +>genFuncYieldVarCall : () => IterableIterator +>yield varCall : any +>varCall : symbol + +// generator function yield with return type query +function* genFuncYieldConstCallWithTypeQuery(): IterableIterator { yield constCall; } +>genFuncYieldConstCallWithTypeQuery : () => IterableIterator +>IterableIterator : IterableIterator +>constCall : unique symbol +>yield constCall : any +>constCall : unique symbol + +// async function return inference +async function asyncFuncReturnConstCall() { return constCall; } +>asyncFuncReturnConstCall : () => Promise +>constCall : unique symbol + +async function asyncFuncReturnLetCall() { return letCall; } +>asyncFuncReturnLetCall : () => Promise +>letCall : symbol + +async function asyncFuncReturnVarCall() { return varCall; } +>asyncFuncReturnVarCall : () => Promise +>varCall : symbol + +// async generator function yield inference +async function* asyncGenFuncYieldConstCall() { yield constCall; } +>asyncGenFuncYieldConstCall : () => AsyncIterableIterator +>yield constCall : any +>constCall : unique symbol + +async function* asyncGenFuncYieldLetCall() { yield letCall; } +>asyncGenFuncYieldLetCall : () => AsyncIterableIterator +>yield letCall : any +>letCall : symbol + +async function* asyncGenFuncYieldVarCall() { yield varCall; } +>asyncGenFuncYieldVarCall : () => AsyncIterableIterator +>yield varCall : any +>varCall : symbol + +// classes +class C { +>C : C + + static readonly readonlyStaticCall = Symbol(); +>readonlyStaticCall : unique symbol +>Symbol() : unique symbol +>Symbol : SymbolConstructor + + static readonly readonlyStaticType: unique symbol; +>readonlyStaticType : unique symbol + + static readonly readonlyStaticTypeAndCall: unique symbol = Symbol(); +>readonlyStaticTypeAndCall : unique symbol +>Symbol() : unique symbol +>Symbol : SymbolConstructor + + static readwriteStaticCall = Symbol(); +>readwriteStaticCall : symbol +>Symbol() : symbol +>Symbol : SymbolConstructor + + readonly readonlyCall = Symbol(); +>readonlyCall : symbol +>Symbol() : symbol +>Symbol : SymbolConstructor + + readwriteCall = Symbol(); +>readwriteCall : symbol +>Symbol() : symbol +>Symbol : SymbolConstructor +} +declare const c: C; +>c : C +>C : C + +const constInitToCReadonlyStaticCall = C.readonlyStaticCall; +>constInitToCReadonlyStaticCall : symbol +>C.readonlyStaticCall : unique symbol +>C : typeof C +>readonlyStaticCall : unique symbol + +const constInitToCReadonlyStaticType = C.readonlyStaticType; +>constInitToCReadonlyStaticType : symbol +>C.readonlyStaticType : unique symbol +>C : typeof C +>readonlyStaticType : unique symbol + +const constInitToCReadonlyStaticTypeAndCall = C.readonlyStaticTypeAndCall; +>constInitToCReadonlyStaticTypeAndCall : symbol +>C.readonlyStaticTypeAndCall : unique symbol +>C : typeof C +>readonlyStaticTypeAndCall : unique symbol + +const constInitToCReadwriteStaticCall = C.readwriteStaticCall; +>constInitToCReadwriteStaticCall : symbol +>C.readwriteStaticCall : symbol +>C : typeof C +>readwriteStaticCall : symbol + +const constInitToCReadonlyStaticCallWithTypeQuery: typeof C.readonlyStaticCall = C.readonlyStaticCall; +>constInitToCReadonlyStaticCallWithTypeQuery : unique symbol +>C.readonlyStaticCall : unique symbol +>C : typeof C +>readonlyStaticCall : unique symbol +>C.readonlyStaticCall : unique symbol +>C : typeof C +>readonlyStaticCall : unique symbol + +const constInitToCReadonlyStaticTypeWithTypeQuery: typeof C.readonlyStaticType = C.readonlyStaticType; +>constInitToCReadonlyStaticTypeWithTypeQuery : unique symbol +>C.readonlyStaticType : unique symbol +>C : typeof C +>readonlyStaticType : unique symbol +>C.readonlyStaticType : unique symbol +>C : typeof C +>readonlyStaticType : unique symbol + +const constInitToCReadonlyStaticTypeAndCallWithTypeQuery: typeof C.readonlyStaticTypeAndCall = C.readonlyStaticTypeAndCall; +>constInitToCReadonlyStaticTypeAndCallWithTypeQuery : unique symbol +>C.readonlyStaticTypeAndCall : unique symbol +>C : typeof C +>readonlyStaticTypeAndCall : unique symbol +>C.readonlyStaticTypeAndCall : unique symbol +>C : typeof C +>readonlyStaticTypeAndCall : unique symbol + +const constInitToCReadwriteStaticCallWithTypeQuery: typeof C.readwriteStaticCall = C.readwriteStaticCall; +>constInitToCReadwriteStaticCallWithTypeQuery : symbol +>C.readwriteStaticCall : symbol +>C : typeof C +>readwriteStaticCall : symbol +>C.readwriteStaticCall : symbol +>C : typeof C +>readwriteStaticCall : symbol + +const constInitToCReadonlyCall = c.readonlyCall; +>constInitToCReadonlyCall : symbol +>c.readonlyCall : symbol +>c : C +>readonlyCall : symbol + +const constInitToCReadwriteCall = c.readwriteCall; +>constInitToCReadwriteCall : symbol +>c.readwriteCall : symbol +>c : C +>readwriteCall : symbol + +const constInitToCReadonlyCallWithTypeQuery: typeof c.readonlyCall = c.readonlyCall; +>constInitToCReadonlyCallWithTypeQuery : symbol +>c.readonlyCall : symbol +>c : C +>readonlyCall : symbol +>c.readonlyCall : symbol +>c : C +>readonlyCall : symbol + +const constInitToCReadwriteCallWithTypeQuery: typeof c.readwriteCall = c.readwriteCall; +>constInitToCReadwriteCallWithTypeQuery : symbol +>c.readwriteCall : symbol +>c : C +>readwriteCall : symbol +>c.readwriteCall : symbol +>c : C +>readwriteCall : symbol + +const constInitToCReadonlyCallWithIndexedAccess: C["readonlyCall"] = c.readonlyCall; +>constInitToCReadonlyCallWithIndexedAccess : symbol +>C : C +>c.readonlyCall : symbol +>c : C +>readonlyCall : symbol + +const constInitToCReadwriteCallWithIndexedAccess: C["readwriteCall"] = c.readwriteCall; +>constInitToCReadwriteCallWithIndexedAccess : symbol +>C : C +>c.readwriteCall : symbol +>c : C +>readwriteCall : symbol + +// interfaces +interface I { +>I : I + + readonly readonlyType: unique symbol; +>readonlyType : unique symbol +} +declare const i: I; +>i : I +>I : I + +const constInitToIReadonlyType = i.readonlyType; +>constInitToIReadonlyType : symbol +>i.readonlyType : unique symbol +>i : I +>readonlyType : unique symbol + +const constInitToIReadonlyTypeWithTypeQuery: typeof i.readonlyType = i.readonlyType; +>constInitToIReadonlyTypeWithTypeQuery : unique symbol +>i.readonlyType : unique symbol +>i : I +>readonlyType : unique symbol +>i.readonlyType : unique symbol +>i : I +>readonlyType : unique symbol + +const constInitToIReadonlyTypeWithIndexedAccess: I["readonlyType"] = i.readonlyType; +>constInitToIReadonlyTypeWithIndexedAccess : unique symbol +>I : I +>i.readonlyType : unique symbol +>i : I +>readonlyType : unique symbol + +// type literals +type L = { +>L : L + + readonly readonlyType: unique symbol; +>readonlyType : unique symbol + + nested: { +>nested : { readonly readonlyNestedType: unique symbol; } + + readonly readonlyNestedType: unique symbol; +>readonlyNestedType : unique symbol + } +}; +declare const l: L; +>l : L +>L : L + +const constInitToLReadonlyType = l.readonlyType; +>constInitToLReadonlyType : symbol +>l.readonlyType : unique symbol +>l : L +>readonlyType : unique symbol + +const constInitToLReadonlyNestedType = l.nested.readonlyNestedType; +>constInitToLReadonlyNestedType : symbol +>l.nested.readonlyNestedType : unique symbol +>l.nested : { readonly readonlyNestedType: unique symbol; } +>l : L +>nested : { readonly readonlyNestedType: unique symbol; } +>readonlyNestedType : unique symbol + +const constInitToLReadonlyTypeWithTypeQuery: typeof l.readonlyType = l.readonlyType; +>constInitToLReadonlyTypeWithTypeQuery : unique symbol +>l.readonlyType : unique symbol +>l : L +>readonlyType : unique symbol +>l.readonlyType : unique symbol +>l : L +>readonlyType : unique symbol + +const constInitToLReadonlyNestedTypeWithTypeQuery: typeof l.nested.readonlyNestedType = l.nested.readonlyNestedType; +>constInitToLReadonlyNestedTypeWithTypeQuery : unique symbol +>l.nested.readonlyNestedType : unique symbol +>l.nested : { readonly readonlyNestedType: unique symbol; } +>l : L +>nested : { readonly readonlyNestedType: unique symbol; } +>readonlyNestedType : unique symbol +>l.nested.readonlyNestedType : unique symbol +>l.nested : { readonly readonlyNestedType: unique symbol; } +>l : L +>nested : { readonly readonlyNestedType: unique symbol; } +>readonlyNestedType : unique symbol + +const constInitToLReadonlyTypeWithIndexedAccess: L["readonlyType"] = l.readonlyType; +>constInitToLReadonlyTypeWithIndexedAccess : unique symbol +>L : L +>l.readonlyType : unique symbol +>l : L +>readonlyType : unique symbol + +const constInitToLReadonlyNestedTypeWithIndexedAccess: L["nested"]["readonlyNestedType"] = l.nested.readonlyNestedType; +>constInitToLReadonlyNestedTypeWithIndexedAccess : unique symbol +>L : L +>l.nested.readonlyNestedType : unique symbol +>l.nested : { readonly readonlyNestedType: unique symbol; } +>l : L +>nested : { readonly readonlyNestedType: unique symbol; } +>readonlyNestedType : unique symbol + +// type argument inference +const promiseForConstCall = Promise.resolve(constCall); +>promiseForConstCall : Promise +>Promise.resolve(constCall) : Promise +>Promise.resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>Promise : PromiseConstructor +>resolve : { (value: T | PromiseLike): Promise; (): Promise; } +>constCall : unique symbol + +const arrayOfConstCall = [constCall]; +>arrayOfConstCall : symbol[] +>[constCall] : symbol[] +>constCall : unique symbol + +// unique symbol widening in expressions +declare const s: unique symbol; +>s : unique symbol + +declare namespace N { const s: unique symbol; } +>N : typeof N +>s : unique symbol + +declare const o: { [s]: "a", [N.s]: "b" }; +>o : { [s]: "a"; [N.s]: "b"; } +>s : unique symbol +>N.s : unique symbol +>N : typeof N +>s : unique symbol + +declare function f(x: T): T; +>f : (x: T) => T +>T : T +>x : T +>T : T +>T : T + +declare function g(x: typeof s): void; +>g : { (x: unique symbol): void; (x: unique symbol): void; } +>x : unique symbol +>s : unique symbol + +declare function g(x: typeof N.s): void; +>g : { (x: unique symbol): void; (x: unique symbol): void; } +>x : unique symbol +>N.s : unique symbol +>N : typeof N +>s : unique symbol + +// widening positions + +// argument inference +f(s); +>f(s) : symbol +>f : (x: T) => T +>s : unique symbol + +f(N.s); +>f(N.s) : symbol +>f : (x: T) => T +>N.s : unique symbol +>N : typeof N +>s : unique symbol + +f(N["s"]); +>f(N["s"]) : symbol +>f : (x: T) => T +>N["s"] : unique symbol +>N : typeof N +>"s" : "s" + +// array literal elements +[s]; +>[s] : symbol[] +>s : unique symbol + +[N.s]; +>[N.s] : symbol[] +>N.s : unique symbol +>N : typeof N +>s : unique symbol + +[N["s"]]; +>[N["s"]] : symbol[] +>N["s"] : unique symbol +>N : typeof N +>"s" : "s" + +// property assignments/methods +const o2 = { +>o2 : { a: symbol; b: symbol; c: symbol; method1(): symbol; method2(): Promise; method3(): AsyncIterableIterator; method4(): IterableIterator; method5(p?: symbol): symbol; } +>{ a: s, b: N.s, c: N["s"], method1() { return s; }, async method2() { return s; }, async * method3() { yield s; }, * method4() { yield s; }, method5(p = s) { return p; }} : { a: symbol; b: symbol; c: symbol; method1(): symbol; method2(): Promise; method3(): AsyncIterableIterator; method4(): IterableIterator; method5(p?: symbol): symbol; } + + a: s, +>a : symbol +>s : unique symbol + + b: N.s, +>b : symbol +>N.s : unique symbol +>N : typeof N +>s : unique symbol + + c: N["s"], +>c : symbol +>N["s"] : unique symbol +>N : typeof N +>"s" : "s" + + method1() { return s; }, +>method1 : () => symbol +>s : unique symbol + + async method2() { return s; }, +>method2 : () => Promise +>s : unique symbol + + async * method3() { yield s; }, +>method3 : () => AsyncIterableIterator +>yield s : any +>s : unique symbol + + * method4() { yield s; }, +>method4 : () => IterableIterator +>yield s : any +>s : unique symbol + + method5(p = s) { return p; } +>method5 : (p?: symbol) => symbol +>p : symbol +>s : unique symbol +>p : symbol + +}; + +// property initializers +class C0 { +>C0 : C0 + + static readonly a = s; +>a : symbol +>s : unique symbol + + static readonly b = N.s; +>b : symbol +>N.s : unique symbol +>N : typeof N +>s : unique symbol + + static readonly c = N["s"]; +>c : symbol +>N["s"] : unique symbol +>N : typeof N +>"s" : "s" + + static d = s; +>d : symbol +>s : unique symbol + + static e = N.s; +>e : symbol +>N.s : unique symbol +>N : typeof N +>s : unique symbol + + static f = N["s"]; +>f : symbol +>N["s"] : unique symbol +>N : typeof N +>"s" : "s" + + readonly a = s; +>a : symbol +>s : unique symbol + + readonly b = N.s; +>b : symbol +>N.s : unique symbol +>N : typeof N +>s : unique symbol + + readonly c = N["s"]; +>c : symbol +>N["s"] : unique symbol +>N : typeof N +>"s" : "s" + + d = s; +>d : symbol +>s : unique symbol + + e = N.s; +>e : symbol +>N.s : unique symbol +>N : typeof N +>s : unique symbol + + f = N["s"]; +>f : symbol +>N["s"] : unique symbol +>N : typeof N +>"s" : "s" + + method1() { return s; } +>method1 : () => symbol +>s : unique symbol + + async method2() { return s; } +>method2 : () => Promise +>s : unique symbol + + async * method3() { yield s; } +>method3 : () => AsyncIterableIterator +>yield s : any +>s : unique symbol + + * method4() { yield s; } +>method4 : () => IterableIterator +>yield s : any +>s : unique symbol + + method5(p = s) { return p; } +>method5 : (p?: symbol) => symbol +>p : symbol +>s : unique symbol +>p : symbol +} + +// non-widening positions + +// element access +o[s]; +>o[s] : "a" +>o : { [s]: "a"; [N.s]: "b"; } +>s : unique symbol + +o[N.s]; +>o[N.s] : "b" +>o : { [s]: "a"; [N.s]: "b"; } +>N.s : unique symbol +>N : typeof N +>s : unique symbol + +o[N["s"]]; +>o[N["s"]] : "b" +>o : { [s]: "a"; [N.s]: "b"; } +>N["s"] : unique symbol +>N : typeof N +>"s" : "s" + +// arguments (no-inference) +f(s); +>f(s) : unique symbol +>f : (x: T) => T +>s : unique symbol +>s : unique symbol + +f(N.s); +>f(N.s) : unique symbol +>f : (x: T) => T +>N.s : unique symbol +>N : typeof N +>s : unique symbol +>N.s : unique symbol +>N : typeof N +>s : unique symbol + +f(N["s"]); +>f(N["s"]) : unique symbol +>f : (x: T) => T +>N.s : unique symbol +>N : typeof N +>s : unique symbol +>N["s"] : unique symbol +>N : typeof N +>"s" : "s" + +g(s); +>g(s) : void +>g : { (x: unique symbol): void; (x: unique symbol): void; } +>s : unique symbol + +g(N.s); +>g(N.s) : void +>g : { (x: unique symbol): void; (x: unique symbol): void; } +>N.s : unique symbol +>N : typeof N +>s : unique symbol + +g(N["s"]); +>g(N["s"]) : void +>g : { (x: unique symbol): void; (x: unique symbol): void; } +>N["s"] : unique symbol +>N : typeof N +>"s" : "s" + +// falsy expressions +s || ""; +>s || "" : unique symbol | "" +>s : unique symbol +>"" : "" + +N.s || ""; +>N.s || "" : unique symbol | "" +>N.s : unique symbol +>N : typeof N +>s : unique symbol +>"" : "" + +N["s"] || ""; +>N["s"] || "" : unique symbol | "" +>N["s"] : unique symbol +>N : typeof N +>"s" : "s" +>"" : "" + +// conditionals +Math.random() * 2 ? s : "a"; +>Math.random() * 2 ? s : "a" : unique symbol | "a" +>Math.random() * 2 : number +>Math.random() : number +>Math.random : () => number +>Math : Math +>random : () => number +>2 : 2 +>s : unique symbol +>"a" : "a" + +Math.random() * 2 ? N.s : "a"; +>Math.random() * 2 ? N.s : "a" : unique symbol | "a" +>Math.random() * 2 : number +>Math.random() : number +>Math.random : () => number +>Math : Math +>random : () => number +>2 : 2 +>N.s : unique symbol +>N : typeof N +>s : unique symbol +>"a" : "a" + +Math.random() * 2 ? N["s"] : "a"; +>Math.random() * 2 ? N["s"] : "a" : unique symbol | "a" +>Math.random() * 2 : number +>Math.random() : number +>Math.random : () => number +>Math : Math +>random : () => number +>2 : 2 +>N["s"] : unique symbol +>N : typeof N +>"s" : "s" +>"a" : "a" + +// computed property names +({ +>({ [s]: "a", [N.s]: "b",}) : { [s]: string; [N.s]: string; } +>{ [s]: "a", [N.s]: "b",} : { [s]: string; [N.s]: string; } + + [s]: "a", +>s : unique symbol +>"a" : "a" + + [N.s]: "b", +>N.s : unique symbol +>N : typeof N +>s : unique symbol +>"b" : "b" + +}); + +class C1 { +>C1 : C1 + + static [s]: "a"; +>s : unique symbol + + static [N.s]: "b"; +>N.s : unique symbol +>N : typeof N +>s : unique symbol + + [s]: "a"; +>s : unique symbol + + [N.s]: "b"; +>N.s : unique symbol +>N : typeof N +>s : unique symbol +} + +// contextual types + +interface Context { +>Context : Context + + method1(): typeof s; +>method1 : () => unique symbol +>s : unique symbol + + method2(): Promise; +>method2 : () => Promise +>Promise : Promise +>s : unique symbol + + method3(): AsyncIterableIterator; +>method3 : () => AsyncIterableIterator +>AsyncIterableIterator : AsyncIterableIterator +>s : unique symbol + + method4(): IterableIterator; +>method4 : () => IterableIterator +>IterableIterator : IterableIterator +>s : unique symbol + + method5(p?: typeof s): typeof s; +>method5 : (p?: unique symbol) => unique symbol +>p : unique symbol +>s : unique symbol +>s : unique symbol +} + +const o4: Context = { +>o4 : Context +>Context : Context +>{ method1() { return s; // return type should not widen due to contextual type }, async method2() { return s; // return type should not widen due to contextual type }, async * method3() { yield s; // yield type should not widen due to contextual type }, * method4() { yield s; // yield type should not widen due to contextual type }, method5(p = s) { // parameter should not widen due to contextual type return p; }} : { method1(): unique symbol; method2(): Promise; method3(): AsyncIterableIterator; method4(): IterableIterator; method5(p?: unique symbol): unique symbol; } + + method1() { +>method1 : () => unique symbol + + return s; // return type should not widen due to contextual type +>s : unique symbol + + }, + async method2() { +>method2 : () => Promise + + return s; // return type should not widen due to contextual type +>s : unique symbol + + }, + async * method3() { +>method3 : () => AsyncIterableIterator + + yield s; // yield type should not widen due to contextual type +>yield s : any +>s : unique symbol + + }, + * method4() { +>method4 : () => IterableIterator + + yield s; // yield type should not widen due to contextual type +>yield s : any +>s : unique symbol + + }, + method5(p = s) { // parameter should not widen due to contextual type +>method5 : (p?: unique symbol) => unique symbol +>p : unique symbol +>s : unique symbol + + return p; +>p : unique symbol + } +}; diff --git a/tests/baselines/reference/uniqueSymbolsDeclarationsErrors.errors.txt b/tests/baselines/reference/uniqueSymbolsDeclarationsErrors.errors.txt new file mode 100644 index 0000000000000..f7769db1077a6 --- /dev/null +++ b/tests/baselines/reference/uniqueSymbolsDeclarationsErrors.errors.txt @@ -0,0 +1,110 @@ +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarationsErrors.ts(6,14): error TS2527: The inferred type of 'obj' references an inaccessible 'unique symbol' type. A type annotation is necessary. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarationsErrors.ts(15,14): error TS2527: The inferred type of 'classExpression' references an inaccessible 'unique symbol' type. A type annotation is necessary. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarationsErrors.ts(24,17): error TS2527: The inferred type of 'funcInferredReturnType' references an inaccessible 'unique symbol' type. A type annotation is necessary. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarationsErrors.ts(24,64): error TS4078: Parameter 'obj' of exported function has or is using private name 's'. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarationsErrors.ts(29,6): error TS4033: Property '[s]' of exported interface has or is using private name 's'. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarationsErrors.ts(33,6): error TS4102: Method '[s]' of exported interface has or is using private name 's'. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarationsErrors.ts(37,6): error TS4033: Property '[s]' of exported interface has or is using private name 's'. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarationsErrors.ts(41,6): error TS4102: Method '[s]' of exported interface has or is using private name 's'. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarationsErrors.ts(45,6): error TS4031: Public property '[s]' of exported class has or is using private name 's'. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarationsErrors.ts(46,13): error TS4028: Public static property '[s]' of exported class has or is using private name 's'. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarationsErrors.ts(50,6): error TS4100: Public method '[s]' of exported class has or is using private name 's'. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarationsErrors.ts(51,13): error TS4097: Public static method '[s]' of exported class has or is using private name 's'. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarationsErrors.ts(55,10): error TS4031: Public property '[s]' of exported class has or is using private name 's'. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarationsErrors.ts(56,10): error TS4031: Public property '[s]' of exported class has or is using private name 's'. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarationsErrors.ts(57,17): error TS4028: Public static property '[s]' of exported class has or is using private name 's'. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarationsErrors.ts(58,17): error TS4028: Public static property '[s]' of exported class has or is using private name 's'. + + +==== tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarationsErrors.ts (16 errors) ==== + declare const s: unique symbol; + interface I { readonly readonlyType: unique symbol; } + + // not allowed when emitting declarations + + export const obj = { + ~~~ +!!! error TS2527: The inferred type of 'obj' references an inaccessible 'unique symbol' type. A type annotation is necessary. + method1(p: typeof s): typeof s { + return p; + }, + method2(p: I["readonlyType"]): I["readonlyType"] { + return p; + } + }; + + export const classExpression = class { + ~~~~~~~~~~~~~~~ +!!! error TS2527: The inferred type of 'classExpression' references an inaccessible 'unique symbol' type. A type annotation is necessary. + method1(p: typeof s): typeof s { + return p; + } + method2(p: I["readonlyType"]): I["readonlyType"] { + return p; + } + }; + + export function funcInferredReturnType(obj: { method(p: typeof s): void }) { + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2527: The inferred type of 'funcInferredReturnType' references an inaccessible 'unique symbol' type. A type annotation is necessary. + ~ +!!! error TS4078: Parameter 'obj' of exported function has or is using private name 's'. + return obj; + } + + export interface InterfaceWithPrivateNamedProperties { + [s]: any; + ~ +!!! error TS4033: Property '[s]' of exported interface has or is using private name 's'. + } + + export interface InterfaceWithPrivateNamedMethods { + [s](): any; + ~ +!!! error TS4102: Method '[s]' of exported interface has or is using private name 's'. + } + + export type TypeLiteralWithPrivateNamedProperties = { + [s]: any; + ~ +!!! error TS4033: Property '[s]' of exported interface has or is using private name 's'. + } + + export type TypeLiteralWithPrivateNamedMethods = { + [s](): any; + ~ +!!! error TS4102: Method '[s]' of exported interface has or is using private name 's'. + } + + export class ClassWithPrivateNamedProperties { + [s]: any; + ~ +!!! error TS4031: Public property '[s]' of exported class has or is using private name 's'. + static [s]: any; + ~ +!!! error TS4028: Public static property '[s]' of exported class has or is using private name 's'. + } + + export class ClassWithPrivateNamedMethods { + [s]() {} + ~ +!!! error TS4100: Public method '[s]' of exported class has or is using private name 's'. + static [s]() {} + ~ +!!! error TS4097: Public static method '[s]' of exported class has or is using private name 's'. + } + + export class ClassWithPrivateNamedAccessors { + get [s](): any { return undefined; } + ~ +!!! error TS4031: Public property '[s]' of exported class has or is using private name 's'. + set [s](v: any) { } + ~ +!!! error TS4031: Public property '[s]' of exported class has or is using private name 's'. + static get [s](): any { return undefined; } + ~ +!!! error TS4028: Public static property '[s]' of exported class has or is using private name 's'. + static set [s](v: any) { } + ~ +!!! error TS4028: Public static property '[s]' of exported class has or is using private name 's'. + } \ No newline at end of file diff --git a/tests/baselines/reference/uniqueSymbolsDeclarationsErrors.js b/tests/baselines/reference/uniqueSymbolsDeclarationsErrors.js new file mode 100644 index 0000000000000..a446a6712a4d0 --- /dev/null +++ b/tests/baselines/reference/uniqueSymbolsDeclarationsErrors.js @@ -0,0 +1,100 @@ +//// [uniqueSymbolsDeclarationsErrors.ts] +declare const s: unique symbol; +interface I { readonly readonlyType: unique symbol; } + +// not allowed when emitting declarations + +export const obj = { + method1(p: typeof s): typeof s { + return p; + }, + method2(p: I["readonlyType"]): I["readonlyType"] { + return p; + } +}; + +export const classExpression = class { + method1(p: typeof s): typeof s { + return p; + } + method2(p: I["readonlyType"]): I["readonlyType"] { + return p; + } +}; + +export function funcInferredReturnType(obj: { method(p: typeof s): void }) { + return obj; +} + +export interface InterfaceWithPrivateNamedProperties { + [s]: any; +} + +export interface InterfaceWithPrivateNamedMethods { + [s](): any; +} + +export type TypeLiteralWithPrivateNamedProperties = { + [s]: any; +} + +export type TypeLiteralWithPrivateNamedMethods = { + [s](): any; +} + +export class ClassWithPrivateNamedProperties { + [s]: any; + static [s]: any; +} + +export class ClassWithPrivateNamedMethods { + [s]() {} + static [s]() {} +} + +export class ClassWithPrivateNamedAccessors { + get [s](): any { return undefined; } + set [s](v: any) { } + static get [s](): any { return undefined; } + static set [s](v: any) { } +} + +//// [uniqueSymbolsDeclarationsErrors.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// not allowed when emitting declarations +exports.obj = { + method1(p) { + return p; + }, + method2(p) { + return p; + } +}; +exports.classExpression = class { + method1(p) { + return p; + } + method2(p) { + return p; + } +}; +function funcInferredReturnType(obj) { + return obj; +} +exports.funcInferredReturnType = funcInferredReturnType; +class ClassWithPrivateNamedProperties { +} +exports.ClassWithPrivateNamedProperties = ClassWithPrivateNamedProperties; +class ClassWithPrivateNamedMethods { + [s]() { } + static [s]() { } +} +exports.ClassWithPrivateNamedMethods = ClassWithPrivateNamedMethods; +class ClassWithPrivateNamedAccessors { + get [s]() { return undefined; } + set [s](v) { } + static get [s]() { return undefined; } + static set [s](v) { } +} +exports.ClassWithPrivateNamedAccessors = ClassWithPrivateNamedAccessors; diff --git a/tests/baselines/reference/uniqueSymbolsDeclarationsErrors.symbols b/tests/baselines/reference/uniqueSymbolsDeclarationsErrors.symbols new file mode 100644 index 0000000000000..45275c60a1712 --- /dev/null +++ b/tests/baselines/reference/uniqueSymbolsDeclarationsErrors.symbols @@ -0,0 +1,135 @@ +=== tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarationsErrors.ts === +declare const s: unique symbol; +>s : Symbol(s, Decl(uniqueSymbolsDeclarationsErrors.ts, 0, 13)) + +interface I { readonly readonlyType: unique symbol; } +>I : Symbol(I, Decl(uniqueSymbolsDeclarationsErrors.ts, 0, 31)) +>readonlyType : Symbol(I.readonlyType, Decl(uniqueSymbolsDeclarationsErrors.ts, 1, 13)) + +// not allowed when emitting declarations + +export const obj = { +>obj : Symbol(obj, Decl(uniqueSymbolsDeclarationsErrors.ts, 5, 12)) + + method1(p: typeof s): typeof s { +>method1 : Symbol(method1, Decl(uniqueSymbolsDeclarationsErrors.ts, 5, 20)) +>p : Symbol(p, Decl(uniqueSymbolsDeclarationsErrors.ts, 6, 12)) +>s : Symbol(s, Decl(uniqueSymbolsDeclarationsErrors.ts, 0, 13)) +>s : Symbol(s, Decl(uniqueSymbolsDeclarationsErrors.ts, 0, 13)) + + return p; +>p : Symbol(p, Decl(uniqueSymbolsDeclarationsErrors.ts, 6, 12)) + + }, + method2(p: I["readonlyType"]): I["readonlyType"] { +>method2 : Symbol(method2, Decl(uniqueSymbolsDeclarationsErrors.ts, 8, 6)) +>p : Symbol(p, Decl(uniqueSymbolsDeclarationsErrors.ts, 9, 12)) +>I : Symbol(I, Decl(uniqueSymbolsDeclarationsErrors.ts, 0, 31)) +>I : Symbol(I, Decl(uniqueSymbolsDeclarationsErrors.ts, 0, 31)) + + return p; +>p : Symbol(p, Decl(uniqueSymbolsDeclarationsErrors.ts, 9, 12)) + } +}; + +export const classExpression = class { +>classExpression : Symbol(classExpression, Decl(uniqueSymbolsDeclarationsErrors.ts, 14, 12)) + + method1(p: typeof s): typeof s { +>method1 : Symbol(classExpression.method1, Decl(uniqueSymbolsDeclarationsErrors.ts, 14, 38)) +>p : Symbol(p, Decl(uniqueSymbolsDeclarationsErrors.ts, 15, 12)) +>s : Symbol(s, Decl(uniqueSymbolsDeclarationsErrors.ts, 0, 13)) +>s : Symbol(s, Decl(uniqueSymbolsDeclarationsErrors.ts, 0, 13)) + + return p; +>p : Symbol(p, Decl(uniqueSymbolsDeclarationsErrors.ts, 15, 12)) + } + method2(p: I["readonlyType"]): I["readonlyType"] { +>method2 : Symbol(classExpression.method2, Decl(uniqueSymbolsDeclarationsErrors.ts, 17, 5)) +>p : Symbol(p, Decl(uniqueSymbolsDeclarationsErrors.ts, 18, 12)) +>I : Symbol(I, Decl(uniqueSymbolsDeclarationsErrors.ts, 0, 31)) +>I : Symbol(I, Decl(uniqueSymbolsDeclarationsErrors.ts, 0, 31)) + + return p; +>p : Symbol(p, Decl(uniqueSymbolsDeclarationsErrors.ts, 18, 12)) + } +}; + +export function funcInferredReturnType(obj: { method(p: typeof s): void }) { +>funcInferredReturnType : Symbol(funcInferredReturnType, Decl(uniqueSymbolsDeclarationsErrors.ts, 21, 2)) +>obj : Symbol(obj, Decl(uniqueSymbolsDeclarationsErrors.ts, 23, 39)) +>method : Symbol(method, Decl(uniqueSymbolsDeclarationsErrors.ts, 23, 45)) +>p : Symbol(p, Decl(uniqueSymbolsDeclarationsErrors.ts, 23, 53)) +>s : Symbol(s, Decl(uniqueSymbolsDeclarationsErrors.ts, 0, 13)) + + return obj; +>obj : Symbol(obj, Decl(uniqueSymbolsDeclarationsErrors.ts, 23, 39)) +} + +export interface InterfaceWithPrivateNamedProperties { +>InterfaceWithPrivateNamedProperties : Symbol(InterfaceWithPrivateNamedProperties, Decl(uniqueSymbolsDeclarationsErrors.ts, 25, 1)) + + [s]: any; +>s : Symbol(s, Decl(uniqueSymbolsDeclarationsErrors.ts, 0, 13)) +} + +export interface InterfaceWithPrivateNamedMethods { +>InterfaceWithPrivateNamedMethods : Symbol(InterfaceWithPrivateNamedMethods, Decl(uniqueSymbolsDeclarationsErrors.ts, 29, 1)) + + [s](): any; +>s : Symbol(s, Decl(uniqueSymbolsDeclarationsErrors.ts, 0, 13)) +} + +export type TypeLiteralWithPrivateNamedProperties = { +>TypeLiteralWithPrivateNamedProperties : Symbol(TypeLiteralWithPrivateNamedProperties, Decl(uniqueSymbolsDeclarationsErrors.ts, 33, 1)) + + [s]: any; +>s : Symbol(s, Decl(uniqueSymbolsDeclarationsErrors.ts, 0, 13)) +} + +export type TypeLiteralWithPrivateNamedMethods = { +>TypeLiteralWithPrivateNamedMethods : Symbol(TypeLiteralWithPrivateNamedMethods, Decl(uniqueSymbolsDeclarationsErrors.ts, 37, 1)) + + [s](): any; +>s : Symbol(s, Decl(uniqueSymbolsDeclarationsErrors.ts, 0, 13)) +} + +export class ClassWithPrivateNamedProperties { +>ClassWithPrivateNamedProperties : Symbol(ClassWithPrivateNamedProperties, Decl(uniqueSymbolsDeclarationsErrors.ts, 41, 1)) + + [s]: any; +>s : Symbol(s, Decl(uniqueSymbolsDeclarationsErrors.ts, 0, 13)) + + static [s]: any; +>s : Symbol(s, Decl(uniqueSymbolsDeclarationsErrors.ts, 0, 13)) +} + +export class ClassWithPrivateNamedMethods { +>ClassWithPrivateNamedMethods : Symbol(ClassWithPrivateNamedMethods, Decl(uniqueSymbolsDeclarationsErrors.ts, 46, 1)) + + [s]() {} +>s : Symbol(s, Decl(uniqueSymbolsDeclarationsErrors.ts, 0, 13)) + + static [s]() {} +>s : Symbol(s, Decl(uniqueSymbolsDeclarationsErrors.ts, 0, 13)) +} + +export class ClassWithPrivateNamedAccessors { +>ClassWithPrivateNamedAccessors : Symbol(ClassWithPrivateNamedAccessors, Decl(uniqueSymbolsDeclarationsErrors.ts, 51, 1)) + + get [s](): any { return undefined; } +>s : Symbol(s, Decl(uniqueSymbolsDeclarationsErrors.ts, 0, 13)) +>undefined : Symbol(undefined) + + set [s](v: any) { } +>s : Symbol(s, Decl(uniqueSymbolsDeclarationsErrors.ts, 0, 13)) +>v : Symbol(v, Decl(uniqueSymbolsDeclarationsErrors.ts, 55, 12)) + + static get [s](): any { return undefined; } +>s : Symbol(s, Decl(uniqueSymbolsDeclarationsErrors.ts, 0, 13)) +>undefined : Symbol(undefined) + + static set [s](v: any) { } +>s : Symbol(s, Decl(uniqueSymbolsDeclarationsErrors.ts, 0, 13)) +>v : Symbol(v, Decl(uniqueSymbolsDeclarationsErrors.ts, 57, 19)) +} diff --git a/tests/baselines/reference/uniqueSymbolsDeclarationsErrors.types b/tests/baselines/reference/uniqueSymbolsDeclarationsErrors.types new file mode 100644 index 0000000000000..ff3101193b4f3 --- /dev/null +++ b/tests/baselines/reference/uniqueSymbolsDeclarationsErrors.types @@ -0,0 +1,137 @@ +=== tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarationsErrors.ts === +declare const s: unique symbol; +>s : unique symbol + +interface I { readonly readonlyType: unique symbol; } +>I : I +>readonlyType : unique symbol + +// not allowed when emitting declarations + +export const obj = { +>obj : { method1(p: unique symbol): unique symbol; method2(p: unique symbol): unique symbol; } +>{ method1(p: typeof s): typeof s { return p; }, method2(p: I["readonlyType"]): I["readonlyType"] { return p; }} : { method1(p: unique symbol): unique symbol; method2(p: unique symbol): unique symbol; } + + method1(p: typeof s): typeof s { +>method1 : (p: unique symbol) => unique symbol +>p : unique symbol +>s : unique symbol +>s : unique symbol + + return p; +>p : unique symbol + + }, + method2(p: I["readonlyType"]): I["readonlyType"] { +>method2 : (p: unique symbol) => unique symbol +>p : unique symbol +>I : I +>I : I + + return p; +>p : unique symbol + } +}; + +export const classExpression = class { +>classExpression : typeof classExpression +>class { method1(p: typeof s): typeof s { return p; } method2(p: I["readonlyType"]): I["readonlyType"] { return p; }} : typeof classExpression + + method1(p: typeof s): typeof s { +>method1 : (p: unique symbol) => unique symbol +>p : unique symbol +>s : unique symbol +>s : unique symbol + + return p; +>p : unique symbol + } + method2(p: I["readonlyType"]): I["readonlyType"] { +>method2 : (p: unique symbol) => unique symbol +>p : unique symbol +>I : I +>I : I + + return p; +>p : unique symbol + } +}; + +export function funcInferredReturnType(obj: { method(p: typeof s): void }) { +>funcInferredReturnType : (obj: { method(p: unique symbol): void; }) => { method(p: unique symbol): void; } +>obj : { method(p: unique symbol): void; } +>method : (p: unique symbol) => void +>p : unique symbol +>s : unique symbol + + return obj; +>obj : { method(p: unique symbol): void; } +} + +export interface InterfaceWithPrivateNamedProperties { +>InterfaceWithPrivateNamedProperties : InterfaceWithPrivateNamedProperties + + [s]: any; +>s : unique symbol +} + +export interface InterfaceWithPrivateNamedMethods { +>InterfaceWithPrivateNamedMethods : InterfaceWithPrivateNamedMethods + + [s](): any; +>s : unique symbol +} + +export type TypeLiteralWithPrivateNamedProperties = { +>TypeLiteralWithPrivateNamedProperties : TypeLiteralWithPrivateNamedProperties + + [s]: any; +>s : unique symbol +} + +export type TypeLiteralWithPrivateNamedMethods = { +>TypeLiteralWithPrivateNamedMethods : TypeLiteralWithPrivateNamedMethods + + [s](): any; +>s : unique symbol +} + +export class ClassWithPrivateNamedProperties { +>ClassWithPrivateNamedProperties : ClassWithPrivateNamedProperties + + [s]: any; +>s : unique symbol + + static [s]: any; +>s : unique symbol +} + +export class ClassWithPrivateNamedMethods { +>ClassWithPrivateNamedMethods : ClassWithPrivateNamedMethods + + [s]() {} +>s : unique symbol + + static [s]() {} +>s : unique symbol +} + +export class ClassWithPrivateNamedAccessors { +>ClassWithPrivateNamedAccessors : ClassWithPrivateNamedAccessors + + get [s](): any { return undefined; } +>s : unique symbol +>undefined : undefined + + set [s](v: any) { } +>s : unique symbol +>v : any + + static get [s](): any { return undefined; } +>s : unique symbol +>undefined : undefined + + static set [s](v: any) { } +>s : unique symbol +>v : any +} diff --git a/tests/baselines/reference/uniqueSymbolsErrors.errors.txt b/tests/baselines/reference/uniqueSymbolsErrors.errors.txt new file mode 100644 index 0000000000000..4f49e7b096c13 --- /dev/null +++ b/tests/baselines/reference/uniqueSymbolsErrors.errors.txt @@ -0,0 +1,269 @@ +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(2,41): error TS1005: 'symbol' expected. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(3,19): error TS1333: 'unique symbol' types may not be used on a variable declaration with a binding name. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(4,13): error TS1332: A variable whose type is a 'unique symbol' type must be 'const'. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(5,13): error TS1332: A variable whose type is a 'unique symbol' type must be 'const'. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(8,38): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(9,46): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(10,39): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(11,40): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(12,53): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(13,59): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(14,50): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(18,44): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(20,14): error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(21,5): error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(22,25): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(23,34): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(24,26): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(25,27): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(26,40): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(27,46): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(28,37): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(29,26): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(30,28): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(32,12): error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(33,38): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(34,47): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(35,39): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(36,40): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(37,53): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(38,59): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(39,50): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(40,39): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(41,41): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(46,5): error TS1330: A property of an interface or type literal whose type is a 'unique symbol' type must be 'readonly'. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(47,25): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(48,34): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(49,26): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(50,27): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(51,40): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(52,46): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(53,37): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(58,5): error TS1330: A property of an interface or type literal whose type is a 'unique symbol' type must be 'readonly'. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(59,25): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(60,34): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(61,26): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(62,27): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(63,40): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(64,46): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(65,37): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(69,21): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(70,52): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(71,49): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(74,44): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(75,34): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(76,34): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(79,51): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(82,29): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(82,45): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(83,36): error TS1335: 'unique symbol' types are not allowed here. +tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(83,52): error TS1335: 'unique symbol' types are not allowed here. + + +==== tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts (60 errors) ==== + // declarations + declare const invalidUniqueType: unique number; + ~~~~~~ +!!! error TS1005: 'symbol' expected. + declare const {}: unique symbol; + ~~~~~~~~~~~~~ +!!! error TS1333: 'unique symbol' types may not be used on a variable declaration with a binding name. + declare let invalidLetType: unique symbol; + ~~~~~~~~~~~~~~ +!!! error TS1332: A variable whose type is a 'unique symbol' type must be 'const'. + declare var invalidVarType: unique symbol; + ~~~~~~~~~~~~~~ +!!! error TS1332: A variable whose type is a 'unique symbol' type must be 'const'. + + // function arguments and return types + declare function invalidArgType(arg: unique symbol): void; + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + declare function invalidRestArgType(...arg: (unique symbol)[]): void; + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + declare function invalidReturnType(): unique symbol; + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + declare function invalidThisType(this: unique symbol): void; + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + declare function invalidTypePredicate(n: any): n is unique symbol; + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + declare function invalidTypeParameterConstraint(): void; + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + declare function invalidTypeParameterDefault(): void; + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + + // classes + class InvalidClass { + constructor(invalidConstructorArgType: unique symbol) {} + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + + readonly invalidReadonlyPropertyType: unique symbol; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. + invalidPropertyType: unique symbol; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. + invalidArgType(arg: unique symbol): void { return; } + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + invalidRestArgType(...args: (unique symbol)[]): void { return; } + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + invalidReturnType(): unique symbol { return; } + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + invalidThisType(this: unique symbol): void { return; } + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + invalidTypePredicate(n: any): n is unique symbol { return; } + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + invalidTypeParameterConstraint(): void { return; } + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + invalidTypeParameterDefault(): void { return; } + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + get invalidGetter(): unique symbol { return; } + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + set invalidSetter(arg: unique symbol) { return; } + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + + static invalidStaticPropertyType: unique symbol; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1331: A property of a class whose type is a 'unique symbol' type must be both 'static' and 'readonly'. + static invalidStaticArgType(arg: unique symbol): void { return; } + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + static invalidStaticRestArgType(...args: (unique symbol)[]): void { return; } + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + static invalidStaticReturnType(): unique symbol { return; } + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + static invalidStaticThisType(this: unique symbol): void { return; } + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + static invalidStaticTypePredicate(n: any): n is unique symbol { return; } + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + static invalidStaticTypeParameterConstraint(): void { return; } + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + static invalidStaticTypeParameterDefault(): void { return; } + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + static get invalidStaticGetter(): unique symbol { return; } + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + static set invalidStaticSetter(arg: unique symbol) { return; } + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + } + + // interfaces + interface InvalidInterface { + invalidPropertyType: unique symbol; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS1330: A property of an interface or type literal whose type is a 'unique symbol' type must be 'readonly'. + invalidArgType(arg: unique symbol): void; + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + invalidRestArgType(...args: (unique symbol)[]): void; + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + invalidReturnType(): unique symbol; + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + invalidThisType(this: unique symbol); + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + invalidTypePredicate(n: any): n is unique symbol + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + invalidTypeParameterConstraint(): void; + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + invalidTypeParameterDefault(): void; + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + } + + // type literals + type InvalidTypeLiteral = { + invalidPropertyType: unique symbol; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS1330: A property of an interface or type literal whose type is a 'unique symbol' type must be 'readonly'. + invalidArgType(arg: unique symbol): void; + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + invalidRestArgType(...args: (unique symbol)[]): void; + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + invalidReturnType(): unique symbol; + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + invalidThisType(this: unique symbol); + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + invalidTypePredicate(n: any): n is unique symbol + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + invalidTypeParameterConstraint(): void; + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + invalidTypeParameterDefault(): void; + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + }; + + // type alias + type InvalidAlias = unique symbol; + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + type InvalidAliasTypeParameterConstraint = never; + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + type InvalidAliasTypeParameterDefault = never; + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + + // type references + declare const invalidTypeArgument: Promise; + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + declare const invalidArrayType: (unique symbol)[]; + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + declare const invalidTupleType: [unique symbol]; + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + + // mapped types + declare const invalidMappedType: { [P in string]: unique symbol }; + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + + // unions/intersection + declare const invalidUnion: unique symbol | unique symbol; + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + declare const invalidIntersection: unique symbol | unique symbol; + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + ~~~~~~~~~~~~~ +!!! error TS1335: 'unique symbol' types are not allowed here. + + + \ No newline at end of file diff --git a/tests/baselines/reference/uniqueSymbolsErrors.js b/tests/baselines/reference/uniqueSymbolsErrors.js new file mode 100644 index 0000000000000..f1e1bfaacdcde --- /dev/null +++ b/tests/baselines/reference/uniqueSymbolsErrors.js @@ -0,0 +1,111 @@ +//// [uniqueSymbolsErrors.ts] +// declarations +declare const invalidUniqueType: unique number; +declare const {}: unique symbol; +declare let invalidLetType: unique symbol; +declare var invalidVarType: unique symbol; + +// function arguments and return types +declare function invalidArgType(arg: unique symbol): void; +declare function invalidRestArgType(...arg: (unique symbol)[]): void; +declare function invalidReturnType(): unique symbol; +declare function invalidThisType(this: unique symbol): void; +declare function invalidTypePredicate(n: any): n is unique symbol; +declare function invalidTypeParameterConstraint(): void; +declare function invalidTypeParameterDefault(): void; + +// classes +class InvalidClass { + constructor(invalidConstructorArgType: unique symbol) {} + + readonly invalidReadonlyPropertyType: unique symbol; + invalidPropertyType: unique symbol; + invalidArgType(arg: unique symbol): void { return; } + invalidRestArgType(...args: (unique symbol)[]): void { return; } + invalidReturnType(): unique symbol { return; } + invalidThisType(this: unique symbol): void { return; } + invalidTypePredicate(n: any): n is unique symbol { return; } + invalidTypeParameterConstraint(): void { return; } + invalidTypeParameterDefault(): void { return; } + get invalidGetter(): unique symbol { return; } + set invalidSetter(arg: unique symbol) { return; } + + static invalidStaticPropertyType: unique symbol; + static invalidStaticArgType(arg: unique symbol): void { return; } + static invalidStaticRestArgType(...args: (unique symbol)[]): void { return; } + static invalidStaticReturnType(): unique symbol { return; } + static invalidStaticThisType(this: unique symbol): void { return; } + static invalidStaticTypePredicate(n: any): n is unique symbol { return; } + static invalidStaticTypeParameterConstraint(): void { return; } + static invalidStaticTypeParameterDefault(): void { return; } + static get invalidStaticGetter(): unique symbol { return; } + static set invalidStaticSetter(arg: unique symbol) { return; } +} + +// interfaces +interface InvalidInterface { + invalidPropertyType: unique symbol; + invalidArgType(arg: unique symbol): void; + invalidRestArgType(...args: (unique symbol)[]): void; + invalidReturnType(): unique symbol; + invalidThisType(this: unique symbol); + invalidTypePredicate(n: any): n is unique symbol + invalidTypeParameterConstraint(): void; + invalidTypeParameterDefault(): void; +} + +// type literals +type InvalidTypeLiteral = { + invalidPropertyType: unique symbol; + invalidArgType(arg: unique symbol): void; + invalidRestArgType(...args: (unique symbol)[]): void; + invalidReturnType(): unique symbol; + invalidThisType(this: unique symbol); + invalidTypePredicate(n: any): n is unique symbol + invalidTypeParameterConstraint(): void; + invalidTypeParameterDefault(): void; +}; + +// type alias +type InvalidAlias = unique symbol; +type InvalidAliasTypeParameterConstraint = never; +type InvalidAliasTypeParameterDefault = never; + +// type references +declare const invalidTypeArgument: Promise; +declare const invalidArrayType: (unique symbol)[]; +declare const invalidTupleType: [unique symbol]; + +// mapped types +declare const invalidMappedType: { [P in string]: unique symbol }; + +// unions/intersection +declare const invalidUnion: unique symbol | unique symbol; +declare const invalidIntersection: unique symbol | unique symbol; + + + + +//// [uniqueSymbolsErrors.js] +// classes +class InvalidClass { + constructor(invalidConstructorArgType) { } + invalidArgType(arg) { return; } + invalidRestArgType(...args) { return; } + invalidReturnType() { return; } + invalidThisType() { return; } + invalidTypePredicate(n) { return; } + invalidTypeParameterConstraint() { return; } + invalidTypeParameterDefault() { return; } + get invalidGetter() { return; } + set invalidSetter(arg) { return; } + static invalidStaticArgType(arg) { return; } + static invalidStaticRestArgType(...args) { return; } + static invalidStaticReturnType() { return; } + static invalidStaticThisType() { return; } + static invalidStaticTypePredicate(n) { return; } + static invalidStaticTypeParameterConstraint() { return; } + static invalidStaticTypeParameterDefault() { return; } + static get invalidStaticGetter() { return; } + static set invalidStaticSetter(arg) { return; } +} diff --git a/tests/baselines/reference/uniqueSymbolsErrors.symbols b/tests/baselines/reference/uniqueSymbolsErrors.symbols new file mode 100644 index 0000000000000..2788870bf7c7d --- /dev/null +++ b/tests/baselines/reference/uniqueSymbolsErrors.symbols @@ -0,0 +1,238 @@ +=== tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts === +// declarations +declare const invalidUniqueType: unique number; +>invalidUniqueType : Symbol(invalidUniqueType, Decl(uniqueSymbolsErrors.ts, 1, 13)) + +declare const {}: unique symbol; +declare let invalidLetType: unique symbol; +>invalidLetType : Symbol(invalidLetType, Decl(uniqueSymbolsErrors.ts, 3, 11)) + +declare var invalidVarType: unique symbol; +>invalidVarType : Symbol(invalidVarType, Decl(uniqueSymbolsErrors.ts, 4, 11)) + +// function arguments and return types +declare function invalidArgType(arg: unique symbol): void; +>invalidArgType : Symbol(invalidArgType, Decl(uniqueSymbolsErrors.ts, 4, 42)) +>arg : Symbol(arg, Decl(uniqueSymbolsErrors.ts, 7, 32)) + +declare function invalidRestArgType(...arg: (unique symbol)[]): void; +>invalidRestArgType : Symbol(invalidRestArgType, Decl(uniqueSymbolsErrors.ts, 7, 58)) +>arg : Symbol(arg, Decl(uniqueSymbolsErrors.ts, 8, 36)) + +declare function invalidReturnType(): unique symbol; +>invalidReturnType : Symbol(invalidReturnType, Decl(uniqueSymbolsErrors.ts, 8, 69)) + +declare function invalidThisType(this: unique symbol): void; +>invalidThisType : Symbol(invalidThisType, Decl(uniqueSymbolsErrors.ts, 9, 52)) +>this : Symbol(this, Decl(uniqueSymbolsErrors.ts, 10, 33)) + +declare function invalidTypePredicate(n: any): n is unique symbol; +>invalidTypePredicate : Symbol(invalidTypePredicate, Decl(uniqueSymbolsErrors.ts, 10, 60)) +>n : Symbol(n, Decl(uniqueSymbolsErrors.ts, 11, 38)) +>n : Symbol(n, Decl(uniqueSymbolsErrors.ts, 11, 38)) + +declare function invalidTypeParameterConstraint(): void; +>invalidTypeParameterConstraint : Symbol(invalidTypeParameterConstraint, Decl(uniqueSymbolsErrors.ts, 11, 66)) +>T : Symbol(T, Decl(uniqueSymbolsErrors.ts, 12, 48)) + +declare function invalidTypeParameterDefault(): void; +>invalidTypeParameterDefault : Symbol(invalidTypeParameterDefault, Decl(uniqueSymbolsErrors.ts, 12, 81)) +>T : Symbol(T, Decl(uniqueSymbolsErrors.ts, 13, 45)) + +// classes +class InvalidClass { +>InvalidClass : Symbol(InvalidClass, Decl(uniqueSymbolsErrors.ts, 13, 72)) + + constructor(invalidConstructorArgType: unique symbol) {} +>invalidConstructorArgType : Symbol(invalidConstructorArgType, Decl(uniqueSymbolsErrors.ts, 17, 16)) + + readonly invalidReadonlyPropertyType: unique symbol; +>invalidReadonlyPropertyType : Symbol(InvalidClass.invalidReadonlyPropertyType, Decl(uniqueSymbolsErrors.ts, 17, 60)) + + invalidPropertyType: unique symbol; +>invalidPropertyType : Symbol(InvalidClass.invalidPropertyType, Decl(uniqueSymbolsErrors.ts, 19, 56)) + + invalidArgType(arg: unique symbol): void { return; } +>invalidArgType : Symbol(InvalidClass.invalidArgType, Decl(uniqueSymbolsErrors.ts, 20, 39)) +>arg : Symbol(arg, Decl(uniqueSymbolsErrors.ts, 21, 19)) + + invalidRestArgType(...args: (unique symbol)[]): void { return; } +>invalidRestArgType : Symbol(InvalidClass.invalidRestArgType, Decl(uniqueSymbolsErrors.ts, 21, 56)) +>args : Symbol(args, Decl(uniqueSymbolsErrors.ts, 22, 23)) + + invalidReturnType(): unique symbol { return; } +>invalidReturnType : Symbol(InvalidClass.invalidReturnType, Decl(uniqueSymbolsErrors.ts, 22, 68)) + + invalidThisType(this: unique symbol): void { return; } +>invalidThisType : Symbol(InvalidClass.invalidThisType, Decl(uniqueSymbolsErrors.ts, 23, 50)) +>this : Symbol(this, Decl(uniqueSymbolsErrors.ts, 24, 20)) + + invalidTypePredicate(n: any): n is unique symbol { return; } +>invalidTypePredicate : Symbol(InvalidClass.invalidTypePredicate, Decl(uniqueSymbolsErrors.ts, 24, 58)) +>n : Symbol(n, Decl(uniqueSymbolsErrors.ts, 25, 25)) +>n : Symbol(n, Decl(uniqueSymbolsErrors.ts, 25, 25)) + + invalidTypeParameterConstraint(): void { return; } +>invalidTypeParameterConstraint : Symbol(InvalidClass.invalidTypeParameterConstraint, Decl(uniqueSymbolsErrors.ts, 25, 64)) +>T : Symbol(T, Decl(uniqueSymbolsErrors.ts, 26, 35)) + + invalidTypeParameterDefault(): void { return; } +>invalidTypeParameterDefault : Symbol(InvalidClass.invalidTypeParameterDefault, Decl(uniqueSymbolsErrors.ts, 26, 79)) +>T : Symbol(T, Decl(uniqueSymbolsErrors.ts, 27, 32)) + + get invalidGetter(): unique symbol { return; } +>invalidGetter : Symbol(InvalidClass.invalidGetter, Decl(uniqueSymbolsErrors.ts, 27, 70)) + + set invalidSetter(arg: unique symbol) { return; } +>invalidSetter : Symbol(InvalidClass.invalidSetter, Decl(uniqueSymbolsErrors.ts, 28, 50)) +>arg : Symbol(arg, Decl(uniqueSymbolsErrors.ts, 29, 22)) + + static invalidStaticPropertyType: unique symbol; +>invalidStaticPropertyType : Symbol(InvalidClass.invalidStaticPropertyType, Decl(uniqueSymbolsErrors.ts, 29, 53)) + + static invalidStaticArgType(arg: unique symbol): void { return; } +>invalidStaticArgType : Symbol(InvalidClass.invalidStaticArgType, Decl(uniqueSymbolsErrors.ts, 31, 52)) +>arg : Symbol(arg, Decl(uniqueSymbolsErrors.ts, 32, 32)) + + static invalidStaticRestArgType(...args: (unique symbol)[]): void { return; } +>invalidStaticRestArgType : Symbol(InvalidClass.invalidStaticRestArgType, Decl(uniqueSymbolsErrors.ts, 32, 69)) +>args : Symbol(args, Decl(uniqueSymbolsErrors.ts, 33, 36)) + + static invalidStaticReturnType(): unique symbol { return; } +>invalidStaticReturnType : Symbol(InvalidClass.invalidStaticReturnType, Decl(uniqueSymbolsErrors.ts, 33, 81)) + + static invalidStaticThisType(this: unique symbol): void { return; } +>invalidStaticThisType : Symbol(InvalidClass.invalidStaticThisType, Decl(uniqueSymbolsErrors.ts, 34, 63)) +>this : Symbol(this, Decl(uniqueSymbolsErrors.ts, 35, 33)) + + static invalidStaticTypePredicate(n: any): n is unique symbol { return; } +>invalidStaticTypePredicate : Symbol(InvalidClass.invalidStaticTypePredicate, Decl(uniqueSymbolsErrors.ts, 35, 71)) +>n : Symbol(n, Decl(uniqueSymbolsErrors.ts, 36, 38)) +>n : Symbol(n, Decl(uniqueSymbolsErrors.ts, 36, 38)) + + static invalidStaticTypeParameterConstraint(): void { return; } +>invalidStaticTypeParameterConstraint : Symbol(InvalidClass.invalidStaticTypeParameterConstraint, Decl(uniqueSymbolsErrors.ts, 36, 77)) +>T : Symbol(T, Decl(uniqueSymbolsErrors.ts, 37, 48)) + + static invalidStaticTypeParameterDefault(): void { return; } +>invalidStaticTypeParameterDefault : Symbol(InvalidClass.invalidStaticTypeParameterDefault, Decl(uniqueSymbolsErrors.ts, 37, 92)) +>T : Symbol(T, Decl(uniqueSymbolsErrors.ts, 38, 45)) + + static get invalidStaticGetter(): unique symbol { return; } +>invalidStaticGetter : Symbol(InvalidClass.invalidStaticGetter, Decl(uniqueSymbolsErrors.ts, 38, 83)) + + static set invalidStaticSetter(arg: unique symbol) { return; } +>invalidStaticSetter : Symbol(InvalidClass.invalidStaticSetter, Decl(uniqueSymbolsErrors.ts, 39, 63)) +>arg : Symbol(arg, Decl(uniqueSymbolsErrors.ts, 40, 35)) +} + +// interfaces +interface InvalidInterface { +>InvalidInterface : Symbol(InvalidInterface, Decl(uniqueSymbolsErrors.ts, 41, 1)) + + invalidPropertyType: unique symbol; +>invalidPropertyType : Symbol(InvalidInterface.invalidPropertyType, Decl(uniqueSymbolsErrors.ts, 44, 28)) + + invalidArgType(arg: unique symbol): void; +>invalidArgType : Symbol(InvalidInterface.invalidArgType, Decl(uniqueSymbolsErrors.ts, 45, 39)) +>arg : Symbol(arg, Decl(uniqueSymbolsErrors.ts, 46, 19)) + + invalidRestArgType(...args: (unique symbol)[]): void; +>invalidRestArgType : Symbol(InvalidInterface.invalidRestArgType, Decl(uniqueSymbolsErrors.ts, 46, 45)) +>args : Symbol(args, Decl(uniqueSymbolsErrors.ts, 47, 23)) + + invalidReturnType(): unique symbol; +>invalidReturnType : Symbol(InvalidInterface.invalidReturnType, Decl(uniqueSymbolsErrors.ts, 47, 57)) + + invalidThisType(this: unique symbol); +>invalidThisType : Symbol(InvalidInterface.invalidThisType, Decl(uniqueSymbolsErrors.ts, 48, 39)) +>this : Symbol(this, Decl(uniqueSymbolsErrors.ts, 49, 20)) + + invalidTypePredicate(n: any): n is unique symbol +>invalidTypePredicate : Symbol(InvalidInterface.invalidTypePredicate, Decl(uniqueSymbolsErrors.ts, 49, 41)) +>n : Symbol(n, Decl(uniqueSymbolsErrors.ts, 50, 25)) +>n : Symbol(n, Decl(uniqueSymbolsErrors.ts, 50, 25)) + + invalidTypeParameterConstraint(): void; +>invalidTypeParameterConstraint : Symbol(InvalidInterface.invalidTypeParameterConstraint, Decl(uniqueSymbolsErrors.ts, 50, 52)) +>T : Symbol(T, Decl(uniqueSymbolsErrors.ts, 51, 35)) + + invalidTypeParameterDefault(): void; +>invalidTypeParameterDefault : Symbol(InvalidInterface.invalidTypeParameterDefault, Decl(uniqueSymbolsErrors.ts, 51, 68)) +>T : Symbol(T, Decl(uniqueSymbolsErrors.ts, 52, 32)) +} + +// type literals +type InvalidTypeLiteral = { +>InvalidTypeLiteral : Symbol(InvalidTypeLiteral, Decl(uniqueSymbolsErrors.ts, 53, 1)) + + invalidPropertyType: unique symbol; +>invalidPropertyType : Symbol(invalidPropertyType, Decl(uniqueSymbolsErrors.ts, 56, 27)) + + invalidArgType(arg: unique symbol): void; +>invalidArgType : Symbol(invalidArgType, Decl(uniqueSymbolsErrors.ts, 57, 39)) +>arg : Symbol(arg, Decl(uniqueSymbolsErrors.ts, 58, 19)) + + invalidRestArgType(...args: (unique symbol)[]): void; +>invalidRestArgType : Symbol(invalidRestArgType, Decl(uniqueSymbolsErrors.ts, 58, 45)) +>args : Symbol(args, Decl(uniqueSymbolsErrors.ts, 59, 23)) + + invalidReturnType(): unique symbol; +>invalidReturnType : Symbol(invalidReturnType, Decl(uniqueSymbolsErrors.ts, 59, 57)) + + invalidThisType(this: unique symbol); +>invalidThisType : Symbol(invalidThisType, Decl(uniqueSymbolsErrors.ts, 60, 39)) +>this : Symbol(this, Decl(uniqueSymbolsErrors.ts, 61, 20)) + + invalidTypePredicate(n: any): n is unique symbol +>invalidTypePredicate : Symbol(invalidTypePredicate, Decl(uniqueSymbolsErrors.ts, 61, 41)) +>n : Symbol(n, Decl(uniqueSymbolsErrors.ts, 62, 25)) +>n : Symbol(n, Decl(uniqueSymbolsErrors.ts, 62, 25)) + + invalidTypeParameterConstraint(): void; +>invalidTypeParameterConstraint : Symbol(invalidTypeParameterConstraint, Decl(uniqueSymbolsErrors.ts, 62, 52)) +>T : Symbol(T, Decl(uniqueSymbolsErrors.ts, 63, 35)) + + invalidTypeParameterDefault(): void; +>invalidTypeParameterDefault : Symbol(invalidTypeParameterDefault, Decl(uniqueSymbolsErrors.ts, 63, 68)) +>T : Symbol(T, Decl(uniqueSymbolsErrors.ts, 64, 32)) + +}; + +// type alias +type InvalidAlias = unique symbol; +>InvalidAlias : Symbol(InvalidAlias, Decl(uniqueSymbolsErrors.ts, 65, 2)) + +type InvalidAliasTypeParameterConstraint = never; +>InvalidAliasTypeParameterConstraint : Symbol(InvalidAliasTypeParameterConstraint, Decl(uniqueSymbolsErrors.ts, 68, 34)) +>T : Symbol(T, Decl(uniqueSymbolsErrors.ts, 69, 41)) + +type InvalidAliasTypeParameterDefault = never; +>InvalidAliasTypeParameterDefault : Symbol(InvalidAliasTypeParameterDefault, Decl(uniqueSymbolsErrors.ts, 69, 74)) +>T : Symbol(T, Decl(uniqueSymbolsErrors.ts, 70, 38)) + +// type references +declare const invalidTypeArgument: Promise; +>invalidTypeArgument : Symbol(invalidTypeArgument, Decl(uniqueSymbolsErrors.ts, 73, 13)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +declare const invalidArrayType: (unique symbol)[]; +>invalidArrayType : Symbol(invalidArrayType, Decl(uniqueSymbolsErrors.ts, 74, 13)) + +declare const invalidTupleType: [unique symbol]; +>invalidTupleType : Symbol(invalidTupleType, Decl(uniqueSymbolsErrors.ts, 75, 13)) + +// mapped types +declare const invalidMappedType: { [P in string]: unique symbol }; +>invalidMappedType : Symbol(invalidMappedType, Decl(uniqueSymbolsErrors.ts, 78, 13)) +>P : Symbol(P, Decl(uniqueSymbolsErrors.ts, 78, 36)) + +// unions/intersection +declare const invalidUnion: unique symbol | unique symbol; +>invalidUnion : Symbol(invalidUnion, Decl(uniqueSymbolsErrors.ts, 81, 13)) + +declare const invalidIntersection: unique symbol | unique symbol; +>invalidIntersection : Symbol(invalidIntersection, Decl(uniqueSymbolsErrors.ts, 82, 13)) + + + diff --git a/tests/baselines/reference/uniqueSymbolsErrors.types b/tests/baselines/reference/uniqueSymbolsErrors.types new file mode 100644 index 0000000000000..20eda66b9ef8f --- /dev/null +++ b/tests/baselines/reference/uniqueSymbolsErrors.types @@ -0,0 +1,238 @@ +=== tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts === +// declarations +declare const invalidUniqueType: unique number; +>invalidUniqueType : any + +declare const {}: unique symbol; +declare let invalidLetType: unique symbol; +>invalidLetType : symbol + +declare var invalidVarType: unique symbol; +>invalidVarType : symbol + +// function arguments and return types +declare function invalidArgType(arg: unique symbol): void; +>invalidArgType : (arg: symbol) => void +>arg : symbol + +declare function invalidRestArgType(...arg: (unique symbol)[]): void; +>invalidRestArgType : (...arg: symbol[]) => void +>arg : symbol[] + +declare function invalidReturnType(): unique symbol; +>invalidReturnType : () => symbol + +declare function invalidThisType(this: unique symbol): void; +>invalidThisType : (this: symbol) => void +>this : symbol + +declare function invalidTypePredicate(n: any): n is unique symbol; +>invalidTypePredicate : (n: any) => n is symbol +>n : any +>n : any + +declare function invalidTypeParameterConstraint(): void; +>invalidTypeParameterConstraint : () => void +>T : T + +declare function invalidTypeParameterDefault(): void; +>invalidTypeParameterDefault : () => void +>T : T + +// classes +class InvalidClass { +>InvalidClass : InvalidClass + + constructor(invalidConstructorArgType: unique symbol) {} +>invalidConstructorArgType : symbol + + readonly invalidReadonlyPropertyType: unique symbol; +>invalidReadonlyPropertyType : symbol + + invalidPropertyType: unique symbol; +>invalidPropertyType : symbol + + invalidArgType(arg: unique symbol): void { return; } +>invalidArgType : (arg: symbol) => void +>arg : symbol + + invalidRestArgType(...args: (unique symbol)[]): void { return; } +>invalidRestArgType : (...args: symbol[]) => void +>args : symbol[] + + invalidReturnType(): unique symbol { return; } +>invalidReturnType : () => symbol + + invalidThisType(this: unique symbol): void { return; } +>invalidThisType : (this: symbol) => void +>this : symbol + + invalidTypePredicate(n: any): n is unique symbol { return; } +>invalidTypePredicate : (n: any) => n is symbol +>n : any +>n : any + + invalidTypeParameterConstraint(): void { return; } +>invalidTypeParameterConstraint : () => void +>T : T + + invalidTypeParameterDefault(): void { return; } +>invalidTypeParameterDefault : () => void +>T : T + + get invalidGetter(): unique symbol { return; } +>invalidGetter : symbol + + set invalidSetter(arg: unique symbol) { return; } +>invalidSetter : symbol +>arg : symbol + + static invalidStaticPropertyType: unique symbol; +>invalidStaticPropertyType : symbol + + static invalidStaticArgType(arg: unique symbol): void { return; } +>invalidStaticArgType : (arg: symbol) => void +>arg : symbol + + static invalidStaticRestArgType(...args: (unique symbol)[]): void { return; } +>invalidStaticRestArgType : (...args: symbol[]) => void +>args : symbol[] + + static invalidStaticReturnType(): unique symbol { return; } +>invalidStaticReturnType : () => symbol + + static invalidStaticThisType(this: unique symbol): void { return; } +>invalidStaticThisType : (this: symbol) => void +>this : symbol + + static invalidStaticTypePredicate(n: any): n is unique symbol { return; } +>invalidStaticTypePredicate : (n: any) => n is symbol +>n : any +>n : any + + static invalidStaticTypeParameterConstraint(): void { return; } +>invalidStaticTypeParameterConstraint : () => void +>T : T + + static invalidStaticTypeParameterDefault(): void { return; } +>invalidStaticTypeParameterDefault : () => void +>T : T + + static get invalidStaticGetter(): unique symbol { return; } +>invalidStaticGetter : symbol + + static set invalidStaticSetter(arg: unique symbol) { return; } +>invalidStaticSetter : symbol +>arg : symbol +} + +// interfaces +interface InvalidInterface { +>InvalidInterface : InvalidInterface + + invalidPropertyType: unique symbol; +>invalidPropertyType : symbol + + invalidArgType(arg: unique symbol): void; +>invalidArgType : (arg: symbol) => void +>arg : symbol + + invalidRestArgType(...args: (unique symbol)[]): void; +>invalidRestArgType : (...args: symbol[]) => void +>args : symbol[] + + invalidReturnType(): unique symbol; +>invalidReturnType : () => symbol + + invalidThisType(this: unique symbol); +>invalidThisType : (this: symbol) => any +>this : symbol + + invalidTypePredicate(n: any): n is unique symbol +>invalidTypePredicate : (n: any) => n is symbol +>n : any +>n : any + + invalidTypeParameterConstraint(): void; +>invalidTypeParameterConstraint : () => void +>T : T + + invalidTypeParameterDefault(): void; +>invalidTypeParameterDefault : () => void +>T : T +} + +// type literals +type InvalidTypeLiteral = { +>InvalidTypeLiteral : InvalidTypeLiteral + + invalidPropertyType: unique symbol; +>invalidPropertyType : symbol + + invalidArgType(arg: unique symbol): void; +>invalidArgType : (arg: symbol) => void +>arg : symbol + + invalidRestArgType(...args: (unique symbol)[]): void; +>invalidRestArgType : (...args: symbol[]) => void +>args : symbol[] + + invalidReturnType(): unique symbol; +>invalidReturnType : () => symbol + + invalidThisType(this: unique symbol); +>invalidThisType : (this: symbol) => any +>this : symbol + + invalidTypePredicate(n: any): n is unique symbol +>invalidTypePredicate : (n: any) => n is symbol +>n : any +>n : any + + invalidTypeParameterConstraint(): void; +>invalidTypeParameterConstraint : () => void +>T : T + + invalidTypeParameterDefault(): void; +>invalidTypeParameterDefault : () => void +>T : T + +}; + +// type alias +type InvalidAlias = unique symbol; +>InvalidAlias : symbol + +type InvalidAliasTypeParameterConstraint = never; +>InvalidAliasTypeParameterConstraint : never +>T : T + +type InvalidAliasTypeParameterDefault = never; +>InvalidAliasTypeParameterDefault : never +>T : T + +// type references +declare const invalidTypeArgument: Promise; +>invalidTypeArgument : Promise +>Promise : Promise + +declare const invalidArrayType: (unique symbol)[]; +>invalidArrayType : symbol[] + +declare const invalidTupleType: [unique symbol]; +>invalidTupleType : [symbol] + +// mapped types +declare const invalidMappedType: { [P in string]: unique symbol }; +>invalidMappedType : { [x: string]: symbol; } +>P : P + +// unions/intersection +declare const invalidUnion: unique symbol | unique symbol; +>invalidUnion : symbol + +declare const invalidIntersection: unique symbol | unique symbol; +>invalidIntersection : symbol + + + diff --git a/tests/cases/compiler/dynamicNames.ts b/tests/cases/compiler/dynamicNames.ts new file mode 100644 index 0000000000000..9562685b08f7a --- /dev/null +++ b/tests/cases/compiler/dynamicNames.ts @@ -0,0 +1,153 @@ +// @target: esnext +// @lib: esnext +// @module: commonjs +// @declaration: true +// @filename: module.ts +export const c0 = "a"; +export const c1 = 1; +export const s0 = Symbol(); +export interface T0 { + [c0]: number; + [c1]: string; + [s0]: boolean; +} +export declare class T1 implements T2 { + [c0]: number; + [c1]: string; + [s0]: boolean; +} +export declare class T2 extends T1 { +} +export declare type T3 = { + [c0]: number; + [c1]: string; + [s0]: boolean; +}; + +// @filename: main.ts +import { c0, c1, s0, T0, T1, T2, T3 } from "./module"; +import * as M from "./module"; + +namespace N { + export const c2 = "a"; + export const c3 = 1; + export const s1: typeof s0 = s0; + + export interface T4 { + [N.c2]: number; + [N.c3]: string; + [N.s1]: boolean; + } + export declare class T5 implements T4 { + [N.c2]: number; + [N.c3]: string; + [N.s1]: boolean; + } + export declare class T6 extends T5 { + } + export declare type T7 = { + [N.c2]: number; + [N.c3]: string; + [N.s1]: boolean; + }; +} + +export const c4 = "a"; +export const c5 = 1; +export const s2: typeof s0 = s0; + +interface T8 { + [c4]: number; + [c5]: string; + [s2]: boolean; +} +declare class T9 implements T8 { + [c4]: number; + [c5]: string; + [s2]: boolean; +} +declare class T10 extends T9 { +} +declare type T11 = { + [c4]: number; + [c5]: string; + [s2]: boolean; +}; + +interface T12 { + a: number; + 1: string; + [s2]: boolean; +} +declare class T13 implements T2 { + a: number; + 1: string; + [s2]: boolean; +} +declare class T14 extends T13 { +} +declare type T15 = { + a: number; + 1: string; + [s2]: boolean; +}; + +declare class C { + static a: number; + static 1: string; + static [s2]: boolean; +} + +let t0: T0; +let t1: T1; +let t2: T2; +let t3: T3; +let t0_1: M.T0; +let t1_1: M.T1; +let t2_1: M.T2; +let t3_1: M.T3; +let t4: N.T4; +let t5: N.T5; +let t6: N.T6; +let t7: N.T7; +let t8: T8; +let t9: T9; +let t10: T10; +let t11: T11; +let t12: T12; +let t13: T13; +let t14: T14; +let t15: T15; + +// assignability +t0 = t1, t0 = t2, t0 = t3, t1 = t0, t1 = t2, t1 = t3, t2 = t0, t2 = t1, t2 = t3, t3 = t0, t3 = t1, t3 = t2; +t4 = t5, t4 = t6, t4 = t7, t5 = t4, t5 = t6, t5 = t7, t6 = t4, t6 = t5, t6 = t7, t7 = t4, t7 = t5, t7 = t6; +t0 = t12, t0 = t13, t0 = t14, t0 = t15, t12 = t0, t13 = t0, t14 = t0, t15 = t0; +t0 = C; // static side + +// object literals +export const o1 = { + [c4]: 1, + [c5]: "a", + [s2]: true +}; + +// check element access types +export const o1_c4 = o1[c4]; +export const o1_c5 = o1[c5]; +export const o1_s2 = o1[s2]; + +export const o2: T0 = o1; + +// recursive declarations +declare const rI: RI; +interface RI { + x: "a"; + [rI.x]: "b"; +} + +declare const rC: RC; +declare class RC { + x: "a"; + [rC.x]: "b"; +} \ No newline at end of file diff --git a/tests/cases/compiler/dynamicNamesErrors.ts b/tests/cases/compiler/dynamicNamesErrors.ts new file mode 100644 index 0000000000000..daeb5cb600b93 --- /dev/null +++ b/tests/cases/compiler/dynamicNamesErrors.ts @@ -0,0 +1,62 @@ +// @target: esnext +// @module: commonjs +// @declaration: true +const c0 = "1"; +const c1 = 1; + +interface T0 { + [c0]: number; + 1: number; +} + +interface T1 { + [c0]: number; +} + +interface T2 { + [c0]: string; +} + +interface T3 { + [c0]: number; + [c1]: string; +} + +let t1: T1; +let t2: T2; +t1 = t2; +t2 = t1; + +const x = Symbol(); +const y = Symbol(); +const z = Symbol(); +const w = Symbol(); + +export interface InterfaceMemberVisibility { + [x]: number; + [y](): number; +} + +export class ClassMemberVisibility { + static [x]: number; + static [y](): number { return 0; } + static get [z](): number { return 0; } + static set [w](value: number) { } + + [x]: number; + [y](): number { return 0; } + get [z](): number { return 0; } + set [w](value: number) { } +} + +export type ObjectTypeVisibility = { + [x]: number; + [y](): number; +}; + +export const ObjectLiteralVisibility = { + [x]: 0, + [y](): number { return 0; }, + get [z](): number { return 0; }, + set [w](value: number) { }, +}; \ No newline at end of file diff --git a/tests/cases/conformance/types/uniqueSymbol/uniqueSymbols.ts b/tests/cases/conformance/types/uniqueSymbol/uniqueSymbols.ts new file mode 100644 index 0000000000000..498a1c2904d2c --- /dev/null +++ b/tests/cases/conformance/types/uniqueSymbol/uniqueSymbols.ts @@ -0,0 +1,266 @@ +// @target: esnext +// @lib: esnext +// @declaration: false + +// declarations with call initializer +const constCall = Symbol(); +let letCall = Symbol(); +var varCall = Symbol(); + +// ambient declaration with type +declare const constType: unique symbol; + +// declaration with type and call initializer +const constTypeAndCall: unique symbol = Symbol(); + +// declaration from initializer +const constInitToConstCall = constCall; +const constInitToLetCall = letCall; +const constInitToVarCall = varCall; +const constInitToConstDeclAmbient = constType; +let letInitToConstCall = constCall; +let letInitToLetCall = letCall; +let letInitToVarCall = varCall; +let letInitToConstDeclAmbient = constType; +var varInitToConstCall = constCall; +var varInitToLetCall = letCall; +var varInitToVarCall = varCall; +var varInitToConstDeclAmbient = constType; + +// declaration from initializer with type query +const constInitToConstCallWithTypeQuery: typeof constCall = constCall; +const constInitToConstDeclAmbientWithTypeQuery: typeof constType = constType; + +// function return inference +function funcReturnConstCall() { return constCall; } +function funcReturnLetCall() { return letCall; } +function funcReturnVarCall() { return varCall; } + +// function return value with type query +function funcReturnConstCallWithTypeQuery(): typeof constCall { return constCall; } + +// generator function yield inference +function* genFuncYieldConstCall() { yield constCall; } +function* genFuncYieldLetCall() { yield letCall; } +function* genFuncYieldVarCall() { yield varCall; } + +// generator function yield with return type query +function* genFuncYieldConstCallWithTypeQuery(): IterableIterator { yield constCall; } + +// async function return inference +async function asyncFuncReturnConstCall() { return constCall; } +async function asyncFuncReturnLetCall() { return letCall; } +async function asyncFuncReturnVarCall() { return varCall; } + +// async generator function yield inference +async function* asyncGenFuncYieldConstCall() { yield constCall; } +async function* asyncGenFuncYieldLetCall() { yield letCall; } +async function* asyncGenFuncYieldVarCall() { yield varCall; } + +// classes +class C { + static readonly readonlyStaticCall = Symbol(); + static readonly readonlyStaticType: unique symbol; + static readonly readonlyStaticTypeAndCall: unique symbol = Symbol(); + static readwriteStaticCall = Symbol(); + + readonly readonlyCall = Symbol(); + readwriteCall = Symbol(); +} +declare const c: C; + +const constInitToCReadonlyStaticCall = C.readonlyStaticCall; +const constInitToCReadonlyStaticType = C.readonlyStaticType; +const constInitToCReadonlyStaticTypeAndCall = C.readonlyStaticTypeAndCall; +const constInitToCReadwriteStaticCall = C.readwriteStaticCall; + +const constInitToCReadonlyStaticCallWithTypeQuery: typeof C.readonlyStaticCall = C.readonlyStaticCall; +const constInitToCReadonlyStaticTypeWithTypeQuery: typeof C.readonlyStaticType = C.readonlyStaticType; +const constInitToCReadonlyStaticTypeAndCallWithTypeQuery: typeof C.readonlyStaticTypeAndCall = C.readonlyStaticTypeAndCall; +const constInitToCReadwriteStaticCallWithTypeQuery: typeof C.readwriteStaticCall = C.readwriteStaticCall; + +const constInitToCReadonlyCall = c.readonlyCall; +const constInitToCReadwriteCall = c.readwriteCall; +const constInitToCReadonlyCallWithTypeQuery: typeof c.readonlyCall = c.readonlyCall; +const constInitToCReadwriteCallWithTypeQuery: typeof c.readwriteCall = c.readwriteCall; +const constInitToCReadonlyCallWithIndexedAccess: C["readonlyCall"] = c.readonlyCall; +const constInitToCReadwriteCallWithIndexedAccess: C["readwriteCall"] = c.readwriteCall; + +// interfaces +interface I { + readonly readonlyType: unique symbol; +} +declare const i: I; + +const constInitToIReadonlyType = i.readonlyType; +const constInitToIReadonlyTypeWithTypeQuery: typeof i.readonlyType = i.readonlyType; +const constInitToIReadonlyTypeWithIndexedAccess: I["readonlyType"] = i.readonlyType; + +// type literals +type L = { + readonly readonlyType: unique symbol; + nested: { + readonly readonlyNestedType: unique symbol; + } +}; +declare const l: L; + +const constInitToLReadonlyType = l.readonlyType; +const constInitToLReadonlyNestedType = l.nested.readonlyNestedType; +const constInitToLReadonlyTypeWithTypeQuery: typeof l.readonlyType = l.readonlyType; +const constInitToLReadonlyNestedTypeWithTypeQuery: typeof l.nested.readonlyNestedType = l.nested.readonlyNestedType; +const constInitToLReadonlyTypeWithIndexedAccess: L["readonlyType"] = l.readonlyType; +const constInitToLReadonlyNestedTypeWithIndexedAccess: L["nested"]["readonlyNestedType"] = l.nested.readonlyNestedType; + +// type argument inference +const promiseForConstCall = Promise.resolve(constCall); +const arrayOfConstCall = [constCall]; + +// unique symbol widening in expressions +declare const s: unique symbol; +declare namespace N { const s: unique symbol; } +declare const o: { [s]: "a", [N.s]: "b" }; +declare function f(x: T): T; +declare function g(x: typeof s): void; +declare function g(x: typeof N.s): void; + +// widening positions + +// argument inference +f(s); +f(N.s); +f(N["s"]); + +// array literal elements +[s]; +[N.s]; +[N["s"]]; + +// property assignments/methods +const o2 = { + a: s, + b: N.s, + c: N["s"], + + method1() { return s; }, + async method2() { return s; }, + async * method3() { yield s; }, + * method4() { yield s; }, + method5(p = s) { return p; }, +}; + +// property initializers +class C0 { + static readonly a = s; + static readonly b = N.s; + static readonly c = N["s"]; + + static d = s; + static e = N.s; + static f = N["s"]; + + readonly a = s; + readonly b = N.s; + readonly c = N["s"]; + + d = s; + e = N.s; + f = N["s"]; + + method1() { return s; } + async method2() { return s; } + async * method3() { yield s; } + * method4() { yield s; } + method5(p = s) { return p; } +} + +// non-widening positions + +// element access +o[s]; +o[N.s]; +o[N["s"]]; + +// arguments (no-inference) +f(s); +f(N.s); +f(N["s"]); +g(s); +g(N.s); +g(N["s"]); + +// falsy expressions +s || ""; +N.s || ""; +N["s"] || ""; + +// conditionals +Math.random() * 2 ? s : "a"; +Math.random() * 2 ? N.s : "a"; +Math.random() * 2 ? N["s"] : "a"; + +// computed property names +({ + [s]: "a", + [N.s]: "b", +}); + +class C1 { + static [s]: "a"; + static [N.s]: "b"; + + [s]: "a"; + [N.s]: "b"; +} + +// contextual types + +interface Context { + method1(): typeof s; + method2(): Promise; + method3(): AsyncIterableIterator; + method4(): IterableIterator; + method5(p?: typeof s): typeof s; +} + +const o3: Context = { + method1() { + return s; // return type should not widen due to contextual type + }, + async method2() { + return s; // return type should not widen due to contextual type + }, + async * method3() { + yield s; // yield type should not widen due to contextual type + }, + * method4() { + yield s; // yield type should not widen due to contextual type + }, + method5(p = s) { // parameter should not widen due to contextual type + return p; + }, +}; + +// allowed when not emitting declarations + +const o4 = { + method1(p: typeof s): typeof s { + return p; + }, + method2(p: I["readonlyType"]): I["readonlyType"] { + return p; + } +}; + +const ce0 = class { + method1(p: typeof s): typeof s { + return p; + } + method2(p: I["readonlyType"]): I["readonlyType"] { + return p; + } +}; + +function funcInferredReturnType(obj: { method(p: typeof s): void }) { + return obj; +} diff --git a/tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarations.ts b/tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarations.ts new file mode 100644 index 0000000000000..b097e290e8fbf --- /dev/null +++ b/tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarations.ts @@ -0,0 +1,242 @@ +// @target: esnext +// @lib: esnext +// @declaration: true + +// declarations with call initializer +const constCall = Symbol(); +let letCall = Symbol(); +var varCall = Symbol(); + +// ambient declaration with type +declare const constType: unique symbol; + +// declaration with type and call initializer +const constTypeAndCall: unique symbol = Symbol(); + +// declaration from initializer +const constInitToConstCall = constCall; +const constInitToLetCall = letCall; +const constInitToVarCall = varCall; +const constInitToConstDeclAmbient = constType; +let letInitToConstCall = constCall; +let letInitToLetCall = letCall; +let letInitToVarCall = varCall; +let letInitToConstDeclAmbient = constType; +var varInitToConstCall = constCall; +var varInitToLetCall = letCall; +var varInitToVarCall = varCall; +var varInitToConstDeclAmbient = constType; + +// declaration from initializer with type query +const constInitToConstCallWithTypeQuery: typeof constCall = constCall; +const constInitToConstDeclAmbientWithTypeQuery: typeof constType = constType; + +// function return inference +function funcReturnConstCall() { return constCall; } +function funcReturnLetCall() { return letCall; } +function funcReturnVarCall() { return varCall; } + +// function return value with type query +function funcReturnConstCallWithTypeQuery(): typeof constCall { return constCall; } + +// generator function yield inference +function* genFuncYieldConstCall() { yield constCall; } +function* genFuncYieldLetCall() { yield letCall; } +function* genFuncYieldVarCall() { yield varCall; } + +// generator function yield with return type query +function* genFuncYieldConstCallWithTypeQuery(): IterableIterator { yield constCall; } + +// async function return inference +async function asyncFuncReturnConstCall() { return constCall; } +async function asyncFuncReturnLetCall() { return letCall; } +async function asyncFuncReturnVarCall() { return varCall; } + +// async generator function yield inference +async function* asyncGenFuncYieldConstCall() { yield constCall; } +async function* asyncGenFuncYieldLetCall() { yield letCall; } +async function* asyncGenFuncYieldVarCall() { yield varCall; } + +// classes +class C { + static readonly readonlyStaticCall = Symbol(); + static readonly readonlyStaticType: unique symbol; + static readonly readonlyStaticTypeAndCall: unique symbol = Symbol(); + static readwriteStaticCall = Symbol(); + + readonly readonlyCall = Symbol(); + readwriteCall = Symbol(); +} +declare const c: C; + +const constInitToCReadonlyStaticCall = C.readonlyStaticCall; +const constInitToCReadonlyStaticType = C.readonlyStaticType; +const constInitToCReadonlyStaticTypeAndCall = C.readonlyStaticTypeAndCall; +const constInitToCReadwriteStaticCall = C.readwriteStaticCall; + +const constInitToCReadonlyStaticCallWithTypeQuery: typeof C.readonlyStaticCall = C.readonlyStaticCall; +const constInitToCReadonlyStaticTypeWithTypeQuery: typeof C.readonlyStaticType = C.readonlyStaticType; +const constInitToCReadonlyStaticTypeAndCallWithTypeQuery: typeof C.readonlyStaticTypeAndCall = C.readonlyStaticTypeAndCall; +const constInitToCReadwriteStaticCallWithTypeQuery: typeof C.readwriteStaticCall = C.readwriteStaticCall; + +const constInitToCReadonlyCall = c.readonlyCall; +const constInitToCReadwriteCall = c.readwriteCall; +const constInitToCReadonlyCallWithTypeQuery: typeof c.readonlyCall = c.readonlyCall; +const constInitToCReadwriteCallWithTypeQuery: typeof c.readwriteCall = c.readwriteCall; +const constInitToCReadonlyCallWithIndexedAccess: C["readonlyCall"] = c.readonlyCall; +const constInitToCReadwriteCallWithIndexedAccess: C["readwriteCall"] = c.readwriteCall; + +// interfaces +interface I { + readonly readonlyType: unique symbol; +} +declare const i: I; + +const constInitToIReadonlyType = i.readonlyType; +const constInitToIReadonlyTypeWithTypeQuery: typeof i.readonlyType = i.readonlyType; +const constInitToIReadonlyTypeWithIndexedAccess: I["readonlyType"] = i.readonlyType; + +// type literals +type L = { + readonly readonlyType: unique symbol; + nested: { + readonly readonlyNestedType: unique symbol; + } +}; +declare const l: L; + +const constInitToLReadonlyType = l.readonlyType; +const constInitToLReadonlyNestedType = l.nested.readonlyNestedType; +const constInitToLReadonlyTypeWithTypeQuery: typeof l.readonlyType = l.readonlyType; +const constInitToLReadonlyNestedTypeWithTypeQuery: typeof l.nested.readonlyNestedType = l.nested.readonlyNestedType; +const constInitToLReadonlyTypeWithIndexedAccess: L["readonlyType"] = l.readonlyType; +const constInitToLReadonlyNestedTypeWithIndexedAccess: L["nested"]["readonlyNestedType"] = l.nested.readonlyNestedType; + +// type argument inference +const promiseForConstCall = Promise.resolve(constCall); +const arrayOfConstCall = [constCall]; + +// unique symbol widening in expressions +declare const s: unique symbol; +declare namespace N { const s: unique symbol; } +declare const o: { [s]: "a", [N.s]: "b" }; +declare function f(x: T): T; +declare function g(x: typeof s): void; +declare function g(x: typeof N.s): void; + +// widening positions + +// argument inference +f(s); +f(N.s); +f(N["s"]); + +// array literal elements +[s]; +[N.s]; +[N["s"]]; + +// property assignments/methods +const o2 = { + a: s, + b: N.s, + c: N["s"], + + method1() { return s; }, + async method2() { return s; }, + async * method3() { yield s; }, + * method4() { yield s; }, + method5(p = s) { return p; } +}; + +// property initializers +class C0 { + static readonly a = s; + static readonly b = N.s; + static readonly c = N["s"]; + + static d = s; + static e = N.s; + static f = N["s"]; + + readonly a = s; + readonly b = N.s; + readonly c = N["s"]; + + d = s; + e = N.s; + f = N["s"]; + + method1() { return s; } + async method2() { return s; } + async * method3() { yield s; } + * method4() { yield s; } + method5(p = s) { return p; } +} + +// non-widening positions + +// element access +o[s]; +o[N.s]; +o[N["s"]]; + +// arguments (no-inference) +f(s); +f(N.s); +f(N["s"]); +g(s); +g(N.s); +g(N["s"]); + +// falsy expressions +s || ""; +N.s || ""; +N["s"] || ""; + +// conditionals +Math.random() * 2 ? s : "a"; +Math.random() * 2 ? N.s : "a"; +Math.random() * 2 ? N["s"] : "a"; + +// computed property names +({ + [s]: "a", + [N.s]: "b", +}); + +class C1 { + static [s]: "a"; + static [N.s]: "b"; + + [s]: "a"; + [N.s]: "b"; +} + +// contextual types + +interface Context { + method1(): typeof s; + method2(): Promise; + method3(): AsyncIterableIterator; + method4(): IterableIterator; + method5(p?: typeof s): typeof s; +} + +const o4: Context = { + method1() { + return s; // return type should not widen due to contextual type + }, + async method2() { + return s; // return type should not widen due to contextual type + }, + async * method3() { + yield s; // yield type should not widen due to contextual type + }, + * method4() { + yield s; // yield type should not widen due to contextual type + }, + method5(p = s) { // parameter should not widen due to contextual type + return p; + } +}; \ No newline at end of file diff --git a/tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarationsErrors.ts b/tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarationsErrors.ts new file mode 100644 index 0000000000000..227dbd9c90d0e --- /dev/null +++ b/tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsDeclarationsErrors.ts @@ -0,0 +1,64 @@ +// @target: esnext +// @lib: esnext +// @module: commonjs +// @declaration: true + +declare const s: unique symbol; +interface I { readonly readonlyType: unique symbol; } + +// not allowed when emitting declarations + +export const obj = { + method1(p: typeof s): typeof s { + return p; + }, + method2(p: I["readonlyType"]): I["readonlyType"] { + return p; + } +}; + +export const classExpression = class { + method1(p: typeof s): typeof s { + return p; + } + method2(p: I["readonlyType"]): I["readonlyType"] { + return p; + } +}; + +export function funcInferredReturnType(obj: { method(p: typeof s): void }) { + return obj; +} + +export interface InterfaceWithPrivateNamedProperties { + [s]: any; +} + +export interface InterfaceWithPrivateNamedMethods { + [s](): any; +} + +export type TypeLiteralWithPrivateNamedProperties = { + [s]: any; +} + +export type TypeLiteralWithPrivateNamedMethods = { + [s](): any; +} + +export class ClassWithPrivateNamedProperties { + [s]: any; + static [s]: any; +} + +export class ClassWithPrivateNamedMethods { + [s]() {} + static [s]() {} +} + +export class ClassWithPrivateNamedAccessors { + get [s](): any { return undefined; } + set [s](v: any) { } + static get [s](): any { return undefined; } + static set [s](v: any) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts b/tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts new file mode 100644 index 0000000000000..505efcc4e14ab --- /dev/null +++ b/tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts @@ -0,0 +1,87 @@ +// @target: esnext + +// declarations +declare const invalidUniqueType: unique number; +declare const {}: unique symbol; +declare let invalidLetType: unique symbol; +declare var invalidVarType: unique symbol; + +// function arguments and return types +declare function invalidArgType(arg: unique symbol): void; +declare function invalidRestArgType(...arg: (unique symbol)[]): void; +declare function invalidReturnType(): unique symbol; +declare function invalidThisType(this: unique symbol): void; +declare function invalidTypePredicate(n: any): n is unique symbol; +declare function invalidTypeParameterConstraint(): void; +declare function invalidTypeParameterDefault(): void; + +// classes +class InvalidClass { + constructor(invalidConstructorArgType: unique symbol) {} + + readonly invalidReadonlyPropertyType: unique symbol; + invalidPropertyType: unique symbol; + invalidArgType(arg: unique symbol): void { return; } + invalidRestArgType(...args: (unique symbol)[]): void { return; } + invalidReturnType(): unique symbol { return; } + invalidThisType(this: unique symbol): void { return; } + invalidTypePredicate(n: any): n is unique symbol { return; } + invalidTypeParameterConstraint(): void { return; } + invalidTypeParameterDefault(): void { return; } + get invalidGetter(): unique symbol { return; } + set invalidSetter(arg: unique symbol) { return; } + + static invalidStaticPropertyType: unique symbol; + static invalidStaticArgType(arg: unique symbol): void { return; } + static invalidStaticRestArgType(...args: (unique symbol)[]): void { return; } + static invalidStaticReturnType(): unique symbol { return; } + static invalidStaticThisType(this: unique symbol): void { return; } + static invalidStaticTypePredicate(n: any): n is unique symbol { return; } + static invalidStaticTypeParameterConstraint(): void { return; } + static invalidStaticTypeParameterDefault(): void { return; } + static get invalidStaticGetter(): unique symbol { return; } + static set invalidStaticSetter(arg: unique symbol) { return; } +} + +// interfaces +interface InvalidInterface { + invalidPropertyType: unique symbol; + invalidArgType(arg: unique symbol): void; + invalidRestArgType(...args: (unique symbol)[]): void; + invalidReturnType(): unique symbol; + invalidThisType(this: unique symbol); + invalidTypePredicate(n: any): n is unique symbol + invalidTypeParameterConstraint(): void; + invalidTypeParameterDefault(): void; +} + +// type literals +type InvalidTypeLiteral = { + invalidPropertyType: unique symbol; + invalidArgType(arg: unique symbol): void; + invalidRestArgType(...args: (unique symbol)[]): void; + invalidReturnType(): unique symbol; + invalidThisType(this: unique symbol); + invalidTypePredicate(n: any): n is unique symbol + invalidTypeParameterConstraint(): void; + invalidTypeParameterDefault(): void; +}; + +// type alias +type InvalidAlias = unique symbol; +type InvalidAliasTypeParameterConstraint = never; +type InvalidAliasTypeParameterDefault = never; + +// type references +declare const invalidTypeArgument: Promise; +declare const invalidArrayType: (unique symbol)[]; +declare const invalidTupleType: [unique symbol]; + +// mapped types +declare const invalidMappedType: { [P in string]: unique symbol }; + +// unions/intersection +declare const invalidUnion: unique symbol | unique symbol; +declare const invalidIntersection: unique symbol | unique symbol; + + diff --git a/tests/cases/fourslash/completionInJSDocFunctionNew.ts b/tests/cases/fourslash/completionInJSDocFunctionNew.ts index 742627974bdbf..9b12093b2e12d 100644 --- a/tests/cases/fourslash/completionInJSDocFunctionNew.ts +++ b/tests/cases/fourslash/completionInJSDocFunctionNew.ts @@ -6,5 +6,5 @@ ////var f = function () { return new/**/; } goTo.marker(); -verify.completionListCount(117); +verify.completionListCount(118); verify.completionListContains('new'); diff --git a/tests/cases/fourslash/completionInJSDocFunctionThis.ts b/tests/cases/fourslash/completionInJSDocFunctionThis.ts index e22180aab5283..562f9f35274b2 100644 --- a/tests/cases/fourslash/completionInJSDocFunctionThis.ts +++ b/tests/cases/fourslash/completionInJSDocFunctionThis.ts @@ -5,6 +5,6 @@ ////var f = function (s) { return this/**/; } goTo.marker(); -verify.completionListCount(118); +verify.completionListCount(119); verify.completionListContains('this'); diff --git a/tests/cases/fourslash/findAllRefsForComputedProperties.ts b/tests/cases/fourslash/findAllRefsForComputedProperties.ts index 72c49104dedae..6587211b76d82 100644 --- a/tests/cases/fourslash/findAllRefsForComputedProperties.ts +++ b/tests/cases/fourslash/findAllRefsForComputedProperties.ts @@ -14,13 +14,13 @@ const ranges = test.ranges(); const [r0, r1, r2] = ranges; -verify.referenceGroups(r0, [{ definition: '(property) I[["prop1"]]: () => void', ranges }]); +verify.referenceGroups(r0, [{ definition: '(property) I["prop1"]: () => void', ranges }]); verify.referenceGroups(r1, [ - { definition: '(property) I[["prop1"]]: () => void', ranges: [r0, r2] }, - { definition: '(property) C[["prop1"]]: any', ranges: [r1] } + { definition: '(property) I["prop1"]: () => void', ranges: [r0, r2] }, + { definition: '(property) C["prop1"]: any', ranges: [r1] } ]); verify.referenceGroups(r2, [ - { definition: '(property) I[["prop1"]]: () => void', ranges: [r0, r1] }, + { definition: '(property) I["prop1"]: () => void', ranges: [r0, r1] }, { definition: '(property) ["prop1"]: () => void', ranges: [r2] } ]); diff --git a/tests/cases/fourslash/findAllRefsForComputedProperties2.ts b/tests/cases/fourslash/findAllRefsForComputedProperties2.ts index 4a7a17047ec79..ef28b2f9bd7ec 100644 --- a/tests/cases/fourslash/findAllRefsForComputedProperties2.ts +++ b/tests/cases/fourslash/findAllRefsForComputedProperties2.ts @@ -14,12 +14,12 @@ const ranges = test.ranges(); const [r0, r1, r2] = ranges; -verify.referenceGroups(r0, [{ definition: "(method) I[[42]](): void", ranges }]); +verify.referenceGroups(r0, [{ definition: "(method) I[42](): void", ranges }]); verify.referenceGroups(r1, [ - { definition: "(method) I[[42]](): void", ranges: [r0, r2] }, - { definition: "(property) C[[42]]: any", ranges: [r1] } + { definition: "(method) I[42](): void", ranges: [r0, r2] }, + { definition: "(property) C[42]: any", ranges: [r1] } ]); verify.referenceGroups(r2, [ - { definition: "(method) I[[42]](): void", ranges: [r0, r1] }, + { definition: "(method) I[42](): void", ranges: [r0, r1] }, { definition: '(property) ["42"]: () => void', ranges: [r2] } ]);