Skip to content

Commit

Permalink
Fix style review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Keno committed Apr 25, 2019
1 parent 1886c1e commit cf256fa
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions src/subtype.c
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,8 @@ struct subtype_unionall_env {
static int subtype_unionall_callback(struct subtype_unionall_env *env, int8_t R, jl_stenv_t *s, int param) {
if (R) {
return subtype(env->t, env->ubody, s, param);
} else {
}
else {
return subtype(env->ubody, env->t, s, param);
}
}
Expand Down Expand Up @@ -852,7 +853,8 @@ static int subtype_tuple_varargs(struct subtype_tuple_env *env, jl_stenv_t *e, i
if (jl_is_long(yl)) {
return 0;
}
} else {
}
else {
jl_value_t *xl = jl_tparam1(env->vtx);
if (jl_is_typevar(xl)) {
jl_varbinding_t *xlv = lookup(e, (jl_tvar_t*)xl);
Expand All @@ -874,7 +876,8 @@ static int subtype_tuple_varargs(struct subtype_tuple_env *env, jl_stenv_t *e, i
if (jl_is_long(yl)) {
return jl_unbox_long(yl) + 1 == env->vy;
}
} else {
}
else {
// We can skip the subtype check, but we still
// need to make sure to constrain the length of y
// to 0.
Expand Down Expand Up @@ -923,8 +926,7 @@ static int subtype_tuple_varargs(struct subtype_tuple_env *env, jl_stenv_t *e, i

static int subtype_tuple_tail(struct subtype_tuple_env *env, int8_t R, jl_stenv_t *e, int param)
{
loop:
// while (i <= lx) {
loop: // while (i <= lx) {
if (env->i >= env->lx)
goto done;

Expand All @@ -949,7 +951,8 @@ static int subtype_tuple_tail(struct subtype_tuple_env *env, int8_t R, jl_stenv_
env->vtx = xi;
}
xi = env->vtx;
} else {
}
else {
xi = jl_tparam(env->xd, env->i);
}

Expand All @@ -968,7 +971,8 @@ static int subtype_tuple_tail(struct subtype_tuple_env *env, int8_t R, jl_stenv_
env->vty = yi;
}
yi = env->vty;
} else {
}
else {
yi = jl_tparam(env->yd, env->j);
}
}
Expand Down Expand Up @@ -1015,7 +1019,7 @@ static int subtype_tuple_tail(struct subtype_tuple_env *env, int8_t R, jl_stenv_
env->j++;

goto loop;
// }
// } (from loop:)

done:
// TODO: handle Vararg with explicit integer length parameter
Expand Down Expand Up @@ -1053,10 +1057,12 @@ static int subtype_tuple(jl_datatype_t *xd, jl_datatype_t *yd, jl_stenv_t *e, in
return 0;
else if (env.lx < env.ly) // Unbounded includes N == 0
return 0;
} else if (env.vvy == JL_VARARG_NONE && !check_vararg_length(jl_tparam(env.xd, env.lx-1), env.ly+1-env.lx, e)) {
}
else if (env.vvy == JL_VARARG_NONE && !check_vararg_length(jl_tparam(env.xd, env.lx-1), env.ly+1-env.lx, e)) {
return 0;
}
} else {
}
else {
size_t nx = env.lx;
if (env.vvx == JL_VARARG_INT)
nx += jl_vararg_length(jl_tparam(env.xd, env.lx-1)) - 1;
Expand All @@ -1070,7 +1076,8 @@ static int subtype_tuple(jl_datatype_t *xd, jl_datatype_t *yd, jl_stenv_t *e, in
if (env.vvy == JL_VARARG_NONE || env.vvy == JL_VARARG_INT) {
if (nx != ny)
return 0;
} else {
}
else {
if (ny > nx)
return 0;
}
Expand Down

0 comments on commit cf256fa

Please sign in to comment.