Keep leading and traling trivias on identifiers to prevent some syntax errors

This commit is contained in:
fabien.menager
2022-10-05 17:41:33 +02:00
parent 6aa1e60309
commit f61a30d013
3 changed files with 53 additions and 2 deletions
@@ -0,0 +1,17 @@
using System;
using EntityFrameworkCore.Projectables;
using Foo;
// <auto-generated/>
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
{
public static class Foo_A_IsB
{
public static System.Linq.Expressions.Expression<System.Func<global::Foo.A, bool>> Expression()
{
return (global::Foo.A @this) =>
@this is global::Foo.B;
}
}
}
@@ -343,6 +343,32 @@ namespace Foo {
return Verifier.Verify(result.GeneratedTrees[0].ToString());
}
[Fact]
public Task InOperator()
{
var compilation = CreateCompilation(@"
using System;
using System.Linq;
using EntityFrameworkCore.Projectables;
namespace Foo {
class A {
[Projectable]
public bool IsB => this is B;
}
class B : A {
}
}
");
var result = RunGenerator(compilation);
Assert.Empty(result.Diagnostics);
Assert.Single(result.GeneratedTrees);
return Verifier.Verify(result.GeneratedTrees[0].ToString());
}
[Fact]
public Task ProjectableExtensionMethod()
{