Comments (2)
Hi, actually this error is because of the abstract interpretation, not a missing concretization.
(rather, type aliases are always concretized, and so don't need to specify concretization_patterns
for this case)
The analysis report comes from the analyze_from_definitions
configuration.
struct
definition internally defines its constructor like below:
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 Base.convert(%2::AbstractVector{<:AbstractString}, x::Any)
.
That said, this false positive frequently happens when using analyze_from_definitions=true
, and so I think JET needs to fix this somehow.
from jet.jl.
Easy workaround for now is to set max_methods=1
configuration: report_file("main.jl"; analyze_from_definitions = true, concretization_patterns = [:(MyType = x_)], max_methods=1)
I'm considering making this default though.
from jet.jl.
Related Issues (20)
- false positive: no matching method found HOT 7
- false positives with Base.@kwdef HOT 2
- Define `@test_package` in addition to `report_package`
- Optional analyzer keyword argument gone HOT 2
- JET errors on interface definitions (as it should) - what to do?
- │ ArgumentError: Module JuliaFormatter does not correspond to a loaded package! HOT 2
- JET breaks SnoopCompile
- Add Error Analysis for OptimizationFailureReport
- Add a hook to analyze calls that appear at runtime HOT 1
- False positive for indexing Union{Tuple{},Vector{T}} HOT 2
- Ergonomics: descending into errors HOT 3
- List of Base reports HOT 1
- Line numbers do not Revise HOT 2
- Support JET annotations in source code HOT 4
- False positive: accessing variables from other, possibly undefined modules HOT 1
- Branches that restrict a type HOT 14
- Support "import Module as" syntax HOT 1
- Possible false positive with sort! HOT 4
- Support package extensions HOT 3
- main_uuid not defined HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jet.jl.