mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Exclude the overlap between Type and Value when checking for parameter visibility (#27444)
This commit is contained in:
@@ -1238,7 +1238,7 @@ namespace ts {
|
||||
// local types not visible outside the function body
|
||||
: false;
|
||||
}
|
||||
if (meaning & SymbolFlags.Value && result.flags & SymbolFlags.FunctionScopedVariable) {
|
||||
if (meaning & result.flags & SymbolFlags.FunctionScopedVariable) {
|
||||
// parameters are visible only inside function body, parameter list and return type
|
||||
// technically for parameter list case here we might mix parameters and variables declared in function,
|
||||
// however it is detected separately when checking initializers of parameters
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
//// [typeParameterDoesntBlockParameterLookup.ts]
|
||||
declare function f<Foo extends Bar, Bar>(Bar: any): void
|
||||
|
||||
//// [typeParameterDoesntBlockParameterLookup.js]
|
||||
@@ -0,0 +1,8 @@
|
||||
=== tests/cases/compiler/typeParameterDoesntBlockParameterLookup.ts ===
|
||||
declare function f<Foo extends Bar, Bar>(Bar: any): void
|
||||
>f : Symbol(f, Decl(typeParameterDoesntBlockParameterLookup.ts, 0, 0))
|
||||
>Foo : Symbol(Foo, Decl(typeParameterDoesntBlockParameterLookup.ts, 0, 19))
|
||||
>Bar : Symbol(Bar, Decl(typeParameterDoesntBlockParameterLookup.ts, 0, 35), Decl(typeParameterDoesntBlockParameterLookup.ts, 0, 41))
|
||||
>Bar : Symbol(Bar, Decl(typeParameterDoesntBlockParameterLookup.ts, 0, 35), Decl(typeParameterDoesntBlockParameterLookup.ts, 0, 41))
|
||||
>Bar : Symbol(Bar, Decl(typeParameterDoesntBlockParameterLookup.ts, 0, 35), Decl(typeParameterDoesntBlockParameterLookup.ts, 0, 41))
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
=== tests/cases/compiler/typeParameterDoesntBlockParameterLookup.ts ===
|
||||
declare function f<Foo extends Bar, Bar>(Bar: any): void
|
||||
>f : <Foo extends Bar, Bar>(Bar: any) => void
|
||||
>Bar : any
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
declare function f<Foo extends Bar, Bar>(Bar: any): void
|
||||
Reference in New Issue
Block a user