Skip to content

Relax uninterpretable attributes (such as non-BuckleScript @@deriving payloads) from error to warn #4911

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jscomp/syntax/ast_derive_util.mli
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ val notApplicable:
string ->
unit

val invalid_config : Parsetree.expression -> 'a
val invalid_config : Parsetree.expression -> 'a
11 changes: 8 additions & 3 deletions jscomp/syntax/ast_payload.ml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ type action =
*)


let unrecognizedConfigRecord loc text =
Location.prerr_warning
loc
(Warnings.Bs_derive_warning text)


let ident_or_record_as_config
loc
Expand All @@ -156,11 +161,11 @@ let ident_or_record_as_config
->
({Asttypes.txt = name ; loc}, Some y)
| _ ->
Location.raise_errorf ~loc "Qualified label is not allood"
Location.raise_errorf ~loc "Qualified label is not allowed"
)

| Some _ ->
Location.raise_errorf ~loc "with is not supported"
unrecognizedConfigRecord loc "`with` is not supported, discarding"; []
end
| PStr [
{pstr_desc =
Expand All @@ -174,7 +179,7 @@ let ident_or_record_as_config
] -> [ {Asttypes.txt ; loc = lloc}, None]
| PStr [] -> []
| _ ->
Location.raise_errorf ~loc "this is not a valid record config"
unrecognizedConfigRecord loc "invalid attribute config-record, ignoring"; []



Expand Down
7 changes: 7 additions & 0 deletions jscomp/syntax/ast_payload.mli
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,10 @@ val empty : t

val table_dispatch :
(Parsetree.expression option -> 'a) Map_string.t -> action -> 'a

(** Report to the user, as a warning, that the bs-attribute parser is bailing out. (This is to allow
external ppx, like ppx_deriving, to pick up where the builtin ppx leave off.) *)
val unrecognizedConfigRecord:
Location.t ->
string ->
unit
19 changes: 16 additions & 3 deletions lib/4.06.1/unstable/js_compiler.ml
Original file line number Diff line number Diff line change
Expand Up @@ -398661,6 +398661,13 @@ val empty : t
val table_dispatch :
(Parsetree.expression option -> 'a) Map_string.t -> action -> 'a

(** Report to the user, as a warning, that the bs-attribute parser is bailing out. (This is to allow
external ppx, like ppx_deriving, to pick up where the builtin ppx leave off.) *)
val unrecognizedConfigRecord:
Location.t ->
string ->
unit

end = struct
#1 "ast_payload.ml"
(* Copyright (C) 2015-2016 Bloomberg Finance L.P.
Expand Down Expand Up @@ -398795,6 +398802,11 @@ type action =
*)


let unrecognizedConfigRecord loc text =
Location.prerr_warning
loc
(Warnings.Bs_derive_warning text)


let ident_or_record_as_config
loc
Expand All @@ -398821,11 +398833,11 @@ let ident_or_record_as_config
->
({Asttypes.txt = name ; loc}, Some y)
| _ ->
Location.raise_errorf ~loc "Qualified label is not allood"
Location.raise_errorf ~loc "Qualified label is not allowed"
)

| Some _ ->
Location.raise_errorf ~loc "with is not supported"
unrecognizedConfigRecord loc "`with` is not supported, discarding"; []
end
| PStr [
{pstr_desc =
Expand All @@ -398839,7 +398851,7 @@ let ident_or_record_as_config
] -> [ {Asttypes.txt ; loc = lloc}, None]
| PStr [] -> []
| _ ->
Location.raise_errorf ~loc "this is not a valid record config"
unrecognizedConfigRecord loc "invalid attribute config-record, ignoring"; []



Expand Down Expand Up @@ -402852,6 +402864,7 @@ val notApplicable:
unit

val invalid_config : Parsetree.expression -> 'a

end = struct
#1 "ast_derive_util.ml"
(* Copyright (C) 2015-2016 Bloomberg Finance L.P.
Expand Down
19 changes: 16 additions & 3 deletions lib/4.06.1/unstable/js_refmt_compiler.ml
Original file line number Diff line number Diff line change
Expand Up @@ -398661,6 +398661,13 @@ val empty : t
val table_dispatch :
(Parsetree.expression option -> 'a) Map_string.t -> action -> 'a

(** Report to the user, as a warning, that the bs-attribute parser is bailing out. (This is to allow
external ppx, like ppx_deriving, to pick up where the builtin ppx leave off.) *)
val unrecognizedConfigRecord:
Location.t ->
string ->
unit

end = struct
#1 "ast_payload.ml"
(* Copyright (C) 2015-2016 Bloomberg Finance L.P.
Expand Down Expand Up @@ -398795,6 +398802,11 @@ type action =
*)


let unrecognizedConfigRecord loc text =
Location.prerr_warning
loc
(Warnings.Bs_derive_warning text)


let ident_or_record_as_config
loc
Expand All @@ -398821,11 +398833,11 @@ let ident_or_record_as_config
->
({Asttypes.txt = name ; loc}, Some y)
| _ ->
Location.raise_errorf ~loc "Qualified label is not allood"
Location.raise_errorf ~loc "Qualified label is not allowed"
)

| Some _ ->
Location.raise_errorf ~loc "with is not supported"
unrecognizedConfigRecord loc "`with` is not supported, discarding"; []
end
| PStr [
{pstr_desc =
Expand All @@ -398839,7 +398851,7 @@ let ident_or_record_as_config
] -> [ {Asttypes.txt ; loc = lloc}, None]
| PStr [] -> []
| _ ->
Location.raise_errorf ~loc "this is not a valid record config"
unrecognizedConfigRecord loc "invalid attribute config-record, ignoring"; []



Expand Down Expand Up @@ -402852,6 +402864,7 @@ val notApplicable:
unit

val invalid_config : Parsetree.expression -> 'a

end = struct
#1 "ast_derive_util.ml"
(* Copyright (C) 2015-2016 Bloomberg Finance L.P.
Expand Down
19 changes: 16 additions & 3 deletions lib/4.06.1/whole_compiler.ml
Original file line number Diff line number Diff line change
Expand Up @@ -288146,6 +288146,13 @@ val empty : t
val table_dispatch :
(Parsetree.expression option -> 'a) Map_string.t -> action -> 'a

(** Report to the user, as a warning, that the bs-attribute parser is bailing out. (This is to allow
external ppx, like ppx_deriving, to pick up where the builtin ppx leave off.) *)
val unrecognizedConfigRecord:
Location.t ->
string ->
unit

end = struct
#1 "ast_payload.ml"
(* Copyright (C) 2015-2016 Bloomberg Finance L.P.
Expand Down Expand Up @@ -288280,6 +288287,11 @@ type action =
*)


let unrecognizedConfigRecord loc text =
Location.prerr_warning
loc
(Warnings.Bs_derive_warning text)


let ident_or_record_as_config
loc
Expand All @@ -288306,11 +288318,11 @@ let ident_or_record_as_config
->
({Asttypes.txt = name ; loc}, Some y)
| _ ->
Location.raise_errorf ~loc "Qualified label is not allood"
Location.raise_errorf ~loc "Qualified label is not allowed"
)

| Some _ ->
Location.raise_errorf ~loc "with is not supported"
unrecognizedConfigRecord loc "`with` is not supported, discarding"; []
end
| PStr [
{pstr_desc =
Expand All @@ -288324,7 +288336,7 @@ let ident_or_record_as_config
] -> [ {Asttypes.txt ; loc = lloc}, None]
| PStr [] -> []
| _ ->
Location.raise_errorf ~loc "this is not a valid record config"
unrecognizedConfigRecord loc "invalid attribute config-record, ignoring"; []



Expand Down Expand Up @@ -405681,6 +405693,7 @@ val notApplicable:
unit

val invalid_config : Parsetree.expression -> 'a

end = struct
#1 "ast_derive_util.ml"
(* Copyright (C) 2015-2016 Bloomberg Finance L.P.
Expand Down