Skip to content

Treat one-element initializer lists {x} as vectors - #423

Open
willend wants to merge 1 commit into
mainfrom
fix-single-element-vector
Open

willend wants to merge 1 commit into
mainfrom
fix-single-element-vector

Conversation

@willend

@willend willend commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Fixes #422.

Expr.vector_known required more than one element, so a one-element initializer list {80} was emitted as the scalar dPar = 80, which does not compile. vector_known now also accepts ObjectType.initializer_list. Expr.value uses the same test, so the list branch in c_initialise.py gets [80].

Tested:

  • Full test suite passes (1340 passed), plus a new test_expr_parse_single_element_brace_list.
  • Test_SiC from mcstas-comps: inventory cleanup and test coverage McCode#3219 now gives calloc + dPar[0] = 80 + free, compiles, and matches its %Test values.
  • A default Multilayer_Sample() gives dPar[0] = 20.0 (it was dPar = 20.0).

🤖 Generated with Claude Code

{80} was emitted as the scalar dPar = 80, which does not compile.
Fixes #422.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

One-element vector initializer {x} emitted as a scalar

1 participant