Exclude the overlap between Type and Value when checking for parameter visibility (#27444)

This commit is contained in:
Wesley Wigham
2018-10-02 09:41:06 -07:00
committed by GitHub
parent b15d6a48cb
commit 1e55d650f3
5 changed files with 19 additions and 1 deletions
+1 -1
View File
@@ -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