@@ -3889,6 +3889,8 @@ static Function *emit_function(jl_lambda_info_t *lam)
3889
3889
size_t captvinfoslen = jl_array_dim0 (captvinfos);
3890
3890
size_t nreq = largslen;
3891
3891
int va = 0 ;
3892
+ if (!lam->specTypes )
3893
+ lam->specTypes = jl_anytuple_type;
3892
3894
if (nreq > 0 && jl_is_rest_arg (jl_cellref (largs,nreq-1 ))) {
3893
3895
nreq--;
3894
3896
va = 1 ;
@@ -3955,7 +3957,7 @@ static Function *emit_function(jl_lambda_info_t *lam)
3955
3957
Function *f = NULL ;
3956
3958
3957
3959
bool specsig = false ;
3958
- if (!va && !hasCapt && lam->specTypes != NULL && lam->inferred ) {
3960
+ if (!va && !hasCapt && lam->specTypes != jl_anytuple_type && lam->inferred ) {
3959
3961
// no captured vars and not vararg
3960
3962
// consider specialized signature
3961
3963
for (size_t i=0 ; i < jl_nparams (lam->specTypes ); i++) {
@@ -4416,37 +4418,30 @@ static Function *emit_function(jl_lambda_info_t *lam)
4416
4418
}
4417
4419
4418
4420
// step 11. check arg count
4419
- if (ctx.linfo ->specTypes == NULL ) {
4421
+ if (jl_is_va_tuple (ctx.linfo ->specTypes )) {
4422
+ std::string msg;
4423
+ Value *enough;
4420
4424
if (va) {
4421
- Value *enough =
4422
- builder.CreateICmpUGE (argCount,
4425
+ msg = " too few arguments " ;
4426
+ enough = builder.CreateICmpUGE (argCount,
4423
4427
ConstantInt::get (T_int32, nreq));
4424
- BasicBlock *elseBB =
4425
- BasicBlock::Create (getGlobalContext (), " else" , f);
4426
- BasicBlock *mergeBB =
4427
- BasicBlock::Create (getGlobalContext (), " ifcont" );
4428
- builder.CreateCondBr (enough, mergeBB, elseBB);
4429
- builder.SetInsertPoint (elseBB);
4430
- just_emit_error (" too few arguments" , &ctx);
4431
- builder.CreateUnreachable ();
4432
- f->getBasicBlockList ().push_back (mergeBB);
4433
- builder.SetInsertPoint (mergeBB);
4434
4428
}
4435
4429
else {
4436
- Value *enough =
4430
+ msg = " wrong number of arguments" ;
4431
+ enough =
4437
4432
builder.CreateICmpEQ (argCount,
4438
4433
ConstantInt::get (T_int32, nreq));
4439
- BasicBlock *elseBB =
4440
- BasicBlock::Create (getGlobalContext (), " else" , f);
4441
- BasicBlock *mergeBB =
4442
- BasicBlock::Create (getGlobalContext (), " ifcont" );
4443
- builder.CreateCondBr (enough, mergeBB, elseBB);
4444
- builder.SetInsertPoint (elseBB);
4445
- just_emit_error (" wrong number of arguments" , &ctx);
4446
- builder.CreateUnreachable ();
4447
- f->getBasicBlockList ().push_back (mergeBB);
4448
- builder.SetInsertPoint (mergeBB);
4449
4434
}
4435
+ BasicBlock *elseBB =
4436
+ BasicBlock::Create (getGlobalContext (), " else" , f);
4437
+ BasicBlock *mergeBB =
4438
+ BasicBlock::Create (getGlobalContext (), " ifcont" );
4439
+ builder.CreateCondBr (enough, mergeBB, elseBB);
4440
+ builder.SetInsertPoint (elseBB);
4441
+ just_emit_error (msg, &ctx);
4442
+ builder.CreateUnreachable ();
4443
+ f->getBasicBlockList ().push_back (mergeBB);
4444
+ builder.SetInsertPoint (mergeBB);
4450
4445
}
4451
4446
4452
4447
// step 12. move args into local variables
0 commit comments