Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User signals with nilable parameters doesn't work. #142

Open
hugopl opened this issue Dec 15, 2023 · 1 comment
Open

User signals with nilable parameters doesn't work. #142

hugopl opened this issue Dec 15, 2023 · 1 comment
Labels
blocked PR resolution blocked by something. bug Something isn't working

Comments

@hugopl
Copy link
Owner

hugopl commented Dec 15, 2023

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 hugopl added the bug Something isn't working label Dec 15, 2023
@hugopl
Copy link
Owner Author

hugopl commented Dec 15, 2023

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

@hugopl hugopl added the blocked PR resolution blocked by something. label Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked PR resolution blocked by something. bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant