Skip to content

Commit

Permalink
Use TypeKind
Browse files Browse the repository at this point in the history
  • Loading branch information
jcouv committed Apr 8, 2021
1 parent 53b3532 commit c86b23e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/Features/Core/Portable/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const Microsoft.CodeAnalysis.TextTags.Record = "Record" -> string
const Microsoft.CodeAnalysis.TextTags.RecordStruct = "RecordStruct" -> string
Microsoft.CodeAnalysis.Completion.CompletionItem.IsComplexTextEdit.get -> bool
Microsoft.CodeAnalysis.Completion.CompletionItem.WithIsComplexTextEdit(bool isComplexTextEdit) -> Microsoft.CodeAnalysis.Completion.CompletionItem
static Microsoft.CodeAnalysis.Completion.CompletionChange.Create(Microsoft.CodeAnalysis.Text.TextChange textChange, System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Text.TextChange> textChanges, int? newPosition = null, bool includesCommitCharacter = false) -> Microsoft.CodeAnalysis.Completion.CompletionChange
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public static MemberDeclarationSyntax GenerateNamedTypeDeclaration(

var members = GetMembers(namedType).Where(s => s.Kind != SymbolKind.Property || PropertyGenerator.CanBeGenerated((IPropertySymbol)s))
.ToImmutableArray();
if (namedType.IsRecord && namedType.IsReferenceType)
if (namedType.IsRecord && namedType.TypeKind is TypeKind.Class)
{
declaration = GenerateRecordMembers(service, options, (RecordDeclarationSyntax)declaration, members, cancellationToken);
}
Expand Down Expand Up @@ -198,7 +198,7 @@ private static MemberDeclarationSyntax GetDeclarationSyntaxWithoutMembersWorker(
TypeDeclarationSyntax typeDeclaration;
if (namedType.IsRecord)
{
typeDeclaration = namedType.IsReferenceType
typeDeclaration = namedType.TypeKind is TypeKind.Class
? SyntaxFactory.RecordDeclaration(SyntaxFactory.Token(SyntaxKind.RecordKeyword), namedType.Name.ToIdentifierToken())
: SyntaxFactory.RecordStructDeclaration(SyntaxFactory.Token(SyntaxKind.RecordKeyword), namedType.Name.ToIdentifierToken());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public virtual ImmutableArray<INamedTypeSymbol> Interfaces
public ImmutableArray<INamedTypeSymbol> AllInterfaces
=> ImmutableArray.Create<INamedTypeSymbol>();

public bool IsReferenceType => TypeKind != TypeKind.Enum && TypeKind != TypeKind.Struct && TypeKind != TypeKind.Error;
public bool IsReferenceType => false;

public bool IsValueType => TypeKind == TypeKind.Struct || TypeKind == TypeKind.Enum;

Expand Down

0 comments on commit c86b23e

Please sign in to comment.