-
Notifications
You must be signed in to change notification settings - Fork 479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PLT-1398 Set up typechecking property tests for all PIR compiler passes #5565
Merged
thealmarty
merged 29 commits into
master
from
thealmarty/plt-1398-pir-typechecking-tests
Oct 12, 2023
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
a8f4a1a
Add property tests.
thealmarty c1a24fb
Add module to cabal.
thealmarty d491312
Add tests for more passes.
thealmarty b42013d
Add expectFail tag.
thealmarty f4a9da8
Add changelog.
thealmarty 1a330b7
Tidy up more, address some comments.
thealmarty a2cdf59
void doesn't compile on 9.6.
thealmarty c3a3b31
Add floatTerm test.
thealmarty bd4cc41
Add compileLets tests.
thealmarty f70a82f
Fix Lower.
thealmarty e0ed12c
Only typecheck after the pass.
thealmarty b468472
wip organize tests to eash pass's Test.hs.
thealmarty 74eadff
Add deadcode pass test.
thealmarty 85ab007
Add rename and recSplit tests.
thealmarty 7775749
Avoid tasty discover picking up the property tests.
thealmarty 18a6285
Add caseReduce test.
thealmarty e0d4935
Fix CI.
thealmarty ac9ccd5
Address comment.
thealmarty 5a96a9f
Mark deadcode v2 as expected failure.
thealmarty 67fb027
Make the test consistently fail to pass CI.
thealmarty 4cbc103
Add more tests.
thealmarty 2923dca
Try even more on deadcode test so that it fails consistently.
thealmarty 9eebd12
Switch to camel case.
thealmarty 6fd7048
Run runQuoteT stuff together.
thealmarty 1631bc1
Fix some tests.
thealmarty 0274a60
Let tasty-discover detect prop instead and have quickcheck generate a…
thealmarty 0a45301
Add thunkRecursions test.
thealmarty 03d0a7e
Ignore deadcode pass test to make CI pass.
thealmarty 6278889
Fix after rebasing.
thealmarty File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
...ore/changelog.d/20230928_102703_marty.stumpf_plt_1398_pir_typechecking_tests.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
### Added | ||
|
||
- Typechecking property tests for all PIR compiler passes. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,44 @@ module PlutusIR.Compiler.Let.Test where | |
|
||
import PlutusIR.Test | ||
|
||
import PlutusIR.Compiler.Let | ||
import PlutusIR.Properties.Typecheck | ||
import Test.QuickCheck | ||
import Test.Tasty | ||
import Test.Tasty.ExpectedFailure (ignoreTest) | ||
import Test.Tasty.Extras | ||
import Test.Tasty.QuickCheck | ||
|
||
test_lets :: TestTree | ||
test_lets = runTestNestedIn ["plutus-ir/test/PlutusIR/Compiler"] $ testNested "Let" | ||
[ goldenPlcFromPir pTermAsProg "letInLet" | ||
, goldenPlcFromPir pTermAsProg "letDep" | ||
] | ||
|
||
-- FIXME | ||
-- | Check that a term typechecks after a | ||
-- `PlutusIR.Compiler.Let.compileLets` (recursive terms) pass. | ||
prop_TypecheckCompileLetsRecTerms :: Property | ||
prop_TypecheckCompileLetsRecTerms = | ||
expectFailure $ withMaxSuccess 10000 $ extraConstraintTypecheckProp (compileLets RecTerms) | ||
|
||
-- | Check that a term typechecks after a | ||
-- `PlutusIR.Compiler.Let.compileLets` (non-recursive terms) pass. | ||
prop_TypecheckCompileLetsNonRecTerms :: Property | ||
prop_TypecheckCompileLetsNonRecTerms = | ||
withMaxSuccess 10000 $ extraConstraintTypecheckProp (compileLets NonRecTerms) | ||
|
||
-- | Check that a term typechecks after a | ||
-- `PlutusIR.Compiler.Let.compileLets` (types) pass. | ||
prop_TypecheckCompileLetsTypes :: Property | ||
prop_TypecheckCompileLetsTypes = | ||
withMaxSuccess 10000 $ extraConstraintTypecheckProp (compileLets Types) | ||
|
||
-- FIXME this test sometimes fails so ignoring it to make CI pass. | ||
-- | Check that a term typechecks after a | ||
-- `PlutusIR.Compiler.Let.compileLets` (data types) pass. | ||
test_TypecheckCompileLetsDataTypes :: TestTree | ||
test_TypecheckCompileLetsDataTypes = | ||
ignoreTest $ testProperty "typechecking" $ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So the reason we can't say it's expected to fail is because it sometimes passes? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah. |
||
withMaxSuccess 10000 $ | ||
extraConstraintTypecheckProp (compileLets DataTypes) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
plutus-core/plutus-ir/test/PlutusIR/Transform/CaseReduce/Tests.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module PlutusIR.Transform.CaseReduce.Tests where | ||
|
||
import PlutusIR.Transform.CaseReduce | ||
|
||
import PlutusIR.Properties.Typecheck | ||
import Test.QuickCheck.Property (Property, withMaxSuccess) | ||
|
||
-- | Check that a term typechecks after a `PlutusIR.Transform.CaseReduce.caseReduce` pass. | ||
prop_TypecheckCaseReduce :: Property | ||
prop_TypecheckCaseReduce = | ||
withMaxSuccess 3000 (pureTypecheckProp caseReduce) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could let it generate random LetKind too but I feel in this case it's more obviously useful to separate them. Let me know if you think otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, in this case it actually means "do something completely different", so I think it's good to separate them.