User signals with nilable parameters doesn't work.
Opened this issue · 1 comments
hugopl commented
For the declaration: signal whatever(view : View?)
The generated class_init function is wrong. View | ::Nil.g_type
must be View.g_type
def self._class_init(klass : Pointer(LibGObject::TypeClass), user_data : Pointer(Void)) : Nil
LibGObject.g_signal_new("view_changed", g_type,
GObject::SignalFlags.flags(RunLast, NoRecurse, NoHooks),
0, # class_offset
Pointer(Void).null, # accumulator
Pointer(Void).null, # accumulator_data
Pointer(Void).null, # marshaller
GObject::TYPE_NONE, # return_type
1, # n_params
View | ::Nil.g_type,
Pointer(Void).null)
previous_def
end
hugopl commented
Issue blocked as well due to a compiler bug, when writing a unit test I get:
Module validation failed: GEP base pointer is not a vector or a vector of pointers
%11 = getelementptr inbounds %"(Array(Test::Subject+) | GLib::SList(Test::Subject+) | Tuple(Test::Subject+))", %"(Array(Test::Subject+) | GLib::SList(Test::Subject+) | Tuple(Test::Subject+))" %10, i32 0, i32 0, !dbg !10881
GEP base pointer is not a vector or a vector of pointers
%13 = getelementptr inbounds %"(Array(Test::Subject+) | GLib::SList(Test::Subject+) | Tuple(Test::Subject+))", %"(Array(Test::Subject+) | GLib::SList(Test::Subject+) | Tuple(Test::Subject+))" %10, i32 0, i32 1, !dbg !10881
(Exception)
from crystal in '??'
from crystal in '??'
from crystal in '??'
from crystal in '??'
from crystal in '??'
from crystal in '??'
from crystal in '??'
from crystal in '__crystal_main'
from crystal in 'main'
from /usr/lib/libc.so.6 in '??'
from /usr/lib/libc.so.6 in '__libc_start_main'
from crystal in '_start'
from ???
Error: you've found a bug in the Crystal compiler. Please open an issue, including source code that will allow us to reproduce the bug: https://github.com/crystal-lang/crystal/issues