Remove freshness, more comprehensive grammar checks and diagnostic messages

This commit is contained in:
Ron Buckton 2017-09-22 15:08:55 -07:00
parent e81c83cdc7
commit 891e71d44f
74 changed files with 2156 additions and 391 deletions

View File

@ -630,6 +630,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);
@ -751,7 +760,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];
@ -2479,10 +2488,8 @@ namespace ts {
if (type.flags & TypeFlags.BooleanLiteral) {
return (<IntrinsicType>type).intrinsicName === "true" ? createTrue() : createFalse();
}
if (type.flags & TypeFlags.Unique) {
return type.flags & TypeFlags.Fresh
? <SymbolTypeNode>createToken(SyntaxKind.SymbolType)
: createTypeQueryNodeFromSymbol(type.symbol, SymbolFlags.Value);
if (type.flags & TypeFlags.UniqueESSymbol) {
return createESSymbolTypeNode();
}
if (type.flags & TypeFlags.Void) {
return createKeywordTypeNode(SyntaxKind.VoidKeyword);
@ -3297,15 +3304,10 @@ namespace ts {
else if (getObjectFlags(type) & (ObjectFlags.Anonymous | ObjectFlags.Mapped)) {
writeAnonymousType(<ObjectType>type, nextFlags);
}
else if (type.flags & TypeFlags.Unique) {
if (type.flags & TypeFlags.Fresh) {
writeKeyword(writer, SyntaxKind.SymbolKeyword);
writePunctuation(writer, SyntaxKind.OpenParenToken);
writePunctuation(writer, SyntaxKind.CloseParenToken);
}
else {
writeTypeOfSymbol(type.symbol, flags);
}
else if (type.flags & TypeFlags.UniqueESSymbol) {
writeKeyword(writer, SyntaxKind.SymbolKeyword);
writePunctuation(writer, SyntaxKind.OpenParenToken);
writePunctuation(writer, SyntaxKind.CloseParenToken);
}
else if (type.flags & TypeFlags.StringOrNumberLiteral) {
writer.writeStringLiteral(literalTypeToString(<LiteralType>type));
@ -4522,6 +4524,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.
@ -4590,16 +4598,6 @@ namespace ts {
if (!popTypeResolution()) {
type = reportCircularityError(symbol);
}
// If the type is a fresh, unique symbol type and is not the type for this symbol, get its regular type
// For example:
//
// const x = Symbol(); // fresh type, e.g. 'symbol()'
// const y = x; // regular type, e.g. 'typeof x'
if (type.flags & TypeFlags.Unique && type.flags & TypeFlags.Fresh && type.symbol !== symbol) {
type = (<UniqueType>type).regularType;
}
links.type = type;
}
return links.type;
@ -5417,9 +5415,10 @@ namespace ts {
function resolveDeclaredMembers(type: InterfaceType): InterfaceTypeWithDeclaredMembers {
if (!(<InterfaceTypeWithDeclaredMembers>type).declaredProperties) {
const symbol = type.symbol;
const members = getMembersOfSymbol(symbol);
(<InterfaceTypeWithDeclaredMembers>type).declaredProperties = getNamedMembers(getMembersOfSymbol(symbol));
(<InterfaceTypeWithDeclaredMembers>type).declaredCallSignatures = getSignaturesOfSymbol(symbol.members.get(InternalSymbolName.Call));
(<InterfaceTypeWithDeclaredMembers>type).declaredConstructSignatures = getSignaturesOfSymbol(symbol.members.get(InternalSymbolName.New));
(<InterfaceTypeWithDeclaredMembers>type).declaredCallSignatures = getSignaturesOfSymbol(members.get(InternalSymbolName.Call));
(<InterfaceTypeWithDeclaredMembers>type).declaredConstructSignatures = getSignaturesOfSymbol(members.get(InternalSymbolName.New));
(<InterfaceTypeWithDeclaredMembers>type).declaredStringIndexInfo = getIndexInfoOfSymbol(symbol, IndexKind.String);
(<InterfaceTypeWithDeclaredMembers>type).declaredNumberIndexInfo = getIndexInfoOfSymbol(symbol, IndexKind.Number);
}
@ -5439,16 +5438,7 @@ namespace ts {
lateBindMembers(lateMembers, decl);
}
}
if (!lateMembers || lateMembers.size === 0) {
return links.resolvedMembers = symbol.members || emptySymbols;
}
if (!symbol.members || symbol.members.size === 0) {
return links.resolvedMembers = lateMembers;
}
const resolvedMembers = createUnderscoreEscapedMap<Symbol>();
mergeSymbolTable(resolvedMembers, symbol.members);
mergeSymbolTable(resolvedMembers, lateMembers);
return links.resolvedMembers = resolvedMembers;
links.resolvedMembers = combineSymbolTables(symbol.members, lateMembers) || emptySymbols;
}
return links.resolvedMembers;
}
@ -5456,7 +5446,7 @@ namespace ts {
/**
* Gets the late-bound members of a symbol.
*/
function getLateBoundMembersOfSymbol(symbol: Symbol) {
function getLateBoundMembersOfSymbol(symbol: Symbol): UnderscoreEscapedMap<TransientSymbol> | undefined {
if (symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface | SymbolFlags.TypeLiteral | SymbolFlags.ObjectLiteral)) {
const links = getSymbolLinks(symbol);
return links.lateMembers || (links.lateMembers = createUnderscoreEscapedMap<TransientSymbol>());
@ -5477,7 +5467,11 @@ namespace ts {
function isLateBoundName(node: DeclarationName): node is LateBoundName {
return isComputedPropertyName(node)
&& isEntityNameExpression(node.expression)
&& (checkComputedPropertyName(node).flags & TypeFlags.StringOrNumberLiteralOrUnique) !== 0;
&& isLateBoundNameType(checkComputedPropertyName(node));
}
function isLateBoundNameType(type: Type): type is LiteralType | UniqueESSymbolType {
return !!(type.flags & TypeFlags.StringOrNumberLiteralOrUnique);
}
/**
@ -5511,8 +5505,8 @@ namespace ts {
/**
* Gets the symbolic name for a late-bound member from its type.
*/
function getLateBoundNameFromType(type: Type) {
if (type.flags & TypeFlags.Unique) {
function getLateBoundNameFromType(type: LiteralType | UniqueESSymbolType) {
if (type.flags & TypeFlags.UniqueESSymbol) {
return `__@${type.symbol.escapedName}@${getSymbolId(type.symbol)}` as __String;
}
if (type.flags & TypeFlags.StringOrNumberLiteral) {
@ -5552,7 +5546,7 @@ namespace ts {
const memberSymbol = member.symbol;
links.resolvedSymbol = memberSymbol || unknownSymbol;
const type = checkComputedPropertyName(member.name);
if (type.flags & TypeFlags.StringOrNumberLiteralOrUnique) {
if (isLateBoundNameType(type)) {
const memberName = getLateBoundNameFromType(type);
let symbol = lateMembers.get(memberName);
if (!symbol) {
@ -5633,7 +5627,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);
@ -7464,7 +7458,7 @@ namespace ts {
containsString?: boolean;
containsNumber?: boolean;
containsESSymbol?: boolean;
containsStringOrNumberLiteralOrUnique?: boolean;
containsStringOrNumberLiteralOrUniqueESSymbol?: boolean;
containsObjectType?: boolean;
containsEmptyObject?: boolean;
unionIndex?: number;
@ -7531,7 +7525,7 @@ namespace ts {
if (flags & TypeFlags.String) typeSet.containsString = true;
if (flags & TypeFlags.Number) typeSet.containsNumber = true;
if (flags & TypeFlags.ESSymbol) typeSet.containsESSymbol = true;
if (flags & TypeFlags.StringOrNumberLiteralOrUnique) typeSet.containsStringOrNumberLiteralOrUnique = true;
if (flags & TypeFlags.StringOrNumberLiteralOrUnique) typeSet.containsStringOrNumberLiteralOrUniqueESSymbol = true;
const len = typeSet.length;
const index = len && type.id > typeSet[len - 1].id ? ~len : binarySearchTypes(typeSet, type);
if (index < 0) {
@ -7606,8 +7600,8 @@ namespace ts {
const remove =
t.flags & TypeFlags.StringLiteral && types.containsString ||
t.flags & TypeFlags.NumberLiteral && types.containsNumber ||
t.flags & TypeFlags.Unique && types.containsESSymbol ||
t.flags & TypeFlags.StringOrNumberLiteralOrUnique && t.flags & TypeFlags.Fresh && containsType(types, getRegularTypeOfLiteralOrUniqueType(t));
t.flags & TypeFlags.UniqueESSymbol && types.containsESSymbol ||
t.flags & TypeFlags.StringOrNumberLiteral && t.flags & TypeFlags.FreshLiteral && containsType(types, (<LiteralType>t).regularType);
if (remove) {
orderedRemoveItemAt(types, i);
}
@ -7636,7 +7630,7 @@ namespace ts {
if (subtypeReduction) {
removeSubtypes(typeSet);
}
else if (typeSet.containsStringOrNumberLiteralOrUnique) {
else if (typeSet.containsStringOrNumberLiteralOrUniqueESSymbol) {
removeRedundantLiteralTypes(typeSet);
}
if (typeSet.length === 0) {
@ -7823,8 +7817,7 @@ namespace ts {
function getPropertyTypeForIndexType(objectType: Type, indexType: Type, accessNode: ElementAccessExpression | IndexedAccessTypeNode, cacheSymbol: boolean) {
const accessExpression = accessNode && accessNode.kind === SyntaxKind.ElementAccessExpression ? <ElementAccessExpression>accessNode : undefined;
const propName = indexType.flags & TypeFlags.StringOrNumberLiteralOrUnique ?
getLateBoundNameFromType(indexType) :
const propName = isLateBoundNameType(indexType) ? getLateBoundNameFromType(indexType) :
accessExpression && checkThatExpressionIsProperSymbolReference(accessExpression.argumentExpression, indexType, /*reportError*/ false) ?
getPropertyNameForKnownSymbolName(unescapeLeadingUnderscores((<Identifier>(<PropertyAccessExpression>accessExpression.argumentExpression).name).escapedText)) :
undefined;
@ -8137,22 +8130,20 @@ namespace ts {
return type;
}
function getFreshTypeOfLiteralOrUniqueType(type: Type) {
if (type.flags & TypeFlags.StringOrNumberLiteralOrUnique && !(type.flags & TypeFlags.Fresh)) {
if (!(<UniqueType | LiteralType>type).freshType) {
const freshType = type.flags & TypeFlags.Unique
? createUniqueType(type.symbol, TypeFlags.Fresh)
: createLiteralType(type.flags | TypeFlags.Fresh, (<LiteralType>type).value, (<LiteralType>type).symbol);
freshType.regularType = <UniqueType | LiteralType>type;
(<UniqueType | LiteralType>type).freshType = freshType;
function getFreshTypeOfLiteralType(type: Type) {
if (type.flags & TypeFlags.StringOrNumberLiteral && !(type.flags & TypeFlags.FreshLiteral)) {
if (!(<LiteralType>type).freshType) {
const freshType = createLiteralType(type.flags | TypeFlags.FreshLiteral, (<LiteralType>type).value, (<LiteralType>type).symbol);
freshType.regularType = <LiteralType>type;
(<LiteralType>type).freshType = freshType;
}
return (<UniqueType | LiteralType>type).freshType;
return (<LiteralType>type).freshType;
}
return type;
}
function getRegularTypeOfLiteralOrUniqueType(type: Type) {
return type.flags & TypeFlags.StringOrNumberLiteralOrUnique && type.flags & TypeFlags.Fresh ? (<UniqueType | LiteralType>type).regularType : type;
function getRegularTypeOfLiteralType(type: Type) {
return type.flags & TypeFlags.StringOrNumberLiteral && type.flags & TypeFlags.FreshLiteral ? (<LiteralType>type).regularType : type;
}
function getLiteralType(value: string | number, enumId?: number, symbol?: Symbol) {
@ -8173,36 +8164,63 @@ namespace ts {
function getTypeFromLiteralTypeNode(node: LiteralTypeNode): Type {
const links = getNodeLinks(node);
if (!links.resolvedType) {
links.resolvedType = getRegularTypeOfLiteralOrUniqueType(checkExpression(node.literal));
links.resolvedType = getRegularTypeOfLiteralType(checkExpression(node.literal));
}
return links.resolvedType;
}
function getTypeFromSymbolTypeNode(node: SymbolTypeNode): Type {
const parent = node.parent;
if (parent.kind === SyntaxKind.VariableDeclaration ||
parent.kind === SyntaxKind.PropertyDeclaration ||
parent.kind === SyntaxKind.PropertySignature ||
parent.kind === SyntaxKind.PropertyAssignment) {
const symbol = getSymbolOfNode(parent);
if (symbol) return getUniqueTypeForSymbol(symbol);
}
return esSymbolType;
function getWidenedTypeOfUniqueESSymbolType(type: Type): Type {
return type.flags & TypeFlags.UniqueESSymbol ? esSymbolType :
type.flags & TypeFlags.Union ? getUnionType(sameMap((<UnionType>type).types, getWidenedTypeOfUniqueESSymbolType)) :
type.flags & TypeFlags.Intersection ? getIntersectionType(sameMap((<IntersectionType>type).types, getWidenedTypeOfUniqueESSymbolType)) :
type;
}
function getRegularTypeOfUniqueType(type: Type) {
return type.flags & TypeFlags.Unique && type.flags & TypeFlags.Fresh ? (<UniqueType>type).regularType : type;
}
function createUniqueType(symbol: Symbol, flags?: TypeFlags) {
const type = <UniqueType>createType(TypeFlags.Unique | flags);
function createUniqueESSymbolType(symbol: Symbol) {
const type = <UniqueESSymbolType>createType(TypeFlags.UniqueESSymbol);
type.symbol = symbol;
return type;
}
function getUniqueTypeForSymbol(symbol: Symbol) {
const links = getSymbolLinks(symbol);
return links.type || (links.type = createUniqueType(symbol));
function isReferenceToValidDeclarationForUniqueESSymbol(symbol: Symbol) {
if (symbol.valueDeclaration) {
switch (symbol.valueDeclaration.kind) {
case SyntaxKind.VariableDeclaration:
return getNameOfDeclaration(symbol.valueDeclaration).kind === SyntaxKind.Identifier
&& symbol.valueDeclaration.parent.kind === SyntaxKind.VariableDeclarationList
&& symbol.valueDeclaration.parent.parent.kind === SyntaxKind.VariableStatement
&& !!(symbol.valueDeclaration.parent.flags & NodeFlags.Const);
case SyntaxKind.PropertySignature:
return hasModifier(symbol.valueDeclaration, ModifierFlags.Readonly);
case SyntaxKind.PropertyDeclaration:
return hasModifier(symbol.valueDeclaration, ModifierFlags.Readonly)
&& hasModifier(symbol.valueDeclaration, ModifierFlags.Static);
}
}
return false;
}
function getUniqueESSymbolTypeForSymbol(symbol: Symbol) {
if (isReferenceToValidDeclarationForUniqueESSymbol(symbol)) {
const links = getSymbolLinks(symbol);
return links.type || (links.type = createUniqueESSymbolType(symbol));
}
return esSymbolType;
}
function getTypeFromESSymbolTypeNode(node: ESSymbolTypeNode): Type {
const links = getNodeLinks(node);
if (!links.resolvedType) {
const parent = skipParentheses(node).parent;
const symbol = getSymbolOfNode(parent);
if (symbol) {
links.resolvedType = getUniqueESSymbolTypeForSymbol(symbol);
}
else {
links.resolvedType = esSymbolType;
}
}
return links.resolvedType;
}
function getTypeFromJSDocVariadicType(node: JSDocVariadicType): Type {
@ -8264,8 +8282,8 @@ namespace ts {
return getTypeFromThisTypeNode(node as ThisExpression | ThisTypeNode);
case SyntaxKind.LiteralType:
return getTypeFromLiteralTypeNode(<LiteralTypeNode>node);
case SyntaxKind.SymbolType:
return getTypeFromSymbolTypeNode(<SymbolTypeNode>node);
case SyntaxKind.ESSymbolType:
return getTypeFromESSymbolTypeNode(<ESSymbolTypeNode>node);
case SyntaxKind.TypeReference:
return getTypeFromTypeReference(<TypeReferenceNode>node);
case SyntaxKind.TypePredicate:
@ -9003,7 +9021,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.Unique || t & TypeFlags.Unique) return false;
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
@ -9016,8 +9034,8 @@ namespace ts {
}
function isTypeRelatedTo(source: Type, target: Type, relation: Map<RelationComparisonResult>) {
source = getRegularTypeOfLiteralOrUniqueType(source);
target = getRegularTypeOfLiteralOrUniqueType(target);
source = getRegularTypeOfLiteralType(source);
target = getRegularTypeOfLiteralType(target);
if (source === target || relation !== identityRelation && isSimpleTypeRelatedTo(source, target, relation)) {
return true;
}
@ -9148,8 +9166,8 @@ namespace ts {
* * Ternary.False if they are not related.
*/
function isRelatedTo(source: Type, target: Type, reportErrors?: boolean, headMessage?: DiagnosticMessage): Ternary {
source = getRegularTypeOfLiteralOrUniqueType(source);
target = getRegularTypeOfLiteralOrUniqueType(target);
source = getRegularTypeOfLiteralType(source);
target = getRegularTypeOfLiteralType(target);
// both types are the same - covers 'they are the same primitive type or both are Any' or the same type parameter cases
if (source === target) return Ternary.True;
@ -9159,7 +9177,7 @@ namespace ts {
if (isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : undefined)) return Ternary.True;
if (getObjectFlags(source) & ObjectFlags.ObjectLiteral && source.flags & TypeFlags.Fresh) {
if (getObjectFlags(source) & ObjectFlags.ObjectLiteral && source.flags & TypeFlags.FreshLiteral) {
if (hasExcessProperties(<FreshObjectLiteralType>source, target, reportErrors)) {
if (reportErrors) {
reportRelationError(headMessage, source, target);
@ -10315,9 +10333,8 @@ namespace ts {
function getWidenedLiteralType(type: Type): Type {
return type.flags & TypeFlags.EnumLiteral ? getBaseTypeOfEnumLiteralType(<LiteralType>type) :
type.flags & TypeFlags.StringLiteral && type.flags & TypeFlags.Fresh ? stringType :
type.flags & TypeFlags.NumberLiteral && type.flags & TypeFlags.Fresh ? numberType :
type.flags & TypeFlags.Unique && type.flags & TypeFlags.Fresh ? esSymbolType :
type.flags & TypeFlags.StringLiteral && type.flags & TypeFlags.FreshLiteral ? stringType :
type.flags & TypeFlags.NumberLiteral && type.flags & TypeFlags.FreshLiteral ? numberType :
type.flags & TypeFlags.BooleanLiteral ? booleanType :
type.flags & TypeFlags.Union ? getUnionType(sameMap((<UnionType>type).types, getWidenedLiteralType)) :
type;
@ -10425,7 +10442,7 @@ namespace ts {
* Leave signatures alone since they are not subject to the check.
*/
function getRegularTypeOfObjectLiteral(type: Type): Type {
if (!(getObjectFlags(type) & ObjectFlags.ObjectLiteral && type.flags & TypeFlags.Fresh)) {
if (!(getObjectFlags(type) & ObjectFlags.ObjectLiteral && type.flags & TypeFlags.FreshLiteral)) {
return type;
}
const regularType = (<FreshObjectLiteralType>type).regularType;
@ -10441,7 +10458,7 @@ namespace ts {
resolved.constructSignatures,
resolved.stringIndexInfo,
resolved.numberIndexInfo);
regularNew.flags = resolved.flags & ~TypeFlags.Fresh;
regularNew.flags = resolved.flags & ~TypeFlags.FreshLiteral;
regularNew.objectFlags |= ObjectFlags.ObjectLiteral;
(<FreshObjectLiteralType>type).regularType = regularNew;
return regularNew;
@ -11067,7 +11084,7 @@ namespace ts {
}
}
}
return inferredType;
return getWidenedTypeOfUniqueESSymbolType(inferredType);
}
function getDefaultTypeArgumentType(isInJavaScriptFile: boolean): Type {
@ -11515,7 +11532,7 @@ namespace ts {
function getTypeOfSwitchClause(clause: CaseClause | DefaultClause) {
if (clause.kind === SyntaxKind.CaseClause) {
const caseType = getRegularTypeOfLiteralOrUniqueType(getTypeOfExpression((<CaseClause>clause).expression));
const caseType = getRegularTypeOfLiteralType(getTypeOfExpression((<CaseClause>clause).expression));
return isUnitType(caseType) ? caseType : undefined;
}
return neverType;
@ -12160,8 +12177,8 @@ namespace ts {
return narrowedType.flags & TypeFlags.Never ? type : replacePrimitivesWithLiterals(narrowedType, valueType);
}
if (isUnitType(valueType)) {
const regularType = getRegularTypeOfLiteralOrUniqueType(valueType);
return filterType(type, t => getRegularTypeOfLiteralOrUniqueType(t) !== regularType);
const regularType = getRegularTypeOfLiteralType(valueType);
return filterType(type, t => getRegularTypeOfLiteralType(t) !== regularType);
}
return type;
}
@ -12218,7 +12235,7 @@ namespace ts {
if (!hasDefaultClause) {
return caseType;
}
const defaultType = filterType(type, t => !(isUnitType(t) && contains(switchTypes, getRegularTypeOfLiteralOrUniqueType(t))));
const defaultType = filterType(type, t => !(isUnitType(t) && contains(switchTypes, getRegularTypeOfLiteralType(t))));
return caseType.flags & TypeFlags.Never ? defaultType : getUnionType([caseType, defaultType]);
}
@ -13700,7 +13717,7 @@ namespace ts {
else {
const elementContextualType = getContextualTypeForElementExpression(contextualType, index);
const type = checkExpressionForMutableLocation(e, checkMode, elementContextualType);
elementTypes.push(type);
elementTypes.push(getWidenedTypeOfUniqueESSymbolType(type));
}
hasSpreadElement = hasSpreadElement || e.kind === SyntaxKind.SpreadElement;
}
@ -13882,7 +13899,7 @@ namespace ts {
let prop: TransientSymbol;
if (hasLateBoundName(memberDecl)) {
const nameType = checkComputedPropertyName(memberDecl.name);
if (nameType && nameType.flags & TypeFlags.StringOrNumberLiteralOrUnique) {
if (nameType && isLateBoundNameType(nameType)) {
prop = createSymbol(SymbolFlags.Property | SymbolFlags.Late | member.flags, getLateBoundNameFromType(nameType));
}
}
@ -13994,7 +14011,7 @@ namespace ts {
if (spread.flags & TypeFlags.Object) {
// only set the symbol and flags if this is a (fresh) object type
spread.flags |= propagatedFlags;
spread.flags |= TypeFlags.Fresh;
spread.flags |= TypeFlags.FreshLiteral;
(spread as ObjectType).objectFlags |= ObjectFlags.ObjectLiteral;
spread.symbol = node.symbol;
}
@ -14007,7 +14024,7 @@ namespace ts {
const stringIndexInfo = isJSObjectLiteral ? jsObjectLiteralIndexInfo : hasComputedStringProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, IndexKind.String) : undefined;
const numberIndexInfo = hasComputedNumberProperty && !isJSObjectLiteral ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, IndexKind.Number) : undefined;
const result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo);
const freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : TypeFlags.Fresh;
const freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : TypeFlags.FreshLiteral;
result.flags |= TypeFlags.ContainsObjectLiteral | freshObjectLiteralFlag | (typeFlags & TypeFlags.PropagatingFlags);
result.objectFlags |= ObjectFlags.ObjectLiteral;
if (patternWithComputedProperties) {
@ -16832,11 +16849,8 @@ namespace ts {
// as a fresh unique symbol literal type.
if (returnType.flags & TypeFlags.ESSymbolLike && isSymbolOrSymbolForCall(node)) {
const parent = skipParentheses(node).parent;
if ((parent.kind === SyntaxKind.VariableDeclaration && parent.parent.flags & NodeFlags.Const) ||
(parent.kind === SyntaxKind.PropertyDeclaration && hasModifier(parent, ModifierFlags.Readonly))) {
const symbol = getSymbolOfNode(parent);
if (symbol) return getFreshTypeOfLiteralOrUniqueType(getUniqueTypeForSymbol(symbol));
}
const symbol = getSymbolOfNode(parent);
if (symbol) return getUniqueESSymbolTypeForSymbol(symbol);
}
return returnType;
}
@ -17117,7 +17131,7 @@ namespace ts {
const functionFlags = getFunctionFlags(func);
let type: Type;
if (func.body.kind !== SyntaxKind.Block) {
type = getRegularTypeOfUniqueType(checkExpressionCached(<Expression>func.body, checkMode));
type = checkExpressionCached(<Expression>func.body, checkMode);
if (functionFlags & 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
@ -17125,6 +17139,9 @@ namespace ts {
// the native Promise<T> type later in this function.
type = checkAwaitedType(type, /*errorNode*/ func, Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member);
}
// widen 'symbol()' types when we infer the return type.
type = getWidenedTypeOfUniqueESSymbolType(type);
}
else {
let types: Type[];
@ -17157,7 +17174,10 @@ namespace ts {
}
}
// Return a union of the return expression types.
type = getUnionType(map(types, getRegularTypeOfUniqueType), /*subtypeReduction*/ true);
type = getUnionType(types, /*subtypeReduction*/ true);
// widen 'symbol()' types when we infer the return type.
type = getWidenedTypeOfUniqueESSymbolType(type);
if (functionFlags & FunctionFlags.Generator) { // AsyncGenerator function or Generator function
type = functionFlags & FunctionFlags.Async
@ -17170,12 +17190,11 @@ namespace ts {
reportErrorsFromWidening(func, type);
}
if (isUnitType(type)) {
if (!(contextualSignature &&
if (isUnitType(type) &&
!(contextualSignature &&
isLiteralContextualType(
contextualSignature === getSignatureFromDeclaration(func) ? type : getReturnTypeOfSignature(contextualSignature)))) {
type = getWidenedLiteralType(type);
}
type = getWidenedLiteralType(type);
}
const widenedType = getWidenedType(type);
@ -17222,7 +17241,7 @@ namespace ts {
if (!switchTypes.length) {
return false;
}
return eachTypeContainedIn(mapType(type, getRegularTypeOfLiteralOrUniqueType), switchTypes);
return eachTypeContainedIn(mapType(type, getRegularTypeOfLiteralType), switchTypes);
}
function functionHasImplicitReturn(func: FunctionLikeDeclaration) {
@ -17549,10 +17568,10 @@ namespace ts {
}
if (node.operand.kind === SyntaxKind.NumericLiteral) {
if (node.operator === SyntaxKind.MinusToken) {
return getFreshTypeOfLiteralOrUniqueType(getLiteralType(-(<LiteralExpression>node.operand).text));
return getFreshTypeOfLiteralType(getLiteralType(-(<LiteralExpression>node.operand).text));
}
else if (node.operator === SyntaxKind.PlusToken) {
return getFreshTypeOfLiteralOrUniqueType(getLiteralType(+(<LiteralExpression>node.operand).text));
return getFreshTypeOfLiteralType(getLiteralType(+(<LiteralExpression>node.operand).text));
}
}
switch (node.operator) {
@ -18431,10 +18450,10 @@ namespace ts {
return nullWideningType;
case SyntaxKind.NoSubstitutionTemplateLiteral:
case SyntaxKind.StringLiteral:
return getFreshTypeOfLiteralOrUniqueType(getLiteralType((node as LiteralExpression).text));
return getFreshTypeOfLiteralType(getLiteralType((node as LiteralExpression).text));
case SyntaxKind.NumericLiteral:
checkGrammarNumericLiteral(node as NumericLiteral);
return getFreshTypeOfLiteralOrUniqueType(getLiteralType(+(node as NumericLiteral).text));
return getFreshTypeOfLiteralType(getLiteralType(+(node as NumericLiteral).text));
case SyntaxKind.TrueKeyword:
return trueType;
case SyntaxKind.FalseKeyword:
@ -19236,8 +19255,8 @@ namespace ts {
checkTypeAssignableTo(constraintType, stringType, node.typeParameter.constraint);
}
function checkSymbolType(node: SymbolTypeNode) {
checkGrammarSymbolTypeNode(node);
function checkSymbolType(node: ESSymbolTypeNode) {
checkGrammarESSymbolTypeNode(node);
}
function isPrivateWithinAmbient(node: Node): boolean {
@ -22795,8 +22814,8 @@ namespace ts {
return checkIndexedAccessType(<IndexedAccessTypeNode>node);
case SyntaxKind.MappedType:
return checkMappedType(<MappedTypeNode>node);
case SyntaxKind.SymbolType:
return checkSymbolType(<SymbolTypeNode>node);
case SyntaxKind.ESSymbolType:
return checkSymbolType(<ESSymbolTypeNode>node);
case SyntaxKind.FunctionDeclaration:
return checkFunctionDeclaration(<FunctionDeclaration>node);
case SyntaxKind.Block:
@ -23548,7 +23567,7 @@ namespace ts {
if (isRightSideOfQualifiedNameOrPropertyAccess(expr)) {
expr = <Expression>expr.parent;
}
return getRegularTypeOfLiteralOrUniqueType(getTypeOfExpression(expr));
return getRegularTypeOfLiteralType(getTypeOfExpression(expr));
}
/**
@ -23991,14 +24010,7 @@ namespace ts {
let type: Type = unknownType;
if (symbol && !(symbol.flags & (SymbolFlags.TypeLiteral | SymbolFlags.Signature))) {
type = getTypeOfSymbol(symbol);
if (type.flags & TypeFlags.Unique) {
if (type.symbol !== symbol) {
type = getRegularTypeOfUniqueType(type);
}
}
else {
type = getWidenedLiteralType(type);
}
type = getWidenedLiteralType(type);
}
if (flags & TypeFormatFlags.AddUndefined) {
type = getNullableType(type, TypeFlags.Undefined);
@ -24065,7 +24077,7 @@ namespace ts {
function isLiteralConstDeclaration(node: VariableDeclaration | PropertyDeclaration | PropertySignature | ParameterDeclaration): boolean {
if (isConst(node)) {
const type = getTypeOfSymbol(getSymbolOfNode(node));
return !!(type.flags & TypeFlags.StringOrNumberLiteral && type.flags & TypeFlags.Fresh);
return !!(type.flags & TypeFlags.StringOrNumberLiteral && type.flags & TypeFlags.FreshLiteral);
}
return false;
}
@ -25116,21 +25128,58 @@ namespace ts {
}
}
function checkGrammarSymbolTypeNode(node: SymbolTypeNode) {
const parent = node.parent;
if (parent.kind !== SyntaxKind.VariableDeclaration &&
parent.kind !== SyntaxKind.PropertyDeclaration &&
parent.kind !== SyntaxKind.PropertySignature &&
parent.kind !== SyntaxKind.PropertyAssignment) {
return grammarErrorOnNode(node, Diagnostics.Unique_symbol_types_are_only_allowed_on_variables_and_properties);
function checkGrammarESSymbolTypeNode(node: ESSymbolTypeNode) {
let parent = node.parent;
while (parent.kind === SyntaxKind.ParenthesizedType) {
parent = parent.parent;
}
if (parent.kind === SyntaxKind.VariableDeclaration &&
(<VariableDeclaration>parent).name.kind !== SyntaxKind.Identifier) {
return grammarErrorOnNode(node, Diagnostics.Unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name);
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((<VariableDeclaration>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((<PropertyDeclaration>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((<PropertySignature>parent).name, Diagnostics.A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly);
}
break;
// report specific errors for cases where a `symbol()` type is disallowed even when it is in a `const` or `readonly` declaration.
case SyntaxKind.UnionType:
return grammarErrorOnNode(node, Diagnostics.Unique_symbol_types_are_not_allowed_in_a_union_type);
case SyntaxKind.IntersectionType:
return grammarErrorOnNode(node, Diagnostics.Unique_symbol_types_are_not_allowed_in_an_intersection_type);
case SyntaxKind.ArrayType:
return grammarErrorOnNode(node, Diagnostics.Unique_symbol_types_are_not_allowed_in_an_array_type);
case SyntaxKind.TupleType:
return grammarErrorOnNode(node, Diagnostics.Unique_symbol_types_are_not_allowed_in_a_tuple_type);
case SyntaxKind.MappedType:
return grammarErrorOnNode(node, Diagnostics.Unique_symbol_types_are_not_allowed_in_a_mapped_type);
// report a general error for any other invalid use site.
default:
return grammarErrorOnNode(node, Diagnostics.Unique_symbol_types_are_not_allowed_here);
}
}
function checkGrammarForNonSymbolComputedProperty(node: DeclarationName, message: DiagnosticMessage) {
function checkGrammarForInvalidDynamicName(node: DeclarationName, message: DiagnosticMessage) {
if (isUnboundDynamicName(node)) {
return grammarErrorOnNode(node, message);
}
@ -25159,17 +25208,17 @@ namespace ts {
// and accessors are not allowed in ambient contexts in general,
// so this error only really matters for methods.
if (isInAmbientContext(node)) {
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);
}
}
@ -25421,12 +25470,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) {
@ -25434,7 +25483,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) {

View File

@ -425,7 +425,7 @@ namespace ts {
case SyntaxKind.ThisType:
case SyntaxKind.LiteralType:
return writeTextOfNode(currentText, type);
case SyntaxKind.SymbolType:
case SyntaxKind.ESSymbolType:
return write("symbol()");
case SyntaxKind.ExpressionWithTypeArguments:
return emitExpressionWithTypeArguments(<ExpressionWithTypeArguments>type);

View File

@ -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
},
@ -907,14 +907,50 @@
"category": "Error",
"code": 1328
},
"Unique 'symbol()' types are only allowed on variables and properties.": {
"Unique 'symbol()' types are not allowed in a union type.": {
"category": "Error",
"code": 1329
},
"Unique 'symbol()' types may not be used on a variable declaration with a binding name.": {
"Unique 'symbol()' types are not allowed in an intersection type.": {
"category": "Error",
"code": 1330
},
"Unique 'symbol()' types are not allowed in an array type.": {
"category": "Error",
"code": 1331
},
"Unique 'symbol()' types are not allowed in a tuple type.": {
"category": "Error",
"code": 1332
},
"Unique 'symbol()' types are not allowed in a mapped type.": {
"category": "Error",
"code": 1333
},
"A property of an interface or type literal whose type is a unique 'symbol()' type must be 'readonly'.": {
"category": "Error",
"code": 1334
},
"A property of a class whose type is a unique 'symbol()' type must be both 'static' and 'readonly'.": {
"category": "Error",
"code": 1335
},
"A variable whose type is a unique 'symbol()' type must be 'const'.": {
"category": "Error",
"code": 1336
},
"Unique 'symbol()' types may not be used on a variable declaration with a binding name.": {
"category": "Error",
"code": 1337
},
"Unique 'symbol()' types are only allowed on variables in a variable statement.": {
"category": "Error",
"code": 1338
},
"Unique 'symbol()' types are not allowed here.": {
"category": "Error",
"code": 1339
},
"Duplicate identifier '{0}'.": {
"category": "Error",

View File

@ -574,7 +574,7 @@ namespace ts {
return emitMappedType(<MappedTypeNode>node);
case SyntaxKind.LiteralType:
return emitLiteralType(<LiteralTypeNode>node);
case SyntaxKind.SymbolType:
case SyntaxKind.ESSymbolType:
return write("symbol()");
// Binding patterns

View File

@ -785,6 +785,10 @@ namespace ts {
: node;
}
export function createESSymbolTypeNode() {
return <ESSymbolTypeNode>createSynthesizedNode(SyntaxKind.ESSymbolType);
}
// Binding Patterns
export function createObjectBindingPattern(elements: ReadonlyArray<BindingElement>) {

View File

@ -2615,7 +2615,7 @@ namespace ts {
if (token() === SyntaxKind.DotToken) return undefined;
if (parseOptional(SyntaxKind.OpenParenToken)) {
parseExpected(SyntaxKind.CloseParenToken);
return finishNode(<SymbolTypeNode>createNode(SyntaxKind.SymbolType, fullStart));
return finishNode(<ESSymbolTypeNode>createNode(SyntaxKind.ESSymbolType, fullStart));
}
else {
return finishNode(<TypeNode>createNode(SyntaxKind.SymbolKeyword, fullStart));

View File

@ -240,7 +240,7 @@ namespace ts {
IndexedAccessType,
MappedType,
LiteralType,
SymbolType,
ESSymbolType,
// Binding patterns
ObjectBindingPattern,
ArrayBindingPattern,
@ -399,7 +399,7 @@ namespace ts {
FirstFutureReservedWord = ImplementsKeyword,
LastFutureReservedWord = YieldKeyword,
FirstTypeNode = TypePredicate,
LastTypeNode = SymbolType,
LastTypeNode = ESSymbolType,
FirstPunctuation = OpenBraceToken,
LastPunctuation = CaretEqualsToken,
FirstToken = Unknown,
@ -1053,8 +1053,9 @@ namespace ts {
literal: BooleanLiteral | LiteralExpression | PrefixUnaryExpression;
}
export interface SymbolTypeNode extends TypeNode {
kind: SyntaxKind.SymbolType;
// Represents a unique `symbol()` type
export interface ESSymbolTypeNode extends TypeNode {
kind: SyntaxKind.ESSymbolType;
}
export interface StringLiteral extends LiteralExpression {
@ -2738,6 +2739,7 @@ namespace ts {
// State
InObjectTypeLiteral = 1 << 20,
InTypeAlias = 1 << 23, // Writing type in type alias declaration
IsDeclarationOfUniqueESSymbolType = 1 << 24,
}
/* @internal */
@ -3051,10 +3053,10 @@ namespace ts {
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
lateMembers?: UnderscoreEscapedMap<TransientSymbol>; // Late-bound members resolved during check
resolvedMembers?: SymbolTable; // Combined early- and late-bound members of a symbol
enumKind?: EnumKind; // Enum declaration classification
}
/* @internal */
@ -3204,7 +3206,7 @@ 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
Unique = 1 << 10, // symbol()
UniqueESSymbol = 1 << 10, // symbol()
Void = 1 << 11,
Undefined = 1 << 12,
Null = 1 << 13,
@ -3216,7 +3218,7 @@ namespace ts {
Index = 1 << 19, // keyof T
IndexedAccess = 1 << 20, // T[K]
/* @internal */
Fresh = 1 << 21, // Fresh literal or unique type
FreshLiteral = 1 << 21, // Fresh literal or unique type
/* @internal */
ContainsWideningType = 1 << 22, // Type is or contains undefined or null widening type
/* @internal */
@ -3229,11 +3231,11 @@ namespace ts {
/* @internal */
Nullable = Undefined | Null,
Literal = StringLiteral | NumberLiteral | BooleanLiteral | Unique,
Literal = StringLiteral | NumberLiteral | BooleanLiteral | UniqueESSymbol,
Unit = Literal | Nullable,
StringOrNumberLiteral = StringLiteral | NumberLiteral,
/* @internal */
StringOrNumberLiteralOrUnique = StringOrNumberLiteral | Unique,
StringOrNumberLiteralOrUnique = StringOrNumberLiteral | UniqueESSymbol,
/* @internal */
DefinitelyFalsy = StringLiteral | NumberLiteral | BooleanLiteral | Void | Undefined | Null,
PossiblyFalsy = DefinitelyFalsy | String | Number | Boolean,
@ -3245,7 +3247,7 @@ namespace ts {
NumberLike = Number | NumberLiteral | Enum,
BooleanLike = Boolean | BooleanLiteral,
EnumLike = Enum | EnumLiteral,
ESSymbolLike = ESSymbol | Unique,
ESSymbolLike = ESSymbol | UniqueESSymbol,
UnionOrIntersection = Union | Intersection,
StructuredType = Object | Union | Intersection,
StructuredOrTypeVariable = StructuredType | TypeParameter | Index | IndexedAccess,
@ -3253,7 +3255,7 @@ 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 | Unique | NonPrimitive,
Narrowable = Any | StructuredType | TypeParameter | Index | IndexedAccess | StringLike | NumberLike | BooleanLike | ESSymbol | UniqueESSymbol | NonPrimitive,
NotUnionOrUnit = Any | ESSymbol | Object | NonPrimitive,
/* @internal */
RequiresWidening = ContainsWideningType | ContainsObjectLiteral,
@ -3288,11 +3290,9 @@ namespace ts {
regularType?: LiteralType; // Regular version of type
}
// Unique symbol types (TypeFlags.Unique)
export interface UniqueType extends Type {
// Unique symbol types (TypeFlags.UniqueESSymbol)
export interface UniqueESSymbolType extends Type {
symbol: Symbol;
freshType?: UniqueType; // Fresh version of the type
regularType?: UniqueType; // Regular version of the type
}
export interface StringLiteralType extends LiteralType {

View File

@ -926,6 +926,11 @@ namespace ts {
return false;
}
export function isVariableDeclarationInVariableStatement(node: VariableDeclaration) {
return node.parent.kind === SyntaxKind.VariableDeclarationList
&& node.parent.parent.kind === SyntaxKind.VariableStatement;
}
export function introducesArgumentsExoticObject(node: Node) {
switch (node.kind) {
case SyntaxKind.MethodDeclaration:

View File

@ -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.
}

View File

@ -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 TS2713: Subsequent property declarations must have the same type. Property 'c' must be of type 'number', but here has type 'string'.
tests/cases/compiler/classWithDuplicateIdentifier.ts(11,5): error TS2715: Subsequent property declarations must have the same type. Property 'c' must be of type 'number', but here has type 'string'.
==== tests/cases/compiler/classWithDuplicateIdentifier.ts (5 errors) ====
@ -26,6 +26,6 @@ tests/cases/compiler/classWithDuplicateIdentifier.ts(11,5): error TS2713: Subseq
~
!!! error TS2300: Duplicate identifier 'c'.
~
!!! error TS2713: Subsequent property declarations must have the same type. Property 'c' must be of type 'number', but here has type 'string'.
!!! error TS2715: Subsequent property declarations must have the same type. Property 'c' must be of type 'number', but here has type 'string'.
}

View File

@ -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.
}) {

View File

@ -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 [<any>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.
}

View File

@ -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 [<any>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.
}

View File

@ -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<T>()](): 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.
}

View File

@ -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<T>()](): 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.
}

View File

@ -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.
}

View File

@ -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.
}

View File

@ -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.
}

View File

@ -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.
}

View File

@ -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) { }
}

View File

@ -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) { }
}

View File

@ -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 TS2713: Subsequent property declarations must have the same type. Property 'x2' must be of type 'number', but here has type 'any'.
tests/cases/compiler/duplicateClassElements.ts(34,12): error TS2715: Subsequent property declarations must have the same type. Property 'x2' must be of type 'number', 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 TS2713: Subsequent property declarations must have the same type. Property 'x2' must be of type 'number', but here has type 'any'.
!!! error TS2715: Subsequent property declarations must have the same type. Property 'x2' must be of type 'number', but here has type 'any'.
get z2() {
~~

View File

@ -29,7 +29,7 @@ import * as M from "./module";
namespace N {
export const c2 = "a";
export const c3 = 1;
export const s1 = s0;
export const s1: typeof s0 = s0;
export interface T4 {
[N.c2]: number;
@ -52,7 +52,7 @@ namespace N {
export const c4 = "a";
export const c5 = 1;
export const s2 = s0;
export const s2: typeof s0 = s0;
interface T8 {
[c4]: number;

View File

@ -74,12 +74,13 @@ namespace N {
export const c3 = 1;
>c3 : Symbol(c3, Decl(main.ts, 5, 16))
export const s1 = s0;
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, 25))
>T4 : Symbol(T4, Decl(main.ts, 6, 36))
[N.c2]: number;
>N.c2 : Symbol(c2, Decl(main.ts, 4, 16))
@ -98,7 +99,7 @@ namespace N {
}
export declare class T5 implements T4 {
>T5 : Symbol(T5, Decl(main.ts, 12, 5))
>T4 : Symbol(T4, Decl(main.ts, 6, 25))
>T4 : Symbol(T4, Decl(main.ts, 6, 36))
[N.c2]: number;
>N.c2 : Symbol(c2, Decl(main.ts, 4, 16))
@ -146,12 +147,13 @@ export const c4 = "a";
export const c5 = 1;
>c5 : Symbol(c5, Decl(main.ts, 28, 12))
export const s2 = s0;
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, 21))
>T8 : Symbol(T8, Decl(main.ts, 29, 32))
[c4]: number;
>c4 : Symbol(c4, Decl(main.ts, 27, 12))
@ -164,7 +166,7 @@ interface T8 {
}
declare class T9 implements T8 {
>T9 : Symbol(T9, Decl(main.ts, 35, 1))
>T8 : Symbol(T8, Decl(main.ts, 29, 21))
>T8 : Symbol(T8, Decl(main.ts, 29, 32))
[c4]: number;
>c4 : Symbol(c4, Decl(main.ts, 27, 12))
@ -269,7 +271,7 @@ let t3_1: M.T3;
let t4: N.T4;
>t4 : Symbol(t4, Decl(main.ts, 75, 3))
>N : Symbol(N, Decl(main.ts, 1, 30))
>T4 : Symbol(N.T4, Decl(main.ts, 6, 25))
>T4 : Symbol(N.T4, Decl(main.ts, 6, 36))
let t5: N.T5;
>t5 : Symbol(t5, Decl(main.ts, 76, 3))
@ -288,7 +290,7 @@ let t7: N.T7;
let t8: T8;
>t8 : Symbol(t8, Decl(main.ts, 79, 3))
>T8 : Symbol(T8, Decl(main.ts, 29, 21))
>T8 : Symbol(T8, Decl(main.ts, 29, 32))
let t9: T9;
>t9 : Symbol(t9, Decl(main.ts, 80, 3))

View File

@ -9,7 +9,7 @@ export const c1 = 1;
export const s0 = Symbol();
>s0 : symbol()
>Symbol() : typeof s0
>Symbol() : symbol()
>Symbol : SymbolConstructor
export interface T0 {
@ -22,7 +22,7 @@ export interface T0 {
>c1 : 1
[s0]: boolean;
>s0 : typeof s0
>s0 : symbol()
}
export declare class T1 implements T2 {
>T1 : T1
@ -35,7 +35,7 @@ export declare class T1 implements T2 {
>c1 : 1
[s0]: boolean;
>s0 : typeof s0
>s0 : symbol()
}
export declare class T2 extends T1 {
>T2 : T2
@ -51,7 +51,7 @@ export declare type T3 = {
>c1 : 1
[s0]: boolean;
>s0 : typeof s0
>s0 : symbol()
};
@ -79,9 +79,10 @@ namespace N {
>c3 : 1
>1 : 1
export const s1 = s0;
>s1 : typeof s0
>s0 : typeof s0
export const s1: typeof s0 = s0;
>s1 : symbol()
>s0 : symbol()
>s0 : symbol()
export interface T4 {
>T4 : T4
@ -97,9 +98,9 @@ namespace N {
>c3 : 1
[N.s1]: boolean;
>N.s1 : typeof s0
>N.s1 : symbol()
>N : typeof N
>s1 : typeof s0
>s1 : symbol()
}
export declare class T5 implements T4 {
>T5 : T5
@ -116,9 +117,9 @@ namespace N {
>c3 : 1
[N.s1]: boolean;
>N.s1 : typeof s0
>N.s1 : symbol()
>N : typeof N
>s1 : typeof s0
>s1 : symbol()
}
export declare class T6 extends T5 {
>T6 : T6
@ -138,9 +139,9 @@ namespace N {
>c3 : 1
[N.s1]: boolean;
>N.s1 : typeof s0
>N.s1 : symbol()
>N : typeof N
>s1 : typeof s0
>s1 : symbol()
};
}
@ -153,9 +154,10 @@ export const c5 = 1;
>c5 : 1
>1 : 1
export const s2 = s0;
>s2 : typeof s0
>s0 : typeof s0
export const s2: typeof s0 = s0;
>s2 : symbol()
>s0 : symbol()
>s0 : symbol()
interface T8 {
>T8 : T8
@ -167,7 +169,7 @@ interface T8 {
>c5 : 1
[s2]: boolean;
>s2 : typeof s0
>s2 : symbol()
}
declare class T9 implements T8 {
>T9 : T9
@ -180,7 +182,7 @@ declare class T9 implements T8 {
>c5 : 1
[s2]: boolean;
>s2 : typeof s0
>s2 : symbol()
}
declare class T10 extends T9 {
>T10 : T10
@ -196,7 +198,7 @@ declare type T11 = {
>c5 : 1
[s2]: boolean;
>s2 : typeof s0
>s2 : symbol()
};
@ -208,7 +210,7 @@ interface T12 {
1: string;
[s2]: boolean;
>s2 : typeof s0
>s2 : symbol()
}
declare class T13 implements T2 {
>T13 : T13
@ -219,7 +221,7 @@ declare class T13 implements T2 {
1: string;
[s2]: boolean;
>s2 : typeof s0
>s2 : symbol()
}
declare class T14 extends T13 {
>T14 : T14
@ -233,7 +235,7 @@ declare type T15 = {
1: string;
[s2]: boolean;
>s2 : typeof s0
>s2 : symbol()
};
@ -471,7 +473,7 @@ export const o1 = {
>"a" : "a"
[s2]: true
>s2 : typeof s0
>s2 : symbol()
>true : true
};
@ -493,7 +495,7 @@ export const o1_s2 = o1[s2];
>o1_s2 : boolean
>o1[s2] : boolean
>o1 : { [c4]: number; [c5]: string; [s2]: boolean; }
>s2 : typeof s0
>s2 : symbol()
export const o2: T0 = o1;
>o2 : T0

View File

@ -1,6 +1,6 @@
tests/cases/compiler/dynamicNamesErrors.ts(5,5): error TS2714: Duplicate declaration '[c0]'.
tests/cases/compiler/dynamicNamesErrors.ts(6,5): error TS2714: Duplicate declaration '[c0]'.
tests/cases/compiler/dynamicNamesErrors.ts(19,5): error TS2713: Subsequent property declarations must have the same type. Property '[c1]' must be of type 'number', but here has type 'string'.
tests/cases/compiler/dynamicNamesErrors.ts(5,5): error TS2716: Duplicate declaration '[c0]'.
tests/cases/compiler/dynamicNamesErrors.ts(6,5): error TS2716: Duplicate declaration '[c0]'.
tests/cases/compiler/dynamicNamesErrors.ts(19,5): error TS2715: Subsequent property declarations must have the same type. Property '[c1]' must be of type 'number', 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'.
@ -17,10 +17,10 @@ tests/cases/compiler/dynamicNamesErrors.ts(28,6): error TS4033: Property '[c0]'
interface T0 {
[c0]: number;
~~~~
!!! error TS2714: Duplicate declaration '[c0]'.
!!! error TS2716: Duplicate declaration '[c0]'.
1: number;
~
!!! error TS2714: Duplicate declaration '[c0]'.
!!! error TS2716: Duplicate declaration '[c0]'.
}
interface T1 {
@ -35,7 +35,7 @@ tests/cases/compiler/dynamicNamesErrors.ts(28,6): error TS4033: Property '[c0]'
[c0]: number;
[c1]: string;
~~~~
!!! error TS2713: Subsequent property declarations must have the same type. Property '[c1]' must be of type 'number', but here has type 'string'.
!!! error TS2715: Subsequent property declarations must have the same type. Property '[c1]' must be of type 'number', but here has type 'string'.
}
let t1: T1;

View File

@ -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 TS2713: Subsequent property declarations must have the same type. Property 'Foo' must be of type 'string', but here has type 'number'.
tests/cases/compiler/gettersAndSettersErrors.ts(5,12): error TS2715: Subsequent property declarations must have the same type. Property 'Foo' must be of type 'string', 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 TS2713: Subsequent property declarations must have the same type. Property 'Foo' must be of type 'string', but here has type 'number'.
!!! error TS2715: Subsequent property declarations must have the same type. Property 'Foo' must be of type 'string', 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.

View File

@ -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];

View File

@ -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'.

View File

@ -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'.
}

View File

@ -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'.
}

View File

@ -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 TS2713: Subsequent property declarations must have the same type. Property 'item' must be of type 'any', but here has type 'number'.
tests/cases/compiler/interfaceDeclaration1.ts(8,5): error TS2715: Subsequent property declarations must have the same type. Property 'item' must be of type 'any', 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 TS2713: Subsequent property declarations must have the same type. Property 'item' must be of type 'any', but here has type 'number'.
!!! error TS2715: Subsequent property declarations must have the same type. Property 'item' must be of type 'any', but here has type 'number'.
}
interface I3 {

View File

@ -1,6 +1,6 @@
tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(6,5): error TS2713: Subsequent property declarations must have the same type. Property 'x' must be of type 'string', but here has type 'number'.
tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(15,9): error TS2713: Subsequent property declarations must have the same type. Property 'x' must be of type 'T', but here has type 'number'.
tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(39,9): error TS2713: Subsequent property declarations must have the same type. Property 'x' must be of type 'T', but here has type 'number'.
tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(6,5): error TS2715: Subsequent property declarations must have the same type. Property 'x' must be of type 'string', but here has type 'number'.
tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(15,9): error TS2715: Subsequent property declarations must have the same type. Property 'x' must be of type 'T', but here has type 'number'.
tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(39,9): error TS2715: Subsequent property declarations must have the same type. Property 'x' must be of type 'T', 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 TS2713: Subsequent property declarations must have the same type. Property 'x' must be of type 'string', but here has type 'number'.
!!! error TS2715: Subsequent property declarations must have the same type. Property 'x' must be of type 'string', but here has type 'number'.
}
module M {
@ -22,7 +22,7 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConfli
interface A<T> {
x: number; // error
~
!!! error TS2713: Subsequent property declarations must have the same type. Property 'x' must be of type 'T', but here has type 'number'.
!!! error TS2715: Subsequent property declarations must have the same type. Property 'x' must be of type 'T', but here has type 'number'.
}
}
@ -48,6 +48,6 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConfli
export interface A<T> {
x: number; // error
~
!!! error TS2713: Subsequent property declarations must have the same type. Property 'x' must be of type 'T', but here has type 'number'.
!!! error TS2715: Subsequent property declarations must have the same type. Property 'x' must be of type 'T', but here has type 'number'.
}
}

View File

@ -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 TS2713: Subsequent property declarations must have the same type. Property '1.0' must be of type 'number', but here has type 'string'.
tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(17,5): error TS2715: Subsequent property declarations must have the same type. Property '1.0' must be of type 'number', 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 TS2713: Subsequent property declarations must have the same type. Property '1.0' must be of type 'number', but here has type 'string'.
!!! error TS2715: Subsequent property declarations must have the same type. Property '1.0' must be of type 'number', but here has type 'string'.
}
var b = {

View File

@ -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'.
}

View File

@ -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'.
}

View File

@ -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'.

View File

@ -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'.

View File

@ -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'.

View File

@ -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'.

View File

@ -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'.

View File

@ -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'.
}

View File

@ -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'.
}

View File

@ -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'.
}

View File

@ -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

View File

@ -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'.
}

View File

@ -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'.
}

View File

@ -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'.
}

View File

@ -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'.
}

View File

@ -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.
~~~~~~

View File

@ -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'.
}

View File

@ -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'.
}

View File

@ -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'.
~~~~

View File

@ -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'.
}

View File

@ -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'.
}

View File

@ -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'.
}

View File

@ -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'.
}

View File

@ -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'.
}

View File

@ -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'.

View File

@ -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'.
~~~~

View File

@ -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];

View File

@ -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'.
}

View File

@ -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'.
}

View File

@ -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; }

View File

@ -1,5 +1,5 @@
tests/cases/compiler/reassignStaticProp.ts(5,12): error TS2300: Duplicate identifier 'bar'.
tests/cases/compiler/reassignStaticProp.ts(5,12): error TS2713: Subsequent property declarations must have the same type. Property 'bar' must be of type 'number', but here has type 'string'.
tests/cases/compiler/reassignStaticProp.ts(5,12): error TS2715: Subsequent property declarations must have the same type. Property 'bar' must be of type 'number', but here has type 'string'.
==== tests/cases/compiler/reassignStaticProp.ts (2 errors) ====
@ -11,7 +11,7 @@ tests/cases/compiler/reassignStaticProp.ts(5,12): error TS2713: Subsequent prope
~~~
!!! error TS2300: Duplicate identifier 'bar'.
~~~
!!! error TS2713: Subsequent property declarations must have the same type. Property 'bar' must be of type 'number', but here has type 'string'.
!!! error TS2715: Subsequent property declarations must have the same type. Property 'bar' must be of type 'number', but here has type 'string'.
}

View File

@ -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;

View File

@ -0,0 +1,275 @@
//// [uniqueSymbols.ts]
// declarations with call initializer
const constCall = Symbol();
let letCall = Symbol();
var varCall = Symbol();
// ambient declaration with type
declare const constType: symbol();
// declaration with type and call initializer
const constTypeAndCall: 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<typeof constCall> { 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: symbol();
static readonly readonlyStaticTypeAndCall: 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: 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: symbol();
nested: {
readonly readonlyNestedType: 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];
//// [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];
//// [uniqueSymbols.d.ts]
declare const constCall: symbol();
declare let letCall: symbol;
declare var varCall: symbol;
declare const constType: symbol();
declare const constTypeAndCall: 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<symbol>;
declare function genFuncYieldLetCall(): IterableIterator<symbol>;
declare function genFuncYieldVarCall(): IterableIterator<symbol>;
declare function genFuncYieldConstCallWithTypeQuery(): IterableIterator<typeof constCall>;
declare function asyncFuncReturnConstCall(): Promise<symbol>;
declare function asyncFuncReturnLetCall(): Promise<symbol>;
declare function asyncFuncReturnVarCall(): Promise<symbol>;
declare function asyncGenFuncYieldConstCall(): AsyncIterableIterator<symbol>;
declare function asyncGenFuncYieldLetCall(): AsyncIterableIterator<symbol>;
declare function asyncGenFuncYieldVarCall(): AsyncIterableIterator<symbol>;
declare class C {
static readonly readonlyStaticCall: symbol();
static readonly readonlyStaticType: symbol();
static readonly readonlyStaticTypeAndCall: 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: 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: symbol();
nested: {
readonly readonlyNestedType: 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<symbol>;
declare const arrayOfConstCall: symbol[];

View File

@ -0,0 +1,398 @@
=== 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: symbol();
>constType : Symbol(constType, Decl(uniqueSymbols.ts, 6, 13))
// declaration with type and call initializer
const constTypeAndCall: 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<typeof constCall> { 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: symbol();
>readonlyStaticType : Symbol(C.readonlyStaticType, Decl(uniqueSymbols.ts, 57, 50))
static readonly readonlyStaticTypeAndCall: symbol() = Symbol();
>readonlyStaticTypeAndCall : Symbol(C.readonlyStaticTypeAndCall, Decl(uniqueSymbols.ts, 58, 49))
>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, 67))
>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, 49))
>C : Symbol(C, Decl(uniqueSymbols.ts, 53, 61))
>readonlyStaticTypeAndCall : Symbol(C.readonlyStaticTypeAndCall, Decl(uniqueSymbols.ts, 58, 49))
const constInitToCReadwriteStaticCall = C.readwriteStaticCall;
>constInitToCReadwriteStaticCall : Symbol(constInitToCReadwriteStaticCall, Decl(uniqueSymbols.ts, 70, 5))
>C.readwriteStaticCall : Symbol(C.readwriteStaticCall, Decl(uniqueSymbols.ts, 59, 67))
>C : Symbol(C, Decl(uniqueSymbols.ts, 53, 61))
>readwriteStaticCall : Symbol(C.readwriteStaticCall, Decl(uniqueSymbols.ts, 59, 67))
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, 49))
>C : Symbol(C, Decl(uniqueSymbols.ts, 53, 61))
>readonlyStaticTypeAndCall : Symbol(C.readonlyStaticTypeAndCall, Decl(uniqueSymbols.ts, 58, 49))
>C.readonlyStaticTypeAndCall : Symbol(C.readonlyStaticTypeAndCall, Decl(uniqueSymbols.ts, 58, 49))
>C : Symbol(C, Decl(uniqueSymbols.ts, 53, 61))
>readonlyStaticTypeAndCall : Symbol(C.readonlyStaticTypeAndCall, Decl(uniqueSymbols.ts, 58, 49))
const constInitToCReadwriteStaticCallWithTypeQuery: typeof C.readwriteStaticCall = C.readwriteStaticCall;
>constInitToCReadwriteStaticCallWithTypeQuery : Symbol(constInitToCReadwriteStaticCallWithTypeQuery, Decl(uniqueSymbols.ts, 75, 5))
>C.readwriteStaticCall : Symbol(C.readwriteStaticCall, Decl(uniqueSymbols.ts, 59, 67))
>C : Symbol(C, Decl(uniqueSymbols.ts, 53, 61))
>readwriteStaticCall : Symbol(C.readwriteStaticCall, Decl(uniqueSymbols.ts, 59, 67))
>C.readwriteStaticCall : Symbol(C.readwriteStaticCall, Decl(uniqueSymbols.ts, 59, 67))
>C : Symbol(C, Decl(uniqueSymbols.ts, 53, 61))
>readwriteStaticCall : Symbol(C.readwriteStaticCall, Decl(uniqueSymbols.ts, 59, 67))
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: 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: symbol();
>readonlyType : Symbol(readonlyType, Decl(uniqueSymbols.ts, 95, 10))
nested: {
>nested : Symbol(nested, Decl(uniqueSymbols.ts, 96, 36))
readonly readonlyNestedType: 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, 36))
>l : Symbol(l, Decl(uniqueSymbols.ts, 101, 13))
>nested : Symbol(nested, Decl(uniqueSymbols.ts, 96, 36))
>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, 36))
>l : Symbol(l, Decl(uniqueSymbols.ts, 101, 13))
>nested : Symbol(nested, Decl(uniqueSymbols.ts, 96, 36))
>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, 36))
>l : Symbol(l, Decl(uniqueSymbols.ts, 101, 13))
>nested : Symbol(nested, Decl(uniqueSymbols.ts, 96, 36))
>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, 36))
>l : Symbol(l, Decl(uniqueSymbols.ts, 101, 13))
>nested : Symbol(nested, Decl(uniqueSymbols.ts, 96, 36))
>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))

View File

@ -0,0 +1,416 @@
=== tests/cases/conformance/types/uniqueSymbol/uniqueSymbols.ts ===
// declarations with call initializer
const constCall = Symbol();
>constCall : symbol()
>Symbol() : 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: symbol();
>constType : symbol()
// declaration with type and call initializer
const constTypeAndCall: symbol() = Symbol();
>constTypeAndCall : symbol()
>Symbol() : symbol()
>Symbol : SymbolConstructor
// declaration from initializer
const constInitToConstCall = constCall;
>constInitToConstCall : symbol
>constCall : symbol()
const constInitToLetCall = letCall;
>constInitToLetCall : symbol
>letCall : symbol
const constInitToVarCall = varCall;
>constInitToVarCall : symbol
>varCall : symbol
const constInitToConstDeclAmbient = constType;
>constInitToConstDeclAmbient : symbol
>constType : symbol()
let letInitToConstCall = constCall;
>letInitToConstCall : symbol
>constCall : symbol()
let letInitToLetCall = letCall;
>letInitToLetCall : symbol
>letCall : symbol
let letInitToVarCall = varCall;
>letInitToVarCall : symbol
>varCall : symbol
let letInitToConstDeclAmbient = constType;
>letInitToConstDeclAmbient : symbol
>constType : symbol()
var varInitToConstCall = constCall;
>varInitToConstCall : symbol
>constCall : symbol()
var varInitToLetCall = letCall;
>varInitToLetCall : symbol
>letCall : symbol
var varInitToVarCall = varCall;
>varInitToVarCall : symbol
>varCall : symbol
var varInitToConstDeclAmbient = constType;
>varInitToConstDeclAmbient : symbol
>constType : symbol()
// declaration from initializer with type query
const constInitToConstCallWithTypeQuery: typeof constCall = constCall;
>constInitToConstCallWithTypeQuery : symbol
>constCall : symbol()
>constCall : symbol()
const constInitToConstDeclAmbientWithTypeQuery: typeof constType = constType;
>constInitToConstDeclAmbientWithTypeQuery : symbol
>constType : symbol()
>constType : symbol()
// function return inference
function funcReturnConstCall() { return constCall; }
>funcReturnConstCall : () => symbol
>constCall : 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 : () => symbol()
>constCall : symbol()
>constCall : symbol()
// generator function yield inference
function* genFuncYieldConstCall() { yield constCall; }
>genFuncYieldConstCall : () => IterableIterator<symbol>
>yield constCall : any
>constCall : symbol()
function* genFuncYieldLetCall() { yield letCall; }
>genFuncYieldLetCall : () => IterableIterator<symbol>
>yield letCall : any
>letCall : symbol
function* genFuncYieldVarCall() { yield varCall; }
>genFuncYieldVarCall : () => IterableIterator<symbol>
>yield varCall : any
>varCall : symbol
// generator function yield with return type query
function* genFuncYieldConstCallWithTypeQuery(): IterableIterator<typeof constCall> { yield constCall; }
>genFuncYieldConstCallWithTypeQuery : () => IterableIterator<symbol()>
>IterableIterator : IterableIterator<T>
>constCall : symbol()
>yield constCall : any
>constCall : symbol()
// async function return inference
async function asyncFuncReturnConstCall() { return constCall; }
>asyncFuncReturnConstCall : () => Promise<symbol>
>constCall : symbol()
async function asyncFuncReturnLetCall() { return letCall; }
>asyncFuncReturnLetCall : () => Promise<symbol>
>letCall : symbol
async function asyncFuncReturnVarCall() { return varCall; }
>asyncFuncReturnVarCall : () => Promise<symbol>
>varCall : symbol
// async generator function yield inference
async function* asyncGenFuncYieldConstCall() { yield constCall; }
>asyncGenFuncYieldConstCall : () => AsyncIterableIterator<symbol>
>yield constCall : any
>constCall : symbol()
async function* asyncGenFuncYieldLetCall() { yield letCall; }
>asyncGenFuncYieldLetCall : () => AsyncIterableIterator<symbol>
>yield letCall : any
>letCall : symbol
async function* asyncGenFuncYieldVarCall() { yield varCall; }
>asyncGenFuncYieldVarCall : () => AsyncIterableIterator<symbol>
>yield varCall : any
>varCall : symbol
// classes
class C {
>C : C
static readonly readonlyStaticCall = Symbol();
>readonlyStaticCall : symbol()
>Symbol() : symbol()
>Symbol : SymbolConstructor
static readonly readonlyStaticType: symbol();
>readonlyStaticType : symbol()
static readonly readonlyStaticTypeAndCall: symbol() = Symbol();
>readonlyStaticTypeAndCall : symbol()
>Symbol() : 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 : symbol()
>C : typeof C
>readonlyStaticCall : symbol()
const constInitToCReadonlyStaticType = C.readonlyStaticType;
>constInitToCReadonlyStaticType : symbol
>C.readonlyStaticType : symbol()
>C : typeof C
>readonlyStaticType : symbol()
const constInitToCReadonlyStaticTypeAndCall = C.readonlyStaticTypeAndCall;
>constInitToCReadonlyStaticTypeAndCall : symbol
>C.readonlyStaticTypeAndCall : symbol()
>C : typeof C
>readonlyStaticTypeAndCall : symbol()
const constInitToCReadwriteStaticCall = C.readwriteStaticCall;
>constInitToCReadwriteStaticCall : symbol
>C.readwriteStaticCall : symbol
>C : typeof C
>readwriteStaticCall : symbol
const constInitToCReadonlyStaticCallWithTypeQuery: typeof C.readonlyStaticCall = C.readonlyStaticCall;
>constInitToCReadonlyStaticCallWithTypeQuery : symbol
>C.readonlyStaticCall : symbol()
>C : typeof C
>readonlyStaticCall : symbol()
>C.readonlyStaticCall : symbol()
>C : typeof C
>readonlyStaticCall : symbol()
const constInitToCReadonlyStaticTypeWithTypeQuery: typeof C.readonlyStaticType = C.readonlyStaticType;
>constInitToCReadonlyStaticTypeWithTypeQuery : symbol
>C.readonlyStaticType : symbol()
>C : typeof C
>readonlyStaticType : symbol()
>C.readonlyStaticType : symbol()
>C : typeof C
>readonlyStaticType : symbol()
const constInitToCReadonlyStaticTypeAndCallWithTypeQuery: typeof C.readonlyStaticTypeAndCall = C.readonlyStaticTypeAndCall;
>constInitToCReadonlyStaticTypeAndCallWithTypeQuery : symbol
>C.readonlyStaticTypeAndCall : symbol()
>C : typeof C
>readonlyStaticTypeAndCall : symbol()
>C.readonlyStaticTypeAndCall : symbol()
>C : typeof C
>readonlyStaticTypeAndCall : 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: symbol();
>readonlyType : symbol()
}
declare const i: I;
>i : I
>I : I
const constInitToIReadonlyType = i.readonlyType;
>constInitToIReadonlyType : symbol
>i.readonlyType : symbol()
>i : I
>readonlyType : symbol()
const constInitToIReadonlyTypeWithTypeQuery: typeof i.readonlyType = i.readonlyType;
>constInitToIReadonlyTypeWithTypeQuery : symbol
>i.readonlyType : symbol()
>i : I
>readonlyType : symbol()
>i.readonlyType : symbol()
>i : I
>readonlyType : symbol()
const constInitToIReadonlyTypeWithIndexedAccess: I["readonlyType"] = i.readonlyType;
>constInitToIReadonlyTypeWithIndexedAccess : symbol
>I : I
>i.readonlyType : symbol()
>i : I
>readonlyType : symbol()
// type literals
type L = {
>L : L
readonly readonlyType: symbol();
>readonlyType : symbol()
nested: {
>nested : { readonly readonlyNestedType: symbol(); }
readonly readonlyNestedType: symbol();
>readonlyNestedType : symbol()
}
};
declare const l: L;
>l : L
>L : L
const constInitToLReadonlyType = l.readonlyType;
>constInitToLReadonlyType : symbol
>l.readonlyType : symbol()
>l : L
>readonlyType : symbol()
const constInitToLReadonlyNestedType = l.nested.readonlyNestedType;
>constInitToLReadonlyNestedType : symbol
>l.nested.readonlyNestedType : symbol()
>l.nested : { readonly readonlyNestedType: symbol(); }
>l : L
>nested : { readonly readonlyNestedType: symbol(); }
>readonlyNestedType : symbol()
const constInitToLReadonlyTypeWithTypeQuery: typeof l.readonlyType = l.readonlyType;
>constInitToLReadonlyTypeWithTypeQuery : symbol
>l.readonlyType : symbol()
>l : L
>readonlyType : symbol()
>l.readonlyType : symbol()
>l : L
>readonlyType : symbol()
const constInitToLReadonlyNestedTypeWithTypeQuery: typeof l.nested.readonlyNestedType = l.nested.readonlyNestedType;
>constInitToLReadonlyNestedTypeWithTypeQuery : symbol
>l.nested.readonlyNestedType : symbol()
>l.nested : { readonly readonlyNestedType: symbol(); }
>l : L
>nested : { readonly readonlyNestedType: symbol(); }
>readonlyNestedType : symbol()
>l.nested.readonlyNestedType : symbol()
>l.nested : { readonly readonlyNestedType: symbol(); }
>l : L
>nested : { readonly readonlyNestedType: symbol(); }
>readonlyNestedType : symbol()
const constInitToLReadonlyTypeWithIndexedAccess: L["readonlyType"] = l.readonlyType;
>constInitToLReadonlyTypeWithIndexedAccess : symbol
>L : L
>l.readonlyType : symbol()
>l : L
>readonlyType : symbol()
const constInitToLReadonlyNestedTypeWithIndexedAccess: L["nested"]["readonlyNestedType"] = l.nested.readonlyNestedType;
>constInitToLReadonlyNestedTypeWithIndexedAccess : symbol
>L : L
>l.nested.readonlyNestedType : symbol()
>l.nested : { readonly readonlyNestedType: symbol(); }
>l : L
>nested : { readonly readonlyNestedType: symbol(); }
>readonlyNestedType : symbol()
// type argument inference
const promiseForConstCall = Promise.resolve(constCall);
>promiseForConstCall : Promise<symbol>
>Promise.resolve(constCall) : Promise<symbol>
>Promise.resolve : { <T>(value: T | PromiseLike<T>): Promise<T>; (): Promise<void>; }
>Promise : PromiseConstructor
>resolve : { <T>(value: T | PromiseLike<T>): Promise<T>; (): Promise<void>; }
>constCall : symbol()
const arrayOfConstCall = [constCall];
>arrayOfConstCall : symbol[]
>[constCall] : symbol[]
>constCall : symbol()

View File

@ -0,0 +1,265 @@
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(2,19): error TS1337: Unique 'symbol()' types may not be used on a variable declaration with a binding name.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(3,13): error TS1336: A variable whose type is a unique 'symbol()' type must be 'const'.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(4,13): error TS1336: A variable whose type is a unique 'symbol()' type must be 'const'.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(7,38): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(8,45): error TS1331: Unique 'symbol()' types are not allowed in an array type.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(9,39): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(10,40): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(11,53): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(12,59): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(13,50): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(17,44): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(19,14): error TS1335: 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(20,5): error TS1335: 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,25): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(22,33): error TS1331: Unique 'symbol()' types are not allowed in an array type.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(23,26): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(24,27): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(25,40): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(26,46): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(27,37): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(28,26): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(29,28): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(31,12): error TS1335: 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(32,38): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(33,46): error TS1331: Unique 'symbol()' types are not allowed in an array type.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(34,39): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(35,40): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(36,53): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(37,59): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(38,50): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(39,39): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(40,41): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(45,5): error TS1334: 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(46,25): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(47,33): error TS1331: Unique 'symbol()' types are not allowed in an array type.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(48,26): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(49,27): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(50,40): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(51,46): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(52,37): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(57,5): error TS1334: 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(58,25): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(59,33): error TS1331: Unique 'symbol()' types are not allowed in an array type.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(60,26): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(61,27): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(62,40): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(63,46): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(64,37): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(68,21): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(69,52): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(70,49): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(73,44): error TS1339: Unique 'symbol()' types are not allowed here.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(74,33): error TS1331: Unique 'symbol()' types are not allowed in an array type.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(75,34): error TS1332: Unique 'symbol()' types are not allowed in a tuple type.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(78,51): error TS1333: Unique 'symbol()' types are not allowed in a mapped type.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(81,29): error TS1329: Unique 'symbol()' types are not allowed in a union type.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(81,40): error TS1329: Unique 'symbol()' types are not allowed in a union type.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(82,36): error TS1329: Unique 'symbol()' types are not allowed in a union type.
tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts(82,47): error TS1329: Unique 'symbol()' types are not allowed in a union type.
==== tests/cases/conformance/types/uniqueSymbol/uniqueSymbolsErrors.ts (59 errors) ====
// declarations
declare const {}: symbol();
~~~~~~~~
!!! error TS1337: Unique 'symbol()' types may not be used on a variable declaration with a binding name.
declare let invalidLetType: symbol();
~~~~~~~~~~~~~~
!!! error TS1336: A variable whose type is a unique 'symbol()' type must be 'const'.
declare var invalidVarType: symbol();
~~~~~~~~~~~~~~
!!! error TS1336: A variable whose type is a unique 'symbol()' type must be 'const'.
// function arguments and return types
declare function invalidArgType(arg: symbol()): void;
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
declare function invalidRestArgType(...arg: symbol()[]): void;
~~~~~~~~
!!! error TS1331: Unique 'symbol()' types are not allowed in an array type.
declare function invalidReturnType(): symbol();
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
declare function invalidThisType(this: symbol()): void;
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
declare function invalidTypePredicate(n: any): n is symbol();
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
declare function invalidTypeParameterConstraint<T extends symbol()>(): void;
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
declare function invalidTypeParameterDefault<T = symbol()>(): void;
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
// classes
class InvalidClass {
constructor(invalidConstructorArgType: symbol()) {}
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
readonly invalidReadonlyPropertyType: symbol();
~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1335: A property of a class whose type is a unique 'symbol()' type must be both 'static' and 'readonly'.
invalidPropertyType: symbol();
~~~~~~~~~~~~~~~~~~~
!!! error TS1335: A property of a class whose type is a unique 'symbol()' type must be both 'static' and 'readonly'.
invalidArgType(arg: symbol()): void { return; }
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
invalidRestArgType(...args: symbol()[]): void { return; }
~~~~~~~~
!!! error TS1331: Unique 'symbol()' types are not allowed in an array type.
invalidReturnType(): symbol() { return; }
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
invalidThisType(this: symbol()): void { return; }
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
invalidTypePredicate(n: any): n is symbol() { return; }
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
invalidTypeParameterConstraint<T extends symbol()>(): void { return; }
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
invalidTypeParameterDefault<T = symbol()>(): void { return; }
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
get invalidGetter(): symbol() { return; }
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
set invalidSetter(arg: symbol()) { return; }
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
static invalidStaticPropertyType: symbol();
~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1335: A property of a class whose type is a unique 'symbol()' type must be both 'static' and 'readonly'.
static invalidStaticArgType(arg: symbol()): void { return; }
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
static invalidStaticRestArgType(...args: symbol()[]): void { return; }
~~~~~~~~
!!! error TS1331: Unique 'symbol()' types are not allowed in an array type.
static invalidStaticReturnType(): symbol() { return; }
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
static invalidStaticThisType(this: symbol()): void { return; }
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
static invalidStaticTypePredicate(n: any): n is symbol() { return; }
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
static invalidStaticTypeParameterConstraint<T extends symbol()>(): void { return; }
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
static invalidStaticTypeParameterDefault<T = symbol()>(): void { return; }
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
static get invalidStaticGetter(): symbol() { return; }
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
static set invalidStaticSetter(arg: symbol()) { return; }
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
}
// interfaces
interface InvalidInterface {
invalidPropertyType: symbol();
~~~~~~~~~~~~~~~~~~~
!!! error TS1334: A property of an interface or type literal whose type is a unique 'symbol()' type must be 'readonly'.
invalidArgType(arg: symbol()): void;
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
invalidRestArgType(...args: symbol()[]): void;
~~~~~~~~
!!! error TS1331: Unique 'symbol()' types are not allowed in an array type.
invalidReturnType(): symbol();
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
invalidThisType(this: symbol());
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
invalidTypePredicate(n: any): n is symbol()
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
invalidTypeParameterConstraint<T extends symbol()>(): void;
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
invalidTypeParameterDefault<T = symbol()>(): void;
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
}
// type literals
type InvalidTypeLiteral = {
invalidPropertyType: symbol();
~~~~~~~~~~~~~~~~~~~
!!! error TS1334: A property of an interface or type literal whose type is a unique 'symbol()' type must be 'readonly'.
invalidArgType(arg: symbol()): void;
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
invalidRestArgType(...args: symbol()[]): void;
~~~~~~~~
!!! error TS1331: Unique 'symbol()' types are not allowed in an array type.
invalidReturnType(): symbol();
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
invalidThisType(this: symbol());
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
invalidTypePredicate(n: any): n is symbol()
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
invalidTypeParameterConstraint<T extends symbol()>(): void;
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
invalidTypeParameterDefault<T = symbol()>(): void;
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
};
// type alias
type InvalidAlias = symbol();
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
type InvalidAliasTypeParameterConstraint<T extends symbol()> = never;
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
type InvalidAliasTypeParameterDefault<T extends symbol()> = never;
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
// type references
declare const invalidTypeArgument: Promise<symbol()>;
~~~~~~~~
!!! error TS1339: Unique 'symbol()' types are not allowed here.
declare const invalidArrayType: symbol()[];
~~~~~~~~
!!! error TS1331: Unique 'symbol()' types are not allowed in an array type.
declare const invalidTupleType: [symbol()];
~~~~~~~~
!!! error TS1332: Unique 'symbol()' types are not allowed in a tuple type.
// mapped types
declare const invalidMappedType: { [P in string]: symbol() };
~~~~~~~~
!!! error TS1333: Unique 'symbol()' types are not allowed in a mapped type.
// unions/intersection
declare const invalidUnion: symbol() | symbol();
~~~~~~~~
!!! error TS1329: Unique 'symbol()' types are not allowed in a union type.
~~~~~~~~
!!! error TS1329: Unique 'symbol()' types are not allowed in a union type.
declare const invalidIntersection: symbol() | symbol();
~~~~~~~~
!!! error TS1329: Unique 'symbol()' types are not allowed in a union type.
~~~~~~~~
!!! error TS1329: Unique 'symbol()' types are not allowed in a union type.

View File

@ -0,0 +1,110 @@
//// [uniqueSymbolsErrors.ts]
// declarations
declare const {}: symbol();
declare let invalidLetType: symbol();
declare var invalidVarType: symbol();
// function arguments and return types
declare function invalidArgType(arg: symbol()): void;
declare function invalidRestArgType(...arg: symbol()[]): void;
declare function invalidReturnType(): symbol();
declare function invalidThisType(this: symbol()): void;
declare function invalidTypePredicate(n: any): n is symbol();
declare function invalidTypeParameterConstraint<T extends symbol()>(): void;
declare function invalidTypeParameterDefault<T = symbol()>(): void;
// classes
class InvalidClass {
constructor(invalidConstructorArgType: symbol()) {}
readonly invalidReadonlyPropertyType: symbol();
invalidPropertyType: symbol();
invalidArgType(arg: symbol()): void { return; }
invalidRestArgType(...args: symbol()[]): void { return; }
invalidReturnType(): symbol() { return; }
invalidThisType(this: symbol()): void { return; }
invalidTypePredicate(n: any): n is symbol() { return; }
invalidTypeParameterConstraint<T extends symbol()>(): void { return; }
invalidTypeParameterDefault<T = symbol()>(): void { return; }
get invalidGetter(): symbol() { return; }
set invalidSetter(arg: symbol()) { return; }
static invalidStaticPropertyType: symbol();
static invalidStaticArgType(arg: symbol()): void { return; }
static invalidStaticRestArgType(...args: symbol()[]): void { return; }
static invalidStaticReturnType(): symbol() { return; }
static invalidStaticThisType(this: symbol()): void { return; }
static invalidStaticTypePredicate(n: any): n is symbol() { return; }
static invalidStaticTypeParameterConstraint<T extends symbol()>(): void { return; }
static invalidStaticTypeParameterDefault<T = symbol()>(): void { return; }
static get invalidStaticGetter(): symbol() { return; }
static set invalidStaticSetter(arg: symbol()) { return; }
}
// interfaces
interface InvalidInterface {
invalidPropertyType: symbol();
invalidArgType(arg: symbol()): void;
invalidRestArgType(...args: symbol()[]): void;
invalidReturnType(): symbol();
invalidThisType(this: symbol());
invalidTypePredicate(n: any): n is symbol()
invalidTypeParameterConstraint<T extends symbol()>(): void;
invalidTypeParameterDefault<T = symbol()>(): void;
}
// type literals
type InvalidTypeLiteral = {
invalidPropertyType: symbol();
invalidArgType(arg: symbol()): void;
invalidRestArgType(...args: symbol()[]): void;
invalidReturnType(): symbol();
invalidThisType(this: symbol());
invalidTypePredicate(n: any): n is symbol()
invalidTypeParameterConstraint<T extends symbol()>(): void;
invalidTypeParameterDefault<T = symbol()>(): void;
};
// type alias
type InvalidAlias = symbol();
type InvalidAliasTypeParameterConstraint<T extends symbol()> = never;
type InvalidAliasTypeParameterDefault<T extends symbol()> = never;
// type references
declare const invalidTypeArgument: Promise<symbol()>;
declare const invalidArrayType: symbol()[];
declare const invalidTupleType: [symbol()];
// mapped types
declare const invalidMappedType: { [P in string]: symbol() };
// unions/intersection
declare const invalidUnion: symbol() | symbol();
declare const invalidIntersection: symbol() | 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; }
}

View File

@ -31,7 +31,7 @@ import * as M from "./module";
namespace N {
export const c2 = "a";
export const c3 = 1;
export const s1 = s0;
export const s1: typeof s0 = s0;
export interface T4 {
[N.c2]: number;
@ -54,7 +54,7 @@ namespace N {
export const c4 = "a";
export const c5 = 1;
export const s2 = s0;
export const s2: typeof s0 = s0;
interface T8 {
[c4]: number;

View File

@ -0,0 +1,117 @@
// @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: symbol();
// declaration with type and call initializer
const constTypeAndCall: 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<typeof constCall> { 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: symbol();
static readonly readonlyStaticTypeAndCall: 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: 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: symbol();
nested: {
readonly readonlyNestedType: 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];

View File

@ -0,0 +1,86 @@
// @target: esnext
// declarations
declare const {}: symbol();
declare let invalidLetType: symbol();
declare var invalidVarType: symbol();
// function arguments and return types
declare function invalidArgType(arg: symbol()): void;
declare function invalidRestArgType(...arg: symbol()[]): void;
declare function invalidReturnType(): symbol();
declare function invalidThisType(this: symbol()): void;
declare function invalidTypePredicate(n: any): n is symbol();
declare function invalidTypeParameterConstraint<T extends symbol()>(): void;
declare function invalidTypeParameterDefault<T = symbol()>(): void;
// classes
class InvalidClass {
constructor(invalidConstructorArgType: symbol()) {}
readonly invalidReadonlyPropertyType: symbol();
invalidPropertyType: symbol();
invalidArgType(arg: symbol()): void { return; }
invalidRestArgType(...args: symbol()[]): void { return; }
invalidReturnType(): symbol() { return; }
invalidThisType(this: symbol()): void { return; }
invalidTypePredicate(n: any): n is symbol() { return; }
invalidTypeParameterConstraint<T extends symbol()>(): void { return; }
invalidTypeParameterDefault<T = symbol()>(): void { return; }
get invalidGetter(): symbol() { return; }
set invalidSetter(arg: symbol()) { return; }
static invalidStaticPropertyType: symbol();
static invalidStaticArgType(arg: symbol()): void { return; }
static invalidStaticRestArgType(...args: symbol()[]): void { return; }
static invalidStaticReturnType(): symbol() { return; }
static invalidStaticThisType(this: symbol()): void { return; }
static invalidStaticTypePredicate(n: any): n is symbol() { return; }
static invalidStaticTypeParameterConstraint<T extends symbol()>(): void { return; }
static invalidStaticTypeParameterDefault<T = symbol()>(): void { return; }
static get invalidStaticGetter(): symbol() { return; }
static set invalidStaticSetter(arg: symbol()) { return; }
}
// interfaces
interface InvalidInterface {
invalidPropertyType: symbol();
invalidArgType(arg: symbol()): void;
invalidRestArgType(...args: symbol()[]): void;
invalidReturnType(): symbol();
invalidThisType(this: symbol());
invalidTypePredicate(n: any): n is symbol()
invalidTypeParameterConstraint<T extends symbol()>(): void;
invalidTypeParameterDefault<T = symbol()>(): void;
}
// type literals
type InvalidTypeLiteral = {
invalidPropertyType: symbol();
invalidArgType(arg: symbol()): void;
invalidRestArgType(...args: symbol()[]): void;
invalidReturnType(): symbol();
invalidThisType(this: symbol());
invalidTypePredicate(n: any): n is symbol()
invalidTypeParameterConstraint<T extends symbol()>(): void;
invalidTypeParameterDefault<T = symbol()>(): void;
};
// type alias
type InvalidAlias = symbol();
type InvalidAliasTypeParameterConstraint<T extends symbol()> = never;
type InvalidAliasTypeParameterDefault<T extends symbol()> = never;
// type references
declare const invalidTypeArgument: Promise<symbol()>;
declare const invalidArrayType: symbol()[];
declare const invalidTupleType: [symbol()];
// mapped types
declare const invalidMappedType: { [P in string]: symbol() };
// unions/intersection
declare const invalidUnion: symbol() | symbol();
declare const invalidIntersection: symbol() | symbol();