From dc4b88a43be35aedd3d429ac76c9cb8482f1e744 Mon Sep 17 00:00:00 2001 From: Josh M <20140997+jcmrva@users.noreply.github.com> Date: Mon, 17 Jan 2022 14:30:09 -0500 Subject: [PATCH] updated per compiler suggestion #868 (#869) Thanks, sorry it took so long to get back to this! --- src/FsAutoComplete.Core/UntypedAstUtils.fs | 11 ++++++----- src/FsAutoComplete.Core/Utils.fs | 6 +++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/FsAutoComplete.Core/UntypedAstUtils.fs b/src/FsAutoComplete.Core/UntypedAstUtils.fs index 7997abe7a..f0a44469a 100644 --- a/src/FsAutoComplete.Core/UntypedAstUtils.fs +++ b/src/FsAutoComplete.Core/UntypedAstUtils.fs @@ -1642,10 +1642,11 @@ module Printf = let appStack: AppWithArg list ref = ref [] let addAppWithArg appWithArg = - match !appStack with + match appStack.Value with | lastApp :: _ when not (Range.rangeContainsRange lastApp.Range appWithArg.Range) -> - appStack := [appWithArg] - | _ -> appStack := appWithArg :: !appStack + appStack.Value <- [appWithArg] + | _ -> + appStack.Value <- appWithArg :: appStack.Value let rec walkImplFileInput (ParsedImplFileInput(_, _, _, _, _, moduleOrNamespaceList, _)) = List.iter walkSynModuleOrNamespace moduleOrNamespaceList @@ -1693,7 +1694,7 @@ module Printf = and walkExpr e = match e with | SynExpr.App (_, _, SynExpr.Ident _, SynExpr.Const (SynConst.String (_, _, stringRange), _), r) -> - match !appStack with + match appStack.Value with | (lastApp :: _) as apps when Range.rangeContainsRange lastApp.Range e.Range -> let intersectsWithFuncOrString (arg: Range) = Range.rangeContainsRange arg stringRange @@ -1724,7 +1725,7 @@ module Printf = Args = args } result.Add res | _ -> () - appStack := [] + appStack.Value <- [] | SynExpr.App (_, _, SynExpr.App(_, true, SynExpr.Ident op, e1, _), e2, _) -> let rec deconstruct = function | SynExpr.Paren (exp, _, _, _) -> deconstruct exp diff --git a/src/FsAutoComplete.Core/Utils.fs b/src/FsAutoComplete.Core/Utils.fs index 595ca35c8..56d014a94 100644 --- a/src/FsAutoComplete.Core/Utils.fs +++ b/src/FsAutoComplete.Core/Utils.fs @@ -520,9 +520,9 @@ module String = [| let line = ref (reader.ReadLine()) - while not (isNull (!line)) do - yield !line - line := reader.ReadLine() + while not (isNull (line.Value)) do + yield line.Value + line.Value <- reader.ReadLine() if str.EndsWith("\n") then // last trailing space not returned