GNOME Bugzilla – Bug 749125
vala_semantic_analyzer_get_actual_type: assertion failed: (instance_type != null)
Last modified: 2018-02-25 14:52:27 UTC
It seems valac can't handle templated lambdas. Below is my simplest reproducible example. someone@someone-desktop:~/temp$ cat test.vala public class Hello<T> { public delegate void HelloFunc(T t); public HelloFunc _hello = (t) => {}; } someone@someone-desktop:~/temp$ valac -c test.vala ** ERROR:valasemanticanalyzer.c:5015:vala_semantic_analyzer_get_actual_type: assertion failed: (instance_type != null) Aborted (core dumped) someone@someone-desktop:~/temp$ valac --version Vala 0.24.0
With Vala master, this case is now being recognized: % valac -c bug749125.vala bug749125.vala:2.5-2.34: error: The type-parameter `T' is missing public delegate void HelloFunc(T t); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Compilation failed: 1 error(s), 0 warning(s) Specifying the delegate: public class Hello<T> { public delegate void HelloFunc<T>(T t); public HelloFunc _hello = (t) => {}; } % valac bug749125.vala /tmp/bug749125.vala.c:287:49: warning: expression result unused; should this cast be to 'void'? [-Wunused-value] (self->_hello_target_destroy_notify == NULL) ? NULL : (self->_hello_target_destroy_notify (self->_hello_target), NULL); ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/include/stddef.h:105:17: note: expanded from macro 'NULL' # define NULL ((void*)0) ^ /tmp/bug749125.vala.c:343:10: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'gconstpointer' (aka 'const void *') [-Wint-conversion] _tmp1_ (30, _tmp1__target); ^~ 2 warnings generated. The warnings are subject to bug 639017.