Skip to content

Missing RBI declarations for APIs made by gobject-introspection #2598

@amomchilov

Description

@amomchilov

TL;DR: tapioca dsl misses modules created for GObject interfaces, and maybe other types, too.

Cause

gobject-introspection is a gem brigding to GObject APIs.

For example, GObject interfaces get modelled via Ruby Modules, created here, and set via const_set here. Every such interface will have its const_source_location point to gobject-introspection/lib/gobject-introspection/loader.rb#L618.

When other gems (like gio2) import GObject interfaces, their const_source_location will always point to gobject-introspection/lib/gobject-introspection/loader.rb#L618. Since this location is outside the gem (and in gobject-introspection), Tapioca will skip those module, because it's not defined_in_gem?:

#: (String name, Module[top] constant) -> bool
def skip_module?(name, constant)
return true unless defined_in_gem?(constant, strict: false)
return true if Tapioca::TypeVariableModule === constant
false
end

As a result, the generated gio2.rbi will be missing some interface declaration. It will still include lines that rely on them, leading to type errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions