From fe015ef30fde86ffa4c3eeb89ffe699b5d1eec52 Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Wed, 16 Aug 2017 16:35:53 -0700 Subject: [PATCH] Document failure to handle type parameter shadowing --- src/harness/unittests/extractMethods.ts | 9 +++++ .../extractMethod/extractMethod14.ts | 39 +++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 tests/baselines/reference/extractMethod/extractMethod14.ts diff --git a/src/harness/unittests/extractMethods.ts b/src/harness/unittests/extractMethods.ts index 36f739113ab..a7cc73b5b51 100644 --- a/src/harness/unittests/extractMethods.ts +++ b/src/harness/unittests/extractMethods.ts @@ -565,6 +565,15 @@ namespace A { } } } +}`); + // This test is descriptive, rather than normative. The current implementation + // doesn't handle type parameter shadowing. + testExtractMethod("extractMethod14", + `function F(t1: T) { + function F(t2: T) { + [#|t1.toString(); + t2.toString();|] + } }`); }); diff --git a/tests/baselines/reference/extractMethod/extractMethod14.ts b/tests/baselines/reference/extractMethod/extractMethod14.ts new file mode 100644 index 00000000000..38e4c380ebc --- /dev/null +++ b/tests/baselines/reference/extractMethod/extractMethod14.ts @@ -0,0 +1,39 @@ +// ==ORIGINAL== +function F(t1: T) { + function F(t2: T) { + t1.toString(); + t2.toString(); + } +} +// ==SCOPE::function 'F'== +function F(t1: T) { + function F(t2: T) { + newFunction(); + + function newFunction() { + t1.toString(); + t2.toString(); + } + } +} +// ==SCOPE::function 'F'== +function F(t1: T) { + function F(t2: T) { + newFunction(t2); + } + + function newFunction(t2: T) { + t1.toString(); + t2.toString(); + } +} +// ==SCOPE::global scope== +function F(t1: T) { + function F(t2: T) { + newFunction(t1, t2); + } +} +function newFunction(t1: T, t2: T) { + t1.toString(); + t2.toString(); +}