Open michal-gora opened 3 days ago
The unsafe lines feature highlight lines that contain unsafe operations, i.e. that may cause type errors at runtime.
Actually, in this example, all lines should be highlighted as safe because untyped local variables can take any value. We just don't have good control flow analysis. We could track the current type of a local variable at all points in a function. For an untyped or Variant
-typed local variable, only uses can be unsafe, not assignments.
Tested versions
Reproducible in 4.3.stable
System information
Linux Ubuntu (KDE plasma)
Issue description
The setting "highlight type safe code" does not work as intended. When turning on the setting (which it is by default) and changing theme colors ("Line Number Color" green and "Safe Line Number Color" blue) to be better visible, this is the result of my example code. This behaviour seems inconsistent. Expected behaviour: Additionally green highlighting in line 9, 10, 14
I was trying to find the original issue/pull request adding this setting feature to find the intended documented behaviour so I am not sure if I might be misunderstanding this bug report, in that case I will close the issue again.
Steps to reproduce
Create following script:
Minimal reproduction project (MRP)
bug-report-type-safe-line-highlighting.zip