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

[Bug]: Parsing decorators and directives for Namespaces #3165

Closed
tjprescott opened this issue Apr 12, 2024 Discussed in #3164 · 0 comments · Fixed by #3180
Closed

[Bug]: Parsing decorators and directives for Namespaces #3165

tjprescott opened this issue Apr 12, 2024 Discussed in #3164 · 0 comments · Fixed by #3180
Assignees
Labels
bug Something isn't working triaged:core
Milestone

Comments

@tjprescott
Copy link
Member

Discussed in #3164

Originally posted by tjprescott April 12, 2024

#suppress "deprecated"
@TypeSpec.service( { title: "Test", version: "1" } )
namespace Azure.Test {  
  #suppress "foo" "bar"
  @doc("SubNamespace")
  namespace SubNamespace {
    model Blah {
      name: string;
    }      
  }
}

When I examine the type graph nodes:

  • Namespace SubNamespace has one decorator and one directive.
  • Namespace Test only has one decorator and no directives. I would expect it to have one directive and one decorator.

As it turns out, but examining the parent of Test, which is Azure I then observe:

  • Namespace SubNamespace has one decorator and one directive.
  • Namespace Test only has one decorator and no directives.
  • Namespace Azure only has one directive and no decorators.

Given that these are both written in the same way, I would expect both the directive and the decorator to be located on the node for the Test namespace.

Is there a reason they are treated differently? This seems like a bug to me. I can track back through parents, but then (as expected) I end up getting duplicate directives.

@timotheeguerin timotheeguerin added the bug Something isn't working label Apr 12, 2024
@markcowl markcowl added this to the [2024] May milestone Apr 15, 2024
tjprescott added a commit to tjprescott/typespec that referenced this issue Apr 16, 2024
tjprescott added a commit that referenced this issue Apr 16, 2024
Fixes #3165.

Ensures that decorators and directives are attached the leaf node on
Namespace chains.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triaged:core
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants