Skip to content

inlining bug with concrete Union constraints #39218

@vtjnash

Description

@vtjnash
julia> struct A end

julia> struct B end

julia> const AB = Union{A, B}
AB (alias for Union{A, B})

julia> f(::T, ::T) where {T<:AB} = false
f (generic function with 1 method)

julia> g(a, b) = (@nospecialize; if a isa AB && b isa AB; f(a, b); end;)
g (generic function with 1 method)

julia> g(A(), A())
false

julia> g(A(), B())
ERROR: fatal error in type inference (type bound)
Stacktrace:
 [1] g(a::Any, b::Any)
   @ Main ./REPL[15]:1
 [2] top-level scope
   @ REPL[17]:1

julia> versioninfo()
Julia Version 1.7.0-DEV.184
Commit 8e0183f2b6 (2020-12-28 17:36 UTC)

Metadata

Metadata

Assignees

Labels

regressionRegression in behavior compared to a previous versiontypes and dispatchTypes, subtyping and method dispatch

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions