Skip to content
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

Several simplifications to TypeSymbolWithAnnotations #28583

Merged
merged 2 commits into from
Jul 16, 2018

Conversation

cston
Copy link
Member

@cston cston commented Jul 16, 2018

Minor changes to TypeSymbolWithAnnotations:

  • Move ToDisplayString to base class
  • Add withTupleUnification parameter to SubstituteType
  • Simplified LazyNullableTypeParameter.SpecialType and IsRestrictedType

Code changes separated out from #28453.

@cston cston requested a review from a team as a code owner July 16, 2018 16:34
@@ -138,21 +138,29 @@ internal TypeSymbolWithAnnotations SubstituteType(TypeSymbolWithAnnotations prev
/// In particular, if substitution makes type tuple compatible, transform it into a tuple type.
/// </summary>
internal TypeSymbolWithAnnotations SubstituteTypeWithTupleUnification(TypeSymbol previous)
Copy link
Member

Choose a reason for hiding this comment

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

More general question: why do we have this API, instead of just using SubstituteType?

Copy link
Member

Choose a reason for hiding this comment

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

Because the compiler does not match the language in the way that tuple types are handled. See #20648 which describes a set of changes that are planned to bring them into alignment.

Copy link
Member

Choose a reason for hiding this comment

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

(I'm afraid I may have answered the question you didn't ask)


In reply to: 202755152 [](ancestors = 202755152)

@@ -304,15 +327,20 @@ public bool IsAtLeastAsVisibleAs(Symbol sym, ref HashSet<DiagnosticInfo> useSite
return NullableUnderlyingTypeOrSelf.IsAtLeastAsVisibleAs(sym, ref useSiteDiagnostics);
}

public virtual TypeSymbolWithAnnotations SubstituteType(AbstractTypeMap typeMap)
Copy link
Member

Choose a reason for hiding this comment

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

virtual [](start = 15, length = 7)

What's the virtual removal change related to?

Copy link
Member Author

Choose a reason for hiding this comment

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

The new protected overload is now virtual so derived classes have a single method to override rather than two.

@333fred
Copy link
Member

333fred commented Jul 16, 2018

Done review pass (commit 2)

Copy link
Member

@333fred 333fred left a comment

Choose a reason for hiding this comment

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

LGTM (commit 2)

@jcouv jcouv added this to the 16.0 milestone Jul 16, 2018
Copy link
Member

@gafter gafter left a comment

Choose a reason for hiding this comment

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

:shipit:

@cston cston merged commit 25b4aba into dotnet:features/NullableReferenceTypes Jul 16, 2018
@cston cston deleted the misc branch July 16, 2018 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants