Skip to content

Reject Streamed Parameters that are Also Tagged - #824

Merged
InsertCreativityHere merged 2 commits into
icerpc:mainfrom
InsertCreativityHere:disallow-tagged-stream-parameters
Sep 14, 2026
Merged

InsertCreativityHere merged 2 commits into
icerpc:mainfrom
InsertCreativityHere:disallow-tagged-stream-parameters

Conversation

@InsertCreativityHere

Copy link
Copy Markdown
Member

This PR fixes #823, which I realized while reviewing the recent docs changes to streamed parameters.

Apparently, slicec has never rejected these: tag(5) myParam: stream int32? - which it should.
Tags allow you to add/remove parameters and fields while maintaining on-the-wire compatibility, which is already possible for streamed parameters, even without tags. So this was never a meaningful thing to write.

Additionally, streams use their own encoding and semantics, both different from tags.


I'm targeting this for 0.4.1, even though it's technically a source-incompatible change. I don't think anyone is doing this, it's never been an intentionally supported syntax, and it's a trivial change (just remove the tag(6)) for users.

For the record, the code generators just completely ignore the tag in this case, since it splits parameters into streamed and non-streamed before checking tags.

What's Changed:

slicec

  • slicec now emits an error for streamed parameters that also have tags. There is no point in applying a tag to a streamed parameter, and any such tags should be removed.

Copilot AI 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.

🟢 Approval recommended

The validation, diagnostic, and regression coverage are complete with no unresolved blocking issues.

Pull request overview

This PR updates slicec to reject streamed parameters that also specify tags.

Changes:

  • Add validation for tagged streamed parameters.
  • Add the E037 diagnostic.
  • Add regression test coverage.
File summaries
File Description
slicec/tests/interfaces/operations.rs Tests rejection of tagged streamed parameters.
slicec/src/validators/parameters.rs Validates streamed parameters are untagged.
slicec/src/diagnostics/errors.rs Defines the new diagnostic.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread slicec/tests/interfaces/operations.rs Outdated
module Test

interface I {
op(tag(79) s: stream bool?)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe add a second test case for stream return?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Added a 2nd test case. We have one operation which tests an input-parameter, and a second operation which tests a return-type.

parameter_identifier: String,
},

/// A streamed parameter was also tagged.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
/// A streamed parameter was also tagged.
/// A streamed parameter must not be tagged.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think the current wording is consistent with the rest of the file. We structure our errors like:

/// What actually happened
TheRuleThatWasBroken,

Otherwise, it'd just be like restating the same thing twice.

Here, the variant is named StreamedParamsCannotBeTagged (the rule),
and the comment says"A streamed parameter was also tagged" (what concretely happens to break the rule).

@InsertCreativityHere
InsertCreativityHere merged commit b57663f into icerpc:main Sep 14, 2026
7 checks passed
InsertCreativityHere added a commit that referenced this pull request Sep 14, 2026
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.

slicec Does not Reject Tagged Streamed Parameters

4 participants