Infer Option::None from compound-literal expected types (v0.1.21) - #20
Merged
Conversation
Array, tuple, assignment, return, and enum-payload sites share the same adjacent expected-type plumbing as call arguments, so annotated compounds type-check and emit monomorphized Option_int. Filtered test_runner.sh skips non-matching TSV rows without a tr process per field.
This file contains hidden or 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
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.
Summary
[value; N]elements, assignment, returned compounds, and enum variant payloads now check against the adjacent expected type (sameexpr_expectedhelper as struct fields, call arguments,send, andBox::new). This impactslet a: [Option<int>; 1] = [Option::None],(Option::None, 1),[Option::Some(4)](emitsOption_int, not bare(Option)),x = Option::None,return [Option::None], andResult::Err(Option::None)as a compound element. Unannotatedlet empty = Option::Nonestill requires an annotation.test_runner.shskips non-matching TSV rows without atrprocess per field. A.ionfilter is exact; a bare stem stays a substring.Test plan
cargo fmt --checkcargo testcargo clippy -- -D warningstests/test_runner.sh(332 passed locally; Linux CI)ion-buildprojects compile (includingexamples/data_lib)Option::None/Option::Somecases compile and run; unannotatedlet empty = Option::Nonestill errors./test_runner.sh test_tuple_option_none.ion test_option_none_call_arg.ionfinishes in seconds and does not pull intest_option_none_call_arg_middle