mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 01:04:49 -05:00
Non-namespace merges override valueDeclaration
Instead of searching `declarations` for a class declaration, make the binder and checker merge `valueDeclaration` such that non-namespace merges always have their `valueDeclaration` win.
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
//// [ambientClassDeclarationWithExtends.ts]
|
||||
//// [tests/cases/compiler/ambientClassDeclarationWithExtends.ts] ////
|
||||
|
||||
//// [ambientClassDeclarationExtends_singleFile.ts]
|
||||
declare class A { }
|
||||
declare class B extends A { }
|
||||
|
||||
@@ -10,10 +12,29 @@ declare class D extends C { }
|
||||
|
||||
var d: C = new D();
|
||||
|
||||
//// [ambientClassDeclarationExtends_file1.ts]
|
||||
|
||||
declare class E {
|
||||
public bar;
|
||||
}
|
||||
namespace F { var y; }
|
||||
|
||||
//// [ambientClassDeclarationWithExtends.js]
|
||||
//// [ambientClassDeclarationExtends_file2.ts]
|
||||
|
||||
declare class F extends E { }
|
||||
var f: E = new F();
|
||||
|
||||
|
||||
//// [ambientClassDeclarationExtends_singleFile.js]
|
||||
var D;
|
||||
(function (D) {
|
||||
var x;
|
||||
})(D || (D = {}));
|
||||
var d = new D();
|
||||
//// [ambientClassDeclarationExtends_file1.js]
|
||||
var F;
|
||||
(function (F) {
|
||||
var y;
|
||||
})(F || (F = {}));
|
||||
//// [ambientClassDeclarationExtends_file2.js]
|
||||
var f = new F();
|
||||
|
||||
@@ -1,27 +1,50 @@
|
||||
=== tests/cases/compiler/ambientClassDeclarationWithExtends.ts ===
|
||||
=== tests/cases/compiler/ambientClassDeclarationExtends_singleFile.ts ===
|
||||
declare class A { }
|
||||
>A : Symbol(A, Decl(ambientClassDeclarationWithExtends.ts, 0, 0))
|
||||
>A : Symbol(A, Decl(ambientClassDeclarationExtends_singleFile.ts, 0, 0))
|
||||
|
||||
declare class B extends A { }
|
||||
>B : Symbol(B, Decl(ambientClassDeclarationWithExtends.ts, 0, 19))
|
||||
>A : Symbol(A, Decl(ambientClassDeclarationWithExtends.ts, 0, 0))
|
||||
>B : Symbol(B, Decl(ambientClassDeclarationExtends_singleFile.ts, 0, 19))
|
||||
>A : Symbol(A, Decl(ambientClassDeclarationExtends_singleFile.ts, 0, 0))
|
||||
|
||||
declare class C {
|
||||
>C : Symbol(C, Decl(ambientClassDeclarationWithExtends.ts, 1, 29))
|
||||
>C : Symbol(C, Decl(ambientClassDeclarationExtends_singleFile.ts, 1, 29))
|
||||
|
||||
public foo;
|
||||
>foo : Symbol(foo, Decl(ambientClassDeclarationWithExtends.ts, 3, 17))
|
||||
>foo : Symbol(foo, Decl(ambientClassDeclarationExtends_singleFile.ts, 3, 17))
|
||||
}
|
||||
namespace D { var x; }
|
||||
>D : Symbol(D, Decl(ambientClassDeclarationWithExtends.ts, 5, 1), Decl(ambientClassDeclarationWithExtends.ts, 6, 22))
|
||||
>x : Symbol(x, Decl(ambientClassDeclarationWithExtends.ts, 6, 17))
|
||||
>D : Symbol(D, Decl(ambientClassDeclarationExtends_singleFile.ts, 5, 1), Decl(ambientClassDeclarationExtends_singleFile.ts, 6, 22))
|
||||
>x : Symbol(x, Decl(ambientClassDeclarationExtends_singleFile.ts, 6, 17))
|
||||
|
||||
declare class D extends C { }
|
||||
>D : Symbol(D, Decl(ambientClassDeclarationWithExtends.ts, 5, 1), Decl(ambientClassDeclarationWithExtends.ts, 6, 22))
|
||||
>C : Symbol(C, Decl(ambientClassDeclarationWithExtends.ts, 1, 29))
|
||||
>D : Symbol(D, Decl(ambientClassDeclarationExtends_singleFile.ts, 5, 1), Decl(ambientClassDeclarationExtends_singleFile.ts, 6, 22))
|
||||
>C : Symbol(C, Decl(ambientClassDeclarationExtends_singleFile.ts, 1, 29))
|
||||
|
||||
var d: C = new D();
|
||||
>d : Symbol(d, Decl(ambientClassDeclarationWithExtends.ts, 9, 3))
|
||||
>C : Symbol(C, Decl(ambientClassDeclarationWithExtends.ts, 1, 29))
|
||||
>D : Symbol(D, Decl(ambientClassDeclarationWithExtends.ts, 5, 1), Decl(ambientClassDeclarationWithExtends.ts, 6, 22))
|
||||
>d : Symbol(d, Decl(ambientClassDeclarationExtends_singleFile.ts, 9, 3))
|
||||
>C : Symbol(C, Decl(ambientClassDeclarationExtends_singleFile.ts, 1, 29))
|
||||
>D : Symbol(D, Decl(ambientClassDeclarationExtends_singleFile.ts, 5, 1), Decl(ambientClassDeclarationExtends_singleFile.ts, 6, 22))
|
||||
|
||||
=== tests/cases/compiler/ambientClassDeclarationExtends_file1.ts ===
|
||||
|
||||
declare class E {
|
||||
>E : Symbol(E, Decl(ambientClassDeclarationExtends_file1.ts, 0, 0))
|
||||
|
||||
public bar;
|
||||
>bar : Symbol(bar, Decl(ambientClassDeclarationExtends_file1.ts, 1, 17))
|
||||
}
|
||||
namespace F { var y; }
|
||||
>F : Symbol(F, Decl(ambientClassDeclarationExtends_file1.ts, 3, 1), Decl(ambientClassDeclarationExtends_file2.ts, 0, 0))
|
||||
>y : Symbol(y, Decl(ambientClassDeclarationExtends_file1.ts, 4, 17))
|
||||
|
||||
=== tests/cases/compiler/ambientClassDeclarationExtends_file2.ts ===
|
||||
|
||||
declare class F extends E { }
|
||||
>F : Symbol(F, Decl(ambientClassDeclarationExtends_file1.ts, 3, 1), Decl(ambientClassDeclarationExtends_file2.ts, 0, 0))
|
||||
>E : Symbol(E, Decl(ambientClassDeclarationExtends_file1.ts, 0, 0))
|
||||
|
||||
var f: E = new F();
|
||||
>f : Symbol(f, Decl(ambientClassDeclarationExtends_file2.ts, 2, 3))
|
||||
>E : Symbol(E, Decl(ambientClassDeclarationExtends_file1.ts, 0, 0))
|
||||
>F : Symbol(F, Decl(ambientClassDeclarationExtends_file1.ts, 3, 1), Decl(ambientClassDeclarationExtends_file2.ts, 0, 0))
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
=== tests/cases/compiler/ambientClassDeclarationWithExtends.ts ===
|
||||
=== tests/cases/compiler/ambientClassDeclarationExtends_singleFile.ts ===
|
||||
declare class A { }
|
||||
>A : A
|
||||
|
||||
@@ -26,3 +26,27 @@ var d: C = new D();
|
||||
>new D() : D
|
||||
>D : typeof D
|
||||
|
||||
=== tests/cases/compiler/ambientClassDeclarationExtends_file1.ts ===
|
||||
|
||||
declare class E {
|
||||
>E : E
|
||||
|
||||
public bar;
|
||||
>bar : any
|
||||
}
|
||||
namespace F { var y; }
|
||||
>F : typeof F
|
||||
>y : any
|
||||
|
||||
=== tests/cases/compiler/ambientClassDeclarationExtends_file2.ts ===
|
||||
|
||||
declare class F extends E { }
|
||||
>F : F
|
||||
>E : E
|
||||
|
||||
var f: E = new F();
|
||||
>f : E
|
||||
>E : E
|
||||
>new F() : F
|
||||
>F : typeof F
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// @Filename: ambientClassDeclarationExtends_singleFile.ts
|
||||
declare class A { }
|
||||
declare class B extends A { }
|
||||
|
||||
@@ -8,3 +9,15 @@ namespace D { var x; }
|
||||
declare class D extends C { }
|
||||
|
||||
var d: C = new D();
|
||||
|
||||
// @Filename: ambientClassDeclarationExtends_file1.ts
|
||||
|
||||
declare class E {
|
||||
public bar;
|
||||
}
|
||||
namespace F { var y; }
|
||||
|
||||
// @Filename: ambientClassDeclarationExtends_file2.ts
|
||||
|
||||
declare class F extends E { }
|
||||
var f: E = new F();
|
||||
|
||||
Reference in New Issue
Block a user