Skip to content
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

Internal error: encountered unexpected error in runtime: TypeError... #39082

Closed
thofma opened this issue Jan 3, 2021 · 5 comments · Fixed by #39134
Closed

Internal error: encountered unexpected error in runtime: TypeError... #39082

thofma opened this issue Jan 3, 2021 · 5 comments · Fixed by #39134
Labels
bug Indicates an unexpected problem or unintended behavior compiler:inference Type inference regression Regression in behavior compared to a previous version
Milestone

Comments

@thofma
Copy link
Contributor

thofma commented Jan 3, 2021

Our packages AbstractAlgebra, Hecke, etc. started failing on master. I could reduce the error to the following MWE:

julia> struct Q end

julia> Base.typed_hvcat(a::Q, b, c...) = hvcat(b, c...)

julia> Q()[1//1 0; 0 1//1]
Internal error: encountered unexpected error in runtime:
TypeError(func=:<:, context="", expected=Type, got=T<:(Base.Rational{T} where T<:Integer))
[...]

(full backtrace: https://gist.github.com/thofma/23a37bd230758994871b42686de507ca)

julia> versioninfo()
Julia Version 1.7.0-DEV.205
Commit 5ee2d601ed* (2021-01-01 10:48 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: Intel(R) Core(TM) i5-3320M CPU @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.0 (ORCJIT, ivybridge)

This is working fine on 1.5.1 and on the release1.6 branch, so this is a regression on the master branch.

@simeonschaub
Copy link
Member

Reduced to:

julia> f(x::Vararg{T}) where {T <: Number} = x[1]
f (generic function with 1 method)

julia> code_typed(f, Tuple{Rational, Vararg{Rational}}; optimize=false)
ERROR: TypeError: in <:, expected Type, got a value of type TypeVar
[...]

Seems to have been caused by #38136. @Keno

@simeonschaub simeonschaub added bug Indicates an unexpected problem or unintended behavior compiler:inference Type inference labels Jan 3, 2021
@thofma
Copy link
Contributor Author

thofma commented Jan 3, 2021

Yes, my bisect finished and I can confirm that this is due to #38136.

@JeffBezanson JeffBezanson added the regression Regression in behavior compared to a previous version label Jan 4, 2021
@Sacha0
Copy link
Member

Sacha0 commented Jan 4, 2021

(Crossreferencing the possibly related #38999.)

@JeffBezanson JeffBezanson added this to the 1.7 milestone Jan 5, 2021
@vtjnash
Copy link
Member

vtjnash commented Jan 6, 2021

Hard to say precisely how we should handle this, but it happens when an invalid type tries to get handled as an argument type:

julia> code_typed(getproperty, (Tuple{Int32, Vararg{T}}, Int)) where T
ERROR: TypeError: in <:, expected Type, got a value of type TypeVar

@vtjnash
Copy link
Member

vtjnash commented Jan 6, 2021

MWE. There was a normalization missed in #38136 when constructing argtypes.

julia> f(x, y...) = y[x]

julia> code_typed(f, Tuple{T, Int, Vararg{T}} where T<:Integer)
ERROR: TypeError: in <:, expected Type, got a value of type TypeVar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior compiler:inference Type inference regression Regression in behavior compared to a previous version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants