-
Notifications
You must be signed in to change notification settings - Fork 463
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
CaseOfCase UPLC transformation tests. #5960
Conversation
plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/CaseOfCase.hs
Show resolved
Hide resolved
plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/CaseOfCase.hs
Show resolved
Hide resolved
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.
Lots of nitpicking, sorry.
Thank you for confirming that there's a bug in case-of-case indeed.
I'm not convinced by the solution, because case-of-case is supposed to be an optimization and if we're adding force
-delay
that aren't required in many cases, then are we even making things better?
I'm OK with merging the PR though, a not-too-optimizing optimization is certainly better than a broken one. We can always think of a better solution later.
plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/CaseOfCase.hs
Show resolved
Hide resolved
plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Transform/CaseOfCase.hs
Show resolved
Hide resolved
plutus-core/untyped-plutus-core/test/Transform/CaseOfCase/Test.hs
Outdated
Show resolved
Hide resolved
plutus-core/untyped-plutus-core/test/Transform/CaseOfCase/1.uplc.golden
Outdated
Show resolved
Hide resolved
plutus-core/untyped-plutus-core/test/Transform/CaseOfCase/Test.hs
Outdated
Show resolved
Hide resolved
… program semantics.
…reserve program semantics.
9aa9b46
to
f3d65a7
Compare
|
|
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.
One budget golden file change? When there were like 20 in the original PR? I don't get it, gonna take a look.
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.
@Unisay or feel free to take a look yourself why we're not seeing more changes here.
|
||
goldenVsSimplified :: String -> Term Name PLC.DefaultUni PLC.DefaultFun () -> TestTree | ||
goldenVsSimplified name = | ||
goldenVsString name ("untyped-plutus-core/test/Transform/CaseOfCase/" ++ name ++ ".uplc.golden") |
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.
Don't use /
, use </>
or joinPath
. Those handle weird corner cases correctly and are cross-platform. Also we have the TestNested
machinery for doing these things, but I see that it wasn't in these tests originally.
This is very much by design, originally the builtins machinery would return a regular Plutus bool (Scott-encoded back then), but folks wanted me to remove that feature and return built-in bools instead, so I did that in like 2019. Although now that you mention it, we'll hopefully soon be able to return SOPs from builtins, sounds like we need to come full circle and add builtins returning SOP bools directly. In any case, for you it's obvious that we should return SOPs and not doing so seems awkward. But for, say, Aiken people it's obvious that we should return constants instead, because they prefer to pretend that SOPs don't exist. It's all subjective. |
I've reviewed this once again, I don't think any of my comments are blockers, so let's merge it and do follow-ups:
@zliu41 please still review this PR. |
Oh, and great work, thank you @Unisay! |
caseOfCase
tests fromSimplifier
module into a dedicated test module.CaseOfCase
UPLC transformation changes program evaluation result in a presence ofError
. (2nd commit)CaseOfCase
UPLC transformation to make the test above pass.Closes #5958