chakra-core / chakra-core/ChakraCore

var declaration in eval should conflict with outer block-scoped let declaration

Open
#5,070 1 comment 0 reactions 0 assignees View on GitHub
Bug Severity: 3
Dominant language
JavaScript
Stars
9.3k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

The following should be an error and it is an error in v8 and sm

```js
if (true) {
let fo5_l = 123;

if (true) {
// conflict with `let` declaration in outer block scope - should fail.
try { eval("var fo5_l = 456") } catch (e) { print(e); }
}
}
```

We do handle this correctly when outer `let` is at the top scope, but not if it is in an intermediate block scope.

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue by running the provided JavaScript snippet and observe whether eval("var fo5_l = 456") conflicts with the outer block-scoped let. Trace the eval handling and block-scope conflict checks, then verify that the intermediate-block case throws an error while the existing top-scope behavior remains correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, javascript
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.