Skip to content
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

FStar.Issue: exposing doc_of_issue #3688

Merged
merged 1 commit into from
Jan 18, 2025
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
18 changes: 9 additions & 9 deletions src/basic/FStarC.Errors.fst
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ let optional_def (f : 'a -> PP.document) (def : PP.document) (o : option 'a) : P
| Some x -> f x
| None -> def

let format_issue' (print_hdr:bool) (issue:issue) : string =
let issue_to_doc' (print_hdr:bool) (issue:issue) : PP.document =
let open FStarC.Pprint in
let r = issue.issue_range in
let hdr : document =
Expand Down Expand Up @@ -221,14 +221,14 @@ let format_issue' (print_hdr:bool) (issue:issue) : string =
let mainmsg : document =
concat (List.map (fun d -> subdoc (group d)) issue.issue_msg)
in
let doc : document =
(* This ends in a hardline to get a 1-line spacing between errors *)
hdr ^^
mainmsg ^^
subdoc seealso ^^
subdoc ctx
in
renderdoc doc
(* This ends in a hardline to get a 1-line spacing between errors *)
hdr ^^
mainmsg ^^
subdoc seealso ^^
subdoc ctx

let format_issue' (print_hdr:bool) (issue:issue) : string =
issue_to_doc' print_hdr issue |> renderdoc

let format_issue issue : string = format_issue' true issue

Expand Down
4 changes: 3 additions & 1 deletion ulib/FStar.Issue.fsti
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ val range_of_issue (i:issue) : Tot (option range)

val context_of_issue (i:issue) : Tot (list string)

val issue_to_doc (i:issue) : Tot Pprint.document

val render_issue (i:issue) : Tot string

(* NOTE: the only way to build a document that actually reduces
in interpreted mode (like in tactics when not using plugins)
is using arbitrary_string, as below. *)
Expand Down
1 change: 1 addition & 0 deletions ulib/ml/plugin/FStar_Issue.ml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ let mk_issue_level (i:issue_level_string)
| "Info" -> EInfo
| "Warning" -> EWarning

let issue_to_doc (i:issue) : FStarC_Pprint.document = FStarC_Errors.issue_to_doc' true i
let render_issue (i:issue) : string = FStarC_Errors.format_issue i

let mk_issue_doc (i:issue_level_string)
Expand Down
Loading