Skip to content

depwarn in constructors keeps warning #21972

@andreasnoack

Description

@andreasnoack

The logic for checking the binding is wrong for constructors so

struct TypeA
    function TypeA()
        Base.depwarn("blabla", :TypeA)
        new()
    end
end

julia> TypeA()
WARNING: blabla
Stacktrace:
 [1] depwarn(::String, ::Symbol) at ./deprecated.jl:64
 [2] TypeA() at ./REPL[6]:3
 [3] eval(::Module, ::Any) at ./boot.jl:235
 [4] eval_user_input(::Any, ::Base.REPL.REPLBackend) at ./REPL.jl:66
 [5] macro expansion at ./REPL.jl:97 [inlined]
 [6] (::Base.REPL.##1#2{Base.REPL.REPLBackend})() at ./event.jl:73
while loading no file, in expression starting on line 0
TypeA()

julia> TypeA()
WARNING: blabla
Stacktrace:
 [1] depwarn(::String, ::Symbol) at ./deprecated.jl:64
 [2] TypeA() at ./REPL[6]:3
 [3] eval(::Module, ::Any) at ./boot.jl:235
 [4] eval_user_input(::Any, ::Base.REPL.REPLBackend) at ./REPL.jl:66
 [5] macro expansion at ./REPL.jl:97 [inlined]
 [6] (::Base.REPL.##1#2{Base.REPL.REPLBackend})() at ./event.jl:73
while loading no file, in expression starting on line 0
TypeA()

Metadata

Metadata

Assignees

Labels

bugIndicates an unexpected problem or unintended behaviordeprecationThis change introduces or involves a deprecation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions