Skip to content

Commit

Permalink
remove New from constructor name
Browse files Browse the repository at this point in the history
  • Loading branch information
janmasrovira committed Sep 30, 2024
1 parent 7aaf388 commit 8fcf000
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ checkPositivity noPositivityFlag mut = do
markedPositive d = fromJust (find ((== d) . (^. inductiveName)) defs) ^. inductivePositive
whenJust (nonEmpty (filter (not . markedPositive) neg)) $ \negTys ->
throw $
ErrNonStrictlyPositiveNew
NonStrictlyPositiveNew
ErrNonStrictlyPositive
NonStrictlyPositive
{ _nonStrictlyPositiveNewOccurrences = negTys
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ data TypeCheckerError
| ErrTooManyArgumentsIndType WrongNumberArgumentsIndType
| ErrTooFewArgumentsIndType WrongNumberArgumentsIndType
| ErrInvalidPatternMatching InvalidPatternMatching
| ErrNonStrictlyPositiveNew NonStrictlyPositiveNew
| ErrNonStrictlyPositive NonStrictlyPositive
| ErrUnsupportedTypeFunction UnsupportedTypeFunction
| ErrInvalidInstanceType InvalidInstanceType
| ErrInvalidCoercionType InvalidCoercionType
Expand Down Expand Up @@ -69,7 +69,7 @@ instance ToGenericError TypeCheckerError where
ErrDefaultArgLoop e -> genericError e
ErrBadScope e -> genericError e
ErrInvalidConstructorArgType e -> genericError e
ErrNonStrictlyPositiveNew e -> genericError e
ErrNonStrictlyPositive e -> genericError e

instance Show TypeCheckerError where
show = \case
Expand Down Expand Up @@ -98,4 +98,4 @@ instance Show TypeCheckerError where
ErrBuiltinNotDefined {} -> "ErrBuiltinNotDefined"
ErrBadScope {} -> "ErrBadScope"
ErrInvalidConstructorArgType {} -> "ErrInvalidConstructorArgType"
ErrNonStrictlyPositiveNew {} -> "ErrNonStrictlyPositiveNew"
ErrNonStrictlyPositive {} -> "ErrNonStrictlyPositive"
Original file line number Diff line number Diff line change
Expand Up @@ -691,15 +691,15 @@ instance ToGenericError InvalidConstructorArgType where
<> line
<> ppCode opts' ty

newtype NonStrictlyPositiveNew = NonStrictlyPositiveNew
newtype NonStrictlyPositive = NonStrictlyPositive
{ -- This list contains occurrences of the inductive types in non-strictly
-- positive positions. Thus it may contain repeated names
_nonStrictlyPositiveNewOccurrences :: NonEmpty InductiveName
}

makeLenses ''NonStrictlyPositiveNew
makeLenses ''NonStrictlyPositive

instance ToGenericError NonStrictlyPositiveNew where
instance ToGenericError NonStrictlyPositive where
genericError e = ask >>= generr
where
generr opts =
Expand Down
2 changes: 1 addition & 1 deletion test/Typecheck/Negative.hs
Original file line number Diff line number Diff line change
Expand Up @@ -284,5 +284,5 @@ negPositivityTests =
mk :: String -> Path Rel File -> NegTest
mk testname testfile = negTest testname $(mkRelDir "Internal/Positivity") testfile $
\case
ErrNonStrictlyPositiveNew NonStrictlyPositiveNew {} -> Nothing
ErrNonStrictlyPositive NonStrictlyPositive {} -> Nothing
_ -> wrongError
6 changes: 3 additions & 3 deletions test/Typecheck/NegativeNew.hs
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,14 @@ arityTests =
_ -> wrongError,
negTest "Evil: issue 2540" $(mkRelDir "Internal/Positivity") $(mkRelFile "Evil.juvix") $
\case
ErrNonStrictlyPositiveNew {} -> Nothing
ErrNonStrictlyPositive {} -> Nothing
_ -> wrongError,
negTest "Evil: issue 2540 using Axiom" $(mkRelDir "Internal/Positivity") $(mkRelFile "EvilWithAxiom.juvix") $
\case
ErrNonStrictlyPositiveNew {} -> Nothing
ErrNonStrictlyPositive {} -> Nothing
_ -> wrongError,
negTest "FreeT: issue 2540" $(mkRelDir "Internal/Positivity") $(mkRelFile "FreeT.juvix") $
\case
ErrNonStrictlyPositiveNew {} -> Nothing
ErrNonStrictlyPositive {} -> Nothing
_ -> wrongError
]

0 comments on commit 8fcf000

Please sign in to comment.