From 4e236b5b13db11fb3e1004d8f38b036ac93faf45 Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Tue, 9 Jul 2024 09:28:53 +0200 Subject: [PATCH 1/3] Make the extension compilable with latest ocaml. --- analysis/vendor/ext/bsb_db.ml | 2 - analysis/vendor/ext/bsb_db.mli | 6 - analysis/vendor/ext/ext_buffer.mli | 1 - analysis/vendor/ext/ext_file_extensions.ml | 4 - analysis/vendor/ext/ext_ident.ml | 18 +- analysis/vendor/ext/js_reserved_map.ml | 887 +++---------------- analysis/vendor/ext/js_reserved_map.mli | 6 +- analysis/vendor/ext/js_runtime_modules.ml | 6 + analysis/vendor/ext/literals.ml | 8 +- analysis/vendor/ext/map_gen.mli | 2 - analysis/vendor/ext/set_gen.mli | 2 +- analysis/vendor/ext/warnings.ml | 9 +- analysis/vendor/js_parser/flow_ast_mapper.ml | 3 +- 13 files changed, 164 insertions(+), 790 deletions(-) diff --git a/analysis/vendor/ext/bsb_db.ml b/analysis/vendor/ext/bsb_db.ml index 001824a5f..6ce515499 100644 --- a/analysis/vendor/ext/bsb_db.ml +++ b/analysis/vendor/ext/bsb_db.ml @@ -31,12 +31,10 @@ type info = | Impl | Impl_intf -type syntax_kind = Ml | Res type module_info = { mutable info : info; dir : string; - syntax_kind : syntax_kind; case : bool; name_sans_extension : string; } diff --git a/analysis/vendor/ext/bsb_db.mli b/analysis/vendor/ext/bsb_db.mli index 31df8b685..d4a8cfe43 100644 --- a/analysis/vendor/ext/bsb_db.mli +++ b/analysis/vendor/ext/bsb_db.mli @@ -37,16 +37,10 @@ type info = | Impl | Impl_intf -type syntax_kind = Ml | Res type module_info = { mutable info : info; dir : string; - syntax_kind : syntax_kind; - (* This is actually not stored in bsbuild meta info - since creating .d file only emit .cmj/.cmi dependencies, so it does not - need know which syntax it is written - *) case : bool; name_sans_extension : string; } diff --git a/analysis/vendor/ext/ext_buffer.mli b/analysis/vendor/ext/ext_buffer.mli index 38ae58e8a..a00115b95 100644 --- a/analysis/vendor/ext/ext_buffer.mli +++ b/analysis/vendor/ext/ext_buffer.mli @@ -51,7 +51,6 @@ val clear : t -> unit (** Empty the buffer. *) val add_char : t -> char -> unit - [@@inline] (** [add_char b c] appends the character [c] at the end of the buffer [b]. *) val add_string : t -> string -> unit diff --git a/analysis/vendor/ext/ext_file_extensions.ml b/analysis/vendor/ext/ext_file_extensions.ml index 5449c417f..8cd52c569 100644 --- a/analysis/vendor/ext/ext_file_extensions.ml +++ b/analysis/vendor/ext/ext_file_extensions.ml @@ -1,6 +1,4 @@ type valid_input = - | Ml - | Mli | Res | Resi | Intf_ast @@ -16,8 +14,6 @@ type valid_input = let classify_input ext = match () with - | _ when ext = Literals.suffix_ml -> Ml - | _ when ext = !Config.interface_suffix -> Mli | _ when ext = Literals.suffix_ast -> Impl_ast | _ when ext = Literals.suffix_iast -> Intf_ast | _ when ext = Literals.suffix_mlmap -> Mlmap diff --git a/analysis/vendor/ext/ext_ident.ml b/analysis/vendor/ext/ext_ident.ml index 272a21b43..4f1e6dfa7 100644 --- a/analysis/vendor/ext/ext_ident.ml +++ b/analysis/vendor/ext/ext_ident.ml @@ -23,12 +23,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) - - - - - - let js_flag = 0b1_000 (* check with ocaml compiler *) (* let js_module_flag = 0b10_000 (\* javascript external modules *\) *) @@ -172,18 +166,14 @@ let name_mangle name = Ext_buffer.add_string buffer (convert ~op:(i=0) c) done; Ext_buffer.contents buffer -(* TODO: - check name conflicts with javascript conventions - {[ - Ext_ident.convert "^";; - - : string = "$caret" - ]} - [convert name] if [name] is a js keyword,add "$$" +(** + [convert name] if [name] is a js keyword or js global, add "$$" otherwise do the name mangling to make sure ocaml identifier it is a valid js identifier *) let convert (name : string) = - if Js_reserved_map.is_reserved name then + let name = unwrap_uppercase_exotic name in + if Js_reserved_map.is_js_keyword name || Js_reserved_map.is_js_global name then "$$" ^ name else name_mangle name diff --git a/analysis/vendor/ext/js_reserved_map.ml b/analysis/vendor/ext/js_reserved_map.ml index a5eaeeca9..8918dabd1 100644 --- a/analysis/vendor/ext/js_reserved_map.ml +++ b/analysis/vendor/ext/js_reserved_map.ml @@ -1,4 +1,3 @@ - (* Copyright (C) 2019-Present Hongbo Zhang, Authors of ReScript * * This program is free software: you can redistribute it and/or modify @@ -23,798 +22,198 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -let sorted_keywords = [| - "AbortController"; - "AbortSignal"; - "AbstractRange"; - "ActiveXObject"; +module STbl = struct + include Hashtbl.Make (String) + + let of_array arr = + let tbl = create (Array.length arr) in + let () = Array.iter (fun el -> add tbl el ()) arr in + tbl +end + +(** Words that can never be identifier's name. + + See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#reserved_words + *) +let js_keywords = STbl.of_array [| + "break"; + "case"; + "catch"; + "class"; + "const"; + "continue"; + "debugger"; + "default"; + "delete"; + "do"; + "else"; + "export"; + "extends"; + "false"; + "finally"; + "for"; + "function"; + "if"; + "import"; + "in"; + "instanceof"; + "new"; + "null"; + "return"; + "super"; + "switch"; + "this"; + "throw"; + "true"; + "try"; + "typeof"; + "var"; + "void"; + "while"; + "with"; + (* The following are also reserved in strict context, including ESM *) + "let"; + "static"; + "yield"; + (* `await` is reserved in async context, including ESM *) + "await"; + (* Future reserved words *) + "enum"; + "implements"; + "interface"; + "package"; + "private"; + "protected"; + "public"; +|] + +let is_js_keyword s = STbl.mem js_keywords s + +(** Identifiers with special meanings. + + They can have different meanings depending on the context when used as identifier names, so it should be done carefully. + + See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#identifiers_with_special_meanings + + However, these names are actually used with no problems today. Preventing this can be annoying. + *) +let js_special_words = STbl.of_array [| + "arguments"; + "as"; + "async"; + "eval"; + "from"; + "get"; + "of"; + "set"; +|] + +let is_js_special_word s = STbl.mem js_special_words s + +(** Identifier names _might_ need to care about *) +let js_globals = STbl.of_array [| + (* JavaScript standards built-ins + See https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects + *) "AggregateError"; - "AnalyserNode"; - "Animation"; - "AnimationEffect"; - "AnimationEvent"; - "AnimationPlaybackEvent"; - "AnimationTimeline"; "Array"; "ArrayBuffer"; + "AsyncFunction"; + "AsyncGenerator"; + "AsyncGeneratorFunction"; + "AsyncIterator"; "Atomics"; - "Attr"; - "Audio"; - "AudioBuffer"; - "AudioBufferSourceNode"; - "AudioContext"; - "AudioData"; - "AudioDestinationNode"; - "AudioListener"; - "AudioNode"; - "AudioParam"; - "AudioParamMap"; - "AudioProcessingEvent"; - "AudioScheduledSourceNode"; - "AudioSinkInfo"; - "AudioWorkletNode"; - "BackgroundFetchManager"; - "BackgroundFetchRecord"; - "BackgroundFetchRegistration"; - "BarProp"; - "BaseAudioContext"; - "BeforeInstallPromptEvent"; - "BeforeUnloadEvent"; "BigInt"; "BigInt64Array"; "BigUint64Array"; - "BiquadFilterNode"; - "Blob"; - "BlobEvent"; - "BluetoothUUID"; "Boolean"; - "BroadcastChannel"; - "BrowserCaptureMediaStreamTrack"; - "Buffer"; - "Bun"; - "ByteLengthQueuingStrategy"; - "CDATASection"; - "CSS"; - "CSSAnimation"; - "CSSConditionRule"; - "CSSContainerRule"; - "CSSCounterStyleRule"; - "CSSFontFaceRule"; - "CSSFontPaletteValuesRule"; - "CSSGroupingRule"; - "CSSImageValue"; - "CSSImportRule"; - "CSSKeyframeRule"; - "CSSKeyframesRule"; - "CSSKeywordValue"; - "CSSLayerBlockRule"; - "CSSLayerStatementRule"; - "CSSMathClamp"; - "CSSMathInvert"; - "CSSMathMax"; - "CSSMathMin"; - "CSSMathNegate"; - "CSSMathProduct"; - "CSSMathSum"; - "CSSMathValue"; - "CSSMatrixComponent"; - "CSSMediaRule"; - "CSSNamespaceRule"; - "CSSNumericArray"; - "CSSNumericValue"; - "CSSPageRule"; - "CSSPerspective"; - "CSSPositionValue"; - "CSSPropertyRule"; - "CSSRotate"; - "CSSRule"; - "CSSRuleList"; - "CSSScale"; - "CSSSkew"; - "CSSSkewX"; - "CSSSkewY"; - "CSSStyleDeclaration"; - "CSSStyleRule"; - "CSSStyleSheet"; - "CSSStyleValue"; - "CSSSupportsRule"; - "CSSTransformComponent"; - "CSSTransformValue"; - "CSSTransition"; - "CSSTranslate"; - "CSSUnitValue"; - "CSSUnparsedValue"; - "CSSVariableReferenceValue"; - "CanvasCaptureMediaStreamTrack"; - "CanvasGradient"; - "CanvasPattern"; - "CanvasRenderingContext2D"; - "ChannelMergerNode"; - "ChannelSplitterNode"; - "CharacterData"; - "ClipboardEvent"; - "CloseEvent"; - "Comment"; - "CompositionEvent"; - "CompressionStream"; - "ConstantSourceNode"; - "ContentVisibilityAutoStateChangeEvent"; - "ConvolverNode"; - "CountQueuingStrategy"; - "CropTarget"; - "Crypto"; - "CustomElementRegistry"; - "CustomEvent"; - "CustomStateSet"; - "DOMError"; - "DOMException"; - "DOMImplementation"; - "DOMMatrix"; - "DOMMatrixReadOnly"; - "DOMParser"; - "DOMPoint"; - "DOMPointReadOnly"; - "DOMQuad"; - "DOMRect"; - "DOMRectList"; - "DOMRectReadOnly"; - "DOMStringList"; - "DOMStringMap"; - "DOMTokenList"; - "DataTransfer"; - "DataTransferItem"; - "DataTransferItemList"; "DataView"; "Date"; - "DecompressionStream"; - "DelayNode"; - "DelegatedInkTrailPresenter"; - "Deno"; - "Document"; - "DocumentFragment"; - "DocumentPictureInPictureEvent"; - "DocumentTimeline"; - "DocumentType"; - "DragEvent"; - "DynamicsCompressorNode"; - "Element"; - "ElementInternals"; - "EncodedAudioChunk"; - "EncodedVideoChunk"; + "decodeURI"; + "decodeURIComponent"; + "encodeURI"; + "encodeURIComponent"; "Error"; - "ErrorEvent"; + "eval"; "EvalError"; - "Event"; - "EventCounts"; - "EventSource"; - "EventTarget"; - "External"; - "FeaturePolicy"; - "File"; - "FileList"; - "FileReader"; "FinalizationRegistry"; + "Float16Array"; "Float32Array"; "Float64Array"; - "FocusEvent"; - "FontFace"; - "FontFaceSetLoadEvent"; - "FormData"; - "FormDataEvent"; - "FragmentDirective"; "Function"; - "GainNode"; - "Gamepad"; - "GamepadButton"; - "GamepadEvent"; - "GamepadHapticActuator"; - "Geolocation"; - "GeolocationCoordinates"; - "GeolocationPosition"; - "GeolocationPositionError"; - "HTMLAllCollection"; - "HTMLAnchorElement"; - "HTMLAreaElement"; - "HTMLAudioElement"; - "HTMLBRElement"; - "HTMLBaseElement"; - "HTMLBodyElement"; - "HTMLButtonElement"; - "HTMLCanvasElement"; - "HTMLCollection"; - "HTMLDListElement"; - "HTMLDataElement"; - "HTMLDataListElement"; - "HTMLDetailsElement"; - "HTMLDialogElement"; - "HTMLDirectoryElement"; - "HTMLDivElement"; - "HTMLDocument"; - "HTMLElement"; - "HTMLEmbedElement"; - "HTMLFieldSetElement"; - "HTMLFontElement"; - "HTMLFormControlsCollection"; - "HTMLFormElement"; - "HTMLFrameElement"; - "HTMLFrameSetElement"; - "HTMLHRElement"; - "HTMLHeadElement"; - "HTMLHeadingElement"; - "HTMLHtmlElement"; - "HTMLIFrameElement"; - "HTMLImageElement"; - "HTMLInputElement"; - "HTMLLIElement"; - "HTMLLabelElement"; - "HTMLLegendElement"; - "HTMLLinkElement"; - "HTMLMapElement"; - "HTMLMarqueeElement"; - "HTMLMediaElement"; - "HTMLMenuElement"; - "HTMLMetaElement"; - "HTMLMeterElement"; - "HTMLModElement"; - "HTMLOListElement"; - "HTMLObjectElement"; - "HTMLOptGroupElement"; - "HTMLOptionElement"; - "HTMLOptionsCollection"; - "HTMLOutputElement"; - "HTMLParagraphElement"; - "HTMLParamElement"; - "HTMLPictureElement"; - "HTMLPreElement"; - "HTMLProgressElement"; - "HTMLQuoteElement"; - "HTMLScriptElement"; - "HTMLSelectElement"; - "HTMLSlotElement"; - "HTMLSourceElement"; - "HTMLSpanElement"; - "HTMLStyleElement"; - "HTMLTableCaptionElement"; - "HTMLTableCellElement"; - "HTMLTableColElement"; - "HTMLTableElement"; - "HTMLTableRowElement"; - "HTMLTableSectionElement"; - "HTMLTemplateElement"; - "HTMLTextAreaElement"; - "HTMLTimeElement"; - "HTMLTitleElement"; - "HTMLTrackElement"; - "HTMLUListElement"; - "HTMLUnknownElement"; - "HTMLVideoElement"; - "HashChangeEvent"; - "Headers"; - "Highlight"; - "HighlightRegistry"; - "History"; - "IDBCursor"; - "IDBCursorWithValue"; - "IDBDatabase"; - "IDBFactory"; - "IDBIndex"; - "IDBKeyRange"; - "IDBObjectStore"; - "IDBOpenDBRequest"; - "IDBRequest"; - "IDBTransaction"; - "IDBVersionChangeEvent"; - "IIRFilterNode"; - "IdleDeadline"; - "Image"; - "ImageBitmap"; - "ImageBitmapRenderingContext"; - "ImageCapture"; - "ImageData"; - "ImageTrack"; - "ImageTrackList"; + "Generator"; + "GeneratorFunction"; + "globalThis"; "Infinity"; - "Ink"; - "InputDeviceCapabilities"; - "InputDeviceInfo"; - "InputEvent"; "Int16Array"; "Int32Array"; "Int8Array"; - "IntersectionObserver"; - "IntersectionObserverEntry"; "Intl"; + "isFinite"; + "isNaN"; + "Iterator"; "JSON"; - "KeyboardEvent"; - "KeyframeEffect"; - "LargestContentfulPaint"; - "LaunchParams"; - "LaunchQueue"; - "LayoutShift"; - "LayoutShiftAttribution"; - "Location"; "Map"; "Math"; - "MathMLElement"; - "MediaCapabilities"; - "MediaElementAudioSourceNode"; - "MediaEncryptedEvent"; - "MediaError"; - "MediaList"; - "MediaMetadata"; - "MediaQueryList"; - "MediaQueryListEvent"; - "MediaRecorder"; - "MediaSession"; - "MediaSource"; - "MediaSourceHandle"; - "MediaStream"; - "MediaStreamAudioDestinationNode"; - "MediaStreamAudioSourceNode"; - "MediaStreamEvent"; - "MediaStreamTrack"; - "MediaStreamTrackEvent"; - "MediaStreamTrackGenerator"; - "MediaStreamTrackProcessor"; - "MessageChannel"; - "MessageEvent"; - "MessagePort"; - "MimeType"; - "MimeTypeArray"; - "MouseEvent"; - "MutationEvent"; - "MutationObserver"; - "MutationRecord"; "NaN"; - "NamedNodeMap"; - "NavigateEvent"; - "Navigation"; - "NavigationCurrentEntryChangeEvent"; - "NavigationDestination"; - "NavigationHistoryEntry"; - "NavigationTransition"; - "Navigator"; - "NavigatorUAData"; - "NetworkInformation"; - "Node"; - "NodeFilter"; - "NodeIterator"; - "NodeList"; - "Notification"; "Number"; "Object"; - "OfflineAudioCompletionEvent"; - "OfflineAudioContext"; - "OffscreenCanvas"; - "OffscreenCanvasRenderingContext2D"; - "Option"; - "OscillatorNode"; - "OverconstrainedError"; - "PageTransitionEvent"; - "PannerNode"; - "Path2D"; - "PaymentManager"; - "PaymentRequestUpdateEvent"; - "Performance"; - "PerformanceElementTiming"; - "PerformanceEntry"; - "PerformanceEventTiming"; - "PerformanceLongTaskTiming"; - "PerformanceMark"; - "PerformanceMeasure"; - "PerformanceNavigation"; - "PerformanceNavigationTiming"; - "PerformanceObserver"; - "PerformanceObserverEntryList"; - "PerformancePaintTiming"; - "PerformanceResourceTiming"; - "PerformanceServerTiming"; - "PerformanceTiming"; - "PeriodicSyncManager"; - "PeriodicWave"; - "PermissionStatus"; - "Permissions"; - "PictureInPictureEvent"; - "PictureInPictureWindow"; - "Plugin"; - "PluginArray"; - "PointerEvent"; - "PopStateEvent"; - "ProcessingInstruction"; - "Profiler"; - "ProgressEvent"; + "parseFloat"; + "parseInt"; "Promise"; - "PromiseRejectionEvent"; "Proxy"; - "PushManager"; - "PushSubscription"; - "PushSubscriptionOptions"; - "RTCCertificate"; - "RTCDTMFSender"; - "RTCDTMFToneChangeEvent"; - "RTCDataChannel"; - "RTCDataChannelEvent"; - "RTCDtlsTransport"; - "RTCEncodedAudioFrame"; - "RTCEncodedVideoFrame"; - "RTCError"; - "RTCErrorEvent"; - "RTCIceCandidate"; - "RTCIceTransport"; - "RTCPeerConnection"; - "RTCPeerConnectionIceErrorEvent"; - "RTCPeerConnectionIceEvent"; - "RTCRtpReceiver"; - "RTCRtpSender"; - "RTCRtpTransceiver"; - "RTCSctpTransport"; - "RTCSessionDescription"; - "RTCStatsReport"; - "RTCTrackEvent"; - "RadioNodeList"; - "Range"; "RangeError"; - "ReadableByteStreamController"; - "ReadableStream"; - "ReadableStreamBYOBReader"; - "ReadableStreamBYOBRequest"; - "ReadableStreamDefaultController"; - "ReadableStreamDefaultReader"; "ReferenceError"; "Reflect"; "RegExp"; - "RemotePlayback"; - "ReportingObserver"; - "Request"; - "ResizeObserver"; - "ResizeObserverEntry"; - "ResizeObserverSize"; - "Response"; - "SVGAElement"; - "SVGAngle"; - "SVGAnimateElement"; - "SVGAnimateMotionElement"; - "SVGAnimateTransformElement"; - "SVGAnimatedAngle"; - "SVGAnimatedBoolean"; - "SVGAnimatedEnumeration"; - "SVGAnimatedInteger"; - "SVGAnimatedLength"; - "SVGAnimatedLengthList"; - "SVGAnimatedNumber"; - "SVGAnimatedNumberList"; - "SVGAnimatedPreserveAspectRatio"; - "SVGAnimatedRect"; - "SVGAnimatedString"; - "SVGAnimatedTransformList"; - "SVGAnimationElement"; - "SVGCircleElement"; - "SVGClipPathElement"; - "SVGComponentTransferFunctionElement"; - "SVGDefsElement"; - "SVGDescElement"; - "SVGElement"; - "SVGEllipseElement"; - "SVGFEBlendElement"; - "SVGFEColorMatrixElement"; - "SVGFEComponentTransferElement"; - "SVGFECompositeElement"; - "SVGFEConvolveMatrixElement"; - "SVGFEDiffuseLightingElement"; - "SVGFEDisplacementMapElement"; - "SVGFEDistantLightElement"; - "SVGFEDropShadowElement"; - "SVGFEFloodElement"; - "SVGFEFuncAElement"; - "SVGFEFuncBElement"; - "SVGFEFuncGElement"; - "SVGFEFuncRElement"; - "SVGFEGaussianBlurElement"; - "SVGFEImageElement"; - "SVGFEMergeElement"; - "SVGFEMergeNodeElement"; - "SVGFEMorphologyElement"; - "SVGFEOffsetElement"; - "SVGFEPointLightElement"; - "SVGFESpecularLightingElement"; - "SVGFESpotLightElement"; - "SVGFETileElement"; - "SVGFETurbulenceElement"; - "SVGFilterElement"; - "SVGForeignObjectElement"; - "SVGGElement"; - "SVGGeometryElement"; - "SVGGradientElement"; - "SVGGraphicsElement"; - "SVGImageElement"; - "SVGLength"; - "SVGLengthList"; - "SVGLineElement"; - "SVGLinearGradientElement"; - "SVGMPathElement"; - "SVGMarkerElement"; - "SVGMaskElement"; - "SVGMatrix"; - "SVGMetadataElement"; - "SVGNumber"; - "SVGNumberList"; - "SVGPathElement"; - "SVGPatternElement"; - "SVGPoint"; - "SVGPointList"; - "SVGPolygonElement"; - "SVGPolylineElement"; - "SVGPreserveAspectRatio"; - "SVGRadialGradientElement"; - "SVGRect"; - "SVGRectElement"; - "SVGSVGElement"; - "SVGScriptElement"; - "SVGSetElement"; - "SVGStopElement"; - "SVGStringList"; - "SVGStyleElement"; - "SVGSwitchElement"; - "SVGSymbolElement"; - "SVGTSpanElement"; - "SVGTextContentElement"; - "SVGTextElement"; - "SVGTextPathElement"; - "SVGTextPositioningElement"; - "SVGTitleElement"; - "SVGTransform"; - "SVGTransformList"; - "SVGUnitTypes"; - "SVGUseElement"; - "SVGViewElement"; - "Scheduler"; - "Scheduling"; - "Screen"; - "ScreenOrientation"; - "ScriptProcessorNode"; - "ScrollTimeline"; - "SecurityPolicyViolationEvent"; - "Selection"; "Set"; - "ShadowRoot"; - "SharedWorker"; - "SourceBuffer"; - "SourceBufferList"; - "SpeechSynthesisErrorEvent"; - "SpeechSynthesisEvent"; - "SpeechSynthesisUtterance"; - "StaticRange"; - "StereoPannerNode"; - "Storage"; - "StorageEvent"; + "SharedArrayBuffer"; "String"; - "StylePropertyMap"; - "StylePropertyMapReadOnly"; - "StyleSheet"; - "StyleSheetList"; - "SubmitEvent"; "Symbol"; - "SyncManager"; "SyntaxError"; - "TaskAttributionTiming"; - "TaskController"; - "TaskPriorityChangeEvent"; - "TaskSignal"; - "Text"; - "TextDecoder"; - "TextDecoderStream"; - "TextEncoder"; - "TextEncoderStream"; - "TextEvent"; - "TextMetrics"; - "TextTrack"; - "TextTrackCue"; - "TextTrackCueList"; - "TextTrackList"; - "TimeRanges"; - "ToggleEvent"; - "Touch"; - "TouchEvent"; - "TouchList"; - "TrackEvent"; - "TransformStream"; - "TransformStreamDefaultController"; - "TransitionEvent"; - "TreeWalker"; - "TrustedHTML"; - "TrustedScript"; - "TrustedScriptURL"; - "TrustedTypePolicy"; - "TrustedTypePolicyFactory"; + "TypedArray"; "TypeError"; - "UIEvent"; - "URIError"; - "URL"; - "URLPattern"; - "URLSearchParams"; "Uint16Array"; "Uint32Array"; "Uint8Array"; "Uint8ClampedArray"; - "UserActivation"; - "VTTCue"; - "ValidityState"; - "VideoColorSpace"; - "VideoFrame"; - "VideoPlaybackQuality"; - "ViewTimeline"; - "ViewTransition"; - "VirtualKeyboardGeometryChangeEvent"; - "VisibilityStateEntry"; - "VisualViewport"; - "WaveShaperNode"; + "undefined"; + "URIError"; "WeakMap"; "WeakRef"; "WeakSet"; - "WebAssembly"; - "WebGL2RenderingContext"; - "WebGLActiveInfo"; - "WebGLBuffer"; - "WebGLContextEvent"; - "WebGLFramebuffer"; - "WebGLProgram"; - "WebGLQuery"; - "WebGLRenderbuffer"; - "WebGLRenderingContext"; - "WebGLSampler"; - "WebGLShader"; - "WebGLShaderPrecisionFormat"; - "WebGLSync"; - "WebGLTexture"; - "WebGLTransformFeedback"; - "WebGLUniformLocation"; - "WebGLVertexArrayObject"; - "WebKitCSSMatrix"; - "WebKitMutationObserver"; - "WebSocket"; - "WheelEvent"; - "Window"; - "WindowControlsOverlay"; - "WindowControlsOverlayGeometryChangeEvent"; - "Worker"; - "WritableStream"; - "WritableStreamDefaultController"; - "WritableStreamDefaultWriter"; - "XDomainRequest"; - "XMLDocument"; - "XMLHttpRequest"; - "XMLHttpRequestEventTarget"; - "XMLHttpRequestUpload"; - "XMLSerializer"; - "XPathEvaluator"; - "XPathExpression"; - "XPathResult"; - "XSLTProcessor"; - "__dirname"; - "__esModule"; - "__filename"; - "abstract"; - "arguments"; - "await"; - "boolean"; - "break"; - "byte"; - "case"; - "catch"; - "char"; - "class"; - "clearImmediate"; - "clearInterval"; - "clearTimeout"; - "console"; - "const"; - "continue"; - "debugger"; - "decodeURI"; - "decodeURIComponent"; - "default"; - "delete"; - "do"; + + (* A few of the HTML standard globals + + See https://developer.mozilla.org/en-US/docs/Web/API/Window + See https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope + + But we don't actually need to protect these names. + + "window"; + "self"; "document"; - "double"; - "else"; - "encodeURI"; - "encodeURIComponent"; - "enum"; - "escape"; - "eval"; - "event"; - "export"; - "exports"; - "extends"; - "false"; - "fetch"; - "final"; - "finally"; - "float"; - "for"; - "function"; - "global"; - "goto"; - "if"; - "implements"; - "import"; - "in"; - "instanceof"; - "int"; - "interface"; - "isFinite"; - "isNaN"; - "let"; "location"; - "long"; - "module"; - "native"; "navigator"; - "new"; - "null"; - "package"; - "parseFloat"; - "parseInt"; - "private"; - "process"; - "protected"; - "public"; - "require"; - "return"; - "setImmediate"; - "setInterval"; - "setTimeout"; - "short"; - "static"; - "super"; - "switch"; - "synchronized"; - "this"; - "throw"; - "transient"; - "true"; - "try"; - "typeof"; - "undefined"; - "unescape"; - "var"; - "void"; - "volatile"; - "while"; - "window"; - "with"; - "yield"; - |] - + "origin"; + *) -type element = string + (* A few of the Node.js globals + + Specifically related to the CommonJS module system + They cannot be redeclared in nested scope. + *) + "__dirname"; + "__filename"; + "require"; + "module"; + "exports"; -let rec binary_search_aux (arr : element array) (lo : int) (hi : int) key : bool = - let mid = (lo + hi)/2 in - let mid_val = Array.unsafe_get arr mid in - (* let c = cmp key midVal [@bs] in *) - if key = mid_val then true - else if key < mid_val then (* a[lo] =< key < a[mid] <= a[hi] *) - if hi = mid then - (Array.unsafe_get arr lo) = key - else binary_search_aux arr lo mid key - else (* a[lo] =< a[mid] < key <= a[hi] *) - if lo = mid then - (Array.unsafe_get arr hi) = key - else binary_search_aux arr mid hi key + (* Bun's global namespace *) + "Bun"; -let binary_search (sorted : element array) (key : element) : bool = - let len = Array.length sorted in - if len = 0 then false - else - let lo = Array.unsafe_get sorted 0 in - (* let c = cmp key lo [@bs] in *) - if key < lo then false - else - let hi = Array.unsafe_get sorted (len - 1) in - (* let c2 = cmp key hi [@bs]in *) - if key > hi then false - else binary_search_aux sorted 0 (len - 1) key + (* Deno's global namespace *) + "Deno"; +|] -let is_reserved s = binary_search sorted_keywords s +let is_js_global s = STbl.mem js_globals s diff --git a/analysis/vendor/ext/js_reserved_map.mli b/analysis/vendor/ext/js_reserved_map.mli index 072737f89..cf4e1cb2b 100644 --- a/analysis/vendor/ext/js_reserved_map.mli +++ b/analysis/vendor/ext/js_reserved_map.mli @@ -22,4 +22,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) -val is_reserved : string -> bool +val is_js_keyword: string -> bool + +val is_js_special_word: string -> bool + +val is_js_global: string -> bool diff --git a/analysis/vendor/ext/js_runtime_modules.ml b/analysis/vendor/ext/js_runtime_modules.ml index 9c2b3b9ea..71e2efa94 100644 --- a/analysis/vendor/ext/js_runtime_modules.ml +++ b/analysis/vendor/ext/js_runtime_modules.ml @@ -70,3 +70,9 @@ let external_polyfill = "Caml_external_polyfill" let caml_js_exceptions = "Caml_js_exceptions" let caml_splice_call = "Caml_splice_call" + +let deriving = "Runtime_deriving" + +let promise = "Runtime_promise" + +let astExtensions = "Runtime_ast_extensions" diff --git a/analysis/vendor/ext/literals.ml b/analysis/vendor/ext/literals.ml index b1aa1c2bc..34163c0c6 100644 --- a/analysis/vendor/ext/literals.ml +++ b/analysis/vendor/ext/literals.ml @@ -99,10 +99,6 @@ let suffix_cmxa = ".cmxa" let suffix_mll = ".mll" -let suffix_ml = ".ml" - -let suffix_mli = ".mli" - let suffix_res = ".res" let suffix_resi = ".resi" @@ -130,10 +126,10 @@ let esmodule = "esmodule" let commonjs = "commonjs" let es6 = "es6" -[@@ocaml.deprecated "Will be removed in v12"] +(* [@@deprecated "Will be removed in v12"] *) let es6_global = "es6-global" -[@@ocaml.deprecated "Will be removed in v12"] +(* [@@deprecated "Will be removed in v12"] *) let unused_attribute = "Unused attribute " diff --git a/analysis/vendor/ext/map_gen.mli b/analysis/vendor/ext/map_gen.mli index 4ecd0070e..a1452460a 100644 --- a/analysis/vendor/ext/map_gen.mli +++ b/analysis/vendor/ext/map_gen.mli @@ -22,10 +22,8 @@ val height : ('a, 'b) t -> int val singleton : 'a -> 'b -> ('a, 'b) t val unsafe_node : 'a -> 'b -> ('a, 'b) t -> ('a, 'b) t -> int -> ('a, 'b) t - [@@inline] val unsafe_two_elements : 'a -> 'b -> 'a -> 'b -> ('a, 'b) t - [@@inline] (** smaller comes first *) val bal : ('a, 'b) t -> 'a -> 'b -> ('a, 'b) t -> ('a, 'b) t diff --git a/analysis/vendor/ext/set_gen.mli b/analysis/vendor/ext/set_gen.mli index a1c838c55..0dac4f595 100644 --- a/analysis/vendor/ext/set_gen.mli +++ b/analysis/vendor/ext/set_gen.mli @@ -5,7 +5,7 @@ type 'a t = private val empty : 'a t -val is_empty : 'a t -> bool [@@inline] +val is_empty : 'a t -> bool val unsafe_two_elements : 'a -> 'a -> 'a t diff --git a/analysis/vendor/ext/warnings.ml b/analysis/vendor/ext/warnings.ml index f9f063d3f..ed53ecd69 100644 --- a/analysis/vendor/ext/warnings.ml +++ b/analysis/vendor/ext/warnings.ml @@ -367,13 +367,8 @@ let message = function "this statement never returns (or has an unsound type.)" | Preprocessor s -> s | Useless_record_with -> ( - match !Config.syntax_kind with - | `ml -> - "all the fields are explicitly listed in this record:\n\ - the 'with' clause is useless." - | `rescript -> - "All the fields are already explicitly listed in this record. You \ - can remove the `...` spread.") + "All the fields are already explicitly listed in this record. You \ + can remove the `...` spread.") | Bad_module_name modname -> "This file's name is potentially invalid. The build systems \ conventionally turn a file name into a module name by upper-casing the \ diff --git a/analysis/vendor/js_parser/flow_ast_mapper.ml b/analysis/vendor/js_parser/flow_ast_mapper.ml index 60050c7bf..91ff1f162 100644 --- a/analysis/vendor/js_parser/flow_ast_mapper.ml +++ b/analysis/vendor/js_parser/flow_ast_mapper.ml @@ -1504,8 +1504,7 @@ class ['loc] mapper = updated to override those individually. *) method function_expression_or_method loc (stmt : ('loc, 'loc) Ast.Function.t) = this#function_ loc stmt - [@@alert deprecated "Use either function_expression or class_method"] - + (* Internal helper for function declarations, function expressions and arrow functions *) method function_ _loc (expr : ('loc, 'loc) Ast.Function.t) = let open Ast.Function in From fd0073e2740b1f53aaf20c7eae21c9b9143a7112 Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Tue, 9 Jul 2024 10:00:43 +0200 Subject: [PATCH 2/3] Remove `.ml` files from tests. --- .../examples/example-project/src/SomeFile.ml | 7 - .../larger-project/src/identifiable.ml | 257 --------------- .../examples/deadcode/expected/deadcode.txt | 309 +----------------- .../examples/deadcode/src/DeadMl.bs.js | 113 ------- .../reanalyze/examples/deadcode/src/DeadMl.ml | 114 ------- analysis/tests/src/TableclothMap.ml | 11 - analysis/tests/src/TableclothMap.mli | 3 - analysis/tests/src/TableclothMap.res | 12 + analysis/tests/src/TableclothMap.resi | 3 + .../src/expected/CompletionAttributes.res.txt | 36 -- .../tests/src/expected/TableclothMap.res.txt | 0 .../tests/src/expected/TableclothMap.resi.txt | 0 12 files changed, 16 insertions(+), 849 deletions(-) delete mode 100644 analysis/examples/example-project/src/SomeFile.ml delete mode 100644 analysis/examples/larger-project/src/identifiable.ml delete mode 100644 analysis/reanalyze/examples/deadcode/src/DeadMl.bs.js delete mode 100644 analysis/reanalyze/examples/deadcode/src/DeadMl.ml delete mode 100644 analysis/tests/src/TableclothMap.ml delete mode 100644 analysis/tests/src/TableclothMap.mli create mode 100644 analysis/tests/src/TableclothMap.res create mode 100644 analysis/tests/src/TableclothMap.resi create mode 100644 analysis/tests/src/expected/TableclothMap.res.txt create mode 100644 analysis/tests/src/expected/TableclothMap.resi.txt diff --git a/analysis/examples/example-project/src/SomeFile.ml b/analysis/examples/example-project/src/SomeFile.ml deleted file mode 100644 index 82babab72..000000000 --- a/analysis/examples/example-project/src/SomeFile.ml +++ /dev/null @@ -1,7 +0,0 @@ -let x = 10 - -let y = 20 - -let m x y = - let z = x + y in - z diff --git a/analysis/examples/larger-project/src/identifiable.ml b/analysis/examples/larger-project/src/identifiable.ml deleted file mode 100644 index 9437f3ebc..000000000 --- a/analysis/examples/larger-project/src/identifiable.ml +++ /dev/null @@ -1,257 +0,0 @@ -(**************************************************************************) -(* *) -(* OCaml *) -(* *) -(* Pierre Chambart, OCamlPro *) -(* Mark Shinwell and Leo White, Jane Street Europe *) -(* *) -(* Copyright 2013--2016 OCamlPro SAS *) -(* Copyright 2014--2016 Jane Street Group LLC *) -(* *) -(* All rights reserved. This file is distributed under the terms of *) -(* the GNU Lesser General Public License version 2.1, with the *) -(* special exception on linking described in the file LICENSE. *) -(* *) -(**************************************************************************) - -open P - -module type Thing = sig - type t - - include Hashtbl.HashedType with type t := t - include Map.OrderedType with type t := t - - val output : out_channel -> t -> unit - val print : Format.formatter -> t -> unit -end - -module type Set = sig - module T : Set.OrderedType - include Set.S - with type elt = T.t - and type t = Set.Make (T).t - - val output : out_channel -> t -> unit - val print : Format.formatter -> t -> unit - val to_string : t -> string - val of_list : elt list -> t - val map : (elt -> elt) -> t -> t -end - -module type Map = sig - module T : Map.OrderedType - include Map.S - with type key = T.t - and type 'a t = 'a Map.Make (T).t - - val filter_map : 'a t -> f:(key -> 'a -> 'b option) -> 'b t - val of_list : (key * 'a) list -> 'a t - - val disjoint_union : ?eq:('a -> 'a -> bool) -> ?print:(Format.formatter -> 'a -> unit) -> 'a t -> 'a t -> 'a t - - val union_right : 'a t -> 'a t -> 'a t - - val union_left : 'a t -> 'a t -> 'a t - - val union_merge : ('a -> 'a -> 'a) -> 'a t -> 'a t -> 'a t - val rename : key t -> key -> key - val map_keys : (key -> key) -> 'a t -> 'a t - val keys : 'a t -> Set.Make(T).t - val data : 'a t -> 'a list - val of_set : (key -> 'a) -> Set.Make(T).t -> 'a t - val transpose_keys_and_data : key t -> key t - val transpose_keys_and_data_set : key t -> Set.Make(T).t t - val print : - (Format.formatter -> 'a -> unit) -> Format.formatter -> 'a t -> unit -end - -module type Tbl = sig - module T : sig - type t - include Map.OrderedType with type t := t - include Hashtbl.HashedType with type t := t - end - include Hashtbl.S - with type key = T.t - and type 'a t = 'a Hashtbl.Make (T).t - - val to_list : 'a t -> (T.t * 'a) list - val of_list : (T.t * 'a) list -> 'a t - - val to_map : 'a t -> 'a Map.Make(T).t - val of_map : 'a Map.Make(T).t -> 'a t - val memoize : 'a t -> (key -> 'a) -> key -> 'a - val map : 'a t -> ('a -> 'b) -> 'b t -end - -module Pair (A : Thing) (B : Thing) : Thing with type t = A.t * B.t = struct - type t = A.t * B.t - - let compare (a1, b1) (a2, b2) = - let c = A.compare a1 a2 in - if c <> 0 then c - else B.compare b1 b2 - - let output oc (a, b) = Printf.fprintf oc " (%a, %a)" A.output a B.output b - let hash (a, b) = Hashtbl.hash (A.hash a, B.hash b) - let equal (a1, b1) (a2, b2) = A.equal a1 a2 && B.equal b1 b2 - let print ppf (a, b) = Format.fprintf ppf " (%a, @ %a)" A.print a B.print b -end - -module Make_map (T : Thing) = struct - include Map.Make (T) - - let filter_map t ~f = - fold (fun id v map -> - match f id v with - | None -> map - | Some r -> add id r map) t empty - - let of_list l = - List.fold_left (fun map (id, v) -> add id v map) empty l - - let disjoint_union ?eq ?print m1 m2 = - union (fun id v1 v2 -> - let ok = match eq with - | None -> false - | Some eq -> eq v1 v2 - in - if not ok then - let err = - match print with - | None -> - Format.asprintf "Map.disjoint_union %a" T.print id - | Some print -> - Format.asprintf "Map.disjoint_union %a => %a <> %a" - T.print id print v1 print v2 - in - Misc.fatal_error err - else Some v1) - m1 m2 - [@@raises Fatal_error] - - let union_right m1 m2 = - merge (fun _id x y -> match x, y with - | None, None -> None - | None, Some v - | Some v, None - | Some _, Some v -> Some v) - m1 m2 - - let union_left m1 m2 = union_right m2 m1 - - let union_merge f m1 m2 = - let aux _ m1 m2 = - match m1, m2 with - | None, m | m, None -> m - | Some m1, Some m2 -> Some (f m1 m2) - in - merge aux m1 m2 - - let rename m v = - try find v m - with Not_found -> v - - let map_keys f m = - of_list (List.map (fun (k, v) -> f k, v) (bindings m)) - - let print f ppf s = - let elts ppf s = iter (fun id v -> - Format.fprintf ppf "@ (@[%a@ %a@])" T.print id f v) s in - Format.fprintf ppf "@[<1>{@[%a@ @]}@]" elts s - - module T_set = Set.Make (T) - - let keys map = fold (fun k _ set -> T_set.add k set) map T_set.empty - - let data t = List.map snd (bindings t) - - let of_set f set = T_set.fold (fun e map -> add e (f e) map) set empty - - let transpose_keys_and_data map = fold (fun k v m -> add v k m) map empty - let transpose_keys_and_data_set map = - fold (fun k v m -> - let set = - match find v m with - | exception Not_found -> - T_set.singleton k - | set -> - T_set.add k set - in - add v set m) - map empty -end - -module Make_set (T : Thing) = struct - include Set.Make (T) - - let output oc s = - Printf.fprintf oc " ( "; - iter (fun v -> Printf.fprintf oc "%a " T.output v) s; - Printf.fprintf oc ")" - - let print ppf s = - let elts ppf s = iter (fun e -> Format.fprintf ppf "@ %a" T.print e) s in - Format.fprintf ppf "@[<1>{@[%a@ @]}@]" elts s - - let to_string s = Format.asprintf "%a" print s - - let of_list l = match l with - | [] -> empty - | [t] -> singleton t - | t :: q -> List.fold_left (fun acc e -> add e acc) (singleton t) q - - let map f s = of_list (List.map f (elements s)) -end - -module Make_tbl (T : Thing) = struct - include Hashtbl.Make (T) - - module T_map = Make_map (T) - - let to_list t = - fold (fun key datum elts -> (key, datum)::elts) t [] - - let of_list elts = - let t = create 42 in - List.iter (fun (key, datum) -> add t key datum) elts; - t - - let to_map v = fold T_map.add v T_map.empty - - let of_map m = - let t = create (T_map.cardinal m) in - T_map.iter (fun k v -> add t k v) m; - t - - let memoize t f = fun key -> - try find t key with - | Not_found -> - let r = f key in - add t key r; - r - - let map t f = - of_map (T_map.map f (to_map t)) -end - -module type S = sig - type t - - module T : Thing with type t = t - include Thing with type t := T.t - - module Set : Set with module T := T - module Map : Map with module T := T - module Tbl : Tbl with module T := T -end - -module Make (T : Thing) = struct - module T = T - include T - - module Set = Make_set (T) - module Map = Make_map (T) - module Tbl = Make_tbl (T) -end diff --git a/analysis/reanalyze/examples/deadcode/expected/deadcode.txt b/analysis/reanalyze/examples/deadcode/expected/deadcode.txt index 9296b5944..eb561f9f6 100644 --- a/analysis/reanalyze/examples/deadcode/expected/deadcode.txt +++ b/analysis/reanalyze/examples/deadcode/expected/deadcode.txt @@ -50,77 +50,6 @@ addTypeReference DeadExn.res:10:14 --> DeadExn.res:4:2 addValueReference DeadExn.res:12:7 --> DeadExn.res:10:4 Scanning DeadExn.cmti Source:DeadExn.resi - Scanning DeadMl.cmt Source:DeadMl.ml - addValueDeclaration +thisSpansSeveralLines DeadMl.ml:3:8 path:+DeadMl.QQ - addValueDeclaration +thisIsInInterface DeadMl.ml:9:2 path:+DeadMl.AA - addValueDeclaration +thisHasSemicolons DeadMl.ml:15:4 path:+DeadMl - addValueDeclaration +version DeadMl.ml:26:6 path:+DeadMl.Bs_version - addValueDeclaration +header DeadMl.ml:26:27 path:+DeadMl.Bs_version - addValueDeclaration +package_name DeadMl.ml:26:47 path:+DeadMl.Bs_version - addValueDeclaration +map_split_opt DeadMl.ml:45:8 path:+DeadMl - addValueDeclaration +inline_threshold DeadMl.ml:56:4 path:+DeadMl - addValueDeclaration +dead1 DeadMl.ml:59:6 path:+DeadMl.Scope - addValueDeclaration +deadInner1 DeadMl.ml:62:8 path:+DeadMl.Scope.Inner1 - addValueDeclaration +liveInner2 DeadMl.ml:66:8 path:+DeadMl.Scope.Inner1 - addValueDeclaration +dead2 DeadMl.ml:69:6 path:+DeadMl.Scope - addValueDeclaration +liveInner3 DeadMl.ml:74:8 path:+DeadMl.Scope.Inner2 - addValueDeclaration +live3 DeadMl.ml:77:6 path:+DeadMl.Scope - addValueDeclaration +dead4 DeadMl.ml:80:4 path:+DeadMl - addValueDeclaration +live5 DeadMl.ml:82:4 path:+DeadMl - addValueDeclaration +dead5 DeadMl.ml:85:4 path:+DeadMl - addValueDeclaration +live6 DeadMl.ml:87:4 path:+DeadMl - addValueDeclaration +dead7 DeadMl.ml:90:4 path:+DeadMl - addValueDeclaration +dead8 DeadMl.ml:94:2 path:+DeadMl.WithSignature - addValueDeclaration +live9 DeadMl.ml:96:2 path:+DeadMl.WithSignature - addValueDeclaration +dead10 DeadMl.ml:99:2 path:+DeadMl.WithSignature - addValueDeclaration +live11 DeadMl.ml:103:2 path:+DeadMl.WithSignature - addValueDeclaration +foo DeadMl.ml:112:21 path:+DeadMl - addValueDeclaration +bar DeadMl.ml:114:43 path:+DeadMl - addValueReference DeadMl.ml:3:8 --> DeadMl.ml:4:11 - addValueReference DeadMl.ml:3:8 --> DeadMl.ml:4:20 - addValueDeclaration +thisIsInInterface DeadMl.ml:12:6 path:+DeadMl.AA - addValueReference DeadMl.ml:12:6 --> DeadMl.ml:12:24 - addVariantCaseDeclaration DeadA DeadMl.ml:17:18 path:+DeadMl.thisIsDead - addVariantCaseDeclaration DeadB DeadMl.ml:17:26 path:+DeadMl.thisIsDead - addValueDeclaration +_ DeadMl.ml:21:2 path:+DeadMl - addValueDeclaration +_ DeadMl.ml:22:2 path:+DeadMl - addValueDeclaration +version DeadMl.ml:29:8 path:+DeadMl.Bs_version - addValueDeclaration +header DeadMl.ml:30:8 path:+DeadMl.Bs_version - addValueDeclaration +package_name DeadMl.ml:31:8 path:+DeadMl.Bs_version - addRecordLabelDeclaration Lfunction.arity DeadMl.ml:35:21 path:+DeadMl.l - addRecordLabelDeclaration Lfunction.params DeadMl.ml:36:21 path:+DeadMl.l - addRecordLabelDeclaration Lfunction.body DeadMl.ml:37:21 path:+DeadMl.l - addVariantCaseDeclaration Lfunction DeadMl.ml:35:2 path:+DeadMl.l - addRecordLabelDeclaration module_name DeadMl.ml:41:2 path:+DeadMl.module_info - addRecordLabelDeclaration case DeadMl.ml:42:2 path:+DeadMl.module_info - addValueReference DeadMl.ml:45:8 --> DeadMl.ml:50:4 - addValueReference DeadMl.ml:45:8 --> DeadMl.ml:46:19 - addValueReference DeadMl.ml:45:8 --> DeadMl.ml:50:7 - addValueReference DeadMl.ml:45:8 --> DeadMl.ml:46:19 - addValueReference DeadMl.ml:45:8 --> DeadMl.ml:45:8 - addValueReference DeadMl.ml:45:8 --> DeadMl.ml:53:23 - addValueReference DeadMl.ml:45:8 --> DeadMl.ml:52:8 - addValueReference DeadMl.ml:45:8 --> DeadMl.ml:52:8 - addValueReference DeadMl.ml:45:8 --> DeadMl.ml:51:8 - addValueReference DeadMl.ml:45:8 --> DeadMl.ml:54:23 - addValueReference DeadMl.ml:45:8 --> DeadMl.ml:52:11 - addValueReference DeadMl.ml:45:8 --> DeadMl.ml:52:11 - addValueReference DeadMl.ml:45:8 --> DeadMl.ml:51:10 - addValueReference DeadMl.ml:45:8 --> DeadMl.ml:46:3 - addValueDeclaration +dead8 DeadMl.ml:106:6 path:+DeadMl.WithSignature - addValueDeclaration +live9 DeadMl.ml:107:6 path:+DeadMl.WithSignature - addValueDeclaration +dead10 DeadMl.ml:108:6 path:+DeadMl.WithSignature - addValueDeclaration +live11 DeadMl.ml:109:6 path:+DeadMl.WithSignature - addValueReference DeadMl.ml:112:21 --> DeadMl.ml:112:25 - addValueReference DeadMl.ml:114:43 --> DeadMl.ml:114:47 - addValueReference DeadMl.ml:9:2 --> DeadMl.ml:12:6 - addValueReference DeadMl.ml:26:6 --> DeadMl.ml:29:8 - addValueReference DeadMl.ml:26:27 --> DeadMl.ml:30:8 - addValueReference DeadMl.ml:26:47 --> DeadMl.ml:31:8 - addValueReference DeadMl.ml:94:2 --> DeadMl.ml:106:6 - addValueReference DeadMl.ml:96:2 --> DeadMl.ml:107:6 - addValueReference DeadMl.ml:99:2 --> DeadMl.ml:108:6 - addValueReference DeadMl.ml:103:2 --> DeadMl.ml:109:6 Scanning DeadRT.cmt Source:DeadRT.res addValueDeclaration +emitModuleAccessPath DeadRT.res:5:8 path:+DeadRT addVariantCaseDeclaration Root DeadRT.res:2:2 path:+DeadRT.moduleAccessPath @@ -1896,7 +1825,6 @@ File References DeadCodeInterface.res -->> DeadExn.res -->> DeadExn.resi -->> - DeadMl.ml -->> DeadRT.res -->> DeadRT.resi -->> DeadTest.res -->> React.res, BootloaderResource.res, DeadValueTest.resi, DynamicallyLoadedComponent.res, ImmutableArray.resi, JSResource.res @@ -1984,49 +1912,6 @@ File References Live Value +CreateErrorHandler1.Error1.+notification: 1 references (ErrorHandler.resi:3:2) [0] Live Value +CreateErrorHandler2.Error2.+notification: 1 references (ErrorHandler.resi:3:2) [0] Live Value +DeadCodeImplementation.M.+x: 1 references (DeadCodeInterface.res:2:2) [0] - Live Value +DeadMl.+bar: 0 references () [0] - Live Value +DeadMl.+foo: 0 references () [0] - Live Value +DeadMl.WithSignature.+live11: 0 references () [1] - Live Value +DeadMl.WithSignature.+live11: 1 references (DeadMl.ml:103:2) [0] - Dead Value +DeadMl.WithSignature.+dead10: 0 references () [1] - Dead Value +DeadMl.WithSignature.+dead10: 0 references () [0] - Live Value +DeadMl.WithSignature.+live9: 0 references () [1] - Live Value +DeadMl.WithSignature.+live9: 1 references (DeadMl.ml:96:2) [0] - Dead Value +DeadMl.WithSignature.+dead8: 0 references () [1] - Dead Value +DeadMl.WithSignature.+dead8: 0 references () [0] - Dead Value +DeadMl.+dead7: 0 references () [0] - Live Value +DeadMl.+live6: 0 references () [0] - Dead Value +DeadMl.+dead5: 0 references () [0] - Live Value +DeadMl.+live5: 0 references () [0] - Dead Value +DeadMl.+dead4: 0 references () [0] - Live Value +DeadMl.Scope.+live3: 0 references () [0] - Live Value +DeadMl.Scope.Inner2.+liveInner3: 0 references () [0] - Dead Value +DeadMl.Scope.+dead2: 0 references () [0] - Live Value +DeadMl.Scope.Inner1.+liveInner2: 0 references () [0] - Dead Value +DeadMl.Scope.Inner1.+deadInner1: 0 references () [0] - Dead Value +DeadMl.Scope.+dead1: 0 references () [0] - Dead Value +DeadMl.+inline_threshold: 0 references () [0] - Dead Value +DeadMl.+map_split_opt: 0 references () [0] - Dead RecordLabel +DeadMl.module_info.case: 0 references () [0] - Dead RecordLabel +DeadMl.module_info.module_name: 0 references () [0] - Dead RecordLabel +DeadMl.l.Lfunction.body: 0 references () [0] - Dead RecordLabel +DeadMl.l.Lfunction.params: 0 references () [0] - Dead RecordLabel +DeadMl.l.Lfunction.arity: 0 references () [0] - Dead VariantCase +DeadMl.l.Lfunction: 0 references () [0] - Dead Value +DeadMl.Bs_version.+package_name: 0 references () [1] - Dead Value +DeadMl.Bs_version.+package_name: 0 references () [0] - Dead Value +DeadMl.Bs_version.+header: 0 references () [1] - Dead Value +DeadMl.Bs_version.+header: 0 references () [0] - Dead Value +DeadMl.Bs_version.+version: 0 references () [1] - Dead Value +DeadMl.Bs_version.+version: 0 references () [0] - Dead Value +DeadMl.+_: 0 references () [0] - Dead Value +DeadMl.+_: 0 references () [0] - Dead VariantCase +DeadMl.thisIsDead.DeadB: 0 references () [0] - Dead VariantCase +DeadMl.thisIsDead.DeadA: 0 references () [0] - Dead Value +DeadMl.+thisHasSemicolons: 0 references () [0] - Dead Value +DeadMl.AA.+thisIsInInterface: 0 references () [1] - Dead Value +DeadMl.AA.+thisIsInInterface: 0 references () [0] - Dead Value +DeadMl.QQ.+thisSpansSeveralLines: 0 references () [0] Dead Value +DeadRT.+emitModuleAccessPath: 0 references () [0] Live VariantCase +DeadRT.moduleAccessPath.Kaboom: 1 references (DeadRT.res:11:16) [0] Live VariantCase DeadRT.moduleAccessPath.Root: 1 references (DeadTest.res:106:16) [1] @@ -2791,198 +2676,6 @@ File References <-- line 8 @dead("eToplevel") let eToplevel = Etoplevel - Warning Dead Module - DeadMl.ml:1:1-120 - DeadMl.QQ is a dead module as all its items are dead. - - Warning Dead Value - DeadMl.ml:3:5-93 - QQ.thisSpansSeveralLines is never used - <-- line 3 - x + y : int -> int -> int) [@@dead "QQ.thisSpansSeveralLines"] - - Warning Dead Module - DeadMl.ml:8:1-103 - DeadMl.AA is a dead module as all its items are dead. - - Warning Dead Value - DeadMl.ml:9:3-40 - AA.thisIsInInterface is never used - <-- line 9 - int -> int [@@dead "AA.thisIsInInterface"] - - Warning Dead Value - DeadMl.ml:12:3-29 - AA.thisIsInInterface is never used - <-- line 12 - let thisIsInInterface x = x [@@dead "AA.thisIsInInterface"] - - Warning Dead Value - DeadMl.ml:15:1-25 - thisHasSemicolons is never used - <-- line 15 - let thisHasSemicolons = 3 [@@dead "thisHasSemicolons"] ;; - - Warning Dead Type - DeadMl.ml:17:19-25 - thisIsDead.DeadA is a variant case which is never constructed - <-- line 17 - type thisIsDead = | DeadA [@dead "thisIsDead.DeadA"] | DeadB [@dead "thisIsDead.DeadB"] - - Warning Dead Type - DeadMl.ml:17:27-33 - thisIsDead.DeadB is a variant case which is never constructed - <-- line 17 - type thisIsDead = | DeadA [@dead "thisIsDead.DeadA"] | DeadB [@dead "thisIsDead.DeadB"] - - Warning Dead Module - DeadMl.ml:25:1-256 - DeadMl.Bs_version is a dead module as all its items are dead. - - Warning Dead Value - DeadMl.ml:26:7-26 - Bs_version.version is never used - <-- line 26 - sig val version : string [@@dead "Bs_version.version"] val header : string [@@dead "Bs_version.header"] val package_name : string [@@dead "Bs_version.package_name"] end - - Warning Dead Value - DeadMl.ml:26:28-46 - Bs_version.header is never used - <-- line 26 - sig val version : string [@@dead "Bs_version.version"] val header : string [@@dead "Bs_version.header"] val package_name : string [@@dead "Bs_version.package_name"] end - - Warning Dead Value - DeadMl.ml:26:48-72 - Bs_version.package_name is never used - <-- line 26 - sig val version : string [@@dead "Bs_version.version"] val header : string [@@dead "Bs_version.header"] val package_name : string [@@dead "Bs_version.package_name"] end - - Warning Dead Value - DeadMl.ml:29:5-31 - Bs_version.version is never used - <-- line 29 - let version = "7.2.0-dev.4" [@@dead "Bs_version.version"] - - Warning Dead Value - DeadMl.ml:30:5-70 - Bs_version.header is never used - <-- line 30 - let header = "// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE" [@@dead "Bs_version.header"] - - Warning Dead Value - DeadMl.ml:31:5-36 - Bs_version.package_name is never used - <-- line 31 - let package_name = "bs-platform" [@@dead "Bs_version.package_name"] - - Warning Dead Type - DeadMl.ml:35:3-137 - l.Lfunction is a variant case which is never constructed - <-- line 35 - } [@dead "l.Lfunction"] - - Warning Dead Type - DeadMl.ml:35:22-34 - l.Lfunction.arity is a record label never used to read a value - <-- line 35 - | Lfunction of { arity : int ; [@dead "l.Lfunction.arity"] - - Warning Dead Type - DeadMl.ml:36:22-40 - l.Lfunction.params is a record label never used to read a value - <-- line 36 - params : int list ; [@dead "l.Lfunction.params"] - - Warning Dead Type - DeadMl.ml:37:22-34 - l.Lfunction.body is a record label never used to read a value - <-- line 37 - body : string [@dead "l.Lfunction.body"] - - Warning Dead Type - DeadMl.ml:41:3-22 - module_info.module_name is a record label never used to read a value - <-- line 41 - module_name: string; [@dead "module_info.module_name"] - - Warning Dead Type - DeadMl.ml:42:3-12 - module_info.case is a record label never used to read a value - <-- line 42 - case: bool [@dead "module_info.case"] - - Warning Dead Value - DeadMl.ml:45:1-305 - map_split_opt is never used - <-- line 45 - (match d with Some d -> d::ds | None -> ds) [@@dead "map_split_opt"] - - Warning Dead Value - DeadMl.ml:56:1-40 - inline_threshold is never used - <-- line 56 - let inline_threshold = Some (10. /. 8.); [@@dead "inline_threshold"] - - Warning Dead Value - DeadMl.ml:59:3-15 - Scope.dead1 is never used - <-- line 59 - let dead1 = 1 [@@dead "Scope.dead1"] - - Warning Dead Value - DeadMl.ml:62:5-22 - Scope.Inner1.deadInner1 is never used - <-- line 62 - let deadInner1 = 0 [@@dead "Scope.Inner1.deadInner1"] - - Warning Dead Value - DeadMl.ml:69:3-15 - Scope.dead2 is never used - <-- line 69 - let dead2 = 2 [@@dead "Scope.dead2"] - - Warning Dead Value - DeadMl.ml:80:1-13 - dead4 is never used - <-- line 80 - let dead4 = 4 [@@dead "dead4"] - - Warning Dead Value - DeadMl.ml:85:1-13 - dead5 is never used - <-- line 85 - let dead5 = 5 [@@dead "dead5"] - - Warning Dead Value - DeadMl.ml:90:1-37 - dead7 is never used - <-- line 90 - [@@ocaml.warning "-30"] [@@dead "dead7"] - - Warning Dead Value - DeadMl.ml:94:3-16 - WithSignature.dead8 is never used - <-- line 94 - val dead8: int [@@dead "WithSignature.dead8"] - - Warning Dead Value - DeadMl.ml:99:3-17 - WithSignature.dead10 is never used - <-- line 99 - val dead10: int [@@dead "WithSignature.dead10"] - - Warning Dead Value - DeadMl.ml:106:3-15 - WithSignature.dead8 is never used - <-- line 106 - let dead8 = 8 [@@dead "WithSignature.dead8"] - - Warning Dead Value - DeadMl.ml:108:3-17 - WithSignature.dead10 is never used - <-- line 108 - let dead10 = 10 [@@dead "WithSignature.dead10"] - Warning Dead Value DeadRT.res:5:1-116 emitModuleAccessPath is never used @@ -4601,4 +4294,4 @@ File References <-- line 96 type variant1Object = | @dead("variant1Object.R") R(payload) - Analysis reported 339 issues (Incorrect Dead Annotation:1, Warning Dead Exception:2, Warning Dead Module:25, Warning Dead Type:94, Warning Dead Value:199, Warning Dead Value With Side Effects:2, Warning Redundant Optional Argument:5, Warning Unused Argument:11) + Analysis reported 306 issues (Incorrect Dead Annotation:1, Warning Dead Exception:2, Warning Dead Module:22, Warning Dead Type:86, Warning Dead Value:177, Warning Dead Value With Side Effects:2, Warning Redundant Optional Argument:5, Warning Unused Argument:11) diff --git a/analysis/reanalyze/examples/deadcode/src/DeadMl.bs.js b/analysis/reanalyze/examples/deadcode/src/DeadMl.bs.js deleted file mode 100644 index c71d09d22..000000000 --- a/analysis/reanalyze/examples/deadcode/src/DeadMl.bs.js +++ /dev/null @@ -1,113 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE - -import * as Curry from "rescript/lib/es6/curry.js"; -import * as Pervasives from "rescript/lib/es6/pervasives.js"; -import * as Caml_option from "rescript/lib/es6/caml_option.js"; - -function thisSpansSeveralLines(x, y) { - return x + y | 0; -} - -var QQ = { - thisSpansSeveralLines: thisSpansSeveralLines -}; - -function thisIsInInterface(x) { - return x; -} - -var AA = { - thisIsInInterface: thisIsInInterface -}; - -var Bs_version = { - version: "7.2.0-dev.4", - header: "// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE", - package_name: "bs-platform" -}; - -function map_split_opt(xs, f) { - if (!xs) { - return [ - /* [] */0, - /* [] */0 - ]; - } - var match = Curry._1(f, xs.hd); - var d = match[1]; - var c = match[0]; - var match$1 = map_split_opt(xs.tl, f); - var ds = match$1[1]; - var cs = match$1[0]; - return [ - c !== undefined ? ({ - hd: Caml_option.valFromOption(c), - tl: cs - }) : cs, - d !== undefined ? ({ - hd: Caml_option.valFromOption(d), - tl: ds - }) : ds - ]; -} - -var inline_threshold = 10 / 8; - -var Inner1 = { - deadInner1: 0, - liveInner2: 0 -}; - -var Inner2 = { - liveInner3: 0 -}; - -var Scope = { - dead1: 1, - Inner1: Inner1, - dead2: 2, - Inner2: Inner2, - live3: 3 -}; - -var WithSignature = { - dead8: 8, - live9: 9, - dead10: 10, - live11: 11 -}; - -var foo = Pervasives.print_int; - -var bar = Pervasives.print_int; - -var thisHasSemicolons = 3; - -var dead4 = 4; - -var live5 = 5; - -var dead5 = 5; - -var live6 = 6; - -var dead7 = 7; - -export { - QQ , - AA , - thisHasSemicolons , - Bs_version , - map_split_opt , - inline_threshold , - Scope , - dead4 , - live5 , - dead5 , - live6 , - dead7 , - WithSignature , - foo , - bar , -} -/* No side effect */ diff --git a/analysis/reanalyze/examples/deadcode/src/DeadMl.ml b/analysis/reanalyze/examples/deadcode/src/DeadMl.ml deleted file mode 100644 index 86e9ed4a4..000000000 --- a/analysis/reanalyze/examples/deadcode/src/DeadMl.ml +++ /dev/null @@ -1,114 +0,0 @@ -module QQ = - struct - let thisSpansSeveralLines = - (fun x -> fun y -> - x + y : int -> int -> int) - end - -module AA : sig - val thisIsInInterface : - int -> int -end = struct - let thisIsInInterface x = x -end - -let thisHasSemicolons = 3;; - -type thisIsDead = | DeadA | DeadB - - -let () = - let _ = 3 in - let _ = [1,2,3] in - () - -module Bs_version : - sig val version : string val header : string val package_name : string end - = - struct - let version = "7.2.0-dev.4" - let header = "// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE" - let package_name = "bs-platform" - end - -type l = - | Lfunction of { arity : int ; - params : int list ; - body : string - } - -type module_info = { - module_name: string; - case: bool -} - -let rec map_split_opt - (xs : 'a list) (f : 'a -> 'b option * 'c option) - : 'b list * 'c list = - match xs with - | [] -> [], [] - | x::xs -> - let c,d = f x in - let cs,ds = map_split_opt xs f in - (match c with Some c -> c::cs | None -> cs), - (match d with Some d -> d::ds | None -> ds) - -let inline_threshold = Some (10. /. 8.); - -module Scope = struct - let dead1 = 1 - - module Inner1 = struct - let deadInner1 = 0 - - [@@@ocaml.warning "-32"] - - let liveInner2 = 0 - end - - let dead2 = 2 - - [@@@ocaml.warning "-32"] - - module Inner2 = struct - let liveInner3 = 0 - end - - let live3 = 3 -end - -let dead4 = 4 - -let live5 = 5 -[@@ocaml.warning "-32"] - -let dead5 = 5 - -let live6 = 6 -[@@ocaml.warning "xxx-32xxx"] - -let dead7 = 7 -[@@ocaml.warning "-30"] - -module WithSignature : sig - val dead8: int - - val live9: int - [@@ocaml.warning "-32"] - - val dead10: int - - [@@@ocaml.warning "-32"] - - val live11: int -end = -struct - let dead8 = 8 - let live9 = 9 - let dead10 = 10 - let live11 = 11 -end - -let [@warning "-32"] foo x = print_int x - -let [@warning "-unused-value-declaration"] bar x = print_int x diff --git a/analysis/tests/src/TableclothMap.ml b/analysis/tests/src/TableclothMap.ml deleted file mode 100644 index 1b104278a..000000000 --- a/analysis/tests/src/TableclothMap.ml +++ /dev/null @@ -1,11 +0,0 @@ -let add = 3 - -module Of (M : sig end) = struct - type _t = int -end - -module M = struct end - -module Int = struct - type _t = Of(M)._t -end diff --git a/analysis/tests/src/TableclothMap.mli b/analysis/tests/src/TableclothMap.mli deleted file mode 100644 index 53abe7a17..000000000 --- a/analysis/tests/src/TableclothMap.mli +++ /dev/null @@ -1,3 +0,0 @@ -val add : int - -module Int : sig end \ No newline at end of file diff --git a/analysis/tests/src/TableclothMap.res b/analysis/tests/src/TableclothMap.res new file mode 100644 index 000000000..515bdd62d --- /dev/null +++ b/analysis/tests/src/TableclothMap.res @@ -0,0 +1,12 @@ +let add = 3 + +module Of = (M: {}) => { + type _t = int +} + +module M = {} + +module O = Of(M) +module Int = { + type _t = O._t +} diff --git a/analysis/tests/src/TableclothMap.resi b/analysis/tests/src/TableclothMap.resi new file mode 100644 index 000000000..91d267349 --- /dev/null +++ b/analysis/tests/src/TableclothMap.resi @@ -0,0 +1,3 @@ +let add: int + +module Int: {} diff --git a/analysis/tests/src/expected/CompletionAttributes.res.txt b/analysis/tests/src/expected/CompletionAttributes.res.txt index 3fa299ef7..effdf87ff 100644 --- a/analysis/tests/src/expected/CompletionAttributes.res.txt +++ b/analysis/tests/src/expected/CompletionAttributes.res.txt @@ -24,18 +24,6 @@ Resolved opens 1 pervasives "tags": [], "detail": "Package", "documentation": null - }, { - "label": "./TableclothMap.ml", - "kind": 4, - "tags": [], - "detail": "Local file", - "documentation": null - }, { - "label": "./TableclothMap.mli", - "kind": 4, - "tags": [], - "detail": "Local file", - "documentation": null }, { "label": "./test.json", "kind": 4, @@ -203,18 +191,6 @@ Resolved opens 1 pervasives "tags": [], "detail": "Package", "documentation": null - }, { - "label": "./TableclothMap.ml", - "kind": 4, - "tags": [], - "detail": "Local file", - "documentation": null - }, { - "label": "./TableclothMap.mli", - "kind": 4, - "tags": [], - "detail": "Local file", - "documentation": null }, { "label": "./test.json", "kind": 4, @@ -240,18 +216,6 @@ Resolved opens 1 pervasives "tags": [], "detail": "Package", "documentation": null - }, { - "label": "./TableclothMap.ml", - "kind": 4, - "tags": [], - "detail": "Local file", - "documentation": null - }, { - "label": "./TableclothMap.mli", - "kind": 4, - "tags": [], - "detail": "Local file", - "documentation": null }, { "label": "./test.json", "kind": 4, diff --git a/analysis/tests/src/expected/TableclothMap.res.txt b/analysis/tests/src/expected/TableclothMap.res.txt new file mode 100644 index 000000000..e69de29bb diff --git a/analysis/tests/src/expected/TableclothMap.resi.txt b/analysis/tests/src/expected/TableclothMap.resi.txt new file mode 100644 index 000000000..e69de29bb From 15e8a631ccd923d042095a1abfa8c7d66024e60a Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Tue, 9 Jul 2024 10:05:28 +0200 Subject: [PATCH 3/3] Remove example with defunct `lazy` syntax. --- analysis/tests/src/Patterns.res | 4 ---- analysis/tests/src/expected/Patterns.res.txt | 11 ++++------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/analysis/tests/src/Patterns.res b/analysis/tests/src/Patterns.res index 94f40b850..8d6dc6520 100644 --- a/analysis/tests/src/Patterns.res +++ b/analysis/tests/src/Patterns.res @@ -15,7 +15,6 @@ module A = { let A([v1, _, _]) | _ as v1 = assert false - let lazy lazyy = lazy 3 } let y = A.xxx @@ -31,6 +30,3 @@ let n2 = A.a let n3 = A.v1 // ^def - -let n4 = A.lazyy -// ^def diff --git a/analysis/tests/src/expected/Patterns.res.txt b/analysis/tests/src/expected/Patterns.res.txt index 5c119ffb7..43cb4b1fc 100644 --- a/analysis/tests/src/expected/Patterns.res.txt +++ b/analysis/tests/src/expected/Patterns.res.txt @@ -1,15 +1,12 @@ -Definition src/Patterns.res 20:10 +Definition src/Patterns.res 19:10 {"uri": "Patterns.res", "range": {"start": {"line": 3, "character": 7}, "end": {"line": 3, "character": 10}}} -Definition src/Patterns.res 25:11 +Definition src/Patterns.res 24:11 {"uri": "Patterns.res", "range": {"start": {"line": 9, "character": 7}, "end": {"line": 9, "character": 11}}} -Definition src/Patterns.res 28:11 +Definition src/Patterns.res 27:11 {"uri": "Patterns.res", "range": {"start": {"line": 11, "character": 7}, "end": {"line": 11, "character": 8}}} -Definition src/Patterns.res 31:11 +Definition src/Patterns.res 30:11 {"uri": "Patterns.res", "range": {"start": {"line": 15, "character": 9}, "end": {"line": 15, "character": 11}}} -Definition src/Patterns.res 34:11 -{"uri": "Patterns.res", "range": {"start": {"line": 17, "character": 11}, "end": {"line": 17, "character": 16}}} -