jaredly / reason-language-server

A language server for reason, in reason
MIT License
657 stars 84 forks source link

Dune and module aliasing -> unbound module #255

Open giltho opened 5 years ago

giltho commented 5 years ago

[This might be a duplicate from #105 but I am not using Esy. If you decide it is a duplicate, I'll just close that issue and copy the following as a response in #105]

Hello, I'm trying to move an OCaml project to dune. It's a research project, that is a few years old now and the migration is a bit heavy.

I'm generally using the merlin-based LSP for VSCode, but it is not maintained since RLS exists so I'm trying to move to RLS also.

However, it does not work.. I am stuck with an error saying Unbound module Camelot__. I know this is due to dune wrapping my module, but I don't know why RLS isn't catching that.

The merlin file ends with FLG -open Camelot__ -w -8-11-14-20-26-27-28-32-33-37-39-40-50-52-57 which might explain why the error arises in every file.

Here's my dune file for the library :


(library
    (name camelot)
    (public_name camelot)
    (flags -w -8-11-14-20-26-27-28-32-33-37-39-40-50-52-57)
    (libraries extlib JS_Parser z3 menhirLib)
    (modules_without_implementation absState cMemory error graphNode preds sMemory state store subst unifier val stateCleanUp))

Here's my dune file for the binaries :

  (names jsil js2jsil jsilverify cosette)
  (libraries camelot))
and the debug.log :

``` Hello - from /path/to//.vscode/extensions/jaredly.reason-vscode-1.5.2/bin.native Previous log location: /var/folders/tz/7cs2hhtx6d11512q3y2bnl640000gn/T/lsp.log Sending notification {"jsonrpc": "2.0", "method": "client/registerCapability", "params": {"registrations": [{"id": "watching", "method": "workspace/didChangeWatchedFiles", "registerOptions": {"watchers": [{"globPattern": "**/bsconfig.json", "globPattern": "**/.merlin"}]}}]}} Sending response {"id": 0, "jsonrpc": "2.0", "result": {"capabilities": {"textDocumentSync": 1, "hoverProvider": true, "completionProvider": {"resolveProvider": true, "triggerCharacters": ["."]}, "signatureHelpProvider": {"triggerCharacters": ["("]}, "definitionProvider": true, "typeDefinitionProvider": true, "referencesProvider": true, "documentSymbolProvider": true, "codeActionProvider": true, "executeCommandProvider": {"commands": ["reason-language-server.add_to_interface_inner"]}, "codeLensProvider": {"resolveProvider": true}, "documentHighlightProvider": true, "documentRangeFormattingProvider": true, "documentFormattingProvider": true, "documentFormattingProvider": true, "renameProvider": true}}} Read message {"jsonrpc":"2.0","method":"initialized","params":{}} Read message {"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{"reason_language_server":{"location":"","build_system_override_by_root":{},"refmt":"","lispRefmt":"","format_width":"80","per_value_codelens":false,"dependencies_codelens":false,"opens_codelens":true,"show_module_path_on_hover":false,"reloadOnChange":false,"show_debug_errors":true,"autoRebuild":true}}}} Read message {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///path/to/project/src/lib/Utils/Arith_Utils.ml","languageId":"ocaml","version":1,"text":"open Batteries\n\n(* This is very tricky, -0 has to not be an int *)\nlet is_int (f : float) : bool =\n let f' = float_of_int (int_of_float f) in\n f = f' && (copysign 1.0 f = copysign 1.0 f')\n\nlet is_normal (f : float) =\n let fc = Float.classify f in\n not ((fc = FP_infinite) || (fc = FP_nan))\n\nlet to_int = fun n ->\n match classify_float n with\n | FP_nan -> 0.\n | FP_infinite -> n\n | FP_zero -> n\n | FP_normal\n | FP_subnormal ->\n (if n < 0. then (-1.) else 1.) *. (floor (abs_float n))\n\nlet to_int32 = fun n ->\n match classify_float n with\n | FP_normal | FP_subnormal ->\n let i32 = 2. ** 32. in\n let i31 = 2. ** 31. in\n let posint = (if n < 0. then (-1.) else 1.) *. (floor (abs_float n)) in\n let int32bit =\n let smod = mod_float posint i32 in\n if smod < 0. then smod +. i32 else smod\n in\n (if int32bit >= i31 then int32bit -. i32 else int32bit)\n | _ -> 0.\n\nlet to_uint32 = fun n ->\n match classify_float n with\n | FP_normal | FP_subnormal ->\n let i32 = 2. ** 32. in\n let posint = (if n < 0. then (-1.) else 1.) *. (floor (abs_float n)) in\n let int32bit =\n let smod = mod_float posint i32 in\n if smod < 0. then smod +. i32 else smod\n in\n int32bit\n | _ -> 0.\n\nlet to_uint16 = fun n ->\n match classify_float n with\n | FP_normal | FP_subnormal ->\n let i16 = 2. ** 16. in\n let posint = (if n < 0. then (-1.) else 1.) *. (floor (abs_float n)) in\n let int16bit =\n let smod = mod_float posint i16 in\n if smod < 0. then smod +. i16 else smod\n in\n int16bit\n | _ -> 0.\n\nlet modulo_32 = (fun x -> let r = mod_float x 32. in if x < 0. then r +. 32. else r)\n\nlet int32_bitwise_not = fun x -> Int32.to_float (Int32.lognot (Int32.of_float x))\n\nlet int32_bitwise_and = fun x y -> Int32.to_float (Int32.logand (Int32.of_float x) (Int32.of_float y))\n\nlet int32_bitwise_or = fun x y -> Int32.to_float (Int32.logor (Int32.of_float x) (Int32.of_float y))\n\nlet int32_bitwise_xor = fun x y -> Int32.to_float (Int32.logxor (Int32.of_float x) (Int32.of_float y))\n\nlet int32_left_shift x y =\n let l = Int32.of_float x in\n let r = (int_of_float y) mod 32 in\n Int32.to_float (Int32.shift_left l r)\n\nlet int32_right_shift x y =\n let l = Int32.of_float x in\n let r = (int_of_float y) mod 32 in\n Int32.to_float (Int32.shift_right l r)\n\nlet uint32_right_shift = (fun x y ->\n let i31 = 2. ** 31. in\n let i32 = 2. ** 32. in\n let signedx = if x >= i31 then x -. i32 else x in\n let left = Int32.of_float signedx in\n let right = (int_of_float y) mod 32 in\n let r = Int32.to_float (Int32.shift_right_logical left right) in\n if r < 0. then r +. i32 else r)\n\n(* This is intended to work on positive floats! *)\nlet string_of_pos_float num =\n\t (* Is the number an integer? *)\n\t\tlet inum = int_of_float num in\n if (is_int num) then string_of_int inum\n\t\t(* It is not an integer *)\n else \n\t\t\tif num > 1e+9 && num < 1e+21 \n\t\t\t\tthen Printf.sprintf \"%.0f\" num\n\t\t\telse\n\t\t\tif ((1e-5 <= num) && (num < 1e-4)) \n\t\t\tthen\n\t\t\tbegin\n\t\t\t\tlet s = (string_of_float (num *. 10.)) in\n\t\t\t\tlet len = String.length s in\n\t\t\t\t\"0.0\" ^ (String.sub s 2 (len - 2))\n\t\t\tend\n\t\t\telse\n\t\t\tif ((1e-6 <= num) && (num < 1e-5)) \n\t\t\tthen\n\t\t\tbegin\n\t\t\t\tlet s = (string_of_float (num *. 100.)) in\n\t\t\t\tlet len = String.length s in\n\t\t\t\t\"0.00\" ^ (String.sub s 2 (len - 2))\n\t\t\tend\n\t\t\telse\n\t\t\tlet re = Str.regexp \"e\\\\([-+]\\\\)0\" in (* e+0 -> e+ *)\n \tStr.replace_first re \"e\\\\1\" (string_of_float num)\n\t\nlet rec float_to_string_inner n =\n if Float.is_nan n then \"NaN\"\n else if ((n = 0.0) || (n = -0.0)) then \"0\"\n else if (n < 0.0) then \"-\" ^ (float_to_string_inner (-. n))\n else if (n = Float.infinity) then \"Infinity\"\n else string_of_pos_float n"}}} Found a `dune` file at /path/to/project/src/lib ]] Making a new jbuilder package at /path/to/project/src/lib === Project root: /path/to/project Detected `opam` dependency manager for local use === Build dir: /path/to/project/_build Get ocaml stdlib dirs Include subdirs? YES Got a compiled base /path/to/project/_build/default/src/lib/.camelot.objs Local file: /path/to/project/src/lib/Abstraction/Preds.mli Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Abstraction/Preds.cmt Local file: /path/to/project/src/lib/Abstraction/AbsState.mli Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Abstraction/AbsState.cmt Local file: /path/to/project/src/lib/Abstraction/MakeAbsState.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Abstraction/MakeAbsState.cmt Local file: /path/to/project/src/lib/Abstraction/UP.mli Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Abstraction/UP.cmt Local file: /path/to/project/src/lib/Abstraction/MakeNormaliser.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Abstraction/MakeNormaliser.cmt Local file: /path/to/project/src/lib/Abstraction/SPreds.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Abstraction/SPreds.cmt Local file: /path/to/project/src/lib/Abstraction/MakeUnifier.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Abstraction/MakeUnifier.cmt Local file: /path/to/project/src/lib/Abstraction/JSIL/AbsSState.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Abstraction/JSIL/AbsSState.cmt Local file: /path/to/project/src/lib/Abstraction/StateCleanUp.mli Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Abstraction/StateCleanUp.cmt Local file: /path/to/project/src/lib/Abstraction/MakePreds.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Abstraction/MakePreds.cmt Local file: /path/to/project/src/lib/Abstraction/UP.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Abstraction/UP.cmt Local file: /path/to/project/src/lib/Abstraction/Unifier.mli Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Abstraction/Unifier.cmt Local file: /path/to/project/src/lib/Abstraction/MakeVerification.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Abstraction/MakeVerification.cmt Local file: /path/to/project/src/lib/Abstraction/LogicPreprocessing.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Abstraction/LogicPreprocessing.cmt Local file: /path/to/project/src/lib/ConcreteSemantics/CError.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./ConcreteSemantics/CError.cmt Local file: /path/to/project/src/lib/ConcreteSemantics/MakeCState.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./ConcreteSemantics/MakeCState.cmt Local file: /path/to/project/src/lib/ConcreteSemantics/CStore.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./ConcreteSemantics/CStore.cmt Local file: /path/to/project/src/lib/ConcreteSemantics/CVal.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./ConcreteSemantics/CVal.cmt Local file: /path/to/project/src/lib/ConcreteSemantics/JSIL/CHeap.mli Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./ConcreteSemantics/JSIL/CHeap.cmt Local file: /path/to/project/src/lib/ConcreteSemantics/JSIL/JSILCMemory.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./ConcreteSemantics/JSIL/JSILCMemory.cmt Local file: /path/to/project/src/lib/ConcreteSemantics/JSIL/CHeap.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./ConcreteSemantics/JSIL/CHeap.cmt Local file: /path/to/project/src/lib/ConcreteSemantics/JSIL/CObject.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./ConcreteSemantics/JSIL/CObject.cmt Local file: /path/to/project/src/lib/ConcreteSemantics/JSIL/JSILCInterpreter.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./ConcreteSemantics/JSIL/JSILCInterpreter.cmt Local file: /path/to/project/src/lib/ConcreteSemantics/JSIL/CObject.mli Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./ConcreteSemantics/JSIL/CObject.cmt Local file: /path/to/project/src/lib/ConcreteSemantics/CMemory.mli Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./ConcreteSemantics/CMemory.cmt Local file: /path/to/project/src/lib/ConcreteSemantics/CExprEval.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./ConcreteSemantics/CExprEval.cmt Local file: /path/to/project/src/lib/camelot.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./camelot.cmt Local file: /path/to/project/src/lib/Utils/IO_Utils.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Utils/IO_Utils.cmt Local file: /path/to/project/src/lib/Utils/Utils.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Utils/Utils.cmt Local file: /path/to/project/src/lib/Utils/Arith_Utils.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Utils/Arith_Utils.cmt Local file: /path/to/project/src/lib/Utils/GraphNode.mli Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Utils/GraphNode.cmt Local file: /path/to/project/src/lib/Utils/PreProcessing_Utils.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Utils/PreProcessing_Utils.cmt Local file: /path/to/project/src/lib/Parser/Parsing_Utils.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Parser/Parsing_Utils.cmt Local file: /path/to/project/src/lib/CommandLine/ParserAndCompiler.mli Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./CommandLine/ParserAndCompiler.cmt Local file: /path/to/project/src/lib/CommandLine/ParserAndCompiler.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./CommandLine/ParserAndCompiler.cmt Local file: /path/to/project/src/lib/CommandLine/MakeSInterpreterConsole.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./CommandLine/MakeSInterpreterConsole.cmt Local file: /path/to/project/src/lib/CommandLine/MakeCInterpreterConsole.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./CommandLine/MakeCInterpreterConsole.cmt Local file: /path/to/project/src/lib/CommandLine/MakeVerificationConsole.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./CommandLine/MakeVerificationConsole.cmt Local file: /path/to/project/src/lib/CommandLine/CommandLine.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./CommandLine/CommandLine.cmt Local file: /path/to/project/src/lib/JS2JSIL/JS2JSIL.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./JS2JSIL/JS2JSIL.cmt Local file: /path/to/project/src/lib/JS2JSIL/JS2JSIL_Constants.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./JS2JSIL/JS2JSIL_Constants.cmt Local file: /path/to/project/src/lib/JS2JSIL/JS2JSIL_Preprocessing.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./JS2JSIL/JS2JSIL_Preprocessing.cmt Local file: /path/to/project/src/lib/JS2JSIL/JS_Utils.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./JS2JSIL/JS_Utils.cmt Local file: /path/to/project/src/lib/JS2JSIL/JS2JSIL_Compiler.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./JS2JSIL/JS2JSIL_Compiler.cmt Local file: /path/to/project/src/lib/JS2JSIL/JSIL2GIL.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./JS2JSIL/JSIL2GIL.cmt Local file: /path/to/project/src/lib/JS2JSIL/JSIL_PostParser.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./JS2JSIL/JSIL_PostParser.cmt Local file: /path/to/project/src/lib/JS2JSIL/JS_PreParser.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./JS2JSIL/JS_PreParser.cmt Local file: /path/to/project/src/lib/GeneralSemantics/CallStack.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./GeneralSemantics/CallStack.cmt Local file: /path/to/project/src/lib/GeneralSemantics/MakeError.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./GeneralSemantics/MakeError.cmt Local file: /path/to/project/src/lib/GeneralSemantics/Subst.mli Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./GeneralSemantics/Subst.cmt Local file: /path/to/project/src/lib/GeneralSemantics/Store.mli Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./GeneralSemantics/Store.cmt Local file: /path/to/project/src/lib/GeneralSemantics/MakeStore.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./GeneralSemantics/MakeStore.cmt Local file: /path/to/project/src/lib/GeneralSemantics/General/MakeGInterpreter.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./GeneralSemantics/General/MakeGInterpreter.cmt Local file: /path/to/project/src/lib/GeneralSemantics/External.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./GeneralSemantics/External.cmt Local file: /path/to/project/src/lib/GeneralSemantics/Val.mli Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./GeneralSemantics/Val.cmt Local file: /path/to/project/src/lib/GeneralSemantics/Error.mli Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./GeneralSemantics/Error.cmt Local file: /path/to/project/src/lib/GeneralSemantics/State.mli Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./GeneralSemantics/State.cmt Local file: /path/to/project/src/lib/GeneralSemantics/MakeSubst.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./GeneralSemantics/MakeSubst.cmt Local file: /path/to/project/src/lib/FOLogic/Simplifications.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./FOLogic/Simplifications.cmt Local file: /path/to/project/src/lib/FOLogic/Typing.mli Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./FOLogic/Typing.cmt Local file: /path/to/project/src/lib/FOLogic/FOSolver.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./FOLogic/FOSolver.cmt Local file: /path/to/project/src/lib/FOLogic/Typing.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./FOLogic/Typing.cmt Local file: /path/to/project/src/lib/FOLogic/PFS.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./FOLogic/PFS.cmt Local file: /path/to/project/src/lib/FOLogic/Reduction.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./FOLogic/Reduction.cmt Local file: /path/to/project/src/lib/FOLogic/Z3Encoding.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./FOLogic/Z3Encoding.cmt Local file: /path/to/project/src/lib/FOLogic/TypEnv.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./FOLogic/TypEnv.cmt Local file: /path/to/project/src/lib/FOLogic/TypEnv.mli Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./FOLogic/TypEnv.cmt Local file: /path/to/project/src/lib/Common/CCommon.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Common/CCommon.cmt Local file: /path/to/project/src/lib/Common/Logging.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Common/Logging.cmt Local file: /path/to/project/src/lib/Common/SCommon.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Common/SCommon.cmt Local file: /path/to/project/src/lib/SymbolicSemantics/SMemory.mli Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./SymbolicSemantics/SMemory.cmt Local file: /path/to/project/src/lib/SymbolicSemantics/JSIL/SHeap.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./SymbolicSemantics/JSIL/SHeap.cmt Local file: /path/to/project/src/lib/SymbolicSemantics/JSIL/JSILSInterpreter.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./SymbolicSemantics/JSIL/JSILSInterpreter.cmt Local file: /path/to/project/src/lib/SymbolicSemantics/JSIL/SFVL.mli Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./SymbolicSemantics/JSIL/SFVL.cmt Local file: /path/to/project/src/lib/SymbolicSemantics/JSIL/SFVL.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./SymbolicSemantics/JSIL/SFVL.cmt Local file: /path/to/project/src/lib/SymbolicSemantics/JSIL/JSILSMemory.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./SymbolicSemantics/JSIL/JSILSMemory.cmt Local file: /path/to/project/src/lib/SymbolicSemantics/JSIL/SStore.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./SymbolicSemantics/JSIL/SStore.cmt Local file: /path/to/project/src/lib/SymbolicSemantics/JSIL/SStore.mli Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./SymbolicSemantics/JSIL/SStore.cmt Local file: /path/to/project/src/lib/SymbolicSemantics/SVal.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./SymbolicSemantics/SVal.cmt Local file: /path/to/project/src/lib/SymbolicSemantics/MakeSState.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./SymbolicSemantics/MakeSState.cmt Local file: /path/to/project/src/lib/SymbolicSemantics/SError.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./SymbolicSemantics/SError.cmt Local file: /path/to/project/src/lib/JSLogic/JSExpr.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./JSLogic/JSExpr.cmt Local file: /path/to/project/src/lib/JSLogic/JSLCmd.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./JSLogic/JSLCmd.cmt Local file: /path/to/project/src/lib/JSLogic/JSPred.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./JSLogic/JSPred.cmt Local file: /path/to/project/src/lib/JSLogic/JSAsrt.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./JSLogic/JSAsrt.cmt Local file: /path/to/project/src/lib/JSLogic/JSSpec.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./JSLogic/JSSpec.cmt Local file: /path/to/project/src/lib/JSLogic/JSLogicCommon.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./JSLogic/JSLogicCommon.cmt Local file: /path/to/project/src/lib/Syntax/Syntax.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/Syntax.cmt Local file: /path/to/project/src/lib/Syntax/NOp.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/NOp.cmt Local file: /path/to/project/src/lib/Syntax/UnOp.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/UnOp.cmt Local file: /path/to/project/src/lib/Syntax/Var.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/Var.cmt Local file: /path/to/project/src/lib/Syntax/BinOp.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/BinOp.cmt Local file: /path/to/project/src/lib/Syntax/General/GProg.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/General/GProg.cmt Local file: /path/to/project/src/lib/Syntax/General/GCmd.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/General/GCmd.cmt Local file: /path/to/project/src/lib/Syntax/General/GProc.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/General/GProc.cmt Local file: /path/to/project/src/lib/Syntax/General/GMacro.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/General/GMacro.cmt Local file: /path/to/project/src/lib/Syntax/General/GLCmd.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/General/GLCmd.cmt Local file: /path/to/project/src/lib/Syntax/General/GBiSpec.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/General/GBiSpec.cmt Local file: /path/to/project/src/lib/Syntax/General/GPred.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/General/GPred.cmt Local file: /path/to/project/src/lib/Syntax/General/GSpec.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/General/GSpec.cmt Local file: /path/to/project/src/lib/Syntax/General/GAsrt.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/General/GAsrt.cmt Local file: /path/to/project/src/lib/Syntax/General/GSLCmd.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/General/GSLCmd.cmt Local file: /path/to/project/src/lib/Syntax/General/LabGCmd.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/General/LabGCmd.cmt Local file: /path/to/project/src/lib/Syntax/General/LabGProc.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/General/LabGProc.cmt Local file: /path/to/project/src/lib/Syntax/General/LabGProg.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/General/LabGProg.cmt Local file: /path/to/project/src/lib/Syntax/General/GLemma.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/General/GLemma.cmt Local file: /path/to/project/src/lib/Syntax/Expr.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/Expr.cmt Local file: /path/to/project/src/lib/Syntax/Annot.mli Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/Annot.cmt Local file: /path/to/project/src/lib/Syntax/Constant.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/Constant.cmt Local file: /path/to/project/src/lib/Syntax/Formula.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/Formula.cmt Local file: /path/to/project/src/lib/Syntax/Literal.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/Literal.cmt Local file: /path/to/project/src/lib/Syntax/JSIL/SLCmd.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/JSIL/SLCmd.cmt Local file: /path/to/project/src/lib/Syntax/JSIL/JSILNames.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/JSIL/JSILNames.cmt Local file: /path/to/project/src/lib/Syntax/JSIL/JSIL_Syntax.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/JSIL/JSIL_Syntax.cmt Local file: /path/to/project/src/lib/Syntax/JSIL/EProc.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/JSIL/EProc.cmt Local file: /path/to/project/src/lib/Syntax/JSIL/EProg.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/JSIL/EProg.cmt Local file: /path/to/project/src/lib/Syntax/JSIL/Macro.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/JSIL/Macro.cmt Local file: /path/to/project/src/lib/Syntax/JSIL/BCmd.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/JSIL/BCmd.cmt Local file: /path/to/project/src/lib/Syntax/JSIL/Proc.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/JSIL/Proc.cmt Local file: /path/to/project/src/lib/Syntax/JSIL/LCmd.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/JSIL/LCmd.cmt Local file: /path/to/project/src/lib/Syntax/JSIL/Prog.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/JSIL/Prog.cmt Local file: /path/to/project/src/lib/Syntax/JSIL/LabCmd.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/JSIL/LabCmd.cmt Local file: /path/to/project/src/lib/Syntax/JSIL/Cmd.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/JSIL/Cmd.cmt Local file: /path/to/project/src/lib/Syntax/JSIL/Pred.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/JSIL/Pred.cmt Local file: /path/to/project/src/lib/Syntax/JSIL/Lemma.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/JSIL/Lemma.cmt Local file: /path/to/project/src/lib/Syntax/JSIL/BiSpec.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/JSIL/BiSpec.cmt Local file: /path/to/project/src/lib/Syntax/JSIL/Spec.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/JSIL/Spec.cmt Local file: /path/to/project/src/lib/Syntax/JSIL/Asrt.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/JSIL/Asrt.cmt Local file: /path/to/project/src/lib/Syntax/Flag.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/Flag.cmt Local file: /path/to/project/src/lib/Syntax/Type.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/Type.cmt Local file: /path/to/project/src/lib/Syntax/Annot.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./Syntax/Annot.cmt Local file: /path/to/project/src/lib/BiAbduction/MakeACTConsole.ml Local .cmt file: /path/to/project/_build/default/src/lib/.camelot.objs/camelot__./BiAbduction/MakeACTConsole.cmt Unable to read /path/to/project/src/lib/Utils/jbuild Unable to read /path/to/project/src/lib/Syntax/JSIL/jbuild Unable to read /path/to/project/src/lib/Syntax/General/jbuild Unable to read /path/to/project/src/lib/Syntax/jbuild Unable to read /path/to/project/src/lib/SymbolicSemantics/examples/passing/jbuild Unable to read /path/to/project/src/lib/SymbolicSemantics/examples/failing/jbuild Unable to read /path/to/project/src/lib/SymbolicSemantics/examples/jbuild Unable to read /path/to/project/src/lib/SymbolicSemantics/JSIL/jbuild Unable to read /path/to/project/src/lib/SymbolicSemantics/jbuild Not a library Unable to read /path/to/project/src/lib/JSLogic/runtime/jbuild Unable to read /path/to/project/src/lib/JSLogic/jbuild Unable to read /path/to/project/src/lib/JS2JSIL/runtime/jbuild Unable to read /path/to/project/src/lib/JS2JSIL/biruntime/jbuild Unable to read /path/to/project/src/lib/JS2JSIL/ES5_runtime/jbuild Unable to read /path/to/project/src/lib/JS2JSIL/jbuild Unable to read /path/to/project/src/lib/GeneralSemantics/JSIL/jbuild Unable to read /path/to/project/src/lib/GeneralSemantics/General/jbuild Unable to read /path/to/project/src/lib/GeneralSemantics/jbuild Unable to read /path/to/project/src/lib/FOLogic/jbuild Unable to read /path/to/project/src/lib/Examples/JaVerT/test262/jbuild Unable to read /path/to/project/src/lib/Examples/JaVerT/annotated/jbuild Unable to read /path/to/project/src/lib/Examples/JaVerT/jbuild Unable to read /path/to/project/src/lib/Examples/Cosette/CaseStudies/Sort/jbuild Unable to read /path/to/project/src/lib/Examples/Cosette/CaseStudies/SLL/jbuild Unable to read /path/to/project/src/lib/Examples/Cosette/CaseStudies/PriQ/jbuild Unable to read /path/to/project/src/lib/Examples/Cosette/CaseStudies/KVMap/jbuild Unable to read /path/to/project/src/lib/Examples/Cosette/CaseStudies/IDGen/jbuild Unable to read /path/to/project/src/lib/Examples/Cosette/CaseStudies/ExprEval/jbuild Unable to read /path/to/project/src/lib/Examples/Cosette/CaseStudies/DLL/jbuild Unable to read /path/to/project/src/lib/Examples/Cosette/CaseStudies/BST/jbuild Unable to read /path/to/project/src/lib/Examples/Cosette/CaseStudies/jbuild Unable to read /path/to/project/src/lib/Examples/Cosette/Buckets/stack/jbuild Unable to read /path/to/project/src/lib/Examples/Cosette/Buckets/set/jbuild Unable to read /path/to/project/src/lib/Examples/Cosette/Buckets/queue/jbuild Unable to read /path/to/project/src/lib/Examples/Cosette/Buckets/priorityqueue/jbuild Unable to read /path/to/project/src/lib/Examples/Cosette/Buckets/multidictionary/bug/jbuild Unable to read /path/to/project/src/lib/Examples/Cosette/Buckets/multidictionary/jbuild Unable to read /path/to/project/src/lib/Examples/Cosette/Buckets/linkedlist/bug/jbuild Unable to read /path/to/project/src/lib/Examples/Cosette/Buckets/linkedlist/jbuild Unable to read /path/to/project/src/lib/Examples/Cosette/Buckets/heap/jbuild Unable to read /path/to/project/src/lib/Examples/Cosette/Buckets/dictionary/jbuild Unable to read /path/to/project/src/lib/Examples/Cosette/Buckets/bstree/jbuild Unable to read /path/to/project/src/lib/Examples/Cosette/Buckets/bag/jbuild Unable to read /path/to/project/src/lib/Examples/Cosette/Buckets/arrays/jbuild Unable to read /path/to/project/src/lib/Examples/Cosette/Buckets/jbuild Unable to read /path/to/project/src/lib/Examples/Cosette/jbuild Unable to read /path/to/project/src/lib/Examples/Bi/Failing/jbuild Unable to read /path/to/project/src/lib/Examples/Bi/CaseStudies/Annotated/jbuild Unable to read /path/to/project/src/lib/Examples/Bi/CaseStudies/jbuild Unable to read /path/to/project/src/lib/Examples/Bi/Basics/jbuild Unable to read /path/to/project/src/lib/Examples/Bi/jbuild Unable to read /path/to/project/src/lib/Examples/jbuild Unable to read /path/to/project/src/lib/ConcreteSemantics/JSIL/jbuild Unable to read /path/to/project/src/lib/ConcreteSemantics/jbuild Unable to read /path/to/project/src/lib/Common/jbuild Unable to read /path/to/project/src/lib/CommandLine/jbuild Unable to read /path/to/project/src/lib/BiAbduction/jbuild Unable to read /path/to/project/src/lib/Abstraction/JSIL/jbuild Unable to read /path/to/project/src/lib/Abstraction/jbuild >> Collecting deps for /path/to/home/.opam/camelotenv/lib/z3 >> Collecting deps for /path/to/home/.opam/camelotenv/lib/yojson >> Collecting deps for /path/to/home/.opam/camelotenv/lib/ocaml/threads >> Collecting deps for /path/to/home/.opam/camelotenv/lib/ocaml >> Collecting deps for /path/to/home/.opam/camelotenv/lib/num >> Collecting deps for /path/to/home/.opam/camelotenv/lib/menhirLib >> Collecting deps for /path/to/home/.opam/camelotenv/lib/findlib >> Collecting deps for /path/to/home/.opam/camelotenv/lib/extlib >> Collecting deps for /path/to/home/.opam/camelotenv/lib/easy-format >> Collecting deps for /path/to/home/.opam/camelotenv/lib/bytes >> Collecting deps for /path/to/home/.opam/camelotenv/lib/biniou >> Collecting deps for /path/to/home/.opam/camelotenv/lib/batteries >> Collecting deps for /path/to/home/.opam/camelotenv/lib/JS_Parser-runtime >> Collecting deps for /path/to/home/.opam/camelotenv/lib/JS_Parser >> Collecting deps for /path/to/home/.opam/camelotenv/lib/ocaml Depedency dirs /path/to/home/.opam/camelotenv/lib/z3 /path/to/home/.opam/camelotenv/lib/yojson /path/to/home/.opam/camelotenv/lib/ocaml/threads /path/to/home/.opam/camelotenv/lib/ocaml /path/to/home/.opam/camelotenv/lib/num /path/to/home/.opam/camelotenv/lib/menhirLib /path/to/home/.opam/camelotenv/lib/findlib /path/to/home/.opam/camelotenv/lib/extlib /path/to/home/.opam/camelotenv/lib/easy-format /path/to/home/.opam/camelotenv/lib/bytes /path/to/home/.opam/camelotenv/lib/biniou /path/to/home/.opam/camelotenv/lib/batteries /path/to/home/.opam/camelotenv/lib/JS_Parser-runtime /path/to/home/.opam/camelotenv/lib/JS_Parser /path/to/home/.opam/camelotenv/lib/ocaml >> Build system running: opam exec -- dune build @install --root . >>> stdout >>> stderr Affected files: Cleaning bsconfig.json Sending notification {"jsonrpc": "2.0", "method": "textDocument/publishDiagnostics", "params": {"uri": "file:///path/to/project/src/lib/bsconfig.json", "diagnostics": []}} Running diagnostics for file:///path/to/project/src/lib/Utils/Arith_Utils.ml ➡️ running bsc /path/to/home/.opam/camelotenv/bin/ocamlopt.opt -c -I '/path/to/project/_build/default/src/lib/.camelot.objs' -I '/path/to/home/.opam/camelotenv/lib/z3' -I '/path/to/home/.opam/camelotenv/lib/yojson' -I '/path/to/home/.opam/camelotenv/lib/ocaml/threads' -I '/path/to/home/.opam/camelotenv/lib/ocaml' -I '/path/to/home/.opam/camelotenv/lib/num' -I '/path/to/home/.opam/camelotenv/lib/menhirLib' -I '/path/to/home/.opam/camelotenv/lib/findlib' -I '/path/to/home/.opam/camelotenv/lib/extlib' -I '/path/to/home/.opam/camelotenv/lib/easy-format' -I '/path/to/home/.opam/camelotenv/lib/bytes' -I '/path/to/home/.opam/camelotenv/lib/biniou' -I '/path/to/home/.opam/camelotenv/lib/batteries' -I '/path/to/home/.opam/camelotenv/lib/JS_Parser-runtime' -I '/path/to/home/.opam/camelotenv/lib/JS_Parser' -I '/path/to/home/.opam/camelotenv/lib/ocaml' -bin-annot -open Camelot__ -w -8-11-14-20-26-27-28-32-33-37-39-40-50-52-57 -impl /path/to/project/_build/.lsp/camelot__Arith_Utils.ast with pwd /path/to/project/src/lib << Making lastDefinitions with type error for file:///path/to/project/src/lib/Utils/Arith_Utils.ml type error here File "command line", line 1: Error: Unbound module Camelot__ Sending notification {"jsonrpc": "2.0", "method": "textDocument/publishDiagnostics", "params": {"uri": "file:///path/to/project/src/lib/Utils/Arith_Utils.ml", "diagnostics": [{"range": {"start": {"line": 0, "character": 0}, "end": {"line": 0, "character": 0}}, "message": "File \"command line\", line 1:\nError: Unbound module Camelot__", "severity": 1}]}} Read message {"jsonrpc":"2.0","id":1,"method":"textDocument/documentSymbol","params":{"textDocument":{"uri":"file:///path/to/project/src/lib/Utils/Arith_Utils.ml"}}} [server] Got a method textDocument/documentSymbol [server] processing took 0.00715255737305ms Sending response {"id": 1, "jsonrpc": "2.0", "result": []} Read message {"jsonrpc":"2.0","id":2,"method":"textDocument/codeLens","params":{"textDocument":{"uri":"file:///path/to/project/src/lib/Utils/Arith_Utils.ml"}}} [server] Got a method textDocument/codeLens [server] processing took 0.0100135803223ms Sending response {"id": 2, "jsonrpc": "2.0", "result": []} Read message {"jsonrpc":"2.0","id":3,"method":"textDocument/documentSymbol","params":{"textDocument":{"uri":"file:///path/to/project/src/lib/Utils/Arith_Utils.ml"}}} [server] Got a method textDocument/documentSymbol [server] processing took 0.00691413879395ms Sending response {"id": 3, "jsonrpc": "2.0", "result": []} Read message {"jsonrpc":"2.0","method":"textDocument/didClose","params":{"textDocument":{"uri":"file:///path/to/project/src/lib/Utils/Arith_Utils.ml"}}} Read message {"jsonrpc":"2.0","method":"$/cancelRequest","params":{"id":2}} Read message {"jsonrpc":"2.0","id":4,"method":"shutdown","params":null} Sending response {"id": 4, "jsonrpc": "2.0", "result": null} Read message {"jsonrpc":"2.0","method":"exit","params":null} Got exit! Terminating loop Finished ```

jchavarri commented 5 years ago

Due to my ignorance about Dune I reported this as a bug in that repo: https://github.com/ocaml/dune/issues/1962 but then I learnt is due to the wrapping that is done for modules that @giltho mentions above.

I think the flag is added here:

https://github.com/jaredly/reason-language-server/blob/85ab139a0bf1283eff4413f4b0c951983ddafbf5/src/analyze/State.re#L230

@jaredly Do you have any pointers or ideas on how a fix would look like? I imagine we want to stop opening that module in this case, but I guess we want to do that selectively (i.e. "don't append the name of the module to the list of opens if it's the same as the module itself?")

donut commented 5 years ago

Created a reproduction. See https://github.com/jaredly/reason-language-server/issues/105#issuecomment-482400804

jaredly commented 5 years ago

@jchavarri the latest release (with useOldDuneProcess: false) should fix this. lmk if it's still a problem

jchavarri commented 5 years ago

hey @jaredly I tested 1.6.0 in the project that was giving me problems and it seems to work now 🎉 thanks for the fix. As a curious thing, it seems to work with both useOldDuneProcess set to true or false.