diff --git a/src/Review/Rule.elm b/src/Review/Rule.elm index a2e991d0..9d45de4e 100644 --- a/src/Review/Rule.elm +++ b/src/Review/Rule.elm @@ -4986,6 +4986,15 @@ scope_expressionEnterVisitor node context = context.lookupTable } + Expression.RecordUpdateExpression (Node range name) _ -> + { context + | lookupTable = + ModuleNameLookupTableInternal.add + range + (moduleNameForValue context name []) + context.lookupTable + } + Expression.LambdaExpression { args } -> { context | lookupTable = diff --git a/tests/ModuleNameForValueTest.elm b/tests/ModuleNameForValueTest.elm index 0973c2f4..1abe0817 100644 --- a/tests/ModuleNameForValueTest.elm +++ b/tests/ModuleNameForValueTest.elm @@ -46,6 +46,7 @@ a = localValue Foo.Bar Baz.foo baz + { baz | a = 1 } button Http.get get @@ -92,6 +93,7 @@ Foo.bar -> Foo.bar Foo.Bar -> Foo.Bar Baz.foo -> Bar.foo .baz -> Bar.baz +.baz -> Bar.baz .button -> Html.button Http.get -> Http.get .get -> Http.get @@ -167,6 +169,22 @@ expressionVisitor node context = in ( [], { context | texts = context.texts ++ [ nameInCode ++ " -> " ++ realName ] } ) + Expression.RecordUpdateExpression (Node range name) _ -> + let + realName : String + realName = + case ModuleNameLookupTable.moduleNameAt context.lookupTable range of + Just [] -> + "." ++ name + + Just moduleName_ -> + String.join "." moduleName_ ++ "." ++ name + + Nothing -> + "!!! UNKNOWN !!!" + in + ( [], { context | texts = context.texts ++ [ "." ++ name ++ " -> " ++ realName ] } ) + _ -> ( [], context )