Skip to content

Commit

Permalink
Revert "Mistakenly commited to the master. Reverted the changes"
Browse files Browse the repository at this point in the history
This reverts commit 422fdc5.
  • Loading branch information
Ojasv committed Jan 26, 2020
1 parent 422fdc5 commit 9d7a444
Showing 1 changed file with 36 additions and 8 deletions.
44 changes: 36 additions & 8 deletions src/interpreter.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,16 +152,44 @@ void jl_reset_instantiate_inner_types(jl_datatype_t *t);

void jl_set_datatype_super(jl_datatype_t *tt, jl_value_t *super)
{
if (!jl_is_datatype(super) || !jl_is_abstracttype(super) ||
tt->name == ((jl_datatype_t*)super)->name ||
jl_subtype(super, (jl_value_t*)jl_vararg_type) ||
jl_is_tuple_type(super) ||
jl_is_namedtuple_type(super) ||
jl_subtype(super, (jl_value_t*)jl_type_type) ||
jl_subtype(super, (jl_value_t*)jl_builtin_type)) {
jl_errorf("invalid subtyping in definition of %s",
if(!jl_is_datatype(super)|| !jl_is_abstracttype(super))
{
jl_errorf("invalid subtyping in definition of %s. The given value is not a Julia datatype.",
jl_symbol_name(tt->name->name));
}

if(tt->name == ((jl_datatype_t*)super)->name)
{
jl_errorf("invalid subtyping in definition of %s. The given supertype has same type as the subtype.",
jl_symbol_name(tt->name->name));
}
if(jl_is_tuple_type(super))
{
jl_errorf("invalid subtyping in definition of %s. The given supertype is a tuple.",
jl_symbol_name(tt->name->name));
}
if(jl_is_namedtuple_type(super))
{
jl_errorf("invalid subtyping in definition of %s.The given supertype is a named tuple.",
jl_symbol_name(tt->name->name));
}
if(jl_subtype(super, (jl_value_t*)jl_type_type))
{
jl_errorf("invalid subtyping in definition of %s. Given supertype is sub-type of a \n pre defined datatype.",
jl_symbol_name(tt->name->name));
}
if(jl_subtype(super, (jl_value_t*)jl_builtin_type))
{
jl_errorf("invalid subtyping in definition of %s.Given supertype is sub-type of a \n builtin defined datatype.",
jl_symbol_name(tt->name->name));
}
if(jl_subtype(super, (jl_value_t*)jl_vararg_type))
{
jl_errorf("invalid subtyping in definition of %s. Given supertype is sub-type of a \n vararg.",
jl_symbol_name(tt->name->name));
}


tt->super = (jl_datatype_t*)super;
jl_gc_wb(tt, tt->super);
}
Expand Down

0 comments on commit 9d7a444

Please sign in to comment.