diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision.js b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision.js new file mode 100644 index 00000000000..392506e5368 --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision.js @@ -0,0 +1,51 @@ +//// [tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision.ts] //// + +//// [db.ts] +export class db { + public doSomething() { + } +} + +//// [service.ts] +import {db} from './db'; +function someDecorator(target) { + return target; +} +@someDecorator +class MyClass { + db: db; + + constructor(db: db) { + this.db = db; + this.db.doSomething(); + } +} +export {MyClass}; + + +//// [db.js] +var db = (function () { + function db() { + } + db.prototype.doSomething = function () { + }; + return db; +})(); +exports.db = db; +//// [service.js] +var db_1 = require('./db'); +function someDecorator(target) { + return target; +} +var MyClass = (function () { + function MyClass(db) { + this.db = db; + this.db.doSomething(); + } + MyClass = __decorate([ + someDecorator, + __metadata('design:paramtypes', [db_1.db]) + ], MyClass); + return MyClass; +})(); +exports.MyClass = MyClass; diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision.symbols b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision.symbols new file mode 100644 index 00000000000..c967239df99 --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision.symbols @@ -0,0 +1,51 @@ +=== tests/cases/compiler/db.ts === +export class db { +>db : Symbol(db, Decl(db.ts, 0, 0)) + + public doSomething() { +>doSomething : Symbol(doSomething, Decl(db.ts, 0, 17)) + } +} + +=== tests/cases/compiler/service.ts === +import {db} from './db'; +>db : Symbol(db, Decl(service.ts, 0, 8)) + +function someDecorator(target) { +>someDecorator : Symbol(someDecorator, Decl(service.ts, 0, 24)) +>target : Symbol(target, Decl(service.ts, 1, 23)) + + return target; +>target : Symbol(target, Decl(service.ts, 1, 23)) +} +@someDecorator +>someDecorator : Symbol(someDecorator, Decl(service.ts, 0, 24)) + +class MyClass { +>MyClass : Symbol(MyClass, Decl(service.ts, 3, 1)) + + db: db; +>db : Symbol(db, Decl(service.ts, 5, 15)) +>db : Symbol(db, Decl(service.ts, 0, 8)) + + constructor(db: db) { +>db : Symbol(db, Decl(service.ts, 8, 16)) +>db : Symbol(db, Decl(service.ts, 0, 8)) + + this.db = db; +>this.db : Symbol(db, Decl(service.ts, 5, 15)) +>this : Symbol(MyClass, Decl(service.ts, 3, 1)) +>db : Symbol(db, Decl(service.ts, 5, 15)) +>db : Symbol(db, Decl(service.ts, 8, 16)) + + this.db.doSomething(); +>this.db.doSomething : Symbol(db.doSomething, Decl(db.ts, 0, 17)) +>this.db : Symbol(db, Decl(service.ts, 5, 15)) +>this : Symbol(MyClass, Decl(service.ts, 3, 1)) +>db : Symbol(db, Decl(service.ts, 5, 15)) +>doSomething : Symbol(db.doSomething, Decl(db.ts, 0, 17)) + } +} +export {MyClass}; +>MyClass : Symbol(MyClass, Decl(service.ts, 13, 8)) + diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision.types b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision.types new file mode 100644 index 00000000000..60cf7f10cea --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision.types @@ -0,0 +1,53 @@ +=== tests/cases/compiler/db.ts === +export class db { +>db : db + + public doSomething() { +>doSomething : () => void + } +} + +=== tests/cases/compiler/service.ts === +import {db} from './db'; +>db : typeof db + +function someDecorator(target) { +>someDecorator : (target: any) => any +>target : any + + return target; +>target : any +} +@someDecorator +>someDecorator : (target: any) => any + +class MyClass { +>MyClass : MyClass + + db: db; +>db : db +>db : db + + constructor(db: db) { +>db : db +>db : db + + this.db = db; +>this.db = db : db +>this.db : db +>this : MyClass +>db : db +>db : db + + this.db.doSomething(); +>this.db.doSomething() : void +>this.db.doSomething : () => void +>this.db : db +>this : MyClass +>db : db +>doSomething : () => void + } +} +export {MyClass}; +>MyClass : typeof MyClass + diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision2.js b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision2.js new file mode 100644 index 00000000000..da011acf110 --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision2.js @@ -0,0 +1,51 @@ +//// [tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision2.ts] //// + +//// [db.ts] +export class db { + public doSomething() { + } +} + +//// [service.ts] +import {db as Database} from './db'; +function someDecorator(target) { + return target; +} +@someDecorator +class MyClass { + db: Database; + + constructor(db: Database) { // no collision + this.db = db; + this.db.doSomething(); + } +} +export {MyClass}; + + +//// [db.js] +var db = (function () { + function db() { + } + db.prototype.doSomething = function () { + }; + return db; +})(); +exports.db = db; +//// [service.js] +var db_1 = require('./db'); +function someDecorator(target) { + return target; +} +var MyClass = (function () { + function MyClass(db) { + this.db = db; + this.db.doSomething(); + } + MyClass = __decorate([ + someDecorator, + __metadata('design:paramtypes', [db_1.db]) + ], MyClass); + return MyClass; +})(); +exports.MyClass = MyClass; diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision2.symbols b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision2.symbols new file mode 100644 index 00000000000..d79b05f68f6 --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision2.symbols @@ -0,0 +1,52 @@ +=== tests/cases/compiler/db.ts === +export class db { +>db : Symbol(db, Decl(db.ts, 0, 0)) + + public doSomething() { +>doSomething : Symbol(doSomething, Decl(db.ts, 0, 17)) + } +} + +=== tests/cases/compiler/service.ts === +import {db as Database} from './db'; +>db : Symbol(Database, Decl(service.ts, 0, 8)) +>Database : Symbol(Database, Decl(service.ts, 0, 8)) + +function someDecorator(target) { +>someDecorator : Symbol(someDecorator, Decl(service.ts, 0, 36)) +>target : Symbol(target, Decl(service.ts, 1, 23)) + + return target; +>target : Symbol(target, Decl(service.ts, 1, 23)) +} +@someDecorator +>someDecorator : Symbol(someDecorator, Decl(service.ts, 0, 36)) + +class MyClass { +>MyClass : Symbol(MyClass, Decl(service.ts, 3, 1)) + + db: Database; +>db : Symbol(db, Decl(service.ts, 5, 15)) +>Database : Symbol(Database, Decl(service.ts, 0, 8)) + + constructor(db: Database) { // no collision +>db : Symbol(db, Decl(service.ts, 8, 16)) +>Database : Symbol(Database, Decl(service.ts, 0, 8)) + + this.db = db; +>this.db : Symbol(db, Decl(service.ts, 5, 15)) +>this : Symbol(MyClass, Decl(service.ts, 3, 1)) +>db : Symbol(db, Decl(service.ts, 5, 15)) +>db : Symbol(db, Decl(service.ts, 8, 16)) + + this.db.doSomething(); +>this.db.doSomething : Symbol(Database.doSomething, Decl(db.ts, 0, 17)) +>this.db : Symbol(db, Decl(service.ts, 5, 15)) +>this : Symbol(MyClass, Decl(service.ts, 3, 1)) +>db : Symbol(db, Decl(service.ts, 5, 15)) +>doSomething : Symbol(Database.doSomething, Decl(db.ts, 0, 17)) + } +} +export {MyClass}; +>MyClass : Symbol(MyClass, Decl(service.ts, 13, 8)) + diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision2.types b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision2.types new file mode 100644 index 00000000000..73005b4673f --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision2.types @@ -0,0 +1,54 @@ +=== tests/cases/compiler/db.ts === +export class db { +>db : db + + public doSomething() { +>doSomething : () => void + } +} + +=== tests/cases/compiler/service.ts === +import {db as Database} from './db'; +>db : typeof Database +>Database : typeof Database + +function someDecorator(target) { +>someDecorator : (target: any) => any +>target : any + + return target; +>target : any +} +@someDecorator +>someDecorator : (target: any) => any + +class MyClass { +>MyClass : MyClass + + db: Database; +>db : Database +>Database : Database + + constructor(db: Database) { // no collision +>db : Database +>Database : Database + + this.db = db; +>this.db = db : Database +>this.db : Database +>this : MyClass +>db : Database +>db : Database + + this.db.doSomething(); +>this.db.doSomething() : void +>this.db.doSomething : () => void +>this.db : Database +>this : MyClass +>db : Database +>doSomething : () => void + } +} +export {MyClass}; +>MyClass : typeof MyClass + diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision5.js b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision5.js new file mode 100644 index 00000000000..a2599515338 --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision5.js @@ -0,0 +1,52 @@ +//// [tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision5.ts] //// + +//// [db.ts] +export default class db { + public doSomething() { + } +} + +//// [service.ts] +import db from './db'; +function someDecorator(target) { + return target; +} +@someDecorator +class MyClass { + db: db; + + constructor(db: db) { // collision + this.db = db; + this.db.doSomething(); + } +} +export {MyClass}; + + +//// [db.js] +var db = (function () { + function db() { + } + db.prototype.doSomething = function () { + }; + return db; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = db; +//// [service.js] +var db_1 = require('./db'); +function someDecorator(target) { + return target; +} +var MyClass = (function () { + function MyClass(db) { + this.db = db; + this.db.doSomething(); + } + MyClass = __decorate([ + someDecorator, + __metadata('design:paramtypes', [db_1.default]) + ], MyClass); + return MyClass; +})(); +exports.MyClass = MyClass; diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision5.symbols b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision5.symbols new file mode 100644 index 00000000000..6047d7f2882 --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision5.symbols @@ -0,0 +1,51 @@ +=== tests/cases/compiler/db.ts === +export default class db { +>db : Symbol(db, Decl(db.ts, 0, 0)) + + public doSomething() { +>doSomething : Symbol(doSomething, Decl(db.ts, 0, 25)) + } +} + +=== tests/cases/compiler/service.ts === +import db from './db'; +>db : Symbol(db, Decl(service.ts, 0, 6)) + +function someDecorator(target) { +>someDecorator : Symbol(someDecorator, Decl(service.ts, 0, 22)) +>target : Symbol(target, Decl(service.ts, 1, 23)) + + return target; +>target : Symbol(target, Decl(service.ts, 1, 23)) +} +@someDecorator +>someDecorator : Symbol(someDecorator, Decl(service.ts, 0, 22)) + +class MyClass { +>MyClass : Symbol(MyClass, Decl(service.ts, 3, 1)) + + db: db; +>db : Symbol(db, Decl(service.ts, 5, 15)) +>db : Symbol(db, Decl(service.ts, 0, 6)) + + constructor(db: db) { // collision +>db : Symbol(db, Decl(service.ts, 8, 16)) +>db : Symbol(db, Decl(service.ts, 0, 6)) + + this.db = db; +>this.db : Symbol(db, Decl(service.ts, 5, 15)) +>this : Symbol(MyClass, Decl(service.ts, 3, 1)) +>db : Symbol(db, Decl(service.ts, 5, 15)) +>db : Symbol(db, Decl(service.ts, 8, 16)) + + this.db.doSomething(); +>this.db.doSomething : Symbol(db.doSomething, Decl(db.ts, 0, 25)) +>this.db : Symbol(db, Decl(service.ts, 5, 15)) +>this : Symbol(MyClass, Decl(service.ts, 3, 1)) +>db : Symbol(db, Decl(service.ts, 5, 15)) +>doSomething : Symbol(db.doSomething, Decl(db.ts, 0, 25)) + } +} +export {MyClass}; +>MyClass : Symbol(MyClass, Decl(service.ts, 13, 8)) + diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision5.types b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision5.types new file mode 100644 index 00000000000..0fbc48db157 --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision5.types @@ -0,0 +1,53 @@ +=== tests/cases/compiler/db.ts === +export default class db { +>db : db + + public doSomething() { +>doSomething : () => void + } +} + +=== tests/cases/compiler/service.ts === +import db from './db'; +>db : typeof db + +function someDecorator(target) { +>someDecorator : (target: any) => any +>target : any + + return target; +>target : any +} +@someDecorator +>someDecorator : (target: any) => any + +class MyClass { +>MyClass : MyClass + + db: db; +>db : db +>db : db + + constructor(db: db) { // collision +>db : db +>db : db + + this.db = db; +>this.db = db : db +>this.db : db +>this : MyClass +>db : db +>db : db + + this.db.doSomething(); +>this.db.doSomething() : void +>this.db.doSomething : () => void +>this.db : db +>this : MyClass +>db : db +>doSomething : () => void + } +} +export {MyClass}; +>MyClass : typeof MyClass + diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision6.js b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision6.js new file mode 100644 index 00000000000..917cdc7036f --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision6.js @@ -0,0 +1,52 @@ +//// [tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision6.ts] //// + +//// [db.ts] +export default class db { + public doSomething() { + } +} + +//// [service.ts] +import database from './db'; +function someDecorator(target) { + return target; +} +@someDecorator +class MyClass { + db: database; + + constructor(db: database) { // no collision + this.db = db; + this.db.doSomething(); + } +} +export {MyClass}; + + +//// [db.js] +var db = (function () { + function db() { + } + db.prototype.doSomething = function () { + }; + return db; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = db; +//// [service.js] +var db_1 = require('./db'); +function someDecorator(target) { + return target; +} +var MyClass = (function () { + function MyClass(db) { + this.db = db; + this.db.doSomething(); + } + MyClass = __decorate([ + someDecorator, + __metadata('design:paramtypes', [db_1.default]) + ], MyClass); + return MyClass; +})(); +exports.MyClass = MyClass; diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision6.symbols b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision6.symbols new file mode 100644 index 00000000000..27f807503bf --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision6.symbols @@ -0,0 +1,51 @@ +=== tests/cases/compiler/db.ts === +export default class db { +>db : Symbol(db, Decl(db.ts, 0, 0)) + + public doSomething() { +>doSomething : Symbol(doSomething, Decl(db.ts, 0, 25)) + } +} + +=== tests/cases/compiler/service.ts === +import database from './db'; +>database : Symbol(database, Decl(service.ts, 0, 6)) + +function someDecorator(target) { +>someDecorator : Symbol(someDecorator, Decl(service.ts, 0, 28)) +>target : Symbol(target, Decl(service.ts, 1, 23)) + + return target; +>target : Symbol(target, Decl(service.ts, 1, 23)) +} +@someDecorator +>someDecorator : Symbol(someDecorator, Decl(service.ts, 0, 28)) + +class MyClass { +>MyClass : Symbol(MyClass, Decl(service.ts, 3, 1)) + + db: database; +>db : Symbol(db, Decl(service.ts, 5, 15)) +>database : Symbol(database, Decl(service.ts, 0, 6)) + + constructor(db: database) { // no collision +>db : Symbol(db, Decl(service.ts, 8, 16)) +>database : Symbol(database, Decl(service.ts, 0, 6)) + + this.db = db; +>this.db : Symbol(db, Decl(service.ts, 5, 15)) +>this : Symbol(MyClass, Decl(service.ts, 3, 1)) +>db : Symbol(db, Decl(service.ts, 5, 15)) +>db : Symbol(db, Decl(service.ts, 8, 16)) + + this.db.doSomething(); +>this.db.doSomething : Symbol(database.doSomething, Decl(db.ts, 0, 25)) +>this.db : Symbol(db, Decl(service.ts, 5, 15)) +>this : Symbol(MyClass, Decl(service.ts, 3, 1)) +>db : Symbol(db, Decl(service.ts, 5, 15)) +>doSomething : Symbol(database.doSomething, Decl(db.ts, 0, 25)) + } +} +export {MyClass}; +>MyClass : Symbol(MyClass, Decl(service.ts, 13, 8)) + diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision6.types b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision6.types new file mode 100644 index 00000000000..e3a68882dfb --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision6.types @@ -0,0 +1,53 @@ +=== tests/cases/compiler/db.ts === +export default class db { +>db : db + + public doSomething() { +>doSomething : () => void + } +} + +=== tests/cases/compiler/service.ts === +import database from './db'; +>database : typeof database + +function someDecorator(target) { +>someDecorator : (target: any) => any +>target : any + + return target; +>target : any +} +@someDecorator +>someDecorator : (target: any) => any + +class MyClass { +>MyClass : MyClass + + db: database; +>db : database +>database : database + + constructor(db: database) { // no collision +>db : database +>database : database + + this.db = db; +>this.db = db : database +>this.db : database +>this : MyClass +>db : database +>db : database + + this.db.doSomething(); +>this.db.doSomething() : void +>this.db.doSomething : () => void +>this.db : database +>this : MyClass +>db : database +>doSomething : () => void + } +} +export {MyClass}; +>MyClass : typeof MyClass + diff --git a/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision.ts b/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision.ts new file mode 100644 index 00000000000..8d198e44752 --- /dev/null +++ b/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision.ts @@ -0,0 +1,26 @@ +// @noemithelpers: true +// @experimentaldecorators: true +// @emitdecoratormetadata: true +// @target: es5 +// @module: commonjs +// @filename: db.ts +export class db { + public doSomething() { + } +} + +// @filename: service.ts +import {db} from './db'; +function someDecorator(target) { + return target; +} +@someDecorator +class MyClass { + db: db; + + constructor(db: db) { + this.db = db; + this.db.doSomething(); + } +} +export {MyClass}; diff --git a/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision2.ts b/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision2.ts new file mode 100644 index 00000000000..ac097dd3ba4 --- /dev/null +++ b/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision2.ts @@ -0,0 +1,26 @@ +// @noemithelpers: true +// @experimentaldecorators: true +// @emitdecoratormetadata: true +// @target: es5 +// @module: commonjs +// @filename: db.ts +export class db { + public doSomething() { + } +} + +// @filename: service.ts +import {db as Database} from './db'; +function someDecorator(target) { + return target; +} +@someDecorator +class MyClass { + db: Database; + + constructor(db: Database) { // no collision + this.db = db; + this.db.doSomething(); + } +} +export {MyClass}; diff --git a/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision5.ts b/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision5.ts new file mode 100644 index 00000000000..24934963b3e --- /dev/null +++ b/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision5.ts @@ -0,0 +1,26 @@ +// @noemithelpers: true +// @experimentaldecorators: true +// @emitdecoratormetadata: true +// @target: es5 +// @module: commonjs +// @filename: db.ts +export default class db { + public doSomething() { + } +} + +// @filename: service.ts +import db from './db'; +function someDecorator(target) { + return target; +} +@someDecorator +class MyClass { + db: db; + + constructor(db: db) { // collision + this.db = db; + this.db.doSomething(); + } +} +export {MyClass}; diff --git a/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision6.ts b/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision6.ts new file mode 100644 index 00000000000..2043279c4aa --- /dev/null +++ b/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision6.ts @@ -0,0 +1,26 @@ +// @noemithelpers: true +// @experimentaldecorators: true +// @emitdecoratormetadata: true +// @target: es5 +// @module: commonjs +// @filename: db.ts +export default class db { + public doSomething() { + } +} + +// @filename: service.ts +import database from './db'; +function someDecorator(target) { + return target; +} +@someDecorator +class MyClass { + db: database; + + constructor(db: database) { // no collision + this.db = db; + this.db.doSomething(); + } +} +export {MyClass};