-
Notifications
You must be signed in to change notification settings - Fork 7
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
test: proptest Type validation and substitution #1744
Draft
acl-cqc
wants to merge
21
commits into
main
Choose a base branch
from
tests/proptest_type_with_env
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
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
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1744 +/- ##
==========================================
+ Coverage 86.52% 86.64% +0.11%
==========================================
Files 188 192 +4
Lines 34205 35021 +816
Branches 31076 31834 +758
==========================================
+ Hits 29597 30343 +746
- Misses 2923 2976 +53
- Partials 1685 1702 +17
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
TypeBase(Function(FuncTypeBase { input: TypeRowBase { types: [ TypeBase(Extension(CustomType { extension: IdentList("prelude"), extension_ref: (Weak), id: "string", args: [], bound: Copyable }), Copyable)] }, output: TypeRowBase { types: [ TypeBase(Variable(0, Any), Any), TypeBase(Function(FuncTypeBase { input: TypeRowBase { types: [TypeBase(Sum(Unit { size: 1 }), Copyable), TypeBase(Sum(Unit { size: 1 }), Copyable)] }, output: TypeRowBase { types: [] }, runtime_reqs: ExtensionSet({}) }), Copyable)] }, runtime_reqs: ExtensionSet({IdentList("arithmetic.conversions")}) }), Copyable) with environment [Type { b: Any }]
acl-cqc
changed the title
tests: [Very WIP] Better proptests for Type
test: [Very WIP] Better proptests for Type
Dec 23, 2024
Example original type TypeBase(Extension(CustomType { extension: IdentList("collections.list"), extension_ref: (Weak), id: "List", args: [Type { ty: TypeBase(Variable(0, Any), Any) }], bound: Any }), Any) Original environment [Type { b: Any }] Substituted variable 0: Type { ty: TypeBase(Sum(General { rows: [TypeRowBase { types: [TypeBase(Function(FuncTypeBase { input: TypeRowBase { types: [TypeBase(Extension(CustomType { extension: IdentList("prelude"), extension_ref: (Weak), id: "usize", args: [], bound: Copyable }), Copyable)] }, output: TypeRowBase { types: [TypeBase(Variable(0, Any), Any)] }, runtime_reqs: ExtensionSet({IdentList("logic")}) }), Copyable), TypeBase(Extension(CustomType { extension: IdentList("prelude"), extension_ref: (Weak), id: "qubit", args: [], bound: Any }), Any), TypeBase(Extension(CustomType { extension: IdentList("arithmetic.float.types"), extension_ref: (Weak), id: "float64", args: [], bound: Copyable }), Copyable)] }] }), Any) } Substitution result: TypeBase(Extension(CustomType { extension: IdentList("collections.list"), extension_ref: (Weak), id: "List", args: [Type { ty: TypeBase(Sum(General { rows: [TypeRowBase { types: [TypeBase(Function(FuncTypeBase { input: TypeRowBase { types: [TypeBase(Extension(CustomType { extension: IdentList("prelude"), extension_ref: (Weak), id: "usize", args: [], bound: Copyable }), Copyable)] }, output: TypeRowBase { types: [TypeBase(Variable(0, Any), Any)] }, runtime_reqs: ExtensionSet({IdentList("logic")}) }), Copyable), TypeBase(Extension(CustomType { extension: IdentList("prelude"), extension_ref: (Weak), id: "qubit", args: [], bound: Any }), Any), TypeBase(Extension(CustomType { extension: IdentList("arithmetic.float.types"), extension_ref: (Weak), id: "float64", args: [], bound: Copyable }), Copyable)] }] }), Any) }], bound: Any }), Any)
acl-cqc
changed the title
test: [Very WIP] Better proptests for Type
test: proptest Type validation and substitution
Dec 23, 2024
Here's an example:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
proptest::Strategy
s that produce valid/well-formed Types/etc.Vec<TypeParam>
declaring all variables that are usedfold
or "State monad"-like mechanism of passing in an environment to each Strategy that then returns a copy of that environment with potentially more variables.)Using
std_reg()
, thus produce types and valid substitutions for the variables in those types; check the type is valid in the original environment, and after substitution, is valid in the environment for the substituted-in values.Coverage of making TypeArgs for TypeParam::{List, Tuple, Extensions} is missing because the
std_reg()
does not declare any types taking those kinds of type arguments (!)....hence, TODOs:prop_filter
for "interesting" cases, to check such are actually generated. This may allow tweaking/improving probabilities/distributions.Type
proptests (should be subsumed by this, but potentially simpler/easier-to-understand)And, extend this to test substitution of nodes/operations - in time, that will probably be a second PR.