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

Bug in static_methods #23

Closed
MasonProtter opened this issue Feb 1, 2021 · 8 comments
Closed

Bug in static_methods #23

MasonProtter opened this issue Feb 1, 2021 · 8 comments

Comments

@MasonProtter
Copy link
Contributor

MasonProtter commented Feb 1, 2021

Run on version 1.6 beta 1:

julia> using Tricks

julia> let
           f(x) = x + 1
           f(::Int) = 1
           static_methods(f)
       end
# 2 methods:
[1] (::var"#f#7")(::Int64) in Main at REPL[7]:3
[2] (::var"#f#7")(x) in Main at REPL[7]:2

julia> let
           f(x) = x + 1
           @show (length  collect  static_methods)(f)
           f(::Int) = 1
           static_methods(f)
       end
((length  collect)  static_methods)(f) = 1
# 1 method:
[1] (::var"#f#8")(x) in Main at REPL[8]:2

The related tests are also failing for me locally.

julia> versioninfo()
Julia Version 1.6.0-beta1
Commit b84990e1ac* (2021-01-08 12:42 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: AMD Ryzen 5 2600 Six-Core Processor
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.0 (ORCJIT, znver1)
Environment:
  JULIA_NUM_THREADS = 6


(@v1.6) pkg> st Tricks
Status `~/.julia/environments/v1.6/Project.toml`
  [410a4b4d] Tricks v0.1.3

(@v1.6) pkg> test Tricks
     Testing Tricks
Status `/tmp/jl_JV12np/Project.toml`
  [410a4b4d] Tricks v0.1.3
  [b77e0a4c] InteractiveUtils `@stdlib/InteractiveUtils`
  [8dfed614] Test `@stdlib/Test`
Status `/tmp/jl_JV12np/Manifest.toml`
  [410a4b4d] Tricks v0.1.3
  [2a0f44e3] Base64 `@stdlib/Base64`
  [b77e0a4c] InteractiveUtils `@stdlib/InteractiveUtils`
  [56ddb016] Logging `@stdlib/Logging`
  [d6f4376e] Markdown `@stdlib/Markdown`
  [9a3f8284] Random `@stdlib/Random`
  [9e88b42a] Serialization `@stdlib/Serialization`
  [8dfed614] Test `@stdlib/Test`
     Testing Running tests...
Test Summary:    | Pass  Total
static_hasmethod |   35     35
Test Summary:    | Pass  Total
compat_hasmethod |    1      1
static_methods: Test Failed at /home/mason/.julia/packages/Tricks/Omjx9/test/runtests.jl:89
  Expression: ((length  collect)  static_methods)(f) == 2
   Evaluated: 1 == 2
Stacktrace:
 [1] macro expansion
   @ ~/.julia/packages/Tricks/Omjx9/test/runtests.jl:89 [inlined]
 [2] macro expansion
   @ ~/julia/usr/share/julia/stdlib/v1.6/Test/src/Test.jl:1147 [inlined]
 [3] top-level scope
   @ ~/.julia/packages/Tricks/Omjx9/test/runtests.jl:86
Test Summary:  | Pass  Fail  Total
static_methods |    7     1      8
ERROR: LoadError: Some tests did not pass: 7 passed, 1 failed, 0 errored, 0 broken.
in expression starting at /home/mason/.julia/packages/Tricks/Omjx9/test/runtests.jl:84
ERROR: Package Tricks errored during testing
@oxinabox
Copy link
Owner

oxinabox commented Feb 1, 2021

Does this work on 1.5?

@oxinabox
Copy link
Owner

oxinabox commented Feb 1, 2021

It looks like the back edge is not triggering when f(::Int) = 1 is run.

@MasonProtter
Copy link
Contributor Author

MasonProtter commented Feb 2, 2021

Yep, works on 1.5 for me:

julia> using Tricks

julia> let
           f(x) = x + 1
           f(::Int) = 1
           static_methods(f)
       end
# 2 methods:
[1] (::var"#f#3")(::Int64) in Main at REPL[6]:3
[2] (::var"#f#3")(x) in Main at REPL[6]:2

julia> let
           f(x) = x + 1
           @show (length  collect  static_methods)(f)
           f(::Int) = 1
           static_methods(f)
       end
((length  collect)  static_methods)(f) = 1
# 2 methods:
[1] (::var"#f#4")(::Int64) in Main at REPL[7]:4
[2] (::var"#f#4")(x) in Main at REPL[7]:2

julia> versioninfo()
Julia Version 1.5.3
Commit 788b2c77c1* (2020-11-09 13:37 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: AMD Ryzen 5 2600 Six-Core Processor
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, znver1)
Environment:
  JULIA_NUM_THREADS = 6

(@v1.5) pkg> st
Status `~/.julia/environments/v1.5/Project.toml`
  [410a4b4d] Tricks v0.1.3

(@v1.5) pkg> test Tricks
    Testing Tricks
Status `/tmp/jl_R6VQz9/Project.toml`
  [410a4b4d] Tricks v0.1.3
  [b77e0a4c] InteractiveUtils
  [8dfed614] Test
Status `/tmp/jl_R6VQz9/Manifest.toml`
  [410a4b4d] Tricks v0.1.3
  [2a0f44e3] Base64
  [b77e0a4c] InteractiveUtils
  [56ddb016] Logging
  [d6f4376e] Markdown
  [9a3f8284] Random
  [9e88b42a] Serialization
  [8dfed614] Test
Test Summary:    | Pass  Total
static_hasmethod |   35     35
Test Summary:    | Pass  Total
compat_hasmethod |    1      1
Test Summary:  | Pass  Total
static_methods |    8      8
    Testing Tricks tests passed 

@oxinabox
Copy link
Owner

oxinabox commented Feb 2, 2021

Hmm might have to learn to use git bisect

@MasonProtter
Copy link
Contributor Author

We should probably track this down before 1.6 is released in case it's a real bug in julia. I don't know anything about git bisect, do you have any pointers?

@oxinabox
Copy link
Owner

I also don't know anything about it.
Except that it can be used for finding which commit caused a test to fail

@MasonProtter
Copy link
Contributor Author

Okay, reading the docs it doesn't see, too hard. I'll it now.

@MasonProtter
Copy link
Contributor Author

Nvm, this is fixed now on v1.6.0-rc1.

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

2 participants