-
Notifications
You must be signed in to change notification settings - Fork 29
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
false positive error from a type constructor with parameterized vector field #154
Comments
Hi, actually this error is because of the abstract interpretation, not a missing concretization. The analysis report comes from the julia> JET.@lwr struct Foo
x::MyType
end
:($(Expr(:thunk, CodeInfo(
@ none within `top-level scope'
1 ── global Foo
│ const Foo
│ %3 = Core.svec()
│ %4 = Core.svec(:x)
│ #217#Foo = Core._structtype(Main, :Foo, %3, %4, false, 1)
│ Core._setsuper!(#217#Foo, Core.Any)
│ %7 = $(Expr(:isdefined, :Foo))
└─── goto #6 if not %7
2 ── %9 = Foo
│ %10 = Core._equiv_typedef(%9, #217#Foo)
└─── goto #4 if not %10
3 ── #217#Foo = %9
└─── goto #5
4 ── Foo = #217#Foo
5 ┄─ goto #7
6 ── Foo = #217#Foo
7 ┄─ %17 = #217#Foo
│ %18 = Core.svec(MyType)
│ Core._typebody!(%17, %18)
│ global Foo
│ %21 = Core.Any === MyType
└─── goto #9 if not %21
8 ── goto #10
9 ── $(Expr(:method, :Foo))
│ %25 = Core.Typeof(Foo)
│ %26 = Core.svec(%25, MyType)
│ %27 = Core.svec()
│ %28 = Core.svec(%26, %27, $(QuoteNode(:(#= none:2 =#))))
└─── $(Expr(:method, :Foo, :(%28), CodeInfo(
@ none:2 within `none'
1 ─ %1 = %new(Foo, x)
└── return %1
)))
10 ┄ $(Expr(:method, :Foo))
│ %31 = Core.Typeof(Foo)
│ %32 = Core.svec(%31, Core.Any)
│ %33 = Core.svec()
│ %34 = Core.svec(%32, %33, $(QuoteNode(:(#= none:2 =#))))
│ $(Expr(:method, :Foo, :(%34), CodeInfo(
@ none:2 within `none'
1 ─ %1 = Foo
│ %2 = Core.fieldtype(%1, 1)
│ %3 = Base.convert(%2, x)
│ %4 = %new(%1, %3)
└── return %4
)))
└─── return nothing
)))) and the error is reported at That said, this false positive frequently happens when using |
Easy workaround for now is to set I'm considering making this default though. |
I am not sure how to specify the concretization pattern for this code:
I tried using:
report_file("main.jl"; analyze_from_definitions = true, concretization_patterns = [:(MyType = x_)])
but that results in this error:
I am not sure how
LinearAlgebra
has entered the picture. Any advice on what the concretization pattern should be here? I am using JET v0.1.0 and Julia 1.6.0.The text was updated successfully, but these errors were encountered: