From 3da46dc4d7eec74991e4b7c01e01ffe20719017c Mon Sep 17 00:00:00 2001 From: Mateus Date: Tue, 18 Jun 2024 15:08:13 -0300 Subject: [PATCH] fix: infinite loop when installing new function --- src/Install/Function.elm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Install/Function.elm b/src/Install/Function.elm index a7bbdea..3692c57 100644 --- a/src/Install/Function.elm +++ b/src/Install/Function.elm @@ -153,8 +153,14 @@ declarationVisitor context (Config config) declaration = (Install.Library.getExpressionFromString context confg.functionImplementation) == Just Normalize.ConfirmedEquality |> not + + isImplemented = + not (isNotImplemented function config) in - if name == config.functionName && isInCorrectModule && isNotImplemented function config then + if isImplemented then + ( [], { contextWithLastDeclarationRange | appliedFix = True } ) + + else if name == config.functionName && isInCorrectModule && isNotImplemented function config then replaceFunction { range = Node.range declaration, functionName = config.functionName, functionImplementation = config.functionImplementation } context else