GNOME Bugzilla – Bug 772204
type parameter arity is not checked for delegates
Last modified: 2016-12-10 12:31:00 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.
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.
Hmm, Looks like something which will cause quite some trouble.
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
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?
@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.
Created attachment 337217 [details] [review] vala: Check delegate type parameter parity
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!
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?
I suppose we could make it a warning for now?
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.
http://paldo.org:8010/builders/vala-staging/builds/120 https://git.gnome.org/browse/vala/log/?h=wip/generics
Created attachment 337234 [details] [review] vapi: Add missing type parameters for delegates
Created attachment 337235 [details] [review] vala: Check delegate type parameter parity
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
*** Bug 775466 has been marked as a duplicate of this bug. ***
Similar to https://bugzilla.gnome.org/show_bug.cgi?id=775466