Skip to content

RequiredInterfaces bricks usage of Revise #20

Description

@briederer

When using the Revise package in combination with the definition of an interface via RequiredInterfaces.@required changes in the source code immediately throws an error.

As an example I used a completely clean julia environment and added only the packages Revise and RequiredInterfaces, followed by loading Revise.

The test module is:

module TestModule

import RequiredInterfaces

abstract type AbstractDummyType end

RequiredInterfaces.@required AbstractDummyType begin
    foo(::AbstractDummyType)
    bar(::AbstractDummyType)
end

struct DummyType <: AbstractDummyType end

foo(::DummyType) = "foo"
bar(::DummyType) = "bar"

end

Calling Revise.includet("path/to/TestModule") throws the error

ERROR: LoadError: ArgumentError: `AbstractDummyType` is already registered as an interface.
Use the `begin` block version to specify multiple methods as part of the interface `AbstractDummyType`.
in expression starting at path/to/TestModule.jl:7
Stacktrace:
 [1] var"@required"(__source__::LineNumberNode, __module__::Module, T::Symbol, expr::Expr)
   @ RequiredInterfaces ...\.julia\packages\RequiredInterfaces\FQnDq\src\RequiredInterfaces.jl:47
 [2] eval
   @ .\boot.jl:430 [inlined]
 [3] process_source!(mod_exprs_sigs::OrderedCollections.OrderedDict{Module, OrderedCollections.OrderedDict{Revise.RelocatableExpr, Union{Nothing, Vector{Any}}}}, ex::Expr, filename::String, mod::Module; mode::Symbol)
   @ Revise ...\.julia\packages\Revise\mLfYT\src\parsing.jl:54
in expression starting at path/to/TestModule.jl:7

Unfortunately this makes development with Revise and RequiredInterfaces practically useless.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions