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 684208 - Wrong error message: "0 missing arguments"
Wrong error message: "0 missing arguments"
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Errors
0.17.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2012-09-17 12:23 UTC by Christophe Fergeau
Modified: 2017-03-22 16:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
vala: Perform arguments-check against actual .end() method-signature (2.21 KB, patch)
2017-03-22 15:44 UTC, Rico Tzschichholz
committed Details | Review

Description Christophe Fergeau 2012-09-17 12:23:58 UTC
If you take the first example program from https://live.gnome.org/Vala/AsyncSamples and replace

    list_dir.begin((obj, res) => {
            list_dir.end(res);
            loop.quit();
        });

with
    list_dir.begin(() => {
            list_dir.end();
            loop.quit();
        });
:


// Example with GIO asynchronous methods:
// Build with: valac --pkg=gio-2.0 example.vala

async void list_dir() {
    var dir = File.new_for_path (Environment.get_home_dir());
    try {
        var e = yield dir.enumerate_children_async(
            FileAttribute.STANDARD_NAME, 0, Priority.DEFAULT, null);
        while (true) {
            var files = yield e.next_files_async(
                 10, Priority.DEFAULT, null);
            if (files == null) {
                break;
            }
            foreach (var info in files) {
                print("%s\n", info.get_name());
            }
        }
    } catch (Error err) {
        warning("Error: %s\n", err.message);
    }
}

void main() {
    var loop = new MainLoop();
    list_dir.begin(() => {
            list_dir.end();
            loop.quit();
        });
    loop.run();
}

The error message you get is "0 missing arguments for `void list_dir ()'" which is not helpful.
Comment 1 Rico Tzschichholz 2017-03-22 15:44:48 UTC
Created attachment 348514 [details] [review]
vala: Perform arguments-check against actual .end() method-signature

This results in error message referring to the actual expected signature.
Comment 2 Rico Tzschichholz 2017-03-22 16:07:20 UTC
Attachment 348514 [details] pushed as ad0530e - vala: Perform arguments-check against actual .end() method-signature