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
The following fails because I define bar(::Foo, ::Any), which gives an ambiguity error when I try e.g. bar(::Foo, ::Int) with the default error fallback using the abstract type
using RequiredInterfaces
abstract type MyInterface end@required MyInterface beginbar(::MyInterface, ::Number)
endstruct Foo <:MyInterfaceendbar(::Foo, x) = x
RequiredInterfaces.check_implementations(MyInterface)
# Fails because of ambiguity with the erroring fallback
The text was updated successfully, but these errors were encountered:
Yes, this is a limitation of having to create actual methods to make the fallback work :( It wouldn't be a problem if the typesystem itself were aware of the interface, because then the error would come from having a distinction between an interface & a defined method to throw the NotImplementedError from. It would be the compiler/type checker that throws the error, not a fallback method.
I think it could be made to work in this particular case, at least in terms of having check_implementations report a "success", but you'd still get an ambiguity when actually trying to call this method.
The following fails because I define
bar(::Foo, ::Any)
, which gives an ambiguity error when I try e.g.bar(::Foo, ::Int)
with the default error fallback using the abstract typeThe text was updated successfully, but these errors were encountered: