Skip to content

Add INamedType.Construct overload with nullable annotations#37271

Merged
cston merged 3 commits intodotnet:masterfrom
cston:36046
Jul 16, 2019
Merged

Add INamedType.Construct overload with nullable annotations#37271
cston merged 3 commits intodotnet:masterfrom
cston:36046

Conversation

@cston
Copy link
Copy Markdown
Contributor

@cston cston commented Jul 16, 2019

Fixes #36046

@cston cston requested a review from a team as a code owner July 16, 2019 18:03
@cston
Copy link
Copy Markdown
Contributor Author

cston commented Jul 16, 2019

@dotnet/roslyn-compiler, @jasonmalinowski, please review.

@cston cston requested a review from a team as a code owner July 16, 2019 18:18
return Construct(builder.ToImmutableAndFree(), unbound: false);
}

INamedTypeSymbol INamedTypeSymbol.Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<CodeAnalysis.NullableAnnotation> typeArgumentNullableAnnotations)
Copy link
Copy Markdown
Member

@333fred 333fred Jul 16, 2019

Choose a reason for hiding this comment

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

Is there any reason to allow a default typeArgumentNullableAnnotations? Feels like the user is calling the wrong overload if they pass default instead of calling the other version. #ByDesign

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ideally callers should be able to use a single overload.


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


[Fact]
[WorkItem(37161, "https://github.com/dotnet/roslyn/issues/37161")]
public void EmitPrivateMetadata_ExplicitImplementation()
Copy link
Copy Markdown
Member

@333fred 333fred Jul 16, 2019

Choose a reason for hiding this comment

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

Is this add just a weird merge or something? Doesn't seem relevant. #ByDesign

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

An unrelated test but intentional.


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

@333fred
Copy link
Copy Markdown
Member

333fred commented Jul 16, 2019

Done review pass (commit 3)


public INamedTypeSymbol Construct(ImmutableArray<ITypeSymbol> typeArguments, ImmutableArray<NullableAnnotation> typeArgumentNullableAnnotations)
{
return WrappedSymbol.Construct(typeArguments, typeArgumentNullableAnnotations);
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.

; [](start = 94, length = 1)

.WithNullability(Nullability)

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.

Correct: should work like the method above.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch. Logged #37279


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

Copy link
Copy Markdown
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.

Other than the small bug in NamedTypeSymbolWithNullableAnnotation, looks good to me.

@agocke agocke added this to the 16.3 milestone Jul 16, 2019
Return Construct(builder.ToImmutableAndFree())
End Function

Private Function INamedTypeSymbol_Construct(typeArguments As ImmutableArray(Of ITypeSymbol), typeArgumentNullableAnnotations As ImmutableArray(Of CodeAnalysis.NullableAnnotation)) As INamedTypeSymbol Implements INamedTypeSymbol.Construct
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.

I think we should throw NotImplemented for VB

Copy link
Copy Markdown
Contributor Author

@cston cston Jul 16, 2019

Choose a reason for hiding this comment

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

Presumably NullableAnnotation.Disabled should be supported. Logged
#37278 for other cases.


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

Copy link
Copy Markdown
Member

@jcouv jcouv left a comment

Choose a reason for hiding this comment

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

LGTM Thanks (iteration 3) modulo VB observation (should throw NotImplemented, imo)

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.

INamedTypeSymbol.Construct() does not have a way to pass in nested nullabilities

6 participants