Document failure to handle type parameter shadowing

This commit is contained in:
Andrew Casey 2017-08-16 16:35:53 -07:00
parent b09d2277b8
commit fe015ef30f
2 changed files with 48 additions and 0 deletions

View File

@ -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<T>(t1: T) {
function F<T>(t2: T) {
[#|t1.toString();
t2.toString();|]
}
}`);
});

View File

@ -0,0 +1,39 @@
// ==ORIGINAL==
function F<T>(t1: T) {
function F<T>(t2: T) {
t1.toString();
t2.toString();
}
}
// ==SCOPE::function 'F'==
function F<T>(t1: T) {
function F<T>(t2: T) {
newFunction();
function newFunction() {
t1.toString();
t2.toString();
}
}
}
// ==SCOPE::function 'F'==
function F<T>(t1: T) {
function F<T>(t2: T) {
newFunction<T>(t2);
}
function newFunction<T>(t2: T) {
t1.toString();
t2.toString();
}
}
// ==SCOPE::global scope==
function F<T>(t1: T) {
function F<T>(t2: T) {
newFunction<T, T>(t1, t2);
}
}
function newFunction<T, T>(t1: T, t2: T) {
t1.toString();
t2.toString();
}