-
Notifications
You must be signed in to change notification settings - Fork 35
Implement AST multi-error recovery #383
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -864,6 +864,7 @@ impl Value { | |
| } | ||
| } | ||
| } | ||
| TypeInner::Never => unreachable!("poisoned type in value reconstruction; values exist only for error-free programs"), | ||
| } | ||
| } | ||
| debug_assert_eq!(output.len(), 1); | ||
|
|
@@ -937,6 +938,7 @@ impl crate::ArbitraryOfType for Value { | |
| .collect::<arbitrary::Result<Vec<Self>>>()?; | ||
| Ok(Self::list(elements, ty.as_ref().clone(), *bound)) | ||
| } | ||
| TypeInner::Never => unreachable!("cannot generate a value of a poisoned type"), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In fdfae8b: This one is not unreachable. We should return an Arbitrary error here indicating that there is no value of the never type.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed with @KyrylR that this PR is too large to review as one unit. I'm splitting it into a sequence: (Rough split, not yet validated)
@apoelstra, I plan to address your comment about the Arbitrary branch in (1). I'll also rewrite the doc comment "recovered subtree" and "re-report" are not defined anywhere. Sorry for the churn. Keeping this open as a draft for the overall design; I'll close it once (4) |
||
| } | ||
| } | ||
| } | ||
|
|
@@ -1257,7 +1259,7 @@ impl TreeLike for Destructor<'_> { | |
| Self::WrongType => return Tree::Nullary, | ||
| }; | ||
| match ty.as_inner() { | ||
| TypeInner::Boolean | TypeInner::UInt(..) => Tree::Nullary, | ||
| TypeInner::Boolean | TypeInner::UInt(..) | TypeInner::Never => Tree::Nullary, | ||
| TypeInner::Enum(info) => match destruct::as_enum_leaf(value, info.variants().len()) { | ||
| Some((index, leaf)) => { | ||
| Tree::Unary(Self::new(leaf, info.variants()[index].payload_type())) | ||
|
|
||
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.
In fdfae8b:
What is a "recovered subtree" what does it mean to "re-report" a type?