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
Copy link
Copy Markdown
Member

@eemeli eemeli commented Jan 2, 2026

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.

@eemeli eemeli added fluent.syntax Issues related to the fluent.syntax module. fluent.runtime Issues related to the fluent.runtime module. labels Jan 2, 2026
Copy link
Copy Markdown

@functionzz functionzz left a comment

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:

class NamedArgument(FTL.NamedArgument, BaseResolver):
    name: Identifier
    value: 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?

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

@eemeli eemeli requested a review from functionzz June 1, 2026 15:30
Copy link
Copy Markdown

@functionzz functionzz left a comment

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 free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fluent.runtime Issues related to the fluent.runtime module. fluent.syntax Issues related to the fluent.syntax module.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants