Skip to content

Commit

Permalink
fix #35793, assertion failure with union of singletons (#35812)
Browse files Browse the repository at this point in the history
(cherry picked from commit 8f512f3)
  • Loading branch information
JeffBezanson authored and KristofferC committed May 12, 2020
1 parent c94e232 commit 8babf99
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/cgutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ static Type *_julia_struct_to_llvm(jl_codegen_params_t *ctx, jl_value_t *jt, jl_
Type *AlignmentType = IntegerType::get(jl_LLVMContext, 8 * al);
unsigned NumATy = fsz / al;
unsigned remainder = fsz % al;
assert(NumATy > 0);
assert(al == 1 || NumATy > 0);
while (NumATy--)
latypes.push_back(AlignmentType);
while (remainder--)
Expand Down
10 changes: 10 additions & 0 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5961,6 +5961,16 @@ let a33709 = A33709(A33709(nothing))
@test isnothing(a33709.a.a)
end

# issue #35793
struct A35793
x::Union{Nothing, Missing}
end
let x = A35793(nothing), y = A35793(missing)
@test x isa A35793
@test x.x === nothing
@test y.x === missing
end

# issue 31583
a31583 = "a"
f31583() = a31583 === "a"
Expand Down

0 comments on commit 8babf99

Please sign in to comment.