Giter Site home page Giter Site logo

Make MetadataDisplayFormat public about roslyn HOT 2 OPEN

tmat avatar tmat commented on July 1, 2024 1
Make MetadataDisplayFormat public

from roslyn.

Comments (2)

333fred avatar 333fred commented on July 1, 2024

API Review

  • Rather than exposing a new MetadataDisplayFormat, can we just expose UsePlusForNestedTypes option?
  • Let users then create the format they need
  • What part of metadata format does this cover? Is it class declaration? Is it call syntax with substituted generic types?
    • If we want to have a premade format for this scenario, we should be very precise as to what is supported and what is not.

Conclusion: Needs work. Exposing a UsePlusForNestedTypes option seems reasonable by itself. A format would then need to be very precise as to what it supports and where.

from roslyn.

tmat avatar tmat commented on July 1, 2024

My bad, I didn't notice that s_metadataDisplayFormat is only used by tests and is not the full implementation of fully qualified name.

The intention was to allow the code written in the usage example - that is, given a ITypeSymbol return a fully qualified metadata name in the format that System.Reflection parses to load a type. See https://github.com/dotnet/runtime/blob/main/src/libraries/Common/src/System/Reflection/TypeNameParser.cs.

This format is also used in ECMA-335 when serializing the value of System.Type for custom attribute blob. This is implemented by the compiler here: https://github.com/dotnet/roslyn/blob/main/src/Compilers/Core/Portable/PEWriter/TypeNameSerializer.cs

Examples:

typeof(X<int*[]>.Y<string>[,,]))
X`1+Y`1[[System.Int32*[], System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]][,,]
typeof(X<>.Y<>)
X`1+Y`1

from roslyn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.