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

Old method incorrectly called after redefining it #25252

Closed
nalimilan opened this issue Dec 22, 2017 · 4 comments
Closed

Old method incorrectly called after redefining it #25252

nalimilan opened this issue Dec 22, 2017 · 4 comments
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@nalimilan
Copy link
Member

nalimilan commented Dec 22, 2017

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.

@StefanKarpinski
Copy link
Sponsor Member

cc @vtjnash

@timholy
Copy link
Sponsor Member

timholy commented Dec 22, 2017

I've seen something like this before too but never tracked down a reproducer. Awesome work, @nalimilan.

@nalimilan
Copy link
Member Author

Yeah, when I started to have serious doubts about the fact that I wasn't just mad, but that something weird was going on, I thought it was probably worth reporting, since it's not that common to be able to reproduce this kind of thing. The fact that I identified the problem is an indication of the hard time I had getting the hashing algorithm to work (and of my lazy trial-and-error approach :-p).

@nalimilan nalimilan added the bug Indicates an unexpected problem or unintended behavior label Jan 24, 2018
@KristofferC
Copy link
Sponsor Member

This doesn't repro anymore and a lot of things have changed since the issue opened. Please reopen if this can be reproduced some other way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

4 participants