ocaml
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Dead code identifier removal and cleanup

+29 -59
-1
lib/compiler/Eval.ml
··· 360 360 let table = 361 361 let env = Lex_env.read () in 362 362 let add (name, body) = 363 - let super = Symbol.fresh () in 364 363 Value.Method_table.add name Value.{body; self; super = None; env} 365 364 in 366 365 List.fold_right add methods Value.Method_table.empty
-1
lib/compiler/Forest.ml
··· 14 14 15 15 include URI.Tbl 16 16 17 - type resource = T.content T.resource 18 17 type article = T.content T.article 19 18 type env = (module Forest_graphs.S) 20 19
-1
lib/compiler/Suggestions.ml
··· 7 7 8 8 open Forester_prelude 9 9 open Forester_core 10 - open Bwd 11 10 12 11 (* TODO: remove this in favor of https://github.com/ocaml/ocaml/pull/13760 *) 13 12 let edit_distance ~cutoff x y =
-3
lib/core/Config.ml
··· 29 29 home = URI_scheme.named_uri ~base: url "index"; 30 30 } 31 31 32 - (* TODO: validate beforehand *) 33 - let base_uri {url; _} = url 34 - 35 32 let home_uri config = config.home
+1 -3
lib/core/Forest_graph.ml
··· 34 34 35 35 let immediate_dependencies = safe_pred 36 36 37 - let add_edge_safe g v w = if mem_vertex g v && mem_vertex g w then add_edge g v w 38 - 39 37 let dependencies graph vertex : t = 40 38 let dep_graph = create () in 41 39 let rec go v = ··· 67 65 let default_vertex_attributes _ = [] 68 66 let vertex_attributes _ = [] 69 67 let default_edge_attributes _ = [] 70 - let edge_attributes e = [`Label ""] 68 + let edge_attributes _e = [`Label ""] 71 69 let get_subgraph _ = None 72 70 end)
-9
lib/core/Forest_graphs.ml
··· 26 26 let@ host = Option.iter @~ URI.host uri in 27 27 let host_vtx = T.Content_vertex (T.Content [T.Text host]) in 28 28 Dl.db_add_fact dl_db @@ Dl.mk_literal Builtin_relation.in_host [Dl.mk_const vtx; Dl.mk_const host_vtx] 29 - 30 - let add_edge rel ~source ~target = 31 - Dl.db_add_fact dl_db @@ 32 - Dl.mk_literal 33 - rel 34 - [ 35 - Dl.mk_const source; 36 - Dl.mk_const target 37 - ] 38 29 end) 39 30 40 31 module Make () : S = (val (init @@ Dl.db_create ()))
+1 -5
lib/core/Reporter.ml
··· 4 4 * SPDX-License-Identifier: GPL-3.0-or-later 5 5 *) 6 6 7 - open Forester_prelude 8 - open Base 9 - 10 7 module R = Resolver 11 8 module Sc = R.Scope 12 9 ··· 23 20 let before = Unix.gettimeofday () in 24 21 let result = body () in 25 22 let after = Unix.gettimeofday () in 26 - emit (Profiling (after, before)); 27 - (* "[%fs] %s" (after -. before) msg; *) 23 + emit ~extra_remarks: [Asai.Diagnostic.loctextf "%s" msg] (Profiling (after, before)); 28 24 result 29 25 30 26 module Tty = Asai.Tty.Make(Message)
+2 -3
lib/core/Reporter_message.ml
··· 1 - open Forester_prelude 2 1 open Base 3 2 4 3 open struct ··· 90 89 | Missing_argument -> Error 91 90 | Uninterpreted_config_options _ -> Warning 92 91 | Using_default_option _ -> Info 93 - | Required_config_option string -> Error 92 + | Required_config_option _ -> Error 94 93 95 94 let short_code : t -> string = function 96 95 | Import_not_found _ -> "import_not_found" ··· 189 188 Asai.Diagnostic.textf "%t%t.\n%t" expected_msg got_msg hint 190 189 end 191 190 | Asset_not_found msg -> Asai.Diagnostic.text msg 192 - | Unbound_method (mthd, {prototype; methods}) -> 191 + | Unbound_method (mthd, {prototype = _; methods; _}) -> 193 192 let method_names = List.map fst @@ Value.Method_table.to_list methods in 194 193 Asai.Diagnostic.textf 195 194 "Unbound method %s. Available methods are:@.%a"
+5 -5
lib/core/Tree.ml
··· 45 45 46 46 let origin = function 47 47 | Document doc -> Physical doc 48 - | Parsed {nodes; identity; origin; timestamp} -> origin 49 - | Expanded {nodes; code; identity; units} -> code.origin 50 - | Resource {resource; route_locally; expanded} -> 51 - match expanded with 48 + | Parsed parsed -> parsed.origin 49 + | Expanded expanded -> expanded.code.origin 50 + | Resource resource -> 51 + match resource.expanded with 52 52 | None -> Undefined 53 - | Some {nodes; code; identity; units} -> code.origin 53 + | Some expanded -> expanded.code.origin 54 54 55 55 let show_phase = function 56 56 | Document _ -> "document"
-2
lib/core/Vertex.mli
··· 4 4 * SPDX-License-Identifier: GPL-3.0-or-later 5 5 *) 6 6 7 - open Base 8 - 9 7 type t = Types.content Types.vertex 10 8 include Set.OrderedType with type t := t 11 9 val equal : t -> t -> bool
-1
lib/core/test/Test_errors.ml
··· 9 9 open Forester_core 10 10 open Forester_compiler 11 11 open Forester_frontend 12 - open Testables 13 12 14 13 let error_run ~env ~config ~raw_trees = 15 14 with_test_forest
+1 -1
lib/core/test/Test_uri_util.ml
··· 5 5 *) 6 6 7 7 open Forester_core 8 - open Forester_compiler 8 + 9 9 10 10 let test_split_addr_1 () = 11 11 let uri = URI.of_string_exn "forest://test/foo-bar" in
-2
lib/language_server/Code_action.ml
··· 5 5 * 6 6 *) 7 7 8 - open Forester_prelude 9 8 open Forester_compiler 10 9 11 10 open struct module L = Lsp.Types end ··· 35 34 36 35 let compute (L.CodeActionParams.{range; textDocument = {uri}; _;}) : L.CodeActionResult.t = 37 36 let Lsp_state.{forest; _} = Lsp_state.get () in 38 - let config = forest.config in 39 37 let actions = 40 38 let next_sequential, next_random = next_addrs ~forest None in 41 39 match forest.config.trees with
-1
lib/language_server/Document_symbols.ml
··· 11 11 12 12 open struct 13 13 module L = Lsp.Types 14 - let (let*) = Option.bind 15 14 let pp_path = Resolver.Scope.pp_path 16 15 end 17 16
-1
lib/language_server/Inlay_hint.ml
··· 13 13 14 14 open struct 15 15 module L = Lsp.Types 16 - let (let*) = Option.bind 17 16 end 18 17 19 18 let compute (params : L.InlayHintParams.t) : L.InlayHint.t list option =
+2 -1
lib/language_server/Semantic_tokens.ml
··· 130 130 in 131 131 grouping [] l 132 132 133 - let node_to_tokens (_ : Code.node Range.located) _ list = [] 133 + (* TODO? *) 134 + let node_to_tokens (_ : Code.node Range.located) _ _list = [] 134 135 135 136 let tokenize_path ~(start : L.Position.t) (path : string list) : token list = 136 137 let offset = ref (start.character) in
+11 -11
lib/search/Context.ml
··· 59 59 = fun path frontmatter -> 60 60 match path with 61 61 | [] -> raise (Invalid_argument "stopped on non-leaf node") 62 - | 0 :: path -> 62 + | 0 :: _path -> 63 63 Format.(asprintf "%a" (pp_print_option URI.pp) frontmatter.uri) 64 64 | 1 :: path' -> 65 65 begin ··· 75 75 begin 76 76 match path' with 77 77 | [] -> assert false 78 - | path -> assert false 78 + | _path -> assert false 79 79 end (*frontmatter.dates*) 80 80 | 3 :: path' -> 81 81 begin 82 82 match path' with 83 83 | [] -> assert false 84 - | path -> assert false 84 + | _path -> assert false 85 85 end (*frontmatter.attributions*) 86 86 | 4 :: path' -> 87 87 begin ··· 95 95 begin 96 96 match path' with 97 97 | [] -> assert false 98 - | path -> assert false 98 + | _path -> assert false 99 99 end (*frontmatter.number*) 100 100 | 6 :: path' -> 101 101 begin 102 102 match path' with 103 103 | [] -> assert false 104 - | path -> assert false 104 + | _path -> assert false 105 105 end (*frontmatter.designated_parent*) 106 106 | 7 :: path' -> 107 107 begin 108 108 match path' with 109 109 | [] -> assert false 110 - | path -> assert false 110 + | _path -> assert false 111 111 end (*frontmatter.source_path*) 112 112 | 8 :: path' -> 113 113 begin 114 114 match path' with 115 115 | [] -> assert false 116 - | path -> assert false 116 + | _path -> assert false 117 117 end (*frontmatter.tags*) 118 118 | 9 :: path' -> 119 119 begin 120 120 match path' with 121 121 | [] -> assert false 122 - | path -> assert false 122 + | _path -> assert false 123 123 end (*frontmatter.metas*) 124 124 | _ -> raise (Invalid_argument "out of bound index") 125 125 ··· 137 137 | T.Contextual_number _ -> assert false 138 138 | T.Section _ -> assert false 139 139 | T.KaTeX (_, _) -> assert false 140 - | T.Link {href; content} -> render_context_content path' content 140 + | T.Link link -> render_context_content path' link.content 141 141 | T.Artefact _ -> assert false 142 142 | T.Uri _ -> assert false 143 143 | T.Route_of_uri _ -> assert false ··· 166 166 167 167 and debug_context_article : path -> string = function 168 168 | [] -> "empty path" 169 - | 0 :: path' -> "frontmatter ->" 170 - | 1 :: path' -> "mainmatter ->" 169 + | 0 :: _path' -> "frontmatter ->" 170 + | 1 :: _path' -> "mainmatter ->" 171 171 | _ -> raise (Invalid_argument "out of bound index")
-1
lib/search/Index.ml
··· 5 5 *) 6 6 7 7 open Forester_core 8 - open Forester_prelude 9 8 open Spelll 10 9 11 10 open struct module T = Forester_core.Types end
+3 -4
lib/search/Search_engine.ml
··· 9 9 open Forester_compiler 10 10 open Forester_search 11 11 open Forester_frontend 12 - open Cmdliner 13 - open Cmdliner.Term.Syntax 12 + 14 13 15 14 open struct module T = Types end 16 15 17 16 let ranked_search 18 17 : ?fuzz: int -> State.t -> string -> (URI.t * float) list 19 - = fun ?fuzz forest terms -> 18 + = fun ?fuzz: _ forest terms -> 20 19 Tokenizer.tokenize terms |> function 21 20 | tokens -> 22 21 (* In order to rank documents, I search for the first token and then ··· 51 50 List.iter 52 51 (fun (uri, score) -> 53 52 match State.get_article uri forest with 54 - | Some article -> 53 + | Some _article -> 55 54 Format.printf "%a, %f@." URI.pp uri score; 56 55 | None -> assert false 57 56 )
+1 -1
lib/search/Tokenizer.ml
··· 167 167 List.concat_map (tokenize_vertex path In_frontmatter) tags; 168 168 List.concat @@ 169 169 List.mapi 170 - (fun i (s, c) -> 170 + (fun _i (s, c) -> 171 171 (List.mapi (fun i t -> i :: path, t) @@ tokenize s) @ 172 172 tokenize_content path In_frontmatter c 173 173 )
+2 -2
lib/search/test/Test_forester_search.ml
··· 83 83 ] 84 84 in 85 85 let tokens = Tokenizer.tokenize_content [] In_mainmatter content in 86 - let locations = List.map (fun (x, y) -> List.rev x) tokens in 86 + let locations = List.map (fun (x, _) -> List.rev x) tokens in 87 87 let render path = Context.render_context_content path content in 88 88 Alcotest.(check @@ list string) 89 89 "" ··· 124 124 () 125 125 in 126 126 let tokens = Tokenizer.tokenize_frontmatter [] frontmatter in 127 - let locations = List.map (fun (x, y) -> List.rev x) tokens in 127 + let locations = List.map (fun (x, _) -> List.rev x) tokens in 128 128 let render path = Context.render_context_frontmatter path frontmatter in 129 129 Alcotest.(check @@ list string) 130 130 ""