Skip to content

Allow VariableReference as NamedArgument value - #218

Open
eemeli wants to merge 4 commits into
mainfrom
variable-named-args
Open

Allow VariableReference as NamedArgument value#218
eemeli wants to merge 4 commits into
mainfrom
variable-named-args

Conversation

@eemeli

@eemelieemeli commented Jan 2, 2026

Copy link
Copy Markdown
Member

This will need a rebase once #217 is merged. Only the last commit is really part of this PR.Edit: done.

This corresponds to the changes proposed in projectfluent/fluent#379.

@eemelieemeli added fluent.syntax Issues related to the fluent.syntax module. fluent.runtime Issues related to the fluent.runtime module. labels Jan 2, 2026

@functionzzfunctionzz left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly looks good to me but I left a few things to check over.

For fluent.runtime/fluent/runtime/resolver.py, there is a suspicious definition that may need to be changed, perhaps to:

classNamedArgument(FTL.NamedArgument, BaseResolver):
name: Identifiervalue: Union[NumberLiteral, StringLiteral, FTL.VariableReference]

)
assert val == "a thing"
assert errs == []

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe also add a test that checks for no args like for test_functions.py?

deftest_missing_variable_named_arg(self, bundle):
val, errs=bundle.format_pattern(
bundle.get_message("thing-variable-arg").value, {}
)
assertval=="the thing"asserterrs== [FluentReferenceError('Unknown external: art')]

@eemeli
eemeli requested a review from functionzzJune 1, 2026 15:30

@functionzzfunctionzz left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fluent.runtimeIssues related to the fluent.runtime module.fluent.syntaxIssues related to the fluent.syntax module.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@eemeli@functionzz