Skip to content

Commit

Permalink
Update collection expression tests for .NET 8 (#69705)
Browse files Browse the repository at this point in the history
  • Loading branch information
cston authored Aug 24, 2023
1 parent 72efaa9 commit d7e010b
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10562,7 +10562,9 @@ public static MyCollection<T> Create<T>({{(useScoped ? "scoped" : "")}} ReadOnly
=> new MyCollection<T>(new List<T>(items.ToArray()));
}
""";
var comp = CreateCompilation(new[] { sourceA, CollectionBuilderAttributeDefinition }, targetFramework: targetFramework);
var comp = CreateCompilation(
targetFramework == TargetFramework.Net80 ? new[] { sourceA } : new[] { sourceA, CollectionBuilderAttributeDefinition },
targetFramework: targetFramework);
comp.VerifyEmitDiagnostics();
var refA = comp.EmitToImageReference();

Expand Down Expand Up @@ -13405,7 +13407,9 @@ public static MyCollection<T> Create<T>(ReadOnlySpan<T> items)
=> new MyCollection<T>(new List<T>(items.ToArray()));
}
""";
var comp = CreateCompilation(new[] { sourceA, CollectionBuilderAttributeDefinition }, targetFramework: targetFramework);
var comp = CreateCompilation(
targetFramework == TargetFramework.Net80 ? new[] { sourceA } : new[] { sourceA, CollectionBuilderAttributeDefinition },
targetFramework: targetFramework);
comp.VerifyEmitDiagnostics();
var refA = comp.EmitToImageReference();

Expand Down

0 comments on commit d7e010b

Please sign in to comment.