IntersectMBO / IntersectMBO/plutus
Add term mangling
- Dominant language
- Haskell
- Stars
- 1.6k
- Forks
- 508
- Avg merge
- 3d 10h
- Merged PRs (30d)
- 22
Description
We have name mangling [tests](https://github.com/IntersectMBO/plutus/blob/08fe5f3f75f5046add34aa20e1b4bc6f0337c6c9/plutus-core/plutus-core/test/Names/Spec.hs#L45), we should add similar ones except for mangling arbitrary parts of terms, so that we can declaratively specify what kind of transformations turn a well-typed term into an ill-typed one. The simplest example would be substituting a variable with a term of a different type -- that should never type check in TPLC or PIR.
This is important, because we don't really have any good tests for type checking errors, since PIR generators only produce well-typed terms and we don't have many unit/golden tests either. And we just recently had a nasty bug related to a type checking failure.
This will probably require some interesting tech to pick an arbitrary part of a term, tree-like structures aren't particularly well-suited for that, but I guess we can just enumerate the nodes and pick an arbitrary number within the resulting range.
We'll also need to figure out whether arbitrarily changing a type to a different but still well-kinded one is supposed to always give a type error. I suppose there generally will be plenty of corner cases to consider.
Contributor guide
Assessment
This issue has not been assessed yet.