Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public PrimitiveTypeResolver(TypeStore typeStore) : base(typeStore)
{
}

private static ExternalTypeReference CreateExternalTypeRef(string @namespace, string name)
=> new ExternalTypeReference(new IdentifierSymbol(@namespace), new IdentifierSymbol(name));
private static ExternalTypeReference CreateExternalTypeRef(string? @namespace, string name)
=> new ExternalTypeReference(@namespace is not null ? new IdentifierSymbol(@namespace) : null, new IdentifierSymbol(name));
private static readonly Dictionary<string, TypeReference> _typeMap = new Dictionary<string, TypeReference>()
{
["bool"] = CreateExternalTypeRef("System", "Boolean"),
Expand All @@ -35,6 +35,7 @@ private static ExternalTypeReference CreateExternalTypeRef(string @namespace, st
["ulong"] = CreateExternalTypeRef("System", "UInt64"),
["short"] = CreateExternalTypeRef("System", "Int16"),
["ushort"] = CreateExternalTypeRef("System", "UInt16"),
["void"] = CreateExternalTypeRef(null, "void")
};

/// <inheritdoc />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ public sealed class PrimitiveTypeResolverTests
InlineData("ulong", "System", "UInt64"),
InlineData("short", "System", "Int16"),
InlineData("ushort", "System", "UInt16"),
InlineData("void", null, "void"),
]
public void ShouldResolve(string text, string @namespace, string identifier)
public void ShouldResolve(string text, string? @namespace, string identifier)
{
var symbol = new UnresolvedTypeReference(text);
var output = new PrimitiveTypeResolver(new TypeStore());
Expand Down