phptools-docs icon indicating copy to clipboard operation
phptools-docs copied to clipboard

Incorrect unreachable code detection

Open tanzanite777 opened this issue 1 year ago • 2 comments

Type: Bug

Noticed that (one of the) latest updates introduced an incorrect unreachable code notification.

Simplified example code:

class Bug {
    final function foo() : void {
        $set = [1,2];
        $first = true;
        $tmp = '';
        foreach($set as $_ignore) {
            if($first) $tmp .= '+'; else $tmp .= '-'; // else part is marked unreachable
            $first = false;
        }
    }
    final function bar() : void {
        $set = [1,2];
        $first = true;
        $tmp = '';
        foreach($set as $_ignore) {
            if($first) { $tmp .= '+'; $first = false; } else $tmp .= '-'; // else part is marked unreachable
        }
    }
}

Extension version: 1.46.15409 VS Code version: Code 1.89.0 (b58957e67ee1e712cebf466b995adf4c5307b2bd, 2024-05-01T02:09:22.859Z) OS version: Windows_NT x64 10.0.19045 Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz (8 x 3600)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) undefined
Memory (System) 15.88GB (7.30GB free)
Process Argv --crash-reporter-id adf79977-8c83-4303-918e-a7dfc5f31bf1
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
tftest:31042121
vscod805cf:30301675
binariesv615:30325510
vsaa593:30376534
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
a9j8j154:30646983
962ge761:30959799
pythongtdpath:30769146
welcomedialog:30910333
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
h48ei257:31000450
pythontbext0:30879054
accentitlementsc:30995553
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
showvideot:31016892
chatpanelc:31018788
dsvsc021:30996838
bdiig495:31013172
fchga941:31046352
pythonprt:31039817
dwnewjupyter:31039675

tanzanite777 avatar May 14 '24 11:05 tanzanite777

Thanks!

jakubmisek avatar May 14 '24 14:05 jakubmisek

fixed in the upcoming update

jakubmisek avatar May 14 '24 15:05 jakubmisek

fixed in 1.46.15428 and newer

thanks!

jakubmisek avatar May 14 '24 16:05 jakubmisek