You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an abstract def has a type restriction for a type, that does not exist, the compiler doesn't enforce implementation of that def.
The compiler generally ensures that implementing types implement abstract defs. But apparently, it won't do that if a type restriction on the abstract def doesn't resolve.
In the following code, Boo#foo is supposed to implement the abstract def Foo#foo but the parameter's type restriction is different. The compiler doesn't complain about this mismatch. It would complain if we remove Boo#foo entirely, though.
Introducing a type that the Bar restriction resolves to (e.g. class Foo::Bar; end) makes the compiler realize the abstract def is not implemented correctly: abstract def Foo#foo(bar : Bar) must be implemented by Boo.
When an abstract def has a type restriction for a type, that does not exist, the compiler doesn't enforce implementation of that def.
The compiler generally ensures that implementing types implement abstract defs. But apparently, it won't do that if a type restriction on the abstract def doesn't resolve.
In the following code,
Boo#foo
is supposed to implement the abstract defFoo#foo
but the parameter's type restriction is different. The compiler doesn't complain about this mismatch. It would complain if we removeBoo#foo
entirely, though.Introducing a type that the
Bar
restriction resolves to (e.g.class Foo::Bar; end
) makes the compiler realize the abstract def is not implemented correctly:abstract
def Foo#foo(bar : Bar)must be implemented by Boo
.Related: #1647
This is a generalization of #15357
The text was updated successfully, but these errors were encountered: