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 749125 - vala_semantic_analyzer_get_actual_type: assertion failed: (instance_type != null)
vala_semantic_analyzer_get_actual_type: assertion failed: (instance_type != n...
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Semantic Analyzer
0.24.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2015-05-08 15:49 UTC by weberc2
Modified: 2018-02-25 14:52 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description weberc2 2015-05-08 15:49:38 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
Comment 1 Michael 'Mickey' Lauer 2018-02-25 14:52:27 UTC
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.