Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/features/function-pointers' in…
Browse files Browse the repository at this point in the history
…to function-pointer-type-lookup

* upstream/features/function-pointers: (86 commits)
  Better client / server logging (dotnet#46079)
  Fix OptProf config
  Update src/VisualStudio/LiveShare/Impl/AbstractGoToDefinitionWithFindUsagesServiceHandler.cs
  Do not execute RemoveUnnecessaryInlineSuppressions on generated code
  Update dependencies from https://github.com/dotnet/arcade build 20200715.6 (dotnet#46086)
  Use ISpanMapper before sending cross file results to LSP
  Add additional module initializers tests from review (dotnet#46020)
  Fix type in OptProf configuration
  bump to 500
  Fixed VS crash during implicit conversion of null object in nullable walker (dotnet#45974)
  Rename variable
  Fix KeyNotFound exception in RemoveUnnecessaryInlineSuppressionsDiagnosticAnalyzer
  Check modifiers on record positional members (dotnet#45898)
  Fix typos and link in Source Generators cookbook (dotnet#44372)
  Remove reference to non-existing VisualStudioInteractiveComponents.vsix from deployment VSIX. (dotnet#45979)
  Address feedback + fix tests
  Update dependencies from https://github.com/dotnet/roslyn build 20200711.1 (dotnet#45932)
  Make MetadataTypeName non-copyable
  Fix usage of GetService extension
  Consolidate service provider extensions
  ...
  • Loading branch information
333fred committed Jul 23, 2020
2 parents 0c443cd + 6202837 commit 6c56c2a
Show file tree
Hide file tree
Showing 285 changed files with 9,357 additions and 2,229 deletions.
10 changes: 5 additions & 5 deletions Compilers.sln
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CSharpErrorFactsGenerator",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CSharpSyntaxGenerator", "src\Tools\Source\CompilerGeneratorTools\Source\CSharpSyntaxGenerator\CSharpSyntaxGenerator.csproj", "{288089C5-8721-458E-BE3E-78990DAB5E2D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IOperationGenerator", "src\Tools\Source\CompilerGeneratorTools\Source\IOperationGenerator\CompilersIOperationGenerator.csproj", "{D0A79850-B32A-45E5-9FD5-D43CB345867A}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CompilersIOperationGenerator", "src\Tools\Source\CompilerGeneratorTools\Source\IOperationGenerator\CompilersIOperationGenerator.csproj", "{D0A79850-B32A-45E5-9FD5-D43CB345867A}"
EndProject
Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "VisualBasicSyntaxGenerator", "src\Tools\Source\CompilerGeneratorTools\Source\VisualBasicSyntaxGenerator\VisualBasicSyntaxGenerator.vbproj", "{6AA96934-D6B7-4CC8-990D-DB6B9DD56E34}"
EndProject
Expand Down Expand Up @@ -303,10 +303,10 @@ Global
{288089C5-8721-458E-BE3E-78990DAB5E2D}.Debug|Any CPU.Build.0 = Debug|x64
{288089C5-8721-458E-BE3E-78990DAB5E2D}.Release|Any CPU.ActiveCfg = Release|x64
{288089C5-8721-458E-BE3E-78990DAB5E2D}.Release|Any CPU.Build.0 = Release|x64
{D0A79850-B32A-45E5-9FD5-D43CB345867A}.Debug|Any CPU.ActiveCfg = Debug|x64
{D0A79850-B32A-45E5-9FD5-D43CB345867A}.Debug|Any CPU.Build.0 = Debug|x64
{D0A79850-B32A-45E5-9FD5-D43CB345867A}.Release|Any CPU.ActiveCfg = Release|x64
{D0A79850-B32A-45E5-9FD5-D43CB345867A}.Release|Any CPU.Build.0 = Release|x64
{D0A79850-B32A-45E5-9FD5-D43CB345867A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D0A79850-B32A-45E5-9FD5-D43CB345867A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D0A79850-B32A-45E5-9FD5-D43CB345867A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D0A79850-B32A-45E5-9FD5-D43CB345867A}.Release|Any CPU.Build.0 = Release|Any CPU
{6AA96934-D6B7-4CC8-990D-DB6B9DD56E34}.Debug|Any CPU.ActiveCfg = Debug|x64
{6AA96934-D6B7-4CC8-990D-DB6B9DD56E34}.Debug|Any CPU.Build.0 = Debug|x64
{6AA96934-D6B7-4CC8-990D-DB6B9DD56E34}.Release|Any CPU.ActiveCfg = Release|x64
Expand Down
25 changes: 25 additions & 0 deletions docs/compilers/CSharp/Warnversion Warning Waves.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# /warnversion warning "waves"

The C# compiler flag `/warnversion` controls optional warnings.
When we introduce new warnings that can be reported on existing code,
we do so under an opt-in system so that programmers do not see new warnings
without taking action to enable them.
For that purpose, we have introduced the compiler flag "`/warnversion=n`"
where `n` is a whole number or a decimal number.
For a warning that was introduced in dotnet version `k`,
that warning will be produced if the warning version `n` specified when compiling is
greater than or equal to `k` and a compiler shipped with dotnet version
`k` or later is used to compile the code.

The default warning version is `0` (produce no optional warnings).
Our first warning under control of `/warnversion` was introduced in version `5`
as part of .NET 5.
If you want the compiler to produce all applicable warnings, you can specify
`/warnversion=9999`.
In the project file, the property used to specify the warning version is `AnalysisLevel`.

The table below describes all of the warnings controlled by `/warnversion`.

| Warning ID | warnversion | Description |
|------------|---------|-------------|
| CS8073 | 5 | [Expression always true (or false) when comparing a struct to null](https://github.com/dotnet/roslyn/issues/45744) |
32 changes: 16 additions & 16 deletions docs/features/source-generators.cookbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,26 +115,26 @@ namespace GeneratedNamespace
```csharp
[Generator]
public class FileTransformGenerator : ISourceGenerator
{
public void Initialize(InitializationContext context) {}
{
public void Initialize(InitializationContext context) {}

public void Execute(SourceGeneratorContext context)
public void Execute(SourceGeneratorContext context)
{
// find anything that matches our files
var myFiles = context.AnalyzerOptions.AdditionalFiles.Where(at => at.Path.EndsWith(".xml"));
foreach (var file in myFiles)
{
// find anything that matches our files
var myFiles = context.AnalyzerOptions.AdditionalFiles.Where(at => at.Path.EndsWith(".xml"));
foreach (var file in myFiles)
{
var content = file.GetText(context.CancellationToken);
var content = file.GetText(context.CancellationToken);

// do some transforms based on the file context
string output = MyXmlToCSharpCompiler.Compile(content);
// do some transforms based on the file context
string output = MyXmlToCSharpCompiler.Compile(content);

var sourceText = SourceText.From(output, Encoding.UTF8);
var sourceText = SourceText.From(output, Encoding.UTF8);

context.AddSource($"{file.Name}generated.cs", sourceText);
}
context.AddSource($"{file.Name}generated.cs", sourceText);
}
}
}
```

### Augment user code
Expand Down Expand Up @@ -628,7 +628,7 @@ partial class MyRecord
}
```

This attribute could also be used for #participate-in-the-ide-experience,
This attribute could also be used for [Participate in the IDE experience](#participate-in-the-ide-experience),
when the full scope of that feature is fully designed. In that scenario,
instead of the generator finding every type marked with the given attribute,
the compiler would notify the generator of every type marked with the given
Expand Down Expand Up @@ -670,8 +670,8 @@ public string Serialize()
```

Obviously this is heavily simplified -- this example only handles the `string` and `int`
types properly and has no error recovery, but it should serve to demonstrate the kind
of code a source generator could add to a compilation.
types properly, adds a trailing comma to the json output and has no error recovery, but
it should serve to demonstrate the kind of code a source generator could add to a compilation.

Our next task is design a generator to generate the above code, since the
above code is itself customized in the `// Body` section according to the
Expand Down
8 changes: 4 additions & 4 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
<ProductDependencies>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.20326.2">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.20365.6">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>ed69753a3ffbdaa08365252c710d57a64d17f859</Sha>
<Sha>7cc59275eade471e29b88a797275818b0d513d0f</Sha>
</Dependency>
<Dependency Name="Microsoft.Net.Compilers.Toolset" Version="3.8.0-1.20353.1">
<Dependency Name="Microsoft.Net.Compilers.Toolset" Version="3.8.0-1.20361.1">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>09f75b83754732a74e0815976b80ecffd94c0dde</Sha>
<Sha>f24d2c5c98211908ab90d6f1f42e7592411d6058</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</MajorVersion>
<MinorVersion>
</MinorVersion>
<MicrosoftNetCompilersToolsetVersion>3.8.0-1.20353.1</MicrosoftNetCompilersToolsetVersion>
<MicrosoftNetCompilersToolsetVersion>3.8.0-1.20361.1</MicrosoftNetCompilersToolsetVersion>
</PropertyGroup>
<PropertyGroup>
<!-- Versions used by several individual references below -->
Expand Down
12 changes: 12 additions & 0 deletions eng/common/templates/post-build/post-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,18 @@ stages:
shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json'
symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json'

- template: \eng\common\templates\post-build\channels\generic-public-channel.yml
parameters:
artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
stageName: 'VS16_8_Publishing'
channelName: 'VS 16.8'
channelId: 1154
transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-transport/nuget/v3/index.json'
shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json'
symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json'

- template: \eng\common\templates\post-build\channels\generic-public-channel.yml
parameters:
artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
Expand Down
12 changes: 8 additions & 4 deletions eng/config/OptProf.json
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,10 @@
{
"filename": "/Contents/MSBuild/Current/Bin/Roslyn/System.Runtime.CompilerServices.Unsafe.dll",
"testCases":[ "VSPE.OptProfTests.vs_perf_designtime_solution_build_vb_australiangovernment", "VSPE.OptProfTests.vs_perf_designtime_ide_searchtest", "VSPE.OptProfTests.DDRIT_RPS_ManagedLangs_Typing", "VSPE.OptProfTests.DDRIT_RPS_ManagedLangs_Debug" ]
},
{
"filename": "/Contents/MSBuild/Current/Bin/Roslyn/System.Reflection.Metadata.dll",
"testCases":[ "VSPE.OptProfTests.vs_perf_designtime_solution_build_vb_australiangovernment", "VSPE.OptProfTests.vs_perf_designtime_ide_searchtest", "VSPE.OptProfTests.DDRIT_RPS_ManagedLangs_Typing", "VSPE.OptProfTests.DDRIT_RPS_ManagedLangs_Debug" ]
}
]
}
Expand Down Expand Up @@ -444,7 +448,7 @@
"testCases": [
"VSPE.OptProfTests.vs_asl_cs_scenario",
"VSPE.OptProfTests.vs_asl_vb_scenario",
"VSPE.OptProfTests.vs_ddbvtqa_vbwi",
"VSPE.OptProfTests.vs_ddbvtqa_vbwin",
"VSPE.OptProfTests.vs_perf_designtime_editor_intellisense_globalcompletionlist_cs",
"VSPE.OptProfTests.vs_perf_designtime_ide_searchtest",
"VSPE.OptProfTests.vs_perf_designtime_solution_build_vb_australiangovernment",
Expand All @@ -463,7 +467,7 @@
{
"container": "XamlOptProf",
"testCases": [
"Microsoft.Test.Performance.XamlOptProfCreateTests.UwpCreateProject_DesignerIsolated",
"Microsoft.Test.Performance.XamlOptProfCreateTests.UwpCreateProject_SurfaceIsolated",
"Microsoft.Test.Performance.XamlOptProfCreateTests.WpfCreateProject_DesignerIsolated"
]
}
Expand All @@ -489,7 +493,7 @@
"testCases": [
"VSPE.OptProfTests.vs_asl_cs_scenario",
"VSPE.OptProfTests.vs_asl_vb_scenario",
"VSPE.OptProfTests.vs_ddbvtqa_vbwi",
"VSPE.OptProfTests.vs_ddbvtqa_vbwin",
"VSPE.OptProfTests.vs_perf_designtime_editor_intellisense_globalcompletionlist_cs",
"VSPE.OptProfTests.vs_perf_designtime_ide_searchtest",
"VSPE.OptProfTests.vs_perf_designtime_solution_build_vb_australiangovernment",
Expand All @@ -508,7 +512,7 @@
{
"container": "XamlOptProf",
"testCases": [
"Microsoft.Test.Performance.XamlOptProfCreateTests.UwpCreateProject_DesignerIsolated",
"Microsoft.Test.Performance.XamlOptProfCreateTests.UwpCreateProject_SurfaceIsolated",
"Microsoft.Test.Performance.XamlOptProfCreateTests.WpfCreateProject_DesignerIsolated"
]
}
Expand Down
6 changes: 3 additions & 3 deletions eng/config/PublishData.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,12 @@
"vsBranch": "master",
"vsMajorVersion": 16
},
"features/dotnetFormat": {
"features/UsedAssemblyReferences": {
"nugetKind": [ "Shipping", "NonShipping" ],
"version": "3.3.*",
"version": "3.8.*",
"nuget": [ "https://dotnet.myget.org/F/roslyn/api/v2/package" ],
"vsix": [ "https://dotnet.myget.org/F/roslyn/vsix/upload" ],
"channels": [ "dotnetFormat" ],
"channels": [ "UsedAssemblyReferences" ],
"vsBranch": "master",
"vsMajorVersion": 16
},
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"xcopy-msbuild": "16.4.0-alpha"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.20326.2"
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.20365.6"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ public async Task AnalyzeAsync(
return;
}

// Bail out for generated code.
if (tree.IsGeneratedCode(compilationWithAnalyzers.AnalysisOptions.Options, SyntaxFacts, cancellationToken))
{
return;
}

var root = tree.GetRoot(cancellationToken);

// Bail out if tree has syntax errors.
Expand Down Expand Up @@ -190,9 +196,12 @@ await ProcessReportedDiagnosticsAsync(diagnostics, tree, compilationWithAnalyzer
// Remove entries for unhandled diagnostic ids.
foreach (var id in unhandledIds)
{
foreach (var (pragma, _) in idToPragmasMap[id])
if (idToPragmasMap.TryGetValue(id, out var pragmas))
{
pragmasToIsUsedMap.Remove(pragma);
foreach (var (pragma, _) in pragmas)
{
pragmasToIsUsedMap.Remove(pragma);
}
}

if (idToSuppressMessageAttributesMap.TryGetValue(id, out var attributeNodes))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,8 @@ private bool IsCandidateSymbol(ISymbol memberSymbol)
}

private bool IsEntryPoint(IMethodSymbol methodSymbol)
=> (methodSymbol.Name == WellKnownMemberNames.EntryPointMethodName || methodSymbol.Name == "$Main") &&
=> (methodSymbol.Name == WellKnownMemberNames.EntryPointMethodName || methodSymbol.Name == "<Main>$") && // https://github.com/dotnet/roslyn/issues/45110 Switch to using WellKnownMemberNames.TopLevelStatementsEntryPointMethodName
// once src\CodeStyle\Core\Analyzers\Microsoft.CodeAnalysis.CodeStyle.csproj is able to use the latest version of the type.
methodSymbol.IsStatic &&
(methodSymbol.ReturnsVoid ||
methodSymbol.ReturnType.SpecialType == SpecialType.System_Int32 ||
Expand Down
2 changes: 1 addition & 1 deletion src/Compilers/CSharp/Portable/Binder/Binder_QueryErrors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ internal void ReportQueryLookupFailed(
}
else if (ImplementsStandardQueryInterface(instanceArgument.Type, name, ref useSiteDiagnostics))
{
// Could not find an implementation of the query pattern for source type '{0}'. '{1}' not found. Are you missing a reference to 'System.Core.dll' or a using directive for 'System.Linq'?
// Could not find an implementation of the query pattern for source type '{0}'. '{1}' not found. Are you missing required assembly references or a using directive for 'System.Linq'?
diagnostics.Add(new DiagnosticInfoWithSymbols(
ErrorCode.ERR_QueryNoProviderStandard,
new object[] { instanceArgument.Type, name },
Expand Down
Loading

0 comments on commit 6c56c2a

Please sign in to comment.