Skip to content
This repository was archived by the owner on Nov 13, 2026. It is now read-only.

Move Name, Namespace and OwningType to DefType - #1553

Merged
MichalStrehovsky merged 1 commit into
dotnet:masterfrom
MichalStrehovsky:nameAndNamespace
Jul 20, 2016
Merged

MichalStrehovsky merged 1 commit into
dotnet:masterfrom
MichalStrehovsky:nameAndNamespace

Conversation

@MichalStrehovsky

Copy link
Copy Markdown
Member

The motivation for this change is:

  • To make the type name formatter general purpose (it can now handle
    NoMetadata types)
  • To make NameMangler able to mangle canon types and runtime
    determined types without special casing

For situation where we have a NoMetadataType, the expectation is that
we're asking for the name for diagnostic purposes only (i.e. name
formatter wants it). In that case:

  • In checked builds, the name can actually be retrieved from diagnostic
    mapping tables, along with the owning type (we have a metadata TypeRef
    for this).
  • In the absence of diagnostic mapping tables, the name can be faked up
    and the type pretended to be non-nested
    ("System.Runtime.NoMetadataTypes.EEType1234ABCD")

As an additional change, I'm also adding Name property on
GenericParameterDesc. We can compute a useful fallback value for this
in absence of metadata ("T" + index).

The motivation for this change is:
* To make the type name formatter general purpose (it can now handle
`NoMetadata` types)
* To make `NameMangler` able to mangle canon types and runtime
determined types without special casing

For situation where we have a NoMetadataType, the expectation is that
we're asking for the name for diagnostic purposes only (i.e. name
formatter wants it). In that case:
* In checked builds, the name can actually be retrieved from diagnostic
mapping tables, along with the owning type (we have a metadata TypeRef
for this).
* In the absence of diagnostic mapping tables, the name can be faked up
and the type pretended to be non-nested
("System.Runtime.NoMetadataTypes.EEType1234ABCD")

As an additional change, I'm also adding `Name` property on
`GenericParameterDesc`. We can compute a useful fallback value for this
in absence of metadata ("T" + index).
@MichalStrehovsky

Copy link
Copy Markdown
Member Author

@davidwrighton PTAL

I'm mostly happy with how this change turned out, except for runtime determined types, where it feels a bit weird. But I'm not sure if we can do anything with runtime determined types that wouldn't be weird.

I can do the proposed changes on the NoMetadata side once this change trickles down to TFS. No fallout is expected at the time of merging (except for having to adapt ContainingType to be a DefType now) and the NoMetadata change can be postponed indefinitely.

@davidwrighton

Copy link
Copy Markdown
Member

I think this is reasonable, and I don't have any particular objections to the changes presented (especially if you're volunteering to do the followon work for NoMetadata stuff in TFS)

@MichalStrehovsky
MichalStrehovsky merged commit 7548882 into dotnet:master Jul 20, 2016
@MichalStrehovsky
MichalStrehovsky deleted the nameAndNamespace branch July 20, 2016 21:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants