Skip to content

Commit

Permalink
Calculate TypeParameterKind based on the container type (dotnet#54104)
Browse files Browse the repository at this point in the history
  • Loading branch information
MykolaBalakin committed Jun 23, 2021
1 parent 8b768a1 commit 070feb0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public override bool IsImplicitlyDeclared
get { return true; }
}

public override TypeParameterKind TypeParameterKind => ContainingSymbol is MethodSymbol ? TypeParameterKind.Method : TypeParameterKind.Type;

internal override void AddSynthesizedAttributes(PEModuleBuilder moduleBuilder, ref ArrayBuilder<SynthesizedAttributeData> attributes)
{
base.AddSynthesizedAttributes(moduleBuilder, ref attributes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public override int Ordinal

public override TypeParameterKind TypeParameterKind
{
get { return TypeParameterKind.Type; }
get { return ContainingSymbol is MethodSymbol ? TypeParameterKind.Method : TypeParameterKind.Type; }
}

public override bool HasConstructorConstraint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.ExpressionEvaluator

Public Overrides ReadOnly Property TypeParameterKind As TypeParameterKind
Get
Return TypeParameterKind.Type
Return If(TypeOf Me.ContainingSymbol Is MethodSymbol, TypeParameterKind.Method, TypeParameterKind.Type)
End Get
End Property

Expand Down

0 comments on commit 070feb0

Please sign in to comment.