dlang-community / D-Scanner

Swiss-army knife for D source code
Boost Software License 1.0
240 stars 80 forks source link

switch statement scope is broken #883

Open brianush1 opened 1 year ago

brianush1 commented 1 year ago
import std.stdio;

void main() {
    int x = 5;
    switch (x) {
    case 3:
        int y = x + 2;
        writeln(y);
        break;
    default:
        int y = x + 3;
        writeln(y);
        break;
    }
}

gives Variable "y" has the same name as a variable defined on line 7. on line 11 even though that's perfectly fine

the bug goes away if default: is replaced with another case whatever: