Skip to content

Commit 88cebbc

Browse files
authored
Merge pull request #61 from koenbeuk/issue-53
Simplified type resolution
2 parents 6de068b + 220fe4f commit 88cebbc

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

src/EntityFrameworkCore.Projectables.Generator/ExpressionSyntaxRewriter.cs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -214,14 +214,9 @@ public ExpressionSyntaxRewriter(INamedTypeSymbol targetTypeSymbol, NullCondition
214214
// if this node refers to a named type which is not yet fully qualified, we want to fully qualify it
215215
if (symbol.Kind is SymbolKind.NamedType && node.Parent?.Kind() is not SyntaxKind.QualifiedName)
216216
{
217-
var typeInfo = _semanticModel.GetTypeInfo(node);
218-
219-
if (typeInfo.Type is not null)
220-
{
221-
return SyntaxFactory.ParseTypeName(
222-
typeInfo.Type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)
223-
).WithLeadingTrivia(node.GetLeadingTrivia());
224-
}
217+
return SyntaxFactory.ParseTypeName(
218+
symbol.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)
219+
).WithLeadingTrivia(node.GetLeadingTrivia());
225220
}
226221
}
227222

tests/EntityFrameworkCore.Projectables.Generator.Tests/ProjectionExpressionGeneratorTests.MixPrimaryConstructorAndProperties.verified.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace EntityFrameworkCore.Projectables.Generated
77
{
88
static global::System.Linq.Expressions.Expression<global::System.Func<global::Foo.EntityExtensions.Entity, global::Foo.EntityExtensions.Entity>> Expression()
99
{
10-
return (global::Foo.EntityExtensions.Entity entity) => new Entity(entity.Id)
10+
return (global::Foo.EntityExtensions.Entity entity) => new global::Foo.EntityExtensions.Entity(entity.Id)
1111
{FullName = entity.FullName};
1212
}
1313
}

tests/EntityFrameworkCore.Projectables.Generator.Tests/ProjectionExpressionGeneratorTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1615,7 +1615,6 @@ public Task GenericTypesWithConstraints()
16151615
return Verifier.Verify(result.GeneratedTrees[0].ToString());
16161616
}
16171617

1618-
16191618
#region Helpers
16201619

16211620
Compilation CreateCompilation(string source, bool expectedToCompile = true)

0 commit comments

Comments
 (0)