mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-12-11 09:24:19 -06:00
Merge pull request #33 from Microsoft/MergingErrors
Fix for Clodule declaration ordering
This commit is contained in:
commit
42b188cb11
@ -5556,16 +5556,38 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function getFirstNonAmbientClassOrFunctionDeclaration(symbol: Symbol): Declaration {
|
||||
var declarations = symbol.declarations;
|
||||
for (var i = 0; i < declarations.length; i++) {
|
||||
var declaration = declarations[i];
|
||||
if ((declaration.kind === SyntaxKind.ClassDeclaration || (declaration.kind === SyntaxKind.FunctionDeclaration && (<FunctionDeclaration>declaration).body)) && !isInAmbientContext(declaration)) {
|
||||
return declaration;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function checkModuleDeclaration(node: ModuleDeclaration) {
|
||||
checkDeclarationModifiers(node);
|
||||
var symbol = getSymbolOfNode(node);
|
||||
if (symbol.flags & SymbolFlags.ValueModule && symbol.declarations.length > 1 && !isInAmbientContext(node)) {
|
||||
var classOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol);
|
||||
if (classOrFunc) {
|
||||
if (getSourceFileOfNode(node) !== getSourceFileOfNode(classOrFunc)) {
|
||||
error(node.name, Diagnostics.A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged);
|
||||
}
|
||||
else if (node.pos < classOrFunc.pos) {
|
||||
error(node.name, Diagnostics.A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (node.name.kind === SyntaxKind.StringLiteral) {
|
||||
if (!isGlobalSourceFile(node.parent)) {
|
||||
error(node, Diagnostics.Ambient_external_modules_cannot_be_nested_in_other_modules);
|
||||
error(node.name, Diagnostics.Ambient_external_modules_cannot_be_nested_in_other_modules);
|
||||
}
|
||||
if (isExternalModuleNameRelative(node.name.text)) {
|
||||
error(node, Diagnostics.Ambient_external_module_declaration_cannot_specify_relative_module_name);
|
||||
error(node.name, Diagnostics.Ambient_external_module_declaration_cannot_specify_relative_module_name);
|
||||
}
|
||||
var symbol = getSymbolOfNode(node);
|
||||
}
|
||||
checkSourceElement(node.body);
|
||||
}
|
||||
|
||||
@ -279,6 +279,8 @@ module ts {
|
||||
Interface_0_incorrectly_extends_interface_1: { code: -9999999, category: DiagnosticCategory.Error, key: "Interface '{0}' incorrectly extends interface '{1}'." },
|
||||
Ambient_external_modules_cannot_be_nested_in_other_modules: { code: -9999999, category: DiagnosticCategory.Error, key: "Ambient external modules cannot be nested in other modules." },
|
||||
Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: -9999999, category: DiagnosticCategory.Error, key: "Import declarations in an internal module cannot reference an external module." },
|
||||
A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: -9999999, category: DiagnosticCategory.Error, key: "A module declaration cannot be in a different file from a class or function with which it is merged" },
|
||||
A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: -9999999, category: DiagnosticCategory.Error, key: "A module declaration cannot be located prior to a class or function with which it is merged" },
|
||||
Cannot_compile_external_modules_unless_the_module_flag_is_provided: { code: -9999999, category: DiagnosticCategory.Error, key: "Cannot compile external modules unless the '--module' flag is provided." },
|
||||
Import_declaration_conflicts_with_local_declaration_of_0: { code: -9999999, category: DiagnosticCategory.Error, key: "Import declaration conflicts with local declaration of '{0}'" },
|
||||
Filename_0_differs_from_already_included_filename_1_only_in_casing: { code: -9999999, category: DiagnosticCategory.Error, key: "Filename '{0}' differs from already included filename '{1}' only in casing" },
|
||||
|
||||
@ -1140,6 +1140,14 @@
|
||||
"category": "Error",
|
||||
"code": -9999999
|
||||
},
|
||||
"A module declaration cannot be in a different file from a class or function with which it is merged": {
|
||||
"category": "Error",
|
||||
"code": -9999999
|
||||
},
|
||||
"A module declaration cannot be located prior to a class or function with which it is merged": {
|
||||
"category": "Error",
|
||||
"code": -9999999
|
||||
},
|
||||
"Cannot compile external modules unless the '--module' flag is provided.": {
|
||||
"category": "Error",
|
||||
"code": -9999999
|
||||
|
||||
@ -0,0 +1,41 @@
|
||||
==== tests/cases/conformance/internalModules/DeclarationMerging/class.ts (0 errors) ====
|
||||
module X.Y {
|
||||
export class Point {
|
||||
constructor(x: number, y: number) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
}
|
||||
|
||||
==== tests/cases/conformance/internalModules/DeclarationMerging/module.ts (1 errors) ====
|
||||
module X.Y {
|
||||
export module Point {
|
||||
~~~~~
|
||||
!!! A module declaration cannot be in a different file from a class or function with which it is merged
|
||||
export var Origin = new Point(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
==== tests/cases/conformance/internalModules/DeclarationMerging/test.ts (0 errors) ====
|
||||
//var cl: { x: number; y: number; }
|
||||
var cl = new X.Y.Point(1,1);
|
||||
var cl = X.Y.Point.Origin; // error not expected here same as bug 83996 ?
|
||||
|
||||
|
||||
==== tests/cases/conformance/internalModules/DeclarationMerging/simple.ts (0 errors) ====
|
||||
class A {
|
||||
id: string;
|
||||
}
|
||||
|
||||
module A {
|
||||
export var Instance = new A();
|
||||
}
|
||||
|
||||
// ensure merging works as expected
|
||||
var a = A.Instance;
|
||||
var a = new A();
|
||||
var a: { id: string };
|
||||
|
||||
@ -5,9 +5,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
==== tests/cases/conformance/internalModules/DeclarationMerging/module.ts (0 errors) ====
|
||||
==== tests/cases/conformance/internalModules/DeclarationMerging/module.ts (1 errors) ====
|
||||
module A {
|
||||
export module Point {
|
||||
~~~~~
|
||||
!!! A module declaration cannot be in a different file from a class or function with which it is merged
|
||||
export var Origin = { x: 0, y: 0 };
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,34 @@
|
||||
==== tests/cases/conformance/internalModules/DeclarationMerging/module.ts (1 errors) ====
|
||||
module X.Y {
|
||||
export module Point {
|
||||
~~~~~
|
||||
!!! A module declaration cannot be in a different file from a class or function with which it is merged
|
||||
export var Origin = new Point(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
==== tests/cases/conformance/internalModules/DeclarationMerging/classPoint.ts (0 errors) ====
|
||||
module X.Y {
|
||||
// duplicate identifier
|
||||
export class Point {
|
||||
constructor(x: number, y: number) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
}
|
||||
|
||||
==== tests/cases/conformance/internalModules/DeclarationMerging/simple.ts (1 errors) ====
|
||||
module A {
|
||||
~
|
||||
!!! A module declaration cannot be located prior to a class or function with which it is merged
|
||||
export var Instance = new A();
|
||||
}
|
||||
|
||||
// duplicate identifier
|
||||
class A {
|
||||
id: string;
|
||||
}
|
||||
|
||||
@ -0,0 +1,32 @@
|
||||
==== tests/cases/conformance/internalModules/DeclarationMerging/module.ts (1 errors) ====
|
||||
module A {
|
||||
export module Point {
|
||||
~~~~~
|
||||
!!! A module declaration cannot be in a different file from a class or function with which it is merged
|
||||
export var Origin = { x: 0, y: 0 };
|
||||
}
|
||||
}
|
||||
|
||||
==== tests/cases/conformance/internalModules/DeclarationMerging/function.ts (0 errors) ====
|
||||
module A {
|
||||
// duplicate identifier error
|
||||
export function Point() {
|
||||
return { x: 0, y: 0 };
|
||||
}
|
||||
}
|
||||
|
||||
==== tests/cases/conformance/internalModules/DeclarationMerging/simple.ts (1 errors) ====
|
||||
module B {
|
||||
|
||||
export module Point {
|
||||
~~~~~
|
||||
!!! A module declaration cannot be located prior to a class or function with which it is merged
|
||||
export var Origin = { x: 0, y: 0 };
|
||||
}
|
||||
|
||||
// duplicate identifier error
|
||||
export function Point() {
|
||||
return { x: 0, y: 0 };
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,13 +72,13 @@
|
||||
// Ambient external module not in the global module
|
||||
module M2 {
|
||||
declare module 'nope' { }
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~
|
||||
!!! Ambient external modules cannot be nested in other modules.
|
||||
}
|
||||
|
||||
// Ambient external module with a string literal name that isn't a top level external module name
|
||||
declare module '../foo' { }
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~
|
||||
!!! Ambient external module declaration cannot specify relative module name.
|
||||
|
||||
// Ambient external module with export assignment and other exported members
|
||||
|
||||
@ -4,12 +4,10 @@
|
||||
export = D;
|
||||
|
||||
declare module "ext" {
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
export class C { }
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~
|
||||
~~~~~
|
||||
!!! Ambient external modules cannot be nested in other modules.
|
||||
export class C { }
|
||||
}
|
||||
|
||||
// Cannot resolve this ext module reference
|
||||
import ext = require("ext");
|
||||
|
||||
@ -1,16 +1,12 @@
|
||||
==== tests/cases/compiler/ambientExternalModuleWithRelativeModuleName.ts (2 errors) ====
|
||||
declare module "./relativeModule" {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
var x: string;
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! Ambient external module declaration cannot specify relative module name.
|
||||
var x: string;
|
||||
}
|
||||
|
||||
declare module ".\\relativeModule" {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! Ambient external module declaration cannot specify relative module name.
|
||||
var x: string;
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~
|
||||
!!! Ambient external module declaration cannot specify relative module name.
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
==== tests/cases/compiler/augmentedTypesModules.ts (3 errors) ====
|
||||
==== tests/cases/compiler/augmentedTypesModules.ts (6 errors) ====
|
||||
// module then var
|
||||
module m1 { }
|
||||
var m1 = 1; // Should be allowed
|
||||
@ -30,9 +30,13 @@
|
||||
function m2() { }; // ok since the module is not instantiated
|
||||
|
||||
module m2a { var y = 2; }
|
||||
~~~
|
||||
!!! A module declaration cannot be located prior to a class or function with which it is merged
|
||||
function m2a() { }; // error since the module is instantiated
|
||||
|
||||
module m2b { export var y = 2; }
|
||||
~~~
|
||||
!!! A module declaration cannot be located prior to a class or function with which it is merged
|
||||
function m2b() { }; // error since the module is instantiated
|
||||
|
||||
// should be errors to have function first
|
||||
@ -56,6 +60,8 @@
|
||||
class m3 { } // ok since the module is not instantiated
|
||||
|
||||
module m3a { var y = 2; }
|
||||
~~~
|
||||
!!! A module declaration cannot be located prior to a class or function with which it is merged
|
||||
class m3a { foo() { } } // error, class isn't ambient or declared before the module
|
||||
|
||||
class m3b { foo() { } }
|
||||
|
||||
35
tests/baselines/reference/augmentedTypesModules2.errors.txt
Normal file
35
tests/baselines/reference/augmentedTypesModules2.errors.txt
Normal file
@ -0,0 +1,35 @@
|
||||
==== tests/cases/compiler/augmentedTypesModules2.ts (3 errors) ====
|
||||
// module then function
|
||||
module m2 { }
|
||||
function m2() { }; // ok since the module is not instantiated
|
||||
|
||||
module m2a { var y = 2; }
|
||||
~~~
|
||||
!!! A module declaration cannot be located prior to a class or function with which it is merged
|
||||
function m2a() { }; // error since the module is instantiated
|
||||
|
||||
module m2b { export var y = 2; }
|
||||
~~~
|
||||
!!! A module declaration cannot be located prior to a class or function with which it is merged
|
||||
function m2b() { }; // error since the module is instantiated
|
||||
|
||||
function m2c() { };
|
||||
module m2c { export var y = 2; }
|
||||
|
||||
module m2cc { export var y = 2; }
|
||||
~~~~
|
||||
!!! A module declaration cannot be located prior to a class or function with which it is merged
|
||||
function m2cc() { }; // error to have module first
|
||||
|
||||
module m2d { }
|
||||
declare function m2d(): void;
|
||||
|
||||
declare function m2e(): void;
|
||||
module m2e { }
|
||||
|
||||
function m2f() { };
|
||||
module m2f { export interface I { foo(): void } }
|
||||
|
||||
function m2g() { };
|
||||
module m2g { export class C { foo() { } } }
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
==== tests/cases/compiler/augmentedTypesModules3.ts (1 errors) ====
|
||||
//// module then class
|
||||
module m3 { }
|
||||
class m3 { } // ok since the module is not instantiated
|
||||
|
||||
module m3a { var y = 2; }
|
||||
~~~
|
||||
!!! A module declaration cannot be located prior to a class or function with which it is merged
|
||||
class m3a { foo() { } } // error, class isn't ambient or declared before the module
|
||||
10
tests/baselines/reference/cloduleSplitAcrossFiles.errors.txt
Normal file
10
tests/baselines/reference/cloduleSplitAcrossFiles.errors.txt
Normal file
@ -0,0 +1,10 @@
|
||||
==== tests/cases/compiler/cloduleSplitAcrossFiles_class.ts (0 errors) ====
|
||||
class D { }
|
||||
|
||||
==== tests/cases/compiler/cloduleSplitAcrossFiles_module.ts (1 errors) ====
|
||||
module D {
|
||||
~
|
||||
!!! A module declaration cannot be in a different file from a class or function with which it is merged
|
||||
export var y = "hi";
|
||||
}
|
||||
D.y;
|
||||
10
tests/baselines/reference/funduleSplitAcrossFiles.errors.txt
Normal file
10
tests/baselines/reference/funduleSplitAcrossFiles.errors.txt
Normal file
@ -0,0 +1,10 @@
|
||||
==== tests/cases/compiler/funduleSplitAcrossFiles_function.ts (0 errors) ====
|
||||
function D() { }
|
||||
|
||||
==== tests/cases/compiler/funduleSplitAcrossFiles_module.ts (1 errors) ====
|
||||
module D {
|
||||
~
|
||||
!!! A module declaration cannot be in a different file from a class or function with which it is merged
|
||||
export var y = "hi";
|
||||
}
|
||||
D.y;
|
||||
@ -5,12 +5,10 @@
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! Cannot find external module 'externalModule'.
|
||||
declare module "m1" {
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~
|
||||
!!! Ambient external modules cannot be nested in other modules.
|
||||
import im2 = require("externalModule");
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! Cannot find external module 'externalModule'.
|
||||
}
|
||||
~
|
||||
!!! Ambient external modules cannot be nested in other modules.
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
==== tests/cases/conformance/internalModules/moduleDeclarations/invalidNestedModules.ts (1 errors) ====
|
||||
==== tests/cases/conformance/internalModules/moduleDeclarations/invalidNestedModules.ts (2 errors) ====
|
||||
module A.B.C {
|
||||
~
|
||||
!!! A module declaration cannot be located prior to a class or function with which it is merged
|
||||
export class Point {
|
||||
x: number;
|
||||
y: number;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
==== tests/cases/compiler/nameCollisions.ts (8 errors) ====
|
||||
==== tests/cases/compiler/nameCollisions.ts (9 errors) ====
|
||||
module T {
|
||||
var x = 2;
|
||||
|
||||
@ -18,6 +18,8 @@
|
||||
!!! Duplicate identifier 'z'.
|
||||
|
||||
module y {
|
||||
~
|
||||
!!! A module declaration cannot be located prior to a class or function with which it is merged
|
||||
var b;
|
||||
}
|
||||
|
||||
|
||||
@ -23,36 +23,24 @@
|
||||
declare export module "m1_M3_public" {
|
||||
~~~~~~
|
||||
!!! 'export' modifier must precede 'declare' modifier.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
export function f1();
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
export class c1 {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~~~~~~~~~
|
||||
export var v1: { new (): c1; };
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
export var v2: c1;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~~~~~
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Ambient external modules cannot be nested in other modules.
|
||||
export function f1();
|
||||
export class c1 {
|
||||
}
|
||||
export var v1: { new (): c1; };
|
||||
export var v2: c1;
|
||||
}
|
||||
|
||||
declare module "m1_M4_private" {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
export function f1();
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
export class c1 {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~~~~~~~~~
|
||||
export var v1: { new (): c1; };
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
export var v2: c1;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~~~~~
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Ambient external modules cannot be nested in other modules.
|
||||
export function f1();
|
||||
export class c1 {
|
||||
}
|
||||
export var v1: { new (): c1; };
|
||||
export var v2: c1;
|
||||
}
|
||||
|
||||
import m1_im1_private = m1_M1_public;
|
||||
export var m1_im1_private_v1_public = m1_im1_private.c1;
|
||||
@ -177,24 +165,21 @@
|
||||
declare module "abc" {
|
||||
~~~~~~~
|
||||
!!! A 'declare' modifier cannot be used in an already ambient context.
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Ambient external modules cannot be nested in other modules.
|
||||
}
|
||||
}
|
||||
|
||||
module m2 {
|
||||
module "abc2" {
|
||||
~~~~~~~~~~~~~~~
|
||||
}
|
||||
~~~~~~~~~
|
||||
~~~~~~
|
||||
!!! Ambient external modules cannot be nested in other modules.
|
||||
}
|
||||
}
|
||||
module "abc3" {
|
||||
~~~~~~~~~~~~~~~
|
||||
}
|
||||
~~~~~
|
||||
~~~~~~
|
||||
!!! Ambient external modules cannot be nested in other modules.
|
||||
}
|
||||
}
|
||||
|
||||
module m2 {
|
||||
|
||||
@ -21,36 +21,24 @@
|
||||
}
|
||||
|
||||
export declare module "m1_M3_public" {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
export function f1();
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
export class c1 {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~~~~~~~~~
|
||||
export var v1: { new (): c1; };
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
export var v2: c1;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~~~~~
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Ambient external modules cannot be nested in other modules.
|
||||
export function f1();
|
||||
export class c1 {
|
||||
}
|
||||
export var v1: { new (): c1; };
|
||||
export var v2: c1;
|
||||
}
|
||||
|
||||
declare module "m1_M4_private" {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
export function f1();
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
export class c1 {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~~~~~~~~~
|
||||
export var v1: { new (): c1; };
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
export var v2: c1;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~~~~~
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Ambient external modules cannot be nested in other modules.
|
||||
export function f1();
|
||||
export class c1 {
|
||||
}
|
||||
export var v1: { new (): c1; };
|
||||
export var v2: c1;
|
||||
}
|
||||
|
||||
import m1_im1_private = m1_M1_public;
|
||||
export var m1_im1_private_v1_public = m1_im1_private.c1;
|
||||
@ -133,36 +121,24 @@
|
||||
}
|
||||
|
||||
export declare module "m2_M3_public" {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
export function f1();
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
export class c1 {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~~~~~~~~~
|
||||
export var v1: { new (): c1; };
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
export var v2: c1;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~~~~~
|
||||
~~~~~~~~~~~~~~
|
||||
!!! Ambient external modules cannot be nested in other modules.
|
||||
export function f1();
|
||||
export class c1 {
|
||||
}
|
||||
export var v1: { new (): c1; };
|
||||
export var v2: c1;
|
||||
}
|
||||
|
||||
declare module "m2_M4_private" {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
export function f1();
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
export class c1 {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~~~~~~~~~
|
||||
export var v1: { new (): c1; };
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
export var v2: c1;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~~~~~
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Ambient external modules cannot be nested in other modules.
|
||||
export function f1();
|
||||
export class c1 {
|
||||
}
|
||||
export var v1: { new (): c1; };
|
||||
export var v2: c1;
|
||||
}
|
||||
|
||||
import m1_im1_private = m2_M1_public;
|
||||
export var m1_im1_private_v1_public = m1_im1_private.c1;
|
||||
@ -235,20 +211,14 @@
|
||||
}
|
||||
|
||||
export declare module "glo_M2_public" {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
export function f1();
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
export class c1 {
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~~~~~
|
||||
export var v1: { new (): c1; };
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
export var v2: c1;
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Ambient external modules cannot be nested in other modules.
|
||||
export function f1();
|
||||
export class c1 {
|
||||
}
|
||||
export var v1: { new (): c1; };
|
||||
export var v2: c1;
|
||||
}
|
||||
|
||||
export module glo_M3_private {
|
||||
export class c1 {
|
||||
@ -261,20 +231,14 @@
|
||||
}
|
||||
|
||||
export declare module "glo_M4_private" {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
export function f1();
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
export class c1 {
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~~~~~
|
||||
export var v1: { new (): c1; };
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
export var v2: c1;
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! Ambient external modules cannot be nested in other modules.
|
||||
export function f1();
|
||||
export class c1 {
|
||||
}
|
||||
export var v1: { new (): c1; };
|
||||
export var v2: c1;
|
||||
}
|
||||
|
||||
|
||||
import glo_im1_private = glo_M1_public;
|
||||
@ -334,217 +298,135 @@
|
||||
|
||||
|
||||
export declare module "use_glo_M1_public" {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! Ambient external modules cannot be nested in other modules.
|
||||
import use_glo_M1_public = glo_M1_public;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
export var use_glo_M1_public_v1_public: { new (): use_glo_M1_public.c1; };
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
export var use_glo_M1_public_v2_public: use_glo_M1_public;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! Cannot find name 'use_glo_M1_public'.
|
||||
export var use_glo_M1_public_v3_public: () => use_glo_M1_public.c1;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
var use_glo_M1_public_v1_private: { new (): use_glo_M1_public.c1; };
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
var use_glo_M1_public_v2_private: use_glo_M1_public;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! Cannot find name 'use_glo_M1_public'.
|
||||
var use_glo_M1_public_v3_private: () => use_glo_M1_public.c1;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
import use_glo_M2_public = require("glo_M2_public");
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! Cannot find external module 'glo_M2_public'.
|
||||
export var use_glo_M2_public_v1_public: { new (): use_glo_M2_public.c1; };
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
export var use_glo_M2_public_v2_public: use_glo_M2_public;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
export var use_glo_M2_public_v3_public: () => use_glo_M2_public.c1;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
var use_glo_M2_public_v1_private: { new (): use_glo_M2_public.c1; };
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
var use_glo_M2_public_v2_private: use_glo_M2_public;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
var use_glo_M2_public_v3_private: () => use_glo_M2_public.c1;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
module m2 {
|
||||
~~~~~~~~~~~~~~~
|
||||
import errorImport = require("glo_M2_public");
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Import declarations in an internal module cannot reference an external module.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
import nonerrorImport = glo_M1_public;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
module m5 {
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
import m5_errorImport = require("glo_M2_public");
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Import declarations in an internal module cannot reference an external module.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
import m5_nonerrorImport = glo_M1_public;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~~~~~~~~~
|
||||
}
|
||||
~~~~~
|
||||
}
|
||||
~
|
||||
!!! Ambient external modules cannot be nested in other modules.
|
||||
|
||||
|
||||
declare module "use_glo_M3_private" {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Ambient external modules cannot be nested in other modules.
|
||||
import use_glo_M3_private = glo_M3_private;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
export var use_glo_M3_private_v1_public: { new (): use_glo_M3_private.c1; };
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
export var use_glo_M3_private_v2_public: use_glo_M3_private;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! Cannot find name 'use_glo_M3_private'.
|
||||
export var use_glo_M3_private_v3_public: () => use_glo_M3_private.c1;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
var use_glo_M3_private_v1_private: { new (): use_glo_M3_private.c1; };
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
var use_glo_M3_private_v2_private: use_glo_M3_private;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! Cannot find name 'use_glo_M3_private'.
|
||||
var use_glo_M3_private_v3_private: () => use_glo_M3_private.c1;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
import use_glo_M4_private = require("glo_M4_private");
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! Cannot find external module 'glo_M4_private'.
|
||||
export var use_glo_M4_private_v1_public: { new (): use_glo_M4_private.c1; };
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
export var use_glo_M4_private_v2_public: use_glo_M4_private;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
export var use_glo_M4_private_v3_public: () => use_glo_M4_private.c1;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
var use_glo_M4_private_v1_private: { new (): use_glo_M4_private.c1; };
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
var use_glo_M4_private_v2_private: use_glo_M4_private;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
var use_glo_M4_private_v3_private: () => use_glo_M4_private.c1;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
module m2 {
|
||||
~~~~~~~~~~~~~~~
|
||||
import errorImport = require("glo_M4_private");
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Import declarations in an internal module cannot reference an external module.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
import nonerrorImport = glo_M3_private;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
module m5 {
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
import m5_errorImport = require("glo_M4_private");
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Import declarations in an internal module cannot reference an external module.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
import m5_nonerrorImport = glo_M3_private;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~~~~~~~~~
|
||||
}
|
||||
~~~~~
|
||||
}
|
||||
~
|
||||
!!! Ambient external modules cannot be nested in other modules.
|
||||
|
||||
declare module "anotherParseError" {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! Ambient external modules cannot be nested in other modules.
|
||||
module m2 {
|
||||
~~~~~~~~~~~~~~~
|
||||
declare module "abc" {
|
||||
~~~~~~~
|
||||
!!! A 'declare' modifier cannot be used in an already ambient context.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~~~~~~~~~
|
||||
~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Ambient external modules cannot be nested in other modules.
|
||||
}
|
||||
}
|
||||
~~~~~
|
||||
|
||||
|
||||
module m2 {
|
||||
~~~~~~~~~~~~~~~
|
||||
module "abc2" {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~
|
||||
~~~~~~
|
||||
!!! Ambient external modules cannot be nested in other modules.
|
||||
}
|
||||
~~~~~~~~~
|
||||
~~~~~~~~~
|
||||
!!! Ambient external modules cannot be nested in other modules.
|
||||
}
|
||||
~~~~~
|
||||
module "abc3" {
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~
|
||||
~~~~~~
|
||||
!!! Ambient external modules cannot be nested in other modules.
|
||||
}
|
||||
~~~~~
|
||||
~~~~~
|
||||
!!! Ambient external modules cannot be nested in other modules.
|
||||
}
|
||||
~
|
||||
!!! Ambient external modules cannot be nested in other modules.
|
||||
|
||||
declare export module "anotherParseError2" {
|
||||
~~~~~~
|
||||
!!! 'export' modifier must precede 'declare' modifier.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Ambient external modules cannot be nested in other modules.
|
||||
module m2 {
|
||||
~~~~~~~~~~~~~~~
|
||||
declare module "abc" {
|
||||
~~~~~~~
|
||||
!!! A 'declare' modifier cannot be used in an already ambient context.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
}
|
||||
~~~~~~~~~
|
||||
~~~~~~~~~
|
||||
~~~~~
|
||||
!!! Ambient external modules cannot be nested in other modules.
|
||||
}
|
||||
}
|
||||
~~~~~
|
||||
|
||||
|
||||
module m2 {
|
||||
~~~~~~~~~~~~~~~
|
||||
module "abc2" {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~
|
||||
~~~~~~
|
||||
!!! Ambient external modules cannot be nested in other modules.
|
||||
}
|
||||
~~~~~~~~~
|
||||
~~~~~~~~~
|
||||
!!! Ambient external modules cannot be nested in other modules.
|
||||
}
|
||||
~~~~~
|
||||
module "abc3" {
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~
|
||||
~~~~~~
|
||||
!!! Ambient external modules cannot be nested in other modules.
|
||||
}
|
||||
~~~~~
|
||||
~~~~~
|
||||
!!! Ambient external modules cannot be nested in other modules.
|
||||
}
|
||||
~
|
||||
!!! Ambient external modules cannot be nested in other modules.
|
||||
|
||||
module m2 {
|
||||
import m3 = require("use_glo_M1_public");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user