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 614986 - Problem with mixing generics and delegates
Problem with mixing generics and delegates
Status: RESOLVED OBSOLETE
Product: vala
Classification: Core
Component: Delegates
0.8.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2010-04-06 17:44 UTC by Tomaz Vajngerl
Modified: 2018-05-22 13:31 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Tomaz Vajngerl 2010-04-06 17:44:07 UTC
Hi,

The following example produces uncompilable code:

public class GenericDelegate<T> : Object {
	public delegate T TestDelegate();
	public TestDelegate test_closure { get; set; }
}

public int main() {

	var test = new GenericDelegate<string> ();
	test.test_closure = () => { return "hi"; };
	print (test.test_closure());

	return 0;
}

valac says:
/home/quikee/Test.vala.c: In function ‘_lambda0_’:
/home/quikee/Test.vala.c:171: warning: assignment makes pointer from integer without a cast
/tmp/cc1AUEeh.o: In function `_lambda0_':
Test.vala.c:(.text+0x654): undefined reference to `t_dup_func'
collect2: ld returned 1 exit status
error: cc exited with status 256
Compilation failed: 1 error(s), 0 warning(s)

Second example is even worse.. it produces an error in valac:

public class GenericDelegate : Object {
	public delegate T TestDelegate<T> ();
	public TestDelegate test_closure { get; set; }
}

public int main() {

	var test = new GenericDelegate();
	test.test_closure = () => { return "hi"; };
	print (test.test_closure());

	return 0;
}

valac says:

# valac Test.vala 
**
ERROR:valasemanticanalyzer.c:2886:vala_semantic_analyzer_get_actual_type: assertion failed: (instance_type != NULL)
Aborted (core dumped)
Comment 1 GNOME Infrastructure Team 2018-05-22 13:31:47 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/82.