Skip to content

Commit

Permalink
fix #21271, codegen of typeassert involving Tuple{Type{T}}
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Apr 4, 2017
1 parent 1c2386f commit 00f7c6b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/cgutils.cpp
Expand Up @@ -1023,7 +1023,7 @@ static void emit_typecheck(const jl_cgval_t &x, jl_value_t *type, const std::str
// return;
// }
Value *istype = emit_isa(x, type, &msg, ctx);
if (!isa<Constant>(istype)) {
if (!isa<ConstantInt>(istype)) {
BasicBlock *failBB = BasicBlock::Create(jl_LLVMContext, "fail", ctx->f);
BasicBlock *passBB = BasicBlock::Create(jl_LLVMContext, "pass");
builder.CreateCondBr(istype, passBB, failBB);
Expand Down
4 changes: 4 additions & 0 deletions test/core.jl
Expand Up @@ -4792,3 +4792,7 @@ b21178(::F1,::F2) where {B1,B2,F1<:F21178{B1,<:Any},F2<:F21178{B2}} = F1,F2,B1,B
a21172 = f21172(x) = 2x
@test f21172(8) == 16
@test a21172 === f21172

# issue #21271
f21271()::Tuple{Type{Int}, Type{Float64}} = (Int, Float64)
@test_throws TypeError f21271()

0 comments on commit 00f7c6b

Please sign in to comment.