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
11 | def add(foo : Foo) : Foo
^--
Error: this method must return Nil, which is the return type of the overridden method TestInterface#add(bar : T) forall T, or a subtype of it, not Foo
I also tried with -Dpreview_overload_order which resulted in the same error.
It seems the abstract def checker thinks the overload with the explicit type is overriding the free var overload, instead of treating them separately.
I was able to work around this for now by defining the free var method in the interface as:
defadd(bar : T) : NilforallT
{%@type.raise "abstract `def TestInterface#add(bar : T) : Nil forall T` must be implemented by #{@type}"%}
end
Which works for now 🤷.
The text was updated successfully, but these errors were encountered:
Given the following code:
It fails to compile due to:
11 | def add(foo : Foo) : Foo ^-- Error: this method must return Nil, which is the return type of the overridden method TestInterface#add(bar : T) forall T, or a subtype of it, not Foo
I also tried with
-Dpreview_overload_order
which resulted in the same error.It seems the abstract def checker thinks the overload with the explicit type is overriding the free var overload, instead of treating them separately.
I was able to work around this for now by defining the free var method in the interface as:
Which works for now 🤷.
The text was updated successfully, but these errors were encountered: