-
Notifications
You must be signed in to change notification settings - Fork 232
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
Prevent use of augment decorators on template instantiations #1744
Conversation
Changes in this PR will be published to the following url to try(check status of TypeSpec Pull Request Try It pipeline for publish status): Website: https://cadlwebsite.z1.web.core.windows.net/prs/1744/ |
You can try these changes at https://cadlplayground.z22.web.core.windows.net/prs/1744/ Check the website changes at https://cadlwebsite.z1.web.core.windows.net/prs/1744/ |
b776102
to
bae4228
Compare
3322e30
to
7d2f6ac
Compare
"test.tsp", | ||
` | ||
import "./test.js"; | ||
|
||
model Foo<T> { | ||
testProp: T; | ||
}; | ||
|
||
@test | ||
op stringTest(): Foo<string>; | ||
|
||
@@customName(Foo, "Some foo thing"); | ||
` | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@timotheeguerin so this will not work if you do:
@@customName(Foo<T>, "Some foo thing");
Is that okay? One scenario we've seen with docs looks like:
@doc("Foo of {T}", T)
model Foo<T> {
prop: T;
}
How would that work with augment? Like this?
@@doc(Foo<T>, "Foo of {T}", T)
With this PR, the above would throw a diagnostic.
78bbe11
to
10a15e6
Compare
10a15e6
to
474a446
Compare
Fix #1354.
Throws a diagnostic if any arguments are provided in the augment decorator.
Error
@@decorator(Foo<string>, "blah")
Error
@@decorator(Foo<T>, "blah")
Okay
@@decorator(Foo, "blah") // the template args left off