mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-29 16:29:19 -05:00
Merge pull request #6763 from Microsoft/classInterfaceCrossFileMerge
properly handle merged declarations across files
This commit is contained in:
34
tests/baselines/reference/mergedDeclarations5.js
Normal file
34
tests/baselines/reference/mergedDeclarations5.js
Normal file
@@ -0,0 +1,34 @@
|
||||
//// [tests/cases/compiler/mergedDeclarations5.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
class A {
|
||||
protected foo() {}
|
||||
}
|
||||
//// [b.ts]
|
||||
interface A { }
|
||||
|
||||
class B extends A {
|
||||
protected foo() {}
|
||||
}
|
||||
|
||||
//// [a.js]
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
A.prototype.foo = function () { };
|
||||
return A;
|
||||
}());
|
||||
//// [b.js]
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var B = (function (_super) {
|
||||
__extends(B, _super);
|
||||
function B() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
B.prototype.foo = function () { };
|
||||
return B;
|
||||
}(A));
|
||||
18
tests/baselines/reference/mergedDeclarations5.symbols
Normal file
18
tests/baselines/reference/mergedDeclarations5.symbols
Normal file
@@ -0,0 +1,18 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
class A {
|
||||
>A : Symbol(A, Decl(a.ts, 0, 0), Decl(b.ts, 0, 0))
|
||||
|
||||
protected foo() {}
|
||||
>foo : Symbol(foo, Decl(a.ts, 0, 9))
|
||||
}
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
interface A { }
|
||||
>A : Symbol(A, Decl(a.ts, 0, 0), Decl(b.ts, 0, 0))
|
||||
|
||||
class B extends A {
|
||||
>B : Symbol(B, Decl(b.ts, 0, 15))
|
||||
>A : Symbol(A, Decl(a.ts, 0, 0), Decl(b.ts, 0, 0))
|
||||
|
||||
protected foo() {}
|
||||
>foo : Symbol(foo, Decl(b.ts, 2, 19))
|
||||
}
|
||||
18
tests/baselines/reference/mergedDeclarations5.types
Normal file
18
tests/baselines/reference/mergedDeclarations5.types
Normal file
@@ -0,0 +1,18 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
class A {
|
||||
>A : A
|
||||
|
||||
protected foo() {}
|
||||
>foo : () => void
|
||||
}
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
interface A { }
|
||||
>A : A
|
||||
|
||||
class B extends A {
|
||||
>B : B
|
||||
>A : A
|
||||
|
||||
protected foo() {}
|
||||
>foo : () => void
|
||||
}
|
||||
57
tests/baselines/reference/mergedDeclarations6.js
Normal file
57
tests/baselines/reference/mergedDeclarations6.js
Normal file
@@ -0,0 +1,57 @@
|
||||
//// [tests/cases/compiler/mergedDeclarations6.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
|
||||
export class A {
|
||||
protected protected: any;
|
||||
|
||||
protected setProtected(val: any) {
|
||||
this.protected = val;
|
||||
}
|
||||
}
|
||||
|
||||
//// [b.ts]
|
||||
import {A} from './a';
|
||||
|
||||
declare module "./a" {
|
||||
interface A { }
|
||||
}
|
||||
|
||||
export class B extends A {
|
||||
protected setProtected() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//// [a.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
A.prototype.setProtected = function (val) {
|
||||
this.protected = val;
|
||||
};
|
||||
return A;
|
||||
}());
|
||||
exports.A = A;
|
||||
});
|
||||
//// [b.js]
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
define(["require", "exports", './a'], function (require, exports, a_1) {
|
||||
"use strict";
|
||||
var B = (function (_super) {
|
||||
__extends(B, _super);
|
||||
function B() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
B.prototype.setProtected = function () {
|
||||
};
|
||||
return B;
|
||||
}(a_1.A));
|
||||
exports.B = B;
|
||||
});
|
||||
38
tests/baselines/reference/mergedDeclarations6.symbols
Normal file
38
tests/baselines/reference/mergedDeclarations6.symbols
Normal file
@@ -0,0 +1,38 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
|
||||
export class A {
|
||||
>A : Symbol(A, Decl(a.ts, 0, 0), Decl(b.ts, 2, 22))
|
||||
|
||||
protected protected: any;
|
||||
>protected : Symbol(protected, Decl(a.ts, 1, 16))
|
||||
|
||||
protected setProtected(val: any) {
|
||||
>setProtected : Symbol(setProtected, Decl(a.ts, 2, 29))
|
||||
>val : Symbol(val, Decl(a.ts, 4, 27))
|
||||
|
||||
this.protected = val;
|
||||
>this.protected : Symbol(protected, Decl(a.ts, 1, 16))
|
||||
>this : Symbol(A, Decl(a.ts, 0, 0), Decl(b.ts, 2, 22))
|
||||
>protected : Symbol(protected, Decl(a.ts, 1, 16))
|
||||
>val : Symbol(val, Decl(a.ts, 4, 27))
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
import {A} from './a';
|
||||
>A : Symbol(A, Decl(b.ts, 0, 8))
|
||||
|
||||
declare module "./a" {
|
||||
interface A { }
|
||||
>A : Symbol(A, Decl(a.ts, 0, 0), Decl(b.ts, 2, 22))
|
||||
}
|
||||
|
||||
export class B extends A {
|
||||
>B : Symbol(B, Decl(b.ts, 4, 1))
|
||||
>A : Symbol(A, Decl(b.ts, 0, 8))
|
||||
|
||||
protected setProtected() {
|
||||
>setProtected : Symbol(setProtected, Decl(b.ts, 6, 26))
|
||||
|
||||
}
|
||||
}
|
||||
39
tests/baselines/reference/mergedDeclarations6.types
Normal file
39
tests/baselines/reference/mergedDeclarations6.types
Normal file
@@ -0,0 +1,39 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
|
||||
export class A {
|
||||
>A : A
|
||||
|
||||
protected protected: any;
|
||||
>protected : any
|
||||
|
||||
protected setProtected(val: any) {
|
||||
>setProtected : (val: any) => void
|
||||
>val : any
|
||||
|
||||
this.protected = val;
|
||||
>this.protected = val : any
|
||||
>this.protected : any
|
||||
>this : this
|
||||
>protected : any
|
||||
>val : any
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
import {A} from './a';
|
||||
>A : typeof A
|
||||
|
||||
declare module "./a" {
|
||||
interface A { }
|
||||
>A : A
|
||||
}
|
||||
|
||||
export class B extends A {
|
||||
>B : B
|
||||
>A : A
|
||||
|
||||
protected setProtected() {
|
||||
>setProtected : () => void
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user