Skip to content

fix[next]: validate attribute access, closure variables and sliced inputs in programs - #3084

Draft
havogt wants to merge 1 commit into
GridTools:mainfrom
havogt:program-element-access
Draft

havogt wants to merge 1 commit into
GridTools:mainfrom
havogt:program-element-access

Conversation

@havogt

@havogt havogt commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #3042 with the remaining fixes for element and attribute access in programs:

  • Attributes of named collections were looked up with getattr on the type spec, so a field named like an attribute of NamedCollectionType (keys, types) resolved to the type's own attribute, and an unknown field raised a bare AttributeError. They are now looked up by key, with a DSLError for unknown fields.
  • Enum and FrozenNamespace closure variables (domain={IDim: (Bounds.LOWER, Bounds.UPPER + constants.offset)}) failed in compiled programs. They are folded to constants, as in field operators; a missing member is a MissingAttributeError.
  • Element access on closure variables (CLOSURE_TUPLE[0]) is not supported but passed type deduction unchecked. It is now a DSLError asking to pass the value as an argument.
  • Slicing a field-operator input (fo(a[1:3], out=out)) was silently accepted. Only out can be sliced; other arguments are now a DSLError.

@havogt

havogt commented Dec 3, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Written by an agent on behalf of @havogt

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.

1 participant