Skip to content

Commit

Permalink
fix #11278, restore check that field types are Types, lost in #10380
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed May 25, 2015
1 parent e36b460 commit d777bcc
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
6 changes: 6 additions & 0 deletions src/builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -1005,6 +1005,12 @@ JL_CALLABLE(jl_f_union)

// generic function reflection ------------------------------------------------

static void jl_check_type_tuple(jl_value_t *t, jl_sym_t *name, const char *ctx)
{
if (!jl_is_tuple_type(t))
jl_type_error_rt(name->name, ctx, (jl_value_t*)jl_type_type, t);
}

JL_CALLABLE(jl_f_methodexists)
{
JL_NARGS(method_exists, 2, 2);
Expand Down
6 changes: 5 additions & 1 deletion src/interpreter.c
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,11 @@ static jl_value_t *eval(jl_value_t *e, jl_value_t **locals, size_t nl, size_t ng
dt->types = (jl_svec_t*)eval(args[4], locals, nl, ngensym);
gc_wb(dt, dt->types);
inside_typedef = 0;
//jl_check_type_tuple(dt->types, dt->name->name, "type definition");
for(size_t i=0; i < jl_svec_len(dt->types); i++) {
jl_value_t *elt = jl_svecref(dt->types, i);
if (!jl_is_type(elt) && !jl_is_typevar(elt))
jl_type_error_rt(dt->name->name->name, "type definition", (jl_value_t*)jl_type_type, elt);
}
super = eval(args[3], locals, nl, ngensym);
jl_set_datatype_super(dt, super);
}
Expand Down
1 change: 0 additions & 1 deletion src/julia_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ uint32_t jl_get_gs_ctr(void);
void jl_set_gs_ctr(uint32_t ctr);

void NORETURN jl_no_method_error(jl_function_t *f, jl_value_t **args, size_t na);
void jl_check_type_tuple(jl_value_t *t, jl_sym_t *name, const char *ctx);

#define JL_CALLABLE(name) \
DLLEXPORT jl_value_t *name(jl_value_t *F, jl_value_t **args, uint32_t nargs)
Expand Down
6 changes: 0 additions & 6 deletions src/toplevel.c
Original file line number Diff line number Diff line change
Expand Up @@ -613,12 +613,6 @@ DLLEXPORT jl_value_t *jl_load_(jl_value_t *str)

void jl_reinstantiate_inner_types(jl_datatype_t *t);

void jl_check_type_tuple(jl_value_t *t, jl_sym_t *name, const char *ctx)
{
if (!jl_is_tuple_type(t))
jl_type_error_rt(name->name, ctx, (jl_value_t*)jl_type_type, t);
}

void jl_set_datatype_super(jl_datatype_t *tt, jl_value_t *super)
{
if (!jl_is_datatype(super) || !jl_is_abstracttype(super) ||
Expand Down

0 comments on commit d777bcc

Please sign in to comment.