bindgen icon indicating copy to clipboard operation
bindgen copied to clipboard

Some namespaced class hierarchies are not realizable

Open HertzDevil opened this issue 3 years ago • 0 comments

In Crystal every class must be defined after all of its base classes, but #83 now permits certain class hierarchies that cannot be realized by the current Bindgen generators, because they require reopening a namespace:

namespace N {
  struct A { };
}

struct B : N::A { };

namespace N {
  struct C : B { };
}
# `N::A` is not defined here
class B < N::A end

module N
  class A end
  class C < B end
end
module N
  class A end
  # `B` is not defined here
  class C < B end
end

class B < N::A end

This rarely occurs in real code; a full fix might require a complete rewrite of Graph::Container and friends, since they impose similar restrictions on the node visitation order.

HertzDevil avatar Sep 07 '20 11:09 HertzDevil