Ban empty record definitions (#384)
* Ban empty record declarations * Use definition instead of declaration * Fix the failing test
This commit is contained in:
@@ -1018,6 +1018,9 @@ check_typedef_sccs(Env, TypeMap, [{acyclic, Name} | SCCs], Acc) ->
|
||||
Env1 = bind_type(Name, Ann, {Xs, Def}, Env),
|
||||
case Def of
|
||||
{alias_t, _} -> check_typedef_sccs(Env1, TypeMap, SCCs, Acc1);
|
||||
{record_t, []} ->
|
||||
type_error({empty_record_definition, Ann, Name}),
|
||||
check_typedef_sccs(Env1, TypeMap, SCCs, Acc1);
|
||||
{record_t, Fields} ->
|
||||
%% check_type to get qualified name
|
||||
RecTy = check_type(Env1, app_t(Ann, D, Xs)),
|
||||
@@ -3279,6 +3282,9 @@ mk_error({using_undefined_namespace_parts, Ann, Namespace, Parts}) ->
|
||||
mk_error({unknown_warning, Warning}) ->
|
||||
Msg = io_lib:format("Trying to report unknown warning: ~p", [Warning]),
|
||||
mk_t_err(pos(0, 0), Msg);
|
||||
mk_error({empty_record_definition, Ann, Name}) ->
|
||||
Msg = io_lib:format("Empty record definitions are not allowed. Cannot define the record `~s`", [Name]),
|
||||
mk_t_err(pos(Ann), Msg);
|
||||
mk_error(Err) ->
|
||||
Msg = io_lib:format("Unknown error: ~p", [Err]),
|
||||
mk_t_err(pos(0, 0), Msg).
|
||||
|
||||
Reference in New Issue
Block a user