Skip to content

Commit

Permalink
add negative test
Browse files Browse the repository at this point in the history
  • Loading branch information
janmasrovira committed Aug 29, 2023
1 parent 218941c commit d4340ea
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Juvix/Compiler/Concrete/Print/Base.hs
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ instance (SingI s) => PrettyPrint (AxiomDef s) where
?<> ppCode _axiomKw
<+> axiomName'
<+> ppCode _axiomColonKw
<+> ppExpressionType _axiomType
<+> nest (ppExpressionType _axiomType)

instance PrettyPrint BuiltinInductive where
ppCode i = ppCode Kw.kwBuiltin <+> keywordText (P.prettyText i)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ instance ToGenericError UnsupportedTypeFunction where
<+> ppCode opts (_unsupportedTypeFunction ^. funDefName)
<> "."
<> line
<> "Only functions with a single clause and no pattern matching are supported."
<> "Only terminating functions with a single clause and no pattern matching are supported."
return
GenericError
{ _genericErrorLoc = i,
Expand Down
6 changes: 6 additions & 0 deletions test/Termination/Negative.hs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ tests =
"Quicksort is not terminating"
$(mkRelDir ".")
$(mkRelFile "Data/QuickSort.juvix")
$ \case
ErrNoLexOrder {} -> Nothing,
NegTest
"Loop in axiom type"
$(mkRelDir ".")
$(mkRelFile "Axiom.juvix")
$ \case
ErrNoLexOrder {} -> Nothing
]
5 changes: 5 additions & 0 deletions tests/negative/Termination/Axiom.juvix
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module Axiom;

axiom A : let
x : Type := x;
in x;
1 change: 0 additions & 1 deletion tests/negative/Termination/Ord.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@ addord : Ord -> Ord -> Ord
aux-addord : (ℕ -> Ord) -> Ord -> ℕ -> Ord

| f y z := addord (f z) y;

0 comments on commit d4340ea

Please sign in to comment.