Skip to content

Commit

Permalink
Warning about abstr modifier in pub rec block (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bohun9 authored May 7, 2024
1 parent ce90ab1 commit b6cf79a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/DblParser/Desugar.ml
Original file line number Diff line number Diff line change
Expand Up @@ -708,8 +708,11 @@ and tr_def ?(public=false) (def : Raw.def) =
let (pub_type, pub_ctors) =
match vis with
| DV_Private -> (public, public)
| DV_Abstract -> (true, public)
| DV_Public -> (true, true )
| DV_Abstract ->
if public then
Error.warn (Error.abstr_data_in_pub_block def.pos);
(true, public)
| DV_Public -> (true, true)
in
begin match tr_type_def tp [] with
| TD_Id(x, args) ->
Expand Down
4 changes: 4 additions & 0 deletions src/DblParser/Error.ml
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,7 @@ let finally_before_return_clause pos =

let multiple_self_parameters pos =
(Some pos, "Multiple 'self' parameters of a method")

let abstr_data_in_pub_block pos =
(Some pos, "This 'abstr' data modifier has no effect. \
It is overridden by 'public' of entire group of definitions.")
2 changes: 2 additions & 0 deletions src/DblParser/Error.mli
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@ val value_before_type_param : Position.t -> t
val finally_before_return_clause : Position.t -> t

val multiple_self_parameters : Position.t -> t

val abstr_data_in_pub_block : Position.t -> t

0 comments on commit b6cf79a

Please sign in to comment.