Merge pull request #5148 from weswigham/duplicate-export-behavior
Make export var or export *'s with duplicate identifiers an error
This commit is contained in:
commit
9b441d8343
|
@ -1103,39 +1103,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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14132,8 +14174,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) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
23
tests/baselines/reference/enumExportMergingES6.js
Normal file
23
tests/baselines/reference/enumExportMergingES6.js
Normal file
|
@ -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 = {}));
|
22
tests/baselines/reference/enumExportMergingES6.symbols
Normal file
22
tests/baselines/reference/enumExportMergingES6.symbols
Normal file
|
@ -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))
|
||||
}
|
||||
|
25
tests/baselines/reference/enumExportMergingES6.types
Normal file
25
tests/baselines/reference/enumExportMergingES6.types
Normal file
|
@ -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,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
|
||||
}
|
||||
|
80
tests/baselines/reference/moduleDuplicateIdentifiers.js
Normal file
80
tests/baselines/reference/moduleDuplicateIdentifiers.js
Normal file
|
@ -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,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 = '';
|
||||
|
|
40
tests/cases/compiler/moduleDuplicateIdentifiers.ts
Normal file
40
tests/cases/compiler/moduleDuplicateIdentifiers.ts
Normal file
|
@ -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
|
||||
};
|
10
tests/cases/conformance/enums/enumExportMergingES6.ts
Normal file
10
tests/cases/conformance/enums/enumExportMergingES6.ts
Normal file
|
@ -0,0 +1,10 @@
|
|||
// @target: es6
|
||||
export enum Animals {
|
||||
Cat = 1
|
||||
}
|
||||
export enum Animals {
|
||||
Dog = 2
|
||||
}
|
||||
export enum Animals {
|
||||
CatDog = Cat | Dog
|
||||
}
|
Loading…
Reference in a new issue