Skip to content

Conversation

@JohannesMeierSE
Copy link
Contributor

No description provided.

if (rule.fragment) {
if (rule.dataType || rule.returnType || rule.inferredType) {
accept('error',
"Fragments assign values to the object of the caller, but don't create a new object themselves. Therefore specifying the type of the returned object is not possible.",
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: The validation message is too long IMO.

Suggested change
"Fragments assign values to the object of the caller, but don't create a new object themselves. Therefore specifying the type of the returned object is not possible.",
"Fragment rules cannot specify a return type.",

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense, the longer description about why can be found in the documentation if the user requires more details: https://langium.org/docs/reference/grammar-language/#rule-fragments

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just pushed a new commit with the proposed, shorter error message.

@JohannesMeierSE JohannesMeierSE merged commit 6f9c6d7 into main Oct 30, 2025
4 checks passed
@JohannesMeierSE JohannesMeierSE deleted the jm/validate-fragment-keywords branch October 30, 2025 07:44
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.

4 participants