tests/cases/compiler/privacyGloImportParseErrors.ts(59,5): error TS1147: Import declarations in an internal module cannot reference an external module.
tests/cases/compiler/privacyGloImportParseErrors.ts(69,5): error TS1147: Import declarations in an internal module cannot reference an external module.
tests/cases/compiler/privacyGloImportParseErrors.ts(81,5): error TS1147: Import declarations in an internal module cannot reference an external module.
tests/cases/compiler/privacyGloImportParseErrors.ts(82,5): error TS1147: Import declarations in an internal module cannot reference an external module.
tests/cases/compiler/privacyGloImportParseErrors.ts(121,9): error TS1147: Import declarations in an internal module cannot reference an external module.
tests/cases/compiler/privacyGloImportParseErrors.ts(125,13): error TS1147: Import declarations in an internal module cannot reference an external module.
tests/cases/compiler/privacyGloImportParseErrors.ts(133,9): error TS1038: A 'declare' modifier cannot be used in an already ambient context.
tests/cases/compiler/privacyGloImportParseErrors.ts(146,5): error TS1147: Import declarations in an internal module cannot reference an external module.
tests/cases/compiler/privacyGloImportParseErrors.ts(149,9): error TS1147: Import declarations in an internal module cannot reference an external module.
tests/cases/compiler/privacyGloImportParseErrors.ts(22,27): error TS2435: Ambient external modules cannot be nested in other modules.
tests/cases/compiler/privacyGloImportParseErrors.ts(30,20): error TS2435: Ambient external modules cannot be nested in other modules.
tests/cases/compiler/privacyGloImportParseErrors.ts(59,37): error TS2307: Cannot find external module 'm1_M3_public'.
tests/cases/compiler/privacyGloImportParseErrors.ts(69,37): error TS2307: Cannot find external module 'm1_M4_private'.
tests/cases/compiler/privacyGloImportParseErrors.ts(133,24): error TS2435: Ambient external modules cannot be nested in other modules.
tests/cases/compiler/privacyGloImportParseErrors.ts(138,16): error TS2435: Ambient external modules cannot be nested in other modules.
tests/cases/compiler/privacyGloImportParseErrors.ts(141,12): error TS2435: Ambient external modules cannot be nested in other modules.


==== tests/cases/compiler/privacyGloImportParseErrors.ts (16 errors) ====
    module m1 {
        export module m1_M1_public {
            export class c1 {
            }
            export function f1() {
                return new c1;
            }
            export var v1 = c1;
            export var v2: c1;
        }
    
        module m1_M2_private {
            export class c1 {
            }
            export function f1() {
                return new c1;
            }
            export var v1 = c1;
            export var v2: c1;
        }
    
        export declare module "m1_M3_public" {
                              ~~~~~~~~~~~~~~
!!! error TS2435: 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" {
                       ~~~~~~~~~~~~~~~
!!! error TS2435: 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;
        export var m1_im1_private_v2_public = new m1_im1_private.c1();
        export var m1_im1_private_v3_public = m1_im1_private.f1;
        export var m1_im1_private_v4_public = m1_im1_private.f1();
        var m1_im1_private_v1_private = m1_im1_private.c1;
        var m1_im1_private_v2_private = new m1_im1_private.c1();
        var m1_im1_private_v3_private = m1_im1_private.f1;
        var m1_im1_private_v4_private = m1_im1_private.f1();
    
    
        import m1_im2_private = m1_M2_private;
        export var m1_im2_private_v1_public = m1_im2_private.c1;
        export var m1_im2_private_v2_public = new m1_im2_private.c1();
        export var m1_im2_private_v3_public = m1_im2_private.f1;
        export var m1_im2_private_v4_public = m1_im2_private.f1();
        var m1_im2_private_v1_private = m1_im2_private.c1;
        var m1_im2_private_v2_private = new m1_im2_private.c1();
        var m1_im2_private_v3_private = m1_im2_private.f1;
        var m1_im2_private_v4_private = m1_im2_private.f1();
    
        import m1_im3_private = require("m1_M3_public");
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1147: Import declarations in an internal module cannot reference an external module.
                                        ~~~~~~~~~~~~~~
!!! error TS2307: Cannot find external module 'm1_M3_public'.
        export var m1_im3_private_v1_public = m1_im3_private.c1;
        export var m1_im3_private_v2_public = new m1_im3_private.c1();
        export var m1_im3_private_v3_public = m1_im3_private.f1;
        export var m1_im3_private_v4_public = m1_im3_private.f1();
        var m1_im3_private_v1_private = m1_im3_private.c1;
        var m1_im3_private_v2_private = new m1_im3_private.c1();
        var m1_im3_private_v3_private = m1_im3_private.f1;
        var m1_im3_private_v4_private = m1_im3_private.f1();
    
        import m1_im4_private = require("m1_M4_private");
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1147: Import declarations in an internal module cannot reference an external module.
                                        ~~~~~~~~~~~~~~~
!!! error TS2307: Cannot find external module 'm1_M4_private'.
        export var m1_im4_private_v1_public = m1_im4_private.c1;
        export var m1_im4_private_v2_public = new m1_im4_private.c1();
        export var m1_im4_private_v3_public = m1_im4_private.f1;
        export var m1_im4_private_v4_public = m1_im4_private.f1();
        var m1_im4_private_v1_private = m1_im4_private.c1;
        var m1_im4_private_v2_private = new m1_im4_private.c1();
        var m1_im4_private_v3_private = m1_im4_private.f1;
        var m1_im4_private_v4_private = m1_im4_private.f1();
    
        export import m1_im1_public = m1_M1_public;
        export import m1_im2_public = m1_M2_private;
        export import m1_im3_public = require("m1_M3_public");
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1147: Import declarations in an internal module cannot reference an external module.
        export import m1_im4_public = require("m1_M4_private");
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1147: Import declarations in an internal module cannot reference an external module.
    }
    
    module glo_M1_public {
        export class c1 {
        }
        export function f1() {
            return new c1;
        }
        export var v1 = c1;
        export var v2: c1;
    }
    
    declare module "glo_M2_public" {
        export function f1();
        export class c1 {
        }
        export var v1: { new (): c1; };
        export var v2: c1;
    }
    
    declare module "use_glo_M1_public" {
        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: typeof 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: typeof 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");
        export var use_glo_M2_public_v1_public: { new (): use_glo_M2_public.c1; };
        export var use_glo_M2_public_v2_public: typeof 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: typeof use_glo_M2_public;
        var use_glo_M2_public_v3_private: () => use_glo_M2_public.c1;
    
        module m2 {
            import errorImport = require("glo_M2_public");
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1147: 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");
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1147: Import declarations in an internal module cannot reference an external module.
                import m5_nonerrorImport = glo_M1_public;
            }
        }
    }
    
    declare module "anotherParseError" {
        module m2 {
            declare module "abc" {
            ~~~~~~~
!!! error TS1038: A 'declare' modifier cannot be used in an already ambient context.
                           ~~~~~
!!! error TS2435: Ambient external modules cannot be nested in other modules.
            }
        }
    
        module m2 {
            module "abc2" {
                   ~~~~~~
!!! error TS2435: Ambient external modules cannot be nested in other modules.
            }
        }
        module "abc3" {
               ~~~~~~
!!! error TS2435: Ambient external modules cannot be nested in other modules.
        }
    }
    
    module m2 {
        import m3 = require("use_glo_M1_public");
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1147: Import declarations in an internal module cannot reference an external module.
        module m4 {
            var a = 10;
            import m2 = require("use_glo_M1_public");
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1147: Import declarations in an internal module cannot reference an external module.
        }
    
    }