Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Compiler/test/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3549,8 +3549,14 @@ f31974(n::Int) = f31974(1:n)
# call cycles.
@test code_typed(f31974, Tuple{Int}) !== nothing

f_overly_abstract_complex() = Complex(Ref{Number}(1)[])
@test Base.return_types(f_overly_abstract_complex, Tuple{}) == [Complex]
# Issue #33472
struct WrapperWithUnionall33472{T<:Real}
x::T
end

f_overly_abstract33472() = WrapperWithUnionall33472(Base.inferencebarrier(1)::Number)
# Check that this doesn't infer as `WrapperWithUnionall33472{T<:Number}`.
@test Base.return_types(f_overly_abstract33472, Tuple{}) == [WrapperWithUnionall33472]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it has a decent chance to be inferred as WrapperWithUnionall33472{Int}.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I can write it as inferencebarrier with a type assert, which is the usual pattern. I was mostly just preserving what is already there.


# Issue 26724
const IntRange = AbstractUnitRange{<:Integer}
Expand Down