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 644241 - Default arguments allowed in center of argument list
Default arguments allowed in center of argument list
Status: RESOLVED OBSOLETE
Product: vala
Classification: Core
Component: Methods
0.11.x
Other All
: Low minor
: ---
Assigned To: Vala maintainers
Vala maintainers
accepts-invalid
Depends on:
Blocks: 792660
 
 
Reported: 2011-03-08 21:06 UTC by Jim Nelson
Modified: 2018-05-22 13:57 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Warn if non-default follows default argument (1.16 KB, patch)
2013-04-06 06:56 UTC, Simon Werbeck
none Details | Review
Warn if non-default follows default argument (1.18 KB, patch)
2013-05-27 12:03 UTC, Simon Werbeck
committed Details | Review
vala: Skip default-value positioning check for parameters of coroutines (1.04 KB, patch)
2018-01-18 19:57 UTC, Rico Tzschichholz
committed Details | Review

Description Jim Nelson 2011-03-08 21:06:54 UTC
It's possible to write a method signature that looks like this:

void func(int a, int b = 1, int c)

No warning or error is given by valac.  I've tested with 0.10.3 and trunk.
Comment 1 Simon Werbeck 2013-04-06 06:56:29 UTC
Created attachment 240814 [details] [review]
Warn if non-default follows default argument

Fixes bug 644241
Comment 2 Luca Bruno 2013-04-06 09:50:43 UTC
Looks good except I'm not sure about the message.
Comment 3 Simon Werbeck 2013-05-27 12:03:09 UTC
Created attachment 245379 [details] [review]
Warn if non-default follows default argument

* Made the error message move verbose

Fixes bug 644241
Comment 4 Luca Bruno 2013-05-27 12:29:44 UTC
What about void foo (int a = 2, int b) { ... }
Comment 5 Simon Werbeck 2013-05-27 12:41:31 UTC
Yup just checked now, warns as intended (btw. should this be an error?)
Comment 6 Luca Bruno 2013-05-27 12:58:32 UTC
Review of attachment 245379 [details] [review]:

Ok looks fine for me.
Comment 7 Luca Bruno 2013-08-24 11:00:38 UTC
commit b22255aa25e0296211ea7ca404970d1677747180
Author: Simon Werbeck <simon.werbeck@gmail.com>
Date:   Sat Apr 6 08:51:19 2013 +0200

    Warn if a parameter without default follows a parameter with default value
    
    Fixes bug 644241.

This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.
Comment 8 Luca Bruno 2013-08-26 20:41:57 UTC
Committed a TODO: for coroutines we have to handle this thing separately for begin and end parameters.
Reopening the bug.

commit dd24a1bfe1a78bf1a37d35f5d8dd6480fd4a8941
Author: Luca Bruno <lucabru@src.gnome.org>
Date:   Mon Aug 26 22:36:00 2013 +0200

    Do not warn about non-default parameters for coroutines.
    
    Reopens bug 644241.
Comment 9 Luca Bruno 2013-08-26 20:43:24 UTC
Committed a TODO: for coroutines we have to handle this thing separately for begin and end parameters.
Reopening the bug.

commit dd24a1bfe1a78bf1a37d35f5d8dd6480fd4a8941
Author: Luca Bruno <lucabru@src.gnome.org>
Date:   Mon Aug 26 22:36:00 2013 +0200

    Do not warn about non-default parameters for coroutines.
    
    Reopens bug 644241.
Comment 10 Rico Tzschichholz 2018-01-18 19:57:25 UTC
Created attachment 367040 [details] [review]
vala: Skip default-value positioning check for parameters of coroutines
Comment 11 Rico Tzschichholz 2018-01-18 20:25:33 UTC
Comment on attachment 367040 [details] [review]
vala: Skip default-value positioning check for parameters of coroutines

Attachment 367040 [details] pushed as 70e694d - vala: Skip default-value positioning check for parameters of coroutines
Comment 12 GNOME Infrastructure Team 2018-05-22 13:57:49 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/178.