Skip to content

Type instability in L"x_{R}"  #75

Closed
@raman-maker

Description

@raman-maker

On using @code_warntype @L_str L"x_{R}" in GLMakie.jl i see type instability atom::Any containing message below:

MethodInstance for var"@L_str"(::LineNumberNode, ::Module, ::String)
from var"@L_str"(source::LineNumberNode, module::Module, s::String) @ LaTeXStrings ~/.julia/packages/LaTeXStrings/6NrIG/src/LaTeXStrings.jl:68
Arguments
#self#::Core.Const(LaTeXStrings.var"@L_str")
source::LineNumberNode
module::Module
s::String
Locals
ex::Expr
buf::IOBuffer
i::Int64
@_8::Int64
val@_9::Char
val@_10::Char
atom::Any
c::Char
Body::Expr
1 ── %1 = LaTeXStrings.firstindex::Core.Const(firstindex)
│ (i = (%1)(s))
│ %3 = LaTeXStrings.ncodeunits::Core.Const(ncodeunits)
│ %4 = (%3)(s)::Int64
│ %5 = (:maxsize,)::Core.Const((:maxsize,))
│ %6 = Core.apply_type(Core.NamedTuple, %5)::Core.Const(NamedTuple{(:maxsize,)})
│ %7 = Core.tuple(%4)::Tuple{Int64}
│ %8 = (%6)(%7)::@NamedTuple{maxsize::Int64}
│ %9 = LaTeXStrings.IOBuffer::Core.Const(IOBuffer)
│ (buf = Core.kwcall(%8, %9))
│ %11 = LaTeXStrings.Expr::Core.Const(Expr)
│ %12 = LaTeXStrings.GlobalRef::Core.Const(GlobalRef)
│ %13 = (%12)(LaTeXStrings.LaTeXStrings, :latexstring)::GlobalRef
└─── (ex = (%11)(:call, %13))
2 ┄─ %15 = LaTeXStrings.:<=::Core.Const(<=)
│ %16 = i::Int64
│ %17 = LaTeXStrings.ncodeunits::Core.Const(ncodeunits)
│ %18 = (%17)(s)::Int64
│ %19 = (%15)(%16, %18)::Bool
└─── goto #17 if not %19
3 ── Core.NewvarNode(:(@_8))
│ Core.NewvarNode(:(val@_9))
│ Core.NewvarNode(:(atom))
│ nothing
│ %25 = i::Int64
│ (val@_10 = Base.getindex(s, %25))
│ nothing
│ %28 = val@_10::Char
│ (c = %28)
│ %30 = LaTeXStrings.nextind::Core.Const(nextind)
│ %31 = i::Int64
│ (i = (%30)(s, %31))
│ %33 = LaTeXStrings.:(===)::Core.Const(===)
│ %34 = c::Char
│ %35 = (%33)(%34, '%')::Bool
└─── goto #15 if not %35
4 ── %37 = LaTeXStrings.:<=::Core.Const(<=)
│ %38 = i::Int64
│ %39 = LaTeXStrings.ncodeunits::Core.Const(ncodeunits)
│ %40 = (%39)(s)::Int64
│ %41 = (%37)(%38, %40)::Bool
└─── goto #15 if not %41
5 ── nothing
│ %44 = i::Int64
│ (val@_9 = Base.getindex(s, %44))
│ nothing
│ %47 = val@_9::Char
│ (c = %47)
│ %49 = LaTeXStrings.:(===)::Core.Const(===)
│ %50 = c::Char
│ %51 = (%49)(%50, '$')::Bool
└─── goto #14 if not %51
6 ── %53 = LaTeXStrings.:>::Core.Const(>)
│ %54 = LaTeXStrings.position::Core.Const(position)
│ %55 = buf::IOBuffer
│ %56 = (%54)(%55)::Int64
│ %57 = (%53)(%56, 0)::Bool
└─── goto #8 if not %57
7 ── %59 = LaTeXStrings.push!::Core.Const(push!)
│ %60 = ex::Expr
│ %61 = Base.getproperty(%60, :args)::Vector{Any}
│ %62 = LaTeXStrings.String::Core.Const(String)
│ %63 = LaTeXStrings.take!::Core.Const(take!)
│ %64 = buf::IOBuffer
│ %65 = (%63)(%64)::Vector{UInt8}
│ %66 = (%62)(%65)::String
│ (%59)(%61, %66)
└─── goto #8
8 ┄─ %69 = LaTeXStrings.nextind::Core.Const(nextind)
│ %70 = i::Int64
│ %71 = (%69)(s, %70)::Int64
│ %72 = LaTeXStrings.string::Core.Const(string)
│ %73 = Base.getproperty(source, :file)::Union{Nothing, Symbol}
│ %74 = (%72)(%73)::String
│ %75 = (:filename,)::Core.Const((:filename,))
│ %76 = Core.apply_type(Core.NamedTuple, %75)::Core.Const(NamedTuple{(:filename,)})
│ %77 = Core.tuple(%74)::Tuple{String}
│ %78 = (%76)(%77)::@NamedTuple{filename::String}
│ %79 = Core.kwcall(%78, LaTeXStrings.parseatom, s, %71)::Tuple{Any, Int64}
│ %80 = Base.indexed_iterate(%79, 1)::Core.PartialStruct(Tuple{Any, Int64}, Any[Any, Core.Const(2)])
│ (atom = Core.getfield(%80, 1))
│ (@_8 = Core.getfield(%80, 2))
│ %83 = @_8::Core.Const(2)
│ %84 = Base.indexed_iterate(%79, 2, %83)::Core.PartialStruct(Tuple{Int64, Int64}, Any[Int64, Core.Const(3)])
│ (i = Core.getfield(%84, 1))
│ %86 = Base.Meta.isexpr::Core.Const(Base.isexpr)
│ %87 = atom::Any
│ %88 = (%86)(%87, :incomplete)::Bool
└─── goto #10 if not %88
9 ── %90 = LaTeXStrings.error::Core.Const(error)
│ %91 = atom::Expr
│ %92 = Base.getproperty(%91, :args)::Vector{Any}
│ %93 = Base.getindex(%92, 1)::Any
│ (%90)(%93)
└─── Core.Const(:(goto %96))
10 ┄ %96 = LaTeXStrings.:!==::Core.Const(!==)
│ %97 = atom::Any
│ %98 = LaTeXStrings.nothing::Core.Const(nothing)
│ %99 = (%96)(%97, %98)::Bool
└─── goto #12 if not %99
11 ─ %101 = LaTeXStrings.push!::Core.Const(push!)
│ %102 = ex::Expr
│ %103 = Base.getproperty(%102, :args)::Vector{Any}
│ %104 = atom::Any
│ (%101)(%103, %104)
└─── goto #12
12 ┄ goto #16
13 ─ Core.Const(:(goto %112))
14 ┄ %109 = LaTeXStrings.print::Core.Const(print)
│ %110 = buf::IOBuffer
│ (%109)(%110, '%')
└─── goto #16
15 ┄ %113 = LaTeXStrings.print::Core.Const(print)
│ %114 = buf::IOBuffer
│ %115 = c::Char
└─── (%113)(%114, %115)
16 ┄ goto #2
17 ─ %118 = LaTeXStrings.:>::Core.Const(>)
│ %119 = LaTeXStrings.position::Core.Const(position)
│ %120 = buf::IOBuffer
│ %121 = (%119)(%120)::Int64
│ %122 = (%118)(%121, 0)::Bool
└─── goto #19 if not %122
18 ─ %124 = LaTeXStrings.push!::Core.Const(push!)
│ %125 = ex::Expr
│ %126 = Base.getproperty(%125, :args)::Vector{Any}
│ %127 = LaTeXStrings.String::Core.Const(String)
│ %128 = LaTeXStrings.take!::Core.Const(take!)
│ %129 = buf::IOBuffer
│ %130 = (%128)(%129)::Vector{UInt8}
│ %131 = (%127)(%130)::String
│ (%124)(%126, %131)
└─── goto #19
19 ┄ %134 = LaTeXStrings.esc::Core.Const(esc)
│ %135 = ex::Expr
│ %136 = (%134)(%135)::Expr
└─── return %136

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions