Skip to content

Break type stability of Rational with unrelated function (0.5-specific) #18465

Closed

Description

Unitful breaks the type-stability of Rational:

julia> using Unitful
INFO: Recompiling stale cache file /home/tim/.julia/lib/v0.5/Unitful.ji for module Unitful.

julia> @code_warntype Rational(5463, 20)
Variables:
  #self#::Type{Rational}
  n::Int64
  d::Int64

Body:
  begin 
      return $(Expr(:invoke, LambdaInfo for Rational{Int64}(::Int64, ::Int64), Rational{Int64}, :(n), :(d)))
  end::Any

If you comment out this line and this function, then it's back to normal. Indeed, just the signature of the latter function (i.e., defining a blank body) is sufficient to break the type-stability of Rational.

What I find curious is that the latter function does not obviously have anything to do with Rational. Seems to suggest some kind of corruption.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

priorityThis should be addressed urgentlywon't changeIndicates that work won't continue on an issue or pull request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions