Skip to content

Qualify address classes in @fromString with inet:: - #1221

Open
torokati44 wants to merge 1 commit into
inet-framework:masterfrom
torokati44:fix/qualify-fromstring-address-classes
Open

torokati44 wants to merge 1 commit into
inet-framework:masterfrom
torokati44:fix/qualify-fromstring-address-classes

Conversation

@torokati44

@torokati44 torokati44 commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

51e70f3 made L3Address and Ipv6Address @editable. Since then, the generated descriptor of any message with a field of these types calls their @fromString expression, which named the class without its namespace (L3Address($)). That doesn't compile for messages outside namespace inet; Simu5G's M1Message fails, for example. This PR spells all five address classes as inet::X($): MacAddress, L3Address, ClnsAddress, Ipv4Address and Ipv6Address. That way the three that aren't @editable yet won't break the same way later.


Devin Review

51e70f3 made L3Address and Ipv6Address @editable, so the generated
descriptor of any message with a field of these types now calls their
@fromString expression. The expression named the class unqualified
(L3Address($)), which does not compile in a project whose messages are
outside namespace inet; Simu5G failed on its M1Message.

All five address classes (MacAddress, L3Address, ClnsAddress,
Ipv4Address, Ipv6Address) now spell inet::X($), so the ones that are
not @editable yet do not break the same way later.

@devin-ai-integration devin-ai-integration Bot 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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@torokati44

Copy link
Copy Markdown
Member Author

Side note, not addressed here: Units.msg has the same pattern.
The unit classes (b, B, bps, Hz, m, Ohmm, rad, W) use unqualified constructors in @fromString and @fromValue, e.g. @fromString(b(string2long($))). They aren't @editable, so that code is only generated if someone marks a unit-typed field @editable in a message outside namespace inet.
Nothing breaks today, and I haven't confirmed it would fail to compile.
If it does, the fix would be to spell them as inet::units::values::X(...).

@levy

levy commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

Thinking about this, it seems to be the wrong place to fix this. It means that all such properties need to be qualified. How does the type's author supposed to know if the type gets used in any downstream project?

@torokati44

Copy link
Copy Markdown
Member Author

So maybe the message compiler should handle this instead? 🤔

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.

2 participants