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

This commit is contained in:
vladima
2015-12-04 21:28:57 -08:00
57 changed files with 1036 additions and 500 deletions
+115 -31
View File
@@ -51,6 +51,7 @@ namespace ts {
const emitResolver = createResolver();
const undefinedSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "undefined");
undefinedSymbol.declarations = [];
const argumentsSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "arguments");
const checker: TypeChecker = {
@@ -234,6 +235,10 @@ namespace ts {
ResolvedReturnType
}
const builtinGlobals: SymbolTable = {
[undefinedSymbol.name]: undefinedSymbol
};
initializeTypeChecker();
return checker;
@@ -360,6 +365,24 @@ namespace ts {
}
}
function addToSymbolTable(target: SymbolTable, source: SymbolTable, message: DiagnosticMessage) {
for (const id in source) {
if (hasProperty(source, id)) {
if (hasProperty(target, id)) {
// Error on redeclarations
forEach(target[id].declarations, addDeclarationDiagnostic(id, message));
}
else {
target[id] = source[id];
}
}
}
function addDeclarationDiagnostic(id: string, message: DiagnosticMessage) {
return (declaration: Declaration) => diagnostics.add(createDiagnosticForNode(declaration, message, id));
}
}
function getSymbolLinks(symbol: Symbol): SymbolLinks {
if (symbol.flags & SymbolFlags.Transient) return <TransientSymbol>symbol;
const id = getSymbolId(symbol);
@@ -1103,39 +1126,81 @@ namespace ts {
return links.resolvedExports || (links.resolvedExports = getExportsForModule(moduleSymbol));
}
function extendExportSymbols(target: SymbolTable, source: SymbolTable) {
interface ExportCollisionTracker {
specifierText: string;
exportsWithDuplicate: ExportDeclaration[];
}
/**
* Extends one symbol table with another while collecting information on name collisions for error message generation into the `lookupTable` argument
* Not passing `lookupTable` and `exportNode` disables this collection, and just extends the tables
*/
function extendExportSymbols(target: SymbolTable, source: SymbolTable, lookupTable?: Map<ExportCollisionTracker>, exportNode?: ExportDeclaration) {
for (const id in source) {
if (id !== "default" && !hasProperty(target, id)) {
target[id] = source[id];
if (lookupTable && exportNode) {
lookupTable[id] = {
specifierText: getTextOfNode(exportNode.moduleSpecifier)
} as ExportCollisionTracker;
}
}
else if (lookupTable && exportNode && id !== "default" && hasProperty(target, id) && resolveSymbol(target[id]) !== resolveSymbol(source[id])) {
if (!lookupTable[id].exportsWithDuplicate) {
lookupTable[id].exportsWithDuplicate = [exportNode];
}
else {
lookupTable[id].exportsWithDuplicate.push(exportNode);
}
}
}
}
function getExportsForModule(moduleSymbol: Symbol): SymbolTable {
let result: SymbolTable;
const visitedSymbols: Symbol[] = [];
visit(moduleSymbol);
return result || moduleSymbol.exports;
return visit(moduleSymbol) || moduleSymbol.exports;
// The ES6 spec permits export * declarations in a module to circularly reference the module itself. For example,
// module 'a' can 'export * from "b"' and 'b' can 'export * from "a"' without error.
function visit(symbol: Symbol) {
if (symbol && symbol.flags & SymbolFlags.HasExports && !contains(visitedSymbols, symbol)) {
visitedSymbols.push(symbol);
if (symbol !== moduleSymbol) {
if (!result) {
result = cloneSymbolTable(moduleSymbol.exports);
}
extendExportSymbols(result, symbol.exports);
}
// All export * declarations are collected in an __export symbol by the binder
const exportStars = symbol.exports["__export"];
if (exportStars) {
for (const node of exportStars.declarations) {
visit(resolveExternalModuleName(node, (<ExportDeclaration>node).moduleSpecifier));
}
}
function visit(symbol: Symbol): SymbolTable {
if (!(symbol && symbol.flags & SymbolFlags.HasExports && !contains(visitedSymbols, symbol))) {
return;
}
visitedSymbols.push(symbol);
const symbols = cloneSymbolTable(symbol.exports);
// All export * declarations are collected in an __export symbol by the binder
const exportStars = symbol.exports["__export"];
if (exportStars) {
const nestedSymbols: SymbolTable = {};
const lookupTable: Map<ExportCollisionTracker> = {};
for (const node of exportStars.declarations) {
const resolvedModule = resolveExternalModuleName(node, (node as ExportDeclaration).moduleSpecifier);
const exportedSymbols = visit(resolvedModule);
extendExportSymbols(
nestedSymbols,
exportedSymbols,
lookupTable,
node as ExportDeclaration
);
}
for (const id in lookupTable) {
const { exportsWithDuplicate } = lookupTable[id];
// It's not an error if the file with multiple `export *`s with duplicate names exports a member with that name itself
if (id === "export=" || !(exportsWithDuplicate && exportsWithDuplicate.length) || hasProperty(symbols, id)) {
continue;
}
for (const node of exportsWithDuplicate) {
diagnostics.add(createDiagnosticForNode(
node,
Diagnostics.Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity,
lookupTable[id].specifierText,
id
));
}
}
extendExportSymbols(symbols, nestedSymbols);
}
return symbols;
}
}
@@ -2948,10 +3013,6 @@ namespace ts {
return type.resolvedBaseConstructorType;
}
function hasClassBaseType(type: InterfaceType): boolean {
return !!forEach(getBaseTypes(type), t => !!(t.symbol.flags & SymbolFlags.Class));
}
function getBaseTypes(type: InterfaceType): ObjectType[] {
const isClass = type.symbol.flags & SymbolFlags.Class;
const isInterface = type.symbol.flags & SymbolFlags.Interface;
@@ -3385,11 +3446,11 @@ namespace ts {
}
function getDefaultConstructSignatures(classType: InterfaceType): Signature[] {
if (!hasClassBaseType(classType)) {
return [createSignature(undefined, classType.localTypeParameters, emptyArray, classType, undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false)];
}
const baseConstructorType = getBaseConstructorTypeOfClass(classType);
const baseSignatures = getSignaturesOfType(baseConstructorType, SignatureKind.Construct);
if (baseSignatures.length === 0) {
return [createSignature(undefined, classType.localTypeParameters, emptyArray, classType, undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false)];
}
const baseTypeNode = getBaseTypeNodeOfClass(classType);
const typeArguments = map(baseTypeNode.typeArguments, getTypeFromTypeNode);
const typeArgCount = typeArguments ? typeArguments.length : 0;
@@ -3607,7 +3668,7 @@ namespace ts {
return <ResolvedType>type;
}
// Return properties of an object type or an empty array for other types
/** Return properties of an object type or an empty array for other types */
function getPropertiesOfObjectType(type: Type): Symbol[] {
if (type.flags & TypeFlags.ObjectType) {
return resolveStructuredTypeMembers(<ObjectType>type).properties;
@@ -3615,8 +3676,8 @@ namespace ts {
return emptyArray;
}
// If the given type is an object type and that type has a property by the given name,
// return the symbol for that property.Otherwise return undefined.
/** If the given type is an object type and that type has a property by the given name,
* return the symbol for that property. Otherwise return undefined. */
function getPropertyOfObjectType(type: Type, name: string): Symbol {
if (type.flags & TypeFlags.ObjectType) {
const resolved = resolveStructuredTypeMembers(<ObjectType>type);
@@ -14132,8 +14193,29 @@ namespace ts {
const declaration = getDeclarationOfAliasSymbol(exportEqualsSymbol) || exportEqualsSymbol.valueDeclaration;
error(declaration, Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements);
}
// Checks for export * conflicts
const exports = getExportsOfModule(moduleSymbol);
for (const id in exports) {
if (id === "__export") {
continue;
}
const { declarations, flags } = exports[id];
// ECMA262: 15.2.1.1 It is a Syntax Error if the ExportedNames of ModuleItemList contains any duplicate entries. (TS Exceptions: namespaces, function overloads, enums, and interfaces)
if (!(flags & (SymbolFlags.Namespace | SymbolFlags.Interface | SymbolFlags.Enum)) && declarations.length > 1) {
const exportedDeclarations: Declaration[] = filter(declarations, isNotOverload);
if (exportedDeclarations.length > 1) {
for (const declaration of exportedDeclarations) {
diagnostics.add(createDiagnosticForNode(declaration, Diagnostics.Cannot_redeclare_exported_variable_0, id));
}
}
}
}
links.exportsChecked = true;
}
function isNotOverload(declaration: Declaration): boolean {
return declaration.kind !== SyntaxKind.FunctionDeclaration || !!(declaration as FunctionDeclaration).body;
}
}
function checkTypePredicate(node: TypePredicateNode) {
@@ -15268,10 +15350,12 @@ namespace ts {
}
});
// Setup global builtins
addToSymbolTable(globals, builtinGlobals, Diagnostics.Declaration_name_conflicts_with_built_in_global_identifier_0);
getSymbolLinks(undefinedSymbol).type = undefinedType;
getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments");
getSymbolLinks(unknownSymbol).type = unknownType;
globals[undefinedSymbol.name] = undefinedSymbol;
// Initialize special types
globalArrayType = <GenericType>getGlobalType("Array", /*arity*/ 1);
+12
View File
@@ -844,6 +844,10 @@
"category": "Error",
"code": 2307
},
"Module {0} has already exported a member named '{1}'. Consider explicitly re-exporting to resolve the ambiguity.": {
"category": "Error",
"code": 2308
},
"An export assignment cannot be used in a module with other exported elements.": {
"category": "Error",
"code": 2309
@@ -900,6 +904,10 @@
"category": "Error",
"code": 2322
},
"Cannot redeclare exported variable '{0}'.": {
"category": "Error",
"code": 2323
},
"Property '{0}' is missing in type '{1}'.": {
"category": "Error",
"code": 2324
@@ -1180,6 +1188,10 @@
"category": "Error",
"code": 2396
},
"Declaration name conflicts with built-in global identifier '{0}'.": {
"category": "Error",
"code": 2397
},
"Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference.": {
"category": "Error",
"code": 2399
+20 -10
View File
@@ -5795,9 +5795,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
if (!shouldHoistDeclarationInSystemJsModule(node)) {
// do not emit var if variable was already hoisted
if (!(node.flags & NodeFlags.Export) || isES6ExportedDeclaration(node)) {
const isES6ExportedEnum = isES6ExportedDeclaration(node);
if (!(node.flags & NodeFlags.Export) || (isES6ExportedEnum && isFirstDeclarationOfKind(node, node.symbol && node.symbol.declarations, SyntaxKind.EnumDeclaration))) {
emitStart(node);
if (isES6ExportedDeclaration(node)) {
if (isES6ExportedEnum) {
write("export ");
}
write("var ");
@@ -5894,6 +5896,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
return languageVersion === ScriptTarget.ES6 && !!(resolver.getNodeCheckFlags(node) & NodeCheckFlags.LexicalModuleMergesWithClass);
}
function isFirstDeclarationOfKind(node: Declaration, declarations: Declaration[], kind: SyntaxKind) {
return !forEach(declarations, declaration => declaration.kind === kind && declaration.pos < node.pos);
}
function emitModuleDeclaration(node: ModuleDeclaration) {
// Emit only if this module is non-ambient.
const shouldEmit = shouldEmitModuleDeclaration(node);
@@ -5905,15 +5911,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
const emitVarForModule = !hoistedInDeclarationScope && !isModuleMergedWithES6Class(node);
if (emitVarForModule) {
emitStart(node);
if (isES6ExportedDeclaration(node)) {
write("export ");
const isES6ExportedNamespace = isES6ExportedDeclaration(node);
if (!isES6ExportedNamespace || isFirstDeclarationOfKind(node, node.symbol && node.symbol.declarations, SyntaxKind.ModuleDeclaration)) {
emitStart(node);
if (isES6ExportedNamespace) {
write("export ");
}
write("var ");
emit(node.name);
write(";");
emitEnd(node);
writeLine();
}
write("var ");
emit(node.name);
write(";");
emitEnd(node);
writeLine();
}
emitStart(node);
@@ -7814,6 +7823,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
const shebang = getShebang(currentText);
if (shebang) {
write(shebang);
writeLine();
}
}
}
+9 -8
View File
@@ -5310,16 +5310,17 @@ namespace ts {
}
function parseModuleSpecifier(): Expression {
// We allow arbitrary expressions here, even though the grammar only allows string
// literals. We check to ensure that it is only a string literal later in the grammar
// walker.
const result = parseExpression();
// Ensure the string being required is in our 'identifier' table. This will ensure
// that features like 'find refs' will look inside this file when search for its name.
if (result.kind === SyntaxKind.StringLiteral) {
if (token === SyntaxKind.StringLiteral) {
const result = parseLiteralNode();
internIdentifier((<LiteralExpression>result).text);
return result;
}
else {
// We allow arbitrary expressions here, even though the grammar only allows string
// literals. We check to ensure that it is only a string literal later in the grammar
// check pass.
return parseExpression();
}
return result;
}
function parseNamespaceImport(): NamespaceImport {
@@ -0,0 +1,23 @@
//// [enumExportMergingES6.ts]
export enum Animals {
Cat = 1
}
export enum Animals {
Dog = 2
}
export enum Animals {
CatDog = Cat | Dog
}
//// [enumExportMergingES6.js]
export var Animals;
(function (Animals) {
Animals[Animals["Cat"] = 1] = "Cat";
})(Animals || (Animals = {}));
(function (Animals) {
Animals[Animals["Dog"] = 2] = "Dog";
})(Animals || (Animals = {}));
(function (Animals) {
Animals[Animals["CatDog"] = 3] = "CatDog";
})(Animals || (Animals = {}));
@@ -0,0 +1,22 @@
=== tests/cases/conformance/enums/enumExportMergingES6.ts ===
export enum Animals {
>Animals : Symbol(Animals, Decl(enumExportMergingES6.ts, 0, 0), Decl(enumExportMergingES6.ts, 2, 1), Decl(enumExportMergingES6.ts, 5, 1))
Cat = 1
>Cat : Symbol(Animals.Cat, Decl(enumExportMergingES6.ts, 0, 21))
}
export enum Animals {
>Animals : Symbol(Animals, Decl(enumExportMergingES6.ts, 0, 0), Decl(enumExportMergingES6.ts, 2, 1), Decl(enumExportMergingES6.ts, 5, 1))
Dog = 2
>Dog : Symbol(Animals.Dog, Decl(enumExportMergingES6.ts, 3, 21))
}
export enum Animals {
>Animals : Symbol(Animals, Decl(enumExportMergingES6.ts, 0, 0), Decl(enumExportMergingES6.ts, 2, 1), Decl(enumExportMergingES6.ts, 5, 1))
CatDog = Cat | Dog
>CatDog : Symbol(Animals.CatDog, Decl(enumExportMergingES6.ts, 6, 21))
>Cat : Symbol(Animals.Cat, Decl(enumExportMergingES6.ts, 0, 21))
>Dog : Symbol(Animals.Dog, Decl(enumExportMergingES6.ts, 3, 21))
}
@@ -0,0 +1,25 @@
=== tests/cases/conformance/enums/enumExportMergingES6.ts ===
export enum Animals {
>Animals : Animals
Cat = 1
>Cat : Animals
>1 : number
}
export enum Animals {
>Animals : Animals
Dog = 2
>Dog : Animals
>2 : number
}
export enum Animals {
>Animals : Animals
CatDog = Cat | Dog
>CatDog : Animals
>Cat | Dog : number
>Cat : Animals
>Dog : Animals
}
@@ -1,15 +1,21 @@
tests/cases/compiler/client.ts(1,1): error TS1191: An import declaration cannot have modifiers.
tests/cases/compiler/client.ts(2,12): error TS2323: Cannot redeclare exported variable 'x1'.
tests/cases/compiler/client.ts(3,1): error TS1191: An import declaration cannot have modifiers.
tests/cases/compiler/client.ts(3,34): error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'a'.
tests/cases/compiler/client.ts(4,12): error TS2323: Cannot redeclare exported variable 'x1'.
tests/cases/compiler/client.ts(5,1): error TS1191: An import declaration cannot have modifiers.
tests/cases/compiler/client.ts(5,34): error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'a'.
tests/cases/compiler/client.ts(6,12): error TS2323: Cannot redeclare exported variable 'x1'.
tests/cases/compiler/client.ts(7,1): error TS1191: An import declaration cannot have modifiers.
tests/cases/compiler/client.ts(7,34): error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'x'.
tests/cases/compiler/client.ts(7,37): error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'a'.
tests/cases/compiler/client.ts(8,12): error TS2323: Cannot redeclare exported variable 'x1'.
tests/cases/compiler/client.ts(9,1): error TS1191: An import declaration cannot have modifiers.
tests/cases/compiler/client.ts(9,34): error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'x'.
tests/cases/compiler/client.ts(10,12): error TS2323: Cannot redeclare exported variable 'x1'.
tests/cases/compiler/client.ts(11,1): error TS1191: An import declaration cannot have modifiers.
tests/cases/compiler/client.ts(11,34): error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'm'.
tests/cases/compiler/client.ts(12,12): error TS2323: Cannot redeclare exported variable 'x1'.
==== tests/cases/compiler/server.ts (0 errors) ====
@@ -17,23 +23,29 @@ tests/cases/compiler/client.ts(11,34): error TS2305: Module '"tests/cases/compil
var a = 10;
export default a;
==== tests/cases/compiler/client.ts (12 errors) ====
==== tests/cases/compiler/client.ts (18 errors) ====
export import defaultBinding1, { } from "./server";
~~~~~~
!!! error TS1191: An import declaration cannot have modifiers.
export var x1: number = defaultBinding1;
~~
!!! error TS2323: Cannot redeclare exported variable 'x1'.
export import defaultBinding2, { a } from "./server";
~~~~~~
!!! error TS1191: An import declaration cannot have modifiers.
~
!!! error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'a'.
export var x1: number = defaultBinding2;
~~
!!! error TS2323: Cannot redeclare exported variable 'x1'.
export import defaultBinding3, { a as b } from "./server";
~~~~~~
!!! error TS1191: An import declaration cannot have modifiers.
~
!!! error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'a'.
export var x1: number = defaultBinding3;
~~
!!! error TS2323: Cannot redeclare exported variable 'x1'.
export import defaultBinding4, { x, a as y } from "./server";
~~~~~~
!!! error TS1191: An import declaration cannot have modifiers.
@@ -42,16 +54,22 @@ tests/cases/compiler/client.ts(11,34): error TS2305: Module '"tests/cases/compil
~
!!! error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'a'.
export var x1: number = defaultBinding4;
~~
!!! error TS2323: Cannot redeclare exported variable 'x1'.
export import defaultBinding5, { x as z, } from "./server";
~~~~~~
!!! error TS1191: An import declaration cannot have modifiers.
~
!!! error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'x'.
export var x1: number = defaultBinding5;
~~
!!! error TS2323: Cannot redeclare exported variable 'x1'.
export import defaultBinding6, { m, } from "./server";
~~~~~~
!!! error TS1191: An import declaration cannot have modifiers.
~
!!! error TS2305: Module '"tests/cases/compiler/server"' has no exported member 'm'.
export var x1: number = defaultBinding6;
~~
!!! error TS2323: Cannot redeclare exported variable 'x1'.
@@ -1,9 +1,15 @@
tests/cases/compiler/client.ts(1,1): error TS1191: An import declaration cannot have modifiers.
tests/cases/compiler/client.ts(2,1): error TS1191: An import declaration cannot have modifiers.
tests/cases/compiler/client.ts(3,12): error TS2323: Cannot redeclare exported variable 'x1'.
tests/cases/compiler/client.ts(4,1): error TS1191: An import declaration cannot have modifiers.
tests/cases/compiler/client.ts(5,12): error TS2323: Cannot redeclare exported variable 'x1'.
tests/cases/compiler/client.ts(6,1): error TS1191: An import declaration cannot have modifiers.
tests/cases/compiler/client.ts(7,12): error TS2323: Cannot redeclare exported variable 'x1'.
tests/cases/compiler/client.ts(8,12): error TS2323: Cannot redeclare exported variable 'x1'.
tests/cases/compiler/client.ts(9,1): error TS1191: An import declaration cannot have modifiers.
tests/cases/compiler/client.ts(10,12): error TS2323: Cannot redeclare exported variable 'x1'.
tests/cases/compiler/client.ts(11,1): error TS1191: An import declaration cannot have modifiers.
tests/cases/compiler/client.ts(12,12): error TS2323: Cannot redeclare exported variable 'x1'.
==== tests/cases/compiler/server.ts (0 errors) ====
@@ -13,7 +19,7 @@ tests/cases/compiler/client.ts(11,1): error TS1191: An import declaration cannot
export var m = a;
export default {};
==== tests/cases/compiler/client.ts (6 errors) ====
==== tests/cases/compiler/client.ts (12 errors) ====
export import defaultBinding1, { } from "server";
~~~~~~
!!! error TS1191: An import declaration cannot have modifiers.
@@ -21,21 +27,33 @@ tests/cases/compiler/client.ts(11,1): error TS1191: An import declaration cannot
~~~~~~
!!! error TS1191: An import declaration cannot have modifiers.
export var x1: number = a;
~~
!!! error TS2323: Cannot redeclare exported variable 'x1'.
export import defaultBinding3, { a as b } from "server";
~~~~~~
!!! error TS1191: An import declaration cannot have modifiers.
export var x1: number = b;
~~
!!! error TS2323: Cannot redeclare exported variable 'x1'.
export import defaultBinding4, { x, a as y } from "server";
~~~~~~
!!! error TS1191: An import declaration cannot have modifiers.
export var x1: number = x;
~~
!!! error TS2323: Cannot redeclare exported variable 'x1'.
export var x1: number = y;
~~
!!! error TS2323: Cannot redeclare exported variable 'x1'.
export import defaultBinding5, { x as z, } from "server";
~~~~~~
!!! error TS1191: An import declaration cannot have modifiers.
export var x1: number = z;
~~
!!! error TS2323: Cannot redeclare exported variable 'x1'.
export import defaultBinding6, { m, } from "server";
~~~~~~
!!! error TS1191: An import declaration cannot have modifiers.
export var x1: number = m;
~~
!!! error TS2323: Cannot redeclare exported variable 'x1'.
@@ -1,11 +1,21 @@
tests/cases/compiler/client.ts(1,1): error TS1191: An import declaration cannot have modifiers.
tests/cases/compiler/client.ts(2,1): error TS1191: An import declaration cannot have modifiers.
tests/cases/compiler/client.ts(3,12): error TS2323: Cannot redeclare exported variable 'xxxx'.
tests/cases/compiler/client.ts(4,1): error TS1191: An import declaration cannot have modifiers.
tests/cases/compiler/client.ts(5,12): error TS2323: Cannot redeclare exported variable 'xxxx'.
tests/cases/compiler/client.ts(6,1): error TS1191: An import declaration cannot have modifiers.
tests/cases/compiler/client.ts(7,12): error TS2323: Cannot redeclare exported variable 'xxxx'.
tests/cases/compiler/client.ts(8,12): error TS2323: Cannot redeclare exported variable 'xxxx'.
tests/cases/compiler/client.ts(9,1): error TS1191: An import declaration cannot have modifiers.
tests/cases/compiler/client.ts(10,12): error TS2323: Cannot redeclare exported variable 'xxxx'.
tests/cases/compiler/client.ts(11,1): error TS1191: An import declaration cannot have modifiers.
tests/cases/compiler/client.ts(12,12): error TS2323: Cannot redeclare exported variable 'xxxx'.
tests/cases/compiler/client.ts(13,1): error TS1191: An import declaration cannot have modifiers.
tests/cases/compiler/client.ts(14,12): error TS2323: Cannot redeclare exported variable 'xxxx'.
tests/cases/compiler/client.ts(15,12): error TS2323: Cannot redeclare exported variable 'xxxx'.
tests/cases/compiler/client.ts(16,1): error TS1191: An import declaration cannot have modifiers.
tests/cases/compiler/client.ts(17,12): error TS2323: Cannot redeclare exported variable 'xxxx'.
tests/cases/compiler/client.ts(18,12): error TS2323: Cannot redeclare exported variable 'xxxx'.
tests/cases/compiler/client.ts(19,1): error TS1191: An import declaration cannot have modifiers.
tests/cases/compiler/client.ts(21,1): error TS1191: An import declaration cannot have modifiers.
tests/cases/compiler/client.ts(25,1): error TS1191: An import declaration cannot have modifiers.
@@ -23,7 +33,7 @@ tests/cases/compiler/client.ts(26,1): error TS1191: An import declaration cannot
export var z2 = 10;
export var aaaa = 10;
==== tests/cases/compiler/client.ts (12 errors) ====
==== tests/cases/compiler/client.ts (22 errors) ====
export import { } from "./server";
~~~~~~
!!! error TS1191: An import declaration cannot have modifiers.
@@ -31,33 +41,53 @@ tests/cases/compiler/client.ts(26,1): error TS1191: An import declaration cannot
~~~~~~
!!! error TS1191: An import declaration cannot have modifiers.
export var xxxx = a;
~~~~
!!! error TS2323: Cannot redeclare exported variable 'xxxx'.
export import { a as b } from "./server";
~~~~~~
!!! error TS1191: An import declaration cannot have modifiers.
export var xxxx = b;
~~~~
!!! error TS2323: Cannot redeclare exported variable 'xxxx'.
export import { x, a as y } from "./server";
~~~~~~
!!! error TS1191: An import declaration cannot have modifiers.
export var xxxx = x;
~~~~
!!! error TS2323: Cannot redeclare exported variable 'xxxx'.
export var xxxx = y;
~~~~
!!! error TS2323: Cannot redeclare exported variable 'xxxx'.
export import { x as z, } from "./server";
~~~~~~
!!! error TS1191: An import declaration cannot have modifiers.
export var xxxx = z;
~~~~
!!! error TS2323: Cannot redeclare exported variable 'xxxx'.
export import { m, } from "./server";
~~~~~~
!!! error TS1191: An import declaration cannot have modifiers.
export var xxxx = m;
~~~~
!!! error TS2323: Cannot redeclare exported variable 'xxxx'.
export import { a1, x1 } from "./server";
~~~~~~
!!! error TS1191: An import declaration cannot have modifiers.
export var xxxx = a1;
~~~~
!!! error TS2323: Cannot redeclare exported variable 'xxxx'.
export var xxxx = x1;
~~~~
!!! error TS2323: Cannot redeclare exported variable 'xxxx'.
export import { a1 as a11, x1 as x11 } from "./server";
~~~~~~
!!! error TS1191: An import declaration cannot have modifiers.
export var xxxx = a11;
~~~~
!!! error TS2323: Cannot redeclare exported variable 'xxxx'.
export var xxxx = x11;
~~~~
!!! error TS2323: Cannot redeclare exported variable 'xxxx'.
export import { z1 } from "./server";
~~~~~~
!!! error TS1191: An import declaration cannot have modifiers.
@@ -58,7 +58,6 @@ export var M;
// alias
M.M_A = M_M;
})(M || (M = {}));
export var M;
(function (M) {
// Reexports
export { M_V as v };
@@ -1,4 +1,6 @@
tests/cases/conformance/es6/modules/main.ts(1,8): error TS1192: Module '"tests/cases/conformance/es6/modules/t4"' has no default export.
tests/cases/conformance/es6/modules/t4.ts(3,1): error TS2308: Module "./t1" has already exported a member named 'x'. Consider explicitly re-exporting to resolve the ambiguity.
tests/cases/conformance/es6/modules/t4.ts(3,1): error TS2308: Module "./t1" has already exported a member named 'y'. Consider explicitly re-exporting to resolve the ambiguity.
==== tests/cases/conformance/es6/modules/t1.ts (0 errors) ====
@@ -16,10 +18,14 @@ tests/cases/conformance/es6/modules/main.ts(1,8): error TS1192: Module '"tests/c
var z = "z";
export { x, y, z };
==== tests/cases/conformance/es6/modules/t4.ts (0 errors) ====
==== tests/cases/conformance/es6/modules/t4.ts (2 errors) ====
export * from "./t1";
export * from "./t2";
export * from "./t3";
~~~~~~~~~~~~~~~~~~~~~
!!! error TS2308: Module "./t1" has already exported a member named 'x'. Consider explicitly re-exporting to resolve the ambiguity.
~~~~~~~~~~~~~~~~~~~~~
!!! error TS2308: Module "./t1" has already exported a member named 'y'. Consider explicitly re-exporting to resolve the ambiguity.
==== tests/cases/conformance/es6/modules/main.ts (1 errors) ====
import hello, { x, y, z, foo } from "./t4";
@@ -1,4 +1,6 @@
tests/cases/conformance/es6/modules/main.ts(1,8): error TS1192: Module '"tests/cases/conformance/es6/modules/t4"' has no default export.
tests/cases/conformance/es6/modules/t4.ts(3,1): error TS2308: Module "./t1" has already exported a member named 'x'. Consider explicitly re-exporting to resolve the ambiguity.
tests/cases/conformance/es6/modules/t4.ts(3,1): error TS2308: Module "./t1" has already exported a member named 'y'. Consider explicitly re-exporting to resolve the ambiguity.
==== tests/cases/conformance/es6/modules/t1.ts (0 errors) ====
@@ -16,10 +18,14 @@ tests/cases/conformance/es6/modules/main.ts(1,8): error TS1192: Module '"tests/c
var z = "z";
export { x, y, z };
==== tests/cases/conformance/es6/modules/t4.ts (0 errors) ====
==== tests/cases/conformance/es6/modules/t4.ts (2 errors) ====
export * from "./t1";
export * from "./t2";
export * from "./t3";
~~~~~~~~~~~~~~~~~~~~~
!!! error TS2308: Module "./t1" has already exported a member named 'x'. Consider explicitly re-exporting to resolve the ambiguity.
~~~~~~~~~~~~~~~~~~~~~
!!! error TS2308: Module "./t1" has already exported a member named 'y'. Consider explicitly re-exporting to resolve the ambiguity.
==== tests/cases/conformance/es6/modules/main.ts (1 errors) ====
import hello, { x, y, z, foo } from "./t4";
@@ -0,0 +1,27 @@
//// [extendConstructSignatureInInterface.ts]
interface C {
new(x: number): C;
}
var CStatic: C;
class E extends CStatic {
}
var e: E = new E(1);
//// [extendConstructSignatureInInterface.js]
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var CStatic;
var E = (function (_super) {
__extends(E, _super);
function E() {
_super.apply(this, arguments);
}
return E;
})(CStatic);
var e = new E(1);
@@ -0,0 +1,23 @@
=== tests/cases/compiler/extendConstructSignatureInInterface.ts ===
interface C {
>C : Symbol(C, Decl(extendConstructSignatureInInterface.ts, 0, 0))
new(x: number): C;
>x : Symbol(x, Decl(extendConstructSignatureInInterface.ts, 1, 8))
>C : Symbol(C, Decl(extendConstructSignatureInInterface.ts, 0, 0))
}
var CStatic: C;
>CStatic : Symbol(CStatic, Decl(extendConstructSignatureInInterface.ts, 4, 3))
>C : Symbol(C, Decl(extendConstructSignatureInInterface.ts, 0, 0))
class E extends CStatic {
>E : Symbol(E, Decl(extendConstructSignatureInInterface.ts, 4, 15))
>CStatic : Symbol(CStatic, Decl(extendConstructSignatureInInterface.ts, 4, 3))
}
var e: E = new E(1);
>e : Symbol(e, Decl(extendConstructSignatureInInterface.ts, 8, 3))
>E : Symbol(E, Decl(extendConstructSignatureInInterface.ts, 4, 15))
>E : Symbol(E, Decl(extendConstructSignatureInInterface.ts, 4, 15))
@@ -0,0 +1,25 @@
=== tests/cases/compiler/extendConstructSignatureInInterface.ts ===
interface C {
>C : C
new(x: number): C;
>x : number
>C : C
}
var CStatic: C;
>CStatic : C
>C : C
class E extends CStatic {
>E : E
>CStatic : C
}
var e: E = new E(1);
>e : E
>E : E
>new E(1) : E
>E : typeof E
>1 : number
@@ -0,0 +1,16 @@
//// [tests/cases/compiler/missingSemicolonInModuleSpecifier.ts] ////
//// [a.ts]
export const x = 1;
//// [b.ts]
import {x} from "./a"
(function() { return 1; }())
//// [a.js]
"use strict";
exports.x = 1;
//// [b.js]
"use strict";
(function () { return 1; }());
@@ -0,0 +1,10 @@
=== tests/cases/compiler/a.ts ===
export const x = 1;
>x : Symbol(x, Decl(a.ts, 1, 12))
=== tests/cases/compiler/b.ts ===
import {x} from "./a"
>x : Symbol(x, Decl(b.ts, 0, 8))
(function() { return 1; }())
@@ -0,0 +1,16 @@
=== tests/cases/compiler/a.ts ===
export const x = 1;
>x : number
>1 : number
=== tests/cases/compiler/b.ts ===
import {x} from "./a"
>x : number
(function() { return 1; }())
>(function() { return 1; }()) : number
>function() { return 1; }() : number
>function() { return 1; } : () => number
>1 : number
@@ -0,0 +1,55 @@
tests/cases/compiler/moduleDuplicateIdentifiers.ts(1,12): error TS2323: Cannot redeclare exported variable 'Foo'.
tests/cases/compiler/moduleDuplicateIdentifiers.ts(2,12): error TS2323: Cannot redeclare exported variable 'Foo'.
tests/cases/compiler/moduleDuplicateIdentifiers.ts(20,14): error TS2300: Duplicate identifier 'Kettle'.
tests/cases/compiler/moduleDuplicateIdentifiers.ts(24,14): error TS2300: Duplicate identifier 'Kettle'.
==== tests/cases/compiler/moduleDuplicateIdentifiers.ts (4 errors) ====
export var Foo = 2;
~~~
!!! error TS2323: Cannot redeclare exported variable 'Foo'.
export var Foo = 42; // Should error
~~~
!!! error TS2323: Cannot redeclare exported variable 'Foo'.
export interface Bar {
_brand1: any;
}
export interface Bar { // Shouldn't error
_brand2: any;
}
export namespace FooBar {
export var member1 = 2;
}
export namespace FooBar { // Shouldn't error
export var member2 = 42;
}
export class Kettle {
~~~~~~
!!! error TS2300: Duplicate identifier 'Kettle'.
member1 = 2;
}
export class Kettle { // Should error
~~~~~~
!!! error TS2300: Duplicate identifier 'Kettle'.
member2 = 42;
}
export var Pot = 2;
Pot = 42; // Shouldn't error
export enum Utensils {
Spoon,
Fork,
Knife
}
export enum Utensils { // Shouldn't error
Spork = 3
}
@@ -0,0 +1,80 @@
//// [moduleDuplicateIdentifiers.ts]
export var Foo = 2;
export var Foo = 42; // Should error
export interface Bar {
_brand1: any;
}
export interface Bar { // Shouldn't error
_brand2: any;
}
export namespace FooBar {
export var member1 = 2;
}
export namespace FooBar { // Shouldn't error
export var member2 = 42;
}
export class Kettle {
member1 = 2;
}
export class Kettle { // Should error
member2 = 42;
}
export var Pot = 2;
Pot = 42; // Shouldn't error
export enum Utensils {
Spoon,
Fork,
Knife
}
export enum Utensils { // Shouldn't error
Spork = 3
}
//// [moduleDuplicateIdentifiers.js]
"use strict";
exports.Foo = 2;
exports.Foo = 42; // Should error
var FooBar;
(function (FooBar) {
FooBar.member1 = 2;
})(FooBar = exports.FooBar || (exports.FooBar = {}));
var FooBar;
(function (FooBar) {
FooBar.member2 = 42;
})(FooBar = exports.FooBar || (exports.FooBar = {}));
var Kettle = (function () {
function Kettle() {
this.member1 = 2;
}
return Kettle;
})();
exports.Kettle = Kettle;
var Kettle = (function () {
function Kettle() {
this.member2 = 42;
}
return Kettle;
})();
exports.Kettle = Kettle;
exports.Pot = 2;
exports.Pot = 42; // Shouldn't error
(function (Utensils) {
Utensils[Utensils["Spoon"] = 0] = "Spoon";
Utensils[Utensils["Fork"] = 1] = "Fork";
Utensils[Utensils["Knife"] = 2] = "Knife";
})(exports.Utensils || (exports.Utensils = {}));
var Utensils = exports.Utensils;
(function (Utensils) {
Utensils[Utensils["Spork"] = 3] = "Spork";
})(exports.Utensils || (exports.Utensils = {}));
var Utensils = exports.Utensils;
@@ -0,0 +1,28 @@
//// [tests/cases/compiler/moduleSameValueDuplicateExportedBindings1.ts] ////
//// [a.ts]
export * from "./b";
export * from "./c";
//// [b.ts]
export * from "./c";
//// [c.ts]
export var foo = 42;
//// [c.js]
"use strict";
exports.foo = 42;
//// [b.js]
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
__export(require("./c"));
//// [a.js]
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
__export(require("./b"));
__export(require("./c"));
@@ -0,0 +1,11 @@
=== tests/cases/compiler/a.ts ===
export * from "./b";
No type information for this code.export * from "./c";
No type information for this code.
No type information for this code.=== tests/cases/compiler/b.ts ===
export * from "./c";
No type information for this code.
No type information for this code.=== tests/cases/compiler/c.ts ===
export var foo = 42;
>foo : Symbol(foo, Decl(c.ts, 0, 10))
@@ -0,0 +1,12 @@
=== tests/cases/compiler/a.ts ===
export * from "./b";
No type information for this code.export * from "./c";
No type information for this code.
No type information for this code.=== tests/cases/compiler/b.ts ===
export * from "./c";
No type information for this code.
No type information for this code.=== tests/cases/compiler/c.ts ===
export var foo = 42;
>foo : number
>42 : number
@@ -0,0 +1,34 @@
//// [tests/cases/compiler/moduleSameValueDuplicateExportedBindings2.ts] ////
//// [a.ts]
export * from "./b";
export * from "./c";
//// [b.ts]
export {Animals} from "./c";
//// [c.ts]
export enum Animals {
Cat,
Dog
};
//// [c.js]
"use strict";
(function (Animals) {
Animals[Animals["Cat"] = 0] = "Cat";
Animals[Animals["Dog"] = 1] = "Dog";
})(exports.Animals || (exports.Animals = {}));
var Animals = exports.Animals;
;
//// [b.js]
"use strict";
var c_1 = require("./c");
exports.Animals = c_1.Animals;
//// [a.js]
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
__export(require("./b"));
__export(require("./c"));
@@ -0,0 +1,19 @@
=== tests/cases/compiler/a.ts ===
export * from "./b";
No type information for this code.export * from "./c";
No type information for this code.
No type information for this code.=== tests/cases/compiler/b.ts ===
export {Animals} from "./c";
>Animals : Symbol(Animals, Decl(b.ts, 0, 8))
=== tests/cases/compiler/c.ts ===
export enum Animals {
>Animals : Symbol(Animals, Decl(c.ts, 0, 0))
Cat,
>Cat : Symbol(Animals.Cat, Decl(c.ts, 0, 21))
Dog
>Dog : Symbol(Animals.Dog, Decl(c.ts, 1, 5))
};
@@ -0,0 +1,19 @@
=== tests/cases/compiler/a.ts ===
export * from "./b";
No type information for this code.export * from "./c";
No type information for this code.
No type information for this code.=== tests/cases/compiler/b.ts ===
export {Animals} from "./c";
>Animals : typeof Animals
=== tests/cases/compiler/c.ts ===
export enum Animals {
>Animals : Animals
Cat,
>Cat : Animals
Dog
>Dog : Animals
};
@@ -1,17 +1,23 @@
tests/cases/conformance/es6/modules/m1.ts(2,25): error TS2323: Cannot redeclare exported variable 'default'.
tests/cases/conformance/es6/modules/m1.ts(2,25): error TS2393: Duplicate function implementation.
tests/cases/conformance/es6/modules/m1.ts(6,25): error TS2323: Cannot redeclare exported variable 'default'.
tests/cases/conformance/es6/modules/m1.ts(6,25): error TS2393: Duplicate function implementation.
==== tests/cases/conformance/es6/modules/m1.ts (2 errors) ====
==== tests/cases/conformance/es6/modules/m1.ts (4 errors) ====
export default function foo() {
~~~
!!! error TS2323: Cannot redeclare exported variable 'default'.
~~~
!!! error TS2393: Duplicate function implementation.
}
export default function bar() {
~~~
!!! error TS2323: Cannot redeclare exported variable 'default'.
~~~
!!! error TS2393: Duplicate function implementation.
}
@@ -1,15 +1,21 @@
tests/cases/conformance/es6/modules/multipleDefaultExports04.ts(2,25): error TS2323: Cannot redeclare exported variable 'default'.
tests/cases/conformance/es6/modules/multipleDefaultExports04.ts(2,25): error TS2393: Duplicate function implementation.
tests/cases/conformance/es6/modules/multipleDefaultExports04.ts(5,25): error TS2323: Cannot redeclare exported variable 'default'.
tests/cases/conformance/es6/modules/multipleDefaultExports04.ts(5,25): error TS2393: Duplicate function implementation.
==== tests/cases/conformance/es6/modules/multipleDefaultExports04.ts (2 errors) ====
==== tests/cases/conformance/es6/modules/multipleDefaultExports04.ts (4 errors) ====
export default function f() {
~
!!! error TS2323: Cannot redeclare exported variable 'default'.
~
!!! error TS2393: Duplicate function implementation.
}
export default function f() {
~
!!! error TS2323: Cannot redeclare exported variable 'default'.
~
!!! error TS2393: Duplicate function implementation.
}
@@ -0,0 +1,55 @@
tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport_core.ts(15,12): error TS2323: Cannot redeclare exported variable 'publicUse_im_public_mi_public'.
tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport_core.ts(17,12): error TS2323: Cannot redeclare exported variable 'publicUse_im_public_mi_public'.
==== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport_core.ts (2 errors) ====
///<reference path='privacyTopLevelAmbientExternalModuleImportWithExport_require2.ts'/>
///<reference path='privacyTopLevelAmbientExternalModuleImportWithExport_require3.ts'/>
// Privacy errors - importing private elements
export import im_public_mi_private = require("./privacyTopLevelAmbientExternalModuleImportWithExport_require");
export import im_public_mu_private = require("./privacyTopLevelAmbientExternalModuleImportWithExport_require1");
export import im_public_mi_public = require("m");
export import im_public_mu_public = require("m2");
// Usage of privacy error imports
var privateUse_im_public_mi_private = new im_public_mi_private.c_public();
export var publicUse_im_public_mi_private = new im_public_mi_private.c_public();
var privateUse_im_public_mu_private = new im_public_mu_private.c_public();
export var publicUse_im_public_mu_private = new im_public_mu_private.c_public();
var privateUse_im_public_mi_public = new im_public_mi_public.c_private();
export var publicUse_im_public_mi_public = new im_public_mi_public.c_private();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2323: Cannot redeclare exported variable 'publicUse_im_public_mi_public'.
var privateUse_im_public_mi_public = new im_public_mi_public.c_private();
export var publicUse_im_public_mi_public = new im_public_mi_public.c_private();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2323: Cannot redeclare exported variable 'publicUse_im_public_mi_public'.
==== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport_require.ts (0 errors) ====
// Public elements
export class c_public {
foo: string;
}
==== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport_require1.ts (0 errors) ====
export class c_public {
bar: string;
}
==== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport_require2.ts (0 errors) ====
// private elements
// Export - Error ambient modules allowed only in global
declare module 'm' {
export class c_private {
baz: string;
}
}
==== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport_require3.ts (0 errors) ====
declare module 'm2' {
export class c_private {
bing: string;
}
}
@@ -1,105 +0,0 @@
=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport_core.ts ===
///<reference path='privacyTopLevelAmbientExternalModuleImportWithExport_require2.ts'/>
///<reference path='privacyTopLevelAmbientExternalModuleImportWithExport_require3.ts'/>
// Privacy errors - importing private elements
export import im_public_mi_private = require("./privacyTopLevelAmbientExternalModuleImportWithExport_require");
>im_public_mi_private : Symbol(im_public_mi_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 0, 0))
export import im_public_mu_private = require("./privacyTopLevelAmbientExternalModuleImportWithExport_require1");
>im_public_mu_private : Symbol(im_public_mu_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 3, 111))
export import im_public_mi_public = require("m");
>im_public_mi_public : Symbol(im_public_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 4, 112))
export import im_public_mu_public = require("m2");
>im_public_mu_public : Symbol(im_public_mu_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 5, 49))
// Usage of privacy error imports
var privateUse_im_public_mi_private = new im_public_mi_private.c_public();
>privateUse_im_public_mi_private : Symbol(privateUse_im_public_mi_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 9, 3))
>im_public_mi_private.c_public : Symbol(im_public_mi_private.c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require.ts, 0, 0))
>im_public_mi_private : Symbol(im_public_mi_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 0, 0))
>c_public : Symbol(im_public_mi_private.c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require.ts, 0, 0))
export var publicUse_im_public_mi_private = new im_public_mi_private.c_public();
>publicUse_im_public_mi_private : Symbol(publicUse_im_public_mi_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 10, 10))
>im_public_mi_private.c_public : Symbol(im_public_mi_private.c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require.ts, 0, 0))
>im_public_mi_private : Symbol(im_public_mi_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 0, 0))
>c_public : Symbol(im_public_mi_private.c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require.ts, 0, 0))
var privateUse_im_public_mu_private = new im_public_mu_private.c_public();
>privateUse_im_public_mu_private : Symbol(privateUse_im_public_mu_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 11, 3))
>im_public_mu_private.c_public : Symbol(im_public_mu_private.c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require1.ts, 0, 0))
>im_public_mu_private : Symbol(im_public_mu_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 3, 111))
>c_public : Symbol(im_public_mu_private.c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require1.ts, 0, 0))
export var publicUse_im_public_mu_private = new im_public_mu_private.c_public();
>publicUse_im_public_mu_private : Symbol(publicUse_im_public_mu_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 12, 10))
>im_public_mu_private.c_public : Symbol(im_public_mu_private.c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require1.ts, 0, 0))
>im_public_mu_private : Symbol(im_public_mu_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 3, 111))
>c_public : Symbol(im_public_mu_private.c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require1.ts, 0, 0))
var privateUse_im_public_mi_public = new im_public_mi_public.c_private();
>privateUse_im_public_mi_public : Symbol(privateUse_im_public_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 13, 3), Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 15, 3))
>im_public_mi_public.c_private : Symbol(im_public_mi_public.c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require2.ts, 2, 20))
>im_public_mi_public : Symbol(im_public_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 4, 112))
>c_private : Symbol(im_public_mi_public.c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require2.ts, 2, 20))
export var publicUse_im_public_mi_public = new im_public_mi_public.c_private();
>publicUse_im_public_mi_public : Symbol(publicUse_im_public_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 14, 10), Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 16, 10))
>im_public_mi_public.c_private : Symbol(im_public_mi_public.c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require2.ts, 2, 20))
>im_public_mi_public : Symbol(im_public_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 4, 112))
>c_private : Symbol(im_public_mi_public.c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require2.ts, 2, 20))
var privateUse_im_public_mi_public = new im_public_mi_public.c_private();
>privateUse_im_public_mi_public : Symbol(privateUse_im_public_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 13, 3), Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 15, 3))
>im_public_mi_public.c_private : Symbol(im_public_mi_public.c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require2.ts, 2, 20))
>im_public_mi_public : Symbol(im_public_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 4, 112))
>c_private : Symbol(im_public_mi_public.c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require2.ts, 2, 20))
export var publicUse_im_public_mi_public = new im_public_mi_public.c_private();
>publicUse_im_public_mi_public : Symbol(publicUse_im_public_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 14, 10), Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 16, 10))
>im_public_mi_public.c_private : Symbol(im_public_mi_public.c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require2.ts, 2, 20))
>im_public_mi_public : Symbol(im_public_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_core.ts, 4, 112))
>c_private : Symbol(im_public_mi_public.c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require2.ts, 2, 20))
=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport_require.ts ===
// Public elements
export class c_public {
>c_public : Symbol(c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require.ts, 0, 0))
foo: string;
>foo : Symbol(foo, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require.ts, 1, 23))
}
=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport_require1.ts ===
export class c_public {
>c_public : Symbol(c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require1.ts, 0, 0))
bar: string;
>bar : Symbol(bar, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require1.ts, 0, 23))
}
=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport_require2.ts ===
// private elements
// Export - Error ambient modules allowed only in global
declare module 'm' {
export class c_private {
>c_private : Symbol(c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require2.ts, 2, 20))
baz: string;
>baz : Symbol(baz, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require2.ts, 3, 28))
}
}
=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport_require3.ts ===
declare module 'm2' {
export class c_private {
>c_private : Symbol(c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require3.ts, 0, 21))
bing: string;
>bing : Symbol(bing, Decl(privacyTopLevelAmbientExternalModuleImportWithExport_require3.ts, 1, 28))
}
}
@@ -1,113 +0,0 @@
=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport_core.ts ===
///<reference path='privacyTopLevelAmbientExternalModuleImportWithExport_require2.ts'/>
///<reference path='privacyTopLevelAmbientExternalModuleImportWithExport_require3.ts'/>
// Privacy errors - importing private elements
export import im_public_mi_private = require("./privacyTopLevelAmbientExternalModuleImportWithExport_require");
>im_public_mi_private : typeof im_public_mi_private
export import im_public_mu_private = require("./privacyTopLevelAmbientExternalModuleImportWithExport_require1");
>im_public_mu_private : typeof im_public_mu_private
export import im_public_mi_public = require("m");
>im_public_mi_public : typeof im_public_mi_public
export import im_public_mu_public = require("m2");
>im_public_mu_public : typeof im_public_mu_public
// Usage of privacy error imports
var privateUse_im_public_mi_private = new im_public_mi_private.c_public();
>privateUse_im_public_mi_private : im_public_mi_private.c_public
>new im_public_mi_private.c_public() : im_public_mi_private.c_public
>im_public_mi_private.c_public : typeof im_public_mi_private.c_public
>im_public_mi_private : typeof im_public_mi_private
>c_public : typeof im_public_mi_private.c_public
export var publicUse_im_public_mi_private = new im_public_mi_private.c_public();
>publicUse_im_public_mi_private : im_public_mi_private.c_public
>new im_public_mi_private.c_public() : im_public_mi_private.c_public
>im_public_mi_private.c_public : typeof im_public_mi_private.c_public
>im_public_mi_private : typeof im_public_mi_private
>c_public : typeof im_public_mi_private.c_public
var privateUse_im_public_mu_private = new im_public_mu_private.c_public();
>privateUse_im_public_mu_private : im_public_mu_private.c_public
>new im_public_mu_private.c_public() : im_public_mu_private.c_public
>im_public_mu_private.c_public : typeof im_public_mu_private.c_public
>im_public_mu_private : typeof im_public_mu_private
>c_public : typeof im_public_mu_private.c_public
export var publicUse_im_public_mu_private = new im_public_mu_private.c_public();
>publicUse_im_public_mu_private : im_public_mu_private.c_public
>new im_public_mu_private.c_public() : im_public_mu_private.c_public
>im_public_mu_private.c_public : typeof im_public_mu_private.c_public
>im_public_mu_private : typeof im_public_mu_private
>c_public : typeof im_public_mu_private.c_public
var privateUse_im_public_mi_public = new im_public_mi_public.c_private();
>privateUse_im_public_mi_public : im_public_mi_public.c_private
>new im_public_mi_public.c_private() : im_public_mi_public.c_private
>im_public_mi_public.c_private : typeof im_public_mi_public.c_private
>im_public_mi_public : typeof im_public_mi_public
>c_private : typeof im_public_mi_public.c_private
export var publicUse_im_public_mi_public = new im_public_mi_public.c_private();
>publicUse_im_public_mi_public : im_public_mi_public.c_private
>new im_public_mi_public.c_private() : im_public_mi_public.c_private
>im_public_mi_public.c_private : typeof im_public_mi_public.c_private
>im_public_mi_public : typeof im_public_mi_public
>c_private : typeof im_public_mi_public.c_private
var privateUse_im_public_mi_public = new im_public_mi_public.c_private();
>privateUse_im_public_mi_public : im_public_mi_public.c_private
>new im_public_mi_public.c_private() : im_public_mi_public.c_private
>im_public_mi_public.c_private : typeof im_public_mi_public.c_private
>im_public_mi_public : typeof im_public_mi_public
>c_private : typeof im_public_mi_public.c_private
export var publicUse_im_public_mi_public = new im_public_mi_public.c_private();
>publicUse_im_public_mi_public : im_public_mi_public.c_private
>new im_public_mi_public.c_private() : im_public_mi_public.c_private
>im_public_mi_public.c_private : typeof im_public_mi_public.c_private
>im_public_mi_public : typeof im_public_mi_public
>c_private : typeof im_public_mi_public.c_private
=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport_require.ts ===
// Public elements
export class c_public {
>c_public : c_public
foo: string;
>foo : string
}
=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport_require1.ts ===
export class c_public {
>c_public : c_public
bar: string;
>bar : string
}
=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport_require2.ts ===
// private elements
// Export - Error ambient modules allowed only in global
declare module 'm' {
export class c_private {
>c_private : c_private
baz: string;
>baz : string
}
}
=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithExport_require3.ts ===
declare module 'm2' {
export class c_private {
>c_private : c_private
bing: string;
>bing : string
}
}
@@ -0,0 +1,55 @@
tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts(15,12): error TS2323: Cannot redeclare exported variable 'publicUse_im_private_mi_public'.
tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts(17,12): error TS2323: Cannot redeclare exported variable 'publicUse_im_private_mi_public'.
==== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts (2 errors) ====
///<reference path='privacyTopLevelAmbientExternalModuleImportWithoutExport_require2.ts'/>
///<reference path='privacyTopLevelAmbientExternalModuleImportWithoutExport_require3.ts'/>
// Privacy errors - importing private elements
import im_private_mi_private = require("m");
import im_private_mu_private = require("m2");
import im_private_mi_public = require("privacyTopLevelAmbientExternalModuleImportWithoutExport_require");
import im_private_mu_public = require("privacyTopLevelAmbientExternalModuleImportWithoutExport_require1");
// Usage of privacy error imports
var privateUse_im_private_mi_private = new im_private_mi_private.c_private();
export var publicUse_im_private_mi_private = new im_private_mi_private.c_private();
var privateUse_im_private_mu_private = new im_private_mu_private.c_private();
export var publicUse_im_private_mu_private = new im_private_mu_private.c_private();
var privateUse_im_private_mi_public = new im_private_mi_public.c_public();
export var publicUse_im_private_mi_public = new im_private_mi_public.c_public();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2323: Cannot redeclare exported variable 'publicUse_im_private_mi_public'.
var privateUse_im_private_mi_public = new im_private_mi_public.c_public();
export var publicUse_im_private_mi_public = new im_private_mi_public.c_public();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2323: Cannot redeclare exported variable 'publicUse_im_private_mi_public'.
==== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithoutExport_require.ts (0 errors) ====
// Public elements
export class c_public {
foo: string;
}
==== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithoutExport_require1.ts (0 errors) ====
export class c_public {
bar: string;
}
==== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithoutExport_require2.ts (0 errors) ====
// private elements
// Export - Error ambient modules allowed only in global
declare module 'm' {
export class c_private {
baz: string
}
}
==== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithoutExport_require3.ts (0 errors) ====
declare module 'm2' {
export class c_private {
bing: string;
}
}
@@ -1,105 +0,0 @@
=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts ===
///<reference path='privacyTopLevelAmbientExternalModuleImportWithoutExport_require2.ts'/>
///<reference path='privacyTopLevelAmbientExternalModuleImportWithoutExport_require3.ts'/>
// Privacy errors - importing private elements
import im_private_mi_private = require("m");
>im_private_mi_private : Symbol(im_private_mi_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 0, 0))
import im_private_mu_private = require("m2");
>im_private_mu_private : Symbol(im_private_mu_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 3, 44))
import im_private_mi_public = require("privacyTopLevelAmbientExternalModuleImportWithoutExport_require");
>im_private_mi_public : Symbol(im_private_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 4, 45))
import im_private_mu_public = require("privacyTopLevelAmbientExternalModuleImportWithoutExport_require1");
>im_private_mu_public : Symbol(im_private_mu_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 5, 105))
// Usage of privacy error imports
var privateUse_im_private_mi_private = new im_private_mi_private.c_private();
>privateUse_im_private_mi_private : Symbol(privateUse_im_private_mi_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 9, 3))
>im_private_mi_private.c_private : Symbol(im_private_mi_private.c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require2.ts, 2, 20))
>im_private_mi_private : Symbol(im_private_mi_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 0, 0))
>c_private : Symbol(im_private_mi_private.c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require2.ts, 2, 20))
export var publicUse_im_private_mi_private = new im_private_mi_private.c_private();
>publicUse_im_private_mi_private : Symbol(publicUse_im_private_mi_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 10, 10))
>im_private_mi_private.c_private : Symbol(im_private_mi_private.c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require2.ts, 2, 20))
>im_private_mi_private : Symbol(im_private_mi_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 0, 0))
>c_private : Symbol(im_private_mi_private.c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require2.ts, 2, 20))
var privateUse_im_private_mu_private = new im_private_mu_private.c_private();
>privateUse_im_private_mu_private : Symbol(privateUse_im_private_mu_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 11, 3))
>im_private_mu_private.c_private : Symbol(im_private_mu_private.c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require3.ts, 0, 21))
>im_private_mu_private : Symbol(im_private_mu_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 3, 44))
>c_private : Symbol(im_private_mu_private.c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require3.ts, 0, 21))
export var publicUse_im_private_mu_private = new im_private_mu_private.c_private();
>publicUse_im_private_mu_private : Symbol(publicUse_im_private_mu_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 12, 10))
>im_private_mu_private.c_private : Symbol(im_private_mu_private.c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require3.ts, 0, 21))
>im_private_mu_private : Symbol(im_private_mu_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 3, 44))
>c_private : Symbol(im_private_mu_private.c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require3.ts, 0, 21))
var privateUse_im_private_mi_public = new im_private_mi_public.c_public();
>privateUse_im_private_mi_public : Symbol(privateUse_im_private_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 13, 3), Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 15, 3))
>im_private_mi_public.c_public : Symbol(im_private_mi_public.c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require.ts, 0, 0))
>im_private_mi_public : Symbol(im_private_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 4, 45))
>c_public : Symbol(im_private_mi_public.c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require.ts, 0, 0))
export var publicUse_im_private_mi_public = new im_private_mi_public.c_public();
>publicUse_im_private_mi_public : Symbol(publicUse_im_private_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 14, 10), Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 16, 10))
>im_private_mi_public.c_public : Symbol(im_private_mi_public.c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require.ts, 0, 0))
>im_private_mi_public : Symbol(im_private_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 4, 45))
>c_public : Symbol(im_private_mi_public.c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require.ts, 0, 0))
var privateUse_im_private_mi_public = new im_private_mi_public.c_public();
>privateUse_im_private_mi_public : Symbol(privateUse_im_private_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 13, 3), Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 15, 3))
>im_private_mi_public.c_public : Symbol(im_private_mi_public.c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require.ts, 0, 0))
>im_private_mi_public : Symbol(im_private_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 4, 45))
>c_public : Symbol(im_private_mi_public.c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require.ts, 0, 0))
export var publicUse_im_private_mi_public = new im_private_mi_public.c_public();
>publicUse_im_private_mi_public : Symbol(publicUse_im_private_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 14, 10), Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 16, 10))
>im_private_mi_public.c_public : Symbol(im_private_mi_public.c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require.ts, 0, 0))
>im_private_mi_public : Symbol(im_private_mi_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts, 4, 45))
>c_public : Symbol(im_private_mi_public.c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require.ts, 0, 0))
=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithoutExport_require.ts ===
// Public elements
export class c_public {
>c_public : Symbol(c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require.ts, 0, 0))
foo: string;
>foo : Symbol(foo, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require.ts, 2, 23))
}
=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithoutExport_require1.ts ===
export class c_public {
>c_public : Symbol(c_public, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require1.ts, 0, 0))
bar: string;
>bar : Symbol(bar, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require1.ts, 0, 23))
}
=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithoutExport_require2.ts ===
// private elements
// Export - Error ambient modules allowed only in global
declare module 'm' {
export class c_private {
>c_private : Symbol(c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require2.ts, 2, 20))
baz: string
>baz : Symbol(baz, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require2.ts, 3, 28))
}
}
=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithoutExport_require3.ts ===
declare module 'm2' {
export class c_private {
>c_private : Symbol(c_private, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require3.ts, 0, 21))
bing: string;
>bing : Symbol(bing, Decl(privacyTopLevelAmbientExternalModuleImportWithoutExport_require3.ts, 1, 28))
}
}
@@ -1,113 +0,0 @@
=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithoutExport_core.ts ===
///<reference path='privacyTopLevelAmbientExternalModuleImportWithoutExport_require2.ts'/>
///<reference path='privacyTopLevelAmbientExternalModuleImportWithoutExport_require3.ts'/>
// Privacy errors - importing private elements
import im_private_mi_private = require("m");
>im_private_mi_private : typeof im_private_mi_private
import im_private_mu_private = require("m2");
>im_private_mu_private : typeof im_private_mu_private
import im_private_mi_public = require("privacyTopLevelAmbientExternalModuleImportWithoutExport_require");
>im_private_mi_public : typeof im_private_mi_public
import im_private_mu_public = require("privacyTopLevelAmbientExternalModuleImportWithoutExport_require1");
>im_private_mu_public : typeof im_private_mu_public
// Usage of privacy error imports
var privateUse_im_private_mi_private = new im_private_mi_private.c_private();
>privateUse_im_private_mi_private : im_private_mi_private.c_private
>new im_private_mi_private.c_private() : im_private_mi_private.c_private
>im_private_mi_private.c_private : typeof im_private_mi_private.c_private
>im_private_mi_private : typeof im_private_mi_private
>c_private : typeof im_private_mi_private.c_private
export var publicUse_im_private_mi_private = new im_private_mi_private.c_private();
>publicUse_im_private_mi_private : im_private_mi_private.c_private
>new im_private_mi_private.c_private() : im_private_mi_private.c_private
>im_private_mi_private.c_private : typeof im_private_mi_private.c_private
>im_private_mi_private : typeof im_private_mi_private
>c_private : typeof im_private_mi_private.c_private
var privateUse_im_private_mu_private = new im_private_mu_private.c_private();
>privateUse_im_private_mu_private : im_private_mu_private.c_private
>new im_private_mu_private.c_private() : im_private_mu_private.c_private
>im_private_mu_private.c_private : typeof im_private_mu_private.c_private
>im_private_mu_private : typeof im_private_mu_private
>c_private : typeof im_private_mu_private.c_private
export var publicUse_im_private_mu_private = new im_private_mu_private.c_private();
>publicUse_im_private_mu_private : im_private_mu_private.c_private
>new im_private_mu_private.c_private() : im_private_mu_private.c_private
>im_private_mu_private.c_private : typeof im_private_mu_private.c_private
>im_private_mu_private : typeof im_private_mu_private
>c_private : typeof im_private_mu_private.c_private
var privateUse_im_private_mi_public = new im_private_mi_public.c_public();
>privateUse_im_private_mi_public : im_private_mi_public.c_public
>new im_private_mi_public.c_public() : im_private_mi_public.c_public
>im_private_mi_public.c_public : typeof im_private_mi_public.c_public
>im_private_mi_public : typeof im_private_mi_public
>c_public : typeof im_private_mi_public.c_public
export var publicUse_im_private_mi_public = new im_private_mi_public.c_public();
>publicUse_im_private_mi_public : im_private_mi_public.c_public
>new im_private_mi_public.c_public() : im_private_mi_public.c_public
>im_private_mi_public.c_public : typeof im_private_mi_public.c_public
>im_private_mi_public : typeof im_private_mi_public
>c_public : typeof im_private_mi_public.c_public
var privateUse_im_private_mi_public = new im_private_mi_public.c_public();
>privateUse_im_private_mi_public : im_private_mi_public.c_public
>new im_private_mi_public.c_public() : im_private_mi_public.c_public
>im_private_mi_public.c_public : typeof im_private_mi_public.c_public
>im_private_mi_public : typeof im_private_mi_public
>c_public : typeof im_private_mi_public.c_public
export var publicUse_im_private_mi_public = new im_private_mi_public.c_public();
>publicUse_im_private_mi_public : im_private_mi_public.c_public
>new im_private_mi_public.c_public() : im_private_mi_public.c_public
>im_private_mi_public.c_public : typeof im_private_mi_public.c_public
>im_private_mi_public : typeof im_private_mi_public
>c_public : typeof im_private_mi_public.c_public
=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithoutExport_require.ts ===
// Public elements
export class c_public {
>c_public : c_public
foo: string;
>foo : string
}
=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithoutExport_require1.ts ===
export class c_public {
>c_public : c_public
bar: string;
>bar : string
}
=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithoutExport_require2.ts ===
// private elements
// Export - Error ambient modules allowed only in global
declare module 'm' {
export class c_private {
>c_private : c_private
baz: string
>baz : string
}
}
=== tests/cases/compiler/privacyTopLevelAmbientExternalModuleImportWithoutExport_require3.ts ===
declare module 'm2' {
export class c_private {
>c_private : c_private
bing: string;
>bing : string
}
}
@@ -1,5 +1,5 @@
tests/cases/compiler/recursiveBaseConstructorCreation3.ts(6,27): error TS2314: Generic type 'abc<T>' requires 1 type argument(s).
tests/cases/compiler/recursiveBaseConstructorCreation3.ts(10,18): error TS2339: Property 'foo' does not exist on type 'xyz'.
tests/cases/compiler/recursiveBaseConstructorCreation3.ts(9,11): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
==== tests/cases/compiler/recursiveBaseConstructorCreation3.ts (2 errors) ====
@@ -14,6 +14,6 @@ tests/cases/compiler/recursiveBaseConstructorCreation3.ts(10,18): error TS2339:
}
var bar = new xyz(); // Error: Invalid 'new' expression.
var r: xyz = bar.foo;
~~~
!!! error TS2339: Property 'foo' does not exist on type 'xyz'.
~~~~~~~~~
!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
var r: xyz = bar.foo;
@@ -16,6 +16,7 @@ import {x} from "test";
use(x);
//// [f.js]
#!/usr/bin/env node"use strict";
#!/usr/bin/env node
"use strict";
var test_1 = require("test");
use(test_1.x);
@@ -1,8 +1,10 @@
tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType.ts(2,1): error TS1148: Cannot compile modules unless the '--module' flag is provided.
tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType.ts(20,12): error TS2323: Cannot redeclare exported variable 'r5'.
tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType.ts(21,12): error TS2323: Cannot redeclare exported variable 'r5'.
tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType.ts(42,12): error TS2502: 'r12' is referenced directly or indirectly in its own type annotation.
==== tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType.ts (2 errors) ====
==== tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType.ts (4 errors) ====
var x = 1;
export var r1: typeof x;
~~~~~~~~~~~~~~~~~~~~~~~~
@@ -25,7 +27,11 @@ tests/cases/conformance/types/specifyingTypes/typeQueries/typeofANonExportedType
export var i: I;
var i2: I;
export var r5: typeof i;
~~
!!! error TS2323: Cannot redeclare exported variable 'r5'.
export var r5: typeof i2;
~~
!!! error TS2323: Cannot redeclare exported variable 'r5'.
module M {
export var foo = '';
@@ -1,8 +1,10 @@
tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided.
tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.ts(20,12): error TS2323: Cannot redeclare exported variable 'r5'.
tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.ts(21,12): error TS2323: Cannot redeclare exported variable 'r5'.
tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.ts(42,12): error TS2502: 'r12' is referenced directly or indirectly in its own type annotation.
==== tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.ts (2 errors) ====
==== tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.ts (4 errors) ====
export var x = 1;
~~~~~~~~~~~~~~~~~
!!! error TS1148: Cannot compile modules unless the '--module' flag is provided.
@@ -25,7 +27,11 @@ tests/cases/conformance/types/specifyingTypes/typeQueries/typeofAnExportedType.t
export var i: I;
var i2: I;
export var r5: typeof i;
~~
!!! error TS2323: Cannot redeclare exported variable 'r5'.
export var r5: typeof i2;
~~
!!! error TS2323: Cannot redeclare exported variable 'r5'.
export module M {
export var foo = '';
@@ -0,0 +1,11 @@
tests/cases/compiler/undefinedTypeAssignment1.ts(1,1): error TS2397: Declaration name conflicts with built-in global identifier 'undefined'.
==== tests/cases/compiler/undefinedTypeAssignment1.ts (1 errors) ====
type undefined = string;
~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2397: Declaration name conflicts with built-in global identifier 'undefined'.
function p(undefined = "wat") {
return undefined;
}
@@ -0,0 +1,12 @@
//// [undefinedTypeAssignment1.ts]
type undefined = string;
function p(undefined = "wat") {
return undefined;
}
//// [undefinedTypeAssignment1.js]
function p(undefined) {
if (undefined === void 0) { undefined = "wat"; }
return undefined;
}
@@ -0,0 +1,8 @@
tests/cases/compiler/undefinedTypeAssignment2.ts(1,5): error TS2397: Declaration name conflicts with built-in global identifier 'undefined'.
==== tests/cases/compiler/undefinedTypeAssignment2.ts (1 errors) ====
var undefined = void 0;
~~~~~~~~~
!!! error TS2397: Declaration name conflicts with built-in global identifier 'undefined'.
@@ -0,0 +1,6 @@
//// [undefinedTypeAssignment2.ts]
var undefined = void 0;
//// [undefinedTypeAssignment2.js]
var undefined = void 0;
@@ -0,0 +1,8 @@
tests/cases/compiler/undefinedTypeAssignment3.ts(1,5): error TS2397: Declaration name conflicts with built-in global identifier 'undefined'.
==== tests/cases/compiler/undefinedTypeAssignment3.ts (1 errors) ====
var undefined = null;
~~~~~~~~~
!!! error TS2397: Declaration name conflicts with built-in global identifier 'undefined'.
@@ -0,0 +1,6 @@
//// [undefinedTypeAssignment3.ts]
var undefined = null;
//// [undefinedTypeAssignment3.js]
var undefined = null;
@@ -0,0 +1,24 @@
tests/cases/compiler/undefinedTypeAssignment4.ts(1,7): error TS2397: Declaration name conflicts with built-in global identifier 'undefined'.
tests/cases/compiler/undefinedTypeAssignment4.ts(4,11): error TS2397: Declaration name conflicts with built-in global identifier 'undefined'.
tests/cases/compiler/undefinedTypeAssignment4.ts(7,11): error TS2397: Declaration name conflicts with built-in global identifier 'undefined'.
==== tests/cases/compiler/undefinedTypeAssignment4.ts (3 errors) ====
class undefined {
~~~~~~~~~
!!! error TS2397: Declaration name conflicts with built-in global identifier 'undefined'.
foo: string;
}
interface undefined {
~~~~~~~~~
!!! error TS2397: Declaration name conflicts with built-in global identifier 'undefined'.
member: number;
}
namespace undefined {
~~~~~~~~~
!!! error TS2397: Declaration name conflicts with built-in global identifier 'undefined'.
export var x = 42;
}
var x: undefined;
var y: typeof undefined;
@@ -0,0 +1,26 @@
//// [undefinedTypeAssignment4.ts]
class undefined {
foo: string;
}
interface undefined {
member: number;
}
namespace undefined {
export var x = 42;
}
var x: undefined;
var y: typeof undefined;
//// [undefinedTypeAssignment4.js]
var undefined = (function () {
function undefined() {
}
return undefined;
})();
var undefined;
(function (undefined) {
undefined.x = 42;
})(undefined || (undefined = {}));
var x;
var y;
@@ -0,0 +1,9 @@
interface C {
new(x: number): C;
}
var CStatic: C;
class E extends CStatic {
}
var e: E = new E(1);
@@ -0,0 +1,8 @@
// @module: commonjs
// @filename: a.ts
export const x = 1;
// @filename: b.ts
import {x} from "./a"
(function() { return 1; }())
@@ -0,0 +1,40 @@
// @module: commonjs
export var Foo = 2;
export var Foo = 42; // Should error
export interface Bar {
_brand1: any;
}
export interface Bar { // Shouldn't error
_brand2: any;
}
export namespace FooBar {
export var member1 = 2;
}
export namespace FooBar { // Shouldn't error
export var member2 = 42;
}
export class Kettle {
member1 = 2;
}
export class Kettle { // Should error
member2 = 42;
}
export var Pot = 2;
Pot = 42; // Shouldn't error
export enum Utensils {
Spoon,
Fork,
Knife
}
export enum Utensils { // Shouldn't error
Spork = 3
}
@@ -0,0 +1,10 @@
// @module: commonjs
// @filename: a.ts
export * from "./b";
export * from "./c";
// @filename: b.ts
export * from "./c";
// @filename: c.ts
export var foo = 42;
@@ -0,0 +1,13 @@
// @module: commonjs
// @filename: a.ts
export * from "./b";
export * from "./c";
// @filename: b.ts
export {Animals} from "./c";
// @filename: c.ts
export enum Animals {
Cat,
Dog
};
@@ -0,0 +1,4 @@
type undefined = string;
function p(undefined = "wat") {
return undefined;
}
@@ -0,0 +1 @@
var undefined = void 0;
@@ -0,0 +1 @@
var undefined = null;
@@ -0,0 +1,11 @@
class undefined {
foo: string;
}
interface undefined {
member: number;
}
namespace undefined {
export var x = 42;
}
var x: undefined;
var y: typeof undefined;
@@ -0,0 +1,10 @@
// @target: es6
export enum Animals {
Cat = 1
}
export enum Animals {
Dog = 2
}
export enum Animals {
CatDog = Cat | Dog
}