From 5d3550b76080355da27c68ac982a9610e66b4283 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Czajka?= <62751+lukaszcz@users.noreply.github.com> Date: Wed, 11 Sep 2024 09:30:40 +0200 Subject: [PATCH] Fix bug in symbol dependency graph generation in Core (#3018) The graph was missing some edges, which led to too many symbols being filtered out by the `filter-unreachable` transformation. --- app/Commands/Dev/DevCompile/Core.hs | 2 +- src/Juvix/Compiler/Core/Data/IdentDependencyInfo.hs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Commands/Dev/DevCompile/Core.hs b/app/Commands/Dev/DevCompile/Core.hs index d77c1d3239..d369bb2719 100644 --- a/app/Commands/Dev/DevCompile/Core.hs +++ b/app/Commands/Dev/DevCompile/Core.hs @@ -8,7 +8,7 @@ import Juvix.Compiler.Core.Pretty import Juvix.Compiler.Core.Transformation qualified as Core compileTransformations :: [Core.TransformationId] -compileTransformations = [Core.CombineInfoTables, Core.FilterUnreachable, Core.DisambiguateNames] +compileTransformations = [Core.CombineInfoTables, Core.DisambiguateNames, Core.FilterUnreachable] runCommand :: forall r. diff --git a/src/Juvix/Compiler/Core/Data/IdentDependencyInfo.hs b/src/Juvix/Compiler/Core/Data/IdentDependencyInfo.hs index e2073025e5..132abce630 100644 --- a/src/Juvix/Compiler/Core/Data/IdentDependencyInfo.hs +++ b/src/Juvix/Compiler/Core/Data/IdentDependencyInfo.hs @@ -44,7 +44,7 @@ createSymbolDependencyInfo tab = createDependencyInfo graph startVertices (tab ^. infoIdentifiers) <> foldr ( \ConstructorInfo {..} -> - HashMap.insert _constructorInductive (getSymbols' tab _constructorType) + HashMap.insertWith (<>) _constructorInductive (getSymbols' tab _constructorType) ) mempty (tab ^. infoConstructors)