Bug 296709 - incorrect coloring and tooltip of foreach ... as variable
Summary: incorrect coloring and tooltip of foreach ... as variable
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: PHP (show other bugs)
Version: 4.3.0
Platform: Ubuntu Linux
: NOR normal
Target Milestone: 4.3.0
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-24 20:50 UTC by Jakob Lund
Modified: 2013-03-31 01:08 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jakob Lund 2012-03-24 20:50:20 UTC
In this code

  foreach ($new_users as $newuser) {
      $newuser['pass'] = f();
  }

the highlighter seems to miss the fact that the two occurences of $newuser refer to the same varible. The second occurence is rendered in bold, and when the cursor hovers, only the second is highlighted, and the tooltip refers to that line as the source of the variable declaration.

The expected behavoiur would be to highlight both, and refer to the first occurence as the point of definition.
Comment 1 Milian Wolff 2012-03-29 17:36:55 UTC
Git commit 75493103a0b53ddc364b229020ffde216ea7d7cb by Milian Wolff.
Committed on 29/03/2012 at 19:35.
Pushed by mwolff into branch '1.3'.

take range into account when looking for redeclarations

probably we should refactor the handling of foreach
variables, since right now we have to visit the
TypeBuilder::visitStatement before declaring the variables.
this has side-effects since it also means we visit the
foreach-body statements before declaring the variables...

M  +2    -1    duchain/builders/declarationbuilder.cpp
M  +43   -0    duchain/tests/duchain.cpp
M  +1    -0    duchain/tests/duchain.h

http://commits.kde.org/kdev-php/75493103a0b53ddc364b229020ffde216ea7d7cb