diff --git a/src/Juvix/Compiler/Concrete/Translation/FromParsed/Analysis/Scoping.hs b/src/Juvix/Compiler/Concrete/Translation/FromParsed/Analysis/Scoping.hs index 8642c37632..c26b0fdf05 100644 --- a/src/Juvix/Compiler/Concrete/Translation/FromParsed/Analysis/Scoping.hs +++ b/src/Juvix/Compiler/Concrete/Translation/FromParsed/Analysis/Scoping.hs @@ -3266,17 +3266,7 @@ checkAliasDef def@AliasDef {..} = do aliasId <- gets (^?! scopeLocalSymbols . at (a ^. aliasDefName) . _Just . S.nameId) asName <- checkName (a ^. aliasDefAsName) modify' (set (scoperAlias . at aliasId) (Just asName)) - checkLoop aliasId registerAlias aliasId asName - where - checkLoop :: NameId -> Sem r () - checkLoop = evalState (mempty :: HashSet NameId) . go - where - go :: (Members '[State (HashSet NameId), Error ScoperError, State ScoperState] s) => NameId -> Sem s () - go i = do - whenM (gets (HashSet.member i)) (throw (ErrAliasCycle (AliasCycle a))) - modify' (HashSet.insert i) - whenJustM (gets (^? scoperAlias . at i . _Just . preSymbolName . S.nameId)) go reserveAliasDef :: (Members '[Error ScoperError, Reader ScopeParameters, State Scope, State ScoperState, InfoTableBuilder, Reader InfoTable, NameIdGen, State ScoperSyntax, Reader BindingStrategy] r) => diff --git a/src/Juvix/Compiler/Concrete/Translation/FromParsed/Analysis/Scoping/Error.hs b/src/Juvix/Compiler/Concrete/Translation/FromParsed/Analysis/Scoping/Error.hs index c6ad481c77..39b89433d9 100644 --- a/src/Juvix/Compiler/Concrete/Translation/FromParsed/Analysis/Scoping/Error.hs +++ b/src/Juvix/Compiler/Concrete/Translation/FromParsed/Analysis/Scoping/Error.hs @@ -51,7 +51,6 @@ data ScoperError | ErrMissingArgs MissingArgs | ErrPrecedenceInconsistency PrecedenceInconsistencyError | ErrIncomparablePrecedences IncomaprablePrecedences - | ErrAliasCycle AliasCycle | ErrInvalidRangeNumber InvalidRangeNumber | ErrWrongDefaultValue WrongDefaultValue | ErrUnsupported Unsupported @@ -104,7 +103,6 @@ instance ToGenericError ScoperError where ErrMissingArgs e -> genericError e ErrPrecedenceInconsistency e -> genericError e ErrIncomparablePrecedences e -> genericError e - ErrAliasCycle e -> genericError e ErrInvalidRangeNumber e -> genericError e ErrWrongDefaultValue e -> genericError e ErrUnsupported e -> genericError e diff --git a/src/Juvix/Compiler/Concrete/Translation/FromParsed/Analysis/Scoping/Error/Types.hs b/src/Juvix/Compiler/Concrete/Translation/FromParsed/Analysis/Scoping/Error/Types.hs index fcf0b17bf4..ac71598a84 100644 --- a/src/Juvix/Compiler/Concrete/Translation/FromParsed/Analysis/Scoping/Error/Types.hs +++ b/src/Juvix/Compiler/Concrete/Translation/FromParsed/Analysis/Scoping/Error/Types.hs @@ -1019,28 +1019,6 @@ instance ToGenericError IncomaprablePrecedences where i :: Interval i = getLoc _incomparablePrecedencesName1 -newtype AliasCycle = AliasCycle - { _aliasCycleDef :: AliasDef 'Parsed - } - deriving stock (Show) - -instance ToGenericError AliasCycle where - genericError AliasCycle {..} = do - opts <- fromGenericOptions <$> ask - let msg = - "The definition of" - <+> ppCode opts (_aliasCycleDef ^. aliasDefName) - <+> "creates an alias cycle." - return - GenericError - { _genericErrorLoc = i, - _genericErrorMessage = mkAnsiText msg, - _genericErrorIntervals = [i] - } - where - i :: Interval - i = getLoc _aliasCycleDef - newtype WrongDefaultValue = WrongDefaultValue { _wrongDefaultValue :: SigArg 'Parsed } diff --git a/src/Juvix/Compiler/Core/Transformation/Optimize/Inlining.hs b/src/Juvix/Compiler/Core/Transformation/Optimize/Inlining.hs index 0e4697af17..32ef13fee1 100644 --- a/src/Juvix/Compiler/Core/Transformation/Optimize/Inlining.hs +++ b/src/Juvix/Compiler/Core/Transformation/Optimize/Inlining.hs @@ -38,8 +38,8 @@ convertNode inlineDepth nonRecSyms md = dmapL go node _ | HashSet.member _identSymbol nonRecSyms - && isInlineableLambda inlineDepth md bl def - && length args >= argsNum -> + && length args >= argsNum + && isInlineableLambda inlineDepth md bl def -> mkApps def args _ -> node diff --git a/test/Scope/Negative.hs b/test/Scope/Negative.hs index f97949aecc..b87950a646 100644 --- a/test/Scope/Negative.hs +++ b/test/Scope/Negative.hs @@ -269,11 +269,6 @@ scoperErrorTests = $(mkRelDir ".") $(mkRelFile "PrecedenceInconsistency.juvix") $ wantsError ErrPrecedenceInconsistency, - negTest - "Alias cycle" - $(mkRelDir ".") - $(mkRelFile "AliasCycle.juvix") - $ wantsError ErrAliasCycle, negTest "Invalid range number in iterator definition" $(mkRelDir ".") diff --git a/tests/negative/AliasCycle.juvix b/tests/negative/AliasCycle.juvix deleted file mode 100644 index 2e6ce0838a..0000000000 --- a/tests/negative/AliasCycle.juvix +++ /dev/null @@ -1,5 +0,0 @@ -module AliasCycle; - -syntax alias x1 := x2; -syntax alias x2 := x3; -syntax alias x3 := x1;