Skip to content

Commit

Permalink
Merge pull request #51197 from AlekseyTs/master
Browse files Browse the repository at this point in the history
Merge features/UsedAssemblyReferences into 'master'
  • Loading branch information
msftbot[bot] authored Feb 12, 2021
2 parents fb89a5d + fa751a9 commit 64d1bee
Show file tree
Hide file tree
Showing 695 changed files with 26,181 additions and 9,554 deletions.
8 changes: 8 additions & 0 deletions docs/features/UsedAssemblyReferences.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Used Assembly References
=========================

The *Used Assembly References* feature provides a ```GetUsedAssemblyReferences``` API on a ```Compilation``` to obtain a set
of metadata assembly references that are considered to be used by the compilation. For example, if a type declared in a
referenced assembly is referenced in source code within the compilation, the reference is considered to be used. Etc.

See https://github.com/dotnet/roslyn/issues/37768 for more information.
10 changes: 10 additions & 0 deletions eng/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ param (
[switch][Alias('test')]$testDesktop,
[switch]$testCoreClr,
[switch]$testIOperation,
[switch]$testUsedAssemblies,
[switch]$sequential,
[switch]$helix,
[string]$helixQueueName = "",
Expand Down Expand Up @@ -95,6 +96,7 @@ function Print-Usage() {
Write-Host " -testCoreClr Run CoreClr unit tests"
Write-Host " -testVsi Run all integration tests"
Write-Host " -testIOperation Run extra checks to validate IOperations"
Write-Host " -testUsedAssemblies Run extra checks to validate used assemblies feature"
Write-Host ""
Write-Host "Advanced settings:"
Write-Host " -ci Set when running on CI server"
Expand Down Expand Up @@ -345,6 +347,10 @@ function TestUsingRunTests() {
$env:ROSLYN_TEST_IOPERATION = "true"
}

if ($testUsedAssemblies) {
$env:ROSLYN_TEST_USEDASSEMBLIES = "true"
}

$runTests = GetProjectOutputBinary "RunTests.dll" -tfm "netcoreapp3.1"

if (!(Test-Path $runTests)) {
Expand Down Expand Up @@ -419,6 +425,10 @@ function TestUsingRunTests() {
Remove-Item env:\ROSLYN_TEST_IOPERATION
}

if ($testUsedAssemblies) {
Remove-Item env:\ROSLYN_TEST_USEDASSEMBLIES
}

if ($testVsi) {
$serviceHubLogs = Join-Path $TempDir "servicehub\logs"
if (Test-Path $serviceHubLogs) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public RangeVariableMap RangeVariableMap()
return result;
}

internal RangeVariableSymbol AddRangeVariable(Binder binder, SyntaxToken identifier, DiagnosticBag diagnostics)
internal RangeVariableSymbol AddRangeVariable(Binder binder, SyntaxToken identifier, BindingDiagnosticBag diagnostics)
{
string name = identifier.ValueText;
var result = new RangeVariableSymbol(name, binder.ContainingMemberOrLambda, identifier.GetLocation());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Microsoft.CodeAnalysis.CSharp
{
internal partial class Binder
{
private delegate BoundBlock LambdaBodyFactory(LambdaSymbol lambdaSymbol, Binder lambdaBodyBinder, DiagnosticBag diagnostics);
private delegate BoundBlock LambdaBodyFactory(LambdaSymbol lambdaSymbol, Binder lambdaBodyBinder, BindingDiagnosticBag diagnostics);

private sealed class QueryUnboundLambdaState : UnboundLambdaState
{
Expand All @@ -22,7 +22,7 @@ private sealed class QueryUnboundLambdaState : UnboundLambdaState
private readonly RangeVariableMap _rangeVariableMap;

public QueryUnboundLambdaState(Binder binder, RangeVariableMap rangeVariableMap, ImmutableArray<RangeVariableSymbol> parameters, LambdaBodyFactory bodyFactory, bool includeCache = true)
: base(binder, unboundLambdaOpt: null, includeCache)
: base(binder, includeCache)
{
_parameters = parameters;
_rangeVariableMap = rangeVariableMap;
Expand All @@ -42,7 +42,7 @@ public QueryUnboundLambdaState(Binder binder, RangeVariableMap rangeVariableMap,
public override Location ParameterLocation(int index) { return _parameters[index].Locations[0]; }
public override TypeWithAnnotations ParameterTypeWithAnnotations(int index) { throw new ArgumentException(); } // implicitly typed

public override void GenerateAnonymousFunctionConversionError(DiagnosticBag diagnostics, TypeSymbol targetType)
public override void GenerateAnonymousFunctionConversionError(BindingDiagnosticBag diagnostics, TypeSymbol targetType)
{
// TODO: improved diagnostics for query expressions
base.GenerateAnonymousFunctionConversionError(diagnostics, targetType);
Expand All @@ -63,12 +63,12 @@ protected override BoundExpression GetLambdaExpressionBody(BoundBlock body)
return null;
}

protected override BoundBlock CreateBlockFromLambdaExpressionBody(Binder lambdaBodyBinder, BoundExpression expression, DiagnosticBag diagnostics)
protected override BoundBlock CreateBlockFromLambdaExpressionBody(Binder lambdaBodyBinder, BoundExpression expression, BindingDiagnosticBag diagnostics)
{
throw ExceptionUtilities.Unreachable;
}

protected override BoundBlock BindLambdaBody(LambdaSymbol lambdaSymbol, Binder lambdaBodyBinder, DiagnosticBag diagnostics)
protected override BoundBlock BindLambdaBody(LambdaSymbol lambdaSymbol, Binder lambdaBodyBinder, BindingDiagnosticBag diagnostics)
{
return _bodyFactory(lambdaSymbol, lambdaBodyBinder, diagnostics);
}
Expand Down
Loading

0 comments on commit 64d1bee

Please sign in to comment.