After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 570128 - Warning for variable which was assigned but not used
Warning for variable which was assigned but not used
Status: RESOLVED OBSOLETE
Product: vala
Classification: Core
Component: general
unspecified
Other All
: Normal minor
: 1.2
Assigned To: Vala maintainers
Vala maintainers
: 664084 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2009-02-01 18:49 UTC by Martin Olsson
Modified: 2018-05-22 13:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
testcase (compare lines 70, 74 and 81 in main.vala ) (10.58 KB, application/x-compressed-tar)
2009-02-01 18:50 UTC, Martin Olsson
  Details
Do not mark variable as used for simple assignments (841 bytes, patch)
2011-06-01 09:42 UTC, Luca Bruno
none Details | Review

Description Martin Olsson 2009-02-01 18:49:52 UTC
Please describe the problem:
In the attached testcase, valac trunk feb 1st warns me about assigning but not using a local variable at line 81, but no such warnings are given for line 70 and 74.


Steps to reproduce:


Actual results:


Expected results:


Does this happen every time?


Other information:
Comment 1 Martin Olsson 2009-02-01 18:50:45 UTC
Created attachment 127717 [details]
testcase (compare lines 70, 74 and 81 in main.vala )
Comment 2 Luca Bruno 2011-05-29 07:03:11 UTC
About element1, it is initialized by the out argument at line 71
About element2, vala could warn about assigned but not used yes.

void main () {
        string foo;
        foo = "foo";
}
Comment 3 Luca Bruno 2011-06-01 09:42:29 UTC
Created attachment 188979 [details] [review]
Do not mark variable as used for simple assignments

Fixes bug 570128.

Things get more complicated for non-simple assignments because they get transformed.
Comment 4 Daniel Espinosa 2017-02-19 03:54:25 UTC
Minor improvements tagged for 1.2 milestone.
Comment 5 Rico Tzschichholz 2018-05-17 06:08:56 UTC
*** Bug 664084 has been marked as a duplicate of this bug. ***
Comment 6 GNOME Infrastructure Team 2018-05-22 13:17:00 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/vala/issues/24.