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

Add support for runtime determined types - #1440

Merged
MichalStrehovsky merged 7 commits into
dotnet:masterfrom
MichalStrehovsky:runtimeDetermined
Jun 29, 2016
Merged

MichalStrehovsky merged 7 commits into
dotnet:masterfrom
MichalStrehovsky:runtimeDetermined

Conversation

@MichalStrehovsky

Copy link
Copy Markdown
Member

A runtime determined type wraps a canonical type and the information
about what generic parameter it is bound to.

Runtime determined types are only expected to show up during dependecy
analysis and when talking to codegen backends that can leverage
the extra information runtime determined types provide on top of
bare canonical forms to do advanced inlining in shared generic method bodies.

@MichalStrehovsky

Copy link
Copy Markdown
Member Author

@davidwrighton Please take a look

I'm especially interested to hear about what behaviors should I unit test. I copied most of the code from NUTC, but I don't know which behaviors are accidental implementation details that nobody uses and which are actually important because NUTC has no unit tests...

I made the decision to make runtime determined types act as signature variable instead of building a parallel mechanism. I assume SomeType<T__Canon, !0> is something that we don't expect to see in the system.

A runtime determined type wraps a canonical type and the information
about what generic parameter it is bound to.

Runtime determined types are only expected to show up during dependecy
analysis and when talking to codegen backends that can leverage
the extra information runtime determined types provide on top of
bare canonical forms to do advanced inlining in shared generic method bodies.

using Debug = System.Diagnostics.Debug;

namespace Internal.TypeSystem

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't end up with a separate copy of this file for scenarios where we have runtime determined types and when we don't. Either we don't allow the existing model of having canonical things without runtimedetermined things, or we make this logic into an algorithm.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made it an algorithm but I'm pretty disgusted with the result. We're swapping perf and elegance in favor of testability of a few dozens of lines of code.

@davidwrighton

Copy link
Copy Markdown
Member

:shipit:

@MichalStrehovsky
MichalStrehovsky merged commit e0ece68 into dotnet:master Jun 29, 2016
@MichalStrehovsky
MichalStrehovsky deleted the runtimeDetermined branch June 29, 2016 20:59
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.

4 participants