-
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
Fix untyped terms generation #438
Comments
Ah, looks like the same issue I hit in #301, that explains why it doesn't trigger on master. |
Oh, I forgot about this one. Yes, indeed looks like an explanation.
Actually, no, I guess I misinterpreted test failures, because I do not think terms like that can be generated as the generators are well-typed. |
We'd decided in a meeting early on that bounds checking should happen during parsing - though I suppose you could bring that particular point up again next week. |
@effectfully do you have a seed for the second issue? I've tried running property tests several times, but I've yet to trigger
|
I wrote above:
I'm not sure if there are any other failures that are not related to out-of-bounds constants, but the second issue does seem like I misunderstood something and there is no issue there actually. |
Ah okay. |
Reopening, because still the case:
|
But... why is this a problem? We are just looking at the lexical structure, yes? This is a test primarily for the parser. |
I played with this stuff and it's a funny situation: we generate silly terms that violate our invariants, but we never ever do anything with uniques: pretty-printing ignores them and
is false. I'd say this is a mess: we violate invariants, generate uniques and ignore them and use custom equality checking functions. There should be something better than that. |
Does it matter for parsing? |
Yes, because we generate uniques during parsing. By ignoring them we weaken our tests. Besides, we use these generators in other tests as well. It's just a law of property-based testing that default generators have to produce non-trivial test cases. Our generators rarely produce terms with some variable appearing twice and this just makes our tests weaker. Regardless of the procedures we actually test, default generators must cover a variety of cases, because that's the whole point of property-based testing: cover as many cases as you can. |
The way the parser handles uniques is somewhat idiosyncratic and I can't think of a way to test its uniques aside from duplicating the function of some of the code test-side... which is not much of a test. I'm open to other suggestions if you see a better way.
Could we not use something else there? We don't use |
Just got this on master:
I.e. it's an instance of #463. |
Yes, those should definitely be filtered. |
This nonsense is still there. @kwxm you did an amazing job in the compiler in the other project fixing issues with generators, do you happen to have time to devote it to making Plutus Core property tests sensible? |
I noticed that this property
passes even if what is printed can't be parsed back, because
parse
returns anEither
andand
called overLeft
returnsTrue
. This kinda defeats the entire purpose of the test.If I change the last two lines to
I immediately get parsing errors which are all due to poor terms generation:
which doesn't parse due to the out-of-bounds constant (maybe we really shouldn't do bounds checking during parsing).
There are also problems in
because we can generate names that have same uniques, but distinct string representations which violates one of our invariants. Besides, with such generation, terms where the same variable appearing twice are rather rare.
The text was updated successfully, but these errors were encountered: