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

JET errors on interface definitions (as it should) - what to do? #495

Open
gdalle opened this issue Apr 21, 2023 · 0 comments
Open

JET errors on interface definitions (as it should) - what to do? #495

gdalle opened this issue Apr 21, 2023 · 0 comments

Comments

@gdalle
Copy link

gdalle commented Apr 21, 2023

Suppose I define an abstract type with a required method, like this:

"""
    AbstractFoo

Concrete subtypes must implement `bar`.
"""
abstract type AbstractFoo end

"""
    bar(foo::AbstractFoo)
"""
function bar end

openbar(foo::AbstractFoo) = bar(foo)

This is standard practice to document an interface.
Then, when I apply JET error analysis, I get a hit:

using JET

println(report_call(openbar, (AbstractFoo, )))

gives me

═════ 1 possible error found ═════
┌ @ .../jet_interface.jl:16 bar(foo)
│ no matching method found `bar(::AbstractFoo)`: bar(foo::AbstractFoo)
└──────────────────────────────────────────────────

No surprise there, JET is doing its job. So what's the right move if I want to analyse a whole package that contains several such interfaces? Do I just ignore these?
Until JuliaLang/julia#6975 is solved, interfaces won't have a formal definition, and so JET cannot possibly validate the call to openbar(foo).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant