Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix namespace in blockless namespace with same name #4050

Merged

Conversation

timotheeguerin
Copy link
Member

fix #4049

@azure-sdk
Copy link
Collaborator

azure-sdk commented Jul 30, 2024

All changed packages have been documented.

  • @typespec/compiler
Show changes

@typespec/compiler - fix ✏️

Allow using compact namespace form Foo.Bar when inside another namespace,> tsp,> namespace MyOrg.MyProject {,> namespace MyModule.MySubmodule { // <-- this used to emit an error,> // ...,> },> },>

@typespec/compiler - breaking ✏️

Fix issue where naming a namespace with the same name as the blockless namespace would merge with it instead of creating a subnamespace like any other name would.,> ,> tsp,> namespace MyOrg.MyProject;,> ,> namespace MyOrg.MyProject.MyArea {,> model A {},> },> ,> namespace MyArea2 {,> model B {},> },> ,> ,> Previously model A would end-up in namespace MyOrg.MyProject.MyArea and model B in MyOrg.MyProject.MyArea2. With this change model A will now be in MyOrg.MyProject.MyOrg.MyProject.MyArea. To achieve the previous behavior the above code should be written as:,> ,> tsp,> namespace MyOrg.MyProject;,> ,> namespace MyArea {,> model A {},> },> ,> namespace MyArea2 {,> model B {},> },>

@timotheeguerin timotheeguerin added breaking-change A change that might cause specs or code to break triaged:core labels Jul 30, 2024
@azure-sdk
Copy link
Collaborator

You can try these changes here

🛝 Playground 🌐 Website 📚 Next docs

Copy link
Member

@chrisradek chrisradek left a comment

Choose a reason for hiding this comment

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

Implementation looks good. I didn't fully understand the issue until reading the changelog because looking at the playground example my brain wanted to think those namespaces should merge, but I understand why they shouldn't.

Obviously needs breaking change review.

@timotheeguerin timotheeguerin added this pull request to the merge queue Aug 5, 2024
Merged via the queue into microsoft:main with commit 272bd4c Aug 5, 2024
22 checks passed
@timotheeguerin timotheeguerin deleted the fix/namespace-in-blockless branch August 5, 2024 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change A change that might cause specs or code to break compiler:core Issues for @typespec/compiler triaged:core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Namespace inside global namespace doesn't always resolve relative to it
3 participants