Skip to content

Infer Option::None from compound-literal expected types (v0.1.21) - #20

Merged
Cod-e-Codes merged 1 commit into
mainfrom
fix/compound-lit-expected-type
Aug 14, 2026
Merged

Infer Option::None from compound-literal expected types (v0.1.21)#20
Cod-e-Codes merged 1 commit into
mainfrom
fix/compound-lit-expected-type

Conversation

@Cod-e-Codes

Copy link
Copy Markdown
Owner

Summary

  • Type checker / Codegen: array, tuple, and [value; N] elements, assignment, returned compounds, and enum variant payloads now check against the adjacent expected type (same expr_expected helper as struct fields, call arguments, send, and Box::new). This impacts let a: [Option<int>; 1] = [Option::None], (Option::None, 1), [Option::Some(4)] (emits Option_int, not bare (Option)), x = Option::None, return [Option::None], and Result::Err(Option::None) as a compound element. Unannotated let empty = Option::None still requires an annotation.
  • Harness: filtered test_runner.sh skips non-matching TSV rows without a tr process per field. A .ion filter is exact; a bare stem stays a substring.

Test plan

  • cargo fmt --check
  • cargo test
  • cargo clippy -- -D warnings
  • tests/test_runner.sh (332 passed locally; Linux CI)
  • Example ion-build projects compile (including examples/data_lib)
  • Confirm annotated compound Option::None / Option::Some cases compile and run; unannotated let empty = Option::None still errors
  • Filtered harness ./test_runner.sh test_tuple_option_none.ion test_option_none_call_arg.ion finishes in seconds and does not pull in test_option_none_call_arg_middle

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.
@Cod-e-Codes
Cod-e-Codes merged commit 678e4ec into main Aug 14, 2026
7 checks passed
@Cod-e-Codes
Cod-e-Codes deleted the fix/compound-lit-expected-type branch August 14, 2026 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant