Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(47561): use parameter name from enclosing declaration (#47609)
- Loading branch information
1 parent
d56d621
commit 3206df8
Showing
5 changed files
with
141 additions
and
1 deletion.
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
37 changes: 37 additions & 0 deletions
37
tests/baselines/reference/typeParametersAvailableInNestedScope3.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,37 @@ | ||
//// [typeParametersAvailableInNestedScope3.ts] | ||
function foo<T>(v: T) { | ||
function a<T>(a: T) { return a; } | ||
function b(): T { return v; } | ||
|
||
function c<T>(v: T) { | ||
function a<T>(a: T) { return a; } | ||
function b(): T { return v; } | ||
return { a, b }; | ||
} | ||
|
||
return { a, b, c }; | ||
} | ||
|
||
|
||
//// [typeParametersAvailableInNestedScope3.js] | ||
function foo(v) { | ||
function a(a) { return a; } | ||
function b() { return v; } | ||
function c(v) { | ||
function a(a) { return a; } | ||
function b() { return v; } | ||
return { a: a, b: b }; | ||
} | ||
return { a: a, b: b, c: c }; | ||
} | ||
|
||
|
||
//// [typeParametersAvailableInNestedScope3.d.ts] | ||
declare function foo<T>(v: T): { | ||
a: <T_1>(a: T_1) => T_1; | ||
b: () => T; | ||
c: <T_2>(v: T_2) => { | ||
a: <T_3>(a: T_3) => T_3; | ||
b: () => T_2; | ||
}; | ||
}; |
48 changes: 48 additions & 0 deletions
48
tests/baselines/reference/typeParametersAvailableInNestedScope3.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,48 @@ | ||
=== tests/cases/conformance/types/typeParameters/typeParameterLists/typeParametersAvailableInNestedScope3.ts === | ||
function foo<T>(v: T) { | ||
>foo : Symbol(foo, Decl(typeParametersAvailableInNestedScope3.ts, 0, 0)) | ||
>T : Symbol(T, Decl(typeParametersAvailableInNestedScope3.ts, 0, 13)) | ||
>v : Symbol(v, Decl(typeParametersAvailableInNestedScope3.ts, 0, 16)) | ||
>T : Symbol(T, Decl(typeParametersAvailableInNestedScope3.ts, 0, 13)) | ||
|
||
function a<T>(a: T) { return a; } | ||
>a : Symbol(a, Decl(typeParametersAvailableInNestedScope3.ts, 0, 23)) | ||
>T : Symbol(T, Decl(typeParametersAvailableInNestedScope3.ts, 1, 15)) | ||
>a : Symbol(a, Decl(typeParametersAvailableInNestedScope3.ts, 1, 18)) | ||
>T : Symbol(T, Decl(typeParametersAvailableInNestedScope3.ts, 1, 15)) | ||
>a : Symbol(a, Decl(typeParametersAvailableInNestedScope3.ts, 1, 18)) | ||
|
||
function b(): T { return v; } | ||
>b : Symbol(b, Decl(typeParametersAvailableInNestedScope3.ts, 1, 37)) | ||
>T : Symbol(T, Decl(typeParametersAvailableInNestedScope3.ts, 0, 13)) | ||
>v : Symbol(v, Decl(typeParametersAvailableInNestedScope3.ts, 0, 16)) | ||
|
||
function c<T>(v: T) { | ||
>c : Symbol(c, Decl(typeParametersAvailableInNestedScope3.ts, 2, 33)) | ||
>T : Symbol(T, Decl(typeParametersAvailableInNestedScope3.ts, 4, 15)) | ||
>v : Symbol(v, Decl(typeParametersAvailableInNestedScope3.ts, 4, 18)) | ||
>T : Symbol(T, Decl(typeParametersAvailableInNestedScope3.ts, 4, 15)) | ||
|
||
function a<T>(a: T) { return a; } | ||
>a : Symbol(a, Decl(typeParametersAvailableInNestedScope3.ts, 4, 25)) | ||
>T : Symbol(T, Decl(typeParametersAvailableInNestedScope3.ts, 5, 19)) | ||
>a : Symbol(a, Decl(typeParametersAvailableInNestedScope3.ts, 5, 22)) | ||
>T : Symbol(T, Decl(typeParametersAvailableInNestedScope3.ts, 5, 19)) | ||
>a : Symbol(a, Decl(typeParametersAvailableInNestedScope3.ts, 5, 22)) | ||
|
||
function b(): T { return v; } | ||
>b : Symbol(b, Decl(typeParametersAvailableInNestedScope3.ts, 5, 41)) | ||
>T : Symbol(T, Decl(typeParametersAvailableInNestedScope3.ts, 4, 15)) | ||
>v : Symbol(v, Decl(typeParametersAvailableInNestedScope3.ts, 4, 18)) | ||
|
||
return { a, b }; | ||
>a : Symbol(a, Decl(typeParametersAvailableInNestedScope3.ts, 7, 16)) | ||
>b : Symbol(b, Decl(typeParametersAvailableInNestedScope3.ts, 7, 19)) | ||
} | ||
|
||
return { a, b, c }; | ||
>a : Symbol(a, Decl(typeParametersAvailableInNestedScope3.ts, 10, 12)) | ||
>b : Symbol(b, Decl(typeParametersAvailableInNestedScope3.ts, 10, 15)) | ||
>c : Symbol(c, Decl(typeParametersAvailableInNestedScope3.ts, 10, 18)) | ||
} | ||
|
40 changes: 40 additions & 0 deletions
40
tests/baselines/reference/typeParametersAvailableInNestedScope3.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,40 @@ | ||
=== tests/cases/conformance/types/typeParameters/typeParameterLists/typeParametersAvailableInNestedScope3.ts === | ||
function foo<T>(v: T) { | ||
>foo : <T>(v: T) => { a: <T>(a: T) => T; b: () => T; c: <T>(v: T) => { a: <T>(a: T) => T; b: () => T; }; } | ||
>v : T | ||
|
||
function a<T>(a: T) { return a; } | ||
>a : <T>(a: T) => T | ||
>a : T | ||
>a : T | ||
|
||
function b(): T { return v; } | ||
>b : () => T | ||
>v : T | ||
|
||
function c<T>(v: T) { | ||
>c : <T>(v: T) => { a: <T>(a: T) => T; b: () => T; } | ||
>v : T | ||
|
||
function a<T>(a: T) { return a; } | ||
>a : <T>(a: T) => T | ||
>a : T | ||
>a : T | ||
|
||
function b(): T { return v; } | ||
>b : () => T | ||
>v : T | ||
|
||
return { a, b }; | ||
>{ a, b } : { a: <T>(a: T) => T; b: () => T; } | ||
>a : <T>(a: T) => T | ||
>b : () => T | ||
} | ||
|
||
return { a, b, c }; | ||
>{ a, b, c } : { a: <T>(a: T) => T; b: () => T; c: <T>(v: T) => { a: <T>(a: T) => T; b: () => T; }; } | ||
>a : <T>(a: T) => T | ||
>b : () => T | ||
>c : <T>(v: T) => { a: <T>(a: T) => T; b: () => T; } | ||
} | ||
|
14 changes: 14 additions & 0 deletions
14
...formance/types/typeParameters/typeParameterLists/typeParametersAvailableInNestedScope3.ts
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 @@ | ||
// @declaration: true | ||
|
||
function foo<T>(v: T) { | ||
function a<T>(a: T) { return a; } | ||
function b(): T { return v; } | ||
|
||
function c<T>(v: T) { | ||
function a<T>(a: T) { return a; } | ||
function b(): T { return v; } | ||
return { a, b }; | ||
} | ||
|
||
return { a, b, c }; | ||
} |