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 772204 - type parameter arity is not checked for delegates
type parameter arity is not checked for delegates
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Semantic Analyzer
0.32.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2016-09-29 20:54 UTC by Matthias Berndt
Modified: 2016-12-10 12:31 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (1.70 KB, patch)
2016-09-29 22:01 UTC, Matthias Berndt
none Details | Review
check delegate type parameter arity (2.00 KB, patch)
2016-10-07 23:45 UTC, Matthias Berndt
none Details | Review
fix bindings (8.43 KB, patch)
2016-10-08 02:12 UTC, Matthias Berndt
none Details | Review
vala: Check delegate type parameter parity (3.02 KB, patch)
2016-10-08 11:16 UTC, Rico Tzschichholz
none Details | Review
vapi: Add missing type parameters for delegates (13.35 KB, patch)
2016-10-08 15:41 UTC, Rico Tzschichholz
committed Details | Review
vala: Check delegate type parameter parity (2.06 KB, patch)
2016-10-08 15:41 UTC, Rico Tzschichholz
committed Details | Review

Description Matthias Berndt 2016-09-29 20:54:31 UTC
The following code compiles, though it clearly shouldn't:

delegate void f<T>();
void main() {
  f f = null;
}

The compiler should tell me that I didn't specify f's type parameter.
Comment 1 Matthias Berndt 2016-09-29 22:01:55 UTC
Created attachment 336555 [details] [review]
patch

This should fix the issue in the compiler. However it needs some more work since the vapi files shipped with valac aren't compatible yet.
Comment 2 Rico Tzschichholz 2016-10-05 15:23:42 UTC
Hmm, Looks like something which will cause quite some trouble.
Comment 3 Matthias Berndt 2016-10-07 23:45:20 UTC
Created attachment 337201 [details] [review]
check delegate type parameter arity

new version of the patch that makes sure the error message is printed only once
Comment 4 Matthias Berndt 2016-10-08 02:12:42 UTC
Created attachment 337208 [details] [review]
fix bindings

This should help to fix the issues in the bindings.

I wasn't able to check Gdk since I can't build it even without the patch, but all other bindings now compile. I guessed the type parameters for the delegates as best as I could, but I'd very much appreciate a thorough review by somebody who knows the GNOME library stack better than I do.

Note: "make all-bindings" doesn't work because the build system doesn't understand the dependencies between the packages. So you need to run:
cd vapi
make gio-2.0
make gstreamer-1.0
make all-bindings
in that order.

Note: I didn't want to add the modified .vapi files myself  because I have gstreamer 1.8 installed and the gstreamer-1.0.vapi in the repo was generated from gstreamer 1.10. Perhaps the vapi files can be regenerated on some CI system or something?
Comment 5 Rico Tzschichholz 2016-10-08 11:01:56 UTC
@matthias: Please check your codestyle and fix the Makefile error in your patch.

The first thing to do would be to run "make check" (which fails).

At a first glance the binding fixes looking good.
Comment 6 Rico Tzschichholz 2016-10-08 11:16:21 UTC
Created attachment 337217 [details] [review]
vala: Check delegate type parameter parity
Comment 7 Matthias Berndt 2016-10-08 11:22:40 UTC
Hey Rico,

thanks for the review and for the fixes! I was actually fixing it just now when I received the email about the new patch you posted. Ideally next time you'd either ask me to fix it or do it yourself, but not both, so we can use our resources efficiently.

Anyway, thanks for the help!
Comment 8 Rico Tzschichholz 2016-10-08 11:23:55 UTC
http://paldo.org:8010/builders/vala-staging/builds/117/steps/vala_1/logs/stdio

I guess omitting type-parameters might be an option to be allowed?
Comment 9 Matthias Berndt 2016-10-08 11:47:15 UTC
I suppose we could make it a warning for now?
Comment 10 Rico Tzschichholz 2016-10-08 12:48:34 UTC
I looked at vala itself it seemed worse that it was.

If it isn't easily possible to fix libgee and the 3rd party apps we are following then a warning would not hurt so much.
Comment 12 Rico Tzschichholz 2016-10-08 15:41:28 UTC
Created attachment 337234 [details] [review]
vapi: Add missing type parameters for delegates
Comment 13 Rico Tzschichholz 2016-10-08 15:41:43 UTC
Created attachment 337235 [details] [review]
vala: Check delegate type parameter parity
Comment 14 Rico Tzschichholz 2016-10-23 20:51:58 UTC
Comment on attachment 337234 [details] [review]
vapi: Add missing type parameters for delegates

commit 41942694292e63346f9f7bdf7c6b52aa91bead2e
Author: Matthias Berndt <matthias_berndt@gmx.de>
Date:   Fri Oct 7 23:42:29 2016 +0200

    vapi: Add missing type parameters for delegates
Comment 15 Rico Tzschichholz 2016-12-01 13:18:26 UTC
*** Bug 775466 has been marked as a duplicate of this bug. ***
Comment 16 Rico Tzschichholz 2016-12-01 13:23:17 UTC
Similar to https://bugzilla.gnome.org/show_bug.cgi?id=775466