Skip to content
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
merged 29 commits into from
Oct 12, 2023

Conversation

thealmarty
Copy link
Contributor

@thealmarty thealmarty commented Sep 28, 2023

Add typechecking property tests to each simplifier pass and the overall simplifier pass.

Some of the code is a bit repetitive but I think it's ok. This way it's tidy and easy to follow which tests are which.

The inline and overall simplifier passes are failing atm so they're marked as expected to fail. Debugging to follow in another PR. See ticket.

Pre-submit checklist:

  • Branch
    • Tests are provided (if possible)
    • Commit sequence broadly makes sense
    • Key commits have useful messages
    • Changelog fragments have been written (if appropriate)
    • Relevant tickets are mentioned in commit messages
    • Formatting, PNG optimization, etc. are updated
  • PR
    • (For external contributions) Corresponding issue exists and is linked in the description
    • Targeting master unless this is a cherry-pick backport
    • Self-reviewed the diff
    • Useful pull request description
    • Reviewer requested

@thealmarty thealmarty changed the title Thealmarty/plt 1398 pir typechecking tests PLT-1398 Set up typechecking property tests for all PIR compiler passes Sep 28, 2023
@thealmarty thealmarty requested a review from a team September 28, 2023 17:25
@thealmarty thealmarty marked this pull request as ready for review September 28, 2023 17:28
@thealmarty thealmarty marked this pull request as draft September 28, 2023 17:36
@thealmarty thealmarty force-pushed the thealmarty/plt-1398-pir-typechecking-tests branch from a7d7ad6 to 246c4c9 Compare September 28, 2023 17:40
@thealmarty thealmarty removed the request for review from a team September 28, 2023 17:40
@thealmarty
Copy link
Contributor Author

I'll be adding other PIR compiler passes. Feel free to look at the tests for the simplifier passes.

plutus-core/plutus-ir/test/TypecheckSpec.hs Outdated Show resolved Hide resolved
plutus-core/plutus-ir/test/TypecheckSpec.hs Outdated Show resolved Hide resolved
plutus-core/plutus-ir/test/TypecheckSpec.hs Outdated Show resolved Hide resolved
plutus-core/plutus-ir/test/TypecheckSpec.hs Outdated Show resolved Hide resolved
plutus-core/plutus-ir/test/TypecheckSpec.hs Outdated Show resolved Hide resolved
plutus-core/plutus-ir/test/TypecheckSpec.hs Outdated Show resolved Hide resolved
plutus-core/plutus-ir/test/TypecheckSpec.hs Outdated Show resolved Hide resolved
plutus-core/plutus-ir/test/TypecheckSpec.hs Outdated Show resolved Hide resolved
plutus-core/plutus-ir/test/TypecheckSpec.hs Outdated Show resolved Hide resolved
@thealmarty thealmarty force-pushed the thealmarty/plt-1398-pir-typechecking-tests branch 9 times, most recently from c1a5e7b to fcd895e Compare October 5, 2023 15:18
@thealmarty thealmarty marked this pull request as ready for review October 5, 2023 15:21
@thealmarty thealmarty requested a review from a team October 5, 2023 15:21
@thealmarty
Copy link
Contributor Author

As discussed I've changed the tests to testing that the terms typecheck after a pass. Fewer tests are failing but still there are some. They are marked as expected failures and will be investigated in another PR (see ticket).

@thealmarty thealmarty force-pushed the thealmarty/plt-1398-pir-typechecking-tests branch 5 times, most recently from 64d6667 to f36d6fc Compare October 11, 2023 17:20
-- FIXME
-- | Check that a term typechecks after a
-- `PlutusIR.Compiler.Let.compileLets` (recursive terms) pass.
prop_TypecheckCompileLetsRecTerms :: Property
Copy link
Contributor Author

@thealmarty thealmarty Oct 11, 2023

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.

Copy link
Contributor

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.

@thealmarty thealmarty force-pushed the thealmarty/plt-1398-pir-typechecking-tests branch from f36d6fc to cbe39f5 Compare October 11, 2023 17:39
-- FIXME
-- | Check that a term typechecks after a
-- `PlutusIR.Compiler.Let.compileLets` (recursive terms) pass.
prop_TypecheckCompileLetsRecTerms :: Property
Copy link
Contributor

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.

-- `PlutusIR.Compiler.Let.compileLets` (data types) pass.
test_TypecheckCompileLetsDataTypes :: TestTree
test_TypecheckCompileLetsDataTypes =
ignoreTest $ testProperty "typechecking" $
Copy link
Contributor

Choose a reason for hiding this comment

The 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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah.

@michaelpj
Copy link
Contributor

Looks like the letrec test also fails sometimes.

@thealmarty thealmarty force-pushed the thealmarty/plt-1398-pir-typechecking-tests branch from b56e2cd to 03d0a7e Compare October 12, 2023 18:04
@thealmarty thealmarty merged commit a14976d into master Oct 12, 2023
7 checks passed
@thealmarty thealmarty deleted the thealmarty/plt-1398-pir-typechecking-tests branch October 12, 2023 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants