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

Nits #3742

Merged
merged 4 commits into from
Feb 12, 2025
Merged

Nits #3742

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
6 changes: 5 additions & 1 deletion src/extraction/FStarC.Extraction.ML.PrintML.fsti
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@ module FStarC.Extraction.ML.PrintML

open FStarC.Extraction.ML.Syntax

val print: option string -> string -> mllib -> unit
val print
(odir : option string)
(extension : string)
(defs : mllib)
: unit
13 changes: 9 additions & 4 deletions src/fstar/FStarC.Main.fst
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ let report_errors fmods =
end

let load_native_tactics () =
let open FStarC.Errors.Msg in
let modules_to_load = Options.load() |> List.map Ident.lid_of_str in
let cmxs_to_load = Options.load_cmxs () |> List.map Ident.lid_of_str in
let ml_module_name m = FStarC.Extraction.ML.Util.ml_module_name_of_lid m in
Expand All @@ -83,15 +84,19 @@ let load_native_tactics () =
else //else try to find and compile the ml file
match Find.find_file_odir (ml_file m) with
| None ->
E.raise_error0 E.Fatal_FailToCompileNativeTactic
(Util.format1 "Failed to compile native tactic; extracted module %s not found" (ml_file m))
E.raise_error0 E.Fatal_FailToCompileNativeTactic [
text "Failed to compile native tactic.";
text (format1 "Extracted module %s not found." (ml_file m))
]
| Some ml ->
let dir = Util.dirname ml in
Plugins.compile_modules dir [ml_module_name m];
begin match Find.find_file_odir cmxs with
| None ->
E.raise_error0 E.Fatal_FailToCompileNativeTactic
(Util.format1 "Failed to compile native tactic; compiled object %s not found" cmxs)
E.raise_error0 E.Fatal_FailToCompileNativeTactic [
text "Failed to compile native tactic.";
text (format1 "Compilation seemingly succeeded, but compiled object %s not found." cmxs);
]
| Some f -> f
end
in
Expand Down
16 changes: 8 additions & 8 deletions src/interactive/FStarC.Interactive.Ide.Types.fst
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ module SS = FStarC.Syntax.Syntax
let initial_range =
Range.mk_range "<input>" (Range.mk_pos 1 0) (Range.mk_pos 1 0)

instance showable_push_kind : showable push_kind = {
show = (function
| SyntaxCheck -> "SyntaxCheck"
| LaxCheck -> "LaxCheck"
| FullCheck -> "FullCheck");
}

(*************************)
(* REPL tasks and states *)
(*************************)
Expand Down Expand Up @@ -98,22 +105,15 @@ let repl_state_to_string (r:repl_state)
| Some m -> Ident.string_of_lid m.name);
string_of_repl_stack r.repl_deps_stack]


let push_query_to_string pq =
let pk =
match pq.push_kind with
| SyntaxCheck -> "SyntaxCheck"
| LaxCheck -> "LaxCheck"
| FullCheck -> "FullCheck"
in
let code_or_decl =
match pq.push_code_or_decl with
| Inl code -> code
| Inr (_decl, code) -> code.code
in
FStarC.Util.format "{ push_kind = %s; push_line = %s; \
push_column = %s; push_peek_only = %s; push_code_or_decl = %s }"
[pk; string_of_int pq.push_line;
[show pq.push_kind; string_of_int pq.push_line;
string_of_int pq.push_column;
string_of_bool pq.push_peek_only;
code_or_decl]
Expand Down
2 changes: 2 additions & 0 deletions src/interactive/FStarC.Interactive.Ide.Types.fsti
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ val initial_range : range

type push_kind = | SyntaxCheck | LaxCheck | FullCheck

instance val showable_push_kind : Class.Show.showable push_kind

type completion_context =
| CKCode
| CKOption of bool (* #set-options (false) or #reset-options (true) *)
Expand Down
2 changes: 2 additions & 0 deletions src/interactive/FStarC.Interactive.Ide.fst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ open FStarC.Interactive.PushHelper
open FStarC.Interactive.Ide.Types
module BU = FStarC.Util

open FStarC.Class.Show

let dbg = Debug.get_toggle "IDE"

open FStarC.Universal
Expand Down
8 changes: 2 additions & 6 deletions src/parser/FStarC.Parser.Dep.fst
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,8 @@ module FStarC.Parser.Dep
open FStarC
open FStarC.Effect //for ref, failwith etc
open FStarC.List
open FStarC.Parser
open FStarC.Parser.AST
open FStarC.Util
open FStarC.Const
open FStar.String
open FStarC.Ident
open FStarC.Errors
open FStarC.Class.Show

Expand Down Expand Up @@ -142,10 +138,10 @@ let module_name_of_file f =
let lowercase_module_name f = String.lowercase (module_name_of_file f)

let namespace_of_module f =
let lid = FStarC.Ident.lid_of_path (FStarC.Ident.path_of_text f) Range.dummyRange in
let lid = Ident.lid_of_path (Ident.path_of_text f) Range.dummyRange in
match ns_of_lid lid with
| [] -> None
| ns -> Some (FStarC.Ident.lid_of_ids ns)
| ns -> Some (Ident.lid_of_ids ns)

type file_name = string
type dependence =
Expand Down
1 change: 0 additions & 1 deletion src/parser/FStarC.Parser.Dep.fsti
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ module FStarC.Parser.Dep

open FStarC
open FStarC.Effect
open FStarC.Parser.AST
open FStarC.Util
open FStarC.Ident

Expand Down
Loading