Skip to content

Salsa unreachable code detected is not so smart #6665

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

Closed
egamma opened this issue Jan 27, 2016 · 3 comments
Closed

Salsa unreachable code detected is not so smart #6665

egamma opened this issue Jan 27, 2016 · 3 comments
Assignees
Labels
By Design Deprecated - use "Working as Intended" or "Design Limitation" instead

Comments

@egamma
Copy link
Member

egamma commented Jan 27, 2016

From @alexandrudima on January 27, 2016 10:45

Testing #2218

function xx() {
    if (true) {
        return 5;
    } else {
        return '5';
    }
}

This shows a squiggly on the second return saying 'Unreachable code detected'.

The following or any other const expression does not:

function xx() {
    if (true || true) {
        return 5;
    } else {
        return '5';
    }
}

same with if (!false) or if (!true), etc.

Copied from original issue: microsoft/vscode#2430

@egamma egamma self-assigned this Jan 27, 2016
@egamma
Copy link
Member Author

egamma commented Jan 27, 2016

From @alexandrudima on January 27, 2016 10:46

Also doesn't work with if(1) or if(0) -- it appears to be hard coded for true or false

@RyanCavanaugh RyanCavanaugh added the By Design Deprecated - use "Working as Intended" or "Design Limitation" instead label Jan 27, 2016
@alexdima
Copy link
Member

ok :)

@RyanCavanaugh
Copy link
Member

Sorry, forgot to leave a comment. We intentionally don't compute these complex expressions because it's pretty common to write e.g. if(true || oldCondition) while debugging

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
By Design Deprecated - use "Working as Intended" or "Design Limitation" instead
Projects
None yet
Development

No branches or pull requests

3 participants