Skip to content

julia nightly build throws TypeError in the implementation of Base.methods() #49982

@gafter

Description

@gafter

Testing my code passes my tests on 1.6.2, 1.8, 1.8.2, and 1.9. However, it fails on nightly with an exception.

  TypeError: in typeassert, expected Vector, got a value of type Nothing
  Stacktrace:
    [1] methods(f::Any, t::Any, mod::Nothing)
      @ Base ./reflection.jl:1060
    [2] methods (repeats 2 times)
      @ Base ./reflection.jl:1082 [inlined]
    [3] enumerate_children_names(node_type::Type{Sub})
      @ TreeTransform ~/Repos/TreeTransform.jl/src/TreeTransform.jl:221

versioninfo() reports

Julia Version 1.10.0-DEV.1392
Commit 248ceda3c49 (2023-05-27 13:39 UTC)
Platform Info:
  OS: macOS (arm64-apple-darwin22.4.0)
  CPU: 12 × Apple M2 Max
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, apple-m1)
  Threads: 1 on 8 virtual cores
Environment:
  JULIA_SSL_CA_ROOTS_PATH = 
  JULIA_EDITOR = code

I installed the nightly by downloading the Apple silicon nightly build, mounting it, and dragging the app into my Applications folder.

You can reproduce the failure as follows (my repo is only a couple of hundred lines of code):

git clone https://github.com/RelationalAI/TreeTransform.jl
cd TreeTransform.jl
git checkout julia-nightly-issue
/Applications/Julia-1.10.app/Contents/Resources/julia/bin/julia
] # enter package mode
activate .
instantiate
# exit package mode
include("test/runtests.jl")

This will result, in short order, in

Check some simple cases: Error During Test at /Users/nealgafter/Repos/TreeTransform.jl/test/treetransform.jl:80
  Test threw exception
  Expression: simplify(Sub(x, Neg(y))) == Add(x, y)
  TypeError: in typeassert, expected Vector, got a value of type Nothing
  Stacktrace:
    [1] methods(f::Any, t::Any, mod::Nothing)
      @ Base ./reflection.jl:1060
    [2] methods (repeats 2 times)
      @ Base ./reflection.jl:1082 [inlined]
    [3] enumerate_children_names(node_type::Type{Sub})
      @ TreeTransform ~/Repos/TreeTransform.jl/src/TreeTransform.jl:220
    [4] #s7#16
      @ TreeTransform ~/Repos/TreeTransform.jl/src/TreeTransform.jl:266 [inlined]
    [5] var"#s7#16"(T::Any, ::Any, ctx::Any, node::Any)
      @ TreeTransform ./none:0
    [6] (::Core.GeneratedFunctionStub)(::UInt64, ::LineNumberNode, ::Any, ::Vararg{Any})
      @ Core ./boot.jl:598
    [7] fixed_point(ctx::TreeTransform.RewriteContext, node::Sub, rebuild::Bool)
      @ TreeTransform ~/Repos/TreeTransform.jl/src/TreeTransform.jl:336
    [8] bottom_up_rewrite(xform::Function, data::Sub; detect_cycles::Bool, max_transformations_per_node::Int64, recursive::Bool)
      @ TreeTransform ~/Repos/TreeTransform.jl/src/TreeTransform.jl:152
    [9] bottom_up_rewrite(xform::typeof(xform), data::Sub)
      @ TreeTransform ~/Repos/TreeTransform.jl/src/TreeTransform.jl:137 [inlined]
   [10] simplify(node::Sub)
      @ Main ~/Repos/TreeTransform.jl/test/treetransform.jl:73
   [11] macro expansion
      @ /Applications/Julia-1.10.app/Contents/Resources/julia/share/julia/stdlib/v1.10/Test/src/Test.jl:669 [inlined]
   [12] macro expansion
      @ ~/Repos/TreeTransform.jl/test/treetransform.jl:80 [inlined]
   [13] macro expansion
      @ /Applications/Julia-1.10.app/Contents/Resources/julia/share/julia/stdlib/v1.10/Test/src/Test.jl:1547 [inlined]
   [14] top-level scope
      @ ~/Repos/TreeTransform.jl/test/treetransform.jl:77

Metadata

Metadata

Assignees

No one assigned

    Labels

    error messagesBetter, more actionable error messages

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions