mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 01:04:49 -05:00
use Value meaning as a filter when resolving names to prevent skipping other value in favor of block-scoped variables
This commit is contained in:
28
tests/baselines/reference/letConstMatchingParameterNames.js
Normal file
28
tests/baselines/reference/letConstMatchingParameterNames.js
Normal file
@@ -0,0 +1,28 @@
|
||||
//// [letConstMatchingParameterNames.ts]
|
||||
let parent = true;
|
||||
const parent2 = true;
|
||||
declare function use(a: any);
|
||||
|
||||
function a() {
|
||||
|
||||
let parent = 1;
|
||||
const parent2 = 2;
|
||||
|
||||
function b(parent: string, parent2: number) {
|
||||
use(parent);
|
||||
use(parent2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// [letConstMatchingParameterNames.js]
|
||||
var parent = true;
|
||||
var parent2 = true;
|
||||
function a() {
|
||||
var _parent = 1;
|
||||
var _parent2 = 2;
|
||||
function b(parent, parent2) {
|
||||
use(parent);
|
||||
use(parent2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
=== tests/cases/compiler/letConstMatchingParameterNames.ts ===
|
||||
let parent = true;
|
||||
>parent : boolean
|
||||
|
||||
const parent2 = true;
|
||||
>parent2 : boolean
|
||||
|
||||
declare function use(a: any);
|
||||
>use : (a: any) => any
|
||||
>a : any
|
||||
|
||||
function a() {
|
||||
>a : () => void
|
||||
|
||||
let parent = 1;
|
||||
>parent : number
|
||||
|
||||
const parent2 = 2;
|
||||
>parent2 : number
|
||||
|
||||
function b(parent: string, parent2: number) {
|
||||
>b : (parent: string, parent2: number) => void
|
||||
>parent : string
|
||||
>parent2 : number
|
||||
|
||||
use(parent);
|
||||
>use(parent) : any
|
||||
>use : (a: any) => any
|
||||
>parent : string
|
||||
|
||||
use(parent2);
|
||||
>use(parent2) : any
|
||||
>use : (a: any) => any
|
||||
>parent2 : number
|
||||
}
|
||||
}
|
||||
|
||||
15
tests/cases/compiler/letConstMatchingParameterNames.ts
Normal file
15
tests/cases/compiler/letConstMatchingParameterNames.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
// @target: es5
|
||||
let parent = true;
|
||||
const parent2 = true;
|
||||
declare function use(a: any);
|
||||
|
||||
function a() {
|
||||
|
||||
let parent = 1;
|
||||
const parent2 = 2;
|
||||
|
||||
function b(parent: string, parent2: number) {
|
||||
use(parent);
|
||||
use(parent2);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user