Conversation
straight-shoota
left a comment
There was a problem hiding this comment.
Unfortunately, this still isn't working correctly.
With this change, each generic instantiation is treated as a different including type.
For example, for Comparable:
Direct including types
Array(String) Array(Crystal) Array(Log::Metadata::Value) Array(JSON::Any) Array(LLVM::BasicBlock) Array(YAML::Any) Array(Crystal::DWARF::Abbrev::Attribute) Array(Crystal::DWARF::Abbrev) Array(Crystal::DWARF::LineNumbers::Sequence::FileEntry) Array(Crystal::DWARF::LineNumbers::Row) Array(Array(Crystal::DWARF::LineNumbers::Row)) Array({UInt64, UInt64, String}) Array(Pointer(Void)) Array(Int32) Array(IO) Array({Int32, Int32, String::Grapheme::Property}) Array(Time::Location::Zone) Array({Int32, Int32, Int32}) Array({Int32, Int32}) Array({Int32, Int32, UInt8}) Array({Int32, Int32, Unicode::QuickCheckResult}) Array(Compress::Zip::File::Entry) Array(LLVM::ABI::ArgType) Array(LLVM::Value) Array(Spec::Result) Array(Int32 | String) Array(Benchmark::IPS::Entry) Array(Pointer(Bool)) Array(UInt8) Array(Crystal::ELF::SectionHeader) Array(Int32, Exception? -> Nil) Array( -> Nil) Array(PrettyPrint::Group) Array(Array(PrettyPrint::Group)) Array(Time::Location::ZoneTransition) Array(Compress::Zip::Writer::Entry) Array(Log::Builder::Binding) Array(Log::Entry) Array(HTTP::Request -> Nil) Array(Socket::Server) Array(JSON::Builder::ArrayState | JSON::Builder::DocumentEndState | JSON::Builder::DocumentStartState | JSON::Builder::ObjectState | JSON::Builder::StartState)
|
Right. Still |
|
What I do now is def must_include?(type : GenericInstanceType)
return false unless type.unbound?
type = type(type.generic_type)
must_include? type
endwhich I'd say is "correct". One problem with this is
If I modify However, e.g. |
|
That was an unrelated change. #14817 added documentation for |
Oh 🤦 |
|
|
||
| unless ast_node? | ||
| @type.ancestors.each do |ancestor| | ||
| next if ancestor.module? |
There was a problem hiding this comment.
Maybe this is it's own PR, but I noticed that included modules ended up in ancestors in index.json.

Fixes #15053