Skip to content

cannot detect type mismatch in this caseΒ #750

@kurt-steiner

Description

@kurt-steiner

Problem

I have discuss this problem on the slack, please check at https://julialang.slack.com/archives/C6A044SQH/p1758335604957939

Environment

julia> versioninfo()
Julia Version 1.12.0-rc2
Commit 72cbf019d04 (2025-09-06 12:00 UTC)
Build Info:
  Official https://julialang.org release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 Γ— Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz
  WORD_SIZE: 64
  LLVM: libLLVM-18.1.7 (ORCJIT, skylake)
  GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 8 virtual cores)
Environment:
  JULIA_EDITOR = code
  JULIA_VSCODE_REPL = 1
  JULIA_PKG_SERVER = https://mirrors.pku.edu.cn/julia

(@v1.12) pkg> st JET
Status `~/.julia/environments/v1.12/Project.toml`
  [c3a54625] JET v0.10.7

Reproduce it

full code here

module DataStructure

#= include("linkedlist/LinkedList.jl")

if false
    include("../test/runtests.jl")
end
 =#

mutable struct ListNode{T}
    data::T
    next::Union{Nothing, ListNode{T}}
    prev::Union{Nothing, ListNode{T}}
end

function insert_next!(node::ListNode{T}, next_node::ListNode{T}) where T
    node.next = next_node;
    next_node.prev = node;
end

function remove_next!(node::ListNode{T}) where T
    target_node::Union{Nothing, ListNode{T}} = node.next

    if !isnothing(target_node)
        unlink_node::Union{Nothing, ListNode{T}} = target_node.next
        insert_next!(node, unlink_node)
    end
end

end # module DataStructure

after activate the environment,

julia> import DataStructure
Precompiling DataStructure finished.
  1 dependency successfully precompiled in 1 seconds

julia> using JET

julia> report_package(DataStructure)
[toplevel-info] virtualized the context of Main (took 0.056 sec)
[toplevel-info] entered into /home/steiner/workspace/exploring/DataStructure.jl/src/DataStructure.jl
[toplevel-info]  exited from /home/steiner/workspace/exploring/DataStructure.jl/src/DataStructure.jl (took 0.036 sec)
[toplevel-info] analyzing from top-level definitions (2/2)
[toplevel-info] analyzed 2 top-level definitions (took 12.829 sec)
No errors detected

still looking for a little demo to reproduce it again

πŸ˜‹

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions