Skip to content

Old method incorrectly called after redefining it #25252

Closed

Description

I've experienced a weird bug when working on #16401. When debugging the hash(::AbstractArray, ::UInt) method, I repeatedly pasted it in the REPL and called hash(::AbstractArray). It turns out that under some circumstances, the redefinition has no effect: the old method is still used.

I've been able to reproduce the problem with relatively simple steps:

  1. start REPL in the Julia source directory and call import Base: hash, hash_range, TypeRangeStep, RangeStepRegular, hashaa_seed, hashr_seed, hashrle_seed
  2. copy these lines to the REPL after adding a statement like println(1) at the top of the function
  3. call hash([1]) and check that it prints 1
  4. run using Test; include("test/hashing.jl")
  5. copy the lines from step 2 after increasing the value in the println call
  6. call hash([1]) and observe that it still prints 1

If you skip step 4, the call in the last step prints 2 as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions