-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
264 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
tests/baselines/reference/declarationEmitPrivateSymbolCausesVarDeclarationEmit2.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
tests/cases/compiler/c.ts(4,14): error TS2415: Class 'D' incorrectly extends base class 'C'. | ||
Types have separate declarations of a private property '[x]'. | ||
|
||
|
||
==== tests/cases/compiler/a.ts (0 errors) ==== | ||
export const x = Symbol(); | ||
|
||
==== tests/cases/compiler/b.ts (0 errors) ==== | ||
import { x } from "./a"; | ||
|
||
export class C { | ||
private [x]: number = 1; | ||
} | ||
|
||
==== tests/cases/compiler/c.ts (1 errors) ==== | ||
import { x } from "./a"; | ||
import { C } from "./b"; | ||
|
||
export class D extends C { | ||
~ | ||
!!! error TS2415: Class 'D' incorrectly extends base class 'C'. | ||
!!! error TS2415: Types have separate declarations of a private property '[x]'. | ||
private [x]: 12 = 12; | ||
} | ||
|
80 changes: 80 additions & 0 deletions
80
tests/baselines/reference/declarationEmitPrivateSymbolCausesVarDeclarationEmit2.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
//// [tests/cases/compiler/declarationEmitPrivateSymbolCausesVarDeclarationEmit2.ts] //// | ||
|
||
//// [a.ts] | ||
export const x = Symbol(); | ||
|
||
//// [b.ts] | ||
import { x } from "./a"; | ||
|
||
export class C { | ||
private [x]: number = 1; | ||
} | ||
|
||
//// [c.ts] | ||
import { x } from "./a"; | ||
import { C } from "./b"; | ||
|
||
export class D extends C { | ||
private [x]: 12 = 12; | ||
} | ||
|
||
|
||
//// [a.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.x = Symbol(); | ||
//// [b.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
var a_1 = require("./a"); | ||
var C = /** @class */ (function () { | ||
function C() { | ||
this[_a] = 1; | ||
} | ||
return C; | ||
}()); | ||
_a = a_1.x; | ||
exports.C = C; | ||
var _a; | ||
//// [c.js] | ||
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
exports.__esModule = true; | ||
var a_1 = require("./a"); | ||
var b_1 = require("./b"); | ||
var D = /** @class */ (function (_super) { | ||
__extends(D, _super); | ||
function D() { | ||
var _this = _super !== null && _super.apply(this, arguments) || this; | ||
_this[_a] = 12; | ||
return _this; | ||
} | ||
return D; | ||
}(b_1.C)); | ||
_a = a_1.x; | ||
exports.D = D; | ||
var _a; | ||
|
||
|
||
//// [a.d.ts] | ||
export declare const x: unique symbol; | ||
//// [b.d.ts] | ||
import { x } from "./a"; | ||
export declare class C { | ||
private [x]; | ||
} | ||
//// [c.d.ts] | ||
import { x } from "./a"; | ||
import { C } from "./b"; | ||
export declare class D extends C { | ||
private [x]; | ||
} |
33 changes: 33 additions & 0 deletions
33
tests/baselines/reference/declarationEmitPrivateSymbolCausesVarDeclarationEmit2.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
=== tests/cases/compiler/a.ts === | ||
export const x = Symbol(); | ||
>x : Symbol(x, Decl(a.ts, 0, 12)) | ||
>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) | ||
|
||
=== tests/cases/compiler/b.ts === | ||
import { x } from "./a"; | ||
>x : Symbol(x, Decl(b.ts, 0, 8)) | ||
|
||
export class C { | ||
>C : Symbol(C, Decl(b.ts, 0, 24)) | ||
|
||
private [x]: number = 1; | ||
>[x] : Symbol(C[x], Decl(b.ts, 2, 16)) | ||
>x : Symbol(x, Decl(b.ts, 0, 8)) | ||
} | ||
|
||
=== tests/cases/compiler/c.ts === | ||
import { x } from "./a"; | ||
>x : Symbol(x, Decl(c.ts, 0, 8)) | ||
|
||
import { C } from "./b"; | ||
>C : Symbol(C, Decl(c.ts, 1, 8)) | ||
|
||
export class D extends C { | ||
>D : Symbol(D, Decl(c.ts, 1, 24)) | ||
>C : Symbol(C, Decl(c.ts, 1, 8)) | ||
|
||
private [x]: 12 = 12; | ||
>[x] : Symbol(D[x], Decl(c.ts, 3, 26)) | ||
>x : Symbol(x, Decl(c.ts, 0, 8)) | ||
} | ||
|
36 changes: 36 additions & 0 deletions
36
tests/baselines/reference/declarationEmitPrivateSymbolCausesVarDeclarationEmit2.types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
=== tests/cases/compiler/a.ts === | ||
export const x = Symbol(); | ||
>x : unique symbol | ||
>Symbol() : unique symbol | ||
>Symbol : SymbolConstructor | ||
|
||
=== tests/cases/compiler/b.ts === | ||
import { x } from "./a"; | ||
>x : unique symbol | ||
|
||
export class C { | ||
>C : C | ||
|
||
private [x]: number = 1; | ||
>[x] : number | ||
>x : unique symbol | ||
>1 : 1 | ||
} | ||
|
||
=== tests/cases/compiler/c.ts === | ||
import { x } from "./a"; | ||
>x : unique symbol | ||
|
||
import { C } from "./b"; | ||
>C : typeof C | ||
|
||
export class D extends C { | ||
>D : D | ||
>C : C | ||
|
||
private [x]: 12 = 12; | ||
>[x] : 12 | ||
>x : unique symbol | ||
>12 : 12 | ||
} | ||
|
26 changes: 26 additions & 0 deletions
26
tests/baselines/reference/declarationEmitPrivateSymbolCausesVarDeclarationToBeEmitted.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
//// [declarationEmitPrivateSymbolCausesVarDeclarationToBeEmitted.ts] | ||
const _data = Symbol('data'); | ||
|
||
export class User { | ||
private [_data] : any; | ||
}; | ||
|
||
|
||
//// [declarationEmitPrivateSymbolCausesVarDeclarationToBeEmitted.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
var _data = Symbol('data'); | ||
var User = /** @class */ (function () { | ||
function User() { | ||
} | ||
return User; | ||
}()); | ||
exports.User = User; | ||
; | ||
|
||
|
||
//// [declarationEmitPrivateSymbolCausesVarDeclarationToBeEmitted.d.ts] | ||
declare const _data: unique symbol; | ||
export declare class User { | ||
private [_data]; | ||
} |
14 changes: 14 additions & 0 deletions
14
...s/baselines/reference/declarationEmitPrivateSymbolCausesVarDeclarationToBeEmitted.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
=== tests/cases/compiler/declarationEmitPrivateSymbolCausesVarDeclarationToBeEmitted.ts === | ||
const _data = Symbol('data'); | ||
>_data : Symbol(_data, Decl(declarationEmitPrivateSymbolCausesVarDeclarationToBeEmitted.ts, 0, 5)) | ||
>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) | ||
|
||
export class User { | ||
>User : Symbol(User, Decl(declarationEmitPrivateSymbolCausesVarDeclarationToBeEmitted.ts, 0, 29)) | ||
|
||
private [_data] : any; | ||
>[_data] : Symbol(User[_data], Decl(declarationEmitPrivateSymbolCausesVarDeclarationToBeEmitted.ts, 2, 19)) | ||
>_data : Symbol(_data, Decl(declarationEmitPrivateSymbolCausesVarDeclarationToBeEmitted.ts, 0, 5)) | ||
|
||
}; | ||
|
16 changes: 16 additions & 0 deletions
16
tests/baselines/reference/declarationEmitPrivateSymbolCausesVarDeclarationToBeEmitted.types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
=== tests/cases/compiler/declarationEmitPrivateSymbolCausesVarDeclarationToBeEmitted.ts === | ||
const _data = Symbol('data'); | ||
>_data : unique symbol | ||
>Symbol('data') : unique symbol | ||
>Symbol : SymbolConstructor | ||
>'data' : "data" | ||
|
||
export class User { | ||
>User : User | ||
|
||
private [_data] : any; | ||
>[_data] : any | ||
>_data : unique symbol | ||
|
||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.