evision icon indicating copy to clipboard operation
evision copied to clipboard

Expand types in function specs

Open cocoa-xu opened this issue 1 year ago • 0 comments

Classes like cv::Algorithm can have a few subclasses, and in the Evision.Algorithm module, functions that accepts cv:: Algorithm parameters are expecting Evision.Algorithm.t() in their type specs.

Currently, although subclasses will have their own copies of these functions from the parent classes with correct type specs, we can find all derived classes of a class, and expand the type specs to accept them.

For example, say we have class Foo, and class Bar and Buzz are derived from Foo, then we're expecting the following changes:

Before

@spec func(Evision.Foo.t()) :: nil

After

@spec func(Evision.Foo.t() | Evision.Bar.t() | Evision.Buzz.t()) :: nil

This issue is not urgent but definitely can help users, the language server and tools like dialyzer.

cocoa-xu avatar Jun 04 '24 15:06 cocoa-xu