-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Struct #is_a? fails for generic module included in abstract superstruct #10302
Comments
Possibly related to #9660, but this used to work. |
It is not enough that module Mod(T)
end
abstract struct Sup
include Mod(Sup)
end
struct Sub < Sup
end
Sup < Mod(Sup) # => false
{% Sup < Mod(Sup) %} # => false
Sub < Mod(Sup) # => false
{% Sub < Mod(Sup) %} # => false This only happens with abstract structs. |
Downcasts also fail in a manner unrelated to #10214 and not fixed by #10779: module Mod(T)
end
abstract struct Sup
include Mod(Sup)
end
struct Sub < Sup
end
{% p Mod(Sup).includers %} # => [] of ::NoReturn
Sub.new.as(Mod(Sup)).as(Sup)
# Error: can't cast Mod(Sup) to Sup
# 0.36.0 only: can't cast Sub to Mod(Sup) It appears |
In 0.36.0, if you have a struct
Sub
which extends an abstract structSup
, whereSup
includes a generic moduleMod(T)
asMod(Sup)
,Sub#is_a? Mod(Sup)
will evaluate tofalse
, when it was formerlytrue
on 0.35.1.For example:
Notably, this only seems to occur when the abstract superstruct is a part of the generic type of the module when it's included. So,
and
and
but
The text was updated successfully, but these errors were encountered: