WebKit2 library define a None enum != 0 and fail to compile
hugopl opened this issue · 0 comments
hugopl commented
Generating bindings for WebKit2 module you get this error when trying to require the module:
In lib/gi-crystal/src/auto/web_kit2-5.0/web_kit2.cr:503:5
503 | None = 2
^---
Error: flags enum can't redefine None member to non-0
Crystal language doesn't allow a flag to define None as non-zero, but WebKit2 define this:
# Flags
@[Flags]
enum EditorTypingAttributes : UInt32
None = 2
Bold = 4
Italic = 8
Underline = 16
Strikethrough = 32
# Returns the type id (GType) registered in GLib type system.
def self.g_type : UInt64
LibWebKit2.webkit_editor_typing_attributes_get_type
end
end
So, some sort of translation must be done when instances of this type crosses Crystal-C boundary. However what if the C enum is like this:
enum Foo {
None = 4,
Troll = 0
};