Skip to content
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

dsl: add ExprType.HasMethod() #349

Merged
merged 1 commit into from
Jan 6, 2022
Merged

Commits on Jan 6, 2022

  1. dsl: add ExprType.HasMethod()

    HasMethod reports whether a type has a given method.
    Unlike Implements(), it will work for both value and pointer types.
    
    fn argument is a function signature, like `WriteString(string) (int, error)`.
    It can also be in form of a method reference for importable types: `io.StringWriter.WriteString`.
    
    To avoid confusion with Implements() method, here is a hint when to use which:
    
    	- To check if it's possible to call F on x, use HasMethod(F)
    	- To check if x can be passed as I interface, use Implements(I)
    
    Refs #331
    quasilyte committed Jan 6, 2022
    Configuration menu
    Copy the full SHA
    3a246ab View commit details
    Browse the repository at this point in the history