Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

💅 correctness/noUnreachable incorrect for try/catch/finally when there is a jump before the finally block #4946

Open
1 task done
dylwil3 opened this issue Jan 23, 2025 · 0 comments
Labels
A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug

Comments

@dylwil3
Copy link

dylwil3 commented Jan 23, 2025

Environment information

See playground link.

Rule name

noUnreachable

Playground link

https://biomejs.dev/playground/?code=ZgB1AG4AYwB0AGkAbwBuACAAZgAoACkAIAB7AAoACQB3AGgAaQBsAGUAIAAoAHQAcgB1AGUAKQAgAHsACgAJAAkAdAByAHkAIAB7AAoACQAJAAkAYgByAGUAYQBrADsACgAJAAkAfQAgAGYAaQBuAGEAbABsAHkAIAB7AAoACQAJAAkAYwBvAG4AcwBvAGwAZQAuAGwAbwBnACgAIgByAGUAYQBjAGgAYQBiAGwAZQAiACkAOwAKAAkACQB9AAoACQAJAGMAbwBuAHMAbwBsAGUALgBsAG8AZwAoACIAdQBuAHIAZQBhAGMAaABhAGIAbABlACIAKQA7AAoACQB9AAoAfQA%3D

Expected result

In the below snippet, both log statements are marked as unreachable, but only the second is. It looks like the control flow analysis is not taking into account that the finally block is resolved before any jumps from the try block?

function f() {
	while (true) {
		try {
			break;
		} finally {
			console.log("reachable");
		}
		console.log("unreachable");
	}
}

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@dylwil3 dylwil3 added the S-Needs triage Status: this issue needs to be triaged label Jan 23, 2025
@dyc3 dyc3 added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug labels Jan 23, 2025
@github-actions github-actions bot removed the S-Needs triage Status: this issue needs to be triaged label Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug
Projects
None yet
Development

No branches or pull requests

2 participants