Papierkorb / bindgen

Binding and wrapper generator for C/C++ libraries
GNU General Public License v3.0
179 stars 18 forks source link

Some namespaced class hierarchies are not realizable #89

Open HertzDevil opened 4 years ago

HertzDevil commented 4 years ago

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.