diff --git a/scripts/bisect-test.ts b/scripts/bisect-test.ts
new file mode 100644
index 00000000000..93a516bc899
--- /dev/null
+++ b/scripts/bisect-test.ts
@@ -0,0 +1,56 @@
+///
+
+import cp = require('child_process');
+import fs = require('fs');
+
+// Slice off 'node bisect-test.js' from the commandline args
+var args = process.argv.slice(2);
+
+function tsc(tscArgs: string, onExit: (exitCode: number) => void) {
+ var tsc = cp.exec('node built/local/tsc.js ' + tscArgs,() => void 0);
+ tsc.on('close', tscExitCode => {
+ onExit(tscExitCode);
+ });
+}
+
+var jake = cp.exec('jake clean local', () => void 0);
+jake.on('close', jakeExitCode => {
+ if (jakeExitCode === 0) {
+ // See what we're being asked to do
+ if (args[1] === 'compiles' || args[1] === '!compiles') {
+ tsc(args[0], tscExitCode => {
+ if ((tscExitCode === 0) === (args[1] === 'compiles')) {
+ console.log('Good');
+ process.exit(0); // Good
+ } else {
+ console.log('Bad');
+ process.exit(1); // Bad
+ }
+ });
+ } else if (args[1] === 'emits' || args[1] === '!emits') {
+ tsc(args[0], tscExitCode => {
+ fs.readFile(args[2], 'utf-8', (err, data) => {
+ var doesContains = data.indexOf(args[3]) >= 0;
+ if (doesContains === (args[1] === 'emits')) {
+ console.log('Good');
+ process.exit(0); // Good
+ } else {
+ console.log('Bad');
+ process.exit(1); // Bad
+ }
+ });
+ });
+ } else {
+ console.log('Unknown command line arguments.');
+ console.log('Usage (compile errors): git bisect run scripts\bisect.js "foo.ts --module amd" compiles');
+ console.log('Usage (emit check): git bisect run scripts\bisect.js bar.ts emits bar.js "_this = this"');
+ // Aborts the 'git bisect run' process
+ process.exit(-1);
+ }
+ } else {
+ // Compiler build failed; skip this commit
+ console.log('Skip');
+ process.exit(125); // bisect skip
+ }
+});
+
\ No newline at end of file
diff --git a/scripts/bisect.cmd b/scripts/bisect.cmd
new file mode 100644
index 00000000000..148722665d4
--- /dev/null
+++ b/scripts/bisect.cmd
@@ -0,0 +1,30 @@
+echo off
+IF NOT EXIST scripts\bisect.cmd GOTO :wrongdir
+IF "%1" == "" GOTO :usage
+IF "%1" == "GO" GOTO :run
+GOTO :copy
+
+:usage
+echo Usage: bisect GoodCommit BadCommit test.ts compiles
+echo Usage: bisect GoodCommit BadCommit test.ts emits test.js "var x = 3"
+GOTO :eof
+
+:copy
+copy scripts\bisect.cmd scripts\bisect-fresh.cmd
+scripts\bisect-fresh GO %*
+GOTO :eof
+
+:run
+call jake local
+node built/local/tsc.js scripts/bisect-test.ts --module commonjs
+git bisect start %2 %3
+git bisect run node scripts/bisect-test.js %4 %5 %6 %7
+del scripts\bisect-test.js
+del scripts\bisect-fresh.cmd
+GOTO :eof
+
+:wrongdir
+@echo Run this file from the repo folder, not the scripts folder
+GOTO :eof
+
+:eof
\ No newline at end of file
diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts
index 201913a50b4..fe52e26ddd1 100644
--- a/src/compiler/binder.ts
+++ b/src/compiler/binder.ts
@@ -9,8 +9,8 @@ module ts {
export function getModuleInstanceState(node: Node): ModuleInstanceState {
// A module is uninstantiated if it contains only
- // 1. interface declarations
- if (node.kind === SyntaxKind.InterfaceDeclaration) {
+ // 1. interface declarations, type alias declarations
+ if (node.kind === SyntaxKind.InterfaceDeclaration || node.kind === SyntaxKind.TypeAliasDeclaration) {
return ModuleInstanceState.NonInstantiated;
}
// 2. const enum declarations don't make module instantiated
@@ -50,12 +50,13 @@ module ts {
}
/**
- * Returns false if any of the following are true:
- * 1. declaration has no name
- * 2. declaration has a literal name (not computed)
- * 3. declaration has a computed property name that is a known symbol
+ * A declaration has a dynamic name if both of the following are true:
+ * 1. The declaration has a computed property name
+ * 2. The computed name is *not* expressed as Symbol., where name
+ * is a property of the Symbol constructor that denotes a built in
+ * Symbol.
*/
- export function hasComputedNameButNotSymbol(declaration: Declaration): boolean {
+ export function hasDynamicName(declaration: Declaration): boolean {
return declaration.name && declaration.name.kind === SyntaxKind.ComputedPropertyName;
}
@@ -96,7 +97,7 @@ module ts {
if (node.kind === SyntaxKind.ModuleDeclaration && node.name.kind === SyntaxKind.StringLiteral) {
return '"' + (node.name).text + '"';
}
- Debug.assert(!hasComputedNameButNotSymbol(node));
+ Debug.assert(!hasDynamicName(node));
return (node.name).text;
}
switch (node.kind) {
@@ -118,11 +119,7 @@ module ts {
}
function declareSymbol(symbols: SymbolTable, parent: Symbol, node: Declaration, includes: SymbolFlags, excludes: SymbolFlags): Symbol {
- // Nodes with computed property names will not get symbols, because the type checker
- // does not make properties for them.
- if (hasComputedNameButNotSymbol(node)) {
- return undefined;
- }
+ Debug.assert(!hasDynamicName(node));
var name = getDeclarationName(node);
if (name !== undefined) {
@@ -395,14 +392,14 @@ module ts {
break;
case SyntaxKind.PropertyDeclaration:
case SyntaxKind.PropertySignature:
- bindDeclaration(node, SymbolFlags.Property | ((node).questionToken ? SymbolFlags.Optional : 0), SymbolFlags.PropertyExcludes, /*isBlockScopeContainer*/ false);
+ bindPropertyOrMethodOrAccessor(node, SymbolFlags.Property | ((node).questionToken ? SymbolFlags.Optional : 0), SymbolFlags.PropertyExcludes, /*isBlockScopeContainer*/ false);
break;
case SyntaxKind.PropertyAssignment:
case SyntaxKind.ShorthandPropertyAssignment:
- bindDeclaration(node, SymbolFlags.Property, SymbolFlags.PropertyExcludes, /*isBlockScopeContainer*/ false);
+ bindPropertyOrMethodOrAccessor(node, SymbolFlags.Property, SymbolFlags.PropertyExcludes, /*isBlockScopeContainer*/ false);
break;
case SyntaxKind.EnumMember:
- bindDeclaration(node, SymbolFlags.EnumMember, SymbolFlags.EnumMemberExcludes, /*isBlockScopeContainer*/ false);
+ bindPropertyOrMethodOrAccessor(node, SymbolFlags.EnumMember, SymbolFlags.EnumMemberExcludes, /*isBlockScopeContainer*/ false);
break;
case SyntaxKind.CallSignature:
case SyntaxKind.ConstructSignature:
@@ -415,7 +412,7 @@ module ts {
// as other properties in the object literal. So we use SymbolFlags.PropertyExcludes
// so that it will conflict with any other object literal members with the same
// name.
- bindDeclaration(node, SymbolFlags.Method | ((node).questionToken ? SymbolFlags.Optional : 0),
+ bindPropertyOrMethodOrAccessor(node, SymbolFlags.Method | ((node).questionToken ? SymbolFlags.Optional : 0),
isObjectLiteralMethod(node) ? SymbolFlags.PropertyExcludes : SymbolFlags.MethodExcludes, /*isBlockScopeContainer*/ true);
break;
case SyntaxKind.FunctionDeclaration:
@@ -425,10 +422,10 @@ module ts {
bindDeclaration(node, SymbolFlags.Constructor, /*symbolExcludes:*/ 0, /*isBlockScopeContainer:*/ true);
break;
case SyntaxKind.GetAccessor:
- bindDeclaration(node, SymbolFlags.GetAccessor, SymbolFlags.GetAccessorExcludes, /*isBlockScopeContainer*/ true);
+ bindPropertyOrMethodOrAccessor(node, SymbolFlags.GetAccessor, SymbolFlags.GetAccessorExcludes, /*isBlockScopeContainer*/ true);
break;
case SyntaxKind.SetAccessor:
- bindDeclaration(node, SymbolFlags.SetAccessor, SymbolFlags.SetAccessorExcludes, /*isBlockScopeContainer*/ true);
+ bindPropertyOrMethodOrAccessor(node, SymbolFlags.SetAccessor, SymbolFlags.SetAccessorExcludes, /*isBlockScopeContainer*/ true);
break;
case SyntaxKind.FunctionType:
@@ -510,5 +507,14 @@ module ts {
declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, SymbolFlags.Property, SymbolFlags.PropertyExcludes);
}
}
+
+ function bindPropertyOrMethodOrAccessor(node: Declaration, symbolKind: SymbolFlags, symbolExcludes: SymbolFlags, isBlockScopeContainer: boolean) {
+ if (hasDynamicName(node)) {
+ bindAnonymousDeclaration(node, symbolKind, "__computed", isBlockScopeContainer);
+ }
+ else {
+ bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer);
+ }
+ }
}
}
diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts
index 3ad62c1d639..fd85a477bd4 100644
--- a/src/compiler/checker.ts
+++ b/src/compiler/checker.ts
@@ -16,6 +16,8 @@ module ts {
var emptySymbols: SymbolTable = {};
var compilerOptions = host.getCompilerOptions();
+ var languageVersion = compilerOptions.target || ScriptTarget.ES3;
+
var emitResolver = createResolver();
var checker: TypeChecker = {
@@ -335,6 +337,25 @@ module ts {
break loop;
}
break;
+
+ // It is not legal to reference a class's own type parameters from a computed property name that
+ // belongs to the class. For example:
+ //
+ // function foo() { return '' }
+ // class C { // <-- Class's own type parameter T
+ // [foo()]() { } // <-- Reference to T from class's own computed property
+ // }
+ //
+ case SyntaxKind.ComputedPropertyName:
+ var grandparent = location.parent.parent;
+ if (grandparent.kind === SyntaxKind.ClassDeclaration || grandparent.kind === SyntaxKind.InterfaceDeclaration) {
+ // A reference to this grandparent's type parameters would be an error
+ if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & SymbolFlags.Type)) {
+ error(errorLocation, Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
+ return undefined;
+ }
+ }
+ break;
case SyntaxKind.MethodDeclaration:
case SyntaxKind.MethodSignature:
case SyntaxKind.Constructor:
@@ -1658,7 +1679,7 @@ module ts {
// Use type of the specified property, or otherwise, for a numeric name, the type of the numeric index signature,
// or otherwise the type of the string index signature.
var type = getTypeOfPropertyOfType(parentType, name.text) ||
- isNumericName(name.text) && getIndexTypeOfType(parentType, IndexKind.Number) ||
+ isNumericLiteralName(name.text) && getIndexTypeOfType(parentType, IndexKind.Number) ||
getIndexTypeOfType(parentType, IndexKind.String);
if (!type) {
error(name, Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), declarationNameToString(name));
@@ -1704,7 +1725,7 @@ module ts {
if (declaration.kind === SyntaxKind.Parameter) {
var func = declaration.parent;
// For a parameter of a set accessor, use the type of the get accessor if one is present
- if (func.kind === SyntaxKind.SetAccessor && !hasComputedNameButNotSymbol(func)) {
+ if (func.kind === SyntaxKind.SetAccessor && !hasDynamicName(func)) {
var getter = getDeclarationOfKind(declaration.parent.symbol, SyntaxKind.GetAccessor);
if (getter) {
return getReturnTypeOfSignature(getSignatureFromDeclaration(getter));
@@ -2620,7 +2641,7 @@ module ts {
else {
// TypeScript 1.0 spec (April 2014):
// If only one accessor includes a type annotation, the other behaves as if it had the same type annotation.
- if (declaration.kind === SyntaxKind.GetAccessor && !hasComputedNameButNotSymbol(declaration)) {
+ if (declaration.kind === SyntaxKind.GetAccessor && !hasDynamicName(declaration)) {
var setter = getDeclarationOfKind(declaration.symbol, SyntaxKind.SetAccessor);
returnType = getAnnotatedAccessorType(setter);
}
@@ -4757,6 +4778,7 @@ module ts {
return type;
}
}
+
/*Transitively mark all linked imports as referenced*/
function markLinkedImportsAsReferenced(node: ImportDeclaration): void {
var nodeLinks = getNodeLinks(node);
@@ -4853,6 +4875,9 @@ module ts {
// do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks
}
break;
+ case SyntaxKind.ComputedPropertyName:
+ error(node, Diagnostics.this_cannot_be_referenced_in_a_computed_property_name);
+ break;
}
if (needToCaptureLexicalThis) {
@@ -4867,26 +4892,6 @@ module ts {
return anyType;
}
- function getSuperContainer(node: Node): Node {
- while (true) {
- node = node.parent;
- if (!node) return node;
- switch (node.kind) {
- case SyntaxKind.FunctionDeclaration:
- case SyntaxKind.FunctionExpression:
- case SyntaxKind.ArrowFunction:
- case SyntaxKind.PropertyDeclaration:
- case SyntaxKind.PropertySignature:
- case SyntaxKind.MethodDeclaration:
- case SyntaxKind.MethodSignature:
- case SyntaxKind.Constructor:
- case SyntaxKind.GetAccessor:
- case SyntaxKind.SetAccessor:
- return node;
- }
- }
- }
-
function isInConstructorArgumentInitializer(node: Node, constructorDecl: Node): boolean {
for (var n = node; n && n !== constructorDecl; n = n.parent) {
if (n.kind === SyntaxKind.Parameter) {
@@ -4910,7 +4915,7 @@ module ts {
return unknownType;
}
- var container = getSuperContainer(node);
+ var container = getSuperContainer(node, /*includeFunctions*/ true);
if (container) {
var canUseSuperExpression = false;
@@ -4928,7 +4933,7 @@ module ts {
// super property access might appear in arrow functions with arbitrary deep nesting
var needToCaptureLexicalThis = false;
while (container && container.kind === SyntaxKind.ArrowFunction) {
- container = getSuperContainer(container);
+ container = getSuperContainer(container, /*includeFunctions*/ true);
needToCaptureLexicalThis = true;
}
@@ -4983,7 +4988,10 @@ module ts {
}
}
- if (isCallExpression) {
+ if (container.kind === SyntaxKind.ComputedPropertyName) {
+ error(node, Diagnostics.super_cannot_be_referenced_in_a_computed_property_name);
+ }
+ else if (isCallExpression) {
error(node, Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors);
}
else {
@@ -5165,13 +5173,22 @@ module ts {
function getContextualTypeForObjectLiteralElement(element: ObjectLiteralElement) {
var objectLiteral = element.parent;
var type = getContextualType(objectLiteral);
- // TODO(jfreeman): Handle this case for computed names and symbols
- var name = (element.name).text;
- if (type && name) {
- return getTypeOfPropertyOfContextualType(type, name) ||
- isNumericName(name) && getIndexTypeOfContextualType(type, IndexKind.Number) ||
+ if (type) {
+ if (!hasDynamicName(element)) {
+ // For a (non-symbol) computed property, there is no reason to look up the name
+ // in the type. It will just be "__computed", which does not appear in any
+ // SymbolTable.
+ var symbolName = getSymbolOfNode(element).name;
+ var propertyType = getTypeOfPropertyOfContextualType(type, symbolName);
+ if (propertyType) {
+ return propertyType;
+ }
+ }
+
+ return isNumericName(element.name) && getIndexTypeOfContextualType(type, IndexKind.Number) ||
getIndexTypeOfContextualType(type, IndexKind.String);
}
+
return undefined;
}
@@ -5370,7 +5387,17 @@ module ts {
return createArrayType(getUnionType(elementTypes));
}
- function isNumericName(name: string) {
+ function isNumericName(name: DeclarationName): boolean {
+ return name.kind === SyntaxKind.ComputedPropertyName ? isNumericComputedName(name) : isNumericLiteralName((name).text);
+ }
+
+ function isNumericComputedName(name: ComputedPropertyName): boolean {
+ // It seems odd to consider an expression of type Any to result in a numeric name,
+ // but this behavior is consistent with checkIndexedAccess
+ return isTypeOfKind(checkComputedPropertyName(name), TypeFlags.Any | TypeFlags.NumberLike);
+ }
+
+ function isNumericLiteralName(name: string) {
// The intent of numeric names is that
// - they are names with text in a numeric form, and that
// - setting properties/indexing with them is always equivalent to doing so with the numeric literal 'numLit',
@@ -5395,64 +5422,85 @@ module ts {
return (+name).toString() === name;
}
+ function checkComputedPropertyName(node: ComputedPropertyName): Type {
+ var links = getNodeLinks(node.expression);
+ if (!links.resolvedType) {
+ links.resolvedType = checkExpression(node.expression);
+
+ // This will allow types number, string, or any. It will also allow enums, the unknown
+ // type, and any union of these types (like string | number).
+ if (!isTypeOfKind(links.resolvedType, TypeFlags.Any | TypeFlags.NumberLike | TypeFlags.StringLike)) {
+ error(node, Diagnostics.A_computed_property_name_must_be_of_type_string_number_or_any);
+ }
+ }
+
+ return links.resolvedType;
+ }
+
function checkObjectLiteral(node: ObjectLiteralExpression, contextualMapper?: TypeMapper): Type {
// Grammar checking
checkGrammarObjectLiteralExpression(node);
- var members = node.symbol.members;
var properties: SymbolTable = {};
var contextualType = getContextualType(node);
var typeFlags: TypeFlags;
- for (var id in members) {
- if (hasProperty(members, id)) {
- var member = members[id];
- if (member.flags & SymbolFlags.Property || isObjectLiteralMethod(member.declarations[0])) {
- var memberDecl = member.declarations[0];
- if (memberDecl.kind === SyntaxKind.PropertyAssignment) {
- var type = checkExpression((memberDecl).initializer, contextualMapper);
- }
- else if (memberDecl.kind === SyntaxKind.MethodDeclaration) {
- var type = checkObjectLiteralMethod(memberDecl, contextualMapper);
- }
- else {
- Debug.assert(memberDecl.kind === SyntaxKind.ShorthandPropertyAssignment);
- var type = memberDecl.name.kind === SyntaxKind.ComputedPropertyName
- ? unknownType
- : checkExpression(memberDecl.name, contextualMapper);
- }
- typeFlags |= type.flags;
- var prop = createSymbol(SymbolFlags.Property | SymbolFlags.Transient | member.flags, member.name);
- prop.declarations = member.declarations;
- prop.parent = member.parent;
- if (member.valueDeclaration) {
- prop.valueDeclaration = member.valueDeclaration;
- }
-
- prop.type = type;
- prop.target = member;
- member = prop;
+ for (var i = 0; i < node.properties.length; i++) {
+ var memberDecl = node.properties[i];
+ var member = memberDecl.symbol;
+ if (memberDecl.kind === SyntaxKind.PropertyAssignment ||
+ memberDecl.kind === SyntaxKind.ShorthandPropertyAssignment ||
+ isObjectLiteralMethod(memberDecl)) {
+ if (memberDecl.kind === SyntaxKind.PropertyAssignment) {
+ var type = checkPropertyAssignment(memberDecl, contextualMapper);
+ }
+ else if (memberDecl.kind === SyntaxKind.MethodDeclaration) {
+ var type = checkObjectLiteralMethod(memberDecl, contextualMapper);
}
else {
- // TypeScript 1.0 spec (April 2014)
- // A get accessor declaration is processed in the same manner as
- // an ordinary function declaration(section 6.1) with no parameters.
- // A set accessor declaration is processed in the same manner
- // as an ordinary function declaration with a single parameter and a Void return type.
- var getAccessor = getDeclarationOfKind(member, SyntaxKind.GetAccessor);
- if (getAccessor) {
- checkAccessorDeclaration(getAccessor);
- }
-
- var setAccessor = getDeclarationOfKind(member, SyntaxKind.SetAccessor);
- if (setAccessor) {
- checkAccessorDeclaration(setAccessor);
- }
+ Debug.assert(memberDecl.kind === SyntaxKind.ShorthandPropertyAssignment);
+ var type = memberDecl.name.kind === SyntaxKind.ComputedPropertyName
+ ? unknownType
+ : checkExpression(memberDecl.name, contextualMapper);
}
+ typeFlags |= type.flags;
+ var prop = createSymbol(SymbolFlags.Property | SymbolFlags.Transient | member.flags, member.name);
+ prop.declarations = member.declarations;
+ prop.parent = member.parent;
+ if (member.valueDeclaration) {
+ prop.valueDeclaration = member.valueDeclaration;
+ }
+
+ prop.type = type;
+ prop.target = member;
+ member = prop;
+ }
+ else {
+ // TypeScript 1.0 spec (April 2014)
+ // A get accessor declaration is processed in the same manner as
+ // an ordinary function declaration(section 6.1) with no parameters.
+ // A set accessor declaration is processed in the same manner
+ // as an ordinary function declaration with a single parameter and a Void return type.
+ Debug.assert(memberDecl.kind === SyntaxKind.GetAccessor || memberDecl.kind === SyntaxKind.SetAccessor);
+ checkAccessorDeclaration(memberDecl);
+ }
+
+ if (!hasDynamicName(memberDecl)) {
properties[member.name] = member;
}
}
+ // If object literal is contextually (but not inferentially) typed, copy missing optional properties from
+ // the contextual type such that the resulting type becomes a subtype in cases where only optional properties
+ // were omitted. There is no need to create new property objects as nothing in them needs to change.
+ if (contextualType && !isInferentialContext(contextualMapper)) {
+ forEach(getPropertiesOfObjectType(contextualType), p => {
+ if (p.flags & SymbolFlags.Optional && !hasProperty(properties, p.name)) {
+ properties[p.name] = p;
+ }
+ });
+ }
+
var stringIndexType = getIndexType(IndexKind.String);
var numberIndexType = getIndexType(IndexKind.Number);
var result = createAnonymousType(node.symbol, properties, emptyArray, emptyArray, stringIndexType, numberIndexType);
@@ -5462,13 +5510,12 @@ module ts {
function getIndexType(kind: IndexKind) {
if (contextualType && contextualTypeHasIndexSignature(contextualType, kind)) {
var propTypes: Type[] = [];
- for (var id in properties) {
- if (hasProperty(properties, id)) {
- if (kind === IndexKind.String || isNumericName(id)) {
- var type = getTypeOfSymbol(properties[id]);
- if (!contains(propTypes, type)) {
- propTypes.push(type);
- }
+ for (var i = 0; i < node.properties.length; i++) {
+ var propertyDecl = node.properties[i];
+ if (kind === IndexKind.String || isNumericName(propertyDecl.name)) {
+ var type = getTypeOfSymbol(getSymbolOfNode(propertyDecl));
+ if (!contains(propTypes, type)) {
+ propTypes.push(type);
}
}
}
@@ -5618,7 +5665,7 @@ module ts {
}
var isConstEnum = isConstEnumObjectType(objectType);
- if (isConstEnum &&
+ if (isConstEnum &&
(!node.argumentExpression || node.argumentExpression.kind !== SyntaxKind.StringLiteral)) {
error(node.argumentExpression, Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal);
return unknownType;
@@ -5650,10 +5697,10 @@ module ts {
}
// Check for compatible indexer types.
- if (indexType.flags & (TypeFlags.Any | TypeFlags.StringLike | TypeFlags.NumberLike)) {
+ if (isTypeOfKind(indexType, TypeFlags.Any | TypeFlags.StringLike | TypeFlags.NumberLike)) {
// Try to use a number indexer.
- if (indexType.flags & (TypeFlags.Any | TypeFlags.NumberLike)) {
+ if (isTypeOfKind(indexType, TypeFlags.Any | TypeFlags.NumberLike)) {
var numberIndexType = getIndexTypeOfType(objectType, IndexKind.Number);
if (numberIndexType) {
return numberIndexType;
@@ -6357,7 +6404,7 @@ module ts {
function checkTaggedTemplateExpression(node: TaggedTemplateExpression): Type {
// Grammar checking
- if (compilerOptions.target < ScriptTarget.ES6) {
+ if (languageVersion < ScriptTarget.ES6) {
grammarErrorOnFirstToken(node.template, Diagnostics.Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher);
}
@@ -6554,7 +6601,7 @@ module ts {
}
function checkArithmeticOperandType(operand: Node, type: Type, diagnostic: DiagnosticMessage): boolean {
- if (!(type.flags & (TypeFlags.Any | TypeFlags.NumberLike))) {
+ if (!isTypeOfKind(type, TypeFlags.Any | TypeFlags.NumberLike)) {
error(operand, diagnostic);
return false;
}
@@ -6705,12 +6752,21 @@ module ts {
return numberType;
}
- // Return true if type an object type, a type parameter, or a union type composed of only those kinds of types
- function isStructuredType(type: Type): boolean {
- if (type.flags & TypeFlags.Union) {
- return !forEach((type).types, t => !isStructuredType(t));
+ // Return true if type has the given flags, or is a union type composed of types that all have those flags
+ function isTypeOfKind(type: Type, kind: TypeFlags): boolean {
+ if (type.flags & kind) {
+ return true;
}
- return (type.flags & (TypeFlags.ObjectType | TypeFlags.TypeParameter)) !== 0;
+ if (type.flags & TypeFlags.Union) {
+ var types = (type).types;
+ for (var i = 0; i < types.length; i++) {
+ if (!(types[i].flags & kind)) {
+ return false;
+ }
+ }
+ return true;
+ }
+ return false;
}
function isConstEnumObjectType(type: Type): boolean {
@@ -6727,7 +6783,7 @@ module ts {
// and the right operand to be of type Any or a subtype of the 'Function' interface type.
// The result is always of the Boolean primitive type.
// NOTE: do not raise error if leftType is unknown as related error was already reported
- if (!(leftType.flags & TypeFlags.Any || isStructuredType(leftType))) {
+ if (!isTypeOfKind(leftType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter)) {
error(node.left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
}
// NOTE: do not raise error if right is unknown as related error was already reported
@@ -6742,10 +6798,10 @@ module ts {
// The in operator requires the left operand to be of type Any, the String primitive type, or the Number primitive type,
// and the right operand to be of type Any, an object type, or a type parameter type.
// The result is always of the Boolean primitive type.
- if (leftType !== anyType && leftType !== stringType && leftType !== numberType) {
+ if (!isTypeOfKind(leftType, TypeFlags.Any | TypeFlags.StringLike | TypeFlags.NumberLike)) {
error(node.left, Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number);
}
- if (!(rightType.flags & TypeFlags.Any || isStructuredType(rightType))) {
+ if (!isTypeOfKind(rightType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter)) {
error(node.right, Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
}
return booleanType;
@@ -6760,7 +6816,7 @@ module ts {
var name = (p).name;
var type = sourceType.flags & TypeFlags.Any ? sourceType :
getTypeOfPropertyOfType(sourceType, name.text) ||
- isNumericName(name.text) && getIndexTypeOfType(sourceType, IndexKind.Number) ||
+ isNumericLiteralName(name.text) && getIndexTypeOfType(sourceType, IndexKind.Number) ||
getIndexTypeOfType(sourceType, IndexKind.String);
if (type) {
checkDestructuringAssignment((p).initializer || name, type);
@@ -6906,16 +6962,16 @@ module ts {
if (rightType.flags & (TypeFlags.Undefined | TypeFlags.Null)) rightType = leftType;
var resultType: Type;
- if (leftType.flags & TypeFlags.NumberLike && rightType.flags & TypeFlags.NumberLike) {
+ if (isTypeOfKind(leftType, TypeFlags.NumberLike) && isTypeOfKind(rightType, TypeFlags.NumberLike)) {
// Operands of an enum type are treated as having the primitive type Number.
// If both operands are of the Number primitive type, the result is of the Number primitive type.
resultType = numberType;
}
- else if (leftType.flags & TypeFlags.StringLike || rightType.flags & TypeFlags.StringLike) {
+ else if (isTypeOfKind(leftType, TypeFlags.StringLike) || isTypeOfKind(rightType, TypeFlags.StringLike)) {
// If one or both operands are of the String primitive type, the result is of the String primitive type.
resultType = stringType;
}
- else if (leftType.flags & TypeFlags.Any || leftType === unknownType || rightType.flags & TypeFlags.Any || rightType === unknownType) {
+ else if (leftType.flags & TypeFlags.Any || rightType.flags & TypeFlags.Any) {
// Otherwise, the result is of type Any.
// NOTE: unknown type here denotes error type. Old compiler treated this case as any type so do we.
resultType = anyType;
@@ -7041,10 +7097,22 @@ module ts {
return links.resolvedType;
}
+ function checkPropertyAssignment(node: PropertyAssignment, contextualMapper?: TypeMapper): Type {
+ if (hasDynamicName(node)) {
+ checkComputedPropertyName(node.name);
+ }
+
+ return checkExpression((node).initializer, contextualMapper);
+ }
+
function checkObjectLiteralMethod(node: MethodDeclaration, contextualMapper?: TypeMapper): Type {
// Grammar checking
checkGrammarMethod(node);
+ if (hasDynamicName(node)) {
+ checkComputedPropertyName(node.name);
+ }
+
var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper);
return instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper);
}
@@ -7415,7 +7483,7 @@ module ts {
}
}
- if (!hasComputedNameButNotSymbol(node)) {
+ if (!hasDynamicName(node)) {
// TypeScript 1.0 spec (April 2014): 8.4.3
// Accessors for the same member name must specify the same accessibility.
var otherKind = node.kind === SyntaxKind.GetAccessor ? SyntaxKind.SetAccessor : SyntaxKind.GetAccessor;
@@ -7435,9 +7503,9 @@ module ts {
}
}
}
-
- checkAndStoreTypeOfAccessors(getSymbolOfNode(node));
}
+
+ checkAndStoreTypeOfAccessors(getSymbolOfNode(node));
}
checkFunctionLikeDeclaration(node);
@@ -7853,7 +7921,12 @@ module ts {
function checkFunctionLikeDeclaration(node: FunctionLikeDeclaration): void {
checkSignatureDeclaration(node);
- if (!hasComputedNameButNotSymbol(node)) {
+ if (hasDynamicName(node)) {
+ // This check will account for methods in class/interface declarations,
+ // as well as accessors in classes/object literals
+ checkComputedPropertyName(node.name);
+ }
+ else {
// first we want to check the local symbol that contain this declaration
// - if node.localSymbol !== undefined - this is current declaration is exported and localSymbol points to the local symbol
// - if node.localSymbol === undefined - this node is non-exported so we can just pick the result of getSymbolOfNode
@@ -8082,7 +8155,8 @@ module ts {
function checkVariableLikeDeclaration(node: VariableLikeDeclaration) {
checkSourceElement(node.type);
// For a computed property, just check the initializer and exit
- if (hasComputedNameButNotSymbol(node)) {
+ if (hasDynamicName(node)) {
+ checkComputedPropertyName(node.name);
if (node.initializer) {
checkExpressionCached(node.initializer);
}
@@ -8271,7 +8345,7 @@ module ts {
var exprType = checkExpression(node.expression);
// unknownType is returned i.e. if node.expression is identifier whose name cannot be resolved
// in this case error about missing name is already reported - do not report extra one
- if (!(exprType.flags & TypeFlags.Any || isStructuredType(exprType))) {
+ if (!isTypeOfKind(exprType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter)) {
error(node.expression, Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter);
}
@@ -8425,45 +8499,7 @@ module ts {
if (node.finallyBlock) checkBlock(node.finallyBlock);
}
- function checkIndexConstraints(type: Type) {
-
- function checkIndexConstraintForProperty(prop: Symbol, propertyType: Type, indexDeclaration: Declaration, indexType: Type, indexKind: IndexKind): void {
- if (!indexType) {
- return;
- }
-
- // index is numeric and property name is not valid numeric literal
- if (indexKind === IndexKind.Number && !isNumericName(prop.name)) {
- return;
- }
-
- // perform property check if property or indexer is declared in 'type'
- // this allows to rule out cases when both property and indexer are inherited from the base class
- var errorNode: Node;
- if (prop.parent === type.symbol) {
- errorNode = prop.valueDeclaration;
- }
- else if (indexDeclaration) {
- errorNode = indexDeclaration;
- }
-
- else if (type.flags & TypeFlags.Interface) {
- // for interfaces property and indexer might be inherited from different bases
- // check if any base class already has both property and indexer.
- // check should be performed only if 'type' is the first type that brings property\indexer together
- var someBaseClassHasBothPropertyAndIndexer = forEach((type).baseTypes, base => getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind));
- errorNode = someBaseClassHasBothPropertyAndIndexer ? undefined : type.symbol.declarations[0];
- }
-
- if (errorNode && !isTypeAssignableTo(propertyType, indexType)) {
- var errorMessage =
- indexKind === IndexKind.String
- ? Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2
- : Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2;
- error(errorNode, errorMessage, symbolToString(prop), typeToString(propertyType), typeToString(indexType));
- }
- }
-
+ function checkIndexConstraints(type: Type) {
var declaredNumberIndexer = getIndexDeclarationOfSymbol(type.symbol, IndexKind.Number);
var declaredStringIndexer = getIndexDeclarationOfSymbol(type.symbol, IndexKind.String);
@@ -8473,9 +8509,24 @@ module ts {
if (stringIndexType || numberIndexType) {
forEach(getPropertiesOfObjectType(type), prop => {
var propType = getTypeOfSymbol(prop);
- checkIndexConstraintForProperty(prop, propType, declaredStringIndexer, stringIndexType, IndexKind.String);
- checkIndexConstraintForProperty(prop, propType, declaredNumberIndexer, numberIndexType, IndexKind.Number);
+ checkIndexConstraintForProperty(prop, propType, type, declaredStringIndexer, stringIndexType, IndexKind.String);
+ checkIndexConstraintForProperty(prop, propType, type, declaredNumberIndexer, numberIndexType, IndexKind.Number);
});
+
+ if (type.flags & TypeFlags.Class && type.symbol.valueDeclaration.kind === SyntaxKind.ClassDeclaration) {
+ var classDeclaration = type.symbol.valueDeclaration;
+ for (var i = 0; i < classDeclaration.members.length; i++) {
+ var member = classDeclaration.members[i];
+ // Only process instance properties with computed names here.
+ // Static properties cannot be in conflict with indexers,
+ // and properties with literal names were already checked.
+ if (!(member.flags & NodeFlags.Static) && hasDynamicName(member)) {
+ var propType = getTypeOfSymbol(member.symbol);
+ checkIndexConstraintForProperty(member.symbol, propType, type, declaredStringIndexer, stringIndexType, IndexKind.String);
+ checkIndexConstraintForProperty(member.symbol, propType, type, declaredNumberIndexer, numberIndexType, IndexKind.Number);
+ }
+ }
+ }
}
var errorNode: Node;
@@ -8492,9 +8543,51 @@ module ts {
error(errorNode, Diagnostics.Numeric_index_type_0_is_not_assignable_to_string_index_type_1,
typeToString(numberIndexType), typeToString(stringIndexType));
}
+
+ function checkIndexConstraintForProperty(
+ prop: Symbol,
+ propertyType: Type,
+ containingType: Type,
+ indexDeclaration: Declaration,
+ indexType: Type,
+ indexKind: IndexKind): void {
+
+ if (!indexType) {
+ return;
+ }
+
+ // index is numeric and property name is not valid numeric literal
+ if (indexKind === IndexKind.Number && !isNumericName(prop.valueDeclaration.name)) {
+ return;
+ }
+
+ // perform property check if property or indexer is declared in 'type'
+ // this allows to rule out cases when both property and indexer are inherited from the base class
+ var errorNode: Node;
+ if (prop.valueDeclaration.name.kind === SyntaxKind.ComputedPropertyName || prop.parent === containingType.symbol) {
+ errorNode = prop.valueDeclaration;
+ }
+ else if (indexDeclaration) {
+ errorNode = indexDeclaration;
+ }
+ else if (containingType.flags & TypeFlags.Interface) {
+ // for interfaces property and indexer might be inherited from different bases
+ // check if any base class already has both property and indexer.
+ // check should be performed only if 'type' is the first type that brings property\indexer together
+ var someBaseClassHasBothPropertyAndIndexer = forEach((containingType).baseTypes, base => getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind));
+ errorNode = someBaseClassHasBothPropertyAndIndexer ? undefined : containingType.symbol.declarations[0];
+ }
+
+ if (errorNode && !isTypeAssignableTo(propertyType, indexType)) {
+ var errorMessage =
+ indexKind === IndexKind.String
+ ? Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2
+ : Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2;
+ error(errorNode, errorMessage, symbolToString(prop), typeToString(propertyType), typeToString(indexType));
+ }
+ }
}
- // TODO(jfreeman): Decide what to do for computed properties
function checkTypeNameIsReserved(name: DeclarationName, message: DiagnosticMessage): void {
// TS 1.0 spec (April 2014): 3.6.1
// The predefined type keywords are reserved and cannot be used as names of user defined types.
@@ -8788,8 +8881,7 @@ module ts {
var enumIsConst = isConst(node);
forEach(node.members, member => {
- // TODO(jfreeman): Check that it is not a computed name
- if(isNumericName((member.name).text)) {
+ if (member.name.kind !== SyntaxKind.ComputedPropertyName && isNumericLiteralName((member.name).text)) {
error(member.name, Diagnostics.An_enum_member_cannot_have_a_numeric_name);
}
var initializer = member.initializer;
@@ -9979,8 +10071,8 @@ module ts {
if (symbol && (symbol.flags & SymbolFlags.EnumMember)) {
var declaration = symbol.valueDeclaration;
var constantValue: number;
- if (declaration.kind === SyntaxKind.EnumMember && (constantValue = getNodeLinks(declaration).enumMemberValue) !== undefined) {
- return constantValue;
+ if (declaration.kind === SyntaxKind.EnumMember) {
+ return getEnumMemberValue(declaration);
}
}
@@ -10055,7 +10147,7 @@ module ts {
globalRegExpType = getGlobalType("RegExp");
// If we're in ES6 mode, load the TemplateStringsArray.
// Otherwise, default to 'unknown' for the purposes of type checking in LS scenarios.
- globalTemplateStringsArrayType = compilerOptions.target >= ScriptTarget.ES6
+ globalTemplateStringsArrayType = languageVersion >= ScriptTarget.ES6
? getGlobalType("TemplateStringsArray")
: unknownType;
anyArrayType = createArrayType(anyType);
@@ -10416,22 +10508,18 @@ module ts {
return false;
}
- function checkGrammarComputedPropertyName(node: Node): void {
+ function checkGrammarComputedPropertyName(node: Node): boolean {
// If node is not a computedPropertyName, just skip the grammar checking
if (node.kind !== SyntaxKind.ComputedPropertyName) {
- return;
+ return false;
}
- // Since computed properties are not supported in the type checker, disallow them in TypeScript 1.4
- // Once full support is added, remove this error.
- grammarErrorOnNode(node, Diagnostics.Computed_property_names_are_not_currently_supported);
- return;
var computedPropertyName = node;
- if (compilerOptions.target < ScriptTarget.ES6) {
- grammarErrorOnNode(node, Diagnostics.Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher);
+ if (languageVersion < ScriptTarget.ES6) {
+ return grammarErrorOnNode(node, Diagnostics.Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher);
}
else if (computedPropertyName.expression.kind === SyntaxKind.BinaryExpression && (computedPropertyName.expression).operator === SyntaxKind.CommaToken) {
- grammarErrorOnNode(computedPropertyName.expression, Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name);
+ return grammarErrorOnNode(computedPropertyName.expression, Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name);
}
}
@@ -10527,7 +10615,7 @@ module ts {
function checkGrammarAccessor(accessor: MethodDeclaration): boolean {
var kind = accessor.kind;
- if (compilerOptions.target < ScriptTarget.ES5) {
+ if (languageVersion < ScriptTarget.ES5) {
return grammarErrorOnNode(accessor.name, Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher);
}
else if (isInAmbientContext(accessor)) {
@@ -10732,7 +10820,7 @@ module ts {
return grammarErrorAtPos(getSourceFileOfNode(declarationList), declarations.pos, declarations.end - declarations.pos, Diagnostics.Variable_declaration_list_cannot_be_empty);
}
- if (compilerOptions.target < ScriptTarget.ES6) {
+ if (languageVersion < ScriptTarget.ES6) {
if (isLet(declarationList)) {
return grammarErrorOnFirstToken(declarationList, Diagnostics.let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher);
}
@@ -10834,7 +10922,7 @@ module ts {
function grammarErrorOnFirstToken(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): boolean {
var sourceFile = getSourceFileOfNode(node);
if (!hasParseDiagnostics(sourceFile)) {
- var scanner = createScanner(compilerOptions.target, /*skipTrivia*/ true, sourceFile.text);
+ var scanner = createScanner(languageVersion, /*skipTrivia*/ true, sourceFile.text);
var start = scanToken(scanner, node.pos);
diagnostics.push(createFileDiagnostic(sourceFile, start, scanner.getTextPos() - start, message, arg0, arg1, arg2));
return true;
@@ -10976,7 +11064,7 @@ module ts {
if (node.parserContextFlags & ParserContextFlags.StrictMode) {
return grammarErrorOnNode(node, Diagnostics.Octal_literals_are_not_allowed_in_strict_mode);
}
- else if (compilerOptions.target >= ScriptTarget.ES5) {
+ else if (languageVersion >= ScriptTarget.ES5) {
return grammarErrorOnNode(node, Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher);
}
}
@@ -10985,7 +11073,7 @@ module ts {
function grammarErrorAfterFirstToken(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): boolean {
var sourceFile = getSourceFileOfNode(node);
if (!hasParseDiagnostics(sourceFile)) {
- var scanner = createScanner(compilerOptions.target, /*skipTrivia*/ true, sourceFile.text);
+ var scanner = createScanner(languageVersion, /*skipTrivia*/ true, sourceFile.text);
scanToken(scanner, node.pos);
diagnostics.push(createFileDiagnostic(sourceFile, scanner.getTextPos(), 0, message, arg0, arg1, arg2));
return true;
diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts
index fa31f25f7c3..23bbba5c6ca 100644
--- a/src/compiler/commandLineParser.ts
+++ b/src/compiler/commandLineParser.ts
@@ -33,6 +33,10 @@ module ts {
type: "boolean",
description: Diagnostics.Print_this_message,
},
+ {
+ name: "listFiles",
+ type: "boolean",
+ },
{
name: "locale",
type: "string",
@@ -40,6 +44,7 @@ module ts {
{
name: "mapRoot",
type: "string",
+ isFilePath: true,
description: Diagnostics.Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
paramType: Diagnostics.LOCATION,
},
@@ -90,6 +95,7 @@ module ts {
{
name: "outDir",
type: "string",
+ isFilePath: true,
description: Diagnostics.Redirect_output_structure_to_the_directory,
paramType: Diagnostics.DIRECTORY,
},
@@ -98,6 +104,14 @@ module ts {
type: "boolean",
description: Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code
},
+ {
+ name: "project",
+ shortName: "p",
+ type: "string",
+ isFilePath: true,
+ description: Diagnostics.Compile_the_project_in_the_given_directory,
+ paramType: Diagnostics.DIRECTORY
+ },
{
name: "removeComments",
type: "boolean",
@@ -111,6 +125,7 @@ module ts {
{
name: "sourceRoot",
type: "string",
+ isFilePath: true,
description: Diagnostics.Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations,
paramType: Diagnostics.LOCATION,
},
@@ -141,26 +156,19 @@ module ts {
}
];
- var shortOptionNames: Map = {};
- var optionNameMap: Map = {};
-
- forEach(optionDeclarations, option => {
- optionNameMap[option.name.toLowerCase()] = option;
-
- if (option.shortName) {
- shortOptionNames[option.shortName] = option.name;
- }
- });
-
export function parseCommandLine(commandLine: string[]): ParsedCommandLine {
- // Set default compiler option values
- var options: CompilerOptions = {
- target: ScriptTarget.ES3,
- module: ModuleKind.None
- };
+ var options: CompilerOptions = {};
var filenames: string[] = [];
var errors: Diagnostic[] = [];
+ var shortOptionNames: Map = {};
+ var optionNameMap: Map = {};
+ forEach(optionDeclarations, option => {
+ optionNameMap[option.name.toLowerCase()] = option;
+ if (option.shortName) {
+ shortOptionNames[option.shortName] = option.name;
+ }
+ });
parseStrings(commandLine);
return {
options,
@@ -256,4 +264,84 @@ module ts {
parseStrings(args);
}
}
+
+ export function readConfigFile(filename: string): any {
+ try {
+ var text = sys.readFile(filename);
+ return /\S/.test(text) ? JSON.parse(text) : {};
+ }
+ catch (e) {
+ }
+ }
+
+ export function parseConfigFile(json: any, basePath?: string): ParsedCommandLine {
+ var errors: Diagnostic[] = [];
+
+ return {
+ options: getCompilerOptions(),
+ filenames: getFiles(),
+ errors
+ };
+
+ function getCompilerOptions(): CompilerOptions {
+ var options: CompilerOptions = {};
+ var optionNameMap: Map = {};
+ forEach(optionDeclarations, option => {
+ optionNameMap[option.name] = option;
+ });
+ var jsonOptions = json["compilerOptions"];
+ if (jsonOptions) {
+ for (var id in jsonOptions) {
+ if (hasProperty(optionNameMap, id)) {
+ var opt = optionNameMap[id];
+ var optType = opt.type;
+ var value = jsonOptions[id];
+ var expectedType = typeof optType === "string" ? optType : "string";
+ if (typeof value === expectedType) {
+ if (typeof optType !== "string") {
+ var key = value.toLowerCase();
+ if (hasProperty(optType, key)) {
+ value = optType[key];
+ }
+ else {
+ errors.push(createCompilerDiagnostic(opt.error));
+ value = 0;
+ }
+ }
+ if (opt.isFilePath) {
+ value = normalizePath(combinePaths(basePath, value));
+ }
+ options[opt.name] = value;
+ }
+ else {
+ errors.push(createCompilerDiagnostic(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, id, expectedType));
+ }
+ }
+ else {
+ errors.push(createCompilerDiagnostic(Diagnostics.Unknown_compiler_option_0, id));
+ }
+ }
+ }
+ return options;
+ }
+
+ function getFiles(): string[] {
+ var files: string[] = [];
+ if (hasProperty(json, "files")) {
+ if (json["files"] instanceof Array) {
+ var files = map(json["files"], s => combinePaths(basePath, s));
+ }
+ }
+ else {
+ var sysFiles = sys.readDirectory(basePath, ".ts");
+ for (var i = 0; i < sysFiles.length; i++) {
+ var name = sysFiles[i];
+ if (!fileExtensionIs(name, ".d.ts") || !contains(sysFiles, name.substr(0, name.length - 5) + ".ts")) {
+ files.push(name);
+ }
+ }
+ }
+ return files;
+ }
+ }
}
diff --git a/src/compiler/core.ts b/src/compiler/core.ts
index aafec557de4..3f882be15a5 100644
--- a/src/compiler/core.ts
+++ b/src/compiler/core.ts
@@ -178,6 +178,19 @@ module ts {
return result;
}
+ export function extend(first: Map, second: Map): Map {
+ var result: Map = {};
+ for (var id in first) {
+ result[id] = first[id];
+ }
+ for (var id in second) {
+ if (!hasProperty(result, id)) {
+ result[id] = second[id];
+ }
+ }
+ return result;
+ }
+
export function forEachValue(map: Map, callback: (value: T) => U): U {
var result: U;
for (var id in map) {
@@ -568,7 +581,7 @@ module ts {
export function combinePaths(path1: string, path2: string) {
if (!(path1 && path1.length)) return path2;
if (!(path2 && path2.length)) return path1;
- if (path2.charAt(0) === directorySeparator) return path2;
+ if (getRootLength(path2) !== 0) return path2;
if (path1.charAt(path1.length - 1) === directorySeparator) return path1 + path2;
return path1 + directorySeparator + path2;
}
diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts
index 9d62ee0e030..f333520733e 100644
--- a/src/compiler/diagnosticInformationMap.generated.ts
+++ b/src/compiler/diagnosticInformationMap.generated.ts
@@ -299,6 +299,10 @@ module ts {
Type_0_is_not_an_array_type: { code: 2461, category: DiagnosticCategory.Error, key: "Type '{0}' is not an array type." },
A_rest_element_must_be_last_in_an_array_destructuring_pattern: { code: 2462, category: DiagnosticCategory.Error, key: "A rest element must be last in an array destructuring pattern" },
A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: DiagnosticCategory.Error, key: "A binding pattern parameter cannot be optional in an implementation signature." },
+ A_computed_property_name_must_be_of_type_string_number_or_any: { code: 2464, category: DiagnosticCategory.Error, key: "A computed property name must be of type 'string', 'number', or 'any'." },
+ this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: DiagnosticCategory.Error, key: "'this' cannot be referenced in a computed property name." },
+ super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: DiagnosticCategory.Error, key: "'super' cannot be referenced in a computed property name." },
+ A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2466, category: DiagnosticCategory.Error, key: "A computed property name cannot reference a type parameter from its containing type." },
Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
@@ -380,11 +384,13 @@ module ts {
Cannot_read_file_0_Colon_1: { code: 5012, category: DiagnosticCategory.Error, key: "Cannot read file '{0}': {1}" },
Unsupported_file_encoding: { code: 5013, category: DiagnosticCategory.Error, key: "Unsupported file encoding." },
Unknown_compiler_option_0: { code: 5023, category: DiagnosticCategory.Error, key: "Unknown compiler option '{0}'." },
+ Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: DiagnosticCategory.Error, key: "Compiler option '{0}' requires a value of type {1}." },
Could_not_write_file_0_Colon_1: { code: 5033, category: DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" },
- Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: DiagnosticCategory.Error, key: "Option mapRoot cannot be specified without specifying sourcemap option." },
- Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: DiagnosticCategory.Error, key: "Option sourceRoot cannot be specified without specifying sourcemap option." },
- Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: DiagnosticCategory.Error, key: "Option noEmit cannot be specified with option out or outDir." },
- Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: DiagnosticCategory.Error, key: "Option noEmit cannot be specified with option declaration." },
+ Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." },
+ Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." },
+ Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." },
+ Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'declaration'." },
+ Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." },
Concatenate_and_emit_output_to_single_file: { code: 6001, category: DiagnosticCategory.Message, key: "Concatenate and emit output to single file." },
Generates_corresponding_d_ts_file: { code: 6002, category: DiagnosticCategory.Message, key: "Generates corresponding '.d.ts' file." },
Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: DiagnosticCategory.Message, key: "Specifies the location where debugger should locate map files instead of generated locations." },
@@ -399,6 +405,7 @@ module ts {
Specify_module_code_generation_Colon_commonjs_or_amd: { code: 6016, category: DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs' or 'amd'" },
Print_this_message: { code: 6017, category: DiagnosticCategory.Message, key: "Print this message." },
Print_the_compiler_s_version: { code: 6019, category: DiagnosticCategory.Message, key: "Print the compiler's version." },
+ Compile_the_project_in_the_given_directory: { code: 6020, category: DiagnosticCategory.Message, key: "Compile the project in the given directory." },
Syntax_Colon_0: { code: 6023, category: DiagnosticCategory.Message, key: "Syntax: {0}" },
options: { code: 6024, category: DiagnosticCategory.Message, key: "options" },
file: { code: 6025, category: DiagnosticCategory.Message, key: "file" },
@@ -406,7 +413,7 @@ module ts {
Options_Colon: { code: 6027, category: DiagnosticCategory.Message, key: "Options:" },
Version_0: { code: 6029, category: DiagnosticCategory.Message, key: "Version {0}" },
Insert_command_line_options_and_files_from_a_file: { code: 6030, category: DiagnosticCategory.Message, key: "Insert command line options and files from a file." },
- File_change_detected_Compiling: { code: 6032, category: DiagnosticCategory.Message, key: "File change detected. Compiling..." },
+ File_change_detected_Starting_incremental_compilation: { code: 6032, category: DiagnosticCategory.Message, key: "File change detected. Starting incremental compilation..." },
KIND: { code: 6034, category: DiagnosticCategory.Message, key: "KIND" },
FILE: { code: 6035, category: DiagnosticCategory.Message, key: "FILE" },
VERSION: { code: 6036, category: DiagnosticCategory.Message, key: "VERSION" },
@@ -445,6 +452,5 @@ module ts {
You_cannot_rename_this_element: { code: 8000, category: DiagnosticCategory.Error, key: "You cannot rename this element." },
yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported.", isEarly: true },
Generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "Generators are not currently supported.", isEarly: true },
- Computed_property_names_are_not_currently_supported: { code: 9002, category: DiagnosticCategory.Error, key: "Computed property names are not currently supported.", isEarly: true },
};
}
\ No newline at end of file
diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json
index ee962edc3a0..49ee8eebcd9 100644
--- a/src/compiler/diagnosticMessages.json
+++ b/src/compiler/diagnosticMessages.json
@@ -675,7 +675,7 @@
},
"A parameter property may not be a binding pattern.": {
"category": "Error",
- "code": 1187
+ "code": 1187
},
"Duplicate identifier '{0}'.": {
@@ -1288,7 +1288,23 @@
},
"A binding pattern parameter cannot be optional in an implementation signature.": {
"category": "Error",
- "code": 2463
+ "code": 2463
+ },
+ "A computed property name must be of type 'string', 'number', or 'any'.": {
+ "category": "Error",
+ "code": 2464
+ },
+ "'this' cannot be referenced in a computed property name.": {
+ "category": "Error",
+ "code": 2465
+ },
+ "'super' cannot be referenced in a computed property name.": {
+ "category": "Error",
+ "code": 2466
+ },
+ "A computed property name cannot reference a type parameter from its containing type.": {
+ "category": "Error",
+ "code": 2466
},
"Import declaration '{0}' is using private name '{1}'.": {
@@ -1618,26 +1634,34 @@
"category": "Error",
"code": 5023
},
+ "Compiler option '{0}' requires a value of type {1}.": {
+ "category": "Error",
+ "code": 5024
+ },
"Could not write file '{0}': {1}": {
"category": "Error",
"code": 5033
},
- "Option mapRoot cannot be specified without specifying sourcemap option.": {
+ "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option.": {
"category": "Error",
"code": 5038
},
- "Option sourceRoot cannot be specified without specifying sourcemap option.": {
+ "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option.": {
"category": "Error",
"code": 5039
},
- "Option noEmit cannot be specified with option out or outDir.": {
+ "Option 'noEmit' cannot be specified with option 'out' or 'outDir'.": {
"category": "Error",
"code": 5040
},
- "Option noEmit cannot be specified with option declaration.": {
+ "Option 'noEmit' cannot be specified with option 'declaration'.": {
"category": "Error",
"code": 5041
},
+ "Option 'project' cannot be mixed with source files on a command line.": {
+ "category": "Error",
+ "code": 5042
+ },
"Concatenate and emit output to single file.": {
"category": "Message",
"code": 6001
@@ -1694,6 +1718,10 @@
"category": "Message",
"code": 6019
},
+ "Compile the project in the given directory.": {
+ "category": "Message",
+ "code": 6020
+ },
"Syntax: {0}": {
"category": "Message",
"code": 6023
@@ -1722,7 +1750,7 @@
"category": "Message",
"code": 6030
},
- "File change detected. Compiling...": {
+ "File change detected. Starting incremental compilation...": {
"category": "Message",
"code": 6032
},
@@ -1880,10 +1908,5 @@
"category": "Error",
"code": 9001,
"isEarly": true
- },
- "Computed property names are not currently supported.": {
- "category": "Error",
- "code": 9002,
- "isEarly": true
}
}
diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts
index d82e577971d..6626823379b 100644
--- a/src/compiler/emitter.ts
+++ b/src/compiler/emitter.ts
@@ -170,9 +170,10 @@ module ts {
function writeCommentRange(currentSourceFile: SourceFile, writer: EmitTextWriter, comment: CommentRange, newLine: string){
if (currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk) {
var firstCommentLineAndCharacter = currentSourceFile.getLineAndCharacterFromPosition(comment.pos);
+ var lastLine = currentSourceFile.getLineStarts().length;
var firstCommentLineIndent: number;
for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) {
- var nextLineStart = currentSourceFile.getPositionFromLineAndCharacter(currentLine + 1, /*character*/1);
+ var nextLineStart = currentLine === lastLine ? (comment.end + 1) : currentSourceFile.getPositionFromLineAndCharacter(currentLine + 1, /*character*/1);
if (pos !== comment.pos) {
// If we are not emitting first line, we need to write the spaces to adjust the alignment
@@ -339,6 +340,7 @@ module ts {
function emitDeclarations(host: EmitHost, resolver: EmitResolver, diagnostics: Diagnostic[], jsFilePath: string, root?: SourceFile): DeclarationEmit {
var newLine = host.getNewLine();
var compilerOptions = host.getCompilerOptions();
+ var languageVersion = compilerOptions.target || ScriptTarget.ES3;
var write: (s: string) => void;
var writeLine: () => void;
@@ -930,6 +932,10 @@ module ts {
}
function emitPropertyDeclaration(node: Declaration) {
+ if (hasDynamicName(node)) {
+ return;
+ }
+
emitJsDocComments(node);
emitClassMemberDeclarationFlags(node);
emitVariableDeclaration(node);
@@ -937,11 +943,13 @@ module ts {
writeLine();
}
- // TODO(jfreeman): Factor out common part of property definition, but treat name differently
function emitVariableDeclaration(node: VariableDeclaration) {
// If we are emitting property it isn't moduleElement and hence we already know it needs to be emitted
// so there is no check needed to see if declaration is visible
if (node.kind !== SyntaxKind.VariableDeclaration || resolver.isDeclarationVisible(node)) {
+ // If this node is a computed name, it can only be a symbol, because we've already skipped
+ // it if it's not a well known symbol. In that case, the text of the name will be exactly
+ // what we want, namely the name expression enclosed in brackets.
writeTextOfNode(currentSourceFile, node.name);
// If optional property emit ?
if ((node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertySignature) && hasQuestionToken(node)) {
@@ -1028,6 +1036,10 @@ module ts {
}
function emitAccessorDeclaration(node: AccessorDeclaration) {
+ if (hasDynamicName(node)) {
+ return;
+ }
+
var accessors = getAllAccessorDeclarations(node.parent, node);
if (node === accessors.firstAccessor) {
emitJsDocComments(accessors.getAccessor);
@@ -1105,6 +1117,10 @@ module ts {
}
function emitFunctionDeclaration(node: FunctionLikeDeclaration) {
+ if (hasDynamicName(node)) {
+ return;
+ }
+
// If we are emitting Method/Constructor it isn't moduleElement and hence already determined to be emitting
// so no need to verify if the declaration is visible
if ((node.kind !== SyntaxKind.FunctionDeclaration || resolver.isDeclarationVisible(node)) &&
@@ -1473,6 +1489,7 @@ module ts {
export function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFile?: SourceFile): EmitResult {
// var program = resolver.getProgram();
var compilerOptions = host.getCompilerOptions();
+ var languageVersion = compilerOptions.target || ScriptTarget.ES3;
var sourceMapDataList: SourceMapData[] = compilerOptions.sourceMap ? [] : undefined;
var diagnostics: Diagnostic[] = [];
var newLine = host.getNewLine();
@@ -1720,7 +1737,14 @@ module ts {
if (scopeName) {
var parentIndex = getSourceMapNameIndex();
if (parentIndex !== -1) {
- scopeName = sourceMapData.sourceMapNames[parentIndex] + "." + scopeName;
+ // Child scopes are always shown with a dot (even if they have no name),
+ // unless it is a computed property. Then it is shown with brackets,
+ // but the brackets are included in the name.
+ var name = (node).name;
+ if (!name || name.kind !== SyntaxKind.ComputedPropertyName) {
+ scopeName = "." + scopeName;
+ }
+ scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName;
}
scopeNameIndex = getProperty(sourceMapNameIndexMap, scopeName);
@@ -1748,8 +1772,11 @@ module ts {
node.kind === SyntaxKind.EnumDeclaration) {
// Declaration and has associated name use it
if ((node).name) {
- // TODO(jfreeman): Ask shkamat about what this name should be for source maps
- scopeName = ((node).name).text;
+ var name = (node).name;
+ // For computed property names, the text will include the brackets
+ scopeName = name.kind === SyntaxKind.ComputedPropertyName
+ ? getTextOfNode(name)
+ : ((node).name).text;
}
recordScopeNameStart(scopeName);
}
@@ -2021,14 +2048,14 @@ module ts {
}
function emitLiteral(node: LiteralExpression) {
- var text = compilerOptions.target < ScriptTarget.ES6 && isTemplateLiteralKind(node.kind) ? getTemplateLiteralAsStringLiteral(node) :
+ var text = languageVersion < ScriptTarget.ES6 && isTemplateLiteralKind(node.kind) ? getTemplateLiteralAsStringLiteral(node) :
node.parent ? getSourceTextOfNodeFromSourceFile(currentSourceFile, node) :
node.text;
if (compilerOptions.sourceMap && (node.kind === SyntaxKind.StringLiteral || isTemplateLiteralKind(node.kind))) {
writer.writeLiteral(text);
}
// For version below ES6, emit binary integer literal and octal integer literal in canonical form
- else if (compilerOptions.target < ScriptTarget.ES6 && node.kind === SyntaxKind.NumericLiteral && isBinaryOrOctalIntegerLiteral(text)) {
+ else if (languageVersion < ScriptTarget.ES6 && node.kind === SyntaxKind.NumericLiteral && isBinaryOrOctalIntegerLiteral(text)) {
write(node.text);
}
else {
@@ -2043,7 +2070,7 @@ module ts {
function emitTemplateExpression(node: TemplateExpression): void {
// In ES6 mode and above, we can simply emit each portion of a template in order, but in
// ES3 & ES5 we must convert the template expression into a series of string concatenations.
- if (compilerOptions.target >= ScriptTarget.ES6) {
+ if (languageVersion >= ScriptTarget.ES6) {
forEachChild(node, emit);
return;
}
@@ -2150,7 +2177,7 @@ module ts {
//
// TODO (drosen): Note that we need to account for the upcoming 'yield' and
// spread ('...') unary operators that are anticipated for ES6.
- Debug.assert(compilerOptions.target <= ScriptTarget.ES5);
+ Debug.assert(languageVersion < ScriptTarget.ES6);
switch (expression.kind) {
case SyntaxKind.BinaryExpression:
switch ((expression).operator) {
@@ -2335,7 +2362,7 @@ module ts {
write("[]");
return;
}
- if (compilerOptions.target >= ScriptTarget.ES6) {
+ if (languageVersion >= ScriptTarget.ES6) {
write("[");
emitList(elements, 0, elements.length, /*multiLine*/(node.flags & NodeFlags.MultiLine) !== 0,
/*trailingComma*/ elements.hasTrailingComma);
@@ -2385,7 +2412,7 @@ module ts {
write(" ");
}
emitList(properties, 0, properties.length, /*multiLine*/ multiLine,
- /*trailingComma*/ properties.hasTrailingComma && compilerOptions.target >= ScriptTarget.ES5);
+ /*trailingComma*/ properties.hasTrailingComma && languageVersion >= ScriptTarget.ES5);
if (!multiLine) {
write(" ");
}
@@ -2405,7 +2432,7 @@ module ts {
}
emitLeadingComments(node);
emit(node.name);
- if (compilerOptions.target < ScriptTarget.ES6) {
+ if (languageVersion < ScriptTarget.ES6) {
write(": function ");
}
emitSignatureAndBody(node);
@@ -2431,7 +2458,7 @@ module ts {
// export var obj = { y };
// }
// The short-hand property in obj need to emit as such ... = { y : m.y } regardless of the TargetScript version
- if (compilerOptions.target < ScriptTarget.ES6 || resolver.getExpressionNamePrefix(node.name)) {
+ if (languageVersion < ScriptTarget.ES6 || resolver.getExpressionNamePrefix(node.name)) {
// Emit identifier as an identifier
write(": ");
// Even though this is stored as identifier treat it as an expression
@@ -2513,7 +2540,7 @@ module ts {
}
function emitTaggedTemplateExpression(node: TaggedTemplateExpression): void {
- Debug.assert(compilerOptions.target >= ScriptTarget.ES6, "Trying to emit a tagged template in pre-ES6 mode.");
+ Debug.assert(languageVersion >= ScriptTarget.ES6, "Trying to emit a tagged template in pre-ES6 mode.");
emit(node.tag);
write(" ");
emit(node.template);
@@ -2605,7 +2632,7 @@ module ts {
function emitBinaryExpression(node: BinaryExpression) {
- if (compilerOptions.target < ScriptTarget.ES6 && node.operator === SyntaxKind.EqualsToken &&
+ if (languageVersion < ScriptTarget.ES6 && node.operator === SyntaxKind.EqualsToken &&
(node.left.kind === SyntaxKind.ObjectLiteralExpression || node.left.kind === SyntaxKind.ArrayLiteralExpression)) {
emitDestructuring(node);
}
@@ -3101,7 +3128,7 @@ module ts {
function emitVariableDeclaration(node: VariableDeclaration) {
emitLeadingComments(node);
if (isBindingPattern(node.name)) {
- if (compilerOptions.target < ScriptTarget.ES6) {
+ if (languageVersion < ScriptTarget.ES6) {
emitDestructuring(node);
}
else {
@@ -3136,7 +3163,7 @@ module ts {
function emitParameter(node: ParameterDeclaration) {
emitLeadingComments(node);
- if (compilerOptions.target < ScriptTarget.ES6) {
+ if (languageVersion < ScriptTarget.ES6) {
if (isBindingPattern(node.name)) {
var name = createTempVariable(node);
if (!tempParameters) {
@@ -3160,7 +3187,7 @@ module ts {
}
function emitDefaultValueAssignments(node: FunctionLikeDeclaration) {
- if (compilerOptions.target < ScriptTarget.ES6) {
+ if (languageVersion < ScriptTarget.ES6) {
var tempIndex = 0;
forEach(node.parameters, p => {
if (isBindingPattern(p.name)) {
@@ -3190,7 +3217,7 @@ module ts {
}
function emitRestParameter(node: FunctionLikeDeclaration) {
- if (compilerOptions.target < ScriptTarget.ES6 && hasRestParameters(node)) {
+ if (languageVersion < ScriptTarget.ES6 && hasRestParameters(node)) {
var restIndex = node.parameters.length - 1;
var restParam = node.parameters[restIndex];
var tempName = createTempVariable(node, /*forLoopVariable*/ true).text;
@@ -3269,7 +3296,7 @@ module ts {
write("(");
if (node) {
var parameters = node.parameters;
- var omitCount = compilerOptions.target < ScriptTarget.ES6 && hasRestParameters(node) ? 1 : 0;
+ var omitCount = languageVersion < ScriptTarget.ES6 && hasRestParameters(node) ? 1 : 0;
emitList(parameters, 0, parameters.length - omitCount, /*multiLine*/ false, /*trailingComma*/ false);
}
write(")");
diff --git a/src/compiler/program.ts b/src/compiler/program.ts
index dac92431bea..9b52b8dc9ca 100644
--- a/src/compiler/program.ts
+++ b/src/compiler/program.ts
@@ -146,7 +146,9 @@ module ts {
function invokeEmitter(targetSourceFile?: SourceFile) {
var resolver = getDiagnosticsProducingTypeChecker().getEmitResolver();
return emitFiles(resolver, getEmitHost(), targetSourceFile);
- } function getSourceFile(filename: string) {
+ }
+
+ function getSourceFile(filename: string) {
filename = host.getCanonicalFileName(filename);
return hasProperty(filesByName, filename) ? filesByName[filename] : undefined;
}
@@ -340,7 +342,7 @@ module ts {
}
var firstExternalModule = forEach(files, f => isExternalModule(f) ? f : undefined);
- if (firstExternalModule && options.module === ModuleKind.None) {
+ if (firstExternalModule && !options.module) {
// We cannot use createDiagnosticFromNode because nodes do not have parents yet
var externalModuleErrorSpan = getErrorSpanForNode(firstExternalModule.externalModuleIndicator);
var errorStart = skipTrivia(firstExternalModule.text, externalModuleErrorSpan.pos);
diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts
index 2a0363f7f78..4aef773004b 100644
--- a/src/compiler/scanner.ts
+++ b/src/compiler/scanner.ts
@@ -224,15 +224,15 @@ module ts {
}
function isUnicodeIdentifierStart(code: number, languageVersion: ScriptTarget) {
- return languageVersion === ScriptTarget.ES3 ?
- lookupInUnicodeMap(code, unicodeES3IdentifierStart) :
- lookupInUnicodeMap(code, unicodeES5IdentifierStart);
+ return languageVersion >= ScriptTarget.ES5 ?
+ lookupInUnicodeMap(code, unicodeES5IdentifierStart) :
+ lookupInUnicodeMap(code, unicodeES3IdentifierStart);
}
function isUnicodeIdentifierPart(code: number, languageVersion: ScriptTarget) {
- return languageVersion === ScriptTarget.ES3 ?
- lookupInUnicodeMap(code, unicodeES3IdentifierPart) :
- lookupInUnicodeMap(code, unicodeES5IdentifierPart);
+ return languageVersion >= ScriptTarget.ES5 ?
+ lookupInUnicodeMap(code, unicodeES5IdentifierPart) :
+ lookupInUnicodeMap(code, unicodeES3IdentifierPart);
}
function makeReverseMap(source: Map): string[] {
@@ -279,7 +279,7 @@ module ts {
}
export function getPositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number {
- Debug.assert(line > 0);
+ Debug.assert(line > 0 && line <= lineStarts.length );
return lineStarts[line - 1] + character - 1;
}
diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts
index 27a8c305c4b..5f10a747d42 100644
--- a/src/compiler/sys.ts
+++ b/src/compiler/sys.ts
@@ -1,3 +1,4 @@
+///
module ts {
export interface System {
@@ -14,6 +15,7 @@ module ts {
createDirectory(directoryName: string): void;
getExecutingFilePath(): string;
getCurrentDirectory(): string;
+ readDirectory(path: string, extension?: string): string[];
getMemoryUsage? (): number;
exit(exitCode?: number): void;
}
@@ -28,6 +30,13 @@ module ts {
declare var global: any;
declare var __filename: string;
+ declare class Enumerator {
+ public atEnd(): boolean;
+ public moveNext(): boolean;
+ public item(): any;
+ constructor(o: any);
+ }
+
export var sys: System = (function () {
function getWScriptSystem(): System {
@@ -100,6 +109,34 @@ module ts {
}
}
+ function getNames(collection: any): string[] {
+ var result: string[] = [];
+ for (var e = new Enumerator(collection); !e.atEnd(); e.moveNext()) {
+ result.push(e.item().Name);
+ }
+ return result.sort();
+ }
+
+ function readDirectory(path: string, extension?: string): string[] {
+ var result: string[] = [];
+ visitDirectory(path);
+ return result;
+ function visitDirectory(path: string) {
+ var folder = fso.GetFolder(path || ".");
+ var files = getNames(folder.files);
+ for (var i = 0; i < files.length; i++) {
+ var name = files[i];
+ if (!extension || fileExtensionIs(name, extension)) {
+ result.push(combinePaths(path, name));
+ }
+ }
+ var subfolders = getNames(folder.subfolders);
+ for (var i = 0; i < subfolders.length; i++) {
+ visitDirectory(combinePaths(path, subfolders[i]));
+ }
+ }
+ }
+
return {
args,
newLine: "\r\n",
@@ -129,6 +166,7 @@ module ts {
getCurrentDirectory() {
return new ActiveXObject("WScript.Shell").CurrentDirectory;
},
+ readDirectory,
exit(exitCode?: number): void {
try {
WScript.Quit(exitCode);
@@ -185,6 +223,31 @@ module ts {
_fs.writeFileSync(fileName, data, "utf8");
}
+ function readDirectory(path: string, extension?: string): string[] {
+ var result: string[] = [];
+ visitDirectory(path);
+ return result;
+ function visitDirectory(path: string) {
+ var files = _fs.readdirSync(path || ".").sort();
+ var directories: string[] = [];
+ for (var i = 0; i < files.length; i++) {
+ var name = combinePaths(path, files[i]);
+ var stat = _fs.lstatSync(name);
+ if (stat.isFile()) {
+ if (!extension || fileExtensionIs(name, extension)) {
+ result.push(name);
+ }
+ }
+ else if (stat.isDirectory()) {
+ directories.push(name);
+ }
+ }
+ for (var i = 0; i < directories.length; i++) {
+ visitDirectory(directories[i]);
+ }
+ }
+ }
+
return {
args: process.argv.slice(2),
newLine: _os.EOL,
@@ -231,6 +294,7 @@ module ts {
getCurrentDirectory() {
return process.cwd();
},
+ readDirectory,
getMemoryUsage() {
if (global.gc) {
global.gc();
diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts
index 9d038920693..ee5dc5104ff 100644
--- a/src/compiler/tsc.ts
+++ b/src/compiler/tsc.ts
@@ -4,6 +4,10 @@
module ts {
var version = "1.4.0.0";
+ export interface SourceFile {
+ fileWatcher: FileWatcher;
+ }
+
/**
* Checks to see if the locale is in the appropriate format,
* and if it is, attempts to set the appropriate language.
@@ -126,16 +130,43 @@ module ts {
reportStatisticalValue(name, (time / 1000).toFixed(2) + "s");
}
+ function isJSONSupported() {
+ return typeof JSON === "object" && typeof JSON.parse === "function";
+ }
+
+ function findConfigFile(): string {
+ var searchPath = normalizePath(sys.getCurrentDirectory());
+ var filename = "tsconfig.json";
+ while (true) {
+ if (sys.fileExists(filename)) {
+ return filename;
+ }
+ var parentPath = getDirectoryPath(searchPath);
+ if (parentPath === searchPath) {
+ break;
+ }
+ searchPath = parentPath;
+ filename = "../" + filename;
+ }
+ return undefined;
+ }
+
export function executeCommandLine(args: string[]): void {
var commandLine = parseCommandLine(args);
- var compilerOptions = commandLine.options;
+ var configFilename: string; // Configuration file name (if any)
+ var configFileWatcher: FileWatcher; // Configuration file watcher
+ var cachedProgram: Program; // Program cached from last compilation
+ var rootFilenames: string[]; // Root filenames for compilation
+ var compilerOptions: CompilerOptions; // Compiler options for compilation
+ var compilerHost: CompilerHost; // Compiler host
+ var hostGetSourceFile: typeof compilerHost.getSourceFile; // getSourceFile method from default host
+ var timerHandle: number; // Handle for 0.25s wait timer
- if (compilerOptions.locale) {
- if (typeof JSON === "undefined") {
+ if (commandLine.options.locale) {
+ if (!isJSONSupported()) {
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--locale"));
- return sys.exit(1);
+ return sys.exit(EmitReturnStatus.CompilerOptionsErrors);
}
-
validateLocaleAndSetLanguage(commandLine.options.locale, commandLine.errors);
}
@@ -146,131 +177,153 @@ module ts {
return sys.exit(EmitReturnStatus.CompilerOptionsErrors);
}
- if (compilerOptions.version) {
+ if (commandLine.options.version) {
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Version_0, version));
return sys.exit(EmitReturnStatus.Succeeded);
}
- if (compilerOptions.help) {
+ if (commandLine.options.help) {
printVersion();
printHelp();
return sys.exit(EmitReturnStatus.Succeeded);
}
- if (commandLine.filenames.length === 0) {
+ if (commandLine.options.project) {
+ if (!isJSONSupported()) {
+ reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--project"));
+ return sys.exit(EmitReturnStatus.CompilerOptionsErrors);
+ }
+ configFilename = normalizePath(combinePaths(commandLine.options.project, "tsconfig.json"));
+ if (commandLine.filenames.length !== 0) {
+ reportDiagnostic(createCompilerDiagnostic(Diagnostics.Option_project_cannot_be_mixed_with_source_files_on_a_command_line));
+ return sys.exit(EmitReturnStatus.CompilerOptionsErrors);
+ }
+ }
+ else if (commandLine.filenames.length === 0 && isJSONSupported()) {
+ configFilename = findConfigFile();
+ }
+
+ if (commandLine.filenames.length === 0 && !configFilename) {
printVersion();
printHelp();
return sys.exit(EmitReturnStatus.CompilerOptionsErrors);
}
- var defaultCompilerHost = createCompilerHost(compilerOptions);
-
- if (compilerOptions.watch) {
+ if (commandLine.options.watch) {
if (!sys.watchFile) {
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--watch"));
return sys.exit(EmitReturnStatus.CompilerOptionsErrors);
}
-
- watchProgram(commandLine, defaultCompilerHost);
- }
- else {
- var result = compile(commandLine, defaultCompilerHost).exitStatus
- return sys.exit(result);
- }
- }
-
- /**
- * Compiles the program once, and then watches all given and referenced files for changes.
- * Upon detecting a file change, watchProgram will queue up file modification events for the next
- * 250ms and then perform a recompilation. The reasoning is that in some cases, an editor can
- * save all files at once, and we'd like to just perform a single recompilation.
- */
- function watchProgram(commandLine: ParsedCommandLine, compilerHost: CompilerHost): void {
- var watchers: Map = {};
- var updatedFiles: Map = {};
-
- // Compile the program the first time and watch all given/referenced files.
- var program = compile(commandLine, compilerHost).program;
- reportDiagnostic(createCompilerDiagnostic(Diagnostics.Compilation_complete_Watching_for_file_changes));
- addWatchers(program);
- return;
-
- function addWatchers(program: Program) {
- forEach(program.getSourceFiles(), f => {
- var filename = getCanonicalName(f.filename);
- watchers[filename] = sys.watchFile(filename, fileUpdated);
- });
- }
-
- function removeWatchers(program: Program) {
- forEach(program.getSourceFiles(), f => {
- var filename = getCanonicalName(f.filename);
- if (hasProperty(watchers, filename)) {
- watchers[filename].close();
- }
- });
-
- watchers = {};
- }
-
- // Fired off whenever a file is changed.
- function fileUpdated(filename: string) {
- var firstNotification = isEmpty(updatedFiles);
- updatedFiles[getCanonicalName(filename)] = true;
-
- // Only start this off when the first file change comes in,
- // so that we can batch up all further changes.
- if (firstNotification) {
- setTimeout(() => {
- var changedFiles = updatedFiles;
- updatedFiles = {};
-
- recompile(changedFiles);
- }, 250);
+ if (configFilename) {
+ configFileWatcher = sys.watchFile(configFilename, configFileChanged);
}
}
- function recompile(changedFiles: Map) {
- reportDiagnostic(createCompilerDiagnostic(Diagnostics.File_change_detected_Compiling));
- // Remove all the watchers, as we may not be watching every file
- // specified since the last compilation cycle.
- removeWatchers(program);
+ performCompilation();
- // Reuse source files from the last compilation so long as they weren't changed.
- var oldSourceFiles = arrayToMap(
- filter(program.getSourceFiles(), file => !hasProperty(changedFiles, getCanonicalName(file.filename))),
- file => getCanonicalName(file.filename));
+ // Invoked to perform initial compilation or re-compilation in watch mode
+ function performCompilation() {
- // We create a new compiler host for this compilation cycle.
- // This new host is effectively the same except that 'getSourceFile'
- // will try to reuse the SourceFiles from the last compilation cycle
- // so long as they were not modified.
- var newCompilerHost = clone(compilerHost);
- newCompilerHost.getSourceFile = (fileName, languageVersion, onError) => {
- fileName = getCanonicalName(fileName);
-
- var sourceFile = lookUp(oldSourceFiles, fileName);
- if (sourceFile) {
- return sourceFile;
+ if (!cachedProgram) {
+ if (configFilename) {
+ var configObject = readConfigFile(configFilename);
+ if (!configObject) {
+ reportDiagnostic(createCompilerDiagnostic(Diagnostics.Unable_to_open_file_0, configFilename));
+ return sys.exit(EmitReturnStatus.CompilerOptionsErrors);
+ }
+ var configParseResult = parseConfigFile(configObject, getDirectoryPath(configFilename));
+ if (configParseResult.errors.length > 0) {
+ reportDiagnostics(configParseResult.errors);
+ return sys.exit(EmitReturnStatus.CompilerOptionsErrors);
+ }
+ rootFilenames = configParseResult.filenames;
+ compilerOptions = extend(commandLine.options, configParseResult.options);
}
+ else {
+ rootFilenames = commandLine.filenames;
+ compilerOptions = commandLine.options;
+ }
+ compilerHost = createCompilerHost(compilerOptions);
+ hostGetSourceFile = compilerHost.getSourceFile;
+ compilerHost.getSourceFile = getSourceFile;
+ }
- return compilerHost.getSourceFile(fileName, languageVersion, onError);
- };
+ var compileResult = compile(rootFilenames, compilerOptions, compilerHost);
- program = compile(commandLine, newCompilerHost).program;
+ if (!commandLine.options.watch) {
+ return sys.exit(compileResult.exitStatus);
+ }
+
+ setCachedProgram(compileResult.program);
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Compilation_complete_Watching_for_file_changes));
- addWatchers(program);
}
- function getCanonicalName(fileName: string) {
- return compilerHost.getCanonicalFileName(fileName);
+ function getSourceFile(filename: string, languageVersion: ScriptTarget, onError ?: (message: string) => void) {
+ // Return existing SourceFile object if one is available
+ if (cachedProgram) {
+ var sourceFile = cachedProgram.getSourceFile(filename);
+ // A modified source file has no watcher and should not be reused
+ if (sourceFile && sourceFile.fileWatcher) {
+ return sourceFile;
+ }
+ }
+ // Use default host function
+ var sourceFile = hostGetSourceFile(filename, languageVersion, onError);
+ if (sourceFile && commandLine.options.watch) {
+ // Attach a file watcher
+ sourceFile.fileWatcher = sys.watchFile(sourceFile.filename, () => sourceFileChanged(sourceFile));
+ }
+ return sourceFile;
+ }
+
+ // Change cached program to the given program
+ function setCachedProgram(program: Program) {
+ if (cachedProgram) {
+ var newSourceFiles = program ? program.getSourceFiles() : undefined;
+ forEach(cachedProgram.getSourceFiles(), sourceFile => {
+ if (!(newSourceFiles && contains(newSourceFiles, sourceFile))) {
+ if (sourceFile.fileWatcher) {
+ sourceFile.fileWatcher.close();
+ sourceFile.fileWatcher = undefined;
+ }
+ }
+ });
+ }
+ cachedProgram = program;
+ }
+
+ // If a source file changes, mark it as unwatched and start the recompilation timer
+ function sourceFileChanged(sourceFile: SourceFile) {
+ sourceFile.fileWatcher = undefined;
+ startTimer();
+ }
+
+ // If the configuration file changes, forget cached program and start the recompilation timer
+ function configFileChanged() {
+ setCachedProgram(undefined);
+ startTimer();
+ }
+
+ // Upon detecting a file change, wait for 250ms and then perform a recompilation. This gives batch
+ // operations (such as saving all modified files in an editor) a chance to complete before we kick
+ // off a new compilation.
+ function startTimer() {
+ if (timerHandle) {
+ clearTimeout(timerHandle);
+ }
+ timerHandle = setTimeout(recompile, 250);
+ }
+
+ function recompile() {
+ timerHandle = undefined;
+ reportDiagnostic(createCompilerDiagnostic(Diagnostics.File_change_detected_Starting_incremental_compilation));
+ performCompilation();
}
}
- function compile(commandLine: ParsedCommandLine, compilerHost: CompilerHost) {
+ function compile(filenames: string[], compilerOptions: CompilerOptions, compilerHost: CompilerHost) {
var parseStart = new Date().getTime();
- var compilerOptions = commandLine.options;
- var program = createProgram(commandLine.filenames, compilerOptions, compilerHost);
+ var program = createProgram(filenames, compilerOptions, compilerHost);
var bindStart = new Date().getTime();
var errors: Diagnostic[] = program.getDiagnostics();
@@ -303,7 +356,14 @@ module ts {
}
reportDiagnostics(errors);
- if (commandLine.options.diagnostics) {
+
+ if (compilerOptions.listFiles) {
+ forEach(program.getSourceFiles(), file => {
+ sys.write(file.filename + sys.newLine);
+ });
+ }
+
+ if (compilerOptions.diagnostics) {
var memoryUsed = sys.getMemoryUsage ? sys.getMemoryUsage() : -1;
reportCountStatistic("Files", program.getSourceFiles().length);
reportCountStatistic("Lines", countLines(program));
diff --git a/src/compiler/tsconfig.json b/src/compiler/tsconfig.json
new file mode 100644
index 00000000000..fd541a8ca80
--- /dev/null
+++ b/src/compiler/tsconfig.json
@@ -0,0 +1,25 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "noImplicitAny": true,
+ "removeComments": true,
+ "preserveConstEnums": true,
+ "out": "../../built/local/tsc.js",
+ "sourceMap": true
+ },
+ "files": [
+ "core.ts",
+ "sys.ts",
+ "types.ts",
+ "scanner.ts",
+ "parser.ts",
+ "utilities.ts",
+ "binder.ts",
+ "checker.ts",
+ "emitter.ts",
+ "program.ts",
+ "commandLineParser.ts",
+ "tsc.ts",
+ "diagnosticInformationMap.generated.ts"
+ ]
+}
diff --git a/src/compiler/types.ts b/src/compiler/types.ts
index 9ebab8dc220..b8c842641d7 100644
--- a/src/compiler/types.ts
+++ b/src/compiler/types.ts
@@ -1448,6 +1448,7 @@ module ts {
diagnostics?: boolean;
emitBOM?: boolean;
help?: boolean;
+ listFiles?: boolean;
locale?: string;
mapRoot?: string;
module?: ModuleKind;
@@ -1461,6 +1462,7 @@ module ts {
out?: string;
outDir?: string;
preserveConstEnums?: boolean;
+ project?: string;
removeComments?: boolean;
sourceMap?: boolean;
sourceRoot?: string;
@@ -1501,10 +1503,11 @@ module ts {
export interface CommandLineOption {
name: string;
type: string | Map; // "string", "number", "boolean", or an object literal mapping named values to actual values
- shortName?: string; // A short mnemonic for convenience - for instance, 'h' can be used in place of 'help'.
+ isFilePath?: boolean; // True if option value is a path or filename
+ shortName?: string; // A short mnemonic for convenience - for instance, 'h' can be used in place of 'help'
description?: DiagnosticMessage; // The message describing what the command line switch does
- paramType?: DiagnosticMessage; // The name to be used for a non-boolean option's parameter.
- error?: DiagnosticMessage; // The error given when the argument does not fit a customized 'type'.
+ paramType?: DiagnosticMessage; // The name to be used for a non-boolean option's parameter
+ error?: DiagnosticMessage; // The error given when the argument does not fit a customized 'type'
}
export const enum CharacterCodes {
diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts
index 7494ec9f6cb..6c894ad7d9c 100644
--- a/src/compiler/utilities.ts
+++ b/src/compiler/utilities.ts
@@ -399,6 +399,21 @@ module ts {
return undefined;
}
switch (node.kind) {
+ case SyntaxKind.ComputedPropertyName:
+ // If the grandparent node is an object literal (as opposed to a class),
+ // then the computed property is not a 'this' container.
+ // A computed property name in a class needs to be a this container
+ // so that we can error on it.
+ if (node.parent.parent.kind === SyntaxKind.ClassDeclaration) {
+ return node;
+ }
+ // If this is a computed property, then the parent should not
+ // make it a this container. The parent might be a property
+ // in an object literal, like a method or accessor. But in order for
+ // such a parent to be a this container, the reference must be in
+ // the *body* of the container.
+ node = node.parent;
+ break;
case SyntaxKind.ArrowFunction:
if (!includeArrowFunctions) {
continue;
@@ -421,13 +436,32 @@ module ts {
}
}
- export function getSuperContainer(node: Node): Node {
+ export function getSuperContainer(node: Node, includeFunctions: boolean): Node {
while (true) {
node = node.parent;
- if (!node) {
- return undefined;
- }
+ if (!node) return node;
switch (node.kind) {
+ case SyntaxKind.ComputedPropertyName:
+ // If the grandparent node is an object literal (as opposed to a class),
+ // then the computed property is not a 'super' container.
+ // A computed property name in a class needs to be a super container
+ // so that we can error on it.
+ if (node.parent.parent.kind === SyntaxKind.ClassDeclaration) {
+ return node;
+ }
+ // If this is a computed property, then the parent should not
+ // make it a super container. The parent might be a property
+ // in an object literal, like a method or accessor. But in order for
+ // such a parent to be a super container, the reference must be in
+ // the *body* of the container.
+ node = node.parent;
+ break;
+ case SyntaxKind.FunctionDeclaration:
+ case SyntaxKind.FunctionExpression:
+ case SyntaxKind.ArrowFunction:
+ if (!includeFunctions) {
+ continue;
+ }
case SyntaxKind.PropertyDeclaration:
case SyntaxKind.PropertySignature:
case SyntaxKind.MethodDeclaration:
@@ -527,6 +561,8 @@ module ts {
return node === (parent).expression;
case SyntaxKind.TemplateSpan:
return node === (parent).expression;
+ case SyntaxKind.ComputedPropertyName:
+ return node === (parent).expression;
default:
if (isExpression(parent)) {
return true;
diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts
index dc7d12cacb8..3987fdb6ffa 100644
--- a/src/harness/fourslash.ts
+++ b/src/harness/fourslash.ts
@@ -548,6 +548,18 @@ module FourSlash {
}
}
+ public verifyGetEmitOutputForCurrentFile(expected: string): void {
+ var emit = this.languageService.getEmitOutput(this.activeFile.fileName);
+ if (emit.outputFiles.length !== 1) {
+ throw new Error("Expected exactly one output from emit of " + this.activeFile.fileName);
+ }
+ this.taoInvalidReason = 'verifyGetEmitOutputForCurrentFile impossible';
+ var actual = emit.outputFiles[0].text;
+ if (actual !== expected) {
+ this.raiseError("Expected emit output to be '" + expected + "', but got '" + actual + "'");
+ }
+ }
+
public verifyMemberListContains(symbol: string, text?: string, documentation?: string, kind?: string) {
this.scenarioActions.push('');
this.scenarioActions.push('');
diff --git a/src/harness/harness.ts b/src/harness/harness.ts
index ecae4ee47a4..df73e52a605 100644
--- a/src/harness/harness.ts
+++ b/src/harness/harness.ts
@@ -22,6 +22,7 @@
declare var require: any;
declare var process: any;
+var Buffer = require('buffer').Buffer;
// this will work in the browser via browserify
var _chai: typeof chai = require('chai');
@@ -1207,7 +1208,6 @@ module Harness {
export function getErrorBaseline(inputFiles: { unitName: string; content: string }[], diagnostics: HarnessDiagnostic[]) {
diagnostics.sort(compareDiagnostics);
-
var outputLines: string[] = [];
// Count up all the errors we find so we don't miss any
var totalErrorsReported = 0;
@@ -1298,8 +1298,13 @@ module Harness {
return diagnostic.filename && isLibraryFile(diagnostic.filename);
});
+ var numTest262HarnessDiagnostics = ts.countWhere(diagnostics, diagnostic => {
+ // Count an error generated from tests262-harness folder.This should only apply for test262
+ return diagnostic.filename && diagnostic.filename.indexOf("test262-harness") >= 0;
+ });
+
// Verify we didn't miss any errors in total
- assert.equal(totalErrorsReported + numLibraryDiagnostics, diagnostics.length, 'total number of errors');
+ assert.equal(totalErrorsReported + numLibraryDiagnostics + numTest262HarnessDiagnostics, diagnostics.length, 'total number of errors');
return minimalDiagnosticsToString(diagnostics) +
ts.sys.newLine + ts.sys.newLine + outputLines.join('\r\n');
@@ -1642,7 +1647,8 @@ module Harness {
}
function writeComparison(expected: string, actual: string, relativeFilename: string, actualFilename: string, descriptionForDescribe: string) {
- if (expected != actual) {
+ var encoded_actual = (new Buffer(actual)).toString('utf8')
+ if (expected != encoded_actual) {
// Overwrite & issue error
var errMsg = 'The baseline file ' + relativeFilename + ' has changed';
throw new Error(errMsg);
diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts
index 787c6fe3f46..cab7547557c 100644
--- a/src/services/formatting/formatting.ts
+++ b/src/services/formatting/formatting.ts
@@ -243,8 +243,18 @@ module ts.formatting {
}
var precedingToken = findPrecedingToken(originalRange.pos, sourceFile);
- // no preceding token found - start from the beginning of enclosing node
- return precedingToken ? precedingToken.end : enclosingNode.pos;
+ if (!precedingToken) {
+ // no preceding token found - start from the beginning of enclosing node
+ return enclosingNode.pos;
+ }
+
+ // preceding token ends after the start of original range (i.e when originaRange.pos falls in the middle of literal)
+ // start from the beginning of enclosingNode to handle the entire 'originalRange'
+ if (precedingToken.end >= originalRange.pos) {
+ return enclosingNode.pos;
+ }
+
+ return precedingToken.end;
}
/*
diff --git a/src/services/formatting/formattingScanner.ts b/src/services/formatting/formattingScanner.ts
index 7ddfecc17f2..e9485158aba 100644
--- a/src/services/formatting/formattingScanner.ts
+++ b/src/services/formatting/formattingScanner.ts
@@ -187,6 +187,9 @@ module ts.formatting {
}
// consume trailing trivia
+ if (trailingTrivia) {
+ trailingTrivia = undefined;
+ }
while(scanner.getStartPos() < endPos) {
currentToken = scanner.scan();
if (!isTrivia(currentToken)) {
diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts
index ce240a95168..3aa97fe6ae6 100644
--- a/src/services/formatting/smartIndenter.ts
+++ b/src/services/formatting/smartIndenter.ts
@@ -12,10 +12,15 @@ module ts.formatting {
return 0;
}
- // no indentation in string \regex literals
- if ((precedingToken.kind === SyntaxKind.StringLiteral || precedingToken.kind === SyntaxKind.RegularExpressionLiteral) &&
- precedingToken.getStart(sourceFile) <= position &&
- precedingToken.end > position) {
+ // no indentation in string \regex\template literals
+ var precedingTokenIsLiteral =
+ precedingToken.kind === SyntaxKind.StringLiteral ||
+ precedingToken.kind === SyntaxKind.RegularExpressionLiteral ||
+ precedingToken.kind === SyntaxKind.NoSubstitutionTemplateLiteral ||
+ precedingToken.kind === SyntaxKind.TemplateHead ||
+ precedingToken.kind === SyntaxKind.TemplateMiddle ||
+ precedingToken.kind === SyntaxKind.TemplateTail;
+ if (precedingTokenIsLiteral && precedingToken.getStart(sourceFile) <= position && precedingToken.end > position) {
return 0;
}
diff --git a/src/services/services.ts b/src/services/services.ts
index 1a9e49c49a9..8889f41656b 100644
--- a/src/services/services.ts
+++ b/src/services/services.ts
@@ -58,7 +58,7 @@ module ts {
export interface SourceFile {
version: string;
scriptSnapshot: IScriptSnapshot;
-
+ nameTable: Map;
getNamedDeclarations(): Declaration[];
}
@@ -750,6 +750,7 @@ module ts {
public version: string;
public languageVersion: ScriptTarget;
public identifiers: Map;
+ public nameTable: Map;
private namedDeclarations: Declaration[];
@@ -1537,6 +1538,8 @@ module ts {
export function createLanguageServiceSourceFile(filename: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile {
var sourceFile = createSourceFile(filename, scriptSnapshot.getText(0, scriptSnapshot.getLength()), scriptTarget, setNodeParents);
setSourceFileFields(sourceFile, scriptSnapshot, version);
+ // after full parsing we can use table with interned strings as name table
+ sourceFile.nameTable = sourceFile.identifiers;
return sourceFile;
}
@@ -1568,6 +1571,9 @@ module ts {
if (!disableIncrementalParsing) {
var newSourceFile = sourceFile.update(scriptSnapshot.getText(0, scriptSnapshot.getLength()), textChangeRange);
setSourceFileFields(newSourceFile, scriptSnapshot, version);
+ // after incremental parsing nameTable might not be up-to-date
+ // drop it so it can be lazily recreated later
+ newSourceFile.nameTable = undefined;
return newSourceFile;
}
}
@@ -3207,7 +3213,7 @@ module ts {
if (node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.ThisKeyword || node.kind === SyntaxKind.SuperKeyword ||
isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) {
- return getReferencesForNode(node, [sourceFile], /*findInStrings:*/ false, /*findInComments:*/ false);
+ return getReferencesForNode(node, [sourceFile], /*searchOnlyInCurrentFile*/ true, /*findInStrings:*/ false, /*findInComments:*/ false);
}
switch (node.kind) {
@@ -3760,10 +3766,31 @@ module ts {
}
Debug.assert(node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.NumericLiteral || node.kind === SyntaxKind.StringLiteral);
- return getReferencesForNode(node, program.getSourceFiles(), findInStrings, findInComments);
+ return getReferencesForNode(node, program.getSourceFiles(), /*searchOnlyInCurrentFile*/ false, findInStrings, findInComments);
}
- function getReferencesForNode(node: Node, sourceFiles: SourceFile[], findInStrings: boolean, findInComments: boolean): ReferenceEntry[] {
+ function initializeNameTable(sourceFile: SourceFile): void {
+ var nameTable: Map = {};
+
+ walk(sourceFile);
+ sourceFile.nameTable = nameTable;
+
+ function walk(node: Node) {
+ switch (node.kind) {
+ case SyntaxKind.Identifier:
+ nameTable[(node).text] = (node).text;
+ break;
+ case SyntaxKind.StringLiteral:
+ case SyntaxKind.NumericLiteral:
+ nameTable[(node).text] = (node).text;
+ break;
+ default:
+ forEachChild(node, walk);
+ }
+ }
+ }
+
+ function getReferencesForNode(node: Node, sourceFiles: SourceFile[], searchOnlyInCurrentFile: boolean, findInStrings: boolean, findInComments: boolean): ReferenceEntry[] {
// Labels
if (isLabelName(node)) {
if (isJumpStatementTarget(node)) {
@@ -3819,15 +3846,28 @@ module ts {
getReferencesInNode(scope, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result);
}
else {
- var internedName = getInternedName(symbol, declarations)
- forEach(sourceFiles, sourceFile => {
- cancellationToken.throwIfCancellationRequested();
+ if (searchOnlyInCurrentFile) {
+ Debug.assert(sourceFiles.length === 1);
+ result = [];
+ getReferencesInNode(sourceFiles[0], symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result);
+ }
+ else {
+ var internedName = getInternedName(symbol, declarations)
+ forEach(sourceFiles, sourceFile => {
+ cancellationToken.throwIfCancellationRequested();
- if (lookUp(sourceFile.identifiers, internedName)) {
- result = result || [];
- getReferencesInNode(sourceFile, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result);
- }
- });
+ if (!sourceFile.nameTable) {
+ initializeNameTable(sourceFile)
+ }
+
+ Debug.assert(sourceFile.nameTable !== undefined);
+
+ if (lookUp(sourceFile.nameTable, internedName)) {
+ result = result || [];
+ getReferencesInNode(sourceFile, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result);
+ }
+ });
+ }
}
return result;
@@ -4086,7 +4126,7 @@ module ts {
}
function getReferencesForSuperKeyword(superKeyword: Node): ReferenceEntry[] {
- var searchSpaceNode = getSuperContainer(superKeyword);
+ var searchSpaceNode = getSuperContainer(superKeyword, /*includeFunctions*/ false);
if (!searchSpaceNode) {
return undefined;
}
@@ -4121,7 +4161,7 @@ module ts {
return;
}
- var container = getSuperContainer(node);
+ var container = getSuperContainer(node, /*includeFunctions*/ false);
// If we have a 'super' container, we must have an enclosing class.
// Now make sure the owning class is the same as the search-space
@@ -4163,6 +4203,8 @@ module ts {
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.FunctionExpression:
break;
+ // Computed properties in classes are not handled here because references to this are illegal,
+ // so there is no point finding references to them.
default:
return undefined;
}
diff --git a/src/services/tsconfig.json b/src/services/tsconfig.json
new file mode 100644
index 00000000000..296e65965d5
--- /dev/null
+++ b/src/services/tsconfig.json
@@ -0,0 +1,47 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "noImplicitAny": true,
+ "removeComments": true,
+ "preserveConstEnums": true,
+ "out": "../../built/local/typescriptServices.js",
+ "sourceMap": true
+ },
+ "files": [
+ "../compiler/core.ts",
+ "../compiler/sys.ts",
+ "../compiler/types.ts",
+ "../compiler/scanner.ts",
+ "../compiler/parser.ts",
+ "../compiler/utilities.ts",
+ "../compiler/binder.ts",
+ "../compiler/checker.ts",
+ "../compiler/emitter.ts",
+ "../compiler/program.ts",
+ "../compiler/commandLineParser.ts",
+ "../compiler/diagnosticInformationMap.generated.ts",
+ "breakpoints.ts",
+ "navigationBar.ts",
+ "outliningElementsCollector.ts",
+ "services.ts",
+ "shims.ts",
+ "signatureHelp.ts",
+ "utilities.ts",
+ "formatting/formatting.ts",
+ "formatting/formattingContext.ts",
+ "formatting/formattingRequestKind.ts",
+ "formatting/formattingScanner.ts",
+ "formatting/references.ts",
+ "formatting/rule.ts",
+ "formatting/ruleAction.ts",
+ "formatting/ruleDescriptor.ts",
+ "formatting/ruleFlag.ts",
+ "formatting/ruleOperation.ts",
+ "formatting/ruleOperationContext.ts",
+ "formatting/rules.ts",
+ "formatting/rulesMap.ts",
+ "formatting/rulesProvider.ts",
+ "formatting/smartIndenter.ts",
+ "formatting/tokenRange.ts"
+ ]
+}
diff --git a/tests/baselines/reference/FunctionDeclaration8_es6.errors.txt b/tests/baselines/reference/FunctionDeclaration8_es6.errors.txt
index 08d151203c9..2c8d034649e 100644
--- a/tests/baselines/reference/FunctionDeclaration8_es6.errors.txt
+++ b/tests/baselines/reference/FunctionDeclaration8_es6.errors.txt
@@ -1,7 +1,13 @@
-tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,11): error TS9002: Computed property names are not currently supported.
+tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,11): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
+tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,12): error TS2304: Cannot find name 'yield'.
+tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,20): error TS2304: Cannot find name 'foo'.
-==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts (1 errors) ====
+==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts (3 errors) ====
var v = { [yield]: foo }
~~~~~~~
-!!! error TS9002: Computed property names are not currently supported.
\ No newline at end of file
+!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
+ ~~~~~
+!!! error TS2304: Cannot find name 'yield'.
+ ~~~
+!!! error TS2304: Cannot find name 'foo'.
\ No newline at end of file
diff --git a/tests/baselines/reference/FunctionDeclaration9_es6.errors.txt b/tests/baselines/reference/FunctionDeclaration9_es6.errors.txt
index 8333eceb267..ef744681fa1 100644
--- a/tests/baselines/reference/FunctionDeclaration9_es6.errors.txt
+++ b/tests/baselines/reference/FunctionDeclaration9_es6.errors.txt
@@ -1,12 +1,15 @@
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(1,10): error TS9001: Generators are not currently supported.
-tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(2,13): error TS9002: Computed property names are not currently supported.
+tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(2,13): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
+tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(2,14): error TS9000: 'yield' expressions are not currently supported.
-==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts (2 errors) ====
+==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts (3 errors) ====
function * foo() {
~
!!! error TS9001: Generators are not currently supported.
var v = { [yield]: foo }
~~~~~~~
-!!! error TS9002: Computed property names are not currently supported.
+!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
+ ~~~~~
+!!! error TS9000: 'yield' expressions are not currently supported.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/FunctionPropertyAssignments5_es6.errors.txt b/tests/baselines/reference/FunctionPropertyAssignments5_es6.errors.txt
index eff0c79d827..c8c356a57ad 100644
--- a/tests/baselines/reference/FunctionPropertyAssignments5_es6.errors.txt
+++ b/tests/baselines/reference/FunctionPropertyAssignments5_es6.errors.txt
@@ -1,7 +1,13 @@
-tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,12): error TS9002: Computed property names are not currently supported.
+tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,11): error TS9001: Generators are not currently supported.
+tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
+tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,13): error TS2304: Cannot find name 'foo'.
-==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts (1 errors) ====
+==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts (3 errors) ====
var v = { *[foo()]() { } }
+ ~
+!!! error TS9001: Generators are not currently supported.
~~~~~~~
-!!! error TS9002: Computed property names are not currently supported.
\ No newline at end of file
+!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
+ ~~~
+!!! error TS2304: Cannot find name 'foo'.
\ No newline at end of file
diff --git a/tests/baselines/reference/MemberFunctionDeclaration3_es6.errors.txt b/tests/baselines/reference/MemberFunctionDeclaration3_es6.errors.txt
index b43e266e2a5..826c1d7fd75 100644
--- a/tests/baselines/reference/MemberFunctionDeclaration3_es6.errors.txt
+++ b/tests/baselines/reference/MemberFunctionDeclaration3_es6.errors.txt
@@ -1,9 +1,12 @@
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts(2,4): error TS9001: Generators are not currently supported.
+tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts(2,6): error TS2304: Cannot find name 'foo'.
-==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts (1 errors) ====
+==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts (2 errors) ====
class C {
*[foo]() { }
~
!!! error TS9001: Generators are not currently supported.
+ ~~~
+!!! error TS2304: Cannot find name 'foo'.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/additionOperatorWithNumberAndEnum.js b/tests/baselines/reference/additionOperatorWithNumberAndEnum.js
index 05bca7a4c0c..231831518e6 100644
--- a/tests/baselines/reference/additionOperatorWithNumberAndEnum.js
+++ b/tests/baselines/reference/additionOperatorWithNumberAndEnum.js
@@ -1,8 +1,10 @@
//// [additionOperatorWithNumberAndEnum.ts]
enum E { a, b }
+enum F { c, d }
var a: number;
var b: E;
+var c: E | F;
var r1 = a + a;
var r2 = a + b;
@@ -12,7 +14,15 @@ var r4 = b + b;
var r5 = 0 + a;
var r6 = E.a + 0;
var r7 = E.a + E.b;
-var r8 = E['a'] + E['b'];
+var r8 = E['a'] + E['b'];
+var r9 = E['a'] + F['c'];
+
+var r10 = a + c;
+var r11 = c + a;
+var r12 = b + c;
+var r13 = c + b;
+var r14 = c + c;
+
//// [additionOperatorWithNumberAndEnum.js]
var E;
@@ -20,8 +30,14 @@ var E;
E[E["a"] = 0] = "a";
E[E["b"] = 1] = "b";
})(E || (E = {}));
+var F;
+(function (F) {
+ F[F["c"] = 0] = "c";
+ F[F["d"] = 1] = "d";
+})(F || (F = {}));
var a;
var b;
+var c;
var r1 = a + a;
var r2 = a + b;
var r3 = b + a;
@@ -30,3 +46,9 @@ var r5 = 0 + a;
var r6 = 0 /* a */ + 0;
var r7 = 0 /* a */ + 1 /* b */;
var r8 = 0 /* 'a' */ + 1 /* 'b' */;
+var r9 = 0 /* 'a' */ + 0 /* 'c' */;
+var r10 = a + c;
+var r11 = c + a;
+var r12 = b + c;
+var r13 = c + b;
+var r14 = c + c;
diff --git a/tests/baselines/reference/additionOperatorWithNumberAndEnum.types b/tests/baselines/reference/additionOperatorWithNumberAndEnum.types
index 268f74b69ff..c22939ffd98 100644
--- a/tests/baselines/reference/additionOperatorWithNumberAndEnum.types
+++ b/tests/baselines/reference/additionOperatorWithNumberAndEnum.types
@@ -4,6 +4,11 @@ enum E { a, b }
>a : E
>b : E
+enum F { c, d }
+>F : F
+>c : F
+>d : F
+
var a: number;
>a : number
@@ -11,6 +16,11 @@ var b: E;
>b : E
>E : E
+var c: E | F;
+>c : E | F
+>E : E
+>F : F
+
var r1 = a + a;
>r1 : number
>a + a : number
@@ -65,3 +75,41 @@ var r8 = E['a'] + E['b'];
>E['b'] : E
>E : typeof E
+var r9 = E['a'] + F['c'];
+>r9 : number
+>E['a'] + F['c'] : number
+>E['a'] : E
+>E : typeof E
+>F['c'] : F
+>F : typeof F
+
+var r10 = a + c;
+>r10 : number
+>a + c : number
+>a : number
+>c : E | F
+
+var r11 = c + a;
+>r11 : number
+>c + a : number
+>c : E | F
+>a : number
+
+var r12 = b + c;
+>r12 : number
+>b + c : number
+>b : E
+>c : E | F
+
+var r13 = c + b;
+>r13 : number
+>c + b : number
+>c : E | F
+>b : E
+
+var r14 = c + c;
+>r14 : number
+>c + c : number
+>c : E | F
+>c : E | F
+
diff --git a/tests/baselines/reference/arithmeticOperatorWithEnumUnion.js b/tests/baselines/reference/arithmeticOperatorWithEnumUnion.js
new file mode 100644
index 00000000000..315f7dd237b
--- /dev/null
+++ b/tests/baselines/reference/arithmeticOperatorWithEnumUnion.js
@@ -0,0 +1,301 @@
+//// [arithmeticOperatorWithEnumUnion.ts]
+// operands of an enum type are treated as having the primitive type Number.
+
+enum E {
+ a,
+ b
+}
+enum F {
+ c,
+ d
+}
+
+var a: any;
+var b: number;
+var c: E | F;
+
+// operator *
+var ra1 = c * a;
+var ra2 = c * b;
+var ra3 = c * c;
+var ra4 = a * c;
+var ra5 = b * c;
+var ra6 = E.a * a;
+var ra7 = E.a * b;
+var ra8 = E.a * E.b;
+var ra9 = E.a * 1;
+var ra10 = a * E.b;
+var ra11 = b * E.b;
+var ra12 = 1 * E.b;
+
+// operator /
+var rb1 = c / a;
+var rb2 = c / b;
+var rb3 = c / c;
+var rb4 = a / c;
+var rb5 = b / c;
+var rb6 = E.a / a;
+var rb7 = E.a / b;
+var rb8 = E.a / E.b;
+var rb9 = E.a / 1;
+var rb10 = a / E.b;
+var rb11 = b / E.b;
+var rb12 = 1 / E.b;
+
+// operator %
+var rc1 = c % a;
+var rc2 = c % b;
+var rc3 = c % c;
+var rc4 = a % c;
+var rc5 = b % c;
+var rc6 = E.a % a;
+var rc7 = E.a % b;
+var rc8 = E.a % E.b;
+var rc9 = E.a % 1;
+var rc10 = a % E.b;
+var rc11 = b % E.b;
+var rc12 = 1 % E.b;
+
+// operator -
+var rd1 = c - a;
+var rd2 = c - b;
+var rd3 = c - c;
+var rd4 = a - c;
+var rd5 = b - c;
+var rd6 = E.a - a;
+var rd7 = E.a - b;
+var rd8 = E.a - E.b;
+var rd9 = E.a - 1;
+var rd10 = a - E.b;
+var rd11 = b - E.b;
+var rd12 = 1 - E.b;
+
+// operator <<
+var re1 = c << a;
+var re2 = c << b;
+var re3 = c << c;
+var re4 = a << c;
+var re5 = b << c;
+var re6 = E.a << a;
+var re7 = E.a << b;
+var re8 = E.a << E.b;
+var re9 = E.a << 1;
+var re10 = a << E.b;
+var re11 = b << E.b;
+var re12 = 1 << E.b;
+
+// operator >>
+var rf1 = c >> a;
+var rf2 = c >> b;
+var rf3 = c >> c;
+var rf4 = a >> c;
+var rf5 = b >> c;
+var rf6 = E.a >> a;
+var rf7 = E.a >> b;
+var rf8 = E.a >> E.b;
+var rf9 = E.a >> 1;
+var rf10 = a >> E.b;
+var rf11 = b >> E.b;
+var rf12 = 1 >> E.b;
+
+// operator >>>
+var rg1 = c >>> a;
+var rg2 = c >>> b;
+var rg3 = c >>> c;
+var rg4 = a >>> c;
+var rg5 = b >>> c;
+var rg6 = E.a >>> a;
+var rg7 = E.a >>> b;
+var rg8 = E.a >>> E.b;
+var rg9 = E.a >>> 1;
+var rg10 = a >>> E.b;
+var rg11 = b >>> E.b;
+var rg12 = 1 >>> E.b;
+
+// operator &
+var rh1 = c & a;
+var rh2 = c & b;
+var rh3 = c & c;
+var rh4 = a & c;
+var rh5 = b & c;
+var rh6 = E.a & a;
+var rh7 = E.a & b;
+var rh8 = E.a & E.b;
+var rh9 = E.a & 1;
+var rh10 = a & E.b;
+var rh11 = b & E.b;
+var rh12 = 1 & E.b;
+
+// operator ^
+var ri1 = c ^ a;
+var ri2 = c ^ b;
+var ri3 = c ^ c;
+var ri4 = a ^ c;
+var ri5 = b ^ c;
+var ri6 = E.a ^ a;
+var ri7 = E.a ^ b;
+var ri8 = E.a ^ E.b;
+var ri9 = E.a ^ 1;
+var ri10 = a ^ E.b;
+var ri11 = b ^ E.b;
+var ri12 = 1 ^ E.b;
+
+// operator |
+var rj1 = c | a;
+var rj2 = c | b;
+var rj3 = c | c;
+var rj4 = a | c;
+var rj5 = b | c;
+var rj6 = E.a | a;
+var rj7 = E.a | b;
+var rj8 = E.a | E.b;
+var rj9 = E.a | 1;
+var rj10 = a | E.b;
+var rj11 = b | E.b;
+var rj12 = 1 | E.b;
+
+//// [arithmeticOperatorWithEnumUnion.js]
+// operands of an enum type are treated as having the primitive type Number.
+var E;
+(function (E) {
+ E[E["a"] = 0] = "a";
+ E[E["b"] = 1] = "b";
+})(E || (E = {}));
+var F;
+(function (F) {
+ F[F["c"] = 0] = "c";
+ F[F["d"] = 1] = "d";
+})(F || (F = {}));
+var a;
+var b;
+var c;
+// operator *
+var ra1 = c * a;
+var ra2 = c * b;
+var ra3 = c * c;
+var ra4 = a * c;
+var ra5 = b * c;
+var ra6 = 0 /* a */ * a;
+var ra7 = 0 /* a */ * b;
+var ra8 = 0 /* a */ * 1 /* b */;
+var ra9 = 0 /* a */ * 1;
+var ra10 = a * 1 /* b */;
+var ra11 = b * 1 /* b */;
+var ra12 = 1 * 1 /* b */;
+// operator /
+var rb1 = c / a;
+var rb2 = c / b;
+var rb3 = c / c;
+var rb4 = a / c;
+var rb5 = b / c;
+var rb6 = 0 /* a */ / a;
+var rb7 = 0 /* a */ / b;
+var rb8 = 0 /* a */ / 1 /* b */;
+var rb9 = 0 /* a */ / 1;
+var rb10 = a / 1 /* b */;
+var rb11 = b / 1 /* b */;
+var rb12 = 1 / 1 /* b */;
+// operator %
+var rc1 = c % a;
+var rc2 = c % b;
+var rc3 = c % c;
+var rc4 = a % c;
+var rc5 = b % c;
+var rc6 = 0 /* a */ % a;
+var rc7 = 0 /* a */ % b;
+var rc8 = 0 /* a */ % 1 /* b */;
+var rc9 = 0 /* a */ % 1;
+var rc10 = a % 1 /* b */;
+var rc11 = b % 1 /* b */;
+var rc12 = 1 % 1 /* b */;
+// operator -
+var rd1 = c - a;
+var rd2 = c - b;
+var rd3 = c - c;
+var rd4 = a - c;
+var rd5 = b - c;
+var rd6 = 0 /* a */ - a;
+var rd7 = 0 /* a */ - b;
+var rd8 = 0 /* a */ - 1 /* b */;
+var rd9 = 0 /* a */ - 1;
+var rd10 = a - 1 /* b */;
+var rd11 = b - 1 /* b */;
+var rd12 = 1 - 1 /* b */;
+// operator <<
+var re1 = c << a;
+var re2 = c << b;
+var re3 = c << c;
+var re4 = a << c;
+var re5 = b << c;
+var re6 = 0 /* a */ << a;
+var re7 = 0 /* a */ << b;
+var re8 = 0 /* a */ << 1 /* b */;
+var re9 = 0 /* a */ << 1;
+var re10 = a << 1 /* b */;
+var re11 = b << 1 /* b */;
+var re12 = 1 << 1 /* b */;
+// operator >>
+var rf1 = c >> a;
+var rf2 = c >> b;
+var rf3 = c >> c;
+var rf4 = a >> c;
+var rf5 = b >> c;
+var rf6 = 0 /* a */ >> a;
+var rf7 = 0 /* a */ >> b;
+var rf8 = 0 /* a */ >> 1 /* b */;
+var rf9 = 0 /* a */ >> 1;
+var rf10 = a >> 1 /* b */;
+var rf11 = b >> 1 /* b */;
+var rf12 = 1 >> 1 /* b */;
+// operator >>>
+var rg1 = c >>> a;
+var rg2 = c >>> b;
+var rg3 = c >>> c;
+var rg4 = a >>> c;
+var rg5 = b >>> c;
+var rg6 = 0 /* a */ >>> a;
+var rg7 = 0 /* a */ >>> b;
+var rg8 = 0 /* a */ >>> 1 /* b */;
+var rg9 = 0 /* a */ >>> 1;
+var rg10 = a >>> 1 /* b */;
+var rg11 = b >>> 1 /* b */;
+var rg12 = 1 >>> 1 /* b */;
+// operator &
+var rh1 = c & a;
+var rh2 = c & b;
+var rh3 = c & c;
+var rh4 = a & c;
+var rh5 = b & c;
+var rh6 = 0 /* a */ & a;
+var rh7 = 0 /* a */ & b;
+var rh8 = 0 /* a */ & 1 /* b */;
+var rh9 = 0 /* a */ & 1;
+var rh10 = a & 1 /* b */;
+var rh11 = b & 1 /* b */;
+var rh12 = 1 & 1 /* b */;
+// operator ^
+var ri1 = c ^ a;
+var ri2 = c ^ b;
+var ri3 = c ^ c;
+var ri4 = a ^ c;
+var ri5 = b ^ c;
+var ri6 = 0 /* a */ ^ a;
+var ri7 = 0 /* a */ ^ b;
+var ri8 = 0 /* a */ ^ 1 /* b */;
+var ri9 = 0 /* a */ ^ 1;
+var ri10 = a ^ 1 /* b */;
+var ri11 = b ^ 1 /* b */;
+var ri12 = 1 ^ 1 /* b */;
+// operator |
+var rj1 = c | a;
+var rj2 = c | b;
+var rj3 = c | c;
+var rj4 = a | c;
+var rj5 = b | c;
+var rj6 = 0 /* a */ | a;
+var rj7 = 0 /* a */ | b;
+var rj8 = 0 /* a */ | 1 /* b */;
+var rj9 = 0 /* a */ | 1;
+var rj10 = a | 1 /* b */;
+var rj11 = b | 1 /* b */;
+var rj12 = 1 | 1 /* b */;
diff --git a/tests/baselines/reference/arithmeticOperatorWithEnumUnion.types b/tests/baselines/reference/arithmeticOperatorWithEnumUnion.types
new file mode 100644
index 00000000000..7b65ddf7f00
--- /dev/null
+++ b/tests/baselines/reference/arithmeticOperatorWithEnumUnion.types
@@ -0,0 +1,903 @@
+=== tests/cases/conformance/expressions/binaryOperators/arithmeticOperator/arithmeticOperatorWithEnumUnion.ts ===
+// operands of an enum type are treated as having the primitive type Number.
+
+enum E {
+>E : E
+
+ a,
+>a : E
+
+ b
+>b : E
+}
+enum F {
+>F : F
+
+ c,
+>c : F
+
+ d
+>d : F
+}
+
+var a: any;
+>a : any
+
+var b: number;
+>b : number
+
+var c: E | F;
+>c : E | F
+>E : E
+>F : F
+
+// operator *
+var ra1 = c * a;
+>ra1 : number
+>c * a : number
+>c : E | F
+>a : any
+
+var ra2 = c * b;
+>ra2 : number
+>c * b : number
+>c : E | F
+>b : number
+
+var ra3 = c * c;
+>ra3 : number
+>c * c : number
+>c : E | F
+>c : E | F
+
+var ra4 = a * c;
+>ra4 : number
+>a * c : number
+>a : any
+>c : E | F
+
+var ra5 = b * c;
+>ra5 : number
+>b * c : number
+>b : number
+>c : E | F
+
+var ra6 = E.a * a;
+>ra6 : number
+>E.a * a : number
+>E.a : E
+>E : typeof E
+>a : E
+>a : any
+
+var ra7 = E.a * b;
+>ra7 : number
+>E.a * b : number
+>E.a : E
+>E : typeof E
+>a : E
+>b : number
+
+var ra8 = E.a * E.b;
+>ra8 : number
+>E.a * E.b : number
+>E.a : E
+>E : typeof E
+>a : E
+>E.b : E
+>E : typeof E
+>b : E
+
+var ra9 = E.a * 1;
+>ra9 : number
+>E.a * 1 : number
+>E.a : E
+>E : typeof E
+>a : E
+
+var ra10 = a * E.b;
+>ra10 : number
+>a * E.b : number
+>a : any
+>E.b : E
+>E : typeof E
+>b : E
+
+var ra11 = b * E.b;
+>ra11 : number
+>b * E.b : number
+>b : number
+>E.b : E
+>E : typeof E
+>b : E
+
+var ra12 = 1 * E.b;
+>ra12 : number
+>1 * E.b : number
+>E.b : E
+>E : typeof E
+>b : E
+
+// operator /
+var rb1 = c / a;
+>rb1 : number
+>c / a : number
+>c : E | F
+>a : any
+
+var rb2 = c / b;
+>rb2 : number
+>c / b : number
+>c : E | F
+>b : number
+
+var rb3 = c / c;
+>rb3 : number
+>c / c : number
+>c : E | F
+>c : E | F
+
+var rb4 = a / c;
+>rb4 : number
+>a / c : number
+>a : any
+>c : E | F
+
+var rb5 = b / c;
+>rb5 : number
+>b / c : number
+>b : number
+>c : E | F
+
+var rb6 = E.a / a;
+>rb6 : number
+>E.a / a : number
+>E.a : E
+>E : typeof E
+>a : E
+>a : any
+
+var rb7 = E.a / b;
+>rb7 : number
+>E.a / b : number
+>E.a : E
+>E : typeof E
+>a : E
+>b : number
+
+var rb8 = E.a / E.b;
+>rb8 : number
+>E.a / E.b : number
+>E.a : E
+>E : typeof E
+>a : E
+>E.b : E
+>E : typeof E
+>b : E
+
+var rb9 = E.a / 1;
+>rb9 : number
+>E.a / 1 : number
+>E.a : E
+>E : typeof E
+>a : E
+
+var rb10 = a / E.b;
+>rb10 : number
+>a / E.b : number
+>a : any
+>E.b : E
+>E : typeof E
+>b : E
+
+var rb11 = b / E.b;
+>rb11 : number
+>b / E.b : number
+>b : number
+>E.b : E
+>E : typeof E
+>b : E
+
+var rb12 = 1 / E.b;
+>rb12 : number
+>1 / E.b : number
+>E.b : E
+>E : typeof E
+>b : E
+
+// operator %
+var rc1 = c % a;
+>rc1 : number
+>c % a : number
+>c : E | F
+>a : any
+
+var rc2 = c % b;
+>rc2 : number
+>c % b : number
+>c : E | F
+>b : number
+
+var rc3 = c % c;
+>rc3 : number
+>c % c : number
+>c : E | F
+>c : E | F
+
+var rc4 = a % c;
+>rc4 : number
+>a % c : number
+>a : any
+>c : E | F
+
+var rc5 = b % c;
+>rc5 : number
+>b % c : number
+>b : number
+>c : E | F
+
+var rc6 = E.a % a;
+>rc6 : number
+>E.a % a : number
+>E.a : E
+>E : typeof E
+>a : E
+>a : any
+
+var rc7 = E.a % b;
+>rc7 : number
+>E.a % b : number
+>E.a : E
+>E : typeof E
+>a : E
+>b : number
+
+var rc8 = E.a % E.b;
+>rc8 : number
+>E.a % E.b : number
+>E.a : E
+>E : typeof E
+>a : E
+>E.b : E
+>E : typeof E
+>b : E
+
+var rc9 = E.a % 1;
+>rc9 : number
+>E.a % 1 : number
+>E.a : E
+>E : typeof E
+>a : E
+
+var rc10 = a % E.b;
+>rc10 : number
+>a % E.b : number
+>a : any
+>E.b : E
+>E : typeof E
+>b : E
+
+var rc11 = b % E.b;
+>rc11 : number
+>b % E.b : number
+>b : number
+>E.b : E
+>E : typeof E
+>b : E
+
+var rc12 = 1 % E.b;
+>rc12 : number
+>1 % E.b : number
+>E.b : E
+>E : typeof E
+>b : E
+
+// operator -
+var rd1 = c - a;
+>rd1 : number
+>c - a : number
+>c : E | F
+>a : any
+
+var rd2 = c - b;
+>rd2 : number
+>c - b : number
+>c : E | F
+>b : number
+
+var rd3 = c - c;
+>rd3 : number
+>c - c : number
+>c : E | F
+>c : E | F
+
+var rd4 = a - c;
+>rd4 : number
+>a - c : number
+>a : any
+>c : E | F
+
+var rd5 = b - c;
+>rd5 : number
+>b - c : number
+>b : number
+>c : E | F
+
+var rd6 = E.a - a;
+>rd6 : number
+>E.a - a : number
+>E.a : E
+>E : typeof E
+>a : E
+>a : any
+
+var rd7 = E.a - b;
+>rd7 : number
+>E.a - b : number
+>E.a : E
+>E : typeof E
+>a : E
+>b : number
+
+var rd8 = E.a - E.b;
+>rd8 : number
+>E.a - E.b : number
+>E.a : E
+>E : typeof E
+>a : E
+>E.b : E
+>E : typeof E
+>b : E
+
+var rd9 = E.a - 1;
+>rd9 : number
+>E.a - 1 : number
+>E.a : E
+>E : typeof E
+>a : E
+
+var rd10 = a - E.b;
+>rd10 : number
+>a - E.b : number
+>a : any
+>E.b : E
+>E : typeof E
+>b : E
+
+var rd11 = b - E.b;
+>rd11 : number
+>b - E.b : number
+>b : number
+>E.b : E
+>E : typeof E
+>b : E
+
+var rd12 = 1 - E.b;
+>rd12 : number
+>1 - E.b : number
+>E.b : E
+>E : typeof E
+>b : E
+
+// operator <<
+var re1 = c << a;
+>re1 : number
+>c << a : number
+>c : E | F
+>a : any
+
+var re2 = c << b;
+>re2 : number
+>c << b : number
+>c : E | F
+>b : number
+
+var re3 = c << c;
+>re3 : number
+>c << c : number
+>c : E | F
+>c : E | F
+
+var re4 = a << c;
+>re4 : number
+>a << c : number
+>a : any
+>c : E | F
+
+var re5 = b << c;
+>re5 : number
+>b << c : number
+>b : number
+>c : E | F
+
+var re6 = E.a << a;
+>re6 : number
+>E.a << a : number
+>E.a : E
+>E : typeof E
+>a : E
+>a : any
+
+var re7 = E.a << b;
+>re7 : number
+>E.a << b : number
+>E.a : E
+>E : typeof E
+>a : E
+>b : number
+
+var re8 = E.a << E.b;
+>re8 : number
+>E.a << E.b : number
+>E.a : E
+>E : typeof E
+>a : E
+>E.b : E
+>E : typeof E
+>b : E
+
+var re9 = E.a << 1;
+>re9 : number
+>E.a << 1 : number
+>E.a : E
+>E : typeof E
+>a : E
+
+var re10 = a << E.b;
+>re10 : number
+>a << E.b : number
+>a : any
+>E.b : E
+>E : typeof E
+>b : E
+
+var re11 = b << E.b;
+>re11 : number
+>b << E.b : number
+>b : number
+>E.b : E
+>E : typeof E
+>b : E
+
+var re12 = 1 << E.b;
+>re12 : number
+>1 << E.b : number
+>E.b : E
+>E : typeof E
+>b : E
+
+// operator >>
+var rf1 = c >> a;
+>rf1 : number
+>c >> a : number
+>c : E | F
+>a : any
+
+var rf2 = c >> b;
+>rf2 : number
+>c >> b : number
+>c : E | F
+>b : number
+
+var rf3 = c >> c;
+>rf3 : number
+>c >> c : number
+>c : E | F
+>c : E | F
+
+var rf4 = a >> c;
+>rf4 : number
+>a >> c : number
+>a : any
+>c : E | F
+
+var rf5 = b >> c;
+>rf5 : number
+>b >> c : number
+>b : number
+>c : E | F
+
+var rf6 = E.a >> a;
+>rf6 : number
+>E.a >> a : number
+>E.a : E
+>E : typeof E
+>a : E
+>a : any
+
+var rf7 = E.a >> b;
+>rf7 : number
+>E.a >> b : number
+>E.a : E
+>E : typeof E
+>a : E
+>b : number
+
+var rf8 = E.a >> E.b;
+>rf8 : number
+>E.a >> E.b : number
+>E.a : E
+>E : typeof E
+>a : E
+>E.b : E
+>E : typeof E
+>b : E
+
+var rf9 = E.a >> 1;
+>rf9 : number
+>E.a >> 1 : number
+>E.a : E
+>E : typeof E
+>a : E
+
+var rf10 = a >> E.b;
+>rf10 : number
+>a >> E.b : number
+>a : any
+>E.b : E
+>E : typeof E
+>b : E
+
+var rf11 = b >> E.b;
+>rf11 : number
+>b >> E.b : number
+>b : number
+>E.b : E
+>E : typeof E
+>b : E
+
+var rf12 = 1 >> E.b;
+>rf12 : number
+>1 >> E.b : number
+>E.b : E
+>E : typeof E
+>b : E
+
+// operator >>>
+var rg1 = c >>> a;
+>rg1 : number
+>c >>> a : number
+>c : E | F
+>a : any
+
+var rg2 = c >>> b;
+>rg2 : number
+>c >>> b : number
+>c : E | F
+>b : number
+
+var rg3 = c >>> c;
+>rg3 : number
+>c >>> c : number
+>c : E | F
+>c : E | F
+
+var rg4 = a >>> c;
+>rg4 : number
+>a >>> c : number
+>a : any
+>c : E | F
+
+var rg5 = b >>> c;
+>rg5 : number
+>b >>> c : number
+>b : number
+>c : E | F
+
+var rg6 = E.a >>> a;
+>rg6 : number
+>E.a >>> a : number
+>E.a : E
+>E : typeof E
+>a : E
+>a : any
+
+var rg7 = E.a >>> b;
+>rg7 : number
+>E.a >>> b : number
+>E.a : E
+>E : typeof E
+>a : E
+>b : number
+
+var rg8 = E.a >>> E.b;
+>rg8 : number
+>E.a >>> E.b : number
+>E.a : E
+>E : typeof E
+>a : E
+>E.b : E
+>E : typeof E
+>b : E
+
+var rg9 = E.a >>> 1;
+>rg9 : number
+>E.a >>> 1 : number
+>E.a : E
+>E : typeof E
+>a : E
+
+var rg10 = a >>> E.b;
+>rg10 : number
+>a >>> E.b : number
+>a : any
+>E.b : E
+>E : typeof E
+>b : E
+
+var rg11 = b >>> E.b;
+>rg11 : number
+>b >>> E.b : number
+>b : number
+>E.b : E
+>E : typeof E
+>b : E
+
+var rg12 = 1 >>> E.b;
+>rg12 : number
+>1 >>> E.b : number
+>E.b : E
+>E : typeof E
+>b : E
+
+// operator &
+var rh1 = c & a;
+>rh1 : number
+>c & a : number
+>c : E | F
+>a : any
+
+var rh2 = c & b;
+>rh2 : number
+>c & b : number
+>c : E | F
+>b : number
+
+var rh3 = c & c;
+>rh3 : number
+>c & c : number
+>c : E | F
+>c : E | F
+
+var rh4 = a & c;
+>rh4 : number
+>a & c : number
+>a : any
+>c : E | F
+
+var rh5 = b & c;
+>rh5 : number
+>b & c : number
+>b : number
+>c : E | F
+
+var rh6 = E.a & a;
+>rh6 : number
+>E.a & a : number
+>E.a : E
+>E : typeof E
+>a : E
+>a : any
+
+var rh7 = E.a & b;
+>rh7 : number
+>E.a & b : number
+>E.a : E
+>E : typeof E
+>a : E
+>b : number
+
+var rh8 = E.a & E.b;
+>rh8 : number
+>E.a & E.b : number
+>E.a : E
+>E : typeof E
+>a : E
+>E.b : E
+>E : typeof E
+>b : E
+
+var rh9 = E.a & 1;
+>rh9 : number
+>E.a & 1 : number
+>E.a : E
+>E : typeof E
+>a : E
+
+var rh10 = a & E.b;
+>rh10 : number
+>a & E.b : number
+>a : any
+>E.b : E
+>E : typeof E
+>b : E
+
+var rh11 = b & E.b;
+>rh11 : number
+>b & E.b : number
+>b : number
+>E.b : E
+>E : typeof E
+>b : E
+
+var rh12 = 1 & E.b;
+>rh12 : number
+>1 & E.b : number
+>E.b : E
+>E : typeof E
+>b : E
+
+// operator ^
+var ri1 = c ^ a;
+>ri1 : number
+>c ^ a : number
+>c : E | F
+>a : any
+
+var ri2 = c ^ b;
+>ri2 : number
+>c ^ b : number
+>c : E | F
+>b : number
+
+var ri3 = c ^ c;
+>ri3 : number
+>c ^ c : number
+>c : E | F
+>c : E | F
+
+var ri4 = a ^ c;
+>ri4 : number
+>a ^ c : number
+>a : any
+>c : E | F
+
+var ri5 = b ^ c;
+>ri5 : number
+>b ^ c : number
+>b : number
+>c : E | F
+
+var ri6 = E.a ^ a;
+>ri6 : number
+>E.a ^ a : number
+>E.a : E
+>E : typeof E
+>a : E
+>a : any
+
+var ri7 = E.a ^ b;
+>ri7 : number
+>E.a ^ b : number
+>E.a : E
+>E : typeof E
+>a : E
+>b : number
+
+var ri8 = E.a ^ E.b;
+>ri8 : number
+>E.a ^ E.b : number
+>E.a : E
+>E : typeof E
+>a : E
+>E.b : E
+>E : typeof E
+>b : E
+
+var ri9 = E.a ^ 1;
+>ri9 : number
+>E.a ^ 1 : number
+>E.a : E
+>E : typeof E
+>a : E
+
+var ri10 = a ^ E.b;
+>ri10 : number
+>a ^ E.b : number
+>a : any
+>E.b : E
+>E : typeof E
+>b : E
+
+var ri11 = b ^ E.b;
+>ri11 : number
+>b ^ E.b : number
+>b : number
+>E.b : E
+>E : typeof E
+>b : E
+
+var ri12 = 1 ^ E.b;
+>ri12 : number
+>1 ^ E.b : number
+>E.b : E
+>E : typeof E
+>b : E
+
+// operator |
+var rj1 = c | a;
+>rj1 : number
+>c | a : number
+>c : E | F
+>a : any
+
+var rj2 = c | b;
+>rj2 : number
+>c | b : number
+>c : E | F
+>b : number
+
+var rj3 = c | c;
+>rj3 : number
+>c | c : number
+>c : E | F
+>c : E | F
+
+var rj4 = a | c;
+>rj4 : number
+>a | c : number
+>a : any
+>c : E | F
+
+var rj5 = b | c;
+>rj5 : number
+>b | c : number
+>b : number
+>c : E | F
+
+var rj6 = E.a | a;
+>rj6 : number
+>E.a | a : number
+>E.a : E
+>E : typeof E
+>a : E
+>a : any
+
+var rj7 = E.a | b;
+>rj7 : number
+>E.a | b : number
+>E.a : E
+>E : typeof E
+>a : E
+>b : number
+
+var rj8 = E.a | E.b;
+>rj8 : number
+>E.a | E.b : number
+>E.a : E
+>E : typeof E
+>a : E
+>E.b : E
+>E : typeof E
+>b : E
+
+var rj9 = E.a | 1;
+>rj9 : number
+>E.a | 1 : number
+>E.a : E
+>E : typeof E
+>a : E
+
+var rj10 = a | E.b;
+>rj10 : number
+>a | E.b : number
+>a : any
+>E.b : E
+>E : typeof E
+>b : E
+
+var rj11 = b | E.b;
+>rj11 : number
+>b | E.b : number
+>b : number
+>E.b : E
+>E : typeof E
+>b : E
+
+var rj12 = 1 | E.b;
+>rj12 : number
+>1 | E.b : number
+>E.b : E
+>E : typeof E
+>b : E
+
diff --git a/tests/baselines/reference/assignmentCompatBug2.errors.txt b/tests/baselines/reference/assignmentCompatBug2.errors.txt
index 15bf1111391..b90c470d771 100644
--- a/tests/baselines/reference/assignmentCompatBug2.errors.txt
+++ b/tests/baselines/reference/assignmentCompatBug2.errors.txt
@@ -2,10 +2,10 @@ tests/cases/compiler/assignmentCompatBug2.ts(1,5): error TS2322: Type '{ a: numb
Property 'b' is missing in type '{ a: number; }'.
tests/cases/compiler/assignmentCompatBug2.ts(3,1): error TS2322: Type '{ a: number; }' is not assignable to type '{ b: number; }'.
Property 'b' is missing in type '{ a: number; }'.
-tests/cases/compiler/assignmentCompatBug2.ts(15,1): error TS2322: Type '{ f: (n: number) => number; g: (s: string) => number; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'.
- Property 'm' is missing in type '{ f: (n: number) => number; g: (s: string) => number; }'.
-tests/cases/compiler/assignmentCompatBug2.ts(20,1): error TS2322: Type '{ f: (n: number) => number; m: number; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'.
- Property 'g' is missing in type '{ f: (n: number) => number; m: number; }'.
+tests/cases/compiler/assignmentCompatBug2.ts(15,1): error TS2322: Type '{ f: (n: number) => number; g: (s: string) => number; n?: number; k?(a: any): any; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'.
+ Property 'm' is missing in type '{ f: (n: number) => number; g: (s: string) => number; n?: number; k?(a: any): any; }'.
+tests/cases/compiler/assignmentCompatBug2.ts(20,1): error TS2322: Type '{ f: (n: number) => number; m: number; n?: number; k?(a: any): any; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'.
+ Property 'g' is missing in type '{ f: (n: number) => number; m: number; n?: number; k?(a: any): any; }'.
tests/cases/compiler/assignmentCompatBug2.ts(33,1): error TS2322: Type '{ f: (n: number) => number; g: (s: string) => number; n: number; k: (a: any) => any; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'.
Property 'm' is missing in type '{ f: (n: number) => number; g: (s: string) => number; n: number; k: (a: any) => any; }'.
@@ -33,16 +33,16 @@ tests/cases/compiler/assignmentCompatBug2.ts(33,1): error TS2322: Type '{ f: (n:
b3 = {
~~
-!!! error TS2322: Type '{ f: (n: number) => number; g: (s: string) => number; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'.
-!!! error TS2322: Property 'm' is missing in type '{ f: (n: number) => number; g: (s: string) => number; }'.
+!!! error TS2322: Type '{ f: (n: number) => number; g: (s: string) => number; n?: number; k?(a: any): any; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'.
+!!! error TS2322: Property 'm' is missing in type '{ f: (n: number) => number; g: (s: string) => number; n?: number; k?(a: any): any; }'.
f: (n) => { return 0; },
g: (s) => { return 0; },
}; // error
b3 = {
~~
-!!! error TS2322: Type '{ f: (n: number) => number; m: number; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'.
-!!! error TS2322: Property 'g' is missing in type '{ f: (n: number) => number; m: number; }'.
+!!! error TS2322: Type '{ f: (n: number) => number; m: number; n?: number; k?(a: any): any; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'.
+!!! error TS2322: Property 'g' is missing in type '{ f: (n: number) => number; m: number; n?: number; k?(a: any): any; }'.
f: (n) => { return 0; },
m: 0,
}; // error
diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembers3.types b/tests/baselines/reference/assignmentCompatWithObjectMembers3.types
index 85a7e59ffbc..ff7ef23307d 100644
--- a/tests/baselines/reference/assignmentCompatWithObjectMembers3.types
+++ b/tests/baselines/reference/assignmentCompatWithObjectMembers3.types
@@ -51,13 +51,13 @@ var b: { foo: string; baz?: string }
var a2: S2 = { foo: '' };
>a2 : S2
>S2 : S2
->{ foo: '' } : { foo: string; }
+>{ foo: '' } : { foo: string; bar?: string; }
>foo : string
var b2: T2 = { foo: '' };
>b2 : T2
>T2 : T2
->{ foo: '' } : { foo: string; }
+>{ foo: '' } : { foo: string; baz?: string; }
>foo : string
s = t;
diff --git a/tests/baselines/reference/assignmentCompatability1.types b/tests/baselines/reference/assignmentCompatability1.types
index 9949fc14bf5..8bb4301b201 100644
--- a/tests/baselines/reference/assignmentCompatability1.types
+++ b/tests/baselines/reference/assignmentCompatability1.types
@@ -12,7 +12,7 @@ module __test1__ {
>U : U
>obj4 : interfaceWithPublicAndOptional
>interfaceWithPublicAndOptional : interfaceWithPublicAndOptional
->{ one: 1 } : { one: number; }
+>{ one: 1 } : { one: number; two?: string; }
>one : number
export var __val__obj4 = obj4;
diff --git a/tests/baselines/reference/assignmentCompatability2.types b/tests/baselines/reference/assignmentCompatability2.types
index 16da45c7e35..69a20b34dd7 100644
--- a/tests/baselines/reference/assignmentCompatability2.types
+++ b/tests/baselines/reference/assignmentCompatability2.types
@@ -12,7 +12,7 @@ module __test1__ {
>U : U
>obj4 : interfaceWithPublicAndOptional
>interfaceWithPublicAndOptional : interfaceWithPublicAndOptional
->{ one: 1 } : { one: number; }
+>{ one: 1 } : { one: number; two?: string; }
>one : number
export var __val__obj4 = obj4;
diff --git a/tests/baselines/reference/assignmentCompatability3.types b/tests/baselines/reference/assignmentCompatability3.types
index 61279b9c7fa..4b598fba84c 100644
--- a/tests/baselines/reference/assignmentCompatability3.types
+++ b/tests/baselines/reference/assignmentCompatability3.types
@@ -12,7 +12,7 @@ module __test1__ {
>U : U
>obj4 : interfaceWithPublicAndOptional
>interfaceWithPublicAndOptional : interfaceWithPublicAndOptional
->{ one: 1 } : { one: number; }
+>{ one: 1 } : { one: number; two?: string; }
>one : number
export var __val__obj4 = obj4;
diff --git a/tests/baselines/reference/assignmentCompatability4.types b/tests/baselines/reference/assignmentCompatability4.types
index f7e5801e9b3..3d8e776ff72 100644
--- a/tests/baselines/reference/assignmentCompatability4.types
+++ b/tests/baselines/reference/assignmentCompatability4.types
@@ -12,7 +12,7 @@ module __test1__ {
>U : U
>obj4 : interfaceWithPublicAndOptional
>interfaceWithPublicAndOptional : interfaceWithPublicAndOptional
->{ one: 1 } : { one: number; }
+>{ one: 1 } : { one: number; two?: string; }
>one : number
export var __val__obj4 = obj4;
diff --git a/tests/baselines/reference/assignmentCompatability5.types b/tests/baselines/reference/assignmentCompatability5.types
index 80eda3e510b..970c913955d 100644
--- a/tests/baselines/reference/assignmentCompatability5.types
+++ b/tests/baselines/reference/assignmentCompatability5.types
@@ -12,7 +12,7 @@ module __test1__ {
>U : U
>obj4 : interfaceWithPublicAndOptional
>interfaceWithPublicAndOptional : interfaceWithPublicAndOptional
->{ one: 1 } : { one: number; }
+>{ one: 1 } : { one: number; two?: string; }
>one : number
export var __val__obj4 = obj4;
diff --git a/tests/baselines/reference/assignmentCompatability6.types b/tests/baselines/reference/assignmentCompatability6.types
index 5e9ae8c6a2f..cf131600c41 100644
--- a/tests/baselines/reference/assignmentCompatability6.types
+++ b/tests/baselines/reference/assignmentCompatability6.types
@@ -12,7 +12,7 @@ module __test1__ {
>U : U
>obj4 : interfaceWithPublicAndOptional
>interfaceWithPublicAndOptional : interfaceWithPublicAndOptional
->{ one: 1 } : { one: number; }
+>{ one: 1 } : { one: number; two?: string; }
>one : number
export var __val__obj4 = obj4;
@@ -29,7 +29,7 @@ module __test2__ {
>T : T
>obj3 : interfaceWithOptional
>interfaceWithOptional : interfaceWithOptional
->{ } : {}
+>{ } : { one?: number; }
export var __val__obj3 = obj3;
>__val__obj3 : interfaceWithOptional
diff --git a/tests/baselines/reference/assignmentCompatability7.types b/tests/baselines/reference/assignmentCompatability7.types
index b7b2ab70566..5bb46428314 100644
--- a/tests/baselines/reference/assignmentCompatability7.types
+++ b/tests/baselines/reference/assignmentCompatability7.types
@@ -12,7 +12,7 @@ module __test1__ {
>U : U
>obj4 : interfaceWithPublicAndOptional
>interfaceWithPublicAndOptional : interfaceWithPublicAndOptional
->{ one: 1 } : { one: number; }
+>{ one: 1 } : { one: number; two?: string; }
>one : number
export var __val__obj4 = obj4;
@@ -32,7 +32,7 @@ module __test2__ {
>U : U
>obj4 : interfaceWithPublicAndOptional
>interfaceWithPublicAndOptional : interfaceWithPublicAndOptional
->{ one: 1 } : { one: number; }
+>{ one: 1 } : { one: number; two?: string; }
>one : number
export var __val__obj4 = obj4;
diff --git a/tests/baselines/reference/assignmentCompatability8.types b/tests/baselines/reference/assignmentCompatability8.types
index 1c009eea482..21fa300a37d 100644
--- a/tests/baselines/reference/assignmentCompatability8.types
+++ b/tests/baselines/reference/assignmentCompatability8.types
@@ -12,7 +12,7 @@ module __test1__ {
>U : U
>obj4 : interfaceWithPublicAndOptional
>interfaceWithPublicAndOptional : interfaceWithPublicAndOptional
->{ one: 1 } : { one: number; }
+>{ one: 1 } : { one: number; two?: string; }
>one : number
export var __val__obj4 = obj4;
diff --git a/tests/baselines/reference/assignmentCompatability9.types b/tests/baselines/reference/assignmentCompatability9.types
index a8235220bec..cc8df0387e7 100644
--- a/tests/baselines/reference/assignmentCompatability9.types
+++ b/tests/baselines/reference/assignmentCompatability9.types
@@ -12,7 +12,7 @@ module __test1__ {
>U : U
>obj4 : interfaceWithPublicAndOptional
>interfaceWithPublicAndOptional : interfaceWithPublicAndOptional
->{ one: 1 } : { one: number; }
+>{ one: 1 } : { one: number; two?: string; }
>one : number
export var __val__obj4 = obj4;
diff --git a/tests/baselines/reference/baseIndexSignatureResolution.js b/tests/baselines/reference/baseIndexSignatureResolution.js
index 4c2d63bf2c9..4720e92b969 100644
--- a/tests/baselines/reference/baseIndexSignatureResolution.js
+++ b/tests/baselines/reference/baseIndexSignatureResolution.js
@@ -55,27 +55,4 @@ interface B extends A {
}
var b: B = null;
var z: Derived = b.foo();
-class Base { private a: string; }
-class Derived extends Base { private b: string; }
-
-// Note - commmenting "extends Foo" prevents the error
-interface Foo {
- [i: number]: Base;
-}
-interface FooOf extends Foo {
- [i: number]: TBase;
-}
-var x: FooOf = null;
-var y: Derived = x[0];
-
-/*
-// Note - the equivalent for normal interface methods works fine:
-interface A {
- foo(): Base;
-}
-interface B extends A {
- foo(): TBase;
-}
-var b: B = null;
-var z: Derived = b.foo();
-
+*/
diff --git a/tests/baselines/reference/commentEmitWithCommentOnLastLine.js b/tests/baselines/reference/commentEmitWithCommentOnLastLine.js
new file mode 100644
index 00000000000..ffd4addb264
--- /dev/null
+++ b/tests/baselines/reference/commentEmitWithCommentOnLastLine.js
@@ -0,0 +1,11 @@
+//// [commentEmitWithCommentOnLastLine.ts]
+var x: any;
+/*
+var bar;
+*/
+
+//// [commentEmitWithCommentOnLastLine.js]
+var x;
+/*
+var bar;
+*/
diff --git a/tests/baselines/reference/commentEmitWithCommentOnLastLine.types b/tests/baselines/reference/commentEmitWithCommentOnLastLine.types
new file mode 100644
index 00000000000..d59c42d3795
--- /dev/null
+++ b/tests/baselines/reference/commentEmitWithCommentOnLastLine.types
@@ -0,0 +1,7 @@
+=== tests/cases/compiler/commentEmitWithCommentOnLastLine.ts ===
+var x: any;
+>x : any
+
+/*
+var bar;
+*/
diff --git a/tests/baselines/reference/complicatedPrivacy.errors.txt b/tests/baselines/reference/complicatedPrivacy.errors.txt
index fd47927f883..5aa399d1d84 100644
--- a/tests/baselines/reference/complicatedPrivacy.errors.txt
+++ b/tests/baselines/reference/complicatedPrivacy.errors.txt
@@ -1,8 +1,9 @@
tests/cases/compiler/complicatedPrivacy.ts(24,38): error TS1005: ';' expected.
+tests/cases/compiler/complicatedPrivacy.ts(35,6): error TS2304: Cannot find name 'number'.
tests/cases/compiler/complicatedPrivacy.ts(73,49): error TS2305: Module 'mglo5' has no exported member 'i6'.
-==== tests/cases/compiler/complicatedPrivacy.ts (2 errors) ====
+==== tests/cases/compiler/complicatedPrivacy.ts (3 errors) ====
module m1 {
export module m2 {
@@ -39,7 +40,9 @@ tests/cases/compiler/complicatedPrivacy.ts(73,49): error TS2305: Module 'mglo5'
export function f4(arg1:
{
- [number]: C1;
+ [number]: C1; // Used to be indexer, now it is a computed property
+ ~~~~~~
+!!! error TS2304: Cannot find name 'number'.
}) {
}
diff --git a/tests/baselines/reference/computedPropertyNames1.errors.txt b/tests/baselines/reference/computedPropertyNames1.errors.txt
deleted file mode 100644
index 02abbcd6b2d..00000000000
--- a/tests/baselines/reference/computedPropertyNames1.errors.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-tests/cases/conformance/es6/computedProperties/computedPropertyNames1.ts(2,9): error TS9002: Computed property names are not currently supported.
-tests/cases/conformance/es6/computedProperties/computedPropertyNames1.ts(3,9): error TS9002: Computed property names are not currently supported.
-
-
-==== tests/cases/conformance/es6/computedProperties/computedPropertyNames1.ts (2 errors) ====
- var v = {
- get [0 + 1]() { return 0 },
- ~~~~~~~
-!!! error TS9002: Computed property names are not currently supported.
- set [0 + 1](v: string) { } //No error
- ~~~~~~~
-!!! error TS9002: Computed property names are not currently supported.
- }
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNames1.js b/tests/baselines/reference/computedPropertyNames1.js
new file mode 100644
index 00000000000..8f3e448d698
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames1.js
@@ -0,0 +1,14 @@
+//// [computedPropertyNames1.ts]
+var v = {
+ get [0 + 1]() { return 0 },
+ set [0 + 1](v: string) { } //No error
+}
+
+//// [computedPropertyNames1.js]
+var v = {
+ get [0 + 1]() {
+ return 0;
+ },
+ set [0 + 1](v) {
+ } //No error
+};
diff --git a/tests/baselines/reference/computedPropertyNames1.types b/tests/baselines/reference/computedPropertyNames1.types
new file mode 100644
index 00000000000..b44aa3c69d0
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames1.types
@@ -0,0 +1,12 @@
+=== tests/cases/conformance/es6/computedProperties/computedPropertyNames1.ts ===
+var v = {
+>v : {}
+>{ get [0 + 1]() { return 0 }, set [0 + 1](v: string) { } //No error} : {}
+
+ get [0 + 1]() { return 0 },
+>0 + 1 : number
+
+ set [0 + 1](v: string) { } //No error
+>0 + 1 : number
+>v : string
+}
diff --git a/tests/baselines/reference/computedPropertyNames10.js b/tests/baselines/reference/computedPropertyNames10.js
new file mode 100644
index 00000000000..138cbd7a4b2
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames10.js
@@ -0,0 +1,46 @@
+//// [computedPropertyNames10.ts]
+var s: string;
+var n: number;
+var a: any;
+var v = {
+ [s]() { },
+ [n]() { },
+ [s + s]() { },
+ [s + n]() { },
+ [+s]() { },
+ [""]() { },
+ [0]() { },
+ [a]() { },
+ [true]() { },
+ [`hello bye`]() { },
+ [`hello ${a} bye`]() { }
+}
+
+//// [computedPropertyNames10.js]
+var s;
+var n;
+var a;
+var v = {
+ [s]() {
+ },
+ [n]() {
+ },
+ [s + s]() {
+ },
+ [s + n]() {
+ },
+ [+s]() {
+ },
+ [""]() {
+ },
+ [0]() {
+ },
+ [a]() {
+ },
+ [true]() {
+ },
+ [`hello bye`]() {
+ },
+ [`hello ${a} bye`]() {
+ }
+};
diff --git a/tests/baselines/reference/computedPropertyNames10.types b/tests/baselines/reference/computedPropertyNames10.types
new file mode 100644
index 00000000000..29bf6c43bef
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames10.types
@@ -0,0 +1,46 @@
+=== tests/cases/conformance/es6/computedProperties/computedPropertyNames10.ts ===
+var s: string;
+>s : string
+
+var n: number;
+>n : number
+
+var a: any;
+>a : any
+
+var v = {
+>v : {}
+>{ [s]() { }, [n]() { }, [s + s]() { }, [s + n]() { }, [+s]() { }, [""]() { }, [0]() { }, [a]() { }, [true]() { }, [`hello bye`]() { }, [`hello ${a} bye`]() { }} : {}
+
+ [s]() { },
+>s : string
+
+ [n]() { },
+>n : number
+
+ [s + s]() { },
+>s + s : string
+>s : string
+>s : string
+
+ [s + n]() { },
+>s + n : string
+>s : string
+>n : number
+
+ [+s]() { },
+>+s : number
+>s : string
+
+ [""]() { },
+ [0]() { },
+ [a]() { },
+>a : any
+
+ [true]() { },
+>true : any
+
+ [`hello bye`]() { },
+ [`hello ${a} bye`]() { }
+>a : any
+}
diff --git a/tests/baselines/reference/computedPropertyNames11.js b/tests/baselines/reference/computedPropertyNames11.js
new file mode 100644
index 00000000000..d82a7c4e512
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames11.js
@@ -0,0 +1,52 @@
+//// [computedPropertyNames11.ts]
+var s: string;
+var n: number;
+var a: any;
+var v = {
+ get [s]() { return 0; },
+ set [n](v) { },
+ get [s + s]() { return 0; },
+ set [s + n](v) { },
+ get [+s]() { return 0; },
+ set [""](v) { },
+ get [0]() { return 0; },
+ set [a](v) { },
+ get [true]() { return 0; },
+ set [`hello bye`](v) { },
+ get [`hello ${a} bye`]() { return 0; }
+}
+
+//// [computedPropertyNames11.js]
+var s;
+var n;
+var a;
+var v = {
+ get [s]() {
+ return 0;
+ },
+ set [n](v) {
+ },
+ get [s + s]() {
+ return 0;
+ },
+ set [s + n](v) {
+ },
+ get [+s]() {
+ return 0;
+ },
+ set [""](v) {
+ },
+ get [0]() {
+ return 0;
+ },
+ set [a](v) {
+ },
+ get [true]() {
+ return 0;
+ },
+ set [`hello bye`](v) {
+ },
+ get [`hello ${a} bye`]() {
+ return 0;
+ }
+};
diff --git a/tests/baselines/reference/computedPropertyNames11.types b/tests/baselines/reference/computedPropertyNames11.types
new file mode 100644
index 00000000000..ee0796320d6
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames11.types
@@ -0,0 +1,53 @@
+=== tests/cases/conformance/es6/computedProperties/computedPropertyNames11.ts ===
+var s: string;
+>s : string
+
+var n: number;
+>n : number
+
+var a: any;
+>a : any
+
+var v = {
+>v : {}
+>{ get [s]() { return 0; }, set [n](v) { }, get [s + s]() { return 0; }, set [s + n](v) { }, get [+s]() { return 0; }, set [""](v) { }, get [0]() { return 0; }, set [a](v) { }, get [true]() { return 0; }, set [`hello bye`](v) { }, get [`hello ${a} bye`]() { return 0; }} : {}
+
+ get [s]() { return 0; },
+>s : string
+
+ set [n](v) { },
+>n : number
+>v : any
+
+ get [s + s]() { return 0; },
+>s + s : string
+>s : string
+>s : string
+
+ set [s + n](v) { },
+>s + n : string
+>s : string
+>n : number
+>v : any
+
+ get [+s]() { return 0; },
+>+s : number
+>s : string
+
+ set [""](v) { },
+>v : any
+
+ get [0]() { return 0; },
+ set [a](v) { },
+>a : any
+>v : any
+
+ get [true]() { return 0; },
+>true : any
+
+ set [`hello bye`](v) { },
+>v : any
+
+ get [`hello ${a} bye`]() { return 0; }
+>a : any
+}
diff --git a/tests/baselines/reference/computedPropertyNames12.errors.txt b/tests/baselines/reference/computedPropertyNames12.errors.txt
new file mode 100644
index 00000000000..56774fe8dae
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames12.errors.txt
@@ -0,0 +1,52 @@
+tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(5,5): error TS1166: Computed property names are not allowed in class property declarations.
+tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(6,5): error TS1166: Computed property names are not allowed in class property declarations.
+tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(7,12): error TS1166: Computed property names are not allowed in class property declarations.
+tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(8,5): error TS1166: Computed property names are not allowed in class property declarations.
+tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(9,5): error TS1166: Computed property names are not allowed in class property declarations.
+tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(10,12): error TS1166: Computed property names are not allowed in class property declarations.
+tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(11,5): error TS1166: Computed property names are not allowed in class property declarations.
+tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(12,5): error TS1166: Computed property names are not allowed in class property declarations.
+tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(13,12): error TS1166: Computed property names are not allowed in class property declarations.
+tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(14,5): error TS1166: Computed property names are not allowed in class property declarations.
+tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(15,12): error TS1166: Computed property names are not allowed in class property declarations.
+
+
+==== tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts (11 errors) ====
+ var s: string;
+ var n: number;
+ var a: any;
+ class C {
+ [s]: number;
+ ~~~
+!!! error TS1166: Computed property names are not allowed in class property declarations.
+ [n] = n;
+ ~~~
+!!! error TS1166: Computed property names are not allowed in class property declarations.
+ static [s + s]: string;
+ ~~~~~~~
+!!! error TS1166: Computed property names are not allowed in class property declarations.
+ [s + n] = 2;
+ ~~~~~~~
+!!! error TS1166: Computed property names are not allowed in class property declarations.
+ [+s]: typeof s;
+ ~~~~
+!!! error TS1166: Computed property names are not allowed in class property declarations.
+ static [""]: number;
+ ~~~~
+!!! error TS1166: Computed property names are not allowed in class property declarations.
+ [0]: number;
+ ~~~
+!!! error TS1166: Computed property names are not allowed in class property declarations.
+ [a]: number;
+ ~~~
+!!! error TS1166: Computed property names are not allowed in class property declarations.
+ static [true]: number;
+ ~~~~~~~~~~~
+!!! error TS1166: Computed property names are not allowed in class property declarations.
+ [`hello bye`] = 0;
+ ~~~~~~~~~~~~~
+!!! error TS1166: Computed property names are not allowed in class property declarations.
+ static [`hello ${a} bye`] = 0
+ ~~~~~~~~~~~~~~~~~~
+!!! error TS1166: Computed property names are not allowed in class property declarations.
+ }
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNames13.js b/tests/baselines/reference/computedPropertyNames13.js
new file mode 100644
index 00000000000..ea531a9c644
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames13.js
@@ -0,0 +1,49 @@
+//// [computedPropertyNames13.ts]
+var s: string;
+var n: number;
+var a: any;
+class C {
+ [s]() {}
+ [n]() { }
+ static [s + s]() { }
+ [s + n]() { }
+ [+s]() { }
+ static [""]() { }
+ [0]() { }
+ [a]() { }
+ static [true]() { }
+ [`hello bye`]() { }
+ static [`hello ${a} bye`]() { }
+}
+
+//// [computedPropertyNames13.js]
+var s;
+var n;
+var a;
+var C = (function () {
+ function C() {
+ }
+ C.prototype[s] = function () {
+ };
+ C.prototype[n] = function () {
+ };
+ C[s + s] = function () {
+ };
+ C.prototype[s + n] = function () {
+ };
+ C.prototype[+s] = function () {
+ };
+ C[""] = function () {
+ };
+ C.prototype[0] = function () {
+ };
+ C.prototype[a] = function () {
+ };
+ C[true] = function () {
+ };
+ C.prototype[`hello bye`] = function () {
+ };
+ C[`hello ${a} bye`] = function () {
+ };
+ return C;
+})();
diff --git a/tests/baselines/reference/computedPropertyNames13.types b/tests/baselines/reference/computedPropertyNames13.types
new file mode 100644
index 00000000000..4f267f2e893
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames13.types
@@ -0,0 +1,45 @@
+=== tests/cases/conformance/es6/computedProperties/computedPropertyNames13.ts ===
+var s: string;
+>s : string
+
+var n: number;
+>n : number
+
+var a: any;
+>a : any
+
+class C {
+>C : C
+
+ [s]() {}
+>s : string
+
+ [n]() { }
+>n : number
+
+ static [s + s]() { }
+>s + s : string
+>s : string
+>s : string
+
+ [s + n]() { }
+>s + n : string
+>s : string
+>n : number
+
+ [+s]() { }
+>+s : number
+>s : string
+
+ static [""]() { }
+ [0]() { }
+ [a]() { }
+>a : any
+
+ static [true]() { }
+>true : any
+
+ [`hello bye`]() { }
+ static [`hello ${a} bye`]() { }
+>a : any
+}
diff --git a/tests/baselines/reference/computedPropertyNames14.errors.txt b/tests/baselines/reference/computedPropertyNames14.errors.txt
new file mode 100644
index 00000000000..1cf5b1445f2
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames14.errors.txt
@@ -0,0 +1,30 @@
+tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(6,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(8,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+
+
+==== tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts (6 errors) ====
+ var b: boolean;
+ class C {
+ [b]() {}
+ ~~~
+!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+ static [true]() { }
+ ~~~~~~
+!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+ [[]]() { }
+ ~~~~
+!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+ static [{}]() { }
+ ~~~~
+!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+ [undefined]() { }
+ ~~~~~~~~~~~
+!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+ static [null]() { }
+ ~~~~~~
+!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+ }
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNames14.js b/tests/baselines/reference/computedPropertyNames14.js
new file mode 100644
index 00000000000..aa551795da6
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames14.js
@@ -0,0 +1,30 @@
+//// [computedPropertyNames14.ts]
+var b: boolean;
+class C {
+ [b]() {}
+ static [true]() { }
+ [[]]() { }
+ static [{}]() { }
+ [undefined]() { }
+ static [null]() { }
+}
+
+//// [computedPropertyNames14.js]
+var b;
+var C = (function () {
+ function C() {
+ }
+ C.prototype[b] = function () {
+ };
+ C[true] = function () {
+ };
+ C.prototype[[]] = function () {
+ };
+ C[{}] = function () {
+ };
+ C.prototype[undefined] = function () {
+ };
+ C[null] = function () {
+ };
+ return C;
+})();
diff --git a/tests/baselines/reference/computedPropertyNames15.errors.txt b/tests/baselines/reference/computedPropertyNames15.errors.txt
new file mode 100644
index 00000000000..0e759668a95
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames15.errors.txt
@@ -0,0 +1,17 @@
+tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+
+
+==== tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts (2 errors) ====
+ var p1: number | string;
+ var p2: number | number[];
+ var p3: string | boolean;
+ class C {
+ [p1]() { }
+ [p2]() { }
+ ~~~~
+!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+ [p3]() { }
+ ~~~~
+!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+ }
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNames15.js b/tests/baselines/reference/computedPropertyNames15.js
new file mode 100644
index 00000000000..1b506bbeb90
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames15.js
@@ -0,0 +1,25 @@
+//// [computedPropertyNames15.ts]
+var p1: number | string;
+var p2: number | number[];
+var p3: string | boolean;
+class C {
+ [p1]() { }
+ [p2]() { }
+ [p3]() { }
+}
+
+//// [computedPropertyNames15.js]
+var p1;
+var p2;
+var p3;
+var C = (function () {
+ function C() {
+ }
+ C.prototype[p1] = function () {
+ };
+ C.prototype[p2] = function () {
+ };
+ C.prototype[p3] = function () {
+ };
+ return C;
+})();
diff --git a/tests/baselines/reference/computedPropertyNames16.js b/tests/baselines/reference/computedPropertyNames16.js
new file mode 100644
index 00000000000..295deb9ee82
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames16.js
@@ -0,0 +1,99 @@
+//// [computedPropertyNames16.ts]
+var s: string;
+var n: number;
+var a: any;
+class C {
+ get [s]() { return 0;}
+ set [n](v) { }
+ static get [s + s]() { return 0; }
+ set [s + n](v) { }
+ get [+s]() { return 0; }
+ static set [""](v) { }
+ get [0]() { return 0; }
+ set [a](v) { }
+ static get [true]() { return 0; }
+ set [`hello bye`](v) { }
+ get [`hello ${a} bye`]() { return 0; }
+}
+
+//// [computedPropertyNames16.js]
+var s;
+var n;
+var a;
+var C = (function () {
+ function C() {
+ }
+ Object.defineProperty(C.prototype, s, {
+ get: function () {
+ return 0;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ Object.defineProperty(C.prototype, n, {
+ set: function (v) {
+ },
+ enumerable: true,
+ configurable: true
+ });
+ Object.defineProperty(C, s + s, {
+ get: function () {
+ return 0;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ Object.defineProperty(C.prototype, s + n, {
+ set: function (v) {
+ },
+ enumerable: true,
+ configurable: true
+ });
+ Object.defineProperty(C.prototype, +s, {
+ get: function () {
+ return 0;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ Object.defineProperty(C, "", {
+ set: function (v) {
+ },
+ enumerable: true,
+ configurable: true
+ });
+ Object.defineProperty(C.prototype, 0, {
+ get: function () {
+ return 0;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ Object.defineProperty(C.prototype, a, {
+ set: function (v) {
+ },
+ enumerable: true,
+ configurable: true
+ });
+ Object.defineProperty(C, true, {
+ get: function () {
+ return 0;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ Object.defineProperty(C.prototype, `hello bye`, {
+ set: function (v) {
+ },
+ enumerable: true,
+ configurable: true
+ });
+ Object.defineProperty(C.prototype, `hello ${a} bye`, {
+ get: function () {
+ return 0;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ return C;
+})();
diff --git a/tests/baselines/reference/computedPropertyNames16.types b/tests/baselines/reference/computedPropertyNames16.types
new file mode 100644
index 00000000000..ccfa7996066
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames16.types
@@ -0,0 +1,52 @@
+=== tests/cases/conformance/es6/computedProperties/computedPropertyNames16.ts ===
+var s: string;
+>s : string
+
+var n: number;
+>n : number
+
+var a: any;
+>a : any
+
+class C {
+>C : C
+
+ get [s]() { return 0;}
+>s : string
+
+ set [n](v) { }
+>n : number
+>v : any
+
+ static get [s + s]() { return 0; }
+>s + s : string
+>s : string
+>s : string
+
+ set [s + n](v) { }
+>s + n : string
+>s : string
+>n : number
+>v : any
+
+ get [+s]() { return 0; }
+>+s : number
+>s : string
+
+ static set [""](v) { }
+>v : any
+
+ get [0]() { return 0; }
+ set [a](v) { }
+>a : any
+>v : any
+
+ static get [true]() { return 0; }
+>true : any
+
+ set [`hello bye`](v) { }
+>v : any
+
+ get [`hello ${a} bye`]() { return 0; }
+>a : any
+}
diff --git a/tests/baselines/reference/computedPropertyNames17.errors.txt b/tests/baselines/reference/computedPropertyNames17.errors.txt
new file mode 100644
index 00000000000..b236ae3245e
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames17.errors.txt
@@ -0,0 +1,30 @@
+tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(3,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(4,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(8,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+
+
+==== tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts (6 errors) ====
+ var b: boolean;
+ class C {
+ get [b]() { return 0;}
+ ~~~
+!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+ static set [true](v) { }
+ ~~~~~~
+!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+ get [[]]() { return 0; }
+ ~~~~
+!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+ set [{}](v) { }
+ ~~~~
+!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+ static get [undefined]() { return 0; }
+ ~~~~~~~~~~~
+!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+ set [null](v) { }
+ ~~~~~~
+!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+ }
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNames17.js b/tests/baselines/reference/computedPropertyNames17.js
new file mode 100644
index 00000000000..5a55dbf7e1b
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames17.js
@@ -0,0 +1,57 @@
+//// [computedPropertyNames17.ts]
+var b: boolean;
+class C {
+ get [b]() { return 0;}
+ static set [true](v) { }
+ get [[]]() { return 0; }
+ set [{}](v) { }
+ static get [undefined]() { return 0; }
+ set [null](v) { }
+}
+
+//// [computedPropertyNames17.js]
+var b;
+var C = (function () {
+ function C() {
+ }
+ Object.defineProperty(C.prototype, b, {
+ get: function () {
+ return 0;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ Object.defineProperty(C, true, {
+ set: function (v) {
+ },
+ enumerable: true,
+ configurable: true
+ });
+ Object.defineProperty(C.prototype, [], {
+ get: function () {
+ return 0;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ Object.defineProperty(C.prototype, {}, {
+ set: function (v) {
+ },
+ enumerable: true,
+ configurable: true
+ });
+ Object.defineProperty(C, undefined, {
+ get: function () {
+ return 0;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ Object.defineProperty(C.prototype, null, {
+ set: function (v) {
+ },
+ enumerable: true,
+ configurable: true
+ });
+ return C;
+})();
diff --git a/tests/baselines/reference/computedPropertyNames18.js b/tests/baselines/reference/computedPropertyNames18.js
new file mode 100644
index 00000000000..af2d68b3095
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames18.js
@@ -0,0 +1,13 @@
+//// [computedPropertyNames18.ts]
+function foo() {
+ var obj = {
+ [this.bar]: 0
+ }
+}
+
+//// [computedPropertyNames18.js]
+function foo() {
+ var obj = {
+ [this.bar]: 0
+ };
+}
diff --git a/tests/baselines/reference/computedPropertyNames18.types b/tests/baselines/reference/computedPropertyNames18.types
new file mode 100644
index 00000000000..0976e5fc3ca
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames18.types
@@ -0,0 +1,14 @@
+=== tests/cases/conformance/es6/computedProperties/computedPropertyNames18.ts ===
+function foo() {
+>foo : () => void
+
+ var obj = {
+>obj : {}
+>{ [this.bar]: 0 } : {}
+
+ [this.bar]: 0
+>this.bar : any
+>this : any
+>bar : any
+ }
+}
diff --git a/tests/baselines/reference/computedPropertyNames19.errors.txt b/tests/baselines/reference/computedPropertyNames19.errors.txt
new file mode 100644
index 00000000000..2037008992f
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames19.errors.txt
@@ -0,0 +1,11 @@
+tests/cases/conformance/es6/computedProperties/computedPropertyNames19.ts(3,10): error TS2331: 'this' cannot be referenced in a module body.
+
+
+==== tests/cases/conformance/es6/computedProperties/computedPropertyNames19.ts (1 errors) ====
+ module M {
+ var obj = {
+ [this.bar]: 0
+ ~~~~
+!!! error TS2331: 'this' cannot be referenced in a module body.
+ }
+ }
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNames19.js b/tests/baselines/reference/computedPropertyNames19.js
new file mode 100644
index 00000000000..3fd2f99eea6
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames19.js
@@ -0,0 +1,14 @@
+//// [computedPropertyNames19.ts]
+module M {
+ var obj = {
+ [this.bar]: 0
+ }
+}
+
+//// [computedPropertyNames19.js]
+var M;
+(function (M) {
+ var obj = {
+ [this.bar]: 0
+ };
+})(M || (M = {}));
diff --git a/tests/baselines/reference/computedPropertyNames2.errors.txt b/tests/baselines/reference/computedPropertyNames2.errors.txt
index 3dd4ac01d5f..d0fd1de4576 100644
--- a/tests/baselines/reference/computedPropertyNames2.errors.txt
+++ b/tests/baselines/reference/computedPropertyNames2.errors.txt
@@ -1,37 +1,19 @@
-tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(4,5): error TS9002: Computed property names are not currently supported.
-tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(5,12): error TS9002: Computed property names are not currently supported.
tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(6,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
-tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(6,9): error TS9002: Computed property names are not currently supported.
-tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(7,9): error TS9002: Computed property names are not currently supported.
tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(8,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
-tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(8,16): error TS9002: Computed property names are not currently supported.
-tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(9,16): error TS9002: Computed property names are not currently supported.
-==== tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts (8 errors) ====
+==== tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts (2 errors) ====
var methodName = "method";
var accessorName = "accessor";
class C {
[methodName]() { }
- ~~~~~~~~~~~~
-!!! error TS9002: Computed property names are not currently supported.
static [methodName]() { }
- ~~~~~~~~~~~~
-!!! error TS9002: Computed property names are not currently supported.
get [accessorName]() { }
~~~~~~~~~~~~~~
!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
- ~~~~~~~~~~~~~~
-!!! error TS9002: Computed property names are not currently supported.
set [accessorName](v) { }
- ~~~~~~~~~~~~~~
-!!! error TS9002: Computed property names are not currently supported.
static get [accessorName]() { }
~~~~~~~~~~~~~~
!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
- ~~~~~~~~~~~~~~
-!!! error TS9002: Computed property names are not currently supported.
static set [accessorName](v) { }
- ~~~~~~~~~~~~~~
-!!! error TS9002: Computed property names are not currently supported.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNames2.js b/tests/baselines/reference/computedPropertyNames2.js
new file mode 100644
index 00000000000..78d53ef94fc
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames2.js
@@ -0,0 +1,48 @@
+//// [computedPropertyNames2.ts]
+var methodName = "method";
+var accessorName = "accessor";
+class C {
+ [methodName]() { }
+ static [methodName]() { }
+ get [accessorName]() { }
+ set [accessorName](v) { }
+ static get [accessorName]() { }
+ static set [accessorName](v) { }
+}
+
+//// [computedPropertyNames2.js]
+var methodName = "method";
+var accessorName = "accessor";
+var C = (function () {
+ function C() {
+ }
+ C.prototype[methodName] = function () {
+ };
+ C[methodName] = function () {
+ };
+ Object.defineProperty(C.prototype, accessorName, {
+ get: function () {
+ },
+ enumerable: true,
+ configurable: true
+ });
+ Object.defineProperty(C.prototype, accessorName, {
+ set: function (v) {
+ },
+ enumerable: true,
+ configurable: true
+ });
+ Object.defineProperty(C, accessorName, {
+ get: function () {
+ },
+ enumerable: true,
+ configurable: true
+ });
+ Object.defineProperty(C, accessorName, {
+ set: function (v) {
+ },
+ enumerable: true,
+ configurable: true
+ });
+ return C;
+})();
diff --git a/tests/baselines/reference/computedPropertyNames20.js b/tests/baselines/reference/computedPropertyNames20.js
new file mode 100644
index 00000000000..2a1edf06142
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames20.js
@@ -0,0 +1,9 @@
+//// [computedPropertyNames20.ts]
+var obj = {
+ [this.bar]: 0
+}
+
+//// [computedPropertyNames20.js]
+var obj = {
+ [this.bar]: 0
+};
diff --git a/tests/baselines/reference/computedPropertyNames20.types b/tests/baselines/reference/computedPropertyNames20.types
new file mode 100644
index 00000000000..abd1b203e87
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames20.types
@@ -0,0 +1,10 @@
+=== tests/cases/conformance/es6/computedProperties/computedPropertyNames20.ts ===
+var obj = {
+>obj : {}
+>{ [this.bar]: 0} : {}
+
+ [this.bar]: 0
+>this.bar : any
+>this : any
+>bar : any
+}
diff --git a/tests/baselines/reference/computedPropertyNames21.errors.txt b/tests/baselines/reference/computedPropertyNames21.errors.txt
new file mode 100644
index 00000000000..a44c8d60ee8
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames21.errors.txt
@@ -0,0 +1,12 @@
+tests/cases/conformance/es6/computedProperties/computedPropertyNames21.ts(5,6): error TS2465: 'this' cannot be referenced in a computed property name.
+
+
+==== tests/cases/conformance/es6/computedProperties/computedPropertyNames21.ts (1 errors) ====
+ class C {
+ bar() {
+ return 0;
+ }
+ [this.bar()]() { }
+ ~~~~
+!!! error TS2465: 'this' cannot be referenced in a computed property name.
+ }
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNames21.js b/tests/baselines/reference/computedPropertyNames21.js
new file mode 100644
index 00000000000..250d9142aa5
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames21.js
@@ -0,0 +1,19 @@
+//// [computedPropertyNames21.ts]
+class C {
+ bar() {
+ return 0;
+ }
+ [this.bar()]() { }
+}
+
+//// [computedPropertyNames21.js]
+var C = (function () {
+ function C() {
+ }
+ C.prototype.bar = function () {
+ return 0;
+ };
+ C.prototype[this.bar()] = function () {
+ };
+ return C;
+})();
diff --git a/tests/baselines/reference/computedPropertyNames22.js b/tests/baselines/reference/computedPropertyNames22.js
new file mode 100644
index 00000000000..b42946536d0
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames22.js
@@ -0,0 +1,23 @@
+//// [computedPropertyNames22.ts]
+class C {
+ bar() {
+ var obj = {
+ [this.bar()]() { }
+ };
+ return 0;
+ }
+}
+
+//// [computedPropertyNames22.js]
+var C = (function () {
+ function C() {
+ }
+ C.prototype.bar = function () {
+ var obj = {
+ [this.bar()]() {
+ }
+ };
+ return 0;
+ };
+ return C;
+})();
diff --git a/tests/baselines/reference/computedPropertyNames22.types b/tests/baselines/reference/computedPropertyNames22.types
new file mode 100644
index 00000000000..d23546192c0
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames22.types
@@ -0,0 +1,21 @@
+=== tests/cases/conformance/es6/computedProperties/computedPropertyNames22.ts ===
+class C {
+>C : C
+
+ bar() {
+>bar : () => number
+
+ var obj = {
+>obj : {}
+>{ [this.bar()]() { } } : {}
+
+ [this.bar()]() { }
+>this.bar() : number
+>this.bar : () => number
+>this : C
+>bar : () => number
+
+ };
+ return 0;
+ }
+}
diff --git a/tests/baselines/reference/computedPropertyNames23.errors.txt b/tests/baselines/reference/computedPropertyNames23.errors.txt
new file mode 100644
index 00000000000..0846ba4d6c6
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames23.errors.txt
@@ -0,0 +1,14 @@
+tests/cases/conformance/es6/computedProperties/computedPropertyNames23.ts(6,12): error TS2465: 'this' cannot be referenced in a computed property name.
+
+
+==== tests/cases/conformance/es6/computedProperties/computedPropertyNames23.ts (1 errors) ====
+ class C {
+ bar() {
+ return 0;
+ }
+ [
+ { [this.bar()]: 1 }[0]
+ ~~~~
+!!! error TS2465: 'this' cannot be referenced in a computed property name.
+ ]() { }
+ }
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNames23.js b/tests/baselines/reference/computedPropertyNames23.js
new file mode 100644
index 00000000000..9d71ef34c1e
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames23.js
@@ -0,0 +1,21 @@
+//// [computedPropertyNames23.ts]
+class C {
+ bar() {
+ return 0;
+ }
+ [
+ { [this.bar()]: 1 }[0]
+ ]() { }
+}
+
+//// [computedPropertyNames23.js]
+var C = (function () {
+ function C() {
+ }
+ C.prototype.bar = function () {
+ return 0;
+ };
+ C.prototype[{ [this.bar()]: 1 }[0]] = function () {
+ };
+ return C;
+})();
diff --git a/tests/baselines/reference/computedPropertyNames24.errors.txt b/tests/baselines/reference/computedPropertyNames24.errors.txt
new file mode 100644
index 00000000000..938fb64b82e
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames24.errors.txt
@@ -0,0 +1,16 @@
+tests/cases/conformance/es6/computedProperties/computedPropertyNames24.ts(9,6): error TS2466: 'super' cannot be referenced in a computed property name.
+
+
+==== tests/cases/conformance/es6/computedProperties/computedPropertyNames24.ts (1 errors) ====
+ class Base {
+ bar() {
+ return 0;
+ }
+ }
+ class C extends Base {
+ // Gets emitted as super, not _super, which is consistent with
+ // use of super in static properties initializers.
+ [super.bar()]() { }
+ ~~~~~
+!!! error TS2466: 'super' cannot be referenced in a computed property name.
+ }
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNames24.js b/tests/baselines/reference/computedPropertyNames24.js
new file mode 100644
index 00000000000..2ef2826ee22
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames24.js
@@ -0,0 +1,38 @@
+//// [computedPropertyNames24.ts]
+class Base {
+ bar() {
+ return 0;
+ }
+}
+class C extends Base {
+ // Gets emitted as super, not _super, which is consistent with
+ // use of super in static properties initializers.
+ [super.bar()]() { }
+}
+
+//// [computedPropertyNames24.js]
+var __extends = this.__extends || function (d, b) {
+ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
+ function __() { this.constructor = d; }
+ __.prototype = b.prototype;
+ d.prototype = new __();
+};
+var Base = (function () {
+ function Base() {
+ }
+ Base.prototype.bar = function () {
+ return 0;
+ };
+ return Base;
+})();
+var C = (function (_super) {
+ __extends(C, _super);
+ function C() {
+ _super.apply(this, arguments);
+ }
+ // Gets emitted as super, not _super, which is consistent with
+ // use of super in static properties initializers.
+ C.prototype[super.bar.call(this)] = function () {
+ };
+ return C;
+})(Base);
diff --git a/tests/baselines/reference/computedPropertyNames25.js b/tests/baselines/reference/computedPropertyNames25.js
new file mode 100644
index 00000000000..a15fcb217e7
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames25.js
@@ -0,0 +1,44 @@
+//// [computedPropertyNames25.ts]
+class Base {
+ bar() {
+ return 0;
+ }
+}
+class C extends Base {
+ foo() {
+ var obj = {
+ [super.bar()]() { }
+ };
+ return 0;
+ }
+}
+
+//// [computedPropertyNames25.js]
+var __extends = this.__extends || function (d, b) {
+ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
+ function __() { this.constructor = d; }
+ __.prototype = b.prototype;
+ d.prototype = new __();
+};
+var Base = (function () {
+ function Base() {
+ }
+ Base.prototype.bar = function () {
+ return 0;
+ };
+ return Base;
+})();
+var C = (function (_super) {
+ __extends(C, _super);
+ function C() {
+ _super.apply(this, arguments);
+ }
+ C.prototype.foo = function () {
+ var obj = {
+ [_super.prototype.bar.call(this)]() {
+ }
+ };
+ return 0;
+ };
+ return C;
+})(Base);
diff --git a/tests/baselines/reference/computedPropertyNames25.types b/tests/baselines/reference/computedPropertyNames25.types
new file mode 100644
index 00000000000..d8567dc86ad
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames25.types
@@ -0,0 +1,31 @@
+=== tests/cases/conformance/es6/computedProperties/computedPropertyNames25.ts ===
+class Base {
+>Base : Base
+
+ bar() {
+>bar : () => number
+
+ return 0;
+ }
+}
+class C extends Base {
+>C : C
+>Base : Base
+
+ foo() {
+>foo : () => number
+
+ var obj = {
+>obj : {}
+>{ [super.bar()]() { } } : {}
+
+ [super.bar()]() { }
+>super.bar() : number
+>super.bar : () => number
+>super : Base
+>bar : () => number
+
+ };
+ return 0;
+ }
+}
diff --git a/tests/baselines/reference/computedPropertyNames26.errors.txt b/tests/baselines/reference/computedPropertyNames26.errors.txt
new file mode 100644
index 00000000000..bbe51c6a0c8
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames26.errors.txt
@@ -0,0 +1,18 @@
+tests/cases/conformance/es6/computedProperties/computedPropertyNames26.ts(10,12): error TS2466: 'super' cannot be referenced in a computed property name.
+
+
+==== tests/cases/conformance/es6/computedProperties/computedPropertyNames26.ts (1 errors) ====
+ class Base {
+ bar() {
+ return 0;
+ }
+ }
+ class C extends Base {
+ // Gets emitted as super, not _super, which is consistent with
+ // use of super in static properties initializers.
+ [
+ { [super.bar()]: 1 }[0]
+ ~~~~~
+!!! error TS2466: 'super' cannot be referenced in a computed property name.
+ ]() { }
+ }
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNames26.js b/tests/baselines/reference/computedPropertyNames26.js
new file mode 100644
index 00000000000..96760fc279c
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames26.js
@@ -0,0 +1,40 @@
+//// [computedPropertyNames26.ts]
+class Base {
+ bar() {
+ return 0;
+ }
+}
+class C extends Base {
+ // Gets emitted as super, not _super, which is consistent with
+ // use of super in static properties initializers.
+ [
+ { [super.bar()]: 1 }[0]
+ ]() { }
+}
+
+//// [computedPropertyNames26.js]
+var __extends = this.__extends || function (d, b) {
+ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
+ function __() { this.constructor = d; }
+ __.prototype = b.prototype;
+ d.prototype = new __();
+};
+var Base = (function () {
+ function Base() {
+ }
+ Base.prototype.bar = function () {
+ return 0;
+ };
+ return Base;
+})();
+var C = (function (_super) {
+ __extends(C, _super);
+ function C() {
+ _super.apply(this, arguments);
+ }
+ // Gets emitted as super, not _super, which is consistent with
+ // use of super in static properties initializers.
+ C.prototype[{ [super.bar.call(this)]: 1 }[0]] = function () {
+ };
+ return C;
+})(Base);
diff --git a/tests/baselines/reference/computedPropertyNames27.errors.txt b/tests/baselines/reference/computedPropertyNames27.errors.txt
new file mode 100644
index 00000000000..c2872197363
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames27.errors.txt
@@ -0,0 +1,11 @@
+tests/cases/conformance/es6/computedProperties/computedPropertyNames27.ts(4,7): error TS2466: 'super' cannot be referenced in a computed property name.
+
+
+==== tests/cases/conformance/es6/computedProperties/computedPropertyNames27.ts (1 errors) ====
+ class Base {
+ }
+ class C extends Base {
+ [(super(), "prop")]() { }
+ ~~~~~
+!!! error TS2466: 'super' cannot be referenced in a computed property name.
+ }
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNames27.js b/tests/baselines/reference/computedPropertyNames27.js
new file mode 100644
index 00000000000..71db977e9b6
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames27.js
@@ -0,0 +1,28 @@
+//// [computedPropertyNames27.ts]
+class Base {
+}
+class C extends Base {
+ [(super(), "prop")]() { }
+}
+
+//// [computedPropertyNames27.js]
+var __extends = this.__extends || function (d, b) {
+ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
+ function __() { this.constructor = d; }
+ __.prototype = b.prototype;
+ d.prototype = new __();
+};
+var Base = (function () {
+ function Base() {
+ }
+ return Base;
+})();
+var C = (function (_super) {
+ __extends(C, _super);
+ function C() {
+ _super.apply(this, arguments);
+ }
+ C.prototype[(_super.call(this), "prop")] = function () {
+ };
+ return C;
+})(Base);
diff --git a/tests/baselines/reference/computedPropertyNames28.js b/tests/baselines/reference/computedPropertyNames28.js
new file mode 100644
index 00000000000..96c7cd082f1
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames28.js
@@ -0,0 +1,35 @@
+//// [computedPropertyNames28.ts]
+class Base {
+}
+class C extends Base {
+ constructor() {
+ super();
+ var obj = {
+ [(super(), "prop")]() { }
+ };
+ }
+}
+
+//// [computedPropertyNames28.js]
+var __extends = this.__extends || function (d, b) {
+ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
+ function __() { this.constructor = d; }
+ __.prototype = b.prototype;
+ d.prototype = new __();
+};
+var Base = (function () {
+ function Base() {
+ }
+ return Base;
+})();
+var C = (function (_super) {
+ __extends(C, _super);
+ function C() {
+ _super.call(this);
+ var obj = {
+ [(_super.call(this), "prop")]() {
+ }
+ };
+ }
+ return C;
+})(Base);
diff --git a/tests/baselines/reference/computedPropertyNames28.types b/tests/baselines/reference/computedPropertyNames28.types
new file mode 100644
index 00000000000..2adf52f8c5f
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames28.types
@@ -0,0 +1,26 @@
+=== tests/cases/conformance/es6/computedProperties/computedPropertyNames28.ts ===
+class Base {
+>Base : Base
+}
+class C extends Base {
+>C : C
+>Base : Base
+
+ constructor() {
+ super();
+>super() : void
+>super : typeof Base
+
+ var obj = {
+>obj : {}
+>{ [(super(), "prop")]() { } } : {}
+
+ [(super(), "prop")]() { }
+>(super(), "prop") : string
+>super(), "prop" : string
+>super() : void
+>super : typeof Base
+
+ };
+ }
+}
diff --git a/tests/baselines/reference/computedPropertyNames29.js b/tests/baselines/reference/computedPropertyNames29.js
new file mode 100644
index 00000000000..dc45746c63c
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames29.js
@@ -0,0 +1,28 @@
+//// [computedPropertyNames29.ts]
+class C {
+ bar() {
+ () => {
+ var obj = {
+ [this.bar()]() { } // needs capture
+ };
+ }
+ return 0;
+ }
+}
+
+//// [computedPropertyNames29.js]
+var C = (function () {
+ function C() {
+ }
+ C.prototype.bar = function () {
+ var _this = this;
+ (function () {
+ var obj = {
+ [_this.bar()]() {
+ } // needs capture
+ };
+ });
+ return 0;
+ };
+ return C;
+})();
diff --git a/tests/baselines/reference/computedPropertyNames29.types b/tests/baselines/reference/computedPropertyNames29.types
new file mode 100644
index 00000000000..ed4db5862e9
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames29.types
@@ -0,0 +1,25 @@
+=== tests/cases/conformance/es6/computedProperties/computedPropertyNames29.ts ===
+class C {
+>C : C
+
+ bar() {
+>bar : () => number
+
+ () => {
+>() => { var obj = { [this.bar()]() { } // needs capture }; } : () => void
+
+ var obj = {
+>obj : {}
+>{ [this.bar()]() { } // needs capture } : {}
+
+ [this.bar()]() { } // needs capture
+>this.bar() : number
+>this.bar : () => number
+>this : C
+>bar : () => number
+
+ };
+ }
+ return 0;
+ }
+}
diff --git a/tests/baselines/reference/computedPropertyNames3.errors.txt b/tests/baselines/reference/computedPropertyNames3.errors.txt
index 084a1f8889f..080bff1ab9a 100644
--- a/tests/baselines/reference/computedPropertyNames3.errors.txt
+++ b/tests/baselines/reference/computedPropertyNames3.errors.txt
@@ -1,36 +1,30 @@
-tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(3,5): error TS9002: Computed property names are not currently supported.
-tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(4,12): error TS9002: Computed property names are not currently supported.
+tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
-tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS9002: Computed property names are not currently supported.
-tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(6,9): error TS9002: Computed property names are not currently supported.
+tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
-tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS9002: Computed property names are not currently supported.
-tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(8,16): error TS9002: Computed property names are not currently supported.
+tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
-==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts (8 errors) ====
+==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts (6 errors) ====
var id;
class C {
[0 + 1]() { }
- ~~~~~~~
-!!! error TS9002: Computed property names are not currently supported.
static [() => { }]() { }
~~~~~~~~~~~
-!!! error TS9002: Computed property names are not currently supported.
+!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
get [delete id]() { }
~~~~~~~~~~~
!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
~~~~~~~~~~~
-!!! error TS9002: Computed property names are not currently supported.
+!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
set [[0, 1]](v) { }
~~~~~~~~
-!!! error TS9002: Computed property names are not currently supported.
+!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
static get [""]() { }
~~~~~~~~~~~~
!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
~~~~~~~~~~~~
-!!! error TS9002: Computed property names are not currently supported.
+!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
static set [id.toString()](v) { }
- ~~~~~~~~~~~~~~~
-!!! error TS9002: Computed property names are not currently supported.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNames3.js b/tests/baselines/reference/computedPropertyNames3.js
new file mode 100644
index 00000000000..fbd76bf48fc
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames3.js
@@ -0,0 +1,47 @@
+//// [computedPropertyNames3.ts]
+var id;
+class C {
+ [0 + 1]() { }
+ static [() => { }]() { }
+ get [delete id]() { }
+ set [[0, 1]](v) { }
+ static get [""]() { }
+ static set [id.toString()](v) { }
+}
+
+//// [computedPropertyNames3.js]
+var id;
+var C = (function () {
+ function C() {
+ }
+ C.prototype[0 + 1] = function () {
+ };
+ C[function () {
+ }] = function () {
+ };
+ Object.defineProperty(C.prototype, delete id, {
+ get: function () {
+ },
+ enumerable: true,
+ configurable: true
+ });
+ Object.defineProperty(C.prototype, [0, 1], {
+ set: function (v) {
+ },
+ enumerable: true,
+ configurable: true
+ });
+ Object.defineProperty(C, "", {
+ get: function () {
+ },
+ enumerable: true,
+ configurable: true
+ });
+ Object.defineProperty(C, id.toString(), {
+ set: function (v) {
+ },
+ enumerable: true,
+ configurable: true
+ });
+ return C;
+})();
diff --git a/tests/baselines/reference/computedPropertyNames30.errors.txt b/tests/baselines/reference/computedPropertyNames30.errors.txt
new file mode 100644
index 00000000000..f7b6411f867
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames30.errors.txt
@@ -0,0 +1,21 @@
+tests/cases/conformance/es6/computedProperties/computedPropertyNames30.ts(11,19): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
+
+
+==== tests/cases/conformance/es6/computedProperties/computedPropertyNames30.ts (1 errors) ====
+ class Base {
+ }
+ class C extends Base {
+ constructor() {
+ super();
+ () => {
+ var obj = {
+ // Ideally, we would capture this. But the reference is
+ // illegal, and not capturing this is consistent with
+ //treatment of other similar violations.
+ [(super(), "prop")]() { }
+ ~~~~~
+!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors
+ };
+ }
+ }
+ }
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNames30.js b/tests/baselines/reference/computedPropertyNames30.js
new file mode 100644
index 00000000000..c10ba51316d
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames30.js
@@ -0,0 +1,45 @@
+//// [computedPropertyNames30.ts]
+class Base {
+}
+class C extends Base {
+ constructor() {
+ super();
+ () => {
+ var obj = {
+ // Ideally, we would capture this. But the reference is
+ // illegal, and not capturing this is consistent with
+ //treatment of other similar violations.
+ [(super(), "prop")]() { }
+ };
+ }
+ }
+}
+
+//// [computedPropertyNames30.js]
+var __extends = this.__extends || function (d, b) {
+ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
+ function __() { this.constructor = d; }
+ __.prototype = b.prototype;
+ d.prototype = new __();
+};
+var Base = (function () {
+ function Base() {
+ }
+ return Base;
+})();
+var C = (function (_super) {
+ __extends(C, _super);
+ function C() {
+ _super.call(this);
+ (function () {
+ var obj = {
+ // Ideally, we would capture this. But the reference is
+ // illegal, and not capturing this is consistent with
+ //treatment of other similar violations.
+ [(_super.call(this), "prop")]() {
+ }
+ };
+ });
+ }
+ return C;
+})(Base);
diff --git a/tests/baselines/reference/computedPropertyNames31.js b/tests/baselines/reference/computedPropertyNames31.js
new file mode 100644
index 00000000000..bf75ac2be74
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames31.js
@@ -0,0 +1,49 @@
+//// [computedPropertyNames31.ts]
+class Base {
+ bar() {
+ return 0;
+ }
+}
+class C extends Base {
+ foo() {
+ () => {
+ var obj = {
+ [super.bar()]() { } // needs capture
+ };
+ }
+ return 0;
+ }
+}
+
+//// [computedPropertyNames31.js]
+var __extends = this.__extends || function (d, b) {
+ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
+ function __() { this.constructor = d; }
+ __.prototype = b.prototype;
+ d.prototype = new __();
+};
+var Base = (function () {
+ function Base() {
+ }
+ Base.prototype.bar = function () {
+ return 0;
+ };
+ return Base;
+})();
+var C = (function (_super) {
+ __extends(C, _super);
+ function C() {
+ _super.apply(this, arguments);
+ }
+ C.prototype.foo = function () {
+ var _this = this;
+ (function () {
+ var obj = {
+ [_super.prototype.bar.call(_this)]() {
+ } // needs capture
+ };
+ });
+ return 0;
+ };
+ return C;
+})(Base);
diff --git a/tests/baselines/reference/computedPropertyNames31.types b/tests/baselines/reference/computedPropertyNames31.types
new file mode 100644
index 00000000000..90e73bc3dcb
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames31.types
@@ -0,0 +1,35 @@
+=== tests/cases/conformance/es6/computedProperties/computedPropertyNames31.ts ===
+class Base {
+>Base : Base
+
+ bar() {
+>bar : () => number
+
+ return 0;
+ }
+}
+class C extends Base {
+>C : C
+>Base : Base
+
+ foo() {
+>foo : () => number
+
+ () => {
+>() => { var obj = { [super.bar()]() { } // needs capture }; } : () => void
+
+ var obj = {
+>obj : {}
+>{ [super.bar()]() { } // needs capture } : {}
+
+ [super.bar()]() { } // needs capture
+>super.bar() : number
+>super.bar : () => number
+>super : Base
+>bar : () => number
+
+ };
+ }
+ return 0;
+ }
+}
diff --git a/tests/baselines/reference/computedPropertyNames32.errors.txt b/tests/baselines/reference/computedPropertyNames32.errors.txt
new file mode 100644
index 00000000000..e2f08c79fc9
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames32.errors.txt
@@ -0,0 +1,13 @@
+tests/cases/conformance/es6/computedProperties/computedPropertyNames32.ts(6,10): error TS2466: A computed property name cannot reference a type parameter from its containing type.
+
+
+==== tests/cases/conformance/es6/computedProperties/computedPropertyNames32.ts (1 errors) ====
+ function foo() { return '' }
+ class C {
+ bar() {
+ return 0;
+ }
+ [foo()]() { }
+ ~
+!!! error TS2466: A computed property name cannot reference a type parameter from its containing type.
+ }
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNames32.js b/tests/baselines/reference/computedPropertyNames32.js
new file mode 100644
index 00000000000..d3e98681369
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames32.js
@@ -0,0 +1,23 @@
+//// [computedPropertyNames32.ts]
+function foo() { return '' }
+class C {
+ bar() {
+ return 0;
+ }
+ [foo()]() { }
+}
+
+//// [computedPropertyNames32.js]
+function foo() {
+ return '';
+}
+var C = (function () {
+ function C() {
+ }
+ C.prototype.bar = function () {
+ return 0;
+ };
+ C.prototype[foo()] = function () {
+ };
+ return C;
+})();
diff --git a/tests/baselines/reference/computedPropertyNames33.js b/tests/baselines/reference/computedPropertyNames33.js
new file mode 100644
index 00000000000..554ec315897
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames33.js
@@ -0,0 +1,27 @@
+//// [computedPropertyNames33.ts]
+function foo() { return '' }
+class C {
+ bar() {
+ var obj = {
+ [foo()]() { }
+ };
+ return 0;
+ }
+}
+
+//// [computedPropertyNames33.js]
+function foo() {
+ return '';
+}
+var C = (function () {
+ function C() {
+ }
+ C.prototype.bar = function () {
+ var obj = {
+ [foo()]() {
+ }
+ };
+ return 0;
+ };
+ return C;
+})();
diff --git a/tests/baselines/reference/computedPropertyNames33.types b/tests/baselines/reference/computedPropertyNames33.types
new file mode 100644
index 00000000000..8cbe8e93ef2
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames33.types
@@ -0,0 +1,25 @@
+=== tests/cases/conformance/es6/computedProperties/computedPropertyNames33.ts ===
+function foo() { return '' }
+>foo : () => string
+>T : T
+
+class C {
+>C : C
+>T : T
+
+ bar() {
+>bar : () => number
+
+ var obj = {
+>obj : {}
+>{ [foo()]() { } } : {}
+
+ [foo()]() { }
+>foo() : string
+>foo : () => string
+>T : T
+
+ };
+ return 0;
+ }
+}
diff --git a/tests/baselines/reference/computedPropertyNames34.errors.txt b/tests/baselines/reference/computedPropertyNames34.errors.txt
new file mode 100644
index 00000000000..c6d4a9aa4eb
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames34.errors.txt
@@ -0,0 +1,15 @@
+tests/cases/conformance/es6/computedProperties/computedPropertyNames34.ts(5,18): error TS2302: Static members cannot reference class type parameters.
+
+
+==== tests/cases/conformance/es6/computedProperties/computedPropertyNames34.ts (1 errors) ====
+ function foo() { return '' }
+ class C {
+ static bar() {
+ var obj = {
+ [foo()]() { }
+ ~
+!!! error TS2302: Static members cannot reference class type parameters.
+ };
+ return 0;
+ }
+ }
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNames34.js b/tests/baselines/reference/computedPropertyNames34.js
new file mode 100644
index 00000000000..f1d774139b1
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames34.js
@@ -0,0 +1,27 @@
+//// [computedPropertyNames34.ts]
+function foo() { return '' }
+class C {
+ static bar() {
+ var obj = {
+ [foo()]() { }
+ };
+ return 0;
+ }
+}
+
+//// [computedPropertyNames34.js]
+function foo() {
+ return '';
+}
+var C = (function () {
+ function C() {
+ }
+ C.bar = function () {
+ var obj = {
+ [foo()]() {
+ }
+ };
+ return 0;
+ };
+ return C;
+})();
diff --git a/tests/baselines/reference/computedPropertyNames35.errors.txt b/tests/baselines/reference/computedPropertyNames35.errors.txt
new file mode 100644
index 00000000000..01c4614e84a
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames35.errors.txt
@@ -0,0 +1,14 @@
+tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts(4,5): error TS1169: Computed property names are not allowed in interfaces.
+tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts(4,10): error TS2466: A computed property name cannot reference a type parameter from its containing type.
+
+
+==== tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts (2 errors) ====
+ function foo() { return '' }
+ interface I {
+ bar(): string;
+ [foo()](): void;
+ ~~~~~~~~~~
+!!! error TS1169: Computed property names are not allowed in interfaces.
+ ~
+!!! error TS2466: A computed property name cannot reference a type parameter from its containing type.
+ }
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNames36.errors.txt b/tests/baselines/reference/computedPropertyNames36.errors.txt
new file mode 100644
index 00000000000..a473ebfba8e
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames36.errors.txt
@@ -0,0 +1,16 @@
+tests/cases/conformance/es6/computedProperties/computedPropertyNames36.ts(8,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
+
+
+==== tests/cases/conformance/es6/computedProperties/computedPropertyNames36.ts (1 errors) ====
+ class Foo { x }
+ class Foo2 { x; y }
+
+ class C {
+ [s: string]: Foo2;
+
+ // Computed properties
+ get ["get1"]() { return new Foo }
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
+ set ["set1"](p: Foo2) { }
+ }
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNames36.js b/tests/baselines/reference/computedPropertyNames36.js
new file mode 100644
index 00000000000..7c731014d1e
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames36.js
@@ -0,0 +1,42 @@
+//// [computedPropertyNames36.ts]
+class Foo { x }
+class Foo2 { x; y }
+
+class C {
+ [s: string]: Foo2;
+
+ // Computed properties
+ get ["get1"]() { return new Foo }
+ set ["set1"](p: Foo2) { }
+}
+
+//// [computedPropertyNames36.js]
+var Foo = (function () {
+ function Foo() {
+ }
+ return Foo;
+})();
+var Foo2 = (function () {
+ function Foo2() {
+ }
+ return Foo2;
+})();
+var C = (function () {
+ function C() {
+ }
+ Object.defineProperty(C.prototype, "get1", {
+ // Computed properties
+ get: function () {
+ return new Foo;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ Object.defineProperty(C.prototype, "set1", {
+ set: function (p) {
+ },
+ enumerable: true,
+ configurable: true
+ });
+ return C;
+})();
diff --git a/tests/baselines/reference/computedPropertyNames37.js b/tests/baselines/reference/computedPropertyNames37.js
new file mode 100644
index 00000000000..fb4c32909d5
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames37.js
@@ -0,0 +1,42 @@
+//// [computedPropertyNames37.ts]
+class Foo { x }
+class Foo2 { x; y }
+
+class C {
+ [s: number]: Foo2;
+
+ // Computed properties
+ get ["get1"]() { return new Foo }
+ set ["set1"](p: Foo2) { }
+}
+
+//// [computedPropertyNames37.js]
+var Foo = (function () {
+ function Foo() {
+ }
+ return Foo;
+})();
+var Foo2 = (function () {
+ function Foo2() {
+ }
+ return Foo2;
+})();
+var C = (function () {
+ function C() {
+ }
+ Object.defineProperty(C.prototype, "get1", {
+ // Computed properties
+ get: function () {
+ return new Foo;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ Object.defineProperty(C.prototype, "set1", {
+ set: function (p) {
+ },
+ enumerable: true,
+ configurable: true
+ });
+ return C;
+})();
diff --git a/tests/baselines/reference/computedPropertyNames37.types b/tests/baselines/reference/computedPropertyNames37.types
new file mode 100644
index 00000000000..b50e0590b79
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames37.types
@@ -0,0 +1,26 @@
+=== tests/cases/conformance/es6/computedProperties/computedPropertyNames37.ts ===
+class Foo { x }
+>Foo : Foo
+>x : any
+
+class Foo2 { x; y }
+>Foo2 : Foo2
+>x : any
+>y : any
+
+class C {
+>C : C
+
+ [s: number]: Foo2;
+>s : number
+>Foo2 : Foo2
+
+ // Computed properties
+ get ["get1"]() { return new Foo }
+>new Foo : Foo
+>Foo : typeof Foo
+
+ set ["set1"](p: Foo2) { }
+>p : Foo2
+>Foo2 : Foo2
+}
diff --git a/tests/baselines/reference/computedPropertyNames38.errors.txt b/tests/baselines/reference/computedPropertyNames38.errors.txt
new file mode 100644
index 00000000000..fc5f31f1329
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames38.errors.txt
@@ -0,0 +1,16 @@
+tests/cases/conformance/es6/computedProperties/computedPropertyNames38.ts(8,5): error TS2411: Property '[1 << 6]' of type 'Foo' is not assignable to string index type 'Foo2'.
+
+
+==== tests/cases/conformance/es6/computedProperties/computedPropertyNames38.ts (1 errors) ====
+ class Foo { x }
+ class Foo2 { x; y }
+
+ class C {
+ [s: string]: Foo2;
+
+ // Computed properties
+ get [1 << 6]() { return new Foo }
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS2411: Property '[1 << 6]' of type 'Foo' is not assignable to string index type 'Foo2'.
+ set [1 << 6](p: Foo2) { }
+ }
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNames38.js b/tests/baselines/reference/computedPropertyNames38.js
new file mode 100644
index 00000000000..922244bfecf
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames38.js
@@ -0,0 +1,42 @@
+//// [computedPropertyNames38.ts]
+class Foo { x }
+class Foo2 { x; y }
+
+class C {
+ [s: string]: Foo2;
+
+ // Computed properties
+ get [1 << 6]() { return new Foo }
+ set [1 << 6](p: Foo2) { }
+}
+
+//// [computedPropertyNames38.js]
+var Foo = (function () {
+ function Foo() {
+ }
+ return Foo;
+})();
+var Foo2 = (function () {
+ function Foo2() {
+ }
+ return Foo2;
+})();
+var C = (function () {
+ function C() {
+ }
+ Object.defineProperty(C.prototype, 1 << 6, {
+ // Computed properties
+ get: function () {
+ return new Foo;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ Object.defineProperty(C.prototype, 1 << 6, {
+ set: function (p) {
+ },
+ enumerable: true,
+ configurable: true
+ });
+ return C;
+})();
diff --git a/tests/baselines/reference/computedPropertyNames39.errors.txt b/tests/baselines/reference/computedPropertyNames39.errors.txt
new file mode 100644
index 00000000000..573ef726241
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames39.errors.txt
@@ -0,0 +1,16 @@
+tests/cases/conformance/es6/computedProperties/computedPropertyNames39.ts(8,5): error TS2412: Property '[1 << 6]' of type 'Foo' is not assignable to numeric index type 'Foo2'.
+
+
+==== tests/cases/conformance/es6/computedProperties/computedPropertyNames39.ts (1 errors) ====
+ class Foo { x }
+ class Foo2 { x; y }
+
+ class C {
+ [s: number]: Foo2;
+
+ // Computed properties
+ get [1 << 6]() { return new Foo }
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS2412: Property '[1 << 6]' of type 'Foo' is not assignable to numeric index type 'Foo2'.
+ set [1 << 6](p: Foo2) { }
+ }
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNames39.js b/tests/baselines/reference/computedPropertyNames39.js
new file mode 100644
index 00000000000..62621f4e754
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames39.js
@@ -0,0 +1,42 @@
+//// [computedPropertyNames39.ts]
+class Foo { x }
+class Foo2 { x; y }
+
+class C {
+ [s: number]: Foo2;
+
+ // Computed properties
+ get [1 << 6]() { return new Foo }
+ set [1 << 6](p: Foo2) { }
+}
+
+//// [computedPropertyNames39.js]
+var Foo = (function () {
+ function Foo() {
+ }
+ return Foo;
+})();
+var Foo2 = (function () {
+ function Foo2() {
+ }
+ return Foo2;
+})();
+var C = (function () {
+ function C() {
+ }
+ Object.defineProperty(C.prototype, 1 << 6, {
+ // Computed properties
+ get: function () {
+ return new Foo;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ Object.defineProperty(C.prototype, 1 << 6, {
+ set: function (p) {
+ },
+ enumerable: true,
+ configurable: true
+ });
+ return C;
+})();
diff --git a/tests/baselines/reference/computedPropertyNames4.js b/tests/baselines/reference/computedPropertyNames4.js
new file mode 100644
index 00000000000..5acb6d957da
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames4.js
@@ -0,0 +1,35 @@
+//// [computedPropertyNames4.ts]
+var s: string;
+var n: number;
+var a: any;
+var v = {
+ [s]: 0,
+ [n]: n,
+ [s + s]: 1,
+ [s + n]: 2,
+ [+s]: s,
+ [""]: 0,
+ [0]: 0,
+ [a]: 1,
+ [true]: 0,
+ [`hello bye`]: 0,
+ [`hello ${a} bye`]: 0
+}
+
+//// [computedPropertyNames4.js]
+var s;
+var n;
+var a;
+var v = {
+ [s]: 0,
+ [n]: n,
+ [s + s]: 1,
+ [s + n]: 2,
+ [+s]: s,
+ [""]: 0,
+ [0]: 0,
+ [a]: 1,
+ [true]: 0,
+ [`hello bye`]: 0,
+ [`hello ${a} bye`]: 0
+};
diff --git a/tests/baselines/reference/computedPropertyNames4.types b/tests/baselines/reference/computedPropertyNames4.types
new file mode 100644
index 00000000000..968cc86b598
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames4.types
@@ -0,0 +1,48 @@
+=== tests/cases/conformance/es6/computedProperties/computedPropertyNames4.ts ===
+var s: string;
+>s : string
+
+var n: number;
+>n : number
+
+var a: any;
+>a : any
+
+var v = {
+>v : {}
+>{ [s]: 0, [n]: n, [s + s]: 1, [s + n]: 2, [+s]: s, [""]: 0, [0]: 0, [a]: 1, [true]: 0, [`hello bye`]: 0, [`hello ${a} bye`]: 0} : {}
+
+ [s]: 0,
+>s : string
+
+ [n]: n,
+>n : number
+>n : number
+
+ [s + s]: 1,
+>s + s : string
+>s : string
+>s : string
+
+ [s + n]: 2,
+>s + n : string
+>s : string
+>n : number
+
+ [+s]: s,
+>+s : number
+>s : string
+>s : string
+
+ [""]: 0,
+ [0]: 0,
+ [a]: 1,
+>a : any
+
+ [true]: 0,
+>true : any
+
+ [`hello bye`]: 0,
+ [`hello ${a} bye`]: 0
+>a : any
+}
diff --git a/tests/baselines/reference/computedPropertyNames40.errors.txt b/tests/baselines/reference/computedPropertyNames40.errors.txt
new file mode 100644
index 00000000000..c5bda4ed999
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames40.errors.txt
@@ -0,0 +1,16 @@
+tests/cases/conformance/es6/computedProperties/computedPropertyNames40.ts(8,5): error TS2411: Property '[""]' of type '() => Foo' is not assignable to string index type '() => Foo2'.
+
+
+==== tests/cases/conformance/es6/computedProperties/computedPropertyNames40.ts (1 errors) ====
+ class Foo { x }
+ class Foo2 { x; y }
+
+ class C {
+ [s: string]: () => Foo2;
+
+ // Computed properties
+ [""]() { return new Foo }
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS2411: Property '[""]' of type '() => Foo' is not assignable to string index type '() => Foo2'.
+ [""]() { return new Foo2 }
+ }
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNames40.js b/tests/baselines/reference/computedPropertyNames40.js
new file mode 100644
index 00000000000..1c9b5d3bfa8
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames40.js
@@ -0,0 +1,35 @@
+//// [computedPropertyNames40.ts]
+class Foo { x }
+class Foo2 { x; y }
+
+class C {
+ [s: string]: () => Foo2;
+
+ // Computed properties
+ [""]() { return new Foo }
+ [""]() { return new Foo2 }
+}
+
+//// [computedPropertyNames40.js]
+var Foo = (function () {
+ function Foo() {
+ }
+ return Foo;
+})();
+var Foo2 = (function () {
+ function Foo2() {
+ }
+ return Foo2;
+})();
+var C = (function () {
+ function C() {
+ }
+ // Computed properties
+ C.prototype[""] = function () {
+ return new Foo;
+ };
+ C.prototype[""] = function () {
+ return new Foo2;
+ };
+ return C;
+})();
diff --git a/tests/baselines/reference/computedPropertyNames41.js b/tests/baselines/reference/computedPropertyNames41.js
new file mode 100644
index 00000000000..34fe2d33df7
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames41.js
@@ -0,0 +1,31 @@
+//// [computedPropertyNames41.ts]
+class Foo { x }
+class Foo2 { x; y }
+
+class C {
+ [s: string]: () => Foo2;
+
+ // Computed properties
+ static [""]() { return new Foo }
+}
+
+//// [computedPropertyNames41.js]
+var Foo = (function () {
+ function Foo() {
+ }
+ return Foo;
+})();
+var Foo2 = (function () {
+ function Foo2() {
+ }
+ return Foo2;
+})();
+var C = (function () {
+ function C() {
+ }
+ // Computed properties
+ C[""] = function () {
+ return new Foo;
+ };
+ return C;
+})();
diff --git a/tests/baselines/reference/computedPropertyNames41.types b/tests/baselines/reference/computedPropertyNames41.types
new file mode 100644
index 00000000000..1fb0af282ca
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames41.types
@@ -0,0 +1,22 @@
+=== tests/cases/conformance/es6/computedProperties/computedPropertyNames41.ts ===
+class Foo { x }
+>Foo : Foo
+>x : any
+
+class Foo2 { x; y }
+>Foo2 : Foo2
+>x : any
+>y : any
+
+class C {
+>C : C
+
+ [s: string]: () => Foo2;
+>s : string
+>Foo2 : Foo2
+
+ // Computed properties
+ static [""]() { return new Foo }
+>new Foo : Foo
+>Foo : typeof Foo
+}
diff --git a/tests/baselines/reference/computedPropertyNames42.errors.txt b/tests/baselines/reference/computedPropertyNames42.errors.txt
new file mode 100644
index 00000000000..059b3117a43
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames42.errors.txt
@@ -0,0 +1,18 @@
+tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts(8,5): error TS1166: Computed property names are not allowed in class property declarations.
+tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts(8,5): error TS2411: Property '[""]' of type 'Foo' is not assignable to string index type 'Foo2'.
+
+
+==== tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts (2 errors) ====
+ class Foo { x }
+ class Foo2 { x; y }
+
+ class C {
+ [s: string]: Foo2;
+
+ // Computed properties
+ [""]: Foo;
+ ~~~~
+!!! error TS1166: Computed property names are not allowed in class property declarations.
+ ~~~~~~~~~~
+!!! error TS2411: Property '[""]' of type 'Foo' is not assignable to string index type 'Foo2'.
+ }
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNames43.errors.txt b/tests/baselines/reference/computedPropertyNames43.errors.txt
new file mode 100644
index 00000000000..d38dcca9216
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames43.errors.txt
@@ -0,0 +1,18 @@
+tests/cases/conformance/es6/computedProperties/computedPropertyNames43.ts(10,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
+
+
+==== tests/cases/conformance/es6/computedProperties/computedPropertyNames43.ts (1 errors) ====
+ class Foo { x }
+ class Foo2 { x; y }
+
+ class C {
+ [s: string]: Foo2;
+ }
+
+ class D extends C {
+ // Computed properties
+ get ["get1"]() { return new Foo }
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
+ set ["set1"](p: Foo2) { }
+ }
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNames43.js b/tests/baselines/reference/computedPropertyNames43.js
new file mode 100644
index 00000000000..22ac7774439
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames43.js
@@ -0,0 +1,57 @@
+//// [computedPropertyNames43.ts]
+class Foo { x }
+class Foo2 { x; y }
+
+class C {
+ [s: string]: Foo2;
+}
+
+class D extends C {
+ // Computed properties
+ get ["get1"]() { return new Foo }
+ set ["set1"](p: Foo2) { }
+}
+
+//// [computedPropertyNames43.js]
+var __extends = this.__extends || function (d, b) {
+ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
+ function __() { this.constructor = d; }
+ __.prototype = b.prototype;
+ d.prototype = new __();
+};
+var Foo = (function () {
+ function Foo() {
+ }
+ return Foo;
+})();
+var Foo2 = (function () {
+ function Foo2() {
+ }
+ return Foo2;
+})();
+var C = (function () {
+ function C() {
+ }
+ return C;
+})();
+var D = (function (_super) {
+ __extends(D, _super);
+ function D() {
+ _super.apply(this, arguments);
+ }
+ Object.defineProperty(D.prototype, "get1", {
+ // Computed properties
+ get: function () {
+ return new Foo;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ Object.defineProperty(D.prototype, "set1", {
+ set: function (p) {
+ },
+ enumerable: true,
+ configurable: true
+ });
+ return D;
+})(C);
diff --git a/tests/baselines/reference/computedPropertyNames44.errors.txt b/tests/baselines/reference/computedPropertyNames44.errors.txt
new file mode 100644
index 00000000000..bf1de6687e1
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames44.errors.txt
@@ -0,0 +1,20 @@
+tests/cases/conformance/es6/computedProperties/computedPropertyNames44.ts(6,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
+tests/cases/conformance/es6/computedProperties/computedPropertyNames44.ts(10,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
+
+
+==== tests/cases/conformance/es6/computedProperties/computedPropertyNames44.ts (2 errors) ====
+ class Foo { x }
+ class Foo2 { x; y }
+
+ class C {
+ [s: string]: Foo2;
+ get ["get1"]() { return new Foo }
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
+ }
+
+ class D extends C {
+ set ["set1"](p: Foo) { }
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
+ }
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNames44.js b/tests/baselines/reference/computedPropertyNames44.js
new file mode 100644
index 00000000000..c91a52e8199
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames44.js
@@ -0,0 +1,55 @@
+//// [computedPropertyNames44.ts]
+class Foo { x }
+class Foo2 { x; y }
+
+class C {
+ [s: string]: Foo2;
+ get ["get1"]() { return new Foo }
+}
+
+class D extends C {
+ set ["set1"](p: Foo) { }
+}
+
+//// [computedPropertyNames44.js]
+var __extends = this.__extends || function (d, b) {
+ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
+ function __() { this.constructor = d; }
+ __.prototype = b.prototype;
+ d.prototype = new __();
+};
+var Foo = (function () {
+ function Foo() {
+ }
+ return Foo;
+})();
+var Foo2 = (function () {
+ function Foo2() {
+ }
+ return Foo2;
+})();
+var C = (function () {
+ function C() {
+ }
+ Object.defineProperty(C.prototype, "get1", {
+ get: function () {
+ return new Foo;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ return C;
+})();
+var D = (function (_super) {
+ __extends(D, _super);
+ function D() {
+ _super.apply(this, arguments);
+ }
+ Object.defineProperty(D.prototype, "set1", {
+ set: function (p) {
+ },
+ enumerable: true,
+ configurable: true
+ });
+ return D;
+})(C);
diff --git a/tests/baselines/reference/computedPropertyNames45.errors.txt b/tests/baselines/reference/computedPropertyNames45.errors.txt
new file mode 100644
index 00000000000..7ad29340b25
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames45.errors.txt
@@ -0,0 +1,18 @@
+tests/cases/conformance/es6/computedProperties/computedPropertyNames45.ts(11,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
+
+
+==== tests/cases/conformance/es6/computedProperties/computedPropertyNames45.ts (1 errors) ====
+ class Foo { x }
+ class Foo2 { x; y }
+
+ class C {
+ get ["get1"]() { return new Foo }
+ }
+
+ class D extends C {
+ // No error when the indexer is in a class more derived than the computed property
+ [s: string]: Foo2;
+ set ["set1"](p: Foo) { }
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'.
+ }
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNames45.js b/tests/baselines/reference/computedPropertyNames45.js
new file mode 100644
index 00000000000..7ec3c165e12
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames45.js
@@ -0,0 +1,56 @@
+//// [computedPropertyNames45.ts]
+class Foo { x }
+class Foo2 { x; y }
+
+class C {
+ get ["get1"]() { return new Foo }
+}
+
+class D extends C {
+ // No error when the indexer is in a class more derived than the computed property
+ [s: string]: Foo2;
+ set ["set1"](p: Foo) { }
+}
+
+//// [computedPropertyNames45.js]
+var __extends = this.__extends || function (d, b) {
+ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
+ function __() { this.constructor = d; }
+ __.prototype = b.prototype;
+ d.prototype = new __();
+};
+var Foo = (function () {
+ function Foo() {
+ }
+ return Foo;
+})();
+var Foo2 = (function () {
+ function Foo2() {
+ }
+ return Foo2;
+})();
+var C = (function () {
+ function C() {
+ }
+ Object.defineProperty(C.prototype, "get1", {
+ get: function () {
+ return new Foo;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ return C;
+})();
+var D = (function (_super) {
+ __extends(D, _super);
+ function D() {
+ _super.apply(this, arguments);
+ }
+ Object.defineProperty(D.prototype, "set1", {
+ set: function (p) {
+ },
+ enumerable: true,
+ configurable: true
+ });
+ return D;
+})(C);
diff --git a/tests/baselines/reference/computedPropertyNames46.js b/tests/baselines/reference/computedPropertyNames46.js
new file mode 100644
index 00000000000..e2ef2b2e729
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames46.js
@@ -0,0 +1,9 @@
+//// [computedPropertyNames46.ts]
+var o = {
+ ["" || 0]: 0
+};
+
+//// [computedPropertyNames46.js]
+var o = {
+ ["" || 0]: 0
+};
diff --git a/tests/baselines/reference/computedPropertyNames46.types b/tests/baselines/reference/computedPropertyNames46.types
new file mode 100644
index 00000000000..cf8585828f4
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames46.types
@@ -0,0 +1,9 @@
+=== tests/cases/conformance/es6/computedProperties/computedPropertyNames46.ts ===
+var o = {
+>o : {}
+>{ ["" || 0]: 0} : {}
+
+ ["" || 0]: 0
+>"" || 0 : string | number
+
+};
diff --git a/tests/baselines/reference/computedPropertyNames47.js b/tests/baselines/reference/computedPropertyNames47.js
new file mode 100644
index 00000000000..88e28e54239
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames47.js
@@ -0,0 +1,19 @@
+//// [computedPropertyNames47.ts]
+enum E1 { x }
+enum E2 { x }
+var o = {
+ [E1.x || E2.x]: 0
+};
+
+//// [computedPropertyNames47.js]
+var E1;
+(function (E1) {
+ E1[E1["x"] = 0] = "x";
+})(E1 || (E1 = {}));
+var E2;
+(function (E2) {
+ E2[E2["x"] = 0] = "x";
+})(E2 || (E2 = {}));
+var o = {
+ [0 /* x */ || 0 /* x */]: 0
+};
diff --git a/tests/baselines/reference/computedPropertyNames47.types b/tests/baselines/reference/computedPropertyNames47.types
new file mode 100644
index 00000000000..20d7ab1d31e
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames47.types
@@ -0,0 +1,23 @@
+=== tests/cases/conformance/es6/computedProperties/computedPropertyNames47.ts ===
+enum E1 { x }
+>E1 : E1
+>x : E1
+
+enum E2 { x }
+>E2 : E2
+>x : E2
+
+var o = {
+>o : {}
+>{ [E1.x || E2.x]: 0} : {}
+
+ [E1.x || E2.x]: 0
+>E1.x || E2.x : E1 | E2
+>E1.x : E1
+>E1 : typeof E1
+>x : E1
+>E2.x : E2
+>E2 : typeof E2
+>x : E2
+
+};
diff --git a/tests/baselines/reference/computedPropertyNames48.js b/tests/baselines/reference/computedPropertyNames48.js
new file mode 100644
index 00000000000..9f8e0442ebe
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames48.js
@@ -0,0 +1,34 @@
+//// [computedPropertyNames48.ts]
+declare function extractIndexer(p: { [n: number]: T }): T;
+
+enum E { x }
+
+var a: any;
+
+extractIndexer({
+ [a]: ""
+}); // Should return string
+
+extractIndexer({
+ [E.x]: ""
+}); // Should return string
+
+extractIndexer({
+ ["" || 0]: ""
+}); // Should return any (widened form of undefined)
+
+//// [computedPropertyNames48.js]
+var E;
+(function (E) {
+ E[E["x"] = 0] = "x";
+})(E || (E = {}));
+var a;
+extractIndexer({
+ [a]: ""
+}); // Should return string
+extractIndexer({
+ [0 /* x */]: ""
+}); // Should return string
+extractIndexer({
+ ["" || 0]: ""
+}); // Should return any (widened form of undefined)
diff --git a/tests/baselines/reference/computedPropertyNames48.types b/tests/baselines/reference/computedPropertyNames48.types
new file mode 100644
index 00000000000..78755d5d5d7
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames48.types
@@ -0,0 +1,47 @@
+=== tests/cases/conformance/es6/computedProperties/computedPropertyNames48.ts ===
+declare function extractIndexer(p: { [n: number]: T }): T;
+>extractIndexer : (p: { [n: number]: T; }) => T
+>T : T
+>p : { [n: number]: T; }
+>n : number
+>T : T
+>T : T
+
+enum E { x }
+>E : E
+>x : E
+
+var a: any;
+>a : any
+
+extractIndexer({
+>extractIndexer({ [a]: ""}) : string
+>extractIndexer : (p: { [n: number]: T; }) => T
+>{ [a]: ""} : { [x: number]: string; }
+
+ [a]: ""
+>a : any
+
+}); // Should return string
+
+extractIndexer({
+>extractIndexer({ [E.x]: ""}) : string
+>extractIndexer : (p: { [n: number]: T; }) => T
+>{ [E.x]: ""} : { [x: number]: string; }
+
+ [E.x]: ""
+>E.x : E
+>E : typeof E
+>x : E
+
+}); // Should return string
+
+extractIndexer({
+>extractIndexer({ ["" || 0]: ""}) : any
+>extractIndexer : (p: { [n: number]: T; }) => T
+>{ ["" || 0]: ""} : { [x: number]: undefined; }
+
+ ["" || 0]: ""
+>"" || 0 : string | number
+
+}); // Should return any (widened form of undefined)
diff --git a/tests/baselines/reference/computedPropertyNames5.errors.txt b/tests/baselines/reference/computedPropertyNames5.errors.txt
new file mode 100644
index 00000000000..2b8cf5503b8
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames5.errors.txt
@@ -0,0 +1,30 @@
+tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(4,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(8,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+
+
+==== tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts (6 errors) ====
+ var b: boolean;
+ var v = {
+ [b]: 0,
+ ~~~
+!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+ [true]: 1,
+ ~~~~~~
+!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+ [[]]: 0,
+ ~~~~
+!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+ [{}]: 0,
+ ~~~~
+!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+ [undefined]: undefined,
+ ~~~~~~~~~~~
+!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+ [null]: null
+ ~~~~~~
+!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+ }
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNames5.js b/tests/baselines/reference/computedPropertyNames5.js
new file mode 100644
index 00000000000..d0158da6400
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames5.js
@@ -0,0 +1,21 @@
+//// [computedPropertyNames5.ts]
+var b: boolean;
+var v = {
+ [b]: 0,
+ [true]: 1,
+ [[]]: 0,
+ [{}]: 0,
+ [undefined]: undefined,
+ [null]: null
+}
+
+//// [computedPropertyNames5.js]
+var b;
+var v = {
+ [b]: 0,
+ [true]: 1,
+ [[]]: 0,
+ [{}]: 0,
+ [undefined]: undefined,
+ [null]: null
+};
diff --git a/tests/baselines/reference/computedPropertyNames6.errors.txt b/tests/baselines/reference/computedPropertyNames6.errors.txt
new file mode 100644
index 00000000000..57798e9f6b6
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames6.errors.txt
@@ -0,0 +1,17 @@
+tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+
+
+==== tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts (2 errors) ====
+ var p1: number | string;
+ var p2: number | number[];
+ var p3: string | boolean;
+ var v = {
+ [p1]: 0,
+ [p2]: 1,
+ ~~~~
+!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+ [p3]: 2
+ ~~~~
+!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+ }
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNames6.js b/tests/baselines/reference/computedPropertyNames6.js
new file mode 100644
index 00000000000..e131ef4417f
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames6.js
@@ -0,0 +1,19 @@
+//// [computedPropertyNames6.ts]
+var p1: number | string;
+var p2: number | number[];
+var p3: string | boolean;
+var v = {
+ [p1]: 0,
+ [p2]: 1,
+ [p3]: 2
+}
+
+//// [computedPropertyNames6.js]
+var p1;
+var p2;
+var p3;
+var v = {
+ [p1]: 0,
+ [p2]: 1,
+ [p3]: 2
+};
diff --git a/tests/baselines/reference/computedPropertyNames7.js b/tests/baselines/reference/computedPropertyNames7.js
new file mode 100644
index 00000000000..075b149522b
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames7.js
@@ -0,0 +1,16 @@
+//// [computedPropertyNames7.ts]
+enum E {
+ member
+}
+var v = {
+ [E.member]: 0
+}
+
+//// [computedPropertyNames7.js]
+var E;
+(function (E) {
+ E[E["member"] = 0] = "member";
+})(E || (E = {}));
+var v = {
+ [0 /* member */]: 0
+};
diff --git a/tests/baselines/reference/computedPropertyNames7.types b/tests/baselines/reference/computedPropertyNames7.types
new file mode 100644
index 00000000000..0b5f26614fc
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames7.types
@@ -0,0 +1,16 @@
+=== tests/cases/conformance/es6/computedProperties/computedPropertyNames7.ts ===
+enum E {
+>E : E
+
+ member
+>member : E
+}
+var v = {
+>v : {}
+>{ [E.member]: 0} : {}
+
+ [E.member]: 0
+>E.member : E
+>E : typeof E
+>member : E
+}
diff --git a/tests/baselines/reference/computedPropertyNames8.errors.txt b/tests/baselines/reference/computedPropertyNames8.errors.txt
new file mode 100644
index 00000000000..515af1f4fc4
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames8.errors.txt
@@ -0,0 +1,17 @@
+tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+
+
+==== tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts (2 errors) ====
+ function f() {
+ var t: T;
+ var u: U;
+ var v = {
+ [t]: 0,
+ ~~~
+!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+ [u]: 1
+ ~~~
+!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+ };
+ }
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNames8.js b/tests/baselines/reference/computedPropertyNames8.js
new file mode 100644
index 00000000000..44a21d79a1c
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames8.js
@@ -0,0 +1,19 @@
+//// [computedPropertyNames8.ts]
+function f() {
+ var t: T;
+ var u: U;
+ var v = {
+ [t]: 0,
+ [u]: 1
+ };
+}
+
+//// [computedPropertyNames8.js]
+function f() {
+ var t;
+ var u;
+ var v = {
+ [t]: 0,
+ [u]: 1
+ };
+}
diff --git a/tests/baselines/reference/computedPropertyNames9.errors.txt b/tests/baselines/reference/computedPropertyNames9.errors.txt
new file mode 100644
index 00000000000..d87576f1f77
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames9.errors.txt
@@ -0,0 +1,16 @@
+tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts(9,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+
+
+==== tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts (1 errors) ====
+ function f(s: string): string;
+ function f(n: number): number;
+ function f(x: T): T;
+ function f(x): any { }
+
+ var v = {
+ [f("")]: 0,
+ [f(0)]: 0,
+ [f(true)]: 0
+ ~~~~~~~~~
+!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
+ }
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNames9.js b/tests/baselines/reference/computedPropertyNames9.js
new file mode 100644
index 00000000000..ede8bb3012b
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNames9.js
@@ -0,0 +1,20 @@
+//// [computedPropertyNames9.ts]
+function f(s: string): string;
+function f(n: number): number;
+function f(x: T): T;
+function f(x): any { }
+
+var v = {
+ [f("")]: 0,
+ [f(0)]: 0,
+ [f(true)]: 0
+}
+
+//// [computedPropertyNames9.js]
+function f(x) {
+}
+var v = {
+ [f("")]: 0,
+ [f(0)]: 0,
+ [f(true)]: 0
+};
diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1.js b/tests/baselines/reference/computedPropertyNamesContextualType1.js
new file mode 100644
index 00000000000..d7704c8c377
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNamesContextualType1.js
@@ -0,0 +1,18 @@
+//// [computedPropertyNamesContextualType1.ts]
+interface I {
+ [s: string]: (x: string) => number;
+ [s: number]: (x: any) => number; // Doesn't get hit
+}
+
+var o: I = {
+ ["" + 0](y) { return y.length; },
+ ["" + 1]: y => y.length
+}
+
+//// [computedPropertyNamesContextualType1.js]
+var o = {
+ ["" + 0](y) {
+ return y.length;
+ },
+ ["" + 1]: function (y) { return y.length; }
+};
diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1.types b/tests/baselines/reference/computedPropertyNamesContextualType1.types
new file mode 100644
index 00000000000..1697542fba6
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNamesContextualType1.types
@@ -0,0 +1,33 @@
+=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1.ts ===
+interface I {
+>I : I
+
+ [s: string]: (x: string) => number;
+>s : string
+>x : string
+
+ [s: number]: (x: any) => number; // Doesn't get hit
+>s : number
+>x : any
+}
+
+var o: I = {
+>o : I
+>I : I
+>{ ["" + 0](y) { return y.length; }, ["" + 1]: y => y.length} : { [x: string]: (y: string) => number; [x: number]: undefined; }
+
+ ["" + 0](y) { return y.length; },
+>"" + 0 : string
+>y : string
+>y.length : number
+>y : string
+>length : number
+
+ ["" + 1]: y => y.length
+>"" + 1 : string
+>y => y.length : (y: string) => number
+>y : string
+>y.length : number
+>y : string
+>length : number
+}
diff --git a/tests/baselines/reference/computedPropertyNamesContextualType10.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType10.errors.txt
new file mode 100644
index 00000000000..5e9fbe7b45b
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNamesContextualType10.errors.txt
@@ -0,0 +1,20 @@
+tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10.ts(5,5): error TS2322: Type '{ [x: number]: string | number; }' is not assignable to type 'I'.
+ Index signatures are incompatible.
+ Type 'string | number' is not assignable to type 'boolean'.
+ Type 'string' is not assignable to type 'boolean'.
+
+
+==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10.ts (1 errors) ====
+ interface I {
+ [s: number]: boolean;
+ }
+
+ var o: I = {
+ ~
+!!! error TS2322: Type '{ [x: number]: string | number; }' is not assignable to type 'I'.
+!!! error TS2322: Index signatures are incompatible.
+!!! error TS2322: Type 'string | number' is not assignable to type 'boolean'.
+!!! error TS2322: Type 'string' is not assignable to type 'boolean'.
+ [+"foo"]: "",
+ [+"bar"]: 0
+ }
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNamesContextualType10.js b/tests/baselines/reference/computedPropertyNamesContextualType10.js
new file mode 100644
index 00000000000..125a014852e
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNamesContextualType10.js
@@ -0,0 +1,15 @@
+//// [computedPropertyNamesContextualType10.ts]
+interface I {
+ [s: number]: boolean;
+}
+
+var o: I = {
+ [+"foo"]: "",
+ [+"bar"]: 0
+}
+
+//// [computedPropertyNamesContextualType10.js]
+var o = {
+ [+"foo"]: "",
+ [+"bar"]: 0
+};
diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2.js b/tests/baselines/reference/computedPropertyNamesContextualType2.js
new file mode 100644
index 00000000000..7b9f98402f5
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNamesContextualType2.js
@@ -0,0 +1,18 @@
+//// [computedPropertyNamesContextualType2.ts]
+interface I {
+ [s: string]: (x: any) => number; // Doesn't get hit
+ [s: number]: (x: string) => number;
+}
+
+var o: I = {
+ [+"foo"](y) { return y.length; },
+ [+"bar"]: y => y.length
+}
+
+//// [computedPropertyNamesContextualType2.js]
+var o = {
+ [+"foo"](y) {
+ return y.length;
+ },
+ [+"bar"]: function (y) { return y.length; }
+};
diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2.types b/tests/baselines/reference/computedPropertyNamesContextualType2.types
new file mode 100644
index 00000000000..408fd6a5062
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNamesContextualType2.types
@@ -0,0 +1,33 @@
+=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2.ts ===
+interface I {
+>I : I
+
+ [s: string]: (x: any) => number; // Doesn't get hit
+>s : string
+>x : any
+
+ [s: number]: (x: string) => number;
+>s : number
+>x : string
+}
+
+var o: I = {
+>o : I
+>I : I
+>{ [+"foo"](y) { return y.length; }, [+"bar"]: y => y.length} : { [x: string]: (y: string) => number; [x: number]: (y: string) => number; }
+
+ [+"foo"](y) { return y.length; },
+>+"foo" : number
+>y : string
+>y.length : number
+>y : string
+>length : number
+
+ [+"bar"]: y => y.length
+>+"bar" : number
+>y => y.length : (y: string) => number
+>y : string
+>y.length : number
+>y : string
+>length : number
+}
diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3.js b/tests/baselines/reference/computedPropertyNamesContextualType3.js
new file mode 100644
index 00000000000..f5b2c71bc18
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNamesContextualType3.js
@@ -0,0 +1,17 @@
+//// [computedPropertyNamesContextualType3.ts]
+interface I {
+ [s: string]: (x: string) => number;
+}
+
+var o: I = {
+ [+"foo"](y) { return y.length; },
+ [+"bar"]: y => y.length
+}
+
+//// [computedPropertyNamesContextualType3.js]
+var o = {
+ [+"foo"](y) {
+ return y.length;
+ },
+ [+"bar"]: function (y) { return y.length; }
+};
diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3.types b/tests/baselines/reference/computedPropertyNamesContextualType3.types
new file mode 100644
index 00000000000..a1a36c1b7e9
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNamesContextualType3.types
@@ -0,0 +1,29 @@
+=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3.ts ===
+interface I {
+>I : I
+
+ [s: string]: (x: string) => number;
+>s : string
+>x : string
+}
+
+var o: I = {
+>o : I
+>I : I
+>{ [+"foo"](y) { return y.length; }, [+"bar"]: y => y.length} : { [x: string]: (y: string) => number; }
+
+ [+"foo"](y) { return y.length; },
+>+"foo" : number
+>y : string
+>y.length : number
+>y : string
+>length : number
+
+ [+"bar"]: y => y.length
+>+"bar" : number
+>y => y.length : (y: string) => number
+>y : string
+>y.length : number
+>y : string
+>length : number
+}
diff --git a/tests/baselines/reference/computedPropertyNamesContextualType4.js b/tests/baselines/reference/computedPropertyNamesContextualType4.js
new file mode 100644
index 00000000000..6ddd22baf6e
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNamesContextualType4.js
@@ -0,0 +1,16 @@
+//// [computedPropertyNamesContextualType4.ts]
+interface I {
+ [s: string]: any;
+ [s: number]: any;
+}
+
+var o: I = {
+ [""+"foo"]: "",
+ [""+"bar"]: 0
+}
+
+//// [computedPropertyNamesContextualType4.js]
+var o = {
+ ["" + "foo"]: "",
+ ["" + "bar"]: 0
+};
diff --git a/tests/baselines/reference/computedPropertyNamesContextualType4.types b/tests/baselines/reference/computedPropertyNamesContextualType4.types
new file mode 100644
index 00000000000..d22f56f24fe
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNamesContextualType4.types
@@ -0,0 +1,22 @@
+=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4.ts ===
+interface I {
+>I : I
+
+ [s: string]: any;
+>s : string
+
+ [s: number]: any;
+>s : number
+}
+
+var o: I = {
+>o : I
+>I : I
+>{ [""+"foo"]: "", [""+"bar"]: 0} : { [x: string]: string | number; [x: number]: undefined; }
+
+ [""+"foo"]: "",
+>""+"foo" : string
+
+ [""+"bar"]: 0
+>""+"bar" : string
+}
diff --git a/tests/baselines/reference/computedPropertyNamesContextualType5.js b/tests/baselines/reference/computedPropertyNamesContextualType5.js
new file mode 100644
index 00000000000..f2bd79644a0
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNamesContextualType5.js
@@ -0,0 +1,16 @@
+//// [computedPropertyNamesContextualType5.ts]
+interface I {
+ [s: string]: any;
+ [s: number]: any;
+}
+
+var o: I = {
+ [+"foo"]: "",
+ [+"bar"]: 0
+}
+
+//// [computedPropertyNamesContextualType5.js]
+var o = {
+ [+"foo"]: "",
+ [+"bar"]: 0
+};
diff --git a/tests/baselines/reference/computedPropertyNamesContextualType5.types b/tests/baselines/reference/computedPropertyNamesContextualType5.types
new file mode 100644
index 00000000000..12c3332acfa
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNamesContextualType5.types
@@ -0,0 +1,22 @@
+=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5.ts ===
+interface I {
+>I : I
+
+ [s: string]: any;
+>s : string
+
+ [s: number]: any;
+>s : number
+}
+
+var o: I = {
+>o : I
+>I : I
+>{ [+"foo"]: "", [+"bar"]: 0} : { [x: string]: string | number; [x: number]: string | number; }
+
+ [+"foo"]: "",
+>+"foo" : number
+
+ [+"bar"]: 0
+>+"bar" : number
+}
diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6.js b/tests/baselines/reference/computedPropertyNamesContextualType6.js
new file mode 100644
index 00000000000..5d0cc149b2c
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNamesContextualType6.js
@@ -0,0 +1,24 @@
+//// [computedPropertyNamesContextualType6.ts]
+interface I {
+ [s: string]: T;
+}
+
+declare function foo(obj: I): T
+
+foo({
+ p: "",
+ 0: () => { },
+ ["hi" + "bye"]: true,
+ [0 + 1]: 0,
+ [+"hi"]: [0]
+});
+
+//// [computedPropertyNamesContextualType6.js]
+foo({
+ p: "",
+ 0: function () {
+ },
+ ["hi" + "bye"]: true,
+ [0 + 1]: 0,
+ [+"hi"]: [0]
+});
diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6.types b/tests/baselines/reference/computedPropertyNamesContextualType6.types
new file mode 100644
index 00000000000..acbae75ad4c
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNamesContextualType6.types
@@ -0,0 +1,40 @@
+=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6.ts ===
+interface I {
+>I : I
+>T : T
+
+ [s: string]: T;
+>s : string
+>T : T
+}
+
+declare function foo(obj: I): T
+>foo : (obj: I) => T
+>T : T
+>obj : I
+>I : I
+>T : T
+>T : T
+
+foo({
+>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : string | number | boolean | number[] | (() => void)
+>foo : (obj: I) => T
+>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | number | boolean | number[] | (() => void); 0: () => void; p: string; }
+
+ p: "",
+>p : string
+
+ 0: () => { },
+>() => { } : () => void
+
+ ["hi" + "bye"]: true,
+>"hi" + "bye" : string
+
+ [0 + 1]: 0,
+>0 + 1 : number
+
+ [+"hi"]: [0]
+>+"hi" : number
+>[0] : number[]
+
+});
diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7.js b/tests/baselines/reference/computedPropertyNamesContextualType7.js
new file mode 100644
index 00000000000..74030be6f2a
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNamesContextualType7.js
@@ -0,0 +1,24 @@
+//// [computedPropertyNamesContextualType7.ts]
+interface I {
+ [s: number]: T;
+}
+
+declare function foo(obj: I): T
+
+foo({
+ p: "",
+ 0: () => { },
+ ["hi" + "bye"]: true,
+ [0 + 1]: 0,
+ [+"hi"]: [0]
+});
+
+//// [computedPropertyNamesContextualType7.js]
+foo({
+ p: "",
+ 0: function () {
+ },
+ ["hi" + "bye"]: true,
+ [0 + 1]: 0,
+ [+"hi"]: [0]
+});
diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7.types b/tests/baselines/reference/computedPropertyNamesContextualType7.types
new file mode 100644
index 00000000000..da059d490b0
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNamesContextualType7.types
@@ -0,0 +1,40 @@
+=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7.ts ===
+interface I {
+>I : I
+>T : T
+
+ [s: number]: T;
+>s : number
+>T : T
+}
+
+declare function foo(obj: I): T
+>foo : (obj: I) => T
+>T : T
+>obj : I
+>I : I
+>T : T
+>T : T
+
+foo({
+>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : number | number[] | (() => void)
+>foo : (obj: I) => T
+>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: number]: number | number[] | (() => void); 0: () => void; p: string; }
+
+ p: "",
+>p : string
+
+ 0: () => { },
+>() => { } : () => void
+
+ ["hi" + "bye"]: true,
+>"hi" + "bye" : string
+
+ [0 + 1]: 0,
+>0 + 1 : number
+
+ [+"hi"]: [0]
+>+"hi" : number
+>[0] : number[]
+
+});
diff --git a/tests/baselines/reference/computedPropertyNamesContextualType8.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType8.errors.txt
new file mode 100644
index 00000000000..07b55b799e4
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNamesContextualType8.errors.txt
@@ -0,0 +1,21 @@
+tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8.ts(6,5): error TS2322: Type '{ [x: string]: string | number; [x: number]: undefined; }' is not assignable to type 'I'.
+ Index signatures are incompatible.
+ Type 'string | number' is not assignable to type 'boolean'.
+ Type 'string' is not assignable to type 'boolean'.
+
+
+==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8.ts (1 errors) ====
+ interface I {
+ [s: string]: boolean;
+ [s: number]: boolean;
+ }
+
+ var o: I = {
+ ~
+!!! error TS2322: Type '{ [x: string]: string | number; [x: number]: undefined; }' is not assignable to type 'I'.
+!!! error TS2322: Index signatures are incompatible.
+!!! error TS2322: Type 'string | number' is not assignable to type 'boolean'.
+!!! error TS2322: Type 'string' is not assignable to type 'boolean'.
+ [""+"foo"]: "",
+ [""+"bar"]: 0
+ }
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNamesContextualType8.js b/tests/baselines/reference/computedPropertyNamesContextualType8.js
new file mode 100644
index 00000000000..d98538c40c1
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNamesContextualType8.js
@@ -0,0 +1,16 @@
+//// [computedPropertyNamesContextualType8.ts]
+interface I {
+ [s: string]: boolean;
+ [s: number]: boolean;
+}
+
+var o: I = {
+ [""+"foo"]: "",
+ [""+"bar"]: 0
+}
+
+//// [computedPropertyNamesContextualType8.js]
+var o = {
+ ["" + "foo"]: "",
+ ["" + "bar"]: 0
+};
diff --git a/tests/baselines/reference/computedPropertyNamesContextualType9.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType9.errors.txt
new file mode 100644
index 00000000000..6a1d9316fd7
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNamesContextualType9.errors.txt
@@ -0,0 +1,21 @@
+tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9.ts(6,5): error TS2322: Type '{ [x: string]: string | number; [x: number]: string | number; }' is not assignable to type 'I'.
+ Index signatures are incompatible.
+ Type 'string | number' is not assignable to type 'boolean'.
+ Type 'string' is not assignable to type 'boolean'.
+
+
+==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9.ts (1 errors) ====
+ interface I {
+ [s: string]: boolean;
+ [s: number]: boolean;
+ }
+
+ var o: I = {
+ ~
+!!! error TS2322: Type '{ [x: string]: string | number; [x: number]: string | number; }' is not assignable to type 'I'.
+!!! error TS2322: Index signatures are incompatible.
+!!! error TS2322: Type 'string | number' is not assignable to type 'boolean'.
+!!! error TS2322: Type 'string' is not assignable to type 'boolean'.
+ [+"foo"]: "",
+ [+"bar"]: 0
+ }
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNamesContextualType9.js b/tests/baselines/reference/computedPropertyNamesContextualType9.js
new file mode 100644
index 00000000000..ed8791a51e0
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNamesContextualType9.js
@@ -0,0 +1,16 @@
+//// [computedPropertyNamesContextualType9.ts]
+interface I {
+ [s: string]: boolean;
+ [s: number]: boolean;
+}
+
+var o: I = {
+ [+"foo"]: "",
+ [+"bar"]: 0
+}
+
+//// [computedPropertyNamesContextualType9.js]
+var o = {
+ [+"foo"]: "",
+ [+"bar"]: 0
+};
diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1.js
new file mode 100644
index 00000000000..bc8b5d0e910
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1.js
@@ -0,0 +1,33 @@
+//// [computedPropertyNamesDeclarationEmit1.ts]
+class C {
+ ["" + ""]() { }
+ get ["" + ""]() { return 0; }
+ set ["" + ""](x) { }
+}
+
+//// [computedPropertyNamesDeclarationEmit1.js]
+var C = (function () {
+ function C() {
+ }
+ C.prototype["" + ""] = function () {
+ };
+ Object.defineProperty(C.prototype, "" + "", {
+ get: function () {
+ return 0;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ Object.defineProperty(C.prototype, "" + "", {
+ set: function (x) {
+ },
+ enumerable: true,
+ configurable: true
+ });
+ return C;
+})();
+
+
+//// [computedPropertyNamesDeclarationEmit1.d.ts]
+declare class C {
+}
diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1.types b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1.types
new file mode 100644
index 00000000000..e8e184a652e
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1.types
@@ -0,0 +1,14 @@
+=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1.ts ===
+class C {
+>C : C
+
+ ["" + ""]() { }
+>"" + "" : string
+
+ get ["" + ""]() { return 0; }
+>"" + "" : string
+
+ set ["" + ""](x) { }
+>"" + "" : string
+>x : any
+}
diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2.js
new file mode 100644
index 00000000000..647f3fab135
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2.js
@@ -0,0 +1,33 @@
+//// [computedPropertyNamesDeclarationEmit2.ts]
+class C {
+ static ["" + ""]() { }
+ static get ["" + ""]() { return 0; }
+ static set ["" + ""](x) { }
+}
+
+//// [computedPropertyNamesDeclarationEmit2.js]
+var C = (function () {
+ function C() {
+ }
+ C["" + ""] = function () {
+ };
+ Object.defineProperty(C, "" + "", {
+ get: function () {
+ return 0;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ Object.defineProperty(C, "" + "", {
+ set: function (x) {
+ },
+ enumerable: true,
+ configurable: true
+ });
+ return C;
+})();
+
+
+//// [computedPropertyNamesDeclarationEmit2.d.ts]
+declare class C {
+}
diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2.types b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2.types
new file mode 100644
index 00000000000..df1da17abea
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2.types
@@ -0,0 +1,14 @@
+=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2.ts ===
+class C {
+>C : C
+
+ static ["" + ""]() { }
+>"" + "" : string
+
+ static get ["" + ""]() { return 0; }
+>"" + "" : string
+
+ static set ["" + ""](x) { }
+>"" + "" : string
+>x : any
+}
diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.errors.txt
new file mode 100644
index 00000000000..69ff2b9e452
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.errors.txt
@@ -0,0 +1,9 @@
+tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3.ts(2,5): error TS1169: Computed property names are not allowed in interfaces.
+
+
+==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3.ts (1 errors) ====
+ interface I {
+ ["" + ""](): void;
+ ~~~~~~~~~
+!!! error TS1169: Computed property names are not allowed in interfaces.
+ }
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.errors.txt
new file mode 100644
index 00000000000..53eb057f8a1
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.errors.txt
@@ -0,0 +1,9 @@
+tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4.ts(2,5): error TS1170: Computed property names are not allowed in type literals.
+
+
+==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4.ts (1 errors) ====
+ var v: {
+ ["" + ""](): void;
+ ~~~~~~~~~
+!!! error TS1170: Computed property names are not allowed in type literals.
+ }
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5.js
new file mode 100644
index 00000000000..d7ac3319eca
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5.js
@@ -0,0 +1,23 @@
+//// [computedPropertyNamesDeclarationEmit5.ts]
+var v = {
+ ["" + ""]: 0,
+ ["" + ""]() { },
+ get ["" + ""]() { return 0; },
+ set ["" + ""](x) { }
+}
+
+//// [computedPropertyNamesDeclarationEmit5.js]
+var v = {
+ ["" + ""]: 0,
+ ["" + ""]() {
+ },
+ get ["" + ""]() {
+ return 0;
+ },
+ set ["" + ""](x) {
+ }
+};
+
+
+//// [computedPropertyNamesDeclarationEmit5.d.ts]
+declare var v: {};
diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5.types b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5.types
new file mode 100644
index 00000000000..c63d6d0d5c3
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5.types
@@ -0,0 +1,18 @@
+=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5.ts ===
+var v = {
+>v : {}
+>{ ["" + ""]: 0, ["" + ""]() { }, get ["" + ""]() { return 0; }, set ["" + ""](x) { }} : {}
+
+ ["" + ""]: 0,
+>"" + "" : string
+
+ ["" + ""]() { },
+>"" + "" : string
+
+ get ["" + ""]() { return 0; },
+>"" + "" : string
+
+ set ["" + ""](x) { }
+>"" + "" : string
+>x : any
+}
diff --git a/tests/baselines/reference/computedPropertyNamesOnOverloads.errors.txt b/tests/baselines/reference/computedPropertyNamesOnOverloads.errors.txt
index 6329ab39f0f..b3c2957a13f 100644
--- a/tests/baselines/reference/computedPropertyNamesOnOverloads.errors.txt
+++ b/tests/baselines/reference/computedPropertyNamesOnOverloads.errors.txt
@@ -1,9 +1,8 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts(4,5): error TS1168: Computed property names are not allowed in method overloads.
tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts(5,5): error TS1168: Computed property names are not allowed in method overloads.
-tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts(6,5): error TS9002: Computed property names are not currently supported.
-==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts (3 errors) ====
+==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts (2 errors) ====
var methodName = "method";
var accessorName = "accessor";
class C {
@@ -14,6 +13,4 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.
~~~~~~~~~~~~
!!! error TS1168: Computed property names are not allowed in method overloads.
[methodName](v?: string) { }
- ~~~~~~~~~~~~
-!!! error TS9002: Computed property names are not currently supported.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1.js b/tests/baselines/reference/computedPropertyNamesSourceMap1.js
new file mode 100644
index 00000000000..b65e3f0ce5b
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNamesSourceMap1.js
@@ -0,0 +1,17 @@
+//// [computedPropertyNamesSourceMap1.ts]
+class C {
+ ["hello"]() {
+ debugger;
+ }
+}
+
+//// [computedPropertyNamesSourceMap1.js]
+var C = (function () {
+ function C() {
+ }
+ C.prototype["hello"] = function () {
+ debugger;
+ };
+ return C;
+})();
+//# sourceMappingURL=computedPropertyNamesSourceMap1.js.map
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap1.js.map
new file mode 100644
index 00000000000..5833df72f7f
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNamesSourceMap1.js.map
@@ -0,0 +1,2 @@
+//// [computedPropertyNamesSourceMap1.js.map]
+{"version":3,"file":"computedPropertyNamesSourceMap1.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap1.ts"],"names":["C","C.constructor","C[\"hello\"]"],"mappings":"AAAA,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAIPC,CAACA;IAHGD,YAACA,OAAOA,CAACA,GAATA;QACIE,QAAQA,CAACA;IACbA,CAACA;IACLF,QAACA;AAADA,CAACA,AAJD,IAIC"}
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1.sourcemap.txt b/tests/baselines/reference/computedPropertyNamesSourceMap1.sourcemap.txt
new file mode 100644
index 00000000000..e806eee1aa7
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNamesSourceMap1.sourcemap.txt
@@ -0,0 +1,114 @@
+===================================================================
+JsFile: computedPropertyNamesSourceMap1.js
+mapUrl: computedPropertyNamesSourceMap1.js.map
+sourceRoot:
+sources: computedPropertyNamesSourceMap1.ts
+===================================================================
+-------------------------------------------------------------------
+emittedFile:tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1.js
+sourceFile:computedPropertyNamesSourceMap1.ts
+-------------------------------------------------------------------
+>>>var C = (function () {
+1 >
+2 >^^^^
+3 > ^
+4 > ^^^^^^^^^^^^^^->
+1 >
+2 >class
+3 > C
+1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
+2 >Emitted(1, 5) Source(1, 7) + SourceIndex(0)
+3 >Emitted(1, 6) Source(1, 8) + SourceIndex(0)
+---
+>>> function C() {
+1->^^^^
+2 > ^^^^^^^^^
+3 > ^
+1->
+2 > class
+3 > C
+1->Emitted(2, 5) Source(1, 1) + SourceIndex(0) name (C)
+2 >Emitted(2, 14) Source(1, 7) + SourceIndex(0) name (C)
+3 >Emitted(2, 15) Source(1, 8) + SourceIndex(0) name (C)
+---
+>>> }
+1 >^^^^
+2 > ^
+3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
+1 > {
+ > ["hello"]() {
+ > debugger;
+ > }
+ >
+2 > }
+1 >Emitted(3, 5) Source(5, 1) + SourceIndex(0) name (C.constructor)
+2 >Emitted(3, 6) Source(5, 2) + SourceIndex(0) name (C.constructor)
+---
+>>> C.prototype["hello"] = function () {
+1->^^^^
+2 > ^^^^^^^^^^^^
+3 > ^^^^^^^
+4 > ^
+5 > ^^^
+1->
+2 > [
+3 > "hello"
+4 > ]
+5 >
+1->Emitted(4, 5) Source(2, 5) + SourceIndex(0) name (C)
+2 >Emitted(4, 17) Source(2, 6) + SourceIndex(0) name (C)
+3 >Emitted(4, 24) Source(2, 13) + SourceIndex(0) name (C)
+4 >Emitted(4, 25) Source(2, 14) + SourceIndex(0) name (C)
+5 >Emitted(4, 28) Source(2, 5) + SourceIndex(0) name (C)
+---
+>>> debugger;
+1 >^^^^^^^^
+2 > ^^^^^^^^
+3 > ^
+1 >["hello"]() {
+ >
+2 > debugger
+3 > ;
+1 >Emitted(5, 9) Source(3, 9) + SourceIndex(0) name (C["hello"])
+2 >Emitted(5, 17) Source(3, 17) + SourceIndex(0) name (C["hello"])
+3 >Emitted(5, 18) Source(3, 18) + SourceIndex(0) name (C["hello"])
+---
+>>> };
+1 >^^^^
+2 > ^
+3 > ^^^^^^^^^->
+1 >
+ >
+2 > }
+1 >Emitted(6, 5) Source(4, 5) + SourceIndex(0) name (C["hello"])
+2 >Emitted(6, 6) Source(4, 6) + SourceIndex(0) name (C["hello"])
+---
+>>> return C;
+1->^^^^
+2 > ^^^^^^^^
+1->
+ >
+2 > }
+1->Emitted(7, 5) Source(5, 1) + SourceIndex(0) name (C)
+2 >Emitted(7, 13) Source(5, 2) + SourceIndex(0) name (C)
+---
+>>>})();
+1 >
+2 >^
+3 >
+4 > ^^^^
+5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
+1 >
+2 >}
+3 >
+4 > class C {
+ > ["hello"]() {
+ > debugger;
+ > }
+ > }
+1 >Emitted(8, 1) Source(5, 1) + SourceIndex(0) name (C)
+2 >Emitted(8, 2) Source(5, 2) + SourceIndex(0) name (C)
+3 >Emitted(8, 2) Source(1, 1) + SourceIndex(0)
+4 >Emitted(8, 6) Source(5, 2) + SourceIndex(0)
+---
+>>>//# sourceMappingURL=computedPropertyNamesSourceMap1.js.map
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1.types b/tests/baselines/reference/computedPropertyNamesSourceMap1.types
new file mode 100644
index 00000000000..54a2a9f19d0
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNamesSourceMap1.types
@@ -0,0 +1,8 @@
+=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1.ts ===
+class C {
+>C : C
+
+ ["hello"]() {
+ debugger;
+ }
+}
diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2.js b/tests/baselines/reference/computedPropertyNamesSourceMap2.js
new file mode 100644
index 00000000000..d967cb0d468
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNamesSourceMap2.js
@@ -0,0 +1,14 @@
+//// [computedPropertyNamesSourceMap2.ts]
+var v = {
+ ["hello"]() {
+ debugger;
+ }
+}
+
+//// [computedPropertyNamesSourceMap2.js]
+var v = {
+ ["hello"]() {
+ debugger;
+ }
+};
+//# sourceMappingURL=computedPropertyNamesSourceMap2.js.map
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap2.js.map
new file mode 100644
index 00000000000..6c485c24f6f
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNamesSourceMap2.js.map
@@ -0,0 +1,2 @@
+//// [computedPropertyNamesSourceMap2.js.map]
+{"version":3,"file":"computedPropertyNamesSourceMap2.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2.ts"],"names":["[\"hello\"]"],"mappings":"AAAA,IAAI,CAAC,GAAG;IACJ,CAAC,OAAO,CAAC;QACLA,QAAQA,CAACA;IACbA,CAACA;CACJ,CAAA"}
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2.sourcemap.txt b/tests/baselines/reference/computedPropertyNamesSourceMap2.sourcemap.txt
new file mode 100644
index 00000000000..29f11b95e1f
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNamesSourceMap2.sourcemap.txt
@@ -0,0 +1,73 @@
+===================================================================
+JsFile: computedPropertyNamesSourceMap2.js
+mapUrl: computedPropertyNamesSourceMap2.js.map
+sourceRoot:
+sources: computedPropertyNamesSourceMap2.ts
+===================================================================
+-------------------------------------------------------------------
+emittedFile:tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2.js
+sourceFile:computedPropertyNamesSourceMap2.ts
+-------------------------------------------------------------------
+>>>var v = {
+1 >
+2 >^^^^
+3 > ^
+4 > ^^^
+5 > ^^^^^^^^^^->
+1 >
+2 >var
+3 > v
+4 > =
+1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
+2 >Emitted(1, 5) Source(1, 5) + SourceIndex(0)
+3 >Emitted(1, 6) Source(1, 6) + SourceIndex(0)
+4 >Emitted(1, 9) Source(1, 9) + SourceIndex(0)
+---
+>>> ["hello"]() {
+1->^^^^
+2 > ^
+3 > ^^^^^^^
+4 > ^
+5 > ^^^^^->
+1->{
+ >
+2 > [
+3 > "hello"
+4 > ]
+1->Emitted(2, 5) Source(2, 5) + SourceIndex(0)
+2 >Emitted(2, 6) Source(2, 6) + SourceIndex(0)
+3 >Emitted(2, 13) Source(2, 13) + SourceIndex(0)
+4 >Emitted(2, 14) Source(2, 14) + SourceIndex(0)
+---
+>>> debugger;
+1->^^^^^^^^
+2 > ^^^^^^^^
+3 > ^
+1->() {
+ >
+2 > debugger
+3 > ;
+1->Emitted(3, 9) Source(3, 9) + SourceIndex(0) name (["hello"])
+2 >Emitted(3, 17) Source(3, 17) + SourceIndex(0) name (["hello"])
+3 >Emitted(3, 18) Source(3, 18) + SourceIndex(0) name (["hello"])
+---
+>>> }
+1 >^^^^
+2 > ^
+1 >
+ >
+2 > }
+1 >Emitted(4, 5) Source(4, 5) + SourceIndex(0) name (["hello"])
+2 >Emitted(4, 6) Source(4, 6) + SourceIndex(0) name (["hello"])
+---
+>>>};
+1 >^
+2 > ^
+3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
+1 >
+ >}
+2 >
+1 >Emitted(5, 2) Source(5, 2) + SourceIndex(0)
+2 >Emitted(5, 3) Source(5, 2) + SourceIndex(0)
+---
+>>>//# sourceMappingURL=computedPropertyNamesSourceMap2.js.map
\ No newline at end of file
diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2.types b/tests/baselines/reference/computedPropertyNamesSourceMap2.types
new file mode 100644
index 00000000000..972259eb3e2
--- /dev/null
+++ b/tests/baselines/reference/computedPropertyNamesSourceMap2.types
@@ -0,0 +1,9 @@
+=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2.ts ===
+var v = {
+>v : {}
+>{ ["hello"]() { debugger; }} : {}
+
+ ["hello"]() {
+ debugger;
+ }
+}
diff --git a/tests/baselines/reference/concatError.js b/tests/baselines/reference/concatError.js
index 04c0a16b836..dee3d8a30e3 100644
--- a/tests/baselines/reference/concatError.js
+++ b/tests/baselines/reference/concatError.js
@@ -57,34 +57,4 @@ var c: C;
var cc: C>;
c = c.m(cc);
-var n1: number[];
-/*
-interface Array {
- concat(...items: T[][]): T[]; // Note: This overload needs to be picked for arrays of arrays, even though both are applicable
- concat(...items: T[]): T[];
-}
-*/
-var fa: number[];
-
-fa = fa.concat([0]);
-fa = fa.concat(0);
-
-
-
-
-
-/*
-
-
-
-
-declare class C {
- public m(p1: C>): C;
- //public p: T;
-}
-
-var c: C;
-var cc: C>;
-
-c = c.m(cc);
-
+*/
diff --git a/tests/baselines/reference/getterSetterNonAccessor.types b/tests/baselines/reference/getterSetterNonAccessor.types
index f3e5d549cff..0c1be481b3a 100644
--- a/tests/baselines/reference/getterSetterNonAccessor.types
+++ b/tests/baselines/reference/getterSetterNonAccessor.types
@@ -14,8 +14,8 @@ Object.defineProperty({}, "0", ({
>{} : {}
>({ get: getFunc, set: setFunc, configurable: true }) : PropertyDescriptor
>PropertyDescriptor : PropertyDescriptor
->({ get: getFunc, set: setFunc, configurable: true }) : { get: () => any; set: (v: any) => void; configurable: boolean; }
->{ get: getFunc, set: setFunc, configurable: true } : { get: () => any; set: (v: any) => void; configurable: boolean; }
+>({ get: getFunc, set: setFunc, configurable: true }) : { get: () => any; set: (v: any) => void; configurable: boolean; enumerable?: boolean; value?: any; writable?: boolean; }
+>{ get: getFunc, set: setFunc, configurable: true } : { get: () => any; set: (v: any) => void; configurable: boolean; enumerable?: boolean; value?: any; writable?: boolean; }
get: getFunc,
>get : () => any
diff --git a/tests/baselines/reference/giant.errors.txt b/tests/baselines/reference/giant.errors.txt
index fbe05bbfc79..e8c574d2115 100644
--- a/tests/baselines/reference/giant.errors.txt
+++ b/tests/baselines/reference/giant.errors.txt
@@ -17,6 +17,7 @@ tests/cases/compiler/giant.ts(35,12): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(36,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/giant.ts(36,16): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(61,5): error TS1169: Computed property names are not allowed in interfaces.
+tests/cases/compiler/giant.ts(61,6): error TS2304: Cannot find name 'p'.
tests/cases/compiler/giant.ts(62,5): error TS1021: An index signature must have a type annotation.
tests/cases/compiler/giant.ts(63,6): error TS1096: An index signature must have exactly one parameter.
tests/cases/compiler/giant.ts(76,5): error TS2386: Overload signatures must all be optional or required.
@@ -39,6 +40,7 @@ tests/cases/compiler/giant.ts(99,16): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(100,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/giant.ts(100,20): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(125,9): error TS1169: Computed property names are not allowed in interfaces.
+tests/cases/compiler/giant.ts(125,10): error TS2304: Cannot find name 'p'.
tests/cases/compiler/giant.ts(126,9): error TS1021: An index signature must have a type annotation.
tests/cases/compiler/giant.ts(127,10): error TS1096: An index signature must have exactly one parameter.
tests/cases/compiler/giant.ts(140,9): error TS2386: Overload signatures must all be optional or required.
@@ -62,6 +64,7 @@ tests/cases/compiler/giant.ts(178,16): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(179,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/giant.ts(179,20): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(204,9): error TS1169: Computed property names are not allowed in interfaces.
+tests/cases/compiler/giant.ts(204,10): error TS2304: Cannot find name 'p'.
tests/cases/compiler/giant.ts(205,9): error TS1021: An index signature must have a type annotation.
tests/cases/compiler/giant.ts(206,10): error TS1096: An index signature must have exactly one parameter.
tests/cases/compiler/giant.ts(219,9): error TS2386: Overload signatures must all be optional or required.
@@ -117,6 +120,7 @@ tests/cases/compiler/giant.ts(293,12): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(294,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/giant.ts(294,16): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(319,5): error TS1169: Computed property names are not allowed in interfaces.
+tests/cases/compiler/giant.ts(319,6): error TS2304: Cannot find name 'p'.
tests/cases/compiler/giant.ts(320,5): error TS1021: An index signature must have a type annotation.
tests/cases/compiler/giant.ts(321,6): error TS1096: An index signature must have exactly one parameter.
tests/cases/compiler/giant.ts(334,5): error TS2386: Overload signatures must all be optional or required.
@@ -139,6 +143,7 @@ tests/cases/compiler/giant.ts(357,16): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(358,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/giant.ts(358,20): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(383,9): error TS1169: Computed property names are not allowed in interfaces.
+tests/cases/compiler/giant.ts(383,10): error TS2304: Cannot find name 'p'.
tests/cases/compiler/giant.ts(384,9): error TS1021: An index signature must have a type annotation.
tests/cases/compiler/giant.ts(385,10): error TS1096: An index signature must have exactly one parameter.
tests/cases/compiler/giant.ts(398,9): error TS2386: Overload signatures must all be optional or required.
@@ -162,6 +167,7 @@ tests/cases/compiler/giant.ts(436,16): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(437,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/compiler/giant.ts(437,20): error TS2300: Duplicate identifier 'tgF'.
tests/cases/compiler/giant.ts(462,9): error TS1169: Computed property names are not allowed in interfaces.
+tests/cases/compiler/giant.ts(462,10): error TS2304: Cannot find name 'p'.
tests/cases/compiler/giant.ts(463,9): error TS1021: An index signature must have a type annotation.
tests/cases/compiler/giant.ts(464,10): error TS1096: An index signature must have exactly one parameter.
tests/cases/compiler/giant.ts(477,9): error TS2386: Overload signatures must all be optional or required.
@@ -233,6 +239,7 @@ tests/cases/compiler/giant.ts(558,24): error TS1184: An implementation cannot be
tests/cases/compiler/giant.ts(561,21): error TS1184: An implementation cannot be declared in ambient contexts.
tests/cases/compiler/giant.ts(563,21): error TS1184: An implementation cannot be declared in ambient contexts.
tests/cases/compiler/giant.ts(587,9): error TS1169: Computed property names are not allowed in interfaces.
+tests/cases/compiler/giant.ts(587,10): error TS2304: Cannot find name 'p'.
tests/cases/compiler/giant.ts(588,9): error TS1021: An index signature must have a type annotation.
tests/cases/compiler/giant.ts(589,10): error TS1096: An index signature must have exactly one parameter.
tests/cases/compiler/giant.ts(602,9): error TS2386: Overload signatures must all be optional or required.
@@ -249,6 +256,7 @@ tests/cases/compiler/giant.ts(623,24): error TS1184: An implementation cannot be
tests/cases/compiler/giant.ts(626,21): error TS1184: An implementation cannot be declared in ambient contexts.
tests/cases/compiler/giant.ts(628,21): error TS1184: An implementation cannot be declared in ambient contexts.
tests/cases/compiler/giant.ts(653,9): error TS1169: Computed property names are not allowed in interfaces.
+tests/cases/compiler/giant.ts(653,10): error TS2304: Cannot find name 'p'.
tests/cases/compiler/giant.ts(654,9): error TS1021: An index signature must have a type annotation.
tests/cases/compiler/giant.ts(655,10): error TS1096: An index signature must have exactly one parameter.
tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all be optional or required.
@@ -257,7 +265,7 @@ tests/cases/compiler/giant.ts(672,25): error TS1036: Statements are not allowed
tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be declared in ambient contexts.
-==== tests/cases/compiler/giant.ts (257 errors) ====
+==== tests/cases/compiler/giant.ts (265 errors) ====
/*
Prefixes
@@ -357,6 +365,8 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be
[p];
~~~
!!! error TS1169: Computed property names are not allowed in interfaces.
+ ~
+!!! error TS2304: Cannot find name 'p'.
[p1: string];
~~~~~~~~~~~~~
!!! error TS1021: An index signature must have a type annotation.
@@ -465,6 +475,8 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be
[p];
~~~
!!! error TS1169: Computed property names are not allowed in interfaces.
+ ~
+!!! error TS2304: Cannot find name 'p'.
[p1: string];
~~~~~~~~~~~~~
!!! error TS1021: An index signature must have a type annotation.
@@ -590,6 +602,8 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be
[p];
~~~
!!! error TS1169: Computed property names are not allowed in interfaces.
+ ~
+!!! error TS2304: Cannot find name 'p'.
[p1: string];
~~~~~~~~~~~~~
!!! error TS1021: An index signature must have a type annotation.
@@ -815,6 +829,8 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be
[p];
~~~
!!! error TS1169: Computed property names are not allowed in interfaces.
+ ~
+!!! error TS2304: Cannot find name 'p'.
[p1: string];
~~~~~~~~~~~~~
!!! error TS1021: An index signature must have a type annotation.
@@ -923,6 +939,8 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be
[p];
~~~
!!! error TS1169: Computed property names are not allowed in interfaces.
+ ~
+!!! error TS2304: Cannot find name 'p'.
[p1: string];
~~~~~~~~~~~~~
!!! error TS1021: An index signature must have a type annotation.
@@ -1048,6 +1066,8 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be
[p];
~~~
!!! error TS1169: Computed property names are not allowed in interfaces.
+ ~
+!!! error TS2304: Cannot find name 'p'.
[p1: string];
~~~~~~~~~~~~~
!!! error TS1021: An index signature must have a type annotation.
@@ -1315,6 +1335,8 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be
[p];
~~~
!!! error TS1169: Computed property names are not allowed in interfaces.
+ ~
+!!! error TS2304: Cannot find name 'p'.
[p1: string];
~~~~~~~~~~~~~
!!! error TS1021: An index signature must have a type annotation.
@@ -1413,6 +1435,8 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be
[p];
~~~
!!! error TS1169: Computed property names are not allowed in interfaces.
+ ~
+!!! error TS2304: Cannot find name 'p'.
[p1: string];
~~~~~~~~~~~~~
!!! error TS1021: An index signature must have a type annotation.
diff --git a/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt b/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt
index 5f538eef40c..9df5357767f 100644
--- a/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt
+++ b/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt
@@ -1,10 +1,8 @@
tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(12,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(13,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(14,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
-tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(15,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(16,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(17,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
-tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(18,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(19,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(20,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(30,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter
@@ -21,7 +19,7 @@ tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInv
tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(43,17): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter
-==== tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts (21 errors) ====
+==== tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts (19 errors) ====
enum E { a }
var x: any;
@@ -43,8 +41,6 @@ tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInv
~~
!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
var ra4 = a4 in x;
- ~~
-!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
var ra5 = null in x;
~~~~
!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
@@ -52,8 +48,6 @@ tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInv
~~~~~~~~~
!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
var ra7 = E.a in x;
- ~~~
-!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
var ra8 = false in x;
~~~~~
!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.
diff --git a/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt b/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt
index 294282d1e9e..82e96bf3846 100644
--- a/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt
+++ b/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt
@@ -1,23 +1,31 @@
-tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(2,5): error TS1169: Computed property names are not allowed in interfaces.
-tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(3,5): error TS1021: An index signature must have a type annotation.
-tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(7,5): error TS1166: Computed property names are not allowed in class property declarations.
-tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(12,5): error TS1021: An index signature must have a type annotation.
+tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(3,5): error TS1169: Computed property names are not allowed in interfaces.
+tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(3,6): error TS2304: Cannot find name 'x'.
+tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(4,5): error TS1021: An index signature must have a type annotation.
+tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(9,5): error TS1166: Computed property names are not allowed in class property declarations.
+tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(9,6): error TS2304: Cannot find name 'x'.
+tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(14,5): error TS1021: An index signature must have a type annotation.
-==== tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts (4 errors) ====
+==== tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts (6 errors) ====
interface I {
+ // Used to be indexer, now it is a computed property
[x]: string;
~~~
!!! error TS1169: Computed property names are not allowed in interfaces.
+ ~
+!!! error TS2304: Cannot find name 'x'.
[x: string];
~~~~~~~~~~~~
!!! error TS1021: An index signature must have a type annotation.
}
class C {
+ // Used to be indexer, now it is a computed property
[x]: string
~~~
!!! error TS1166: Computed property names are not allowed in class property declarations.
+ ~
+!!! error TS2304: Cannot find name 'x'.
}
diff --git a/tests/baselines/reference/indexSignatureWithInitializer.errors.txt b/tests/baselines/reference/indexSignatureWithInitializer.errors.txt
index 6fb708a3b80..d6f547a25cb 100644
--- a/tests/baselines/reference/indexSignatureWithInitializer.errors.txt
+++ b/tests/baselines/reference/indexSignatureWithInitializer.errors.txt
@@ -1,16 +1,23 @@
-tests/cases/compiler/indexSignatureWithInitializer.ts(2,5): error TS1169: Computed property names are not allowed in interfaces.
-tests/cases/compiler/indexSignatureWithInitializer.ts(6,5): error TS1166: Computed property names are not allowed in class property declarations.
+tests/cases/compiler/indexSignatureWithInitializer.ts(3,5): error TS1169: Computed property names are not allowed in interfaces.
+tests/cases/compiler/indexSignatureWithInitializer.ts(3,6): error TS2304: Cannot find name 'x'.
+tests/cases/compiler/indexSignatureWithInitializer.ts(7,5): error TS1166: Computed property names are not allowed in class property declarations.
+tests/cases/compiler/indexSignatureWithInitializer.ts(7,6): error TS2304: Cannot find name 'x'.
-==== tests/cases/compiler/indexSignatureWithInitializer.ts (2 errors) ====
+==== tests/cases/compiler/indexSignatureWithInitializer.ts (4 errors) ====
+ // These used to be indexers, now they are computed properties
interface I {
[x = '']: string;
~~~~~~~~
!!! error TS1169: Computed property names are not allowed in interfaces.
+ ~
+!!! error TS2304: Cannot find name 'x'.
}
class C {
[x = 0]: string
~~~~~~~
!!! error TS1166: Computed property names are not allowed in class property declarations.
+ ~
+!!! error TS2304: Cannot find name 'x'.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/indexWithoutParamType2.errors.txt b/tests/baselines/reference/indexWithoutParamType2.errors.txt
index 41527d0859f..468368b5f23 100644
--- a/tests/baselines/reference/indexWithoutParamType2.errors.txt
+++ b/tests/baselines/reference/indexWithoutParamType2.errors.txt
@@ -1,9 +1,13 @@
-tests/cases/compiler/indexWithoutParamType2.ts(2,5): error TS1166: Computed property names are not allowed in class property declarations.
+tests/cases/compiler/indexWithoutParamType2.ts(3,5): error TS1166: Computed property names are not allowed in class property declarations.
+tests/cases/compiler/indexWithoutParamType2.ts(3,6): error TS2304: Cannot find name 'x'.
-==== tests/cases/compiler/indexWithoutParamType2.ts (1 errors) ====
+==== tests/cases/compiler/indexWithoutParamType2.ts (2 errors) ====
class C {
+ // Used to be indexer, now it is a computed property
[x]: string
~~~
!!! error TS1166: Computed property names are not allowed in class property declarations.
+ ~
+!!! error TS2304: Cannot find name 'x'.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/intTypeCheck.errors.txt b/tests/baselines/reference/intTypeCheck.errors.txt
index 5f7c213a916..fdbcaa88f5d 100644
--- a/tests/baselines/reference/intTypeCheck.errors.txt
+++ b/tests/baselines/reference/intTypeCheck.errors.txt
@@ -1,91 +1,93 @@
-tests/cases/compiler/intTypeCheck.ts(83,5): error TS2386: Overload signatures must all be optional or required.
-tests/cases/compiler/intTypeCheck.ts(97,5): error TS2322: Type 'Object' is not assignable to type 'i1'.
+tests/cases/compiler/intTypeCheck.ts(35,6): error TS2304: Cannot find name 'p'.
+tests/cases/compiler/intTypeCheck.ts(71,6): error TS2304: Cannot find name 'p'.
+tests/cases/compiler/intTypeCheck.ts(85,5): error TS2386: Overload signatures must all be optional or required.
+tests/cases/compiler/intTypeCheck.ts(99,5): error TS2322: Type 'Object' is not assignable to type 'i1'.
Property 'p' is missing in type 'Object'.
-tests/cases/compiler/intTypeCheck.ts(98,16): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
-tests/cases/compiler/intTypeCheck.ts(99,5): error TS2322: Type 'Base' is not assignable to type 'i1'.
+tests/cases/compiler/intTypeCheck.ts(100,16): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
+tests/cases/compiler/intTypeCheck.ts(101,5): error TS2322: Type 'Base' is not assignable to type 'i1'.
Property 'p' is missing in type 'Base'.
-tests/cases/compiler/intTypeCheck.ts(101,5): error TS2322: Type '() => void' is not assignable to type 'i1'.
+tests/cases/compiler/intTypeCheck.ts(103,5): error TS2322: Type '() => void' is not assignable to type 'i1'.
Property 'p' is missing in type '() => void'.
-tests/cases/compiler/intTypeCheck.ts(104,5): error TS2322: Type 'boolean' is not assignable to type 'i1'.
+tests/cases/compiler/intTypeCheck.ts(106,5): error TS2322: Type 'boolean' is not assignable to type 'i1'.
Property 'p' is missing in type 'Boolean'.
-tests/cases/compiler/intTypeCheck.ts(104,20): error TS1109: Expression expected.
-tests/cases/compiler/intTypeCheck.ts(104,21): error TS2304: Cannot find name 'i1'.
-tests/cases/compiler/intTypeCheck.ts(105,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
-tests/cases/compiler/intTypeCheck.ts(110,5): error TS2322: Type '{}' is not assignable to type 'i2'.
-tests/cases/compiler/intTypeCheck.ts(111,5): error TS2322: Type 'Object' is not assignable to type 'i2'.
-tests/cases/compiler/intTypeCheck.ts(112,17): error TS2350: Only a void function can be called with the 'new' keyword.
-tests/cases/compiler/intTypeCheck.ts(113,5): error TS2322: Type 'Base' is not assignable to type 'i2'.
-tests/cases/compiler/intTypeCheck.ts(118,5): error TS2322: Type 'boolean' is not assignable to type 'i2'.
-tests/cases/compiler/intTypeCheck.ts(118,21): error TS1109: Expression expected.
-tests/cases/compiler/intTypeCheck.ts(118,22): error TS2304: Cannot find name 'i2'.
-tests/cases/compiler/intTypeCheck.ts(119,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
-tests/cases/compiler/intTypeCheck.ts(124,5): error TS2322: Type '{}' is not assignable to type 'i3'.
-tests/cases/compiler/intTypeCheck.ts(125,5): error TS2322: Type 'Object' is not assignable to type 'i3'.
-tests/cases/compiler/intTypeCheck.ts(127,5): error TS2322: Type 'Base' is not assignable to type 'i3'.
-tests/cases/compiler/intTypeCheck.ts(129,5): error TS2322: Type '() => void' is not assignable to type 'i3'.
-tests/cases/compiler/intTypeCheck.ts(132,5): error TS2322: Type 'boolean' is not assignable to type 'i3'.
-tests/cases/compiler/intTypeCheck.ts(132,21): error TS1109: Expression expected.
-tests/cases/compiler/intTypeCheck.ts(132,22): error TS2304: Cannot find name 'i3'.
-tests/cases/compiler/intTypeCheck.ts(133,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
-tests/cases/compiler/intTypeCheck.ts(139,5): error TS2322: Type 'Object' is not assignable to type 'i4'.
+tests/cases/compiler/intTypeCheck.ts(106,20): error TS1109: Expression expected.
+tests/cases/compiler/intTypeCheck.ts(106,21): error TS2304: Cannot find name 'i1'.
+tests/cases/compiler/intTypeCheck.ts(107,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
+tests/cases/compiler/intTypeCheck.ts(112,5): error TS2322: Type '{}' is not assignable to type 'i2'.
+tests/cases/compiler/intTypeCheck.ts(113,5): error TS2322: Type 'Object' is not assignable to type 'i2'.
+tests/cases/compiler/intTypeCheck.ts(114,17): error TS2350: Only a void function can be called with the 'new' keyword.
+tests/cases/compiler/intTypeCheck.ts(115,5): error TS2322: Type 'Base' is not assignable to type 'i2'.
+tests/cases/compiler/intTypeCheck.ts(120,5): error TS2322: Type 'boolean' is not assignable to type 'i2'.
+tests/cases/compiler/intTypeCheck.ts(120,21): error TS1109: Expression expected.
+tests/cases/compiler/intTypeCheck.ts(120,22): error TS2304: Cannot find name 'i2'.
+tests/cases/compiler/intTypeCheck.ts(121,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
+tests/cases/compiler/intTypeCheck.ts(126,5): error TS2322: Type '{}' is not assignable to type 'i3'.
+tests/cases/compiler/intTypeCheck.ts(127,5): error TS2322: Type 'Object' is not assignable to type 'i3'.
+tests/cases/compiler/intTypeCheck.ts(129,5): error TS2322: Type 'Base' is not assignable to type 'i3'.
+tests/cases/compiler/intTypeCheck.ts(131,5): error TS2322: Type '() => void' is not assignable to type 'i3'.
+tests/cases/compiler/intTypeCheck.ts(134,5): error TS2322: Type 'boolean' is not assignable to type 'i3'.
+tests/cases/compiler/intTypeCheck.ts(134,21): error TS1109: Expression expected.
+tests/cases/compiler/intTypeCheck.ts(134,22): error TS2304: Cannot find name 'i3'.
+tests/cases/compiler/intTypeCheck.ts(135,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
+tests/cases/compiler/intTypeCheck.ts(141,5): error TS2322: Type 'Object' is not assignable to type 'i4'.
Index signature is missing in type 'Object'.
-tests/cases/compiler/intTypeCheck.ts(140,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
-tests/cases/compiler/intTypeCheck.ts(141,5): error TS2322: Type 'Base' is not assignable to type 'i4'.
+tests/cases/compiler/intTypeCheck.ts(142,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
+tests/cases/compiler/intTypeCheck.ts(143,5): error TS2322: Type 'Base' is not assignable to type 'i4'.
Index signature is missing in type 'Base'.
-tests/cases/compiler/intTypeCheck.ts(143,5): error TS2322: Type '() => void' is not assignable to type 'i4'.
+tests/cases/compiler/intTypeCheck.ts(145,5): error TS2322: Type '() => void' is not assignable to type 'i4'.
Index signature is missing in type '() => void'.
-tests/cases/compiler/intTypeCheck.ts(146,5): error TS2322: Type 'boolean' is not assignable to type 'i4'.
+tests/cases/compiler/intTypeCheck.ts(148,5): error TS2322: Type 'boolean' is not assignable to type 'i4'.
Index signature is missing in type 'Boolean'.
-tests/cases/compiler/intTypeCheck.ts(146,21): error TS1109: Expression expected.
-tests/cases/compiler/intTypeCheck.ts(146,22): error TS2304: Cannot find name 'i4'.
-tests/cases/compiler/intTypeCheck.ts(147,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
-tests/cases/compiler/intTypeCheck.ts(152,5): error TS2322: Type '{}' is not assignable to type 'i5'.
- Property 'p' is missing in type '{}'.
-tests/cases/compiler/intTypeCheck.ts(153,5): error TS2322: Type 'Object' is not assignable to type 'i5'.
+tests/cases/compiler/intTypeCheck.ts(148,21): error TS1109: Expression expected.
+tests/cases/compiler/intTypeCheck.ts(148,22): error TS2304: Cannot find name 'i4'.
+tests/cases/compiler/intTypeCheck.ts(149,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
+tests/cases/compiler/intTypeCheck.ts(154,5): error TS2322: Type '{ p1?: any; p2?: string; p4?(): any; p5?(): void; p7?(pa1: any, pa2: any): void; }' is not assignable to type 'i5'.
+ Property 'p' is missing in type '{ p1?: any; p2?: string; p4?(): any; p5?(): void; p7?(pa1: any, pa2: any): void; }'.
+tests/cases/compiler/intTypeCheck.ts(155,5): error TS2322: Type 'Object' is not assignable to type 'i5'.
Property 'p' is missing in type 'Object'.
-tests/cases/compiler/intTypeCheck.ts(154,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
-tests/cases/compiler/intTypeCheck.ts(155,5): error TS2322: Type 'Base' is not assignable to type 'i5'.
+tests/cases/compiler/intTypeCheck.ts(156,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
+tests/cases/compiler/intTypeCheck.ts(157,5): error TS2322: Type 'Base' is not assignable to type 'i5'.
Property 'p' is missing in type 'Base'.
-tests/cases/compiler/intTypeCheck.ts(157,5): error TS2322: Type '() => void' is not assignable to type 'i5'.
+tests/cases/compiler/intTypeCheck.ts(159,5): error TS2322: Type '() => void' is not assignable to type 'i5'.
Property 'p' is missing in type '() => void'.
-tests/cases/compiler/intTypeCheck.ts(160,5): error TS2322: Type 'boolean' is not assignable to type 'i5'.
+tests/cases/compiler/intTypeCheck.ts(162,5): error TS2322: Type 'boolean' is not assignable to type 'i5'.
Property 'p' is missing in type 'Boolean'.
-tests/cases/compiler/intTypeCheck.ts(160,21): error TS1109: Expression expected.
-tests/cases/compiler/intTypeCheck.ts(160,22): error TS2304: Cannot find name 'i5'.
-tests/cases/compiler/intTypeCheck.ts(161,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
-tests/cases/compiler/intTypeCheck.ts(166,5): error TS2322: Type '{}' is not assignable to type 'i6'.
-tests/cases/compiler/intTypeCheck.ts(167,5): error TS2322: Type 'Object' is not assignable to type 'i6'.
-tests/cases/compiler/intTypeCheck.ts(168,17): error TS2350: Only a void function can be called with the 'new' keyword.
-tests/cases/compiler/intTypeCheck.ts(169,5): error TS2322: Type 'Base' is not assignable to type 'i6'.
-tests/cases/compiler/intTypeCheck.ts(171,5): error TS2322: Type '() => void' is not assignable to type 'i6'.
+tests/cases/compiler/intTypeCheck.ts(162,21): error TS1109: Expression expected.
+tests/cases/compiler/intTypeCheck.ts(162,22): error TS2304: Cannot find name 'i5'.
+tests/cases/compiler/intTypeCheck.ts(163,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
+tests/cases/compiler/intTypeCheck.ts(168,5): error TS2322: Type '{}' is not assignable to type 'i6'.
+tests/cases/compiler/intTypeCheck.ts(169,5): error TS2322: Type 'Object' is not assignable to type 'i6'.
+tests/cases/compiler/intTypeCheck.ts(170,17): error TS2350: Only a void function can be called with the 'new' keyword.
+tests/cases/compiler/intTypeCheck.ts(171,5): error TS2322: Type 'Base' is not assignable to type 'i6'.
+tests/cases/compiler/intTypeCheck.ts(173,5): error TS2322: Type '() => void' is not assignable to type 'i6'.
Type 'void' is not assignable to type 'number'.
-tests/cases/compiler/intTypeCheck.ts(174,5): error TS2322: Type 'boolean' is not assignable to type 'i6'.
-tests/cases/compiler/intTypeCheck.ts(174,21): error TS1109: Expression expected.
-tests/cases/compiler/intTypeCheck.ts(174,22): error TS2304: Cannot find name 'i6'.
-tests/cases/compiler/intTypeCheck.ts(175,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
-tests/cases/compiler/intTypeCheck.ts(180,5): error TS2322: Type '{}' is not assignable to type 'i7'.
-tests/cases/compiler/intTypeCheck.ts(181,5): error TS2322: Type 'Object' is not assignable to type 'i7'.
-tests/cases/compiler/intTypeCheck.ts(183,17): error TS2352: Neither type 'Base' nor type 'i7' is assignable to the other.
-tests/cases/compiler/intTypeCheck.ts(185,5): error TS2322: Type '() => void' is not assignable to type 'i7'.
-tests/cases/compiler/intTypeCheck.ts(188,5): error TS2322: Type 'boolean' is not assignable to type 'i7'.
-tests/cases/compiler/intTypeCheck.ts(188,21): error TS1109: Expression expected.
-tests/cases/compiler/intTypeCheck.ts(188,22): error TS2304: Cannot find name 'i7'.
-tests/cases/compiler/intTypeCheck.ts(189,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
-tests/cases/compiler/intTypeCheck.ts(195,5): error TS2322: Type 'Object' is not assignable to type 'i8'.
+tests/cases/compiler/intTypeCheck.ts(176,5): error TS2322: Type 'boolean' is not assignable to type 'i6'.
+tests/cases/compiler/intTypeCheck.ts(176,21): error TS1109: Expression expected.
+tests/cases/compiler/intTypeCheck.ts(176,22): error TS2304: Cannot find name 'i6'.
+tests/cases/compiler/intTypeCheck.ts(177,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
+tests/cases/compiler/intTypeCheck.ts(182,5): error TS2322: Type '{}' is not assignable to type 'i7'.
+tests/cases/compiler/intTypeCheck.ts(183,5): error TS2322: Type 'Object' is not assignable to type 'i7'.
+tests/cases/compiler/intTypeCheck.ts(185,17): error TS2352: Neither type 'Base' nor type 'i7' is assignable to the other.
+tests/cases/compiler/intTypeCheck.ts(187,5): error TS2322: Type '() => void' is not assignable to type 'i7'.
+tests/cases/compiler/intTypeCheck.ts(190,5): error TS2322: Type 'boolean' is not assignable to type 'i7'.
+tests/cases/compiler/intTypeCheck.ts(190,21): error TS1109: Expression expected.
+tests/cases/compiler/intTypeCheck.ts(190,22): error TS2304: Cannot find name 'i7'.
+tests/cases/compiler/intTypeCheck.ts(191,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
+tests/cases/compiler/intTypeCheck.ts(197,5): error TS2322: Type 'Object' is not assignable to type 'i8'.
Index signature is missing in type 'Object'.
-tests/cases/compiler/intTypeCheck.ts(196,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
-tests/cases/compiler/intTypeCheck.ts(197,5): error TS2322: Type 'Base' is not assignable to type 'i8'.
+tests/cases/compiler/intTypeCheck.ts(198,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
+tests/cases/compiler/intTypeCheck.ts(199,5): error TS2322: Type 'Base' is not assignable to type 'i8'.
Index signature is missing in type 'Base'.
-tests/cases/compiler/intTypeCheck.ts(199,5): error TS2322: Type '() => void' is not assignable to type 'i8'.
+tests/cases/compiler/intTypeCheck.ts(201,5): error TS2322: Type '() => void' is not assignable to type 'i8'.
Index signature is missing in type '() => void'.
-tests/cases/compiler/intTypeCheck.ts(202,5): error TS2322: Type 'boolean' is not assignable to type 'i8'.
+tests/cases/compiler/intTypeCheck.ts(204,5): error TS2322: Type 'boolean' is not assignable to type 'i8'.
Index signature is missing in type 'Boolean'.
-tests/cases/compiler/intTypeCheck.ts(202,21): error TS1109: Expression expected.
-tests/cases/compiler/intTypeCheck.ts(202,22): error TS2304: Cannot find name 'i8'.
-tests/cases/compiler/intTypeCheck.ts(203,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
+tests/cases/compiler/intTypeCheck.ts(204,21): error TS1109: Expression expected.
+tests/cases/compiler/intTypeCheck.ts(204,22): error TS2304: Cannot find name 'i8'.
+tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
-==== tests/cases/compiler/intTypeCheck.ts (67 errors) ====
+==== tests/cases/compiler/intTypeCheck.ts (69 errors) ====
interface i1 {
//Property Signatures
p;
@@ -119,8 +121,11 @@ tests/cases/compiler/intTypeCheck.ts(203,17): error TS2351: Cannot use 'new' wit
new (p6: string, ...p7: any[]);
}
interface i4 {
- //Index Signatures
+ // Used to be indexer, now it is a computed property
[p];
+ ~
+!!! error TS2304: Cannot find name 'p'.
+ //Index Signatures
[p1: string];
[p2: string, p3: number];
}
@@ -153,9 +158,12 @@ tests/cases/compiler/intTypeCheck.ts(203,17): error TS2351: Cannot use 'new' wit
new (...p3: any[]);
new (p4: string, p5?: string);
new (p6: string, ...p7: any[]);
-
- //Index Signatures
+
+ // Used to be indexer, now it is a computed property
[p];
+ ~
+!!! error TS2304: Cannot find name 'p'.
+ //Index Signatures
[p1: string];
[p2: string, p3: number];
@@ -313,8 +321,8 @@ tests/cases/compiler/intTypeCheck.ts(203,17): error TS2351: Cannot use 'new' wit
var obj44: i5;
var obj45: i5 = {};
~~~~~
-!!! error TS2322: Type '{}' is not assignable to type 'i5'.
-!!! error TS2322: Property 'p' is missing in type '{}'.
+!!! error TS2322: Type '{ p1?: any; p2?: string; p4?(): any; p5?(): void; p7?(pa1: any, pa2: any): void; }' is not assignable to type 'i5'.
+!!! error TS2322: Property 'p' is missing in type '{ p1?: any; p2?: string; p4?(): any; p5?(): void; p7?(pa1: any, pa2: any): void; }'.
var obj46: i5 = new Object();
~~~~~
!!! error TS2322: Type 'Object' is not assignable to type 'i5'.
diff --git a/tests/baselines/reference/interfaceContextualType.types b/tests/baselines/reference/interfaceContextualType.types
index 3078ecfdfa4..412a48cfbda 100644
--- a/tests/baselines/reference/interfaceContextualType.types
+++ b/tests/baselines/reference/interfaceContextualType.types
@@ -34,27 +34,27 @@ class Bug {
>{} : { [x: string]: undefined; }
this.values['comments'] = { italic: true };
->this.values['comments'] = { italic: true } : { italic: boolean; }
+>this.values['comments'] = { italic: true } : { italic: boolean; bold?: boolean; }
>this.values['comments'] : IOptions
>this.values : IMap
>this : Bug
>values : IMap
->{ italic: true } : { italic: boolean; }
+>{ italic: true } : { italic: boolean; bold?: boolean; }
>italic : boolean
}
shouldBeOK() {
>shouldBeOK : () => void
this.values = {
->this.values = { comments: { italic: true } } : { [x: string]: { italic: boolean; }; comments: { italic: boolean; }; }
+>this.values = { comments: { italic: true } } : { [x: string]: { italic: boolean; bold?: boolean; }; comments: { italic: boolean; bold?: boolean; }; }
>this.values : IMap
>this : Bug
>values : IMap
->{ comments: { italic: true } } : { [x: string]: { italic: boolean; }; comments: { italic: boolean; }; }
+>{ comments: { italic: true } } : { [x: string]: { italic: boolean; bold?: boolean; }; comments: { italic: boolean; bold?: boolean; }; }
comments: { italic: true }
->comments : { italic: boolean; }
->{ italic: true } : { italic: boolean; }
+>comments : { italic: boolean; bold?: boolean; }
+>{ italic: true } : { italic: boolean; bold?: boolean; }
>italic : boolean
};
diff --git a/tests/baselines/reference/lastPropertyInLiteralWins.errors.txt b/tests/baselines/reference/lastPropertyInLiteralWins.errors.txt
index 4bf5521d24d..d503f59c602 100644
--- a/tests/baselines/reference/lastPropertyInLiteralWins.errors.txt
+++ b/tests/baselines/reference/lastPropertyInLiteralWins.errors.txt
@@ -1,8 +1,8 @@
-tests/cases/compiler/lastPropertyInLiteralWins.ts(8,5): error TS2300: Duplicate identifier 'thunk'.
-tests/cases/compiler/lastPropertyInLiteralWins.ts(9,5): error TS2300: Duplicate identifier 'thunk'.
-tests/cases/compiler/lastPropertyInLiteralWins.ts(12,6): error TS2345: Argument of type '{ thunk: (num: number) => void; }' is not assignable to parameter of type 'Thing'.
+tests/cases/compiler/lastPropertyInLiteralWins.ts(7,6): error TS2345: Argument of type '{ thunk: (num: number) => void; }' is not assignable to parameter of type 'Thing'.
Types of property 'thunk' are incompatible.
Type '(num: number) => void' is not assignable to type '(str: string) => void'.
+tests/cases/compiler/lastPropertyInLiteralWins.ts(8,5): error TS2300: Duplicate identifier 'thunk'.
+tests/cases/compiler/lastPropertyInLiteralWins.ts(9,5): error TS2300: Duplicate identifier 'thunk'.
tests/cases/compiler/lastPropertyInLiteralWins.ts(13,5): error TS2300: Duplicate identifier 'thunk'.
tests/cases/compiler/lastPropertyInLiteralWins.ts(14,5): error TS2300: Duplicate identifier 'thunk'.
@@ -15,21 +15,12 @@ tests/cases/compiler/lastPropertyInLiteralWins.ts(14,5): error TS2300: Duplicate
thing.thunk("str");
}
test({ // Should error, as last one wins, and is wrong type
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
thunk: (str: string) => {},
- ~~~~~
-!!! error TS2300: Duplicate identifier 'thunk'.
- thunk: (num: number) => {}
- ~~~~~
-!!! error TS2300: Duplicate identifier 'thunk'.
- });
-
- test({ // Should be OK. Last 'thunk' is of correct type
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- thunk: (num: number) => {},
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~
!!! error TS2300: Duplicate identifier 'thunk'.
- thunk: (str: string) => {}
+ thunk: (num: number) => {}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~
!!! error TS2300: Duplicate identifier 'thunk'.
@@ -38,4 +29,13 @@ tests/cases/compiler/lastPropertyInLiteralWins.ts(14,5): error TS2300: Duplicate
!!! error TS2345: Argument of type '{ thunk: (num: number) => void; }' is not assignable to parameter of type 'Thing'.
!!! error TS2345: Types of property 'thunk' are incompatible.
!!! error TS2345: Type '(num: number) => void' is not assignable to type '(str: string) => void'.
+
+ test({ // Should be OK. Last 'thunk' is of correct type
+ thunk: (num: number) => {},
+ ~~~~~
+!!! error TS2300: Duplicate identifier 'thunk'.
+ thunk: (str: string) => {}
+ ~~~~~
+!!! error TS2300: Duplicate identifier 'thunk'.
+ });
\ No newline at end of file
diff --git a/tests/baselines/reference/memberOverride.errors.txt b/tests/baselines/reference/memberOverride.errors.txt
index 0fd0fb57e67..b4974e69e53 100644
--- a/tests/baselines/reference/memberOverride.errors.txt
+++ b/tests/baselines/reference/memberOverride.errors.txt
@@ -1,9 +1,8 @@
tests/cases/compiler/memberOverride.ts(4,5): error TS2300: Duplicate identifier 'a'.
tests/cases/compiler/memberOverride.ts(5,5): error TS2300: Duplicate identifier 'a'.
-tests/cases/compiler/memberOverride.ts(8,5): error TS2322: Type 'string' is not assignable to type 'number'.
-==== tests/cases/compiler/memberOverride.ts (3 errors) ====
+==== tests/cases/compiler/memberOverride.ts (2 errors) ====
// An object initialiser accepts the first definition for the same property with a different type signature
// Should compile, since the second declaration of a overrides the first
var x = {
@@ -15,6 +14,4 @@ tests/cases/compiler/memberOverride.ts(8,5): error TS2322: Type 'string' is not
!!! error TS2300: Duplicate identifier 'a'.
}
- var n: number = x.a;
- ~
-!!! error TS2322: Type 'string' is not assignable to type 'number'.
\ No newline at end of file
+ var n: number = x.a;
\ No newline at end of file
diff --git a/tests/baselines/reference/objectLitGetterSetter.types b/tests/baselines/reference/objectLitGetterSetter.types
index 92decfd4068..bbb7ee10140 100644
--- a/tests/baselines/reference/objectLitGetterSetter.types
+++ b/tests/baselines/reference/objectLitGetterSetter.types
@@ -11,8 +11,8 @@
>obj : {}
>({ get: function () { eval("public = 1;"); return 11; }, set: function (v) { } }) : PropertyDescriptor
>PropertyDescriptor : PropertyDescriptor
->({ get: function () { eval("public = 1;"); return 11; }, set: function (v) { } }) : { get: () => number; set: (v: any) => void; }
->{ get: function () { eval("public = 1;"); return 11; }, set: function (v) { } } : { get: () => number; set: (v: any) => void; }
+>({ get: function () { eval("public = 1;"); return 11; }, set: function (v) { } }) : { get: () => number; set: (v: any) => void; configurable?: boolean; enumerable?: boolean; value?: any; writable?: boolean; }
+>{ get: function () { eval("public = 1;"); return 11; }, set: function (v) { } } : { get: () => number; set: (v: any) => void; configurable?: boolean; enumerable?: boolean; value?: any; writable?: boolean; }
get: function () {
>get : () => number
diff --git a/tests/baselines/reference/objectLiteralContextualTyping.js b/tests/baselines/reference/objectLiteralContextualTyping.js
new file mode 100644
index 00000000000..48686042754
--- /dev/null
+++ b/tests/baselines/reference/objectLiteralContextualTyping.js
@@ -0,0 +1,41 @@
+//// [objectLiteralContextualTyping.ts]
+// Tests related to #1774
+
+interface Item {
+ name: string;
+ description?: string;
+}
+
+declare function foo(item: Item): string;
+declare function foo(item: any): number;
+
+var x = foo({ name: "Sprocket" });
+var x: string;
+
+var y = foo({ name: "Sprocket", description: "Bumpy wheel" });
+var y: string;
+
+var z = foo({ name: "Sprocket", description: false });
+var z: number;
+
+var w = foo({ a: 10 });
+var w: number;
+
+declare function bar(param: { x?: T }): T;
+
+var b = bar({});
+var b: {};
+
+
+//// [objectLiteralContextualTyping.js]
+// Tests related to #1774
+var x = foo({ name: "Sprocket" });
+var x;
+var y = foo({ name: "Sprocket", description: "Bumpy wheel" });
+var y;
+var z = foo({ name: "Sprocket", description: false });
+var z;
+var w = foo({ a: 10 });
+var w;
+var b = bar({});
+var b;
diff --git a/tests/baselines/reference/objectLiteralContextualTyping.types b/tests/baselines/reference/objectLiteralContextualTyping.types
new file mode 100644
index 00000000000..495e8df1438
--- /dev/null
+++ b/tests/baselines/reference/objectLiteralContextualTyping.types
@@ -0,0 +1,81 @@
+=== tests/cases/conformance/expressions/contextualTyping/objectLiteralContextualTyping.ts ===
+// Tests related to #1774
+
+interface Item {
+>Item : Item
+
+ name: string;
+>name : string
+
+ description?: string;
+>description : string
+}
+
+declare function foo(item: Item): string;
+>foo : { (item: Item): string; (item: any): number; }
+>item : Item
+>Item : Item
+
+declare function foo(item: any): number;
+>foo : { (item: Item): string; (item: any): number; }
+>item : any
+
+var x = foo({ name: "Sprocket" });
+>x : string
+>foo({ name: "Sprocket" }) : string
+>foo : { (item: Item): string; (item: any): number; }
+>{ name: "Sprocket" } : { name: string; description?: string; }
+>name : string
+
+var x: string;
+>x : string
+
+var y = foo({ name: "Sprocket", description: "Bumpy wheel" });
+>y : string
+>foo({ name: "Sprocket", description: "Bumpy wheel" }) : string
+>foo : { (item: Item): string; (item: any): number; }
+>{ name: "Sprocket", description: "Bumpy wheel" } : { name: string; description: string; }
+>name : string
+>description : string
+
+var y: string;
+>y : string
+
+var z = foo({ name: "Sprocket", description: false });
+>z : number
+>foo({ name: "Sprocket", description: false }) : number
+>foo : { (item: Item): string; (item: any): number; }
+>{ name: "Sprocket", description: false } : { name: string; description: boolean; }
+>name : string
+>description : boolean
+
+var z: number;
+>z : number
+
+var w = foo({ a: 10 });
+>w : number
+>foo({ a: 10 }) : number
+>foo : { (item: Item): string; (item: any): number; }
+>{ a: 10 } : { a: number; }
+>a : number
+
+var w: number;
+>w : number
+
+declare function bar(param: { x?: T }): T;
+>bar : (param: { x?: T; }) => T
+>T : T
+>param : { x?: T; }
+>x : T
+>T : T
+>T : T
+
+var b = bar({});
+>b : {}
+>bar({}) : {}
+>bar : (param: { x?: T; }) => T
+>{} : { x?: {}; }
+
+var b: {};
+>b : {}
+
diff --git a/tests/baselines/reference/optionalAccessorsInInterface1.types b/tests/baselines/reference/optionalAccessorsInInterface1.types
index c426cdba178..f1dcd854f75 100644
--- a/tests/baselines/reference/optionalAccessorsInInterface1.types
+++ b/tests/baselines/reference/optionalAccessorsInInterface1.types
@@ -21,7 +21,7 @@ defineMyProperty({}, "name", { get: function () { return 5; } });
>defineMyProperty({}, "name", { get: function () { return 5; } }) : any
>defineMyProperty : (o: any, p: string, attributes: MyPropertyDescriptor) => any
>{} : {}
->{ get: function () { return 5; } } : { get: () => number; }
+>{ get: function () { return 5; } } : { get: () => number; set?(v: any): void; }
>get : () => number
>function () { return 5; } : () => number
@@ -47,7 +47,7 @@ defineMyProperty2({}, "name", { get: function () { return 5; } });
>defineMyProperty2({}, "name", { get: function () { return 5; } }) : any
>defineMyProperty2 : (o: any, p: string, attributes: MyPropertyDescriptor2) => any
>{} : {}
->{ get: function () { return 5; } } : { get: () => number; }
+>{ get: function () { return 5; } } : { get: () => number; set?: (v: any) => void; }
>get : () => number
>function () { return 5; } : () => number
diff --git a/tests/baselines/reference/optionalPropertiesTest.errors.txt b/tests/baselines/reference/optionalPropertiesTest.errors.txt
index a4b721e92ef..a904911e232 100644
--- a/tests/baselines/reference/optionalPropertiesTest.errors.txt
+++ b/tests/baselines/reference/optionalPropertiesTest.errors.txt
@@ -1,5 +1,5 @@
-tests/cases/compiler/optionalPropertiesTest.ts(14,1): error TS2322: Type '{ name: string; }' is not assignable to type 'IFoo'.
- Property 'id' is missing in type '{ name: string; }'.
+tests/cases/compiler/optionalPropertiesTest.ts(14,1): error TS2322: Type '{ name: string; print?(): void; }' is not assignable to type 'IFoo'.
+ Property 'id' is missing in type '{ name: string; print?(): void; }'.
tests/cases/compiler/optionalPropertiesTest.ts(25,5): error TS2322: Type '{}' is not assignable to type 'i1'.
Property 'M' is missing in type '{}'.
tests/cases/compiler/optionalPropertiesTest.ts(26,5): error TS2322: Type '{}' is not assignable to type 'i3'.
@@ -24,8 +24,8 @@ tests/cases/compiler/optionalPropertiesTest.ts(40,1): error TS2322: Type 'i2' is
foo = { id: 1234, name: "test" }; // Ok
foo = { name: "test" }; // Error, id missing
~~~
-!!! error TS2322: Type '{ name: string; }' is not assignable to type 'IFoo'.
-!!! error TS2322: Property 'id' is missing in type '{ name: string; }'.
+!!! error TS2322: Type '{ name: string; print?(): void; }' is not assignable to type 'IFoo'.
+!!! error TS2322: Property 'id' is missing in type '{ name: string; print?(): void; }'.
foo = {id: 1234, print:()=>{}} // Ok
var s = foo.name || "default";
diff --git a/tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries.types b/tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries.types
index 311cf971b61..f597c93bdda 100644
--- a/tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries.types
+++ b/tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries.types
@@ -105,17 +105,17 @@ var a1 = a.a({});
>a.a : { (o: Opt1): Opt1; (o: Opt2): Opt2; (o: Opt3): Opt3; (o: Opt4): Opt4; }
>a : A
>a : { (o: Opt1): Opt1; (o: Opt2): Opt2; (o: Opt3): Opt3; (o: Opt4): Opt4; }
->{} : {}
+>{} : { r?: any; }
var a1 = a({});
>a1 : Opt3
>a({}) : Opt3
>a : A
->{} : {}
+>{} : { r?: any; }
var a1 = new a({});
>a1 : Opt3
>new a({}) : Opt3
>a : A
->{} : {}
+>{} : { r?: any; }
diff --git a/tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries2.types b/tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries2.types
index e67ff2f8de6..a854c159e0c 100644
--- a/tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries2.types
+++ b/tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries2.types
@@ -108,17 +108,17 @@ var a1 = a.a({});
>a.a : { (o: Opt1): Opt1; (o: Opt2): Opt2; (o: Opt3): Opt3; (o: Opt4): Opt4; }
>a : A
>a : { (o: Opt1): Opt1; (o: Opt2): Opt2; (o: Opt3): Opt3; (o: Opt4): Opt4; }
->{} : {}
+>{} : { r?: any; }
var a1 = a({});
>a1 : Opt3
>a({}) : Opt3
>a : A
->{} : {}
+>{} : { r?: any; }
var a1 = new a({});
>a1 : Opt3
>new a({}) : Opt3
>a : A
->{} : {}
+>{} : { r?: any; }
diff --git a/tests/baselines/reference/parserComputedPropertyName1.errors.txt b/tests/baselines/reference/parserComputedPropertyName1.errors.txt
index 508d06a915c..2258051a46e 100644
--- a/tests/baselines/reference/parserComputedPropertyName1.errors.txt
+++ b/tests/baselines/reference/parserComputedPropertyName1.errors.txt
@@ -1,7 +1,10 @@
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName1.ts(1,12): error TS2304: Cannot find name 'e'.
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName1.ts(1,15): error TS1005: ':' expected.
-==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName1.ts (1 errors) ====
+==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName1.ts (2 errors) ====
var v = { [e] };
+ ~
+!!! error TS2304: Cannot find name 'e'.
~
!!! error TS1005: ':' expected.
\ No newline at end of file
diff --git a/tests/baselines/reference/parserComputedPropertyName10.errors.txt b/tests/baselines/reference/parserComputedPropertyName10.errors.txt
index 704c37ebf45..061e2c40c2d 100644
--- a/tests/baselines/reference/parserComputedPropertyName10.errors.txt
+++ b/tests/baselines/reference/parserComputedPropertyName10.errors.txt
@@ -1,9 +1,12 @@
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName10.ts(2,4): error TS1166: Computed property names are not allowed in class property declarations.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName10.ts(2,5): error TS2304: Cannot find name 'e'.
-==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName10.ts (1 errors) ====
+==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName10.ts (2 errors) ====
class C {
[e] = 1
~~~
!!! error TS1166: Computed property names are not allowed in class property declarations.
+ ~
+!!! error TS2304: Cannot find name 'e'.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/parserComputedPropertyName11.errors.txt b/tests/baselines/reference/parserComputedPropertyName11.errors.txt
index f47aa75031d..65748f72b24 100644
--- a/tests/baselines/reference/parserComputedPropertyName11.errors.txt
+++ b/tests/baselines/reference/parserComputedPropertyName11.errors.txt
@@ -1,9 +1,12 @@
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName11.ts(2,4): error TS1168: Computed property names are not allowed in method overloads.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName11.ts(2,5): error TS2304: Cannot find name 'e'.
-==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName11.ts (1 errors) ====
+==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName11.ts (2 errors) ====
class C {
[e]();
~~~
!!! error TS1168: Computed property names are not allowed in method overloads.
+ ~
+!!! error TS2304: Cannot find name 'e'.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/parserComputedPropertyName12.errors.txt b/tests/baselines/reference/parserComputedPropertyName12.errors.txt
index c028275369d..46baacf402d 100644
--- a/tests/baselines/reference/parserComputedPropertyName12.errors.txt
+++ b/tests/baselines/reference/parserComputedPropertyName12.errors.txt
@@ -1,9 +1,9 @@
-tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName12.ts(2,4): error TS9002: Computed property names are not currently supported.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName12.ts(2,5): error TS2304: Cannot find name 'e'.
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName12.ts (1 errors) ====
class C {
[e]() { }
- ~~~
-!!! error TS9002: Computed property names are not currently supported.
+ ~
+!!! error TS2304: Cannot find name 'e'.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/parserComputedPropertyName12.js b/tests/baselines/reference/parserComputedPropertyName12.js
new file mode 100644
index 00000000000..96e62b626e7
--- /dev/null
+++ b/tests/baselines/reference/parserComputedPropertyName12.js
@@ -0,0 +1,13 @@
+//// [parserComputedPropertyName12.ts]
+class C {
+ [e]() { }
+}
+
+//// [parserComputedPropertyName12.js]
+var C = (function () {
+ function C() {
+ }
+ C.prototype[e] = function () {
+ };
+ return C;
+})();
diff --git a/tests/baselines/reference/parserComputedPropertyName13.errors.txt b/tests/baselines/reference/parserComputedPropertyName13.errors.txt
index 33ef5f9141a..b209f3c7d01 100644
--- a/tests/baselines/reference/parserComputedPropertyName13.errors.txt
+++ b/tests/baselines/reference/parserComputedPropertyName13.errors.txt
@@ -1,7 +1,10 @@
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName13.ts(1,10): error TS1170: Computed property names are not allowed in type literals.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName13.ts(1,11): error TS2304: Cannot find name 'e'.
-==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName13.ts (1 errors) ====
+==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName13.ts (2 errors) ====
var v: { [e]: number };
~~~
-!!! error TS1170: Computed property names are not allowed in type literals.
\ No newline at end of file
+!!! error TS1170: Computed property names are not allowed in type literals.
+ ~
+!!! error TS2304: Cannot find name 'e'.
\ No newline at end of file
diff --git a/tests/baselines/reference/parserComputedPropertyName14.errors.txt b/tests/baselines/reference/parserComputedPropertyName14.errors.txt
index d2f7ad34ed9..6ac2d276a80 100644
--- a/tests/baselines/reference/parserComputedPropertyName14.errors.txt
+++ b/tests/baselines/reference/parserComputedPropertyName14.errors.txt
@@ -1,7 +1,10 @@
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName14.ts(1,10): error TS1170: Computed property names are not allowed in type literals.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName14.ts(1,11): error TS2304: Cannot find name 'e'.
-==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName14.ts (1 errors) ====
+==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName14.ts (2 errors) ====
var v: { [e](): number };
~~~
-!!! error TS1170: Computed property names are not allowed in type literals.
\ No newline at end of file
+!!! error TS1170: Computed property names are not allowed in type literals.
+ ~
+!!! error TS2304: Cannot find name 'e'.
\ No newline at end of file
diff --git a/tests/baselines/reference/parserComputedPropertyName15.errors.txt b/tests/baselines/reference/parserComputedPropertyName15.errors.txt
index b09ddb73112..f66e5930c26 100644
--- a/tests/baselines/reference/parserComputedPropertyName15.errors.txt
+++ b/tests/baselines/reference/parserComputedPropertyName15.errors.txt
@@ -1,7 +1,10 @@
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName15.ts(1,31): error TS1170: Computed property names are not allowed in type literals.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName15.ts(1,32): error TS2304: Cannot find name 'e'.
-==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName15.ts (1 errors) ====
+==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName15.ts (2 errors) ====
var v: { [e: number]: string; [e]: number };
~~~
-!!! error TS1170: Computed property names are not allowed in type literals.
\ No newline at end of file
+!!! error TS1170: Computed property names are not allowed in type literals.
+ ~
+!!! error TS2304: Cannot find name 'e'.
\ No newline at end of file
diff --git a/tests/baselines/reference/parserComputedPropertyName17.errors.txt b/tests/baselines/reference/parserComputedPropertyName17.errors.txt
index f8b1a4866e8..d8b43ada527 100644
--- a/tests/baselines/reference/parserComputedPropertyName17.errors.txt
+++ b/tests/baselines/reference/parserComputedPropertyName17.errors.txt
@@ -1,7 +1,7 @@
-tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName17.ts(1,15): error TS9002: Computed property names are not currently supported.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName17.ts(1,16): error TS2304: Cannot find name 'e'.
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName17.ts (1 errors) ====
var v = { set [e](v) { } }
- ~~~
-!!! error TS9002: Computed property names are not currently supported.
\ No newline at end of file
+ ~
+!!! error TS2304: Cannot find name 'e'.
\ No newline at end of file
diff --git a/tests/baselines/reference/parserComputedPropertyName17.js b/tests/baselines/reference/parserComputedPropertyName17.js
new file mode 100644
index 00000000000..98d61ab8bca
--- /dev/null
+++ b/tests/baselines/reference/parserComputedPropertyName17.js
@@ -0,0 +1,6 @@
+//// [parserComputedPropertyName17.ts]
+var v = { set [e](v) { } }
+
+//// [parserComputedPropertyName17.js]
+var v = { set [e](v) {
+} };
diff --git a/tests/baselines/reference/parserComputedPropertyName18.errors.txt b/tests/baselines/reference/parserComputedPropertyName18.errors.txt
index 72833dda837..f7485a127cb 100644
--- a/tests/baselines/reference/parserComputedPropertyName18.errors.txt
+++ b/tests/baselines/reference/parserComputedPropertyName18.errors.txt
@@ -1,7 +1,10 @@
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName18.ts(1,10): error TS1170: Computed property names are not allowed in type literals.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName18.ts(1,11): error TS2304: Cannot find name 'e'.
-==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName18.ts (1 errors) ====
+==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName18.ts (2 errors) ====
var v: { [e]?(): number };
~~~
-!!! error TS1170: Computed property names are not allowed in type literals.
\ No newline at end of file
+!!! error TS1170: Computed property names are not allowed in type literals.
+ ~
+!!! error TS2304: Cannot find name 'e'.
\ No newline at end of file
diff --git a/tests/baselines/reference/parserComputedPropertyName19.errors.txt b/tests/baselines/reference/parserComputedPropertyName19.errors.txt
index 22dbfff3c61..65c22ff36c3 100644
--- a/tests/baselines/reference/parserComputedPropertyName19.errors.txt
+++ b/tests/baselines/reference/parserComputedPropertyName19.errors.txt
@@ -1,7 +1,10 @@
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName19.ts(1,10): error TS1170: Computed property names are not allowed in type literals.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName19.ts(1,11): error TS2304: Cannot find name 'e'.
-==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName19.ts (1 errors) ====
+==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName19.ts (2 errors) ====
var v: { [e]? };
~~~
-!!! error TS1170: Computed property names are not allowed in type literals.
\ No newline at end of file
+!!! error TS1170: Computed property names are not allowed in type literals.
+ ~
+!!! error TS2304: Cannot find name 'e'.
\ No newline at end of file
diff --git a/tests/baselines/reference/parserComputedPropertyName2.errors.txt b/tests/baselines/reference/parserComputedPropertyName2.errors.txt
index 9eb6cdd6004..864c7adf1b5 100644
--- a/tests/baselines/reference/parserComputedPropertyName2.errors.txt
+++ b/tests/baselines/reference/parserComputedPropertyName2.errors.txt
@@ -1,7 +1,7 @@
-tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName2.ts(1,11): error TS9002: Computed property names are not currently supported.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName2.ts(1,12): error TS2304: Cannot find name 'e'.
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName2.ts (1 errors) ====
var v = { [e]: 1 };
- ~~~
-!!! error TS9002: Computed property names are not currently supported.
\ No newline at end of file
+ ~
+!!! error TS2304: Cannot find name 'e'.
\ No newline at end of file
diff --git a/tests/baselines/reference/parserComputedPropertyName2.js b/tests/baselines/reference/parserComputedPropertyName2.js
new file mode 100644
index 00000000000..f3c41f963f5
--- /dev/null
+++ b/tests/baselines/reference/parserComputedPropertyName2.js
@@ -0,0 +1,5 @@
+//// [parserComputedPropertyName2.ts]
+var v = { [e]: 1 };
+
+//// [parserComputedPropertyName2.js]
+var v = { [e]: 1 };
diff --git a/tests/baselines/reference/parserComputedPropertyName20.errors.txt b/tests/baselines/reference/parserComputedPropertyName20.errors.txt
index 36a7e2d4866..d65dfede1d2 100644
--- a/tests/baselines/reference/parserComputedPropertyName20.errors.txt
+++ b/tests/baselines/reference/parserComputedPropertyName20.errors.txt
@@ -1,9 +1,12 @@
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName20.ts(2,5): error TS1169: Computed property names are not allowed in interfaces.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName20.ts(2,6): error TS2304: Cannot find name 'e'.
-==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName20.ts (1 errors) ====
+==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName20.ts (2 errors) ====
interface I {
[e](): number
~~~
!!! error TS1169: Computed property names are not allowed in interfaces.
+ ~
+!!! error TS2304: Cannot find name 'e'.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/parserComputedPropertyName21.errors.txt b/tests/baselines/reference/parserComputedPropertyName21.errors.txt
index 5850de24b76..5a9738a23a6 100644
--- a/tests/baselines/reference/parserComputedPropertyName21.errors.txt
+++ b/tests/baselines/reference/parserComputedPropertyName21.errors.txt
@@ -1,9 +1,12 @@
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName21.ts(2,5): error TS1169: Computed property names are not allowed in interfaces.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName21.ts(2,6): error TS2304: Cannot find name 'e'.
-==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName21.ts (1 errors) ====
+==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName21.ts (2 errors) ====
interface I {
[e]: number
~~~
!!! error TS1169: Computed property names are not allowed in interfaces.
+ ~
+!!! error TS2304: Cannot find name 'e'.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/parserComputedPropertyName22.errors.txt b/tests/baselines/reference/parserComputedPropertyName22.errors.txt
index 5149c937108..ce20dd0c587 100644
--- a/tests/baselines/reference/parserComputedPropertyName22.errors.txt
+++ b/tests/baselines/reference/parserComputedPropertyName22.errors.txt
@@ -1,9 +1,12 @@
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName22.ts(2,5): error TS1166: Computed property names are not allowed in class property declarations.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName22.ts(2,6): error TS2304: Cannot find name 'e'.
-==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName22.ts (1 errors) ====
+==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName22.ts (2 errors) ====
declare class C {
[e]: number
~~~
!!! error TS1166: Computed property names are not allowed in class property declarations.
+ ~
+!!! error TS2304: Cannot find name 'e'.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/parserComputedPropertyName23.errors.txt b/tests/baselines/reference/parserComputedPropertyName23.errors.txt
index 2018032ef94..8c95992253c 100644
--- a/tests/baselines/reference/parserComputedPropertyName23.errors.txt
+++ b/tests/baselines/reference/parserComputedPropertyName23.errors.txt
@@ -1,9 +1,12 @@
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName23.ts(2,9): error TS1086: An accessor cannot be declared in an ambient context.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName23.ts(2,10): error TS2304: Cannot find name 'e'.
-==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName23.ts (1 errors) ====
+==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName23.ts (2 errors) ====
declare class C {
get [e](): number
~~~
!!! error TS1086: An accessor cannot be declared in an ambient context.
+ ~
+!!! error TS2304: Cannot find name 'e'.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/parserComputedPropertyName24.errors.txt b/tests/baselines/reference/parserComputedPropertyName24.errors.txt
index fa7280a93e7..29bcb05ea0f 100644
--- a/tests/baselines/reference/parserComputedPropertyName24.errors.txt
+++ b/tests/baselines/reference/parserComputedPropertyName24.errors.txt
@@ -1,9 +1,9 @@
-tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName24.ts(2,9): error TS9002: Computed property names are not currently supported.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName24.ts(2,10): error TS2304: Cannot find name 'e'.
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName24.ts (1 errors) ====
class C {
set [e](v) { }
- ~~~
-!!! error TS9002: Computed property names are not currently supported.
+ ~
+!!! error TS2304: Cannot find name 'e'.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/parserComputedPropertyName24.js b/tests/baselines/reference/parserComputedPropertyName24.js
new file mode 100644
index 00000000000..0b9467fb26d
--- /dev/null
+++ b/tests/baselines/reference/parserComputedPropertyName24.js
@@ -0,0 +1,17 @@
+//// [parserComputedPropertyName24.ts]
+class C {
+ set [e](v) { }
+}
+
+//// [parserComputedPropertyName24.js]
+var C = (function () {
+ function C() {
+ }
+ Object.defineProperty(C.prototype, e, {
+ set: function (v) {
+ },
+ enumerable: true,
+ configurable: true
+ });
+ return C;
+})();
diff --git a/tests/baselines/reference/parserComputedPropertyName25.errors.txt b/tests/baselines/reference/parserComputedPropertyName25.errors.txt
index c8dd6b3bc7c..8d26c8afdb7 100644
--- a/tests/baselines/reference/parserComputedPropertyName25.errors.txt
+++ b/tests/baselines/reference/parserComputedPropertyName25.errors.txt
@@ -1,13 +1,16 @@
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName25.ts(3,5): error TS1166: Computed property names are not allowed in class property declarations.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName25.ts(3,6): error TS2304: Cannot find name 'e'.
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName25.ts(4,6): error TS2304: Cannot find name 'e2'.
-==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName25.ts (2 errors) ====
+==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName25.ts (3 errors) ====
class C {
// No ASI
[e] = 0
~~~
!!! error TS1166: Computed property names are not allowed in class property declarations.
+ ~
+!!! error TS2304: Cannot find name 'e'.
[e2] = 1
~~
!!! error TS2304: Cannot find name 'e2'.
diff --git a/tests/baselines/reference/parserComputedPropertyName27.errors.txt b/tests/baselines/reference/parserComputedPropertyName27.errors.txt
index 7c8e30bf25d..3792cf0eccd 100644
--- a/tests/baselines/reference/parserComputedPropertyName27.errors.txt
+++ b/tests/baselines/reference/parserComputedPropertyName27.errors.txt
@@ -1,11 +1,14 @@
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName27.ts(3,6): error TS2304: Cannot find name 'e'.
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName27.ts(4,6): error TS2304: Cannot find name 'e2'.
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName27.ts(4,9): error TS1005: ';' expected.
-==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName27.ts (2 errors) ====
+==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName27.ts (3 errors) ====
class C {
// No ASI
[e]: number = 0
+ ~
+!!! error TS2304: Cannot find name 'e'.
[e2]: number
~~
!!! error TS2304: Cannot find name 'e2'.
diff --git a/tests/baselines/reference/parserComputedPropertyName28.errors.txt b/tests/baselines/reference/parserComputedPropertyName28.errors.txt
index bc32f34c151..c522ec031eb 100644
--- a/tests/baselines/reference/parserComputedPropertyName28.errors.txt
+++ b/tests/baselines/reference/parserComputedPropertyName28.errors.txt
@@ -1,13 +1,19 @@
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(2,5): error TS1166: Computed property names are not allowed in class property declarations.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(2,6): error TS2304: Cannot find name 'e'.
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(3,5): error TS1166: Computed property names are not allowed in class property declarations.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(3,6): error TS2304: Cannot find name 'e2'.
-==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts (2 errors) ====
+==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts (4 errors) ====
class C {
[e]: number = 0;
~~~
!!! error TS1166: Computed property names are not allowed in class property declarations.
+ ~
+!!! error TS2304: Cannot find name 'e'.
[e2]: number
~~~~
!!! error TS1166: Computed property names are not allowed in class property declarations.
+ ~~
+!!! error TS2304: Cannot find name 'e2'.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/parserComputedPropertyName29.errors.txt b/tests/baselines/reference/parserComputedPropertyName29.errors.txt
index 691a240375a..5e6baed0f06 100644
--- a/tests/baselines/reference/parserComputedPropertyName29.errors.txt
+++ b/tests/baselines/reference/parserComputedPropertyName29.errors.txt
@@ -1,17 +1,23 @@
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(3,5): error TS1166: Computed property names are not allowed in class property declarations.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(3,6): error TS2304: Cannot find name 'e'.
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(3,11): error TS2304: Cannot find name 'id'.
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(4,5): error TS1166: Computed property names are not allowed in class property declarations.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(4,6): error TS2304: Cannot find name 'e2'.
-==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts (3 errors) ====
+==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts (5 errors) ====
class C {
// yes ASI
[e] = id++
~~~
!!! error TS1166: Computed property names are not allowed in class property declarations.
+ ~
+!!! error TS2304: Cannot find name 'e'.
~~
!!! error TS2304: Cannot find name 'id'.
[e2]: number
~~~~
!!! error TS1166: Computed property names are not allowed in class property declarations.
+ ~~
+!!! error TS2304: Cannot find name 'e2'.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/parserComputedPropertyName3.errors.txt b/tests/baselines/reference/parserComputedPropertyName3.errors.txt
index b13f453cb89..4b20c55f499 100644
--- a/tests/baselines/reference/parserComputedPropertyName3.errors.txt
+++ b/tests/baselines/reference/parserComputedPropertyName3.errors.txt
@@ -1,7 +1,7 @@
-tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName3.ts(1,11): error TS9002: Computed property names are not currently supported.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName3.ts(1,12): error TS2304: Cannot find name 'e'.
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName3.ts (1 errors) ====
var v = { [e]() { } };
- ~~~
-!!! error TS9002: Computed property names are not currently supported.
\ No newline at end of file
+ ~
+!!! error TS2304: Cannot find name 'e'.
\ No newline at end of file
diff --git a/tests/baselines/reference/parserComputedPropertyName3.js b/tests/baselines/reference/parserComputedPropertyName3.js
new file mode 100644
index 00000000000..2e73fe87d3a
--- /dev/null
+++ b/tests/baselines/reference/parserComputedPropertyName3.js
@@ -0,0 +1,6 @@
+//// [parserComputedPropertyName3.ts]
+var v = { [e]() { } };
+
+//// [parserComputedPropertyName3.js]
+var v = { [e]() {
+} };
diff --git a/tests/baselines/reference/parserComputedPropertyName31.errors.txt b/tests/baselines/reference/parserComputedPropertyName31.errors.txt
index 6dddbd859c9..97a3b1ee187 100644
--- a/tests/baselines/reference/parserComputedPropertyName31.errors.txt
+++ b/tests/baselines/reference/parserComputedPropertyName31.errors.txt
@@ -1,14 +1,20 @@
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(3,5): error TS1166: Computed property names are not allowed in class property declarations.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(3,6): error TS2304: Cannot find name 'e'.
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(4,5): error TS1166: Computed property names are not allowed in class property declarations.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(4,6): error TS2304: Cannot find name 'e2'.
-==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts (2 errors) ====
+==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts (4 errors) ====
class C {
// yes ASI
[e]: number
~~~
!!! error TS1166: Computed property names are not allowed in class property declarations.
+ ~
+!!! error TS2304: Cannot find name 'e'.
[e2]: number
~~~~
!!! error TS1166: Computed property names are not allowed in class property declarations.
+ ~~
+!!! error TS2304: Cannot find name 'e2'.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/parserComputedPropertyName32.errors.txt b/tests/baselines/reference/parserComputedPropertyName32.errors.txt
index 4407014cf99..da423baaa05 100644
--- a/tests/baselines/reference/parserComputedPropertyName32.errors.txt
+++ b/tests/baselines/reference/parserComputedPropertyName32.errors.txt
@@ -1,9 +1,12 @@
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName32.ts(2,5): error TS1165: Computed property names are not allowed in an ambient context.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName32.ts(2,6): error TS2304: Cannot find name 'e'.
-==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName32.ts (1 errors) ====
+==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName32.ts (2 errors) ====
declare class C {
[e](): number
~~~
!!! error TS1165: Computed property names are not allowed in an ambient context.
+ ~
+!!! error TS2304: Cannot find name 'e'.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/parserComputedPropertyName33.errors.txt b/tests/baselines/reference/parserComputedPropertyName33.errors.txt
index d56ee49863f..5ce420ceb60 100644
--- a/tests/baselines/reference/parserComputedPropertyName33.errors.txt
+++ b/tests/baselines/reference/parserComputedPropertyName33.errors.txt
@@ -1,12 +1,15 @@
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName33.ts(3,6): error TS2304: Cannot find name 'e'.
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName33.ts(4,6): error TS2304: Cannot find name 'e2'.
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName33.ts(4,12): error TS1005: ';' expected.
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName33.ts(5,1): error TS1128: Declaration or statement expected.
-==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName33.ts (3 errors) ====
+==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName33.ts (4 errors) ====
class C {
// No ASI
[e] = 0
+ ~
+!!! error TS2304: Cannot find name 'e'.
[e2]() { }
~~
!!! error TS2304: Cannot find name 'e2'.
diff --git a/tests/baselines/reference/parserComputedPropertyName35.errors.txt b/tests/baselines/reference/parserComputedPropertyName35.errors.txt
index d68f0eb1ec7..e603d1c73fd 100644
--- a/tests/baselines/reference/parserComputedPropertyName35.errors.txt
+++ b/tests/baselines/reference/parserComputedPropertyName35.errors.txt
@@ -1,9 +1,9 @@
-tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName35.ts(2,5): error TS9002: Computed property names are not currently supported.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName35.ts(2,6): error TS1171: A comma expression is not allowed in a computed property name.
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName35.ts (1 errors) ====
var x = {
[0, 1]: { }
- ~~~~~~
-!!! error TS9002: Computed property names are not currently supported.
+ ~~~~
+!!! error TS1171: A comma expression is not allowed in a computed property name.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/parserComputedPropertyName35.js b/tests/baselines/reference/parserComputedPropertyName35.js
new file mode 100644
index 00000000000..15992d54ece
--- /dev/null
+++ b/tests/baselines/reference/parserComputedPropertyName35.js
@@ -0,0 +1,9 @@
+//// [parserComputedPropertyName35.ts]
+var x = {
+ [0, 1]: { }
+}
+
+//// [parserComputedPropertyName35.js]
+var x = {
+ [0, 1]: {}
+};
diff --git a/tests/baselines/reference/parserComputedPropertyName36.errors.txt b/tests/baselines/reference/parserComputedPropertyName36.errors.txt
index d10d826d1a9..1b4130b0e27 100644
--- a/tests/baselines/reference/parserComputedPropertyName36.errors.txt
+++ b/tests/baselines/reference/parserComputedPropertyName36.errors.txt
@@ -1,9 +1,12 @@
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName36.ts(2,5): error TS1166: Computed property names are not allowed in class property declarations.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName36.ts(2,6): error TS2304: Cannot find name 'public'.
-==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName36.ts (1 errors) ====
+==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName36.ts (2 errors) ====
class C {
[public ]: string;
~~~~~~~~~
!!! error TS1166: Computed property names are not allowed in class property declarations.
+ ~~~~~~
+!!! error TS2304: Cannot find name 'public'.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/parserComputedPropertyName37.errors.txt b/tests/baselines/reference/parserComputedPropertyName37.errors.txt
index fa1acd5dbe0..64a9e7e99dc 100644
--- a/tests/baselines/reference/parserComputedPropertyName37.errors.txt
+++ b/tests/baselines/reference/parserComputedPropertyName37.errors.txt
@@ -1,9 +1,9 @@
-tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName37.ts(2,5): error TS9002: Computed property names are not currently supported.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName37.ts(2,6): error TS2304: Cannot find name 'public'.
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName37.ts (1 errors) ====
var v = {
[public]: 0
- ~~~~~~~~
-!!! error TS9002: Computed property names are not currently supported.
+ ~~~~~~
+!!! error TS2304: Cannot find name 'public'.
};
\ No newline at end of file
diff --git a/tests/baselines/reference/parserComputedPropertyName37.js b/tests/baselines/reference/parserComputedPropertyName37.js
new file mode 100644
index 00000000000..eb16d5ade37
--- /dev/null
+++ b/tests/baselines/reference/parserComputedPropertyName37.js
@@ -0,0 +1,9 @@
+//// [parserComputedPropertyName37.ts]
+var v = {
+ [public]: 0
+};
+
+//// [parserComputedPropertyName37.js]
+var v = {
+ [public]: 0
+};
diff --git a/tests/baselines/reference/parserComputedPropertyName38.errors.txt b/tests/baselines/reference/parserComputedPropertyName38.errors.txt
index 910a907ee0f..4322abf44ed 100644
--- a/tests/baselines/reference/parserComputedPropertyName38.errors.txt
+++ b/tests/baselines/reference/parserComputedPropertyName38.errors.txt
@@ -1,9 +1,9 @@
-tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName38.ts(2,5): error TS9002: Computed property names are not currently supported.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName38.ts(2,6): error TS2304: Cannot find name 'public'.
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName38.ts (1 errors) ====
class C {
[public]() { }
- ~~~~~~~~
-!!! error TS9002: Computed property names are not currently supported.
+ ~~~~~~
+!!! error TS2304: Cannot find name 'public'.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/parserComputedPropertyName38.js b/tests/baselines/reference/parserComputedPropertyName38.js
new file mode 100644
index 00000000000..487ff4078fd
--- /dev/null
+++ b/tests/baselines/reference/parserComputedPropertyName38.js
@@ -0,0 +1,13 @@
+//// [parserComputedPropertyName38.ts]
+class C {
+ [public]() { }
+}
+
+//// [parserComputedPropertyName38.js]
+var C = (function () {
+ function C() {
+ }
+ C.prototype[public] = function () {
+ };
+ return C;
+})();
diff --git a/tests/baselines/reference/parserComputedPropertyName4.errors.txt b/tests/baselines/reference/parserComputedPropertyName4.errors.txt
index c1137b15872..bfc78b162fd 100644
--- a/tests/baselines/reference/parserComputedPropertyName4.errors.txt
+++ b/tests/baselines/reference/parserComputedPropertyName4.errors.txt
@@ -1,7 +1,10 @@
-tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName4.ts(1,15): error TS9002: Computed property names are not currently supported.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName4.ts(1,15): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName4.ts(1,16): error TS2304: Cannot find name 'e'.
-==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName4.ts (1 errors) ====
+==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName4.ts (2 errors) ====
var v = { get [e]() { } };
~~~
-!!! error TS9002: Computed property names are not currently supported.
\ No newline at end of file
+!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
+ ~
+!!! error TS2304: Cannot find name 'e'.
\ No newline at end of file
diff --git a/tests/baselines/reference/parserComputedPropertyName4.js b/tests/baselines/reference/parserComputedPropertyName4.js
new file mode 100644
index 00000000000..a88545566e6
--- /dev/null
+++ b/tests/baselines/reference/parserComputedPropertyName4.js
@@ -0,0 +1,6 @@
+//// [parserComputedPropertyName4.ts]
+var v = { get [e]() { } };
+
+//// [parserComputedPropertyName4.js]
+var v = { get [e]() {
+} };
diff --git a/tests/baselines/reference/parserComputedPropertyName40.errors.txt b/tests/baselines/reference/parserComputedPropertyName40.errors.txt
index 93be0ad51b7..862836ae47d 100644
--- a/tests/baselines/reference/parserComputedPropertyName40.errors.txt
+++ b/tests/baselines/reference/parserComputedPropertyName40.errors.txt
@@ -1,9 +1,9 @@
-tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName40.ts(2,5): error TS9002: Computed property names are not currently supported.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName40.ts(2,6): error TS2304: Cannot find name 'a'.
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName40.ts (1 errors) ====
class C {
[a ? "" : ""]() {}
- ~~~~~~~~~~~~~
-!!! error TS9002: Computed property names are not currently supported.
+ ~
+!!! error TS2304: Cannot find name 'a'.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/parserComputedPropertyName40.js b/tests/baselines/reference/parserComputedPropertyName40.js
new file mode 100644
index 00000000000..5f6381360fc
--- /dev/null
+++ b/tests/baselines/reference/parserComputedPropertyName40.js
@@ -0,0 +1,13 @@
+//// [parserComputedPropertyName40.ts]
+class C {
+ [a ? "" : ""]() {}
+}
+
+//// [parserComputedPropertyName40.js]
+var C = (function () {
+ function C() {
+ }
+ C.prototype[a ? "" : ""] = function () {
+ };
+ return C;
+})();
diff --git a/tests/baselines/reference/parserComputedPropertyName41.errors.txt b/tests/baselines/reference/parserComputedPropertyName41.errors.txt
index eb5e9a9ebbf..65d4ec8627f 100644
--- a/tests/baselines/reference/parserComputedPropertyName41.errors.txt
+++ b/tests/baselines/reference/parserComputedPropertyName41.errors.txt
@@ -1,9 +1,9 @@
-tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName41.ts(2,5): error TS9002: Computed property names are not currently supported.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName41.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName41.ts (1 errors) ====
var v = {
[0 in []]: true
~~~~~~~~~
-!!! error TS9002: Computed property names are not currently supported.
+!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/parserComputedPropertyName41.js b/tests/baselines/reference/parserComputedPropertyName41.js
new file mode 100644
index 00000000000..b19cc3e7b3f
--- /dev/null
+++ b/tests/baselines/reference/parserComputedPropertyName41.js
@@ -0,0 +1,9 @@
+//// [parserComputedPropertyName41.ts]
+var v = {
+ [0 in []]: true
+}
+
+//// [parserComputedPropertyName41.js]
+var v = {
+ [0 in []]: true
+};
diff --git a/tests/baselines/reference/parserComputedPropertyName5.errors.txt b/tests/baselines/reference/parserComputedPropertyName5.errors.txt
index f0dd056fdf9..07cc6f3a9f0 100644
--- a/tests/baselines/reference/parserComputedPropertyName5.errors.txt
+++ b/tests/baselines/reference/parserComputedPropertyName5.errors.txt
@@ -1,7 +1,10 @@
-tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName5.ts(1,22): error TS9002: Computed property names are not currently supported.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName5.ts(1,22): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName5.ts(1,23): error TS2304: Cannot find name 'e'.
-==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName5.ts (1 errors) ====
+==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName5.ts (2 errors) ====
var v = { public get [e]() { } };
~~~
-!!! error TS9002: Computed property names are not currently supported.
\ No newline at end of file
+!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
+ ~
+!!! error TS2304: Cannot find name 'e'.
\ No newline at end of file
diff --git a/tests/baselines/reference/parserComputedPropertyName5.js b/tests/baselines/reference/parserComputedPropertyName5.js
new file mode 100644
index 00000000000..aa86d54d09c
--- /dev/null
+++ b/tests/baselines/reference/parserComputedPropertyName5.js
@@ -0,0 +1,6 @@
+//// [parserComputedPropertyName5.ts]
+var v = { public get [e]() { } };
+
+//// [parserComputedPropertyName5.js]
+var v = { get [e]() {
+} };
diff --git a/tests/baselines/reference/parserComputedPropertyName6.errors.txt b/tests/baselines/reference/parserComputedPropertyName6.errors.txt
index 893bf3da719..90f1b688408 100644
--- a/tests/baselines/reference/parserComputedPropertyName6.errors.txt
+++ b/tests/baselines/reference/parserComputedPropertyName6.errors.txt
@@ -1,10 +1,13 @@
-tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName6.ts(1,11): error TS9002: Computed property names are not currently supported.
-tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName6.ts(1,19): error TS9002: Computed property names are not currently supported.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName6.ts(1,12): error TS2304: Cannot find name 'e'.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName6.ts(1,20): error TS2304: Cannot find name 'e'.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName6.ts(1,24): error TS2304: Cannot find name 'e'.
-==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName6.ts (2 errors) ====
+==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName6.ts (3 errors) ====
var v = { [e]: 1, [e + e]: 2 };
- ~~~
-!!! error TS9002: Computed property names are not currently supported.
- ~~~~~~~
-!!! error TS9002: Computed property names are not currently supported.
\ No newline at end of file
+ ~
+!!! error TS2304: Cannot find name 'e'.
+ ~
+!!! error TS2304: Cannot find name 'e'.
+ ~
+!!! error TS2304: Cannot find name 'e'.
\ No newline at end of file
diff --git a/tests/baselines/reference/parserComputedPropertyName6.js b/tests/baselines/reference/parserComputedPropertyName6.js
new file mode 100644
index 00000000000..b60ad66a9d8
--- /dev/null
+++ b/tests/baselines/reference/parserComputedPropertyName6.js
@@ -0,0 +1,5 @@
+//// [parserComputedPropertyName6.ts]
+var v = { [e]: 1, [e + e]: 2 };
+
+//// [parserComputedPropertyName6.js]
+var v = { [e]: 1, [e + e]: 2 };
diff --git a/tests/baselines/reference/parserComputedPropertyName7.errors.txt b/tests/baselines/reference/parserComputedPropertyName7.errors.txt
index 21147be3074..bcf39b0ca0a 100644
--- a/tests/baselines/reference/parserComputedPropertyName7.errors.txt
+++ b/tests/baselines/reference/parserComputedPropertyName7.errors.txt
@@ -1,9 +1,12 @@
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName7.ts(2,4): error TS1166: Computed property names are not allowed in class property declarations.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName7.ts(2,5): error TS2304: Cannot find name 'e'.
-==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName7.ts (1 errors) ====
+==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName7.ts (2 errors) ====
class C {
[e]
~~~
!!! error TS1166: Computed property names are not allowed in class property declarations.
+ ~
+!!! error TS2304: Cannot find name 'e'.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/parserComputedPropertyName8.errors.txt b/tests/baselines/reference/parserComputedPropertyName8.errors.txt
index 75352ec9e51..250c7a52c6e 100644
--- a/tests/baselines/reference/parserComputedPropertyName8.errors.txt
+++ b/tests/baselines/reference/parserComputedPropertyName8.errors.txt
@@ -1,9 +1,12 @@
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName8.ts(2,11): error TS1166: Computed property names are not allowed in class property declarations.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName8.ts(2,12): error TS2304: Cannot find name 'e'.
-==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName8.ts (1 errors) ====
+==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName8.ts (2 errors) ====
class C {
public [e]
~~~
!!! error TS1166: Computed property names are not allowed in class property declarations.
+ ~
+!!! error TS2304: Cannot find name 'e'.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/parserComputedPropertyName9.errors.txt b/tests/baselines/reference/parserComputedPropertyName9.errors.txt
index eb5cfd28d73..fd434046564 100644
--- a/tests/baselines/reference/parserComputedPropertyName9.errors.txt
+++ b/tests/baselines/reference/parserComputedPropertyName9.errors.txt
@@ -1,12 +1,15 @@
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName9.ts(2,4): error TS1166: Computed property names are not allowed in class property declarations.
+tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName9.ts(2,5): error TS2304: Cannot find name 'e'.
tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName9.ts(2,9): error TS2304: Cannot find name 'Type'.
-==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName9.ts (2 errors) ====
+==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName9.ts (3 errors) ====
class C {
[e]: Type
~~~
!!! error TS1166: Computed property names are not allowed in class property declarations.
+ ~
+!!! error TS2304: Cannot find name 'e'.
~~~~
!!! error TS2304: Cannot find name 'Type'.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/parserES5ComputedPropertyName1.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName1.errors.txt
index 5bae79b95aa..55af923e54b 100644
--- a/tests/baselines/reference/parserES5ComputedPropertyName1.errors.txt
+++ b/tests/baselines/reference/parserES5ComputedPropertyName1.errors.txt
@@ -1,9 +1,12 @@
tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName1.ts(2,5): error TS1166: Computed property names are not allowed in class property declarations.
+tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName1.ts(2,6): error TS2304: Cannot find name 'e'.
-==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName1.ts (1 errors) ====
+==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName1.ts (2 errors) ====
declare class C {
[e]: number
~~~
!!! error TS1166: Computed property names are not allowed in class property declarations.
+ ~
+!!! error TS2304: Cannot find name 'e'.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/parserES5ComputedPropertyName10.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName10.errors.txt
index 40bec1b4f38..7db85cdef35 100644
--- a/tests/baselines/reference/parserES5ComputedPropertyName10.errors.txt
+++ b/tests/baselines/reference/parserES5ComputedPropertyName10.errors.txt
@@ -1,9 +1,12 @@
tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName10.ts(2,4): error TS1166: Computed property names are not allowed in class property declarations.
+tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName10.ts(2,5): error TS2304: Cannot find name 'e'.
-==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName10.ts (1 errors) ====
+==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName10.ts (2 errors) ====
class C {
[e] = 1
~~~
!!! error TS1166: Computed property names are not allowed in class property declarations.
+ ~
+!!! error TS2304: Cannot find name 'e'.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/parserES5ComputedPropertyName11.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName11.errors.txt
index 124db7da75a..ead27a994d1 100644
--- a/tests/baselines/reference/parserES5ComputedPropertyName11.errors.txt
+++ b/tests/baselines/reference/parserES5ComputedPropertyName11.errors.txt
@@ -1,9 +1,12 @@
tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName11.ts(2,4): error TS1168: Computed property names are not allowed in method overloads.
+tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName11.ts(2,5): error TS2304: Cannot find name 'e'.
-==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName11.ts (1 errors) ====
+==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName11.ts (2 errors) ====
class C {
[e]();
~~~
!!! error TS1168: Computed property names are not allowed in method overloads.
+ ~
+!!! error TS2304: Cannot find name 'e'.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/parserES5ComputedPropertyName2.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName2.errors.txt
index 7b6b74b8fd8..5918387942d 100644
--- a/tests/baselines/reference/parserES5ComputedPropertyName2.errors.txt
+++ b/tests/baselines/reference/parserES5ComputedPropertyName2.errors.txt
@@ -1,7 +1,10 @@
-tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName2.ts(1,11): error TS9002: Computed property names are not currently supported.
+tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName2.ts(1,11): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
+tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName2.ts(1,12): error TS2304: Cannot find name 'e'.
-==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName2.ts (1 errors) ====
+==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName2.ts (2 errors) ====
var v = { [e]: 1 };
~~~
-!!! error TS9002: Computed property names are not currently supported.
\ No newline at end of file
+!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
+ ~
+!!! error TS2304: Cannot find name 'e'.
\ No newline at end of file
diff --git a/tests/baselines/reference/parserES5ComputedPropertyName3.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName3.errors.txt
index 669fd190265..097ab1ea9cb 100644
--- a/tests/baselines/reference/parserES5ComputedPropertyName3.errors.txt
+++ b/tests/baselines/reference/parserES5ComputedPropertyName3.errors.txt
@@ -1,7 +1,10 @@
-tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName3.ts(1,11): error TS9002: Computed property names are not currently supported.
+tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName3.ts(1,11): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
+tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName3.ts(1,12): error TS2304: Cannot find name 'e'.
-==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName3.ts (1 errors) ====
+==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName3.ts (2 errors) ====
var v = { [e]() { } };
~~~
-!!! error TS9002: Computed property names are not currently supported.
\ No newline at end of file
+!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
+ ~
+!!! error TS2304: Cannot find name 'e'.
\ No newline at end of file
diff --git a/tests/baselines/reference/parserES5ComputedPropertyName4.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName4.errors.txt
index af0c6e858ad..ca69791c93c 100644
--- a/tests/baselines/reference/parserES5ComputedPropertyName4.errors.txt
+++ b/tests/baselines/reference/parserES5ComputedPropertyName4.errors.txt
@@ -1,7 +1,13 @@
-tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts(1,15): error TS9002: Computed property names are not currently supported.
+tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts(1,15): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
+tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts(1,15): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
+tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts(1,16): error TS2304: Cannot find name 'e'.
-==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts (1 errors) ====
+==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts (3 errors) ====
var v = { get [e]() { } };
~~~
-!!! error TS9002: Computed property names are not currently supported.
\ No newline at end of file
+!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher.
+ ~~~
+!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
+ ~
+!!! error TS2304: Cannot find name 'e'.
\ No newline at end of file
diff --git a/tests/baselines/reference/parserES5ComputedPropertyName5.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName5.errors.txt
index 8eeeef1516f..122ca20a0e4 100644
--- a/tests/baselines/reference/parserES5ComputedPropertyName5.errors.txt
+++ b/tests/baselines/reference/parserES5ComputedPropertyName5.errors.txt
@@ -1,9 +1,12 @@
tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName5.ts(2,5): error TS1169: Computed property names are not allowed in interfaces.
+tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName5.ts(2,6): error TS2304: Cannot find name 'e'.
-==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName5.ts (1 errors) ====
+==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName5.ts (2 errors) ====
interface I {
[e]: number
~~~
!!! error TS1169: Computed property names are not allowed in interfaces.
+ ~
+!!! error TS2304: Cannot find name 'e'.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/parserES5ComputedPropertyName7.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName7.errors.txt
index 6aefd27ef58..d38d57d87be 100644
--- a/tests/baselines/reference/parserES5ComputedPropertyName7.errors.txt
+++ b/tests/baselines/reference/parserES5ComputedPropertyName7.errors.txt
@@ -1,9 +1,12 @@
tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName7.ts(2,4): error TS1166: Computed property names are not allowed in class property declarations.
+tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName7.ts(2,5): error TS2304: Cannot find name 'e'.
-==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName7.ts (1 errors) ====
+==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName7.ts (2 errors) ====
class C {
[e]
~~~
!!! error TS1166: Computed property names are not allowed in class property declarations.
+ ~
+!!! error TS2304: Cannot find name 'e'.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/parserES5ComputedPropertyName8.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName8.errors.txt
index 4595081c145..e52727c6929 100644
--- a/tests/baselines/reference/parserES5ComputedPropertyName8.errors.txt
+++ b/tests/baselines/reference/parserES5ComputedPropertyName8.errors.txt
@@ -1,7 +1,10 @@
tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName8.ts(1,10): error TS1170: Computed property names are not allowed in type literals.
+tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName8.ts(1,11): error TS2304: Cannot find name 'e'.
-==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName8.ts (1 errors) ====
+==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName8.ts (2 errors) ====
var v: { [e]: number };
~~~
-!!! error TS1170: Computed property names are not allowed in type literals.
\ No newline at end of file
+!!! error TS1170: Computed property names are not allowed in type literals.
+ ~
+!!! error TS2304: Cannot find name 'e'.
\ No newline at end of file
diff --git a/tests/baselines/reference/parserES5ComputedPropertyName9.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName9.errors.txt
index 6d035a7c610..8cbe0ffcf8d 100644
--- a/tests/baselines/reference/parserES5ComputedPropertyName9.errors.txt
+++ b/tests/baselines/reference/parserES5ComputedPropertyName9.errors.txt
@@ -1,12 +1,15 @@
tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName9.ts(2,4): error TS1166: Computed property names are not allowed in class property declarations.
+tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName9.ts(2,5): error TS2304: Cannot find name 'e'.
tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName9.ts(2,9): error TS2304: Cannot find name 'Type'.
-==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName9.ts (2 errors) ====
+==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName9.ts (3 errors) ====
class C {
[e]: Type
~~~
!!! error TS1166: Computed property names are not allowed in class property declarations.
+ ~
+!!! error TS2304: Cannot find name 'e'.
~~~~
!!! error TS2304: Cannot find name 'Type'.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/parserIndexSignature11.errors.txt b/tests/baselines/reference/parserIndexSignature11.errors.txt
index c9976e2bc4a..8cf474b19bb 100644
--- a/tests/baselines/reference/parserIndexSignature11.errors.txt
+++ b/tests/baselines/reference/parserIndexSignature11.errors.txt
@@ -1,13 +1,16 @@
tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts(2,9): error TS1169: Computed property names are not allowed in interfaces.
+tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts(2,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.
-==== tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts (3 errors) ====
+==== tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts (4 errors) ====
interface I {
- [p];
+ [p]; // Used to be indexer, now it is a computed property
~~~
!!! error TS1169: Computed property names are not allowed in interfaces.
+ ~
+!!! error TS2304: Cannot find name 'p'.
[p1: string];
~~~~~~~~~~~~~
!!! error TS1021: An index signature must have a type annotation.
diff --git a/tests/baselines/reference/parserIndexSignature4.errors.txt b/tests/baselines/reference/parserIndexSignature4.errors.txt
index 0f11eb17f3c..d625f27eb6f 100644
--- a/tests/baselines/reference/parserIndexSignature4.errors.txt
+++ b/tests/baselines/reference/parserIndexSignature4.errors.txt
@@ -1,9 +1,12 @@
tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature4.ts(2,3): error TS1169: Computed property names are not allowed in interfaces.
+tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature4.ts(2,4): error TS2304: Cannot find name 'a'.
-==== tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature4.ts (1 errors) ====
+==== tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature4.ts (2 errors) ====
interface I {
- [a = 0]
+ [a = 0] // Used to be indexer, now it is a computed property
~~~~~~~
!!! error TS1169: Computed property names are not allowed in interfaces.
+ ~
+!!! error TS2304: Cannot find name 'a'.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/parserIndexSignature5.errors.txt b/tests/baselines/reference/parserIndexSignature5.errors.txt
index 6400383f9d2..3f3415973d9 100644
--- a/tests/baselines/reference/parserIndexSignature5.errors.txt
+++ b/tests/baselines/reference/parserIndexSignature5.errors.txt
@@ -1,9 +1,12 @@
tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature5.ts(2,3): error TS1169: Computed property names are not allowed in interfaces.
+tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature5.ts(2,4): error TS2304: Cannot find name 'a'.
-==== tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature5.ts (1 errors) ====
+==== tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature5.ts (2 errors) ====
interface I {
- [a]
+ [a] // Used to be indexer, now it is a computed property
~~~
!!! error TS1169: Computed property names are not allowed in interfaces.
+ ~
+!!! error TS2304: Cannot find name 'a'.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/privateIndexer2.errors.txt b/tests/baselines/reference/privateIndexer2.errors.txt
index 8d3c1ec1e6d..405167d68f8 100644
--- a/tests/baselines/reference/privateIndexer2.errors.txt
+++ b/tests/baselines/reference/privateIndexer2.errors.txt
@@ -1,17 +1,20 @@
tests/cases/conformance/classes/indexMemberDeclarations/privateIndexer2.ts(4,15): error TS1005: ']' expected.
+tests/cases/conformance/classes/indexMemberDeclarations/privateIndexer2.ts(4,17): error TS2304: Cannot find name 'string'.
tests/cases/conformance/classes/indexMemberDeclarations/privateIndexer2.ts(4,23): error TS1005: ',' expected.
tests/cases/conformance/classes/indexMemberDeclarations/privateIndexer2.ts(4,24): error TS1136: Property assignment expected.
tests/cases/conformance/classes/indexMemberDeclarations/privateIndexer2.ts(4,32): error TS1005: ':' expected.
tests/cases/conformance/classes/indexMemberDeclarations/privateIndexer2.ts(5,1): error TS1128: Declaration or statement expected.
-==== tests/cases/conformance/classes/indexMemberDeclarations/privateIndexer2.ts (5 errors) ====
+==== tests/cases/conformance/classes/indexMemberDeclarations/privateIndexer2.ts (6 errors) ====
// private indexers not allowed
var x = {
private [x: string]: string;
~
!!! error TS1005: ']' expected.
+ ~~~~~~
+!!! error TS2304: Cannot find name 'string'.
~
!!! error TS1005: ',' expected.
~
diff --git a/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/amd/mapRootSourceRootWithNoSourceMapOption.errors.txt b/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/amd/mapRootSourceRootWithNoSourceMapOption.errors.txt
index 4f41f7523d7..0d3528b6dc3 100644
--- a/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/amd/mapRootSourceRootWithNoSourceMapOption.errors.txt
+++ b/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/amd/mapRootSourceRootWithNoSourceMapOption.errors.txt
@@ -1,9 +1,9 @@
-error TS5039: Option sourceRoot cannot be specified without specifying sourcemap option.
-error TS5038: Option mapRoot cannot be specified without specifying sourcemap option.
+error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option.
+error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourcemap' option.
-!!! error TS5039: Option sourceRoot cannot be specified without specifying sourcemap option.
-!!! error TS5038: Option mapRoot cannot be specified without specifying sourcemap option.
+!!! error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option.
+!!! error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourcemap' option.
==== m1.ts (0 errors) ====
var m1_a1 = 10;
class m1_c1 {
diff --git a/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/node/mapRootSourceRootWithNoSourceMapOption.errors.txt b/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/node/mapRootSourceRootWithNoSourceMapOption.errors.txt
index 4f41f7523d7..0d3528b6dc3 100644
--- a/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/node/mapRootSourceRootWithNoSourceMapOption.errors.txt
+++ b/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/node/mapRootSourceRootWithNoSourceMapOption.errors.txt
@@ -1,9 +1,9 @@
-error TS5039: Option sourceRoot cannot be specified without specifying sourcemap option.
-error TS5038: Option mapRoot cannot be specified without specifying sourcemap option.
+error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option.
+error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourcemap' option.
-!!! error TS5039: Option sourceRoot cannot be specified without specifying sourcemap option.
-!!! error TS5038: Option mapRoot cannot be specified without specifying sourcemap option.
+!!! error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option.
+!!! error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourcemap' option.
==== m1.ts (0 errors) ====
var m1_a1 = 10;
class m1_c1 {
diff --git a/tests/baselines/reference/project/mapRootWithNoSourceMapOption/amd/mapRootWithNoSourceMapOption.errors.txt b/tests/baselines/reference/project/mapRootWithNoSourceMapOption/amd/mapRootWithNoSourceMapOption.errors.txt
index de6de5ecfc6..01a3526196c 100644
--- a/tests/baselines/reference/project/mapRootWithNoSourceMapOption/amd/mapRootWithNoSourceMapOption.errors.txt
+++ b/tests/baselines/reference/project/mapRootWithNoSourceMapOption/amd/mapRootWithNoSourceMapOption.errors.txt
@@ -1,7 +1,7 @@
-error TS5038: Option mapRoot cannot be specified without specifying sourcemap option.
+error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourcemap' option.
-!!! error TS5038: Option mapRoot cannot be specified without specifying sourcemap option.
+!!! error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourcemap' option.
==== m1.ts (0 errors) ====
var m1_a1 = 10;
class m1_c1 {
diff --git a/tests/baselines/reference/project/mapRootWithNoSourceMapOption/node/mapRootWithNoSourceMapOption.errors.txt b/tests/baselines/reference/project/mapRootWithNoSourceMapOption/node/mapRootWithNoSourceMapOption.errors.txt
index de6de5ecfc6..01a3526196c 100644
--- a/tests/baselines/reference/project/mapRootWithNoSourceMapOption/node/mapRootWithNoSourceMapOption.errors.txt
+++ b/tests/baselines/reference/project/mapRootWithNoSourceMapOption/node/mapRootWithNoSourceMapOption.errors.txt
@@ -1,7 +1,7 @@
-error TS5038: Option mapRoot cannot be specified without specifying sourcemap option.
+error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourcemap' option.
-!!! error TS5038: Option mapRoot cannot be specified without specifying sourcemap option.
+!!! error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourcemap' option.
==== m1.ts (0 errors) ====
var m1_a1 = 10;
class m1_c1 {
diff --git a/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/amd/sourceRootWithNoSourceMapOption.errors.txt b/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/amd/sourceRootWithNoSourceMapOption.errors.txt
index 93a57bb27f5..b7abc0c2d52 100644
--- a/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/amd/sourceRootWithNoSourceMapOption.errors.txt
+++ b/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/amd/sourceRootWithNoSourceMapOption.errors.txt
@@ -1,7 +1,7 @@
-error TS5039: Option sourceRoot cannot be specified without specifying sourcemap option.
+error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option.
-!!! error TS5039: Option sourceRoot cannot be specified without specifying sourcemap option.
+!!! error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option.
==== m1.ts (0 errors) ====
var m1_a1 = 10;
class m1_c1 {
diff --git a/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/node/sourceRootWithNoSourceMapOption.errors.txt b/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/node/sourceRootWithNoSourceMapOption.errors.txt
index 93a57bb27f5..b7abc0c2d52 100644
--- a/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/node/sourceRootWithNoSourceMapOption.errors.txt
+++ b/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/node/sourceRootWithNoSourceMapOption.errors.txt
@@ -1,7 +1,7 @@
-error TS5039: Option sourceRoot cannot be specified without specifying sourcemap option.
+error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option.
-!!! error TS5039: Option sourceRoot cannot be specified without specifying sourcemap option.
+!!! error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option.
==== m1.ts (0 errors) ====
var m1_a1 = 10;
class m1_c1 {
diff --git a/tests/baselines/reference/propertyAccess.errors.txt b/tests/baselines/reference/propertyAccess.errors.txt
index fefe929196c..5cffcbec64c 100644
--- a/tests/baselines/reference/propertyAccess.errors.txt
+++ b/tests/baselines/reference/propertyAccess.errors.txt
@@ -1,16 +1,16 @@
-tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(9,22): error TS2304: Cannot find name 'HTMLElement'.
-tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(10,22): error TS2304: Cannot find name 'HTMLDivElement'.
-tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(37,14): error TS2339: Property 'qqq' does not exist on type '{ 10: string; x: string; y: number; z: { n: string; m: number; o: () => boolean; }; 'literal property': number; }'.
-tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(72,19): error TS2304: Cannot find name 'window'.
-tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(109,18): error TS2304: Cannot find name 'window'.
-tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(117,9): error TS2304: Cannot find name 'HTMLDivElement'.
-tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(121,9): error TS2304: Cannot find name 'HTMLDivElement'.
-tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(125,9): error TS2304: Cannot find name 'HTMLElement'.
-tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(129,9): error TS2304: Cannot find name 'HTMLElement'.
-tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(132,22): error TS2304: Cannot find name 'window'.
+tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(45,14): error TS2339: Property 'qqq' does not exist on type '{ 10: string; x: string; y: number; z: { n: string; m: number; o: () => boolean; }; 'literal property': number; }'.
+tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(80,10): error TS2342: An index expression argument must be of type 'string', 'number', or 'any'.
+tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(117,10): error TS2342: An index expression argument must be of type 'string', 'number', or 'any'.
+tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(140,12): error TS2342: An index expression argument must be of type 'string', 'number', or 'any'.
-==== tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts (10 errors) ====
+==== tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts (4 errors) ====
+ class A {
+ a: number;
+ }
+ class B extends A {
+ b: number;
+ }
enum Compass {
North, South, East, West
}
@@ -19,12 +19,8 @@ tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(132,22): er
var strIndex: { [n: string]: Compass } = { 'N': Compass.North, 'E': Compass.East };
var bothIndex:
{
- [n: string]: HTMLElement;
- ~~~~~~~~~~~
-!!! error TS2304: Cannot find name 'HTMLElement'.
- [m: number]: HTMLDivElement;
- ~~~~~~~~~~~~~~
-!!! error TS2304: Cannot find name 'HTMLDivElement'.
+ [n: string]: A;
+ [m: number]: B;
};
function noIndex() { }
@@ -37,6 +33,8 @@ tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(132,22): er
'literal property': 100
};
var anyVar: any = {};
+ var stringOrNumber: string | number;
+ var someObject: { name: string };
// Assign to a property access
obj.y = 4;
@@ -88,9 +86,9 @@ tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(132,22): er
var kk: any;
// Bracket notation property access using value of other type on type with numeric index signature and no string index signature
- var ll = numIndex[window]; // Error
- ~~~~~~
-!!! error TS2304: Cannot find name 'window'.
+ var ll = numIndex[someObject]; // Error
+ ~~~~~~~~~~~~~~~~~~~~
+!!! error TS2342: An index expression argument must be of type 'string', 'number', or 'any'.
// Bracket notation property access using string value on type with string index signature and no numeric index signature
var mm = strIndex['N'];
@@ -127,9 +125,9 @@ tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(132,22): er
var tt: any;
// Bracket notation property access using values of other types on type with no index signatures
- var uu = noIndex[window]; // Error
- ~~~~~~
-!!! error TS2304: Cannot find name 'window'.
+ var uu = noIndex[someObject]; // Error
+ ~~~~~~~~~~~~~~~~~~~
+!!! error TS2342: An index expression argument must be of type 'string', 'number', or 'any'.
// Bracket notation property access using numeric value on type with numeric index signature and string index signature
var vv = noIndex[32];
@@ -137,29 +135,31 @@ tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(132,22): er
// Bracket notation property access using enum value on type with numeric index signature and string index signature
var ww = bothIndex[Compass.East];
- var ww: HTMLDivElement;
- ~~~~~~~~~~~~~~
-!!! error TS2304: Cannot find name 'HTMLDivElement'.
+ var ww: B;
// Bracket notation property access using value of type 'any' on type with numeric index signature and string index signature
var xx = bothIndex[null];
- var xx: HTMLDivElement;
- ~~~~~~~~~~~~~~
-!!! error TS2304: Cannot find name 'HTMLDivElement'.
+ var xx: B;
// Bracket notation property access using string value on type with numeric index signature and string index signature
var yy = bothIndex['foo'];
- var yy: HTMLElement;
- ~~~~~~~~~~~
-!!! error TS2304: Cannot find name 'HTMLElement'.
+ var yy: A;
// Bracket notation property access using numeric string value on type with numeric index signature and string index signature
var zz = bothIndex['1.0'];
- var zz: HTMLElement;
- ~~~~~~~~~~~
-!!! error TS2304: Cannot find name 'HTMLElement'.
+ var zz: A;
// Bracket notation property access using value of other type on type with numeric index signature and no string index signature and string index signature
- var zzzz = bothIndex[window]; // Error
- ~~~~~~
-!!! error TS2304: Cannot find name 'window'.
\ No newline at end of file
+ var zzzz = bothIndex[someObject]; // Error
+ ~~~~~~~~~~~~~~~~~~~~~
+!!! error TS2342: An index expression argument must be of type 'string', 'number', or 'any'.
+
+ var x1 = numIndex[stringOrNumber];
+ var x1: any;
+
+ var x2 = strIndex[stringOrNumber];
+ var x2: Compass;
+
+ var x3 = bothIndex[stringOrNumber];
+ var x3: A;
+
\ No newline at end of file
diff --git a/tests/baselines/reference/propertyAccess.js b/tests/baselines/reference/propertyAccess.js
index 594bdcd84c2..e0b89f39de0 100644
--- a/tests/baselines/reference/propertyAccess.js
+++ b/tests/baselines/reference/propertyAccess.js
@@ -1,4 +1,10 @@
//// [propertyAccess.ts]
+class A {
+ a: number;
+}
+class B extends A {
+ b: number;
+}
enum Compass {
North, South, East, West
}
@@ -7,8 +13,8 @@ var numIndex: { [n: number]: string } = { 3: 'three', 'three': 'three' };
var strIndex: { [n: string]: Compass } = { 'N': Compass.North, 'E': Compass.East };
var bothIndex:
{
- [n: string]: HTMLElement;
- [m: number]: HTMLDivElement;
+ [n: string]: A;
+ [m: number]: B;
};
function noIndex() { }
@@ -21,6 +27,8 @@ var obj = {
'literal property': 100
};
var anyVar: any = {};
+var stringOrNumber: string | number;
+var someObject: { name: string };
// Assign to a property access
obj.y = 4;
@@ -70,7 +78,7 @@ var kk = numIndex['what'];
var kk: any;
// Bracket notation property access using value of other type on type with numeric index signature and no string index signature
-var ll = numIndex[window]; // Error
+var ll = numIndex[someObject]; // Error
// Bracket notation property access using string value on type with string index signature and no numeric index signature
var mm = strIndex['N'];
@@ -107,7 +115,7 @@ var tt = noIndex[null];
var tt: any;
// Bracket notation property access using values of other types on type with no index signatures
-var uu = noIndex[window]; // Error
+var uu = noIndex[someObject]; // Error
// Bracket notation property access using numeric value on type with numeric index signature and string index signature
var vv = noIndex[32];
@@ -115,24 +123,52 @@ var vv: any;
// Bracket notation property access using enum value on type with numeric index signature and string index signature
var ww = bothIndex[Compass.East];
-var ww: HTMLDivElement;
+var ww: B;
// Bracket notation property access using value of type 'any' on type with numeric index signature and string index signature
var xx = bothIndex[null];
-var xx: HTMLDivElement;
+var xx: B;
// Bracket notation property access using string value on type with numeric index signature and string index signature
var yy = bothIndex['foo'];
-var yy: HTMLElement;
+var yy: A;
// Bracket notation property access using numeric string value on type with numeric index signature and string index signature
var zz = bothIndex['1.0'];
-var zz: HTMLElement;
+var zz: A;
// Bracket notation property access using value of other type on type with numeric index signature and no string index signature and string index signature
-var zzzz = bothIndex[window]; // Error
+var zzzz = bothIndex[someObject]; // Error
+
+var x1 = numIndex[stringOrNumber];
+var x1: any;
+
+var x2 = strIndex[stringOrNumber];
+var x2: Compass;
+
+var x3 = bothIndex[stringOrNumber];
+var x3: A;
+
//// [propertyAccess.js]
+var __extends = this.__extends || function (d, b) {
+ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
+ function __() { this.constructor = d; }
+ __.prototype = b.prototype;
+ d.prototype = new __();
+};
+var A = (function () {
+ function A() {
+ }
+ return A;
+})();
+var B = (function (_super) {
+ __extends(B, _super);
+ function B() {
+ _super.apply(this, arguments);
+ }
+ return B;
+})(A);
var Compass;
(function (Compass) {
Compass[Compass["North"] = 0] = "North";
@@ -153,6 +189,8 @@ var obj = {
'literal property': 100
};
var anyVar = {};
+var stringOrNumber;
+var someObject;
// Assign to a property access
obj.y = 4;
// Property access on value of type 'any'
@@ -188,7 +226,7 @@ var jj;
var kk = numIndex['what'];
var kk;
// Bracket notation property access using value of other type on type with numeric index signature and no string index signature
-var ll = numIndex[window]; // Error
+var ll = numIndex[someObject]; // Error
// Bracket notation property access using string value on type with string index signature and no numeric index signature
var mm = strIndex['N'];
var mm;
@@ -216,7 +254,7 @@ var ss;
var tt = noIndex[null];
var tt;
// Bracket notation property access using values of other types on type with no index signatures
-var uu = noIndex[window]; // Error
+var uu = noIndex[someObject]; // Error
// Bracket notation property access using numeric value on type with numeric index signature and string index signature
var vv = noIndex[32];
var vv;
@@ -233,4 +271,10 @@ var yy;
var zz = bothIndex['1.0'];
var zz;
// Bracket notation property access using value of other type on type with numeric index signature and no string index signature and string index signature
-var zzzz = bothIndex[window]; // Error
+var zzzz = bothIndex[someObject]; // Error
+var x1 = numIndex[stringOrNumber];
+var x1;
+var x2 = strIndex[stringOrNumber];
+var x2;
+var x3 = bothIndex[stringOrNumber];
+var x3;
diff --git a/tests/baselines/reference/propertyAssignment.errors.txt b/tests/baselines/reference/propertyAssignment.errors.txt
index 2ea55a1a2d3..51850754a9a 100644
--- a/tests/baselines/reference/propertyAssignment.errors.txt
+++ b/tests/baselines/reference/propertyAssignment.errors.txt
@@ -1,17 +1,20 @@
tests/cases/compiler/propertyAssignment.ts(6,13): error TS1170: Computed property names are not allowed in type literals.
+tests/cases/compiler/propertyAssignment.ts(6,14): error TS2304: Cannot find name 'index'.
tests/cases/compiler/propertyAssignment.ts(14,1): error TS2322: Type '{ x: number; }' is not assignable to type 'new () => any'.
tests/cases/compiler/propertyAssignment.ts(16,1): error TS2322: Type '{ x: number; }' is not assignable to type '() => void'.
-==== tests/cases/compiler/propertyAssignment.ts (3 errors) ====
+==== tests/cases/compiler/propertyAssignment.ts (4 errors) ====
var foo1: { new ():any; }
var bar1: { x : number; }
- var foo2: { [index]; } // should be an error
+ var foo2: { [index]; } // should be an error, used to be indexer, now it is a computed property
~~~~~~~
!!! error TS1170: Computed property names are not allowed in type literals.
+ ~~~~~
+!!! error TS2304: Cannot find name 'index'.
var bar2: { x : number; }
var foo3: { ():void; }
diff --git a/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.js b/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.js
index dd8028b086a..c0abe985dbc 100644
--- a/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.js
+++ b/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.js
@@ -74,32 +74,4 @@ declare module MsPortal.Controls.Base.ItemList {
class ViewModel extends ItemValue {
}
}
-module MsPortal.Controls.Base.ItemList {
-
- export interface Interface {
- // Removing this line fixes the constructor of ItemValue
- options: ViewModel;
- }
-
- export class ItemValue {
- constructor(value: T) {
- }
- }
-
- export class ViewModel extends ItemValue {
- }
-}
-
-// Generates:
-/*
-declare module MsPortal.Controls.Base.ItemList {
- interface Interface {
- options: ViewModel;
- }
- class ItemValue {
- constructor(value: T);
- }
- class ViewModel extends ItemValue {
- }
-}
-
+*/
diff --git a/tests/baselines/reference/stringLiteralTypesInImplementationSignatures2.errors.txt b/tests/baselines/reference/stringLiteralTypesInImplementationSignatures2.errors.txt
index cbc517e0520..3cc172c96d5 100644
--- a/tests/baselines/reference/stringLiteralTypesInImplementationSignatures2.errors.txt
+++ b/tests/baselines/reference/stringLiteralTypesInImplementationSignatures2.errors.txt
@@ -11,9 +11,10 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralType
tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(26,5): error TS2300: Duplicate identifier 'foo'.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(26,5): error TS2381: A signature with an implementation cannot use a string literal type.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(27,5): error TS2300: Duplicate identifier 'foo'.
+tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(27,5): error TS2381: A signature with an implementation cannot use a string literal type.
-==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts (13 errors) ====
+==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts (14 errors) ====
// String literal types are only valid in overload signatures
function foo(x: any);
@@ -67,5 +68,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralType
foo(x: 'a') { },
~~~
!!! error TS2300: Duplicate identifier 'foo'.
+ ~~~~~~~~~~~~~~~
+!!! error TS2381: A signature with an implementation cannot use a string literal type.
}
\ No newline at end of file
diff --git a/tests/baselines/reference/typeAliasDoesntMakeModuleInstantiated.js b/tests/baselines/reference/typeAliasDoesntMakeModuleInstantiated.js
new file mode 100644
index 00000000000..861e20cb0d1
--- /dev/null
+++ b/tests/baselines/reference/typeAliasDoesntMakeModuleInstantiated.js
@@ -0,0 +1,13 @@
+//// [typeAliasDoesntMakeModuleInstantiated.ts]
+declare module m {
+ // type alias declaration here shouldnt make the module declaration instantiated
+ type Selector = string| string[] |Function;
+
+ export interface IStatic {
+ (selector: any /* Selector */): IInstance;
+ }
+ export interface IInstance { }
+}
+declare var m: m.IStatic; // Should be ok to have var 'm' as module is non instantiated
+
+//// [typeAliasDoesntMakeModuleInstantiated.js]
diff --git a/tests/baselines/reference/typeAliasDoesntMakeModuleInstantiated.types b/tests/baselines/reference/typeAliasDoesntMakeModuleInstantiated.types
new file mode 100644
index 00000000000..18f4561241b
--- /dev/null
+++ b/tests/baselines/reference/typeAliasDoesntMakeModuleInstantiated.types
@@ -0,0 +1,24 @@
+=== tests/cases/compiler/typeAliasDoesntMakeModuleInstantiated.ts ===
+declare module m {
+>m : IStatic
+
+ // type alias declaration here shouldnt make the module declaration instantiated
+ type Selector = string| string[] |Function;
+>Selector : string | Function | string[]
+>Function : Function
+
+ export interface IStatic {
+>IStatic : IStatic
+
+ (selector: any /* Selector */): IInstance;
+>selector : any
+>IInstance : IInstance
+ }
+ export interface IInstance { }
+>IInstance : IInstance
+}
+declare var m: m.IStatic; // Should be ok to have var 'm' as module is non instantiated
+>m : m.IStatic
+>m : unknown
+>IStatic : m.IStatic
+
diff --git a/tests/baselines/reference/typeAnnotationBestCommonTypeInArrayLiteral.types b/tests/baselines/reference/typeAnnotationBestCommonTypeInArrayLiteral.types
index 27fcd05bb28..661aa3c3cbb 100644
--- a/tests/baselines/reference/typeAnnotationBestCommonTypeInArrayLiteral.types
+++ b/tests/baselines/reference/typeAnnotationBestCommonTypeInArrayLiteral.types
@@ -23,16 +23,16 @@ interface IMenuItem {
var menuData: IMenuItem[] = [
>menuData : IMenuItem[]
>IMenuItem : IMenuItem
->[ { "id": "ourLogo", "type": "image", "link": "", "icon": "modules/menu/logo.svg" }, { "id": "productName", "type": "default", "link": "", "text": "Product Name" }] : ({ "id": string; "type": string; "link": string; "icon": string; } | { "id": string; "type": string; "link": string; "text": string; })[]
+>[ { "id": "ourLogo", "type": "image", "link": "", "icon": "modules/menu/logo.svg" }, { "id": "productName", "type": "default", "link": "", "text": "Product Name" }] : ({ "id": string; "type": string; "link": string; "icon": string; classes?: string; text?: string; } | { "id": string; "type": string; "link": string; "text": string; classes?: string; icon?: string; })[]
{
->{ "id": "ourLogo", "type": "image", "link": "", "icon": "modules/menu/logo.svg" } : { "id": string; "type": string; "link": string; "icon": string; }
+>{ "id": "ourLogo", "type": "image", "link": "", "icon": "modules/menu/logo.svg" } : { "id": string; "type": string; "link": string; "icon": string; classes?: string; text?: string; }
"id": "ourLogo",
"type": "image",
"link": "",
"icon": "modules/menu/logo.svg"
}, {
->{ "id": "productName", "type": "default", "link": "", "text": "Product Name" } : { "id": string; "type": string; "link": string; "text": string; }
+>{ "id": "productName", "type": "default", "link": "", "text": "Product Name" } : { "id": string; "type": string; "link": string; "text": string; classes?: string; icon?: string; }
"id": "productName",
"type": "default",
diff --git a/tests/baselines/reference/underscoreTest1.types b/tests/baselines/reference/underscoreTest1.types
index a3347457b8a..9e4f5ea1d1b 100644
--- a/tests/baselines/reference/underscoreTest1.types
+++ b/tests/baselines/reference/underscoreTest1.types
@@ -1317,11 +1317,11 @@ compiled2({ epithet: "stooge" });
>epithet : string
_.templateSettings = {
->_.templateSettings = { interpolate: /\{\{(.+?)\}\}/g} : { interpolate: RegExp; }
+>_.templateSettings = { interpolate: /\{\{(.+?)\}\}/g} : { interpolate: RegExp; evaluate?: RegExp; escape?: RegExp; }
>_.templateSettings : Underscore.TemplateSettings
>_ : Underscore.Static
>templateSettings : Underscore.TemplateSettings
->{ interpolate: /\{\{(.+?)\}\}/g} : { interpolate: RegExp; }
+>{ interpolate: /\{\{(.+?)\}\}/g} : { interpolate: RegExp; evaluate?: RegExp; escape?: RegExp; }
interpolate: /\{\{(.+?)\}\}/g
>interpolate : RegExp
@@ -1347,7 +1347,7 @@ _.template("Using 'with': <%= data.answer %>", { answer: 'no' }, { variable: 'da
>template : { (templateString: string): (data: any) => string; (templateString: string, data: any, settings?: Underscore.TemplateSettings): string; }
>{ answer: 'no' } : { answer: string; }
>answer : string
->{ variable: 'data' } : { variable: string; }
+>{ variable: 'data' } : { variable: string; evaluate?: RegExp; interpolate?: RegExp; escape?: RegExp; }
>variable : string
=== tests/cases/compiler/underscoreTest1_underscore.ts ===
diff --git a/tests/cases/compiler/commentEmitWithCommentOnLastLine.ts b/tests/cases/compiler/commentEmitWithCommentOnLastLine.ts
new file mode 100644
index 00000000000..d148fbda6fa
--- /dev/null
+++ b/tests/cases/compiler/commentEmitWithCommentOnLastLine.ts
@@ -0,0 +1,4 @@
+var x: any;
+/*
+var bar;
+*/
\ No newline at end of file
diff --git a/tests/cases/compiler/complicatedPrivacy.ts b/tests/cases/compiler/complicatedPrivacy.ts
index 6c1e3fa8527..6fe144d237c 100644
--- a/tests/cases/compiler/complicatedPrivacy.ts
+++ b/tests/cases/compiler/complicatedPrivacy.ts
@@ -33,7 +33,7 @@ module m1 {
export function f4(arg1:
{
- [number]: C1;
+ [number]: C1; // Used to be indexer, now it is a computed property
}) {
}
diff --git a/tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts b/tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts
index fbe24e975e9..47d818065a1 100644
--- a/tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts
+++ b/tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts
@@ -1,9 +1,11 @@
interface I {
+ // Used to be indexer, now it is a computed property
[x]: string;
[x: string];
}
class C {
+ // Used to be indexer, now it is a computed property
[x]: string
}
diff --git a/tests/cases/compiler/indexSignatureWithInitializer.ts b/tests/cases/compiler/indexSignatureWithInitializer.ts
index a7b185eee0e..f9a4aafc699 100644
--- a/tests/cases/compiler/indexSignatureWithInitializer.ts
+++ b/tests/cases/compiler/indexSignatureWithInitializer.ts
@@ -1,3 +1,4 @@
+// These used to be indexers, now they are computed properties
interface I {
[x = '']: string;
}
diff --git a/tests/cases/compiler/indexWithoutParamType2.ts b/tests/cases/compiler/indexWithoutParamType2.ts
index 9a1976fe9ef..0def5dc06a9 100644
--- a/tests/cases/compiler/indexWithoutParamType2.ts
+++ b/tests/cases/compiler/indexWithoutParamType2.ts
@@ -1,3 +1,4 @@
class C {
+ // Used to be indexer, now it is a computed property
[x]: string
}
\ No newline at end of file
diff --git a/tests/cases/compiler/intTypeCheck.ts b/tests/cases/compiler/intTypeCheck.ts
index 787dc944c43..a1563097863 100644
--- a/tests/cases/compiler/intTypeCheck.ts
+++ b/tests/cases/compiler/intTypeCheck.ts
@@ -31,8 +31,9 @@ interface i3 {
new (p6: string, ...p7: any[]);
}
interface i4 {
- //Index Signatures
+ // Used to be indexer, now it is a computed property
[p];
+ //Index Signatures
[p1: string];
[p2: string, p3: number];
}
@@ -65,9 +66,10 @@ interface i11 {
new (...p3: any[]);
new (p4: string, p5?: string);
new (p6: string, ...p7: any[]);
-
- //Index Signatures
+
+ // Used to be indexer, now it is a computed property
[p];
+ //Index Signatures
[p1: string];
[p2: string, p3: number];
diff --git a/tests/cases/compiler/propertyAssignment.ts b/tests/cases/compiler/propertyAssignment.ts
index 0afb8fb60a7..0c8351fb05d 100644
--- a/tests/cases/compiler/propertyAssignment.ts
+++ b/tests/cases/compiler/propertyAssignment.ts
@@ -3,7 +3,7 @@
var foo1: { new ():any; }
var bar1: { x : number; }
-var foo2: { [index]; } // should be an error
+var foo2: { [index]; } // should be an error, used to be indexer, now it is a computed property
var bar2: { x : number; }
var foo3: { ():void; }
diff --git a/tests/cases/compiler/typeAliasDoesntMakeModuleInstantiated.ts b/tests/cases/compiler/typeAliasDoesntMakeModuleInstantiated.ts
new file mode 100644
index 00000000000..89faf9e4515
--- /dev/null
+++ b/tests/cases/compiler/typeAliasDoesntMakeModuleInstantiated.ts
@@ -0,0 +1,10 @@
+declare module m {
+ // type alias declaration here shouldnt make the module declaration instantiated
+ type Selector = string| string[] |Function;
+
+ export interface IStatic {
+ (selector: any /* Selector */): IInstance;
+ }
+ export interface IInstance { }
+}
+declare var m: m.IStatic; // Should be ok to have var 'm' as module is non instantiated
\ No newline at end of file
diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames10.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames10.ts
new file mode 100644
index 00000000000..0ab74d788c8
--- /dev/null
+++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames10.ts
@@ -0,0 +1,17 @@
+// @target: es6
+var s: string;
+var n: number;
+var a: any;
+var v = {
+ [s]() { },
+ [n]() { },
+ [s + s]() { },
+ [s + n]() { },
+ [+s]() { },
+ [""]() { },
+ [0]() { },
+ [a]() { },
+ [true]() { },
+ [`hello bye`]() { },
+ [`hello ${a} bye`]() { }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames11.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames11.ts
new file mode 100644
index 00000000000..d41c56fe953
--- /dev/null
+++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames11.ts
@@ -0,0 +1,17 @@
+// @target: es6
+var s: string;
+var n: number;
+var a: any;
+var v = {
+ get [s]() { return 0; },
+ set [n](v) { },
+ get [s + s]() { return 0; },
+ set [s + n](v) { },
+ get [+s]() { return 0; },
+ set [""](v) { },
+ get [0]() { return 0; },
+ set [a](v) { },
+ get [true]() { return 0; },
+ set [`hello bye`](v) { },
+ get [`hello ${a} bye`]() { return 0; }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts
new file mode 100644
index 00000000000..e046899d331
--- /dev/null
+++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts
@@ -0,0 +1,17 @@
+// @target: es6
+var s: string;
+var n: number;
+var a: any;
+class C {
+ [s]: number;
+ [n] = n;
+ static [s + s]: string;
+ [s + n] = 2;
+ [+s]: typeof s;
+ static [""]: number;
+ [0]: number;
+ [a]: number;
+ static [true]: number;
+ [`hello bye`] = 0;
+ static [`hello ${a} bye`] = 0
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames13.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames13.ts
new file mode 100644
index 00000000000..de40dc4e774
--- /dev/null
+++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames13.ts
@@ -0,0 +1,17 @@
+// @target: es6
+var s: string;
+var n: number;
+var a: any;
+class C {
+ [s]() {}
+ [n]() { }
+ static [s + s]() { }
+ [s + n]() { }
+ [+s]() { }
+ static [""]() { }
+ [0]() { }
+ [a]() { }
+ static [true]() { }
+ [`hello bye`]() { }
+ static [`hello ${a} bye`]() { }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts
new file mode 100644
index 00000000000..d90f2d7f976
--- /dev/null
+++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts
@@ -0,0 +1,10 @@
+// @target: es6
+var b: boolean;
+class C {
+ [b]() {}
+ static [true]() { }
+ [[]]() { }
+ static [{}]() { }
+ [undefined]() { }
+ static [null]() { }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts
new file mode 100644
index 00000000000..60b62d29034
--- /dev/null
+++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts
@@ -0,0 +1,9 @@
+// @target: es6
+var p1: number | string;
+var p2: number | number[];
+var p3: string | boolean;
+class C {
+ [p1]() { }
+ [p2]() { }
+ [p3]() { }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames16.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames16.ts
new file mode 100644
index 00000000000..c42e6e97177
--- /dev/null
+++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames16.ts
@@ -0,0 +1,17 @@
+// @target: es6
+var s: string;
+var n: number;
+var a: any;
+class C {
+ get [s]() { return 0;}
+ set [n](v) { }
+ static get [s + s]() { return 0; }
+ set [s + n](v) { }
+ get [+s]() { return 0; }
+ static set [""](v) { }
+ get [0]() { return 0; }
+ set [a](v) { }
+ static get [true]() { return 0; }
+ set [`hello bye`](v) { }
+ get [`hello ${a} bye`]() { return 0; }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts
new file mode 100644
index 00000000000..d795b527d06
--- /dev/null
+++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts
@@ -0,0 +1,10 @@
+// @target: es6
+var b: boolean;
+class C {
+ get [b]() { return 0;}
+ static set [true](v) { }
+ get [[]]() { return 0; }
+ set [{}](v) { }
+ static get [undefined]() { return 0; }
+ set [null](v) { }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames18.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames18.ts
new file mode 100644
index 00000000000..cd7a43f233f
--- /dev/null
+++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames18.ts
@@ -0,0 +1,6 @@
+// @target: es6
+function foo() {
+ var obj = {
+ [this.bar]: 0
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames19.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames19.ts
new file mode 100644
index 00000000000..3dbf97d7f7a
--- /dev/null
+++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames19.ts
@@ -0,0 +1,6 @@
+// @target: es6
+module M {
+ var obj = {
+ [this.bar]: 0
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames20.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames20.ts
new file mode 100644
index 00000000000..d31f63d2e87
--- /dev/null
+++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames20.ts
@@ -0,0 +1,4 @@
+// @target: es6
+var obj = {
+ [this.bar]: 0
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames21.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames21.ts
new file mode 100644
index 00000000000..654f1b29985
--- /dev/null
+++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames21.ts
@@ -0,0 +1,7 @@
+// @target: es6
+class C {
+ bar() {
+ return 0;
+ }
+ [this.bar()]() { }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames22.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames22.ts
new file mode 100644
index 00000000000..c999e0d642c
--- /dev/null
+++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames22.ts
@@ -0,0 +1,9 @@
+// @target: es6
+class C {
+ bar() {
+ var obj = {
+ [this.bar()]() { }
+ };
+ return 0;
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames23.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames23.ts
new file mode 100644
index 00000000000..9c7c5bb6539
--- /dev/null
+++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames23.ts
@@ -0,0 +1,9 @@
+// @target: es6
+class C {
+ bar() {
+ return 0;
+ }
+ [
+ { [this.bar()]: 1 }[0]
+ ]() { }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames24.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames24.ts
new file mode 100644
index 00000000000..dc3a9541e11
--- /dev/null
+++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames24.ts
@@ -0,0 +1,11 @@
+// @target: es6
+class Base {
+ bar() {
+ return 0;
+ }
+}
+class C extends Base {
+ // Gets emitted as super, not _super, which is consistent with
+ // use of super in static properties initializers.
+ [super.bar()]() { }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames25.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames25.ts
new file mode 100644
index 00000000000..bc07847b251
--- /dev/null
+++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames25.ts
@@ -0,0 +1,14 @@
+// @target: es6
+class Base {
+ bar() {
+ return 0;
+ }
+}
+class C extends Base {
+ foo() {
+ var obj = {
+ [super.bar()]() { }
+ };
+ return 0;
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames26.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames26.ts
new file mode 100644
index 00000000000..6ef32397f54
--- /dev/null
+++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames26.ts
@@ -0,0 +1,13 @@
+// @target: es6
+class Base {
+ bar() {
+ return 0;
+ }
+}
+class C extends Base {
+ // Gets emitted as super, not _super, which is consistent with
+ // use of super in static properties initializers.
+ [
+ { [super.bar()]: 1 }[0]
+ ]() { }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames27.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames27.ts
new file mode 100644
index 00000000000..be19acd4729
--- /dev/null
+++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames27.ts
@@ -0,0 +1,6 @@
+// @target: es6
+class Base {
+}
+class C extends Base {
+ [(super(), "prop")]() { }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames28.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames28.ts
new file mode 100644
index 00000000000..f9b14c3a75c
--- /dev/null
+++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames28.ts
@@ -0,0 +1,11 @@
+// @target: es6
+class Base {
+}
+class C extends Base {
+ constructor() {
+ super();
+ var obj = {
+ [(super(), "prop")]() { }
+ };
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames29.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames29.ts
new file mode 100644
index 00000000000..abf213b4c75
--- /dev/null
+++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames29.ts
@@ -0,0 +1,11 @@
+// @target: es6
+class C {
+ bar() {
+ () => {
+ var obj = {
+ [this.bar()]() { } // needs capture
+ };
+ }
+ return 0;
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames30.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames30.ts
new file mode 100644
index 00000000000..5fba13388f8
--- /dev/null
+++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames30.ts
@@ -0,0 +1,16 @@
+// @target: es6
+class Base {
+}
+class C extends Base {
+ constructor() {
+ super();
+ () => {
+ var obj = {
+ // Ideally, we would capture this. But the reference is
+ // illegal, and not capturing this is consistent with
+ //treatment of other similar violations.
+ [(super(), "prop")]() { }
+ };
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames31.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames31.ts
new file mode 100644
index 00000000000..0ee8a0284a3
--- /dev/null
+++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames31.ts
@@ -0,0 +1,16 @@
+// @target: es6
+class Base {
+ bar() {
+ return 0;
+ }
+}
+class C extends Base {
+ foo() {
+ () => {
+ var obj = {
+ [super.bar()]() { } // needs capture
+ };
+ }
+ return 0;
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames32.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames32.ts
new file mode 100644
index 00000000000..bf888a0c44b
--- /dev/null
+++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames32.ts
@@ -0,0 +1,8 @@
+// @target: es6
+function foo() { return '' }
+class C {
+ bar() {
+ return 0;
+ }
+ [foo()]() { }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames33.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames33.ts
new file mode 100644
index 00000000000..2a62d003a2e
--- /dev/null
+++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames33.ts
@@ -0,0 +1,10 @@
+// @target: es6
+function foo() { return '' }
+class C {
+ bar() {
+ var obj = {
+ [foo()]() { }
+ };
+ return 0;
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames34.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames34.ts
new file mode 100644
index 00000000000..2a56735701c
--- /dev/null
+++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames34.ts
@@ -0,0 +1,10 @@
+// @target: es6
+function foo() { return '' }
+class C