# Possible Bug regarding TypeVar?

**URL:** <https://discourse.julialang.org/t/possible-bug-regarding-typevar/23283>\
**Category:** General Usage\
**Created:** [April 18, 2019, 7:07pm UTC](https://discourse.julialang.org/t/possible-bug-regarding-typevar/23283 "2019-04-18T19:07:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Qiyamah](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/qiyamah/32/2660_2.png) [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Post date:** [April 18, 2019, 7:07pm UTC](https://discourse.julialang.org/t/possible-bug-regarding-typevar/23283/1 "2019-04-18T19:07:18Z")

</div>

```julia
julia> struct LL{T}
           x::T
       end

julia> emulate_type(tv::TypeVar) = tv.ub == Any ? Union{tv,LL{tv}} : tv
emulate_type (generic function with 1 method)

julia> emulate_type(TypeVar(:T))
Unreachable reached at 0x118fb3a20

signal (4): Illegal instruction: 4
in expression starting at no file:0
emulate_type at ./REPL[2]:1
jl_fptr_trampoline at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:1831
do_call at /Users/osx/buildbot/slave/package_osx64/build/src/interpreter.c:324
eval_stmt_value at /Users/osx/buildbot/slave/package_osx64/build/src/interpreter.c:363 [inlined]
eval_body at /Users/osx/buildbot/slave/package_osx64/build/src/interpreter.c:682
jl_interpret_toplevel_thunk_callback at /Users/osx/buildbot/slave/package_osx64/build/src/interpreter.c:806
unknown function (ip: 0xfffffffffffffffe)
unknown function (ip: 0x113fae12f)
unknown function (ip: 0x0)
jl_interpret_toplevel_thunk at /Users/osx/buildbot/slave/package_osx64/build/src/interpreter.c:815
jl_toplevel_eval_flex at /Users/osx/buildbot/slave/package_osx64/build/src/toplevel.c:805
jl_toplevel_eval_in at /Users/osx/buildbot/slave/package_osx64/build/src/builtins.c:622
eval at ./boot.jl:319
eval_user_input at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:85
macro expansion at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:117 [inlined]
#28 at ./task.jl:259
jl_apply at /Users/osx/buildbot/slave/package_osx64/build/src/./julia.h:1537 [inlined]
start_task at /Users/osx/buildbot/slave/package_osx64/build/src/task.c:268
Allocations: 1208452 (Pool: 1208096; Big: 356); GC: 1
[1] 22236 illegal hardware instruction julia

```

---

<div class="post-metadata">

**Author:** ![mauro3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mauro3/32/292_2.png) [@mauro3](https://discourse.julialang.org/u/mauro3)\
**Post date:** [April 19, 2019, 6:04am UTC](https://discourse.julialang.org/t/possible-bug-regarding-typevar/23283/2 "2019-04-19T06:04:50Z")

</div>

Maybe you can check whether [fix #31703, type intersection bug with chains of vars in invariant position by JeffBezanson · Pull Request #31747 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/pull/31747) resolved this. Otherwise (or if you can’t check) please file an issue.
