Skip to content

Incorrect inference in MTK #43082

Closed
@Keno

Description

Using Julia and MTK master:

using ModelingToolkit
using ModelingToolkit.BipartiteGraphs
graph = ModelingToolkit.BipartiteGraph(0, 0, Val(false))
f() = DiCMOBiGraph{true}(graph)
julia> @code_typed f()
CodeInfo(
1 ─ %1 = Main.graph::Any
│        (DiCMOBiGraph{true, I} where I)(%1)::Union{}
└──      unreachable
) => Union{}

julia> f()
Unreachable reached at 0x7f4edee39050

The inference of the constructor is incorrect. The function returns, causing the subsequent crash. I suspect an intersection issue of some sort as usual, but I will investigate further.

Metadata

Assignees

Labels

bugIndicates an unexpected problem or unintended behaviorcompiler:inferenceType inferencetypes and dispatchTypes, subtyping and method dispatch

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions