Skip to content

Commit

Permalink
remove unused iterator/operator
Browse files Browse the repository at this point in the history
  • Loading branch information
janmasrovira committed Jan 16, 2025
1 parent 31b53cd commit d60b482
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 74 deletions.
2 changes: 2 additions & 0 deletions src/Juvix/Compiler/Concrete/Language/Base.hs
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ instance Serialize FixityDef
instance NFData FixityDef

-- TODO use stage in _opSymbol and _opFixity
-- TODO allow qualified names
data OperatorSyntaxDef (s :: Stage) = OperatorSyntaxDef
{ _opSymbol :: SymbolType s,
_opFixity :: Symbol,
Expand Down Expand Up @@ -484,6 +485,7 @@ instance Serialize (OperatorSyntaxDef 'Scoped)

instance NFData (OperatorSyntaxDef 'Scoped)

-- TODO allow qualified names
data IteratorSyntaxDef (s :: Stage) = IteratorSyntaxDef
{ _iterSymbol :: SymbolType s,
_iterInfo :: Maybe ParsedIteratorInfo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ data ScoperError
| ErrMultipleExport MultipleExportConflict
| ErrAmbiguousSym AmbiguousSym
| ErrAmbiguousModuleSym AmbiguousModuleSym
| ErrUnusedOperatorDef UnusedOperatorDef
| ErrUnusedIteratorDef UnusedIteratorDef
| ErrDoubleBracesPattern DoubleBracesPattern
| ErrDoubleBinderPattern DoubleBinderPattern
| ErrAliasBinderPattern AliasBinderPattern
Expand Down Expand Up @@ -80,8 +78,6 @@ instance ToGenericError ScoperError where
ErrMultipleExport e -> genericError e
ErrAmbiguousSym e -> genericError e
ErrAmbiguousModuleSym e -> genericError e
ErrUnusedOperatorDef e -> genericError e
ErrUnusedIteratorDef e -> genericError e
ErrDoubleBracesPattern e -> genericError e
ErrDoubleBinderPattern e -> genericError e
ErrAliasBinderPattern e -> genericError e
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,52 +424,6 @@ instance ToGenericError ModuleNotInScope where
i = getLoc (e ^. moduleNotInScopeName)
msg = "The module" <+> ppCode opts' _moduleNotInScopeName <+> "is not in scope"

newtype UnusedOperatorDef = UnusedOperatorDef
{ _unusedOperatorDef :: OperatorSyntaxDef 'Parsed
}
deriving stock (Show)

instance ToGenericError UnusedOperatorDef where
genericError UnusedOperatorDef {..} = ask >>= generr
where
generr opts =
return
GenericError
{ _genericErrorLoc = i,
_genericErrorMessage = prettyError msg,
_genericErrorIntervals = [i]
}
where
opts' = fromGenericOptions opts
i = getLoc _unusedOperatorDef
msg =
"Unused operator syntax definition:"
<> line
<> ppCode opts' _unusedOperatorDef

newtype UnusedIteratorDef = UnusedIteratorDef
{ _unusedIteratorDef :: IteratorSyntaxDef 'Parsed
}
deriving stock (Show)

instance ToGenericError UnusedIteratorDef where
genericError UnusedIteratorDef {..} = ask >>= generr
where
generr opts =
return
GenericError
{ _genericErrorLoc = i,
_genericErrorMessage = prettyError msg,
_genericErrorIntervals = [i]
}
where
opts' = fromGenericOptions opts
i = getLoc _unusedIteratorDef
msg =
"Unused iterator syntax definition:"
<> line
<> ppCode opts' _unusedIteratorDef

data AmbiguousSym = AmbiguousSym
{ _ambiguousSymName :: Name,
_ambiguousSymEntires :: [PreSymbolEntry]
Expand Down
10 changes: 0 additions & 10 deletions test/Scope/Negative.hs
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,6 @@ scoperErrorTests =
$(mkRelDir ".")
$(mkRelFile "ModuleNotInScope.juvix")
$ wantsError ErrModuleNotInScope,
negTest
"Unused operator syntax definition"
$(mkRelDir ".")
$(mkRelFile "UnusedOperatorDef.juvix")
$ wantsError ErrUnusedOperatorDef,
negTest
"Ambiguous symbol"
$(mkRelDir ".")
Expand Down Expand Up @@ -199,11 +194,6 @@ scoperErrorTests =
$(mkRelDir ".")
$(mkRelFile "Iterators4.juvix")
$ wantsError ErrDuplicateIterator,
negTest
"Unused iterator declaration"
$(mkRelDir ".")
$(mkRelFile "Iterators5.juvix")
$ wantsError ErrUnusedIteratorDef,
negTest
"Repeated name in named application"
$(mkRelDir ".")
Expand Down
10 changes: 0 additions & 10 deletions tests/negative/Iterators5.juvix

This file was deleted.

4 changes: 0 additions & 4 deletions tests/negative/UnusedOperatorDef.juvix

This file was deleted.

0 comments on commit d60b482

Please sign in to comment.