Use definition instead of declaration

This commit is contained in:
Gaith Hallak 2022-05-23 22:11:41 +04:00
parent af2fe4515c
commit ccfa22972e
4 changed files with 5 additions and 5 deletions

View File

@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
```
### Changed
- Error messages have been restructured (less newlines) to provide more unified errors. Also `pp_oneline/1` has been added.
- Ban empty record declarations (e.g. `record r = {}` would give an error).
- Ban empty record definitions (e.g. `record r = {}` would give an error).
### Removed
- Support for AEVM has been entirely wiped

View File

@ -1019,7 +1019,7 @@ check_typedef_sccs(Env, TypeMap, [{acyclic, Name} | SCCs], Acc) ->
case Def of
{alias_t, _} -> check_typedef_sccs(Env1, TypeMap, SCCs, Acc1);
{record_t, []} ->
type_error({empty_record_declaration, Ann, Name}),
type_error({empty_record_definition, Ann, Name}),
check_typedef_sccs(Env1, TypeMap, SCCs, Acc1);
{record_t, Fields} ->
%% check_type to get qualified name
@ -3282,8 +3282,8 @@ 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_declaration, Ann, Name}) ->
Msg = io_lib:format("Empty record declarations are not allowed. Cannot declare the record `~s`", [Name]),
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]),

View File

@ -793,7 +793,7 @@ failing_contracts() ->
])
, ?TYPE_ERROR(empty_record_declaration,
[<<?Pos(2,5)
"Empty record declarations are not allowed. Cannot declare the record `r`">>
"Empty record definitions are not allowed. Cannot define the record `r`">>
])
, ?TYPE_ERROR(warnings,
[<<?Pos(0, 0)