From 49fd35da33cf3de26199c8183581124974423f50 Mon Sep 17 00:00:00 2001 From: Bill Ticehurst Date: Mon, 10 Oct 2016 22:40:03 -0700 Subject: [PATCH 1/3] Resolve export= module members --- src/compiler/checker.ts | 4 + .../reference/bluebirdStaticThis.errors.txt | 188 +++++++++++++++++- 2 files changed, 191 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index dfe6317e250..b5fe19b0a80 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1465,6 +1465,10 @@ namespace ts { function getExportsForModule(moduleSymbol: Symbol): SymbolTable { const visitedSymbols: Symbol[] = []; + + // A module defined by an 'export=' consists on one export that needs to be resolved + moduleSymbol = resolveExternalModuleSymbol(moduleSymbol); + return visit(moduleSymbol) || moduleSymbol.exports; // The ES6 spec permits export * declarations in a module to circularly reference the module itself. For example, diff --git a/tests/baselines/reference/bluebirdStaticThis.errors.txt b/tests/baselines/reference/bluebirdStaticThis.errors.txt index 1c22a12c341..a20c7ace880 100644 --- a/tests/baselines/reference/bluebirdStaticThis.errors.txt +++ b/tests/baselines/reference/bluebirdStaticThis.errors.txt @@ -1,13 +1,75 @@ tests/cases/compiler/bluebirdStaticThis.ts(5,15): error TS2420: Class 'Promise' incorrectly implements interface 'Thenable'. Property 'then' is missing in type 'Promise'. +tests/cases/compiler/bluebirdStaticThis.ts(7,12): error TS2323: Cannot redeclare exported variable 'try'. +tests/cases/compiler/bluebirdStaticThis.ts(8,12): error TS2323: Cannot redeclare exported variable 'try'. +tests/cases/compiler/bluebirdStaticThis.ts(10,12): error TS2323: Cannot redeclare exported variable 'attempt'. +tests/cases/compiler/bluebirdStaticThis.ts(11,12): error TS2323: Cannot redeclare exported variable 'attempt'. +tests/cases/compiler/bluebirdStaticThis.ts(15,12): error TS2323: Cannot redeclare exported variable 'resolve'. +tests/cases/compiler/bluebirdStaticThis.ts(16,12): error TS2323: Cannot redeclare exported variable 'resolve'. +tests/cases/compiler/bluebirdStaticThis.ts(17,12): error TS2323: Cannot redeclare exported variable 'resolve'. +tests/cases/compiler/bluebirdStaticThis.ts(19,12): error TS2323: Cannot redeclare exported variable 'reject'. +tests/cases/compiler/bluebirdStaticThis.ts(20,12): error TS2323: Cannot redeclare exported variable 'reject'. tests/cases/compiler/bluebirdStaticThis.ts(22,51): error TS2694: Namespace 'Promise' has no exported member 'Resolver'. +tests/cases/compiler/bluebirdStaticThis.ts(24,12): error TS2323: Cannot redeclare exported variable 'cast'. +tests/cases/compiler/bluebirdStaticThis.ts(25,12): error TS2323: Cannot redeclare exported variable 'cast'. +tests/cases/compiler/bluebirdStaticThis.ts(33,12): error TS2323: Cannot redeclare exported variable 'delay'. +tests/cases/compiler/bluebirdStaticThis.ts(34,12): error TS2323: Cannot redeclare exported variable 'delay'. +tests/cases/compiler/bluebirdStaticThis.ts(35,12): error TS2323: Cannot redeclare exported variable 'delay'. +tests/cases/compiler/bluebirdStaticThis.ts(49,12): error TS2323: Cannot redeclare exported variable 'all'. +tests/cases/compiler/bluebirdStaticThis.ts(50,12): error TS2323: Cannot redeclare exported variable 'all'. +tests/cases/compiler/bluebirdStaticThis.ts(51,12): error TS2323: Cannot redeclare exported variable 'all'. +tests/cases/compiler/bluebirdStaticThis.ts(52,12): error TS2323: Cannot redeclare exported variable 'all'. +tests/cases/compiler/bluebirdStaticThis.ts(54,12): error TS2323: Cannot redeclare exported variable 'props'. +tests/cases/compiler/bluebirdStaticThis.ts(55,12): error TS2323: Cannot redeclare exported variable 'props'. +tests/cases/compiler/bluebirdStaticThis.ts(57,12): error TS2323: Cannot redeclare exported variable 'settle'. tests/cases/compiler/bluebirdStaticThis.ts(57,109): error TS2694: Namespace 'Promise' has no exported member 'Inspection'. +tests/cases/compiler/bluebirdStaticThis.ts(58,12): error TS2323: Cannot redeclare exported variable 'settle'. tests/cases/compiler/bluebirdStaticThis.ts(58,91): error TS2694: Namespace 'Promise' has no exported member 'Inspection'. +tests/cases/compiler/bluebirdStaticThis.ts(59,12): error TS2323: Cannot redeclare exported variable 'settle'. tests/cases/compiler/bluebirdStaticThis.ts(59,91): error TS2694: Namespace 'Promise' has no exported member 'Inspection'. +tests/cases/compiler/bluebirdStaticThis.ts(60,12): error TS2323: Cannot redeclare exported variable 'settle'. tests/cases/compiler/bluebirdStaticThis.ts(60,73): error TS2694: Namespace 'Promise' has no exported member 'Inspection'. +tests/cases/compiler/bluebirdStaticThis.ts(62,12): error TS2323: Cannot redeclare exported variable 'any'. +tests/cases/compiler/bluebirdStaticThis.ts(63,12): error TS2323: Cannot redeclare exported variable 'any'. +tests/cases/compiler/bluebirdStaticThis.ts(64,12): error TS2323: Cannot redeclare exported variable 'any'. +tests/cases/compiler/bluebirdStaticThis.ts(65,12): error TS2323: Cannot redeclare exported variable 'any'. +tests/cases/compiler/bluebirdStaticThis.ts(67,12): error TS2323: Cannot redeclare exported variable 'race'. +tests/cases/compiler/bluebirdStaticThis.ts(68,12): error TS2323: Cannot redeclare exported variable 'race'. +tests/cases/compiler/bluebirdStaticThis.ts(69,12): error TS2323: Cannot redeclare exported variable 'race'. +tests/cases/compiler/bluebirdStaticThis.ts(70,12): error TS2323: Cannot redeclare exported variable 'race'. +tests/cases/compiler/bluebirdStaticThis.ts(72,12): error TS2323: Cannot redeclare exported variable 'some'. +tests/cases/compiler/bluebirdStaticThis.ts(73,12): error TS2323: Cannot redeclare exported variable 'some'. +tests/cases/compiler/bluebirdStaticThis.ts(74,12): error TS2323: Cannot redeclare exported variable 'some'. +tests/cases/compiler/bluebirdStaticThis.ts(75,12): error TS2323: Cannot redeclare exported variable 'some'. +tests/cases/compiler/bluebirdStaticThis.ts(77,12): error TS2323: Cannot redeclare exported variable 'join'. +tests/cases/compiler/bluebirdStaticThis.ts(78,12): error TS2323: Cannot redeclare exported variable 'join'. +tests/cases/compiler/bluebirdStaticThis.ts(80,12): error TS2323: Cannot redeclare exported variable 'map'. +tests/cases/compiler/bluebirdStaticThis.ts(81,12): error TS2323: Cannot redeclare exported variable 'map'. +tests/cases/compiler/bluebirdStaticThis.ts(82,12): error TS2323: Cannot redeclare exported variable 'map'. +tests/cases/compiler/bluebirdStaticThis.ts(83,12): error TS2323: Cannot redeclare exported variable 'map'. +tests/cases/compiler/bluebirdStaticThis.ts(84,12): error TS2323: Cannot redeclare exported variable 'map'. +tests/cases/compiler/bluebirdStaticThis.ts(85,12): error TS2323: Cannot redeclare exported variable 'map'. +tests/cases/compiler/bluebirdStaticThis.ts(86,12): error TS2323: Cannot redeclare exported variable 'map'. +tests/cases/compiler/bluebirdStaticThis.ts(87,12): error TS2323: Cannot redeclare exported variable 'map'. +tests/cases/compiler/bluebirdStaticThis.ts(89,12): error TS2323: Cannot redeclare exported variable 'reduce'. +tests/cases/compiler/bluebirdStaticThis.ts(90,12): error TS2323: Cannot redeclare exported variable 'reduce'. +tests/cases/compiler/bluebirdStaticThis.ts(92,12): error TS2323: Cannot redeclare exported variable 'reduce'. +tests/cases/compiler/bluebirdStaticThis.ts(93,12): error TS2323: Cannot redeclare exported variable 'reduce'. +tests/cases/compiler/bluebirdStaticThis.ts(95,12): error TS2323: Cannot redeclare exported variable 'reduce'. +tests/cases/compiler/bluebirdStaticThis.ts(96,12): error TS2323: Cannot redeclare exported variable 'reduce'. +tests/cases/compiler/bluebirdStaticThis.ts(98,12): error TS2323: Cannot redeclare exported variable 'reduce'. +tests/cases/compiler/bluebirdStaticThis.ts(99,12): error TS2323: Cannot redeclare exported variable 'reduce'. +tests/cases/compiler/bluebirdStaticThis.ts(101,12): error TS2323: Cannot redeclare exported variable 'filter'. +tests/cases/compiler/bluebirdStaticThis.ts(102,12): error TS2323: Cannot redeclare exported variable 'filter'. +tests/cases/compiler/bluebirdStaticThis.ts(103,12): error TS2323: Cannot redeclare exported variable 'filter'. +tests/cases/compiler/bluebirdStaticThis.ts(104,12): error TS2323: Cannot redeclare exported variable 'filter'. +tests/cases/compiler/bluebirdStaticThis.ts(105,12): error TS2323: Cannot redeclare exported variable 'filter'. +tests/cases/compiler/bluebirdStaticThis.ts(106,12): error TS2323: Cannot redeclare exported variable 'filter'. +tests/cases/compiler/bluebirdStaticThis.ts(107,12): error TS2323: Cannot redeclare exported variable 'filter'. +tests/cases/compiler/bluebirdStaticThis.ts(108,12): error TS2323: Cannot redeclare exported variable 'filter'. -==== tests/cases/compiler/bluebirdStaticThis.ts (6 errors) ==== +==== tests/cases/compiler/bluebirdStaticThis.ts (68 errors) ==== // This version is reduced from the full d.ts by removing almost all the tests // and all the comments. // Then it adds explicit `this` arguments to the static members. @@ -18,26 +80,48 @@ tests/cases/compiler/bluebirdStaticThis.ts(60,73): error TS2694: Namespace 'Prom !!! error TS2420: Property 'then' is missing in type 'Promise'. constructor(callback: (resolve: (thenableOrResult: R | Promise.Thenable) => void, reject: (error: any) => void) => void); static try(dit: typeof Promise, fn: () => Promise.Thenable, args?: any[], ctx?: any): Promise; + ~~~ +!!! error TS2323: Cannot redeclare exported variable 'try'. static try(dit: typeof Promise, fn: () => R, args?: any[], ctx?: any): Promise; + ~~~ +!!! error TS2323: Cannot redeclare exported variable 'try'. static attempt(dit: typeof Promise, fn: () => Promise.Thenable, args?: any[], ctx?: any): Promise; + ~~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'attempt'. static attempt(dit: typeof Promise, fn: () => R, args?: any[], ctx?: any): Promise; + ~~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'attempt'. static method(dit: typeof Promise, fn: Function): Function; static resolve(dit: typeof Promise): Promise; + ~~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'resolve'. static resolve(dit: typeof Promise, value: Promise.Thenable): Promise; + ~~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'resolve'. static resolve(dit: typeof Promise, value: R): Promise; + ~~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'resolve'. static reject(dit: typeof Promise, reason: any): Promise; + ~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'reject'. static reject(dit: typeof Promise, reason: any): Promise; + ~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'reject'. static defer(dit: typeof Promise): Promise.Resolver; ~~~~~~~~ !!! error TS2694: Namespace 'Promise' has no exported member 'Resolver'. static cast(dit: typeof Promise, value: Promise.Thenable): Promise; + ~~~~ +!!! error TS2323: Cannot redeclare exported variable 'cast'. static cast(dit: typeof Promise, value: R): Promise; + ~~~~ +!!! error TS2323: Cannot redeclare exported variable 'cast'. static bind(dit: typeof Promise, thisArg: any): Promise; @@ -46,8 +130,14 @@ tests/cases/compiler/bluebirdStaticThis.ts(60,73): error TS2694: Namespace 'Prom static longStackTraces(dit: typeof Promise): void; static delay(dit: typeof Promise, value: Promise.Thenable, ms: number): Promise; + ~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'delay'. static delay(dit: typeof Promise, value: R, ms: number): Promise; + ~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'delay'. static delay(dit: typeof Promise, ms: number): Promise; + ~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'delay'. static promisify(dit: typeof Promise, nodeFunction: Function, receiver?: any): Function; @@ -62,73 +152,169 @@ tests/cases/compiler/bluebirdStaticThis.ts(60,73): error TS2694: Namespace 'Prom static onPossiblyUnhandledRejection(dit: typeof Promise, handler: (reason: any) => any): void; static all(dit: typeof Promise, values: Promise.Thenable[]>): Promise; + ~~~ +!!! error TS2323: Cannot redeclare exported variable 'all'. static all(dit: typeof Promise, values: Promise.Thenable): Promise; + ~~~ +!!! error TS2323: Cannot redeclare exported variable 'all'. static all(dit: typeof Promise, values: Promise.Thenable[]): Promise; + ~~~ +!!! error TS2323: Cannot redeclare exported variable 'all'. static all(dit: typeof Promise, values: R[]): Promise; + ~~~ +!!! error TS2323: Cannot redeclare exported variable 'all'. static props(dit: typeof Promise, object: Promise): Promise; + ~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'props'. static props(dit: typeof Promise, object: Object): Promise; + ~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'props'. static settle(dit: typeof Promise, values: Promise.Thenable[]>): Promise[]>; + ~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'settle'. ~~~~~~~~~~ !!! error TS2694: Namespace 'Promise' has no exported member 'Inspection'. static settle(dit: typeof Promise, values: Promise.Thenable): Promise[]>; + ~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'settle'. ~~~~~~~~~~ !!! error TS2694: Namespace 'Promise' has no exported member 'Inspection'. static settle(dit: typeof Promise, values: Promise.Thenable[]): Promise[]>; + ~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'settle'. ~~~~~~~~~~ !!! error TS2694: Namespace 'Promise' has no exported member 'Inspection'. static settle(dit: typeof Promise, values: R[]): Promise[]>; + ~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'settle'. ~~~~~~~~~~ !!! error TS2694: Namespace 'Promise' has no exported member 'Inspection'. static any(dit: typeof Promise, values: Promise.Thenable[]>): Promise; + ~~~ +!!! error TS2323: Cannot redeclare exported variable 'any'. static any(dit: typeof Promise, values: Promise.Thenable): Promise; + ~~~ +!!! error TS2323: Cannot redeclare exported variable 'any'. static any(dit: typeof Promise, values: Promise.Thenable[]): Promise; + ~~~ +!!! error TS2323: Cannot redeclare exported variable 'any'. static any(dit: typeof Promise, values: R[]): Promise; + ~~~ +!!! error TS2323: Cannot redeclare exported variable 'any'. static race(dit: typeof Promise, values: Promise.Thenable[]>): Promise; + ~~~~ +!!! error TS2323: Cannot redeclare exported variable 'race'. static race(dit: typeof Promise, values: Promise.Thenable): Promise; + ~~~~ +!!! error TS2323: Cannot redeclare exported variable 'race'. static race(dit: typeof Promise, values: Promise.Thenable[]): Promise; + ~~~~ +!!! error TS2323: Cannot redeclare exported variable 'race'. static race(dit: typeof Promise, values: R[]): Promise; + ~~~~ +!!! error TS2323: Cannot redeclare exported variable 'race'. static some(dit: typeof Promise, values: Promise.Thenable[]>, count: number): Promise; + ~~~~ +!!! error TS2323: Cannot redeclare exported variable 'some'. static some(dit: typeof Promise, values: Promise.Thenable, count: number): Promise; + ~~~~ +!!! error TS2323: Cannot redeclare exported variable 'some'. static some(dit: typeof Promise, values: Promise.Thenable[], count: number): Promise; + ~~~~ +!!! error TS2323: Cannot redeclare exported variable 'some'. static some(dit: typeof Promise, values: R[], count: number): Promise; + ~~~~ +!!! error TS2323: Cannot redeclare exported variable 'some'. static join(dit: typeof Promise, ...values: Promise.Thenable[]): Promise; + ~~~~ +!!! error TS2323: Cannot redeclare exported variable 'join'. static join(dit: typeof Promise, ...values: R[]): Promise; + ~~~~ +!!! error TS2323: Cannot redeclare exported variable 'join'. static map(dit: typeof Promise, values: Promise.Thenable[]>, mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; + ~~~ +!!! error TS2323: Cannot redeclare exported variable 'map'. static map(dit: typeof Promise, values: Promise.Thenable[]>, mapper: (item: R, index: number, arrayLength: number) => U): Promise; + ~~~ +!!! error TS2323: Cannot redeclare exported variable 'map'. static map(dit: typeof Promise, values: Promise.Thenable, mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; + ~~~ +!!! error TS2323: Cannot redeclare exported variable 'map'. static map(dit: typeof Promise, values: Promise.Thenable, mapper: (item: R, index: number, arrayLength: number) => U): Promise; + ~~~ +!!! error TS2323: Cannot redeclare exported variable 'map'. static map(dit: typeof Promise, values: Promise.Thenable[], mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; + ~~~ +!!! error TS2323: Cannot redeclare exported variable 'map'. static map(dit: typeof Promise, values: Promise.Thenable[], mapper: (item: R, index: number, arrayLength: number) => U): Promise; + ~~~ +!!! error TS2323: Cannot redeclare exported variable 'map'. static map(dit: typeof Promise, values: R[], mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; + ~~~ +!!! error TS2323: Cannot redeclare exported variable 'map'. static map(dit: typeof Promise, values: R[], mapper: (item: R, index: number, arrayLength: number) => U): Promise; + ~~~ +!!! error TS2323: Cannot redeclare exported variable 'map'. static reduce(dit: typeof Promise, values: Promise.Thenable[]>, reducer: (total: U, current: R, index: number, arrayLength: number) => Promise.Thenable, initialValue?: U): Promise; + ~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'reduce'. static reduce(dit: typeof Promise, values: Promise.Thenable[]>, reducer: (total: U, current: R, index: number, arrayLength: number) => U, initialValue?: U): Promise; + ~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'reduce'. static reduce(dit: typeof Promise, values: Promise.Thenable, reducer: (total: U, current: R, index: number, arrayLength: number) => Promise.Thenable, initialValue?: U): Promise; + ~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'reduce'. static reduce(dit: typeof Promise, values: Promise.Thenable, reducer: (total: U, current: R, index: number, arrayLength: number) => U, initialValue?: U): Promise; + ~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'reduce'. static reduce(dit: typeof Promise, values: Promise.Thenable[], reducer: (total: U, current: R, index: number, arrayLength: number) => Promise.Thenable, initialValue?: U): Promise; + ~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'reduce'. static reduce(dit: typeof Promise, values: Promise.Thenable[], reducer: (total: U, current: R, index: number, arrayLength: number) => U, initialValue?: U): Promise; + ~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'reduce'. static reduce(dit: typeof Promise, values: R[], reducer: (total: U, current: R, index: number, arrayLength: number) => Promise.Thenable, initialValue?: U): Promise; + ~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'reduce'. static reduce(dit: typeof Promise, values: R[], reducer: (total: U, current: R, index: number, arrayLength: number) => U, initialValue?: U): Promise; + ~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'reduce'. static filter(dit: typeof Promise, values: Promise.Thenable[]>, filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; + ~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'filter'. static filter(dit: typeof Promise, values: Promise.Thenable[]>, filterer: (item: R, index: number, arrayLength: number) => boolean): Promise; + ~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'filter'. static filter(dit: typeof Promise, values: Promise.Thenable, filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; + ~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'filter'. static filter(dit: typeof Promise, values: Promise.Thenable, filterer: (item: R, index: number, arrayLength: number) => boolean): Promise; + ~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'filter'. static filter(dit: typeof Promise, values: Promise.Thenable[], filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; + ~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'filter'. static filter(dit: typeof Promise, values: Promise.Thenable[], filterer: (item: R, index: number, arrayLength: number) => boolean): Promise; + ~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'filter'. static filter(dit: typeof Promise, values: R[], filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; + ~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'filter'. static filter(dit: typeof Promise, values: R[], filterer: (item: R, index: number, arrayLength: number) => boolean): Promise; + ~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'filter'. } declare module Promise { From a4e7bff759b7d23cca787ff205b4119b950e7fe5 Mon Sep 17 00:00:00 2001 From: Bill Ticehurst Date: Tue, 11 Oct 2016 17:51:53 -0700 Subject: [PATCH 2/3] Fixed errors with overloaded method exports --- src/compiler/checker.ts | 3 ++- .../completionListInImportClause04.ts | 20 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/completionListInImportClause04.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index b5fe19b0a80..273b5e06134 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -17893,7 +17893,8 @@ namespace ts { } function isNotOverload(declaration: Declaration): boolean { - return declaration.kind !== SyntaxKind.FunctionDeclaration || !!(declaration as FunctionDeclaration).body; + return (declaration.kind !== SyntaxKind.FunctionDeclaration && declaration.kind !== SyntaxKind.MethodDeclaration) || + !!(declaration as FunctionDeclaration).body; } } diff --git a/tests/cases/fourslash/completionListInImportClause04.ts b/tests/cases/fourslash/completionListInImportClause04.ts new file mode 100644 index 00000000000..672c754e807 --- /dev/null +++ b/tests/cases/fourslash/completionListInImportClause04.ts @@ -0,0 +1,20 @@ +/// + +// @Filename: foo.d.ts +//// declare class Foo { +//// static prop1(x: number): number; +//// static prop1(x: string): string; +//// static prop2(x: boolean): boolean; +//// } +//// export = Foo; /*2*/ + +// @Filename: app.ts +////import {/*1*/} from './foo'; + +goTo.marker('1'); +verify.completionListContains('prop1'); +verify.completionListContains('prop2'); +verify.not.completionListContains('Foo'); +verify.numberOfErrorsInCurrentFile(0); +goTo.marker('2'); +verify.numberOfErrorsInCurrentFile(0); From db5da0b85f7803f8f6bc17b2f8e2a2105a4ccc5b Mon Sep 17 00:00:00 2001 From: Bill Ticehurst Date: Tue, 11 Oct 2016 18:08:54 -0700 Subject: [PATCH 3/3] Reverted test change --- src/compiler/checker.ts | 2 +- .../reference/bluebirdStaticThis.errors.txt | 188 +----------------- 2 files changed, 2 insertions(+), 188 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 273b5e06134..a1a8ae0da5c 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -17893,7 +17893,7 @@ namespace ts { } function isNotOverload(declaration: Declaration): boolean { - return (declaration.kind !== SyntaxKind.FunctionDeclaration && declaration.kind !== SyntaxKind.MethodDeclaration) || + return (declaration.kind !== SyntaxKind.FunctionDeclaration && declaration.kind !== SyntaxKind.MethodDeclaration) || !!(declaration as FunctionDeclaration).body; } } diff --git a/tests/baselines/reference/bluebirdStaticThis.errors.txt b/tests/baselines/reference/bluebirdStaticThis.errors.txt index a20c7ace880..1c22a12c341 100644 --- a/tests/baselines/reference/bluebirdStaticThis.errors.txt +++ b/tests/baselines/reference/bluebirdStaticThis.errors.txt @@ -1,75 +1,13 @@ tests/cases/compiler/bluebirdStaticThis.ts(5,15): error TS2420: Class 'Promise' incorrectly implements interface 'Thenable'. Property 'then' is missing in type 'Promise'. -tests/cases/compiler/bluebirdStaticThis.ts(7,12): error TS2323: Cannot redeclare exported variable 'try'. -tests/cases/compiler/bluebirdStaticThis.ts(8,12): error TS2323: Cannot redeclare exported variable 'try'. -tests/cases/compiler/bluebirdStaticThis.ts(10,12): error TS2323: Cannot redeclare exported variable 'attempt'. -tests/cases/compiler/bluebirdStaticThis.ts(11,12): error TS2323: Cannot redeclare exported variable 'attempt'. -tests/cases/compiler/bluebirdStaticThis.ts(15,12): error TS2323: Cannot redeclare exported variable 'resolve'. -tests/cases/compiler/bluebirdStaticThis.ts(16,12): error TS2323: Cannot redeclare exported variable 'resolve'. -tests/cases/compiler/bluebirdStaticThis.ts(17,12): error TS2323: Cannot redeclare exported variable 'resolve'. -tests/cases/compiler/bluebirdStaticThis.ts(19,12): error TS2323: Cannot redeclare exported variable 'reject'. -tests/cases/compiler/bluebirdStaticThis.ts(20,12): error TS2323: Cannot redeclare exported variable 'reject'. tests/cases/compiler/bluebirdStaticThis.ts(22,51): error TS2694: Namespace 'Promise' has no exported member 'Resolver'. -tests/cases/compiler/bluebirdStaticThis.ts(24,12): error TS2323: Cannot redeclare exported variable 'cast'. -tests/cases/compiler/bluebirdStaticThis.ts(25,12): error TS2323: Cannot redeclare exported variable 'cast'. -tests/cases/compiler/bluebirdStaticThis.ts(33,12): error TS2323: Cannot redeclare exported variable 'delay'. -tests/cases/compiler/bluebirdStaticThis.ts(34,12): error TS2323: Cannot redeclare exported variable 'delay'. -tests/cases/compiler/bluebirdStaticThis.ts(35,12): error TS2323: Cannot redeclare exported variable 'delay'. -tests/cases/compiler/bluebirdStaticThis.ts(49,12): error TS2323: Cannot redeclare exported variable 'all'. -tests/cases/compiler/bluebirdStaticThis.ts(50,12): error TS2323: Cannot redeclare exported variable 'all'. -tests/cases/compiler/bluebirdStaticThis.ts(51,12): error TS2323: Cannot redeclare exported variable 'all'. -tests/cases/compiler/bluebirdStaticThis.ts(52,12): error TS2323: Cannot redeclare exported variable 'all'. -tests/cases/compiler/bluebirdStaticThis.ts(54,12): error TS2323: Cannot redeclare exported variable 'props'. -tests/cases/compiler/bluebirdStaticThis.ts(55,12): error TS2323: Cannot redeclare exported variable 'props'. -tests/cases/compiler/bluebirdStaticThis.ts(57,12): error TS2323: Cannot redeclare exported variable 'settle'. tests/cases/compiler/bluebirdStaticThis.ts(57,109): error TS2694: Namespace 'Promise' has no exported member 'Inspection'. -tests/cases/compiler/bluebirdStaticThis.ts(58,12): error TS2323: Cannot redeclare exported variable 'settle'. tests/cases/compiler/bluebirdStaticThis.ts(58,91): error TS2694: Namespace 'Promise' has no exported member 'Inspection'. -tests/cases/compiler/bluebirdStaticThis.ts(59,12): error TS2323: Cannot redeclare exported variable 'settle'. tests/cases/compiler/bluebirdStaticThis.ts(59,91): error TS2694: Namespace 'Promise' has no exported member 'Inspection'. -tests/cases/compiler/bluebirdStaticThis.ts(60,12): error TS2323: Cannot redeclare exported variable 'settle'. tests/cases/compiler/bluebirdStaticThis.ts(60,73): error TS2694: Namespace 'Promise' has no exported member 'Inspection'. -tests/cases/compiler/bluebirdStaticThis.ts(62,12): error TS2323: Cannot redeclare exported variable 'any'. -tests/cases/compiler/bluebirdStaticThis.ts(63,12): error TS2323: Cannot redeclare exported variable 'any'. -tests/cases/compiler/bluebirdStaticThis.ts(64,12): error TS2323: Cannot redeclare exported variable 'any'. -tests/cases/compiler/bluebirdStaticThis.ts(65,12): error TS2323: Cannot redeclare exported variable 'any'. -tests/cases/compiler/bluebirdStaticThis.ts(67,12): error TS2323: Cannot redeclare exported variable 'race'. -tests/cases/compiler/bluebirdStaticThis.ts(68,12): error TS2323: Cannot redeclare exported variable 'race'. -tests/cases/compiler/bluebirdStaticThis.ts(69,12): error TS2323: Cannot redeclare exported variable 'race'. -tests/cases/compiler/bluebirdStaticThis.ts(70,12): error TS2323: Cannot redeclare exported variable 'race'. -tests/cases/compiler/bluebirdStaticThis.ts(72,12): error TS2323: Cannot redeclare exported variable 'some'. -tests/cases/compiler/bluebirdStaticThis.ts(73,12): error TS2323: Cannot redeclare exported variable 'some'. -tests/cases/compiler/bluebirdStaticThis.ts(74,12): error TS2323: Cannot redeclare exported variable 'some'. -tests/cases/compiler/bluebirdStaticThis.ts(75,12): error TS2323: Cannot redeclare exported variable 'some'. -tests/cases/compiler/bluebirdStaticThis.ts(77,12): error TS2323: Cannot redeclare exported variable 'join'. -tests/cases/compiler/bluebirdStaticThis.ts(78,12): error TS2323: Cannot redeclare exported variable 'join'. -tests/cases/compiler/bluebirdStaticThis.ts(80,12): error TS2323: Cannot redeclare exported variable 'map'. -tests/cases/compiler/bluebirdStaticThis.ts(81,12): error TS2323: Cannot redeclare exported variable 'map'. -tests/cases/compiler/bluebirdStaticThis.ts(82,12): error TS2323: Cannot redeclare exported variable 'map'. -tests/cases/compiler/bluebirdStaticThis.ts(83,12): error TS2323: Cannot redeclare exported variable 'map'. -tests/cases/compiler/bluebirdStaticThis.ts(84,12): error TS2323: Cannot redeclare exported variable 'map'. -tests/cases/compiler/bluebirdStaticThis.ts(85,12): error TS2323: Cannot redeclare exported variable 'map'. -tests/cases/compiler/bluebirdStaticThis.ts(86,12): error TS2323: Cannot redeclare exported variable 'map'. -tests/cases/compiler/bluebirdStaticThis.ts(87,12): error TS2323: Cannot redeclare exported variable 'map'. -tests/cases/compiler/bluebirdStaticThis.ts(89,12): error TS2323: Cannot redeclare exported variable 'reduce'. -tests/cases/compiler/bluebirdStaticThis.ts(90,12): error TS2323: Cannot redeclare exported variable 'reduce'. -tests/cases/compiler/bluebirdStaticThis.ts(92,12): error TS2323: Cannot redeclare exported variable 'reduce'. -tests/cases/compiler/bluebirdStaticThis.ts(93,12): error TS2323: Cannot redeclare exported variable 'reduce'. -tests/cases/compiler/bluebirdStaticThis.ts(95,12): error TS2323: Cannot redeclare exported variable 'reduce'. -tests/cases/compiler/bluebirdStaticThis.ts(96,12): error TS2323: Cannot redeclare exported variable 'reduce'. -tests/cases/compiler/bluebirdStaticThis.ts(98,12): error TS2323: Cannot redeclare exported variable 'reduce'. -tests/cases/compiler/bluebirdStaticThis.ts(99,12): error TS2323: Cannot redeclare exported variable 'reduce'. -tests/cases/compiler/bluebirdStaticThis.ts(101,12): error TS2323: Cannot redeclare exported variable 'filter'. -tests/cases/compiler/bluebirdStaticThis.ts(102,12): error TS2323: Cannot redeclare exported variable 'filter'. -tests/cases/compiler/bluebirdStaticThis.ts(103,12): error TS2323: Cannot redeclare exported variable 'filter'. -tests/cases/compiler/bluebirdStaticThis.ts(104,12): error TS2323: Cannot redeclare exported variable 'filter'. -tests/cases/compiler/bluebirdStaticThis.ts(105,12): error TS2323: Cannot redeclare exported variable 'filter'. -tests/cases/compiler/bluebirdStaticThis.ts(106,12): error TS2323: Cannot redeclare exported variable 'filter'. -tests/cases/compiler/bluebirdStaticThis.ts(107,12): error TS2323: Cannot redeclare exported variable 'filter'. -tests/cases/compiler/bluebirdStaticThis.ts(108,12): error TS2323: Cannot redeclare exported variable 'filter'. -==== tests/cases/compiler/bluebirdStaticThis.ts (68 errors) ==== +==== tests/cases/compiler/bluebirdStaticThis.ts (6 errors) ==== // This version is reduced from the full d.ts by removing almost all the tests // and all the comments. // Then it adds explicit `this` arguments to the static members. @@ -80,48 +18,26 @@ tests/cases/compiler/bluebirdStaticThis.ts(108,12): error TS2323: Cannot redecla !!! error TS2420: Property 'then' is missing in type 'Promise'. constructor(callback: (resolve: (thenableOrResult: R | Promise.Thenable) => void, reject: (error: any) => void) => void); static try(dit: typeof Promise, fn: () => Promise.Thenable, args?: any[], ctx?: any): Promise; - ~~~ -!!! error TS2323: Cannot redeclare exported variable 'try'. static try(dit: typeof Promise, fn: () => R, args?: any[], ctx?: any): Promise; - ~~~ -!!! error TS2323: Cannot redeclare exported variable 'try'. static attempt(dit: typeof Promise, fn: () => Promise.Thenable, args?: any[], ctx?: any): Promise; - ~~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'attempt'. static attempt(dit: typeof Promise, fn: () => R, args?: any[], ctx?: any): Promise; - ~~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'attempt'. static method(dit: typeof Promise, fn: Function): Function; static resolve(dit: typeof Promise): Promise; - ~~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'resolve'. static resolve(dit: typeof Promise, value: Promise.Thenable): Promise; - ~~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'resolve'. static resolve(dit: typeof Promise, value: R): Promise; - ~~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'resolve'. static reject(dit: typeof Promise, reason: any): Promise; - ~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'reject'. static reject(dit: typeof Promise, reason: any): Promise; - ~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'reject'. static defer(dit: typeof Promise): Promise.Resolver; ~~~~~~~~ !!! error TS2694: Namespace 'Promise' has no exported member 'Resolver'. static cast(dit: typeof Promise, value: Promise.Thenable): Promise; - ~~~~ -!!! error TS2323: Cannot redeclare exported variable 'cast'. static cast(dit: typeof Promise, value: R): Promise; - ~~~~ -!!! error TS2323: Cannot redeclare exported variable 'cast'. static bind(dit: typeof Promise, thisArg: any): Promise; @@ -130,14 +46,8 @@ tests/cases/compiler/bluebirdStaticThis.ts(108,12): error TS2323: Cannot redecla static longStackTraces(dit: typeof Promise): void; static delay(dit: typeof Promise, value: Promise.Thenable, ms: number): Promise; - ~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'delay'. static delay(dit: typeof Promise, value: R, ms: number): Promise; - ~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'delay'. static delay(dit: typeof Promise, ms: number): Promise; - ~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'delay'. static promisify(dit: typeof Promise, nodeFunction: Function, receiver?: any): Function; @@ -152,169 +62,73 @@ tests/cases/compiler/bluebirdStaticThis.ts(108,12): error TS2323: Cannot redecla static onPossiblyUnhandledRejection(dit: typeof Promise, handler: (reason: any) => any): void; static all(dit: typeof Promise, values: Promise.Thenable[]>): Promise; - ~~~ -!!! error TS2323: Cannot redeclare exported variable 'all'. static all(dit: typeof Promise, values: Promise.Thenable): Promise; - ~~~ -!!! error TS2323: Cannot redeclare exported variable 'all'. static all(dit: typeof Promise, values: Promise.Thenable[]): Promise; - ~~~ -!!! error TS2323: Cannot redeclare exported variable 'all'. static all(dit: typeof Promise, values: R[]): Promise; - ~~~ -!!! error TS2323: Cannot redeclare exported variable 'all'. static props(dit: typeof Promise, object: Promise): Promise; - ~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'props'. static props(dit: typeof Promise, object: Object): Promise; - ~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'props'. static settle(dit: typeof Promise, values: Promise.Thenable[]>): Promise[]>; - ~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'settle'. ~~~~~~~~~~ !!! error TS2694: Namespace 'Promise' has no exported member 'Inspection'. static settle(dit: typeof Promise, values: Promise.Thenable): Promise[]>; - ~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'settle'. ~~~~~~~~~~ !!! error TS2694: Namespace 'Promise' has no exported member 'Inspection'. static settle(dit: typeof Promise, values: Promise.Thenable[]): Promise[]>; - ~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'settle'. ~~~~~~~~~~ !!! error TS2694: Namespace 'Promise' has no exported member 'Inspection'. static settle(dit: typeof Promise, values: R[]): Promise[]>; - ~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'settle'. ~~~~~~~~~~ !!! error TS2694: Namespace 'Promise' has no exported member 'Inspection'. static any(dit: typeof Promise, values: Promise.Thenable[]>): Promise; - ~~~ -!!! error TS2323: Cannot redeclare exported variable 'any'. static any(dit: typeof Promise, values: Promise.Thenable): Promise; - ~~~ -!!! error TS2323: Cannot redeclare exported variable 'any'. static any(dit: typeof Promise, values: Promise.Thenable[]): Promise; - ~~~ -!!! error TS2323: Cannot redeclare exported variable 'any'. static any(dit: typeof Promise, values: R[]): Promise; - ~~~ -!!! error TS2323: Cannot redeclare exported variable 'any'. static race(dit: typeof Promise, values: Promise.Thenable[]>): Promise; - ~~~~ -!!! error TS2323: Cannot redeclare exported variable 'race'. static race(dit: typeof Promise, values: Promise.Thenable): Promise; - ~~~~ -!!! error TS2323: Cannot redeclare exported variable 'race'. static race(dit: typeof Promise, values: Promise.Thenable[]): Promise; - ~~~~ -!!! error TS2323: Cannot redeclare exported variable 'race'. static race(dit: typeof Promise, values: R[]): Promise; - ~~~~ -!!! error TS2323: Cannot redeclare exported variable 'race'. static some(dit: typeof Promise, values: Promise.Thenable[]>, count: number): Promise; - ~~~~ -!!! error TS2323: Cannot redeclare exported variable 'some'. static some(dit: typeof Promise, values: Promise.Thenable, count: number): Promise; - ~~~~ -!!! error TS2323: Cannot redeclare exported variable 'some'. static some(dit: typeof Promise, values: Promise.Thenable[], count: number): Promise; - ~~~~ -!!! error TS2323: Cannot redeclare exported variable 'some'. static some(dit: typeof Promise, values: R[], count: number): Promise; - ~~~~ -!!! error TS2323: Cannot redeclare exported variable 'some'. static join(dit: typeof Promise, ...values: Promise.Thenable[]): Promise; - ~~~~ -!!! error TS2323: Cannot redeclare exported variable 'join'. static join(dit: typeof Promise, ...values: R[]): Promise; - ~~~~ -!!! error TS2323: Cannot redeclare exported variable 'join'. static map(dit: typeof Promise, values: Promise.Thenable[]>, mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; - ~~~ -!!! error TS2323: Cannot redeclare exported variable 'map'. static map(dit: typeof Promise, values: Promise.Thenable[]>, mapper: (item: R, index: number, arrayLength: number) => U): Promise; - ~~~ -!!! error TS2323: Cannot redeclare exported variable 'map'. static map(dit: typeof Promise, values: Promise.Thenable, mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; - ~~~ -!!! error TS2323: Cannot redeclare exported variable 'map'. static map(dit: typeof Promise, values: Promise.Thenable, mapper: (item: R, index: number, arrayLength: number) => U): Promise; - ~~~ -!!! error TS2323: Cannot redeclare exported variable 'map'. static map(dit: typeof Promise, values: Promise.Thenable[], mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; - ~~~ -!!! error TS2323: Cannot redeclare exported variable 'map'. static map(dit: typeof Promise, values: Promise.Thenable[], mapper: (item: R, index: number, arrayLength: number) => U): Promise; - ~~~ -!!! error TS2323: Cannot redeclare exported variable 'map'. static map(dit: typeof Promise, values: R[], mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; - ~~~ -!!! error TS2323: Cannot redeclare exported variable 'map'. static map(dit: typeof Promise, values: R[], mapper: (item: R, index: number, arrayLength: number) => U): Promise; - ~~~ -!!! error TS2323: Cannot redeclare exported variable 'map'. static reduce(dit: typeof Promise, values: Promise.Thenable[]>, reducer: (total: U, current: R, index: number, arrayLength: number) => Promise.Thenable, initialValue?: U): Promise; - ~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'reduce'. static reduce(dit: typeof Promise, values: Promise.Thenable[]>, reducer: (total: U, current: R, index: number, arrayLength: number) => U, initialValue?: U): Promise; - ~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'reduce'. static reduce(dit: typeof Promise, values: Promise.Thenable, reducer: (total: U, current: R, index: number, arrayLength: number) => Promise.Thenable, initialValue?: U): Promise; - ~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'reduce'. static reduce(dit: typeof Promise, values: Promise.Thenable, reducer: (total: U, current: R, index: number, arrayLength: number) => U, initialValue?: U): Promise; - ~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'reduce'. static reduce(dit: typeof Promise, values: Promise.Thenable[], reducer: (total: U, current: R, index: number, arrayLength: number) => Promise.Thenable, initialValue?: U): Promise; - ~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'reduce'. static reduce(dit: typeof Promise, values: Promise.Thenable[], reducer: (total: U, current: R, index: number, arrayLength: number) => U, initialValue?: U): Promise; - ~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'reduce'. static reduce(dit: typeof Promise, values: R[], reducer: (total: U, current: R, index: number, arrayLength: number) => Promise.Thenable, initialValue?: U): Promise; - ~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'reduce'. static reduce(dit: typeof Promise, values: R[], reducer: (total: U, current: R, index: number, arrayLength: number) => U, initialValue?: U): Promise; - ~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'reduce'. static filter(dit: typeof Promise, values: Promise.Thenable[]>, filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; - ~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'filter'. static filter(dit: typeof Promise, values: Promise.Thenable[]>, filterer: (item: R, index: number, arrayLength: number) => boolean): Promise; - ~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'filter'. static filter(dit: typeof Promise, values: Promise.Thenable, filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; - ~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'filter'. static filter(dit: typeof Promise, values: Promise.Thenable, filterer: (item: R, index: number, arrayLength: number) => boolean): Promise; - ~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'filter'. static filter(dit: typeof Promise, values: Promise.Thenable[], filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; - ~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'filter'. static filter(dit: typeof Promise, values: Promise.Thenable[], filterer: (item: R, index: number, arrayLength: number) => boolean): Promise; - ~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'filter'. static filter(dit: typeof Promise, values: R[], filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; - ~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'filter'. static filter(dit: typeof Promise, values: R[], filterer: (item: R, index: number, arrayLength: number) => boolean): Promise; - ~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'filter'. } declare module Promise {