-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add speclet for file-local types #6233
Conversation
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.
LGTM Thanks (iteration 4)
It was suggested in email thread with LDT that we do nothing re: attributes. i.e. you can declare 'file class C : System.Attribute' and use it in '[C]', and we won't give a diagnostic or do anything else unusual. It wasn't clear if we had consensus about that. |
proposals/file-types.md
Outdated
@@ -137,14 +137,22 @@ namespace NS1 | |||
Therefore, we don't specify the feature in terms of which scope the type is contained in, but rather as additional "filtering rules" in member lookup. | |||
|
|||
### Attributes | |||
In the initial iteration of the feature, a file type is not allowed to be used as an attribute. Such attributes are of limited utility for users who are unaware of the internal name generation strategy used in the implementation. | |||
File classes are permitted to be attribute types, and can be used as attributes within both file types and non-file types, just as if the attribute type were a non-file type. The metadata name of the file-local attribute type still goes through the same name generation strategy as other file-local types. This means detecting the presence of a file-type by a hard-coded string name is likely to be impractical, because it requires depending on the internal name generation strategy of the compiler, which may change over time. However, detecting via `typeof(MyFileLocalAttribute)` works. |
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.
There are several different names used: "file type", "file-local ... type", and "file-type". Consider choosing one or perhaps two names to use.
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.
Yeah, I'm going to make a pass to change everything to "file-local" types, here and in the implementation.
Related to dotnet/roslyn#60819