Skip to content

Commit 3691261

Browse files
committed
partially revert #7583
1 parent 32178ac commit 3691261

9 files changed

+121
-2
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15085,8 +15085,8 @@ namespace ts {
1508515085
// in order to prevent collisions with declarations that were exported from the current module (they still contribute to local names).
1508615086
const excludedMeanings =
1508715087
(symbol.flags & (SymbolFlags.Value | SymbolFlags.ExportValue) ? SymbolFlags.Value : 0) |
15088-
(symbol.flags & (SymbolFlags.Type | SymbolFlags.ExportType) ? SymbolFlags.Type : 0) |
15089-
(symbol.flags & (SymbolFlags.Namespace | SymbolFlags.ExportNamespace) ? SymbolFlags.Namespace : 0);
15088+
(symbol.flags & SymbolFlags.Type ? SymbolFlags.Type : 0) |
15089+
(symbol.flags & SymbolFlags.Namespace ? SymbolFlags.Namespace : 0);
1509015090
if (target.flags & excludedMeanings) {
1509115091
const message = node.kind === SyntaxKind.ExportSpecifier ?
1509215092
Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 :
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//// [tests/cases/compiler/mergeWithImportedNamespace.ts] ////
2+
3+
//// [f1.ts]
4+
export namespace N { export var x = 1; }
5+
6+
//// [f2.ts]
7+
import {N} from "./f1";
8+
// partial revert of https://github.com/Microsoft/TypeScript/pull/7583 to prevent breaking changes
9+
export namespace N {
10+
export interface I {x: any}
11+
}
12+
13+
//// [f1.js]
14+
"use strict";
15+
var N;
16+
(function (N) {
17+
N.x = 1;
18+
})(N = exports.N || (exports.N = {}));
19+
//// [f2.js]
20+
"use strict";
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
=== tests/cases/compiler/f1.ts ===
2+
export namespace N { export var x = 1; }
3+
>N : Symbol(N, Decl(f1.ts, 0, 0))
4+
>x : Symbol(x, Decl(f1.ts, 0, 31))
5+
6+
=== tests/cases/compiler/f2.ts ===
7+
import {N} from "./f1";
8+
>N : Symbol(N, Decl(f2.ts, 0, 8), Decl(f2.ts, 0, 23))
9+
10+
// partial revert of https://github.com/Microsoft/TypeScript/pull/7583 to prevent breaking changes
11+
export namespace N {
12+
>N : Symbol(N, Decl(f2.ts, 0, 23))
13+
14+
export interface I {x: any}
15+
>I : Symbol(I, Decl(f2.ts, 2, 20))
16+
>x : Symbol(I.x, Decl(f2.ts, 3, 24))
17+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
=== tests/cases/compiler/f1.ts ===
2+
export namespace N { export var x = 1; }
3+
>N : typeof N
4+
>x : number
5+
>1 : number
6+
7+
=== tests/cases/compiler/f2.ts ===
8+
import {N} from "./f1";
9+
>N : typeof N
10+
11+
// partial revert of https://github.com/Microsoft/TypeScript/pull/7583 to prevent breaking changes
12+
export namespace N {
13+
>N : any
14+
15+
export interface I {x: any}
16+
>I : I
17+
>x : any
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//// [tests/cases/compiler/mergeWithImportedType.ts] ////
2+
3+
//// [f1.ts]
4+
export enum E {X}
5+
6+
//// [f2.ts]
7+
import {E} from "./f1";
8+
// partial revert of https://github.com/Microsoft/TypeScript/pull/7583 to prevent breaking changes
9+
export type E = E;
10+
11+
//// [f1.js]
12+
"use strict";
13+
(function (E) {
14+
E[E["X"] = 0] = "X";
15+
})(exports.E || (exports.E = {}));
16+
var E = exports.E;
17+
//// [f2.js]
18+
"use strict";
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
=== tests/cases/compiler/f1.ts ===
2+
export enum E {X}
3+
>E : Symbol(E, Decl(f1.ts, 0, 0))
4+
>X : Symbol(E.X, Decl(f1.ts, 0, 15))
5+
6+
=== tests/cases/compiler/f2.ts ===
7+
import {E} from "./f1";
8+
>E : Symbol(E, Decl(f2.ts, 0, 8), Decl(f2.ts, 0, 23))
9+
10+
// partial revert of https://github.com/Microsoft/TypeScript/pull/7583 to prevent breaking changes
11+
export type E = E;
12+
>E : Symbol(E, Decl(f2.ts, 0, 23))
13+
>E : Symbol(E, Decl(f2.ts, 0, 8), Decl(f2.ts, 0, 23))
14+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
=== tests/cases/compiler/f1.ts ===
2+
export enum E {X}
3+
>E : E
4+
>X : E
5+
6+
=== tests/cases/compiler/f2.ts ===
7+
import {E} from "./f1";
8+
>E : typeof E
9+
10+
// partial revert of https://github.com/Microsoft/TypeScript/pull/7583 to prevent breaking changes
11+
export type E = E;
12+
>E : E
13+
>E : E
14+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// @module:commonjs
2+
// @filename: f1.ts
3+
export namespace N { export var x = 1; }
4+
5+
// @filename: f2.ts
6+
import {N} from "./f1";
7+
// partial revert of https://github.com/Microsoft/TypeScript/pull/7583 to prevent breaking changes
8+
export namespace N {
9+
export interface I {x: any}
10+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// @module:commonjs
2+
// @filename: f1.ts
3+
export enum E {X}
4+
5+
// @filename: f2.ts
6+
import {E} from "./f1";
7+
// partial revert of https://github.com/Microsoft/TypeScript/pull/7583 to prevent breaking changes
8+
export type E = E;

0 commit comments

Comments
 (0)