From c34c08a86afe6996b0551880d56001613533a387 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Fri, 30 Jun 2017 18:50:23 -0500 Subject: [PATCH 001/205] Use IVsUIShell instead of DTE to open the Options dialog Fixes cases where an IOleCommandTarget in the chain fails to propagate the call in a manner that allows arguments, which would crash Visual Studio with a COMException. --- .../PreviewPane/PreviewPane.xaml.cs | 15 ++++++++++----- .../PreviewPane/PreviewPaneService.cs | 10 ++++++---- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/VisualStudio/Core/Def/Implementation/PreviewPane/PreviewPane.xaml.cs b/src/VisualStudio/Core/Def/Implementation/PreviewPane/PreviewPane.xaml.cs index dc03925fe1eb4..ff2ccf4c83359 100644 --- a/src/VisualStudio/Core/Def/Implementation/PreviewPane/PreviewPane.xaml.cs +++ b/src/VisualStudio/Core/Def/Implementation/PreviewPane/PreviewPane.xaml.cs @@ -7,11 +7,12 @@ using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Navigation; -using EnvDTE; using Microsoft.CodeAnalysis.Diagnostics.Log; using Microsoft.VisualStudio.LanguageServices.Implementation.Utilities; using Roslyn.Utilities; using Microsoft.CodeAnalysis.Editor.Implementation.Preview; +using IVsUIShell = Microsoft.VisualStudio.Shell.Interop.IVsUIShell; +using OLECMDEXECOPT = Microsoft.VisualStudio.OLE.Interop.OLECMDEXECOPT; namespace Microsoft.VisualStudio.LanguageServices.Implementation.PreviewPane { @@ -24,7 +25,7 @@ internal partial class PreviewPane : UserControl, IDisposable private readonly string _id; private readonly bool _logIdVerbatimInTelemetry; - private readonly DTE _dte; + private readonly IVsUIShell _uiShell; private bool _isExpanded; private double _heightForThreeLineTitle; @@ -39,14 +40,14 @@ public PreviewPane( string helpLinkToolTipText, IReadOnlyList previewContent, bool logIdVerbatimInTelemetry, - DTE dte, + IVsUIShell uiShell, Guid optionPageGuid = default(Guid)) { InitializeComponent(); _id = id; _logIdVerbatimInTelemetry = logIdVerbatimInTelemetry; - _dte = dte; + _uiShell = uiShell; // Initialize header portion. if ((severityIcon != null) && !string.IsNullOrWhiteSpace(id) && !string.IsNullOrWhiteSpace(title)) @@ -358,7 +359,11 @@ private void OptionsButton_Click(object sender, RoutedEventArgs e) { if (_optionPageGuid != default(Guid)) { - _dte.ExecuteCommand("Tools.Options", _optionPageGuid.ToString()); + ErrorHandler.ThrowOnFailure(_uiShell.PostExecCommand( + VSConstants.GUID_VSStandardCommandSet97, + (uint)VSConstants.VSStd97CmdID.ToolsOptions, + (uint)OLECMDEXECOPT.OLECMDEXECOPT_DODEFAULT, + _optionPageGuid.ToString())); } } } diff --git a/src/VisualStudio/Core/Def/Implementation/PreviewPane/PreviewPaneService.cs b/src/VisualStudio/Core/Def/Implementation/PreviewPane/PreviewPaneService.cs index ea765534c4c91..5add7a32d0f27 100644 --- a/src/VisualStudio/Core/Def/Implementation/PreviewPane/PreviewPaneService.cs +++ b/src/VisualStudio/Core/Def/Implementation/PreviewPane/PreviewPaneService.cs @@ -18,18 +18,20 @@ using Microsoft.VisualStudio.Imaging.Interop; using Microsoft.VisualStudio.LanguageServices.Implementation.Utilities; using Microsoft.VisualStudio.Shell; +using IVsUIShell = Microsoft.VisualStudio.Shell.Interop.IVsUIShell; +using SVsUIShell = Microsoft.VisualStudio.Shell.Interop.SVsUIShell; namespace Microsoft.VisualStudio.LanguageServices.Implementation.PreviewPane { [ExportWorkspaceServiceFactory(typeof(IPreviewPaneService), ServiceLayer.Host), Shared] internal class PreviewPaneService : ForegroundThreadAffinitizedObject, IPreviewPaneService, IWorkspaceServiceFactory { - private readonly EnvDTE.DTE _dte; + private readonly IVsUIShell _uiShell; [ImportingConstructor] public PreviewPaneService(SVsServiceProvider serviceProvider) { - _dte = serviceProvider.GetService(typeof(EnvDTE.DTE)) as EnvDTE.DTE; + _uiShell = serviceProvider.GetService(typeof(SVsUIShell)) as IVsUIShell; } IWorkspaceService IWorkspaceServiceFactory.CreateService(HostWorkspaceServices workspaceServices) @@ -107,7 +109,7 @@ object IPreviewPaneService.GetPreviewPane( return new PreviewPane( severityIcon: null, id: null, title: null, description: null, helpLink: null, helpLinkToolTipText: null, - previewContent: previewContent, logIdVerbatimInTelemetry: false, dte: _dte); + previewContent: previewContent, logIdVerbatimInTelemetry: false, uiShell: _uiShell); } var helpLinkToolTipText = string.Empty; @@ -128,7 +130,7 @@ object IPreviewPaneService.GetPreviewPane( helpLinkToolTipText: helpLinkToolTipText, previewContent: previewContent, logIdVerbatimInTelemetry: diagnostic.CustomTags.Contains(WellKnownDiagnosticTags.Telemetry), - dte: _dte, + uiShell: _uiShell, optionPageGuid: optionPageGuid); } From 5bcacbaf6f639b224cde363c1981ca9375728efd Mon Sep 17 00:00:00 2001 From: Heejae Chang Date: Fri, 21 Jul 2017 12:27:33 -0700 Subject: [PATCH 002/205] report more data on crash due to dispose this is port of https://github.com/dotnet/roslyn/pull/20968 to dev15.3.x --- .../TestUtilities/Remote/WatsonReporter.cs | 23 ++++++ .../ServicesTestUtilities.csproj | 1 + .../Core/Next/Remote/JsonRpcClient.cs | 74 ++++++++++++++++++- 3 files changed, 96 insertions(+), 2 deletions(-) create mode 100644 src/EditorFeatures/TestUtilities/Remote/WatsonReporter.cs diff --git a/src/EditorFeatures/TestUtilities/Remote/WatsonReporter.cs b/src/EditorFeatures/TestUtilities/Remote/WatsonReporter.cs new file mode 100644 index 0000000000000..48d79a4cee667 --- /dev/null +++ b/src/EditorFeatures/TestUtilities/Remote/WatsonReporter.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + + using System; + + namespace Microsoft.VisualStudio.LanguageServices.Implementation + { + /// + /// Mock to make test project build + /// + internal class WatsonReporter + { + public static void Report(string description, Exception exception, Func callback) + { + // do nothing + } + + public interface IFaultUtility + { + void AddProcessDump(int pid); + void AddFile(string fullpathname); + } + } + } \ No newline at end of file diff --git a/src/EditorFeatures/TestUtilities/ServicesTestUtilities.csproj b/src/EditorFeatures/TestUtilities/ServicesTestUtilities.csproj index 8f37b0911c50d..80d88360ce17c 100644 --- a/src/EditorFeatures/TestUtilities/ServicesTestUtilities.csproj +++ b/src/EditorFeatures/TestUtilities/ServicesTestUtilities.csproj @@ -246,6 +246,7 @@ + diff --git a/src/VisualStudio/Core/Next/Remote/JsonRpcClient.cs b/src/VisualStudio/Core/Next/Remote/JsonRpcClient.cs index 64d5a62b7681a..f8d23432149eb 100644 --- a/src/VisualStudio/Core/Next/Remote/JsonRpcClient.cs +++ b/src/VisualStudio/Core/Next/Remote/JsonRpcClient.cs @@ -2,12 +2,15 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Threading; using System.Threading.Tasks; using StreamJsonRpc; +using Microsoft.CodeAnalysis.ErrorReporting; using Microsoft.CodeAnalysis.Remote; using Roslyn.Utilities; +using Microsoft.VisualStudio.LanguageServices.Implementation; namespace Microsoft.VisualStudio.LanguageServices.Remote { @@ -20,6 +23,9 @@ internal class JsonRpcClient : IDisposable private readonly JsonRpc _rpc; private readonly CancellationToken _cancellationToken; + private JsonRpcDisconnectedEventArgs _debuggingLastDisconnectReason; + private string _debuggingLastDisconnectCallstack; + public JsonRpcClient( Stream stream, object callbackTarget, bool useThisAsCallback, CancellationToken cancellationToken) { @@ -42,7 +48,7 @@ public async Task InvokeAsync(string targetName, params object[] arguments) { await _rpc.InvokeAsync(targetName, arguments).ConfigureAwait(false); } - catch + catch (Exception ex) when (ReportUnlessCanceled(ex, _cancellationToken)) { // any exception can be thrown from StreamJsonRpc if JsonRpc is disposed in the middle of read/write. // until we move to newly added cancellation support in JsonRpc, we will catch exception and translate to @@ -61,7 +67,7 @@ public async Task InvokeAsync(string targetName, params object[] arguments { return await _rpc.InvokeAsync(targetName, arguments).ConfigureAwait(false); } - catch + catch (Exception ex) when (ReportUnlessCanceled(ex, _cancellationToken)) { // any exception can be thrown from StreamJsonRpc if JsonRpc is disposed in the middle of read/write. // until we move to newly added cancellation support in JsonRpc, we will catch exception and translate to @@ -82,6 +88,68 @@ public Task InvokeAsync(string targetName, IEnumerable arguments, return Extensions.InvokeAsync(_rpc, targetName, arguments, funcWithDirectStreamAsync, _cancellationToken); } + private bool ReportUnlessCanceled(Exception ex, CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return true; + } + + // save extra info using NFW + ReportExtraInfoAsNFW(ex); + + // make it to explicitly crash to get better info + FatalError.Report(ex); + + GC.KeepAlive(_debuggingLastDisconnectReason); + GC.KeepAlive(_debuggingLastDisconnectCallstack); + + return Contract.FailWithReturn("shouldn't be able to reach here"); + } + + private void ReportExtraInfoAsNFW(Exception ex) + { + WatsonReporter.Report("RemoteHost Failed", ex, u => + { + try + { + // we will record dumps for all service hub processes + foreach (var p in Process.GetProcessesByName("ServiceHub.RoslynCodeAnalysisService32")) + { + // include all remote host processes + u.AddProcessDump(p.Id); + } + + // include all service hub logs as well + var logPath = Path.Combine(Path.GetTempPath(), "servicehub", "logs"); + if (Directory.Exists(logPath)) + { + // attach all log files that are modified less than 1 day before. + var now = DateTime.UtcNow; + var oneDay = TimeSpan.FromDays(1); + + foreach (var file in Directory.EnumerateFiles(logPath, "*.log")) + { + var lastWrite = File.GetLastWriteTimeUtc(file); + if (now - lastWrite > oneDay) + { + continue; + } + + u.AddFile(file); + } + } + } + catch + { + // ignore issue + } + + // 0 means send watson + return 0; + }); + } + public void Dispose() { OnDisposed(); @@ -104,6 +172,8 @@ protected virtual void OnDisposed() protected virtual void OnDisconnected(object sender, JsonRpcDisconnectedEventArgs e) { // do nothing + _debuggingLastDisconnectReason = e; + _debuggingLastDisconnectCallstack = new StackTrace().ToString(); } } } From 2a33f0acc92c7f657dec79eed513b023db704feb Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Mon, 24 Jul 2017 10:18:36 -0700 Subject: [PATCH 003/205] Correctly deduplicate metadata references for lightweight projects We were deduping metadata references by file path alone, which is not correct if we are referencing the same assembly with multiple aliases. This correctly merges those and adds a single reference. --- .../VisualStudioProjectTracker.cs | 32 +++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioProjectTracker.cs b/src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioProjectTracker.cs index 156ad904c478b..ab3f97eabcf6c 100644 --- a/src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioProjectTracker.cs +++ b/src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioProjectTracker.cs @@ -905,7 +905,8 @@ private AbstractProject GetOrCreateProjectFromArgumentsAndReferences( } } - var addedReferencePaths = new HashSet(StringComparer.OrdinalIgnoreCase); + var metadataReferencesToAdd = new Dictionary(StringComparer.OrdinalIgnoreCase); + foreach (var reference in metadataReferences) { var path = GetReferencePath(reference); @@ -916,10 +917,35 @@ private AbstractProject GetOrCreateProjectFromArgumentsAndReferences( continue; } - if (addedReferencePaths.Add(path)) + if (metadataReferencesToAdd.TryGetValue(path, out var existingProperties)) { - projectContext.AddMetadataReference(path, reference.Properties); + // Merge existing aliases the properties that are already there + var allAliases = existingProperties.Aliases.AddRange(reference.Properties.Aliases); + + // If one is empty and the other isn't, then we need to toss the global alias in too. The other cases + // are they're both empty (and this was a direct duplicate) or they're both non-empty and the merge + // is OK. + if ((existingProperties.Aliases.IsDefaultOrEmpty && !reference.Properties.Aliases.IsDefaultOrEmpty) || + (!existingProperties.Aliases.IsDefaultOrEmpty && reference.Properties.Aliases.IsDefaultOrEmpty)) + { + allAliases = allAliases.Add(MetadataReferenceProperties.GlobalAlias); + } + else + { + allAliases = allAliases.Distinct(); + } + + metadataReferencesToAdd[path] = existingProperties.WithAliases(allAliases); } + else + { + metadataReferencesToAdd.Add(path, reference.Properties); + } + } + + foreach (var metadataReferenceToAdd in metadataReferencesToAdd) + { + projectContext.AddMetadataReference(metadataReferenceToAdd.Key, metadataReferenceToAdd.Value); } var addedAnalyzerPaths = new HashSet(StringComparer.OrdinalIgnoreCase); From 46e069ae2d72ea0905f1b2bec301ea8469346755 Mon Sep 17 00:00:00 2001 From: CyrusNajmabadi Date: Mon, 24 Jul 2017 14:27:39 -0700 Subject: [PATCH 004/205] Place caret in parameter list when generating constructors. --- .../GenerateConstructorFromMembersTests.cs | 80 ++++++++++++------- .../CodeActionEditHandlerService.cs | 17 ++-- .../AbstractChangeSignatureTests.cs | 9 ++- .../AbstractCodeActionOrUserDiagnosticTest.cs | 13 ++- .../Diagnostics/AbstractUserDiagnosticTest.cs | 5 +- .../MoveType/AbstractMoveTypeTest.cs | 1 + .../GenerateConstructorFromMembersTests.vb | 26 +++--- .../ConstructorDelegatingCodeAction.cs | 2 +- .../FieldDelegatingCodeAction.cs | 3 +- ...uctorFromMembersCodeRefactoringProvider.cs | 22 +++++ .../CodeGeneration/CSharpSyntaxGenerator.cs | 2 +- .../CSharpSyntaxFactsService.cs | 4 + .../Annotations/ConflictAnnotation.cs | 1 - .../Annotations/NavigationAnnotation.cs | 16 ++++ .../Annotations/RenameAnnotation.cs | 1 - .../CodeGeneration/CodeGenerationHelpers.cs | 8 +- .../Portable/CodeGeneration/CodeGenerator.cs | 5 ++ .../SyntaxFactsService/ISyntaxFactsService.cs | 1 + .../VisualBasicSyntaxGenerator.vb | 2 +- .../VisualBasicSyntaxFactsService.vb | 5 ++ 20 files changed, 160 insertions(+), 63 deletions(-) create mode 100644 src/Workspaces/Core/Portable/CodeActions/Annotations/NavigationAnnotation.cs diff --git a/src/EditorFeatures/CSharpTest/GenerateFromMembers/GenerateConstructorFromMembers/GenerateConstructorFromMembersTests.cs b/src/EditorFeatures/CSharpTest/GenerateFromMembers/GenerateConstructorFromMembers/GenerateConstructorFromMembersTests.cs index 1c8ce9b4691f9..e42358805676e 100644 --- a/src/EditorFeatures/CSharpTest/GenerateFromMembers/GenerateConstructorFromMembers/GenerateConstructorFromMembersTests.cs +++ b/src/EditorFeatures/CSharpTest/GenerateFromMembers/GenerateConstructorFromMembers/GenerateConstructorFromMembersTests.cs @@ -33,7 +33,7 @@ class Z { int a; - public Z(int a) + public Z(int a{|Navigation:)|} { this.a = a; } @@ -56,7 +56,7 @@ class Z { int a; - public Z(int a) => this . a = a ; + public Z(int a{|Navigation:)|} => this . a = a ; }", options: Option(CSharpCodeStyleOptions.PreferExpressionBodiedConstructors, CSharpCodeStyleOptions.WhenPossibleWithNoneEnforcement)); } @@ -77,7 +77,7 @@ class Z { int a; - public Z(int a) => this . a = a ; + public Z(int a{|Navigation:)|} => this . a = a ; }", options: Option(CSharpCodeStyleOptions.PreferExpressionBodiedConstructors, CSharpCodeStyleOptions.WhenOnSingleLineWithNoneEnforcement)); } @@ -100,7 +100,7 @@ class Z int a; int b; - public Z(int a, int b) + public Z(int a, int b{|Navigation:)|} { this . a = a ; this . b = b ; @@ -127,7 +127,7 @@ class Z int a; string b; - public Z(int a, string b) + public Z(int a, string b{|Navigation:)|} { this.a = a; this.b = b; @@ -163,7 +163,7 @@ public Z(int a) this.a = a; } - public Z(string b) + public Z(string b{|Navigation:)|} { this.b = b; } @@ -198,7 +198,7 @@ public Z(int a) this.a = a; } - public Z(int a, string b) + public Z(int a, string b{|Navigation:)|} { this.a = a; this.b = b; @@ -234,7 +234,7 @@ public Z(int a) this.a = a; } - public Z(int a, string b) + public Z(int a, string b{|Navigation:)|} { this.a = a; this.b = b; @@ -270,7 +270,7 @@ public Z(int a) this.a = a; } - public Z(int a, string b) : this(a) + public Z(int a, string b{|Navigation:)|} : this(a) { this.b = b; } @@ -294,7 +294,7 @@ public Z(int a) this.a = a; } - public Z(int a, string b) + public Z(int a, string b{|Navigation:)|} { this.a = a; this.b = b; @@ -313,7 +313,7 @@ await TestInRegularAndScriptAsync( }", @"class Z { - public Z(int a, string b) + public Z(int a, string b{|Navigation:)|} { A = a; B = b; @@ -335,7 +335,7 @@ await TestInRegularAndScriptAsync( }", @"class Z { - public Z(int a, string b) + public Z(int a, string b{|Navigation:)|} { this.A = a; this.B = b; @@ -362,7 +362,7 @@ struct S { int i; - public S(int i) + public S(int i{|Navigation:)|} { this.i = i; } @@ -383,7 +383,7 @@ struct S struct S { - public S(int i) : this() + public S(int i{|Navigation:)|} : this() { this.i = i; } @@ -412,7 +412,7 @@ struct S int y; - public S(int y) : this() + public S(int y{|Navigation:)|} : this() { this.y = y; } @@ -439,7 +439,7 @@ struct S int y; - public S(int i) : this() + public S(int i{|Navigation:)|} : this() { this.i = i; } @@ -462,7 +462,7 @@ class Program { int i; - public Program(int i) + public Program(int i{|Navigation:)|} { this.i = i; } @@ -534,7 +534,7 @@ await TestInRegularAndScriptAsync( { int yield; - public Program(int yield) + public Program(int yield{|Navigation:)|} { this.yield = yield; } @@ -577,7 +577,7 @@ class Z { (int, string) a; - public Z((int, string) a) + public Z((int, string) a{|Navigation:)|} { this.a = a; } @@ -597,7 +597,7 @@ await TestInRegularAndScriptAsync( { int _field; - public Program(int field) + public Program(int field{|Navigation:)|} { _field = field; } @@ -617,7 +617,7 @@ await TestInRegularAndScriptAsync( { int _field; - public Program(int field) + public Program(int field{|Navigation:)|} { this._field = field; } @@ -637,7 +637,7 @@ await TestInRegularAndScriptAsync( }", @"abstract class Contribution { - public Contribution(string title, int number) + public Contribution(string title, int number{|Navigation:)|} { Title = title; Number = number; @@ -679,7 +679,7 @@ class Z { int a; - public Z(int a) + public Z(int a{|Navigation:)|} { this.a = a; } @@ -703,7 +703,7 @@ class Z { int a; - public Z(int a) + public Z(int a{|Navigation:)|} { this.a = a; } @@ -741,7 +741,7 @@ class Z { int a; - public Z() + public Z({|Navigation:)|} { } }", @@ -767,7 +767,7 @@ class Z int a; string b; - public Z(string b, int a) + public Z(string b, int a{|Navigation:)|} { this.b = b; this.a = a; @@ -799,7 +799,7 @@ class Z int a; string b; - public Z(int a, string b) + public Z(int a, string b{|Navigation:)|} { this.a = a; this.b = b ?? throw new ArgumentNullException(nameof(b)); @@ -832,7 +832,7 @@ class Z int a; string b; - public Z(int a, string b) + public Z(int a, string b{|Navigation:)|} { if (b == null) { @@ -897,6 +897,30 @@ public void M() } public void N() { } +}"); + } + + [WorkItem(21067, "https://github.com/dotnet/roslyn/pull/21067")] + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructorFromMembers)] + public async Task TestFinalCaretPosition() + { + await TestInRegularAndScriptAsync( +@"using System.Collections.Generic; + +class Z +{ + [|int a;|] +}", +@"using System.Collections.Generic; + +class Z +{ + int a; + + public Z(int a{|Navigation:)|} + { + this.a = a; + } }"); } } diff --git a/src/EditorFeatures/Core/Implementation/CodeActions/CodeActionEditHandlerService.cs b/src/EditorFeatures/Core/Implementation/CodeActions/CodeActionEditHandlerService.cs index 553c4b6b42cd3..5921cb60f5a88 100644 --- a/src/EditorFeatures/Core/Implementation/CodeActions/CodeActionEditHandlerService.cs +++ b/src/EditorFeatures/Core/Implementation/CodeActions/CodeActionEditHandlerService.cs @@ -176,7 +176,7 @@ public async Task ApplyAsync( } var updatedSolution = operations.OfType().FirstOrDefault()?.ChangedSolution ?? oldSolution; - TryStartRenameSession(workspace, oldSolution, updatedSolution, cancellationToken); + TryNavigateToLocationOrStartRenameSession(workspace, oldSolution, updatedSolution, cancellationToken); } private TextDocument TryGetSingleChangedText( @@ -259,7 +259,7 @@ private static void ProcessOperations( } } - private void TryStartRenameSession(Workspace workspace, Solution oldSolution, Solution newSolution, CancellationToken cancellationToken) + private void TryNavigateToLocationOrStartRenameSession(Workspace workspace, Solution oldSolution, Solution newSolution, CancellationToken cancellationToken) { var changedDocuments = newSolution.GetChangedDocuments(oldSolution); foreach (var documentId in changedDocuments) @@ -272,9 +272,16 @@ private void TryStartRenameSession(Workspace workspace, Solution oldSolution, So var root = document.GetSyntaxRootSynchronously(cancellationToken); - var renameTokenOpt = root.GetAnnotatedNodesAndTokens(RenameAnnotation.Kind) - .Where(s => s.IsToken) - .Select(s => s.AsToken()) + var navigationTokenOpt = root.GetAnnotatedTokens(NavigationAnnotation.Kind) + .FirstOrNullable(); + if (navigationTokenOpt.HasValue) + { + var navigationService = workspace.Services.GetService(); + navigationService.TryNavigateToPosition(workspace, documentId, navigationTokenOpt.Value.SpanStart); + return; + } + + var renameTokenOpt = root.GetAnnotatedTokens(RenameAnnotation.Kind) .FirstOrNullable(); if (renameTokenOpt.HasValue) diff --git a/src/EditorFeatures/TestUtilities/ChangeSignature/AbstractChangeSignatureTests.cs b/src/EditorFeatures/TestUtilities/ChangeSignature/AbstractChangeSignatureTests.cs index 2519671ea97e9..c2223f273f9c7 100644 --- a/src/EditorFeatures/TestUtilities/ChangeSignature/AbstractChangeSignatureTests.cs +++ b/src/EditorFeatures/TestUtilities/ChangeSignature/AbstractChangeSignatureTests.cs @@ -8,6 +8,7 @@ using Microsoft.CodeAnalysis.ChangeSignature; using Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions; using Microsoft.CodeAnalysis.Notification; +using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; using Xunit; @@ -39,9 +40,11 @@ public async Task TestChangeSignatureViaCodeActionAsync( var codeIssueOrRefactoring = await GetCodeRefactoringAsync(workspace, testOptions); await TestActionsAsync(workspace, expectedCode, index, codeIssueOrRefactoring.Actions, - conflictSpans: ImmutableArray.Empty, - renameSpans: ImmutableArray.Empty, - warningSpans: ImmutableArray.Empty, ignoreTrivia: true); + conflictSpans: ImmutableArray.Empty, + renameSpans: ImmutableArray.Empty, + warningSpans: ImmutableArray.Empty, + navigationSpans: ImmutableArray.Empty, + ignoreTrivia: true); } } else diff --git a/src/EditorFeatures/TestUtilities/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs b/src/EditorFeatures/TestUtilities/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs index 09ccfc5b291a2..ba28a1985b8d1 100644 --- a/src/EditorFeatures/TestUtilities/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs +++ b/src/EditorFeatures/TestUtilities/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs @@ -364,11 +364,13 @@ private async Task TestAsync( TestParameters parameters) { MarkupTestFile.GetSpans( - expectedMarkup.NormalizeLineEndings(), out var expected, out IDictionary> spanMap); + expectedMarkup.NormalizeLineEndings(), + out var expected, out IDictionary> spanMap); var conflictSpans = spanMap.GetOrAdd("Conflict", _ => ImmutableArray.Empty); var renameSpans = spanMap.GetOrAdd("Rename", _ => ImmutableArray.Empty); var warningSpans = spanMap.GetOrAdd("Warning", _ => ImmutableArray.Empty); + var navigationSpans = spanMap.GetOrAdd("Navigation", _ => ImmutableArray.Empty); using (var workspace = CreateWorkspaceFromOptions(initialMarkup, parameters)) { @@ -380,7 +382,7 @@ private async Task TestAsync( await TestActionsAsync( workspace, expected, index, actions, - conflictSpans, renameSpans, warningSpans, + conflictSpans, renameSpans, warningSpans, navigationSpans, ignoreTrivia: ignoreTrivia, parseOptions: parameters.parseOptions, priority: priority); @@ -393,12 +395,15 @@ internal async Task> TestActionsAsync( ImmutableArray conflictSpans, ImmutableArray renameSpans, ImmutableArray warningSpans, + ImmutableArray navigationSpans, bool ignoreTrivia, ParseOptions parseOptions = null, CodeActionPriority? priority = null) { var operations = await VerifyInputsAndGetOperationsAsync(index, actions, priority); - return await TestOperationsAsync(workspace, expected, operations, conflictSpans, renameSpans, warningSpans, ignoreTrivia, expectedChangedDocumentId: null, parseOptions: parseOptions); + return await TestOperationsAsync( + workspace, expected, operations, conflictSpans, renameSpans, + warningSpans, navigationSpans, ignoreTrivia, expectedChangedDocumentId: null, parseOptions: parseOptions); } protected async Task> TestOperationsAsync( @@ -408,6 +413,7 @@ protected async Task> TestOperationsAsync( ImmutableArray conflictSpans, ImmutableArray renameSpans, ImmutableArray warningSpans, + ImmutableArray navigationSpans, bool ignoreTrivia, DocumentId expectedChangedDocumentId, ParseOptions parseOptions = null) @@ -439,6 +445,7 @@ protected async Task> TestOperationsAsync( TestAnnotations(conflictSpans, ConflictAnnotation.Kind); TestAnnotations(renameSpans, RenameAnnotation.Kind); TestAnnotations(warningSpans, WarningAnnotation.Kind); + TestAnnotations(navigationSpans, NavigationAnnotation.Kind); return Tuple.Create(oldSolution, newSolution); diff --git a/src/EditorFeatures/TestUtilities/Diagnostics/AbstractUserDiagnosticTest.cs b/src/EditorFeatures/TestUtilities/Diagnostics/AbstractUserDiagnosticTest.cs index ed24a72079101..ce2a4bb1baffa 100644 --- a/src/EditorFeatures/TestUtilities/Diagnostics/AbstractUserDiagnosticTest.cs +++ b/src/EditorFeatures/TestUtilities/Diagnostics/AbstractUserDiagnosticTest.cs @@ -372,6 +372,7 @@ internal async Task TestWithMockedGenerateTypeDialog( conflictSpans: ImmutableArray.Empty, renameSpans: ImmutableArray.Empty, warningSpans: ImmutableArray.Empty, + navigationSpans: ImmutableArray.Empty, ignoreTrivia: false, expectedChangedDocumentId: testState.ExistingDocument.Id); } else @@ -393,7 +394,9 @@ internal async Task TestWithMockedGenerateTypeDialog( await TestOperationsAsync(testState.Workspace, expectedTextWithUsings, operations, conflictSpans: ImmutableArray.Empty, renameSpans: ImmutableArray.Empty, - warningSpans: ImmutableArray.Empty, ignoreTrivia: false, + warningSpans: ImmutableArray.Empty, + navigationSpans: ImmutableArray.Empty, + ignoreTrivia: false, expectedChangedDocumentId: testState.InvocationDocument.Id); } diff --git a/src/EditorFeatures/TestUtilities/MoveType/AbstractMoveTypeTest.cs b/src/EditorFeatures/TestUtilities/MoveType/AbstractMoveTypeTest.cs index 70d174dd823cb..10dc17e228ce6 100644 --- a/src/EditorFeatures/TestUtilities/MoveType/AbstractMoveTypeTest.cs +++ b/src/EditorFeatures/TestUtilities/MoveType/AbstractMoveTypeTest.cs @@ -137,6 +137,7 @@ private async Task> TestOperationAsync( conflictSpans: ImmutableArray.Empty, renameSpans: ImmutableArray.Empty, warningSpans: ImmutableArray.Empty, + navigationSpans: ImmutableArray.Empty, ignoreTrivia: ignoreTrivia, expectedChangedDocumentId: null); } diff --git a/src/EditorFeatures/VisualBasicTest/GenerateConstructorFromMembers/GenerateConstructorFromMembersTests.vb b/src/EditorFeatures/VisualBasicTest/GenerateConstructorFromMembers/GenerateConstructorFromMembersTests.vb index 97e04c12747fb..1d9a9e3319f3c 100644 --- a/src/EditorFeatures/VisualBasicTest/GenerateConstructorFromMembers/GenerateConstructorFromMembersTests.vb +++ b/src/EditorFeatures/VisualBasicTest/GenerateConstructorFromMembers/GenerateConstructorFromMembersTests.vb @@ -21,7 +21,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.GenerateConstructo End Class", "Class Program Private i As Integer - Public Sub New(i As Integer) + Public Sub New(i As Integer{|Navigation:)|} Me.i = i End Sub End Class") @@ -37,7 +37,7 @@ End Class", "Class Program Private i As Integer Private b As String - Public Sub New(i As Integer, b As String) + Public Sub New(i As Integer, b As String{|Navigation:)|} Me.i = i Me.b = b End Sub @@ -60,7 +60,7 @@ End Class", Public Sub New(i As Integer) Me.i = i End Sub - Public Sub New(b As String) + Public Sub New(b As String{|Navigation:)|} Me.b = b End Sub End Class") @@ -82,7 +82,7 @@ End Class", Public Sub New(i As Integer) Me.i = i End Sub - Public Sub New(i As Integer, b As String) + Public Sub New(i As Integer, b As String{|Navigation:)|} Me.i = i Me.b = b End Sub @@ -113,7 +113,7 @@ End Class") End Structure", "Structure S Private i As Integer - Public Sub New(i As Integer) + Public Sub New(i As Integer{|Navigation:)|} Me.i = i End Sub End Structure") @@ -127,7 +127,7 @@ End Structure") End Class", "Class Program(Of T) Private i As Integer - Public Sub New(i As Integer) + Public Sub New(i As Integer{|Navigation:)|} Me.i = i End Sub End Class") @@ -150,7 +150,7 @@ End Class", Public Sub New(i As Integer) Me.i = i End Sub - Public Sub New(i As Integer, b As String) + Public Sub New(i As Integer, b As String{|Navigation:)|} Me.New(i) Me.b = b End Sub @@ -167,7 +167,7 @@ index:=1) Public Property B As String|] End Class", "Class Z - Public Sub New(a As Integer, b As String) + Public Sub New(a As Integer, b As String{|Navigation:)|} Me.A = a Me.B = b End Sub @@ -185,7 +185,7 @@ End Class") ReadOnly Property Number As Integer|] End Class", "Class Contribution - Public Sub New(title As String, number As Integer) + Public Sub New(title As String, number As Integer{|Navigation:)|} Me.Title = title Me.Number = number End Sub @@ -214,7 +214,7 @@ End Class") End Class", "Class Program Private i As Integer - Public Sub New(i As Integer) + Public Sub New(i As Integer{|Navigation:)|} Me.i = i End Sub End Class", chosenSymbols:={"i"}) @@ -229,7 +229,7 @@ End Class", chosenSymbols:={"i"}) End Class", "Class Program Private i As Integer - Public Sub New() + Public Sub New({|Navigation:)|} End Sub End Class", chosenSymbols:={}) End Function @@ -245,7 +245,7 @@ End Class", "Class Program Private i As Integer Private j As String - Public Sub New(j As String, i As Integer) + Public Sub New(j As String, i As Integer{|Navigation:)|} Me.j = j Me.i = i End Sub @@ -260,7 +260,7 @@ End Class", chosenSymbols:={"j", "i"}) End Class", "Class Program Private i As Integer - Public Sub New(i As Integer) + Public Sub New(i As Integer{|Navigation:)|} Me.i = i End Sub End Class", chosenSymbols:={"i"}) diff --git a/src/Features/Core/Portable/GenerateConstructorFromMembers/ConstructorDelegatingCodeAction.cs b/src/Features/Core/Portable/GenerateConstructorFromMembers/ConstructorDelegatingCodeAction.cs index 621dbacd50c93..a1b18b13dbbed 100644 --- a/src/Features/Core/Portable/GenerateConstructorFromMembers/ConstructorDelegatingCodeAction.cs +++ b/src/Features/Core/Portable/GenerateConstructorFromMembers/ConstructorDelegatingCodeAction.cs @@ -103,7 +103,7 @@ protected override async Task GetChangedDocumentAsync(CancellationToke afterThisLocation: afterThisLocation), cancellationToken: cancellationToken).ConfigureAwait(false); - return result; + return await AddNavigationAnnotationAsync(result, cancellationToken).ConfigureAwait(false); } public override string Title diff --git a/src/Features/Core/Portable/GenerateConstructorFromMembers/FieldDelegatingCodeAction.cs b/src/Features/Core/Portable/GenerateConstructorFromMembers/FieldDelegatingCodeAction.cs index 478173b6dca77..d06abae020db3 100644 --- a/src/Features/Core/Portable/GenerateConstructorFromMembers/FieldDelegatingCodeAction.cs +++ b/src/Features/Core/Portable/GenerateConstructorFromMembers/FieldDelegatingCodeAction.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; using System.Collections.Generic; using System.Linq; using System.Threading; @@ -84,7 +85,7 @@ protected override async Task GetChangedDocumentAsync(CancellationToke afterThisLocation: afterThisLocation), cancellationToken).ConfigureAwait(false); - return result; + return await AddNavigationAnnotationAsync(result, cancellationToken).ConfigureAwait(false); } public override string Title diff --git a/src/Features/Core/Portable/GenerateConstructorFromMembers/GenerateConstructorFromMembersCodeRefactoringProvider.cs b/src/Features/Core/Portable/GenerateConstructorFromMembers/GenerateConstructorFromMembersCodeRefactoringProvider.cs index 0c4f0aacdda82..795107dea8387 100644 --- a/src/Features/Core/Portable/GenerateConstructorFromMembers/GenerateConstructorFromMembersCodeRefactoringProvider.cs +++ b/src/Features/Core/Portable/GenerateConstructorFromMembers/GenerateConstructorFromMembersCodeRefactoringProvider.cs @@ -6,6 +6,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeActions; +using Microsoft.CodeAnalysis.CodeGeneration; using Microsoft.CodeAnalysis.CodeRefactorings; using Microsoft.CodeAnalysis.GenerateFromMembers; using Microsoft.CodeAnalysis.Internal.Log; @@ -165,5 +166,26 @@ private ImmutableArray GetCodeActions(Document document, State state return result.ToImmutableAndFree(); } + + private static async Task AddNavigationAnnotationAsync(Document document, CancellationToken cancellationToken) + { + var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); + + var nodes = root.GetAnnotatedNodes(CodeGenerator.Annotation); + var syntaxFacts = document.GetLanguageService(); + + foreach (var node in nodes) + { + var parameterList = syntaxFacts.GetParameterList(node); + if (parameterList != null) + { + var closeParen = parameterList.GetLastToken(); + var newRoot = root.ReplaceToken(closeParen, closeParen.WithAdditionalAnnotations(NavigationAnnotation.Create())); + return document.WithSyntaxRoot(newRoot); + } + } + + return document; + } } } diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/CSharpSyntaxGenerator.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/CSharpSyntaxGenerator.cs index 00354c091d651..d16b439d261e0 100644 --- a/src/Workspaces/CSharp/Portable/CodeGeneration/CSharpSyntaxGenerator.cs +++ b/src/Workspaces/CSharp/Portable/CodeGeneration/CSharpSyntaxGenerator.cs @@ -2610,7 +2610,7 @@ public override SyntaxToken VisitToken(SyntaxToken token) } } - private static BaseParameterListSyntax GetParameterList(SyntaxNode declaration) + internal static BaseParameterListSyntax GetParameterList(SyntaxNode declaration) { switch (declaration.Kind()) { diff --git a/src/Workspaces/CSharp/Portable/LanguageServices/CSharpSyntaxFactsService.cs b/src/Workspaces/CSharp/Portable/LanguageServices/CSharpSyntaxFactsService.cs index 729f52121c38d..e1ebf40f3ad55 100644 --- a/src/Workspaces/CSharp/Portable/LanguageServices/CSharpSyntaxFactsService.cs +++ b/src/Workspaces/CSharp/Portable/LanguageServices/CSharpSyntaxFactsService.cs @@ -8,6 +8,7 @@ using System.Text; using System.Threading; using Microsoft.CodeAnalysis.Collections; +using Microsoft.CodeAnalysis.CSharp.CodeGeneration; using Microsoft.CodeAnalysis.CSharp.Extensions; using Microsoft.CodeAnalysis.CSharp.Extensions.ContextQuery; using Microsoft.CodeAnalysis.CSharp.Syntax; @@ -207,6 +208,9 @@ public bool IsNamedParameter(SyntaxNode node) public SyntaxNode GetDefaultOfParameter(SyntaxNode node) => (node as ParameterSyntax)?.Default; + public SyntaxNode GetParameterList(SyntaxNode node) + => CSharpSyntaxGenerator.GetParameterList(node); + public bool IsSkippedTokensTrivia(SyntaxNode node) { return node is SkippedTokensTriviaSyntax; diff --git a/src/Workspaces/Core/Portable/CodeActions/Annotations/ConflictAnnotation.cs b/src/Workspaces/Core/Portable/CodeActions/Annotations/ConflictAnnotation.cs index 0c8e34fce9a0e..7dedf83be7d7e 100644 --- a/src/Workspaces/Core/Portable/CodeActions/Annotations/ConflictAnnotation.cs +++ b/src/Workspaces/Core/Portable/CodeActions/Annotations/ConflictAnnotation.cs @@ -1,6 +1,5 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - namespace Microsoft.CodeAnalysis.CodeActions { /// diff --git a/src/Workspaces/Core/Portable/CodeActions/Annotations/NavigationAnnotation.cs b/src/Workspaces/Core/Portable/CodeActions/Annotations/NavigationAnnotation.cs new file mode 100644 index 0000000000000..b72e5343a5779 --- /dev/null +++ b/src/Workspaces/Core/Portable/CodeActions/Annotations/NavigationAnnotation.cs @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace Microsoft.CodeAnalysis.CodeActions +{ + /// + /// Apply this annotation to an appropriate Syntax element to request that it should be + /// navigated to by the user after the action. + /// + internal static class NavigationAnnotation + { + public const string Kind = "CodeAction_Navigation"; + + public static SyntaxAnnotation Create() + => new SyntaxAnnotation(Kind); + } +} diff --git a/src/Workspaces/Core/Portable/CodeActions/Annotations/RenameAnnotation.cs b/src/Workspaces/Core/Portable/CodeActions/Annotations/RenameAnnotation.cs index 0d4e103e16eff..0010779038ddd 100644 --- a/src/Workspaces/Core/Portable/CodeActions/Annotations/RenameAnnotation.cs +++ b/src/Workspaces/Core/Portable/CodeActions/Annotations/RenameAnnotation.cs @@ -1,6 +1,5 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - namespace Microsoft.CodeAnalysis.CodeActions { /// diff --git a/src/Workspaces/Core/Portable/CodeGeneration/CodeGenerationHelpers.cs b/src/Workspaces/Core/Portable/CodeGeneration/CodeGenerationHelpers.cs index 3396ea40380a2..b1f9f6144e7a5 100644 --- a/src/Workspaces/Core/Portable/CodeGeneration/CodeGenerationHelpers.cs +++ b/src/Workspaces/Core/Portable/CodeGeneration/CodeGenerationHelpers.cs @@ -49,7 +49,7 @@ public static TSyntaxNode AddAnnotationsTo(ISymbol symbol, TSyntaxN public static TSyntaxNode AddCleanupAnnotationsTo(TSyntaxNode node) where TSyntaxNode : SyntaxNode { - return node.WithAdditionalAnnotations(Formatter.Annotation); + return node.WithAdditionalAnnotations(Formatter.Annotation, CodeGenerator.Annotation); } public static void CheckNodeType(SyntaxNode node, string argumentName) @@ -215,9 +215,9 @@ public static T GetReuseableSyntaxNodeForSymbol(ISymbol symbol, CodeGeneratio { Contract.ThrowIfNull(symbol); - return options != null && options.ReuseSyntax && symbol.DeclaringSyntaxReferences.Length == 1 ? - symbol.DeclaringSyntaxReferences[0].GetSyntax() as T : - null; + return options != null && options.ReuseSyntax && symbol.DeclaringSyntaxReferences.Length == 1 + ? symbol.DeclaringSyntaxReferences[0].GetSyntax() as T + : null; } public static T GetReuseableSyntaxNodeForAttribute(AttributeData attribute, CodeGenerationOptions options) diff --git a/src/Workspaces/Core/Portable/CodeGeneration/CodeGenerator.cs b/src/Workspaces/Core/Portable/CodeGeneration/CodeGenerator.cs index 794f0d4491874..eeb7526aa6ecb 100644 --- a/src/Workspaces/Core/Portable/CodeGeneration/CodeGenerator.cs +++ b/src/Workspaces/Core/Portable/CodeGeneration/CodeGenerator.cs @@ -11,6 +11,11 @@ namespace Microsoft.CodeAnalysis.CodeGeneration /// internal static class CodeGenerator { + /// + /// Annotation placed on generated syntax. + /// + public static readonly SyntaxAnnotation Annotation = new SyntaxAnnotation(nameof(CodeGenerator)); + private static ICodeGenerationService GetCodeGenerationService(Workspace workspace, string language) { return workspace.Services.GetLanguageServices(language).GetService(); diff --git a/src/Workspaces/Core/Portable/LanguageServices/SyntaxFactsService/ISyntaxFactsService.cs b/src/Workspaces/Core/Portable/LanguageServices/SyntaxFactsService/ISyntaxFactsService.cs index 0bc087ef1357a..2b34bbeaf934d 100644 --- a/src/Workspaces/Core/Portable/LanguageServices/SyntaxFactsService/ISyntaxFactsService.cs +++ b/src/Workspaces/Core/Portable/LanguageServices/SyntaxFactsService/ISyntaxFactsService.cs @@ -132,6 +132,7 @@ internal interface ISyntaxFactsService : ILanguageService bool IsNamedParameter(SyntaxNode node); SyntaxNode GetDefaultOfParameter(SyntaxNode node); + SyntaxNode GetParameterList(SyntaxNode node); bool IsSkippedTokensTrivia(SyntaxNode node); diff --git a/src/Workspaces/VisualBasic/Portable/CodeGeneration/VisualBasicSyntaxGenerator.vb b/src/Workspaces/VisualBasic/Portable/CodeGeneration/VisualBasicSyntaxGenerator.vb index 3afc9289d9ce1..361e120e98c35 100644 --- a/src/Workspaces/VisualBasic/Portable/CodeGeneration/VisualBasicSyntaxGenerator.vb +++ b/src/Workspaces/VisualBasic/Portable/CodeGeneration/VisualBasicSyntaxGenerator.vb @@ -3063,7 +3063,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration statement.CaseBlocks.InsertRange(index, switchSections.Cast(Of CaseBlockSyntax))) End Function - Private Function GetParameterList(declaration As SyntaxNode) As ParameterListSyntax + Friend Shared Function GetParameterList(declaration As SyntaxNode) As ParameterListSyntax Select Case declaration.Kind Case SyntaxKind.SubBlock, SyntaxKind.FunctionBlock diff --git a/src/Workspaces/VisualBasic/Portable/LanguageServices/VisualBasicSyntaxFactsService.vb b/src/Workspaces/VisualBasic/Portable/LanguageServices/VisualBasicSyntaxFactsService.vb index a6d6159ef9a7b..0ad08fd1fed74 100644 --- a/src/Workspaces/VisualBasic/Portable/LanguageServices/VisualBasicSyntaxFactsService.vb +++ b/src/Workspaces/VisualBasic/Portable/LanguageServices/VisualBasicSyntaxFactsService.vb @@ -10,6 +10,7 @@ Imports Microsoft.CodeAnalysis.Host.Mef Imports Microsoft.CodeAnalysis.LanguageServices Imports Microsoft.CodeAnalysis.PooledObjects Imports Microsoft.CodeAnalysis.Text +Imports Microsoft.CodeAnalysis.VisualBasic.CodeGeneration Imports Microsoft.CodeAnalysis.VisualBasic.Extensions.ContextQuery Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Imports Microsoft.CodeAnalysis.VisualBasic.SyntaxFacts @@ -202,6 +203,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Return TryCast(node, ParameterSyntax)?.Default End Function + Public Function GetParameterList(node As SyntaxNode) As SyntaxNode Implements ISyntaxFactsService.GetParameterList + Return VisualBasicSyntaxGenerator.GetParameterList(node) + End Function + Public Function IsSkippedTokensTrivia(node As SyntaxNode) As Boolean Implements ISyntaxFactsService.IsSkippedTokensTrivia Return TypeOf node Is SkippedTokensTriviaSyntax End Function From e1e73839c717e41f14e53d51196e5065bb34f283 Mon Sep 17 00:00:00 2001 From: CyrusNajmabadi Date: Mon, 24 Jul 2017 14:33:14 -0700 Subject: [PATCH 005/205] Update method name. --- .../CSharp/Portable/CodeGeneration/ConstructorGenerator.cs | 2 +- .../CSharp/Portable/CodeGeneration/ConversionGenerator.cs | 2 +- .../CSharp/Portable/CodeGeneration/DestructorGenerator.cs | 2 +- .../CSharp/Portable/CodeGeneration/EnumMemberGenerator.cs | 2 +- .../CSharp/Portable/CodeGeneration/EventGenerator.cs | 4 ++-- .../CSharp/Portable/CodeGeneration/FieldGenerator.cs | 2 +- .../CSharp/Portable/CodeGeneration/MethodGenerator.cs | 2 +- .../CSharp/Portable/CodeGeneration/NamedTypeGenerator.cs | 4 ++-- .../CSharp/Portable/CodeGeneration/NamespaceGenerator.cs | 4 ++-- .../CSharp/Portable/CodeGeneration/PropertyGenerator.cs | 4 ++-- .../Core/Portable/CodeGeneration/CodeGenerationHelpers.cs | 6 ++---- .../Portable/CodeGeneration/ConstructorGenerator.vb | 2 +- .../Portable/CodeGeneration/ConversionGenerator.vb | 2 +- .../Portable/CodeGeneration/EnumMemberGenerator.vb | 2 +- .../VisualBasic/Portable/CodeGeneration/EventGenerator.vb | 2 +- .../VisualBasic/Portable/CodeGeneration/FieldGenerator.vb | 2 +- .../VisualBasic/Portable/CodeGeneration/MethodGenerator.vb | 2 +- .../Portable/CodeGeneration/NamedTypeGenerator.vb | 4 ++-- .../Portable/CodeGeneration/NamespaceGenerator.vb | 4 ++-- .../Portable/CodeGeneration/OperatorGenerator.vb | 2 +- .../Portable/CodeGeneration/PropertyGenerator.vb | 2 +- 21 files changed, 28 insertions(+), 30 deletions(-) diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/ConstructorGenerator.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/ConstructorGenerator.cs index 8a8a738b0248c..bfca08548198f 100644 --- a/src/Workspaces/CSharp/Portable/CodeGeneration/ConstructorGenerator.cs +++ b/src/Workspaces/CSharp/Portable/CodeGeneration/ConstructorGenerator.cs @@ -63,7 +63,7 @@ internal static ConstructorDeclarationSyntax GenerateConstructorDeclaration( declaration = UseExpressionBodyIfDesired(workspace, declaration, parseOptions); - return AddCleanupAnnotationsTo( + return AddFormatterAndCodeGeneratorAnnotationsTo( ConditionallyAddDocumentationCommentTo(declaration, constructor, options)); } diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/ConversionGenerator.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/ConversionGenerator.cs index 0db442dde3a7b..7435f1bbf5d9b 100644 --- a/src/Workspaces/CSharp/Portable/CodeGeneration/ConversionGenerator.cs +++ b/src/Workspaces/CSharp/Portable/CodeGeneration/ConversionGenerator.cs @@ -39,7 +39,7 @@ internal static ConversionOperatorDeclarationSyntax GenerateConversionDeclaratio ParseOptions parseOptions) { var declaration = GenerateConversionDeclarationWorker(method, destination, workspace, options, parseOptions); - return AddCleanupAnnotationsTo(AddAnnotationsTo(method, + return AddFormatterAndCodeGeneratorAnnotationsTo(AddAnnotationsTo(method, ConditionallyAddDocumentationCommentTo(declaration, method, options))); } diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/DestructorGenerator.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/DestructorGenerator.cs index c81fc82c1061b..3475176a22fec 100644 --- a/src/Workspaces/CSharp/Portable/CodeGeneration/DestructorGenerator.cs +++ b/src/Workspaces/CSharp/Portable/CodeGeneration/DestructorGenerator.cs @@ -55,7 +55,7 @@ internal static DestructorDeclarationSyntax GenerateDestructorDeclaration( body: hasNoBody ? null : GenerateBlock(destructor), semicolonToken: hasNoBody ? SyntaxFactory.Token(SyntaxKind.SemicolonToken) : default); - return AddCleanupAnnotationsTo( + return AddFormatterAndCodeGeneratorAnnotationsTo( ConditionallyAddDocumentationCommentTo(declaration, destructor, options)); } diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/EnumMemberGenerator.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/EnumMemberGenerator.cs index bb4c73be05400..8b967aee39f4a 100644 --- a/src/Workspaces/CSharp/Portable/CodeGeneration/EnumMemberGenerator.cs +++ b/src/Workspaces/CSharp/Portable/CodeGeneration/EnumMemberGenerator.cs @@ -60,7 +60,7 @@ public static EnumMemberDeclarationSyntax GenerateEnumMemberDeclaration( var member = SyntaxFactory.EnumMemberDeclaration(enumMember.Name.ToIdentifierToken()) .WithEqualsValue(value == null ? null : SyntaxFactory.EqualsValueClause(value: value)); - return AddCleanupAnnotationsTo( + return AddFormatterAndCodeGeneratorAnnotationsTo( ConditionallyAddDocumentationCommentTo(member, enumMember, options)); } diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/EventGenerator.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/EventGenerator.cs index 3d5505f01cd33..bc8aa85c252e6 100644 --- a/src/Workspaces/CSharp/Portable/CodeGeneration/EventGenerator.cs +++ b/src/Workspaces/CSharp/Portable/CodeGeneration/EventGenerator.cs @@ -106,7 +106,7 @@ public static MemberDeclarationSyntax GenerateEventDeclaration( private static MemberDeclarationSyntax GenerateEventFieldDeclaration( IEventSymbol @event, CodeGenerationDestination destination, CodeGenerationOptions options) { - return AddCleanupAnnotationsTo( + return AddFormatterAndCodeGeneratorAnnotationsTo( AddAnnotationsTo(@event, SyntaxFactory.EventFieldDeclaration( AttributeGenerator.GenerateAttributeLists(@event.GetAttributes(), options), @@ -121,7 +121,7 @@ private static MemberDeclarationSyntax GenerateEventDeclarationWorker( { var explicitInterfaceSpecifier = GenerateExplicitInterfaceSpecifier(@event.ExplicitInterfaceImplementations); - return AddCleanupAnnotationsTo(SyntaxFactory.EventDeclaration( + return AddFormatterAndCodeGeneratorAnnotationsTo(SyntaxFactory.EventDeclaration( attributeLists: AttributeGenerator.GenerateAttributeLists(@event.GetAttributes(), options), modifiers: GenerateModifiers(@event, destination, options), type: @event.Type.GenerateTypeSyntax(), diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/FieldGenerator.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/FieldGenerator.cs index 1cc7123808928..cdb14ff0c039c 100644 --- a/src/Workspaces/CSharp/Portable/CodeGeneration/FieldGenerator.cs +++ b/src/Workspaces/CSharp/Portable/CodeGeneration/FieldGenerator.cs @@ -107,7 +107,7 @@ public static FieldDeclarationSyntax GenerateFieldDeclaration( SyntaxFactory.SingletonSeparatedList( AddAnnotationsTo(field, SyntaxFactory.VariableDeclarator(field.Name.ToIdentifierToken(), null, initializer))))); - return AddCleanupAnnotationsTo( + return AddFormatterAndCodeGeneratorAnnotationsTo( ConditionallyAddDocumentationCommentTo(fieldDeclaration, field, options)); } diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/MethodGenerator.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/MethodGenerator.cs index 9bd1c871312b5..da3266c7da8bc 100644 --- a/src/Workspaces/CSharp/Portable/CodeGeneration/MethodGenerator.cs +++ b/src/Workspaces/CSharp/Portable/CodeGeneration/MethodGenerator.cs @@ -109,7 +109,7 @@ private static MethodDeclarationSyntax GenerateMethodDeclarationWorker( methodDeclaration = UseExpressionBodyIfDesired(workspace, methodDeclaration, parseOptions); - return AddCleanupAnnotationsTo(methodDeclaration); + return AddFormatterAndCodeGeneratorAnnotationsTo(methodDeclaration); } private static MethodDeclarationSyntax UseExpressionBodyIfDesired( diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/NamedTypeGenerator.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/NamedTypeGenerator.cs index 29ac58eb065cb..c471ef376c8dd 100644 --- a/src/Workspaces/CSharp/Portable/CodeGeneration/NamedTypeGenerator.cs +++ b/src/Workspaces/CSharp/Portable/CodeGeneration/NamedTypeGenerator.cs @@ -85,7 +85,7 @@ public static MemberDeclarationSyntax GenerateNamedTypeDeclaration( cancellationToken) : declaration; - return AddCleanupAnnotationsTo(ConditionallyAddDocumentationCommentTo(declaration, namedType, options)); + return AddFormatterAndCodeGeneratorAnnotationsTo(ConditionallyAddDocumentationCommentTo(declaration, namedType, options)); } public static MemberDeclarationSyntax UpdateNamedTypeDeclaration( @@ -97,7 +97,7 @@ public static MemberDeclarationSyntax UpdateNamedTypeDeclaration( { declaration = RemoveAllMembers(declaration); declaration = service.AddMembers(declaration, newMembers, options, cancellationToken); - return AddCleanupAnnotationsTo(declaration); + return AddFormatterAndCodeGeneratorAnnotationsTo(declaration); } private static MemberDeclarationSyntax GetDeclarationSyntaxWithoutMembers( diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/NamespaceGenerator.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/NamespaceGenerator.cs index 3c5572646af26..8db65b398af15 100644 --- a/src/Workspaces/CSharp/Portable/CodeGeneration/NamespaceGenerator.cs +++ b/src/Workspaces/CSharp/Portable/CodeGeneration/NamespaceGenerator.cs @@ -67,7 +67,7 @@ internal static SyntaxNode GenerateNamespaceDeclaration( ? service.AddMembers(declaration, innermostNamespace.GetMembers(), options, cancellationToken) : declaration; - return AddCleanupAnnotationsTo(declaration); + return AddFormatterAndCodeGeneratorAnnotationsTo(declaration); } public static SyntaxNode UpdateCompilationUnitOrNamespaceDeclaration( @@ -79,7 +79,7 @@ public static SyntaxNode UpdateCompilationUnitOrNamespaceDeclaration( { declaration = RemoveAllMembers(declaration); declaration = service.AddMembers(declaration, newMembers, options, cancellationToken); - return AddCleanupAnnotationsTo(declaration); + return AddFormatterAndCodeGeneratorAnnotationsTo(declaration); } private static SyntaxNode GenerateNamespaceDeclarationWorker( diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/PropertyGenerator.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/PropertyGenerator.cs index 862109ea16a31..41683812aa9c6 100644 --- a/src/Workspaces/CSharp/Portable/CodeGeneration/PropertyGenerator.cs +++ b/src/Workspaces/CSharp/Portable/CodeGeneration/PropertyGenerator.cs @@ -103,7 +103,7 @@ private static MemberDeclarationSyntax GenerateIndexerDeclaration( accessorList: GenerateAccessorList(property, destination, workspace, options, parseOptions)); declaration = UseExpressionBodyIfDesired(workspace, declaration, parseOptions); - return AddCleanupAnnotationsTo( + return AddFormatterAndCodeGeneratorAnnotationsTo( AddAnnotationsTo(property, declaration)); } @@ -141,7 +141,7 @@ private static MemberDeclarationSyntax GeneratePropertyDeclaration( propertyDeclaration = UseExpressionBodyIfDesired( workspace, propertyDeclaration, parseOptions); - return AddCleanupAnnotationsTo( + return AddFormatterAndCodeGeneratorAnnotationsTo( AddAnnotationsTo(property, propertyDeclaration)); } diff --git a/src/Workspaces/Core/Portable/CodeGeneration/CodeGenerationHelpers.cs b/src/Workspaces/Core/Portable/CodeGeneration/CodeGenerationHelpers.cs index b1f9f6144e7a5..c8469a0820dfb 100644 --- a/src/Workspaces/Core/Portable/CodeGeneration/CodeGenerationHelpers.cs +++ b/src/Workspaces/Core/Portable/CodeGeneration/CodeGenerationHelpers.cs @@ -47,10 +47,8 @@ public static TSyntaxNode AddAnnotationsTo(ISymbol symbol, TSyntaxN return syntax; } - public static TSyntaxNode AddCleanupAnnotationsTo(TSyntaxNode node) where TSyntaxNode : SyntaxNode - { - return node.WithAdditionalAnnotations(Formatter.Annotation, CodeGenerator.Annotation); - } + public static TSyntaxNode AddFormatterAndCodeGeneratorAnnotationsTo(TSyntaxNode node) where TSyntaxNode : SyntaxNode + => node.WithAdditionalAnnotations(Formatter.Annotation, CodeGenerator.Annotation); public static void CheckNodeType(SyntaxNode node, string argumentName) where TSyntaxNode1 : SyntaxNode diff --git a/src/Workspaces/VisualBasic/Portable/CodeGeneration/ConstructorGenerator.vb b/src/Workspaces/VisualBasic/Portable/CodeGeneration/ConstructorGenerator.vb index 1036f5104df19..e67668c96448b 100644 --- a/src/Workspaces/VisualBasic/Portable/CodeGeneration/ConstructorGenerator.vb +++ b/src/Workspaces/VisualBasic/Portable/CodeGeneration/ConstructorGenerator.vb @@ -48,7 +48,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration statements:=GenerateStatements(constructor), endSubStatement:=SyntaxFactory.EndSubStatement())) - Return AddAnnotationsTo(constructor, AddCleanupAnnotationsTo( + Return AddAnnotationsTo(constructor, AddFormatterAndCodeGeneratorAnnotationsTo( ConditionallyAddDocumentationCommentTo(declaration, constructor, options))) End Function diff --git a/src/Workspaces/VisualBasic/Portable/CodeGeneration/ConversionGenerator.vb b/src/Workspaces/VisualBasic/Portable/CodeGeneration/ConversionGenerator.vb index a5b6d0c1c56ea..f4264c3d1d41c 100644 --- a/src/Workspaces/VisualBasic/Portable/CodeGeneration/ConversionGenerator.vb +++ b/src/Workspaces/VisualBasic/Portable/CodeGeneration/ConversionGenerator.vb @@ -30,7 +30,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration Dim declaration = GenerateConversionDeclarationWorker(method, destination, options) Return AddAnnotationsTo(method, - AddCleanupAnnotationsTo( + AddFormatterAndCodeGeneratorAnnotationsTo( ConditionallyAddDocumentationCommentTo(declaration, method, options))) End Function diff --git a/src/Workspaces/VisualBasic/Portable/CodeGeneration/EnumMemberGenerator.vb b/src/Workspaces/VisualBasic/Portable/CodeGeneration/EnumMemberGenerator.vb index 7c0941755d9ba..8d97ba54649cc 100644 --- a/src/Workspaces/VisualBasic/Portable/CodeGeneration/EnumMemberGenerator.vb +++ b/src/Workspaces/VisualBasic/Portable/CodeGeneration/EnumMemberGenerator.vb @@ -44,7 +44,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration Dim member = SyntaxFactory.EnumMemberDeclaration(enumMember.Name.ToIdentifierToken()) _ .WithInitializer(If(value Is Nothing, Nothing, SyntaxFactory.EqualsValue(value:=value))) - Return AddCleanupAnnotationsTo(ConditionallyAddDocumentationCommentTo(member, enumMember, options)) + Return AddFormatterAndCodeGeneratorAnnotationsTo(ConditionallyAddDocumentationCommentTo(member, enumMember, options)) End Function Private Function CreateEnumMemberValue(destinationOpt As EnumBlockSyntax, enumMember As IFieldSymbol) As ExpressionSyntax diff --git a/src/Workspaces/VisualBasic/Portable/CodeGeneration/EventGenerator.vb b/src/Workspaces/VisualBasic/Portable/CodeGeneration/EventGenerator.vb index bbeb40863b800..2f1abd3bf4eec 100644 --- a/src/Workspaces/VisualBasic/Portable/CodeGeneration/EventGenerator.vb +++ b/src/Workspaces/VisualBasic/Portable/CodeGeneration/EventGenerator.vb @@ -69,7 +69,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration Dim declaration = GenerateEventDeclarationWorker([event], destination, options) - Return AddCleanupAnnotationsTo(ConditionallyAddDocumentationCommentTo(declaration, [event], options)) + Return AddFormatterAndCodeGeneratorAnnotationsTo(ConditionallyAddDocumentationCommentTo(declaration, [event], options)) End Function Private Function GenerateEventDeclarationWorker([event] As IEventSymbol, diff --git a/src/Workspaces/VisualBasic/Portable/CodeGeneration/FieldGenerator.vb b/src/Workspaces/VisualBasic/Portable/CodeGeneration/FieldGenerator.vb index 82875e67415d3..6487dd1871169 100644 --- a/src/Workspaces/VisualBasic/Portable/CodeGeneration/FieldGenerator.vb +++ b/src/Workspaces/VisualBasic/Portable/CodeGeneration/FieldGenerator.vb @@ -90,7 +90,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration SyntaxFactory.SimpleAsClause(field.Type.GenerateTypeSyntax()), initializer))) - Return AddCleanupAnnotationsTo(ConditionallyAddDocumentationCommentTo(EnsureLastElasticTrivia(fieldDeclaration), field, options)) + Return AddFormatterAndCodeGeneratorAnnotationsTo(ConditionallyAddDocumentationCommentTo(EnsureLastElasticTrivia(fieldDeclaration), field, options)) End Function Private Function GenerateEqualsValue(field As IFieldSymbol) As EqualsValueSyntax diff --git a/src/Workspaces/VisualBasic/Portable/CodeGeneration/MethodGenerator.vb b/src/Workspaces/VisualBasic/Portable/CodeGeneration/MethodGenerator.vb index 8a51095206acc..da7bed6ce6df9 100644 --- a/src/Workspaces/VisualBasic/Portable/CodeGeneration/MethodGenerator.vb +++ b/src/Workspaces/VisualBasic/Portable/CodeGeneration/MethodGenerator.vb @@ -58,7 +58,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration Dim declaration = GenerateMethodDeclarationWorker(method, destination, options) Return AddAnnotationsTo(method, - AddCleanupAnnotationsTo( + AddFormatterAndCodeGeneratorAnnotationsTo( ConditionallyAddDocumentationCommentTo(declaration, method, options))) End Function diff --git a/src/Workspaces/VisualBasic/Portable/CodeGeneration/NamedTypeGenerator.vb b/src/Workspaces/VisualBasic/Portable/CodeGeneration/NamedTypeGenerator.vb index 8dc662b93cd4c..96b92c7b6b06e 100644 --- a/src/Workspaces/VisualBasic/Portable/CodeGeneration/NamedTypeGenerator.vb +++ b/src/Workspaces/VisualBasic/Portable/CodeGeneration/NamedTypeGenerator.vb @@ -54,7 +54,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration service.AddMembers(declaration, GetMembers(namedType), options, cancellationToken), declaration) - Return AddCleanupAnnotationsTo(ConditionallyAddDocumentationCommentTo(declaration, namedType, options)) + Return AddFormatterAndCodeGeneratorAnnotationsTo(ConditionallyAddDocumentationCommentTo(declaration, namedType, options)) End Function Public Function UpdateNamedTypeDeclaration(service As ICodeGenerationService, @@ -64,7 +64,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration cancellationToken As CancellationToken) As StatementSyntax declaration = RemoveAllMembers(declaration) declaration = service.AddMembers(declaration, newMembers, options, cancellationToken) - Return AddCleanupAnnotationsTo(declaration) + Return AddFormatterAndCodeGeneratorAnnotationsTo(declaration) End Function Private Function GetDeclarationSyntaxWithoutMembers(namedType As INamedTypeSymbol, options As CodeGenerationOptions) As StatementSyntax diff --git a/src/Workspaces/VisualBasic/Portable/CodeGeneration/NamespaceGenerator.vb b/src/Workspaces/VisualBasic/Portable/CodeGeneration/NamespaceGenerator.vb index 1f64fa73854e3..f5e249e103235 100644 --- a/src/Workspaces/VisualBasic/Portable/CodeGeneration/NamespaceGenerator.vb +++ b/src/Workspaces/VisualBasic/Portable/CodeGeneration/NamespaceGenerator.vb @@ -52,7 +52,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration service.AddMembers(declaration, innermostNamespace.GetMembers().AsEnumerable(), options, cancellationToken), declaration) - Return AddCleanupAnnotationsTo(declaration) + Return AddFormatterAndCodeGeneratorAnnotationsTo(declaration) End Function Public Function UpdateCompilationUnitOrNamespaceDeclaration(service As ICodeGenerationService, @@ -62,7 +62,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration cancellationToken As CancellationToken) As SyntaxNode declaration = RemoveAllMembers(declaration) declaration = service.AddMembers(declaration, newMembers, options, cancellationToken) - Return AddCleanupAnnotationsTo(declaration) + Return AddFormatterAndCodeGeneratorAnnotationsTo(declaration) End Function Private Function GetDeclarationSyntaxWithoutMembers([namespace] As INamespaceSymbol, innermostNamespace As INamespaceSymbol, name As String, options As CodeGenerationOptions) As SyntaxNode diff --git a/src/Workspaces/VisualBasic/Portable/CodeGeneration/OperatorGenerator.vb b/src/Workspaces/VisualBasic/Portable/CodeGeneration/OperatorGenerator.vb index 2b25fef9370fc..ac25ff3f38340 100644 --- a/src/Workspaces/VisualBasic/Portable/CodeGeneration/OperatorGenerator.vb +++ b/src/Workspaces/VisualBasic/Portable/CodeGeneration/OperatorGenerator.vb @@ -30,7 +30,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration Dim declaration = GenerateOperatorDeclarationWorker(method, destination, options) Return AddAnnotationsTo(method, - AddCleanupAnnotationsTo( + AddFormatterAndCodeGeneratorAnnotationsTo( ConditionallyAddDocumentationCommentTo(declaration, method, options))) End Function diff --git a/src/Workspaces/VisualBasic/Portable/CodeGeneration/PropertyGenerator.vb b/src/Workspaces/VisualBasic/Portable/CodeGeneration/PropertyGenerator.vb index 7be88b0691dc7..2efebda9adbd5 100644 --- a/src/Workspaces/VisualBasic/Portable/CodeGeneration/PropertyGenerator.vb +++ b/src/Workspaces/VisualBasic/Portable/CodeGeneration/PropertyGenerator.vb @@ -51,7 +51,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration Dim declaration = GeneratePropertyDeclarationWorker([property], destination, options) Return AddAnnotationsTo([property], - AddCleanupAnnotationsTo( + AddFormatterAndCodeGeneratorAnnotationsTo( ConditionallyAddDocumentationCommentTo(declaration, [property], options))) End Function From 8742f35032fc69bc6d2ee4641f7b74eaec104371 Mon Sep 17 00:00:00 2001 From: CyrusNajmabadi Date: Mon, 24 Jul 2017 10:50:03 -0700 Subject: [PATCH 006/205] Fix crash in nuget code when nuget.config file is broken. --- .../Core/Def/Packaging/IPackageServicesProxy.cs | 4 +++- .../Packaging/PackageInstallerServiceFactory.cs | 15 ++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/VisualStudio/Core/Def/Packaging/IPackageServicesProxy.cs b/src/VisualStudio/Core/Def/Packaging/IPackageServicesProxy.cs index a18ed17efd915..3c25fbdc2e563 100644 --- a/src/VisualStudio/Core/Def/Packaging/IPackageServicesProxy.cs +++ b/src/VisualStudio/Core/Def/Packaging/IPackageServicesProxy.cs @@ -7,7 +7,9 @@ namespace Microsoft.VisualStudio.LanguageServices.Packaging { - // Wrapper types to ensure we delay load the nuget libraries. + /// Wrapper type to ensure we delay load the nuget libraries. + /// All methods may throw exceptions due to + /// throwing in all sorts of bad nuget states (for example a bad nuget.config file) internal interface IPackageServicesProxy { event EventHandler SourcesChanged; diff --git a/src/VisualStudio/Core/Def/Packaging/PackageInstallerServiceFactory.cs b/src/VisualStudio/Core/Def/Packaging/PackageInstallerServiceFactory.cs index 6b015fc907b44..92cd940c723c8 100644 --- a/src/VisualStudio/Core/Def/Packaging/PackageInstallerServiceFactory.cs +++ b/src/VisualStudio/Core/Def/Packaging/PackageInstallerServiceFactory.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Collections.Immutable; using System.Composition; +using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -145,9 +146,17 @@ private void OnSourceProviderSourcesChanged(object sender, EventArgs e) this.AssertIsForeground(); - PackageSources = _packageServices.GetSources(includeUnOfficial: true, includeDisabled: false) - .Select(r => new PackageSource(r.Key, r.Value)) - .ToImmutableArrayOrEmpty(); + try + { + PackageSources = _packageServices.GetSources(includeUnOfficial: true, includeDisabled: false) + .Select(r => new PackageSource(r.Key, r.Value)) + .ToImmutableArrayOrEmpty(); + } + catch (Exception ex) when (ex is InvalidDataException || ex is InvalidOperationException) + { + // These exceptions can happen when the nuget.config file is broken. + PackageSources = ImmutableArray.Empty; + } PackageSourcesChanged?.Invoke(this, EventArgs.Empty); } From 77c7df55e15a563f0521bebde8a60db91bdd0ab1 Mon Sep 17 00:00:00 2001 From: CyrusNajmabadi Date: Mon, 24 Jul 2017 17:50:29 -0700 Subject: [PATCH 007/205] Add user facing option to place blank lines between using/import groups. --- .../Organizing/OrganizeUsingsTests.cs | 48 ++++++++++- .../Organizing/OrganizeImportsTests.vb | 49 ++++++++++- .../CSharpOrganizeImportsService.Rewriter.cs | 12 ++- .../CSharpOrganizeImportsService.cs | 5 +- .../OrganizeImports/OrganizeImportsService.cs | 6 +- ...ualBasicOrganizeImportsService.Rewriter.vb | 10 ++- .../VisualBasicOrganizeImportsService.vb | 5 +- .../CSharp/Impl/CSharpVSResources.Designer.cs | 9 ++ .../CSharp/Impl/CSharpVSResources.resx | 3 + .../Options/AdvancedOptionPageControl.xaml | 3 + .../Options/AdvancedOptionPageControl.xaml.cs | 1 + .../Impl/Options/AdvancedOptionPageStrings.cs | 7 +- .../Impl/BasicVSResources.Designer.vb | 9 ++ .../VisualBasic/Impl/BasicVSResources.resx | 5 +- .../Options/AdvancedOptionPageControl.xaml | 3 + .../Options/AdvancedOptionPageControl.xaml.vb | 1 + .../Impl/Options/AdvancedOptionPageStrings.vb | 17 ++-- .../UsingsAndExternAliasesOrganizer.cs | 86 +++++++++++++++++-- .../Portable/Editing/GenerationOptions.cs | 9 +- .../Portable/Utilities/ImportsOrganizer.vb | 76 +++++++++++++--- 20 files changed, 311 insertions(+), 53 deletions(-) diff --git a/src/EditorFeatures/CSharpTest/Organizing/OrganizeUsingsTests.cs b/src/EditorFeatures/CSharpTest/Organizing/OrganizeUsingsTests.cs index 03266681b74ca..3b5672b83a6d3 100644 --- a/src/EditorFeatures/CSharpTest/Organizing/OrganizeUsingsTests.cs +++ b/src/EditorFeatures/CSharpTest/Organizing/OrganizeUsingsTests.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Linq; +using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.Editing; @@ -14,13 +15,19 @@ namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Organizing { public class OrganizeUsingsTests { - protected async Task CheckAsync(string initial, string final, bool placeSystemNamespaceFirst = false, CSharpParseOptions options = null) + protected async Task CheckAsync( + string initial, string final, + bool placeSystemNamespaceFirst = false, + bool separateImportGroups = false, + CSharpParseOptions options = null) { using (var workspace = TestWorkspace.CreateCSharp(initial)) { var document = workspace.CurrentSolution.GetDocument(workspace.Documents.First().Id); workspace.Options = workspace.Options.WithChangedOption(new OptionKey(GenerationOptions.PlaceSystemNamespaceFirst, document.Project.Language), placeSystemNamespaceFirst); - var newRoot = await (await OrganizeImportsService.OrganizeImportsAsync(document)).GetSyntaxRootAsync(); + workspace.Options = workspace.Options.WithChangedOption(new OptionKey(GenerationOptions.SeparateImportDirectiveGroups, document.Project.Language), separateImportGroups); + + var newRoot = await (await OrganizeImportsService.OrganizeImportsAsync(document, CancellationToken.None)).GetSyntaxRootAsync(); Assert.Equal(final.NormalizeLineEndings(), newRoot.ToFullString()); } } @@ -1027,5 +1034,42 @@ public async Task CaseSensitivity2() await CheckAsync(initial, final); } + + [WorkItem(20988, "https://github.com/dotnet/roslyn/issues/20988")] + [Fact, Trait(Traits.Feature, Traits.Features.Organizing)] + public async Task TestGrouping() + { + var initial = +@"// Banner + +using Microsoft.CodeAnalysis.CSharp.Extensions; +using Microsoft.CodeAnalysis.CSharp.Syntax; + +using System.Collections.Generic; +using System.Linq; +using Microsoft.CodeAnalysis.Shared.Extensions; +using Roslyn.Utilities; +using IntList = System.Collections.Generic.List; +using static System.Console;"; + + var final = +@"// Banner + +using System.Collections.Generic; +using System.Linq; + +using Microsoft.CodeAnalysis.CSharp.Extensions; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.Shared.Extensions; + +using Roslyn.Utilities; + +using static System.Console; + +using IntList = System.Collections.Generic.List; +"; + + await CheckAsync(initial, final, placeSystemNamespaceFirst: true, separateImportGroups: true); + } } } diff --git a/src/EditorFeatures/VisualBasicTest/Organizing/OrganizeImportsTests.vb b/src/EditorFeatures/VisualBasicTest/Organizing/OrganizeImportsTests.vb index 36376945f109c..149b6a6295aed 100644 --- a/src/EditorFeatures/VisualBasicTest/Organizing/OrganizeImportsTests.vb +++ b/src/EditorFeatures/VisualBasicTest/Organizing/OrganizeImportsTests.vb @@ -1,5 +1,6 @@ ' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +Imports System.Threading Imports System.Xml.Linq Imports Microsoft.CodeAnalysis.Editing Imports Microsoft.CodeAnalysis.Editor.UnitTests.Extensions @@ -9,11 +10,15 @@ Imports Microsoft.CodeAnalysis.OrganizeImports Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Organizing Public Class OrganizeImportsTests - Private Async Function CheckAsync(initial As XElement, final As XElement, Optional placeSystemNamespaceFirst As Boolean = False) As Task + Private Async Function CheckAsync(initial As XElement, final As XElement, + Optional placeSystemNamespaceFirst As Boolean = False, + Optional separateImportGroups As Boolean = False) As Task Using workspace = TestWorkspace.CreateVisualBasic(initial.NormalizedValue) Dim document = workspace.CurrentSolution.GetDocument(workspace.Documents.First().Id) workspace.Options = workspace.Options.WithChangedOption(New OptionKey(GenerationOptions.PlaceSystemNamespaceFirst, document.Project.Language), placeSystemNamespaceFirst) - Dim newRoot = Await (Await OrganizeImportsService.OrganizeImportsAsync(document)).GetSyntaxRootAsync() + workspace.Options = workspace.Options.WithChangedOption(New OptionKey(GenerationOptions.SeparateImportDirectiveGroups, document.Project.Language), separateImportGroups) + + Dim newRoot = Await (Await OrganizeImportsService.OrganizeImportsAsync(document, CancellationToken.None)).GetSyntaxRootAsync() Assert.Equal(final.NormalizedValue, newRoot.ToFullString()) End Using End Function @@ -678,5 +683,45 @@ Imports ああ Await CheckAsync(initial, final) End Function + + + + Public Async Function TestGrouping() As Task + Dim initial = + +Imports +Imports Roslyn.Utilities +Imports IntList = System.Collections.Generic.List(Of Integer) +Imports +]]> + + Dim final = + +Imports +Imports +]]> + + Await CheckAsync(initial, final, placeSystemNamespaceFirst:=True, separateImportGroups:=True) + End Function End Class End Namespace diff --git a/src/Features/CSharp/Portable/OrganizeImports/CSharpOrganizeImportsService.Rewriter.cs b/src/Features/CSharp/Portable/OrganizeImports/CSharpOrganizeImportsService.Rewriter.cs index 63e59191bce3c..26a6b59068289 100644 --- a/src/Features/CSharp/Portable/OrganizeImports/CSharpOrganizeImportsService.Rewriter.cs +++ b/src/Features/CSharp/Portable/OrganizeImports/CSharpOrganizeImportsService.Rewriter.cs @@ -13,18 +13,23 @@ internal partial class CSharpOrganizeImportsService private class Rewriter : CSharpSyntaxRewriter { private readonly bool _placeSystemNamespaceFirst; + private readonly bool _separateGroups; + public readonly IList TextChanges = new List(); - public Rewriter(bool placeSystemNamespaceFirst) + public Rewriter(bool placeSystemNamespaceFirst, + bool separateGroups) { _placeSystemNamespaceFirst = placeSystemNamespaceFirst; + _separateGroups = separateGroups; } public override SyntaxNode VisitCompilationUnit(CompilationUnitSyntax node) { node = (CompilationUnitSyntax)base.VisitCompilationUnit(node); UsingsAndExternAliasesOrganizer.Organize( - node.Externs, node.Usings, _placeSystemNamespaceFirst, + node.Externs, node.Usings, + _placeSystemNamespaceFirst, _separateGroups, out var organizedExternAliasList, out var organizedUsingList); var result = node.WithExterns(organizedExternAliasList).WithUsings(organizedUsingList); @@ -41,7 +46,8 @@ public override SyntaxNode VisitNamespaceDeclaration(NamespaceDeclarationSyntax { node = (NamespaceDeclarationSyntax)base.VisitNamespaceDeclaration(node); UsingsAndExternAliasesOrganizer.Organize( - node.Externs, node.Usings, _placeSystemNamespaceFirst, + node.Externs, node.Usings, + _placeSystemNamespaceFirst, _separateGroups, out var organizedExternAliasList, out var organizedUsingList); var result = node.WithExterns(organizedExternAliasList).WithUsings(organizedUsingList); diff --git a/src/Features/CSharp/Portable/OrganizeImports/CSharpOrganizeImportsService.cs b/src/Features/CSharp/Portable/OrganizeImports/CSharpOrganizeImportsService.cs index 9ccd2f28ca460..02f434a984ace 100644 --- a/src/Features/CSharp/Portable/OrganizeImports/CSharpOrganizeImportsService.cs +++ b/src/Features/CSharp/Portable/OrganizeImports/CSharpOrganizeImportsService.cs @@ -16,8 +16,11 @@ public async Task OrganizeImportsAsync(Document document, Cancellation { var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); var options = await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false); + var placeSystemNamespaceFirst = options.GetOption(GenerationOptions.PlaceSystemNamespaceFirst); - var rewriter = new Rewriter(placeSystemNamespaceFirst); + var blankLineBetweenGroups = options.GetOption(GenerationOptions.SeparateImportDirectiveGroups); + + var rewriter = new Rewriter(placeSystemNamespaceFirst, blankLineBetweenGroups); var newRoot = rewriter.Visit(root); return document.WithSyntaxRoot(newRoot); diff --git a/src/Features/Core/Portable/OrganizeImports/OrganizeImportsService.cs b/src/Features/Core/Portable/OrganizeImports/OrganizeImportsService.cs index ae66cb6e223b1..668b435a31069 100644 --- a/src/Features/Core/Portable/OrganizeImports/OrganizeImportsService.cs +++ b/src/Features/Core/Portable/OrganizeImports/OrganizeImportsService.cs @@ -8,9 +8,7 @@ namespace Microsoft.CodeAnalysis.OrganizeImports { internal static partial class OrganizeImportsService { - public static Task OrganizeImportsAsync(Document document, CancellationToken cancellationToken = default) - { - return document.GetLanguageService().OrganizeImportsAsync(document, cancellationToken); - } + public static Task OrganizeImportsAsync(Document document, CancellationToken cancellationToken) + => document.GetLanguageService().OrganizeImportsAsync(document, cancellationToken); } } diff --git a/src/Features/VisualBasic/Portable/OrganizeImports/VisualBasicOrganizeImportsService.Rewriter.vb b/src/Features/VisualBasic/Portable/OrganizeImports/VisualBasicOrganizeImportsService.Rewriter.vb index c9b96bb7ac738..7d2979824415e 100644 --- a/src/Features/VisualBasic/Portable/OrganizeImports/VisualBasicOrganizeImportsService.Rewriter.vb +++ b/src/Features/VisualBasic/Portable/OrganizeImports/VisualBasicOrganizeImportsService.Rewriter.vb @@ -10,15 +10,19 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.OrganizeImports Inherits VisualBasicSyntaxRewriter Private ReadOnly _placeSystemNamespaceFirst As Boolean + Private ReadOnly _separateGroups As Boolean + Public ReadOnly TextChanges As IList(Of TextChange) = New List(Of TextChange)() - Public Sub New(placeSystemNamespaceFirst As Boolean) - Me._placeSystemNamespaceFirst = placeSystemNamespaceFirst + Public Sub New(placeSystemNamespaceFirst As Boolean, separateGroups As Boolean) + _placeSystemNamespaceFirst = placeSystemNamespaceFirst + _separateGroups = separateGroups End Sub Public Overrides Function VisitCompilationUnit(node As CompilationUnitSyntax) As SyntaxNode node = DirectCast(MyBase.VisitCompilationUnit(node), CompilationUnitSyntax) - Dim organizedImports = ImportsOrganizer.Organize(node.Imports, _placeSystemNamespaceFirst) + Dim organizedImports = ImportsOrganizer.Organize( + node.Imports, _placeSystemNamespaceFirst, _separateGroups) Dim result = node.WithImports(organizedImports) If result IsNot node Then diff --git a/src/Features/VisualBasic/Portable/OrganizeImports/VisualBasicOrganizeImportsService.vb b/src/Features/VisualBasic/Portable/OrganizeImports/VisualBasicOrganizeImportsService.vb index 93cf25d26b865..4a9e9a758d010 100644 --- a/src/Features/VisualBasic/Portable/OrganizeImports/VisualBasicOrganizeImportsService.vb +++ b/src/Features/VisualBasic/Portable/OrganizeImports/VisualBasicOrganizeImportsService.vb @@ -15,8 +15,11 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.OrganizeImports cancellationToken As CancellationToken) As Task(Of Document) Implements IOrganizeImportsService.OrganizeImportsAsync Dim root = Await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(False) Dim options = Await document.GetOptionsAsync(cancellationToken).ConfigureAwait(False) + Dim placeSystemNamespaceFirst = options.GetOption(GenerationOptions.PlaceSystemNamespaceFirst) - Dim rewriter = New Rewriter(placeSystemNamespaceFirst) + Dim separateGroups = options.GetOption(GenerationOptions.SeparateImportDirectiveGroups) + + Dim rewriter = New Rewriter(placeSystemNamespaceFirst, separateGroups) Dim newRoot = rewriter.Visit(root) Return document.WithSyntaxRoot(newRoot) End Function diff --git a/src/VisualStudio/CSharp/Impl/CSharpVSResources.Designer.cs b/src/VisualStudio/CSharp/Impl/CSharpVSResources.Designer.cs index 7e695c187c6b4..84b758b7067e9 100644 --- a/src/VisualStudio/CSharp/Impl/CSharpVSResources.Designer.cs +++ b/src/VisualStudio/CSharp/Impl/CSharpVSResources.Designer.cs @@ -1059,6 +1059,15 @@ internal static string Selection_In_Completion_List { } } + /// + /// Looks up a localized string similar to Separate using directive groups. + /// + internal static string Separate_using_directive_groups { + get { + return ResourceManager.GetString("Separate_using_directive_groups", resourceCulture); + } + } + /// /// Looks up a localized string similar to Set other spacing options. /// diff --git a/src/VisualStudio/CSharp/Impl/CSharpVSResources.resx b/src/VisualStudio/CSharp/Impl/CSharpVSResources.resx index 337a812d04623..b8fb7e8fb2da2 100644 --- a/src/VisualStudio/CSharp/Impl/CSharpVSResources.resx +++ b/src/VisualStudio/CSharp/Impl/CSharpVSResources.resx @@ -525,4 +525,7 @@ Report invalid placeholders in 'string.Format' calls + + Separate using directive groups + \ No newline at end of file diff --git a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml index 1bec4b08d732c..84ce7778891ae 100644 --- a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml +++ b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml @@ -27,6 +27,9 @@ + diff --git a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs index 5213ed9aab9cb..e270b93b2b565 100644 --- a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs +++ b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs @@ -26,6 +26,7 @@ public AdvancedOptionPageControl(IServiceProvider serviceProvider) : base(servic BindToOption(Perform_editor_feature_analysis_in_external_process, RemoteFeatureOptions.OutOfProcessAllowed); BindToOption(PlaceSystemNamespaceFirst, GenerationOptions.PlaceSystemNamespaceFirst, LanguageNames.CSharp); + BindToOption(SeparateImportGroups, GenerationOptions.SeparateImportDirectiveGroups, LanguageNames.CSharp); BindToOption(SuggestForTypesInReferenceAssemblies, SymbolSearchOptions.SuggestForTypesInReferenceAssemblies, LanguageNames.CSharp); BindToOption(SuggestForTypesInNuGetPackages, SymbolSearchOptions.SuggestForTypesInNuGetPackages, LanguageNames.CSharp); BindToOption(Split_string_literals_on_enter, SplitStringLiteralOptions.Enabled, LanguageNames.CSharp); diff --git a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageStrings.cs b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageStrings.cs index 62bb477351168..ebf93377da080 100644 --- a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageStrings.cs +++ b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageStrings.cs @@ -149,9 +149,10 @@ public static string Option_Performance } public static string Option_PlaceSystemNamespaceFirst - { - get { return CSharpVSResources.Place_System_directives_first_when_sorting_usings; } - } + => CSharpVSResources.Place_System_directives_first_when_sorting_usings; + + public static string Option_SeparateImportGroups + => CSharpVSResources.Separate_using_directive_groups; public static string Option_Using_Directives => CSharpVSResources.Using_Directives; diff --git a/src/VisualStudio/VisualBasic/Impl/BasicVSResources.Designer.vb b/src/VisualStudio/VisualBasic/Impl/BasicVSResources.Designer.vb index fcece5de3d729..77d2be3372f7d 100644 --- a/src/VisualStudio/VisualBasic/Impl/BasicVSResources.Designer.vb +++ b/src/VisualStudio/VisualBasic/Impl/BasicVSResources.Designer.vb @@ -460,6 +460,15 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic End Get End Property + ''' + ''' Looks up a localized string similar to Separate import directive groups. + ''' + Friend Shared ReadOnly Property Separate_import_directive_groups() As String + Get + Return ResourceManager.GetString("Separate_import_directive_groups", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to Show completion item _filters. ''' diff --git a/src/VisualStudio/VisualBasic/Impl/BasicVSResources.resx b/src/VisualStudio/VisualBasic/Impl/BasicVSResources.resx index 21baa3edd699b..691689cae3614 100644 --- a/src/VisualStudio/VisualBasic/Impl/BasicVSResources.resx +++ b/src/VisualStudio/VisualBasic/Impl/BasicVSResources.resx @@ -13,7 +13,7 @@ Example: ... ado.net/XML headers & schema ... - text/microsoft-resxtext/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, ... System.Resources.ResXResourceWriter, System.Windows.Forms, ... @@ -276,4 +276,7 @@ Report invalid placeholders in 'String.Format' calls + + Separate import directive groups + \ No newline at end of file diff --git a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml index 2eac0942912f4..af82357aa83e4 100644 --- a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml +++ b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml @@ -28,6 +28,9 @@ + diff --git a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb index 4944794384c1f..4ad2053268e6a 100644 --- a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb +++ b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb @@ -23,6 +23,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Options BindToOption(Perform_editor_feature_analysis_in_external_process, RemoteFeatureOptions.OutOfProcessAllowed) BindToOption(PlaceSystemNamespaceFirst, GenerationOptions.PlaceSystemNamespaceFirst, LanguageNames.VisualBasic) + BindToOption(SeparateImportGroups, GenerationOptions.SeparateImportDirectiveGroups, LanguageNames.VisualBasic) BindToOption(SuggestForTypesInReferenceAssemblies, SymbolSearchOptions.SuggestForTypesInReferenceAssemblies, LanguageNames.VisualBasic) BindToOption(SuggestForTypesInNuGetPackages, SymbolSearchOptions.SuggestForTypesInNuGetPackages, LanguageNames.VisualBasic) diff --git a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageStrings.vb b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageStrings.vb index c47bfa8d6a0b0..44f8f6ab8ee6d 100644 --- a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageStrings.vb +++ b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageStrings.vb @@ -191,17 +191,14 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Options End Get End Property - Public ReadOnly Property Option_Import_Directives As String - Get - Return BasicVSResources.Import_Directives - End Get - End Property + Public ReadOnly Property Option_Import_Directives As String = + BasicVSResources.Import_Directives - Public ReadOnly Property Option_PlaceSystemNamespaceFirst As String - Get - Return BasicVSResources.Place_System_directives_first_when_sorting_imports - End Get - End Property + Public ReadOnly Property Option_PlaceSystemNamespaceFirst As String = + BasicVSResources.Place_System_directives_first_when_sorting_imports + + Public ReadOnly Property Option_SeparateImportGroups As String = + BasicVSResources.Separate_import_directive_groups Public ReadOnly Property Option_Suggest_imports_for_types_in_reference_assemblies As String Get diff --git a/src/Workspaces/CSharp/Portable/Utilities/UsingsAndExternAliasesOrganizer.cs b/src/Workspaces/CSharp/Portable/Utilities/UsingsAndExternAliasesOrganizer.cs index 6ba9a4ca7492a..037a2e2fd46a9 100644 --- a/src/Workspaces/CSharp/Portable/Utilities/UsingsAndExternAliasesOrganizer.cs +++ b/src/Workspaces/CSharp/Portable/Utilities/UsingsAndExternAliasesOrganizer.cs @@ -2,19 +2,88 @@ using System.Collections.Generic; using System.Linq; -using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Extensions; -using Microsoft.CodeAnalysis.CSharp.Symbols; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Shared.Extensions; -using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp.Utilities { internal static partial class UsingsAndExternAliasesOrganizer { + private static readonly SyntaxTrivia s_newLine = SyntaxFactory.CarriageReturnLineFeed; + public static void Organize( + SyntaxList externAliasList, + SyntaxList usingList, + bool placeSystemNamespaceFirst, bool separateGroups, + out SyntaxList organizedExternAliasList, + out SyntaxList organizedUsingList) + { + OrganizeWorker( + externAliasList, usingList, placeSystemNamespaceFirst, + out organizedExternAliasList, out organizedUsingList); + + if (separateGroups) + { + if (organizedExternAliasList.Count > 0 && organizedUsingList.Count > 0) + { + var firstUsing = organizedUsingList[0]; + var newFirstUsing = firstUsing.WithPrependedLeadingTrivia(s_newLine); + organizedUsingList = organizedUsingList.Replace(firstUsing, newFirstUsing); + } + + for (var i = 1; i < organizedUsingList.Count; i++) + { + var lastUsing = organizedUsingList[i - 1]; + var currentUsing = organizedUsingList[i]; + + if (NeedsGrouping(lastUsing, currentUsing)) + { + var newCurrentUsing = currentUsing.WithPrependedLeadingTrivia(s_newLine); + organizedUsingList = organizedUsingList.Replace(currentUsing, newCurrentUsing); + } + } + } + } + + private static bool NeedsGrouping( + UsingDirectiveSyntax using1, + UsingDirectiveSyntax using2) + { + var directive1IsUsingStatic = using1.StaticKeyword.IsKind(SyntaxKind.StaticKeyword); + var directive2IsUsingStatic = using2.StaticKeyword.IsKind(SyntaxKind.StaticKeyword); + + var directive1IsAlias = using1.Alias != null; + var directive2IsAlias = using2.Alias != null; + + var directive1IsNamespace = !directive1IsUsingStatic && !directive1IsAlias; + var directive2IsNamespace = !directive2IsUsingStatic && !directive2IsAlias; + + if (directive1IsAlias && directive2IsAlias) + { + return false; + } + + if (directive1IsUsingStatic && directive2IsUsingStatic) + { + return false; + } + + if (directive1IsNamespace && directive2IsNamespace) + { + // Both normal usings. Place them in groups if they're first namespace + // component differs. + var name1 = using1.Name.GetFirstToken().ValueText; + var name2 = using2.Name.GetFirstToken().ValueText; + return name1 != name2; + } + + // They have different types, definitely put them into new groups. + return true; + } + + private static void OrganizeWorker( SyntaxList externAliasList, SyntaxList usingList, bool placeSystemNamespaceFirst, @@ -79,9 +148,7 @@ private static void EnsureNewLines(IList list) if (!trailingTrivia.Any() || trailingTrivia.Last().Kind() != SyntaxKind.EndOfLineTrivia) { - // TODO(cyrusn): Don't use CRLF. Use the appropriate - // newline for this file. - list[i] = node.WithTrailingTrivia(trailingTrivia.Concat(SyntaxFactory.CarriageReturnLineFeed)); + list[i] = node.WithTrailingTrivia(trailingTrivia.Concat(s_newLine)); } } @@ -90,10 +157,13 @@ private static void EnsureNewLines(IList list) for (int i = 1; i < list.Count; i++) { var node = list[i]; - list[i] = node.WithLeadingTrivia(node.GetLeadingTrivia().SkipWhile(t => t.Kind() == SyntaxKind.EndOfLineTrivia)); + list[i] = TrimLeadingNewLines(node); } - list[0] = list[0].WithLeadingTrivia(list[0].GetLeadingTrivia().SkipWhile(t => t.Kind() == SyntaxKind.EndOfLineTrivia)); + list[0] = TrimLeadingNewLines(list[0]); } + + private static SyntaxNode TrimLeadingNewLines(SyntaxNode node) + => node.WithLeadingTrivia(node.GetLeadingTrivia().SkipWhile(t => t.Kind() == SyntaxKind.EndOfLineTrivia)); } } diff --git a/src/Workspaces/Core/Portable/Editing/GenerationOptions.cs b/src/Workspaces/Core/Portable/Editing/GenerationOptions.cs index 64e54ead2b9f3..5d2d9f34e2fb4 100644 --- a/src/Workspaces/Core/Portable/Editing/GenerationOptions.cs +++ b/src/Workspaces/Core/Portable/Editing/GenerationOptions.cs @@ -6,9 +6,16 @@ namespace Microsoft.CodeAnalysis.Editing { internal class GenerationOptions { - public static readonly PerLanguageOption PlaceSystemNamespaceFirst = new PerLanguageOption(nameof(GenerationOptions), nameof(PlaceSystemNamespaceFirst), defaultValue: true, + public static readonly PerLanguageOption PlaceSystemNamespaceFirst = new PerLanguageOption(nameof(GenerationOptions), + nameof(PlaceSystemNamespaceFirst), defaultValue: true, storageLocations: new OptionStorageLocation[] { EditorConfigStorageLocation.ForBoolOption("dotnet_sort_system_directives_first"), new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.PlaceSystemNamespaceFirst")}); + + public static readonly PerLanguageOption SeparateImportDirectiveGroups = new PerLanguageOption( + nameof(GenerationOptions), nameof(SeparateImportDirectiveGroups), defaultValue: false, + storageLocations: new OptionStorageLocation[] { + EditorConfigStorageLocation.ForBoolOption("dotnet_seperate_import_directive_groups"), + new RoamingProfileStorageLocation($"TextEditor.%LANGUAGE%.Specific.{nameof(SeparateImportDirectiveGroups)}")}); } } diff --git a/src/Workspaces/VisualBasic/Portable/Utilities/ImportsOrganizer.vb b/src/Workspaces/VisualBasic/Portable/Utilities/ImportsOrganizer.vb index b90cb0182b1e9..9442875275da9 100644 --- a/src/Workspaces/VisualBasic/Portable/Utilities/ImportsOrganizer.vb +++ b/src/Workspaces/VisualBasic/Portable/Utilities/ImportsOrganizer.vb @@ -1,25 +1,73 @@ ' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -Imports System -Imports System.Collections.Generic Imports System.Collections.Immutable -Imports System.Globalization -Imports System.Linq -Imports System.Text -Imports System.Threading Imports Microsoft.CodeAnalysis -Imports Microsoft.CodeAnalysis.Shared.Collections -Imports Microsoft.CodeAnalysis.Text -Imports Microsoft.CodeAnalysis.VisualBasic -Imports Microsoft.CodeAnalysis.VisualBasic.Extensions -Imports Microsoft.CodeAnalysis.VisualBasic.Symbols Imports Microsoft.CodeAnalysis.VisualBasic.Syntax -Imports Microsoft.CodeAnalysis.VisualBasic.Utilities Namespace Microsoft.CodeAnalysis.VisualBasic.Utilities Partial Friend Class ImportsOrganizer + Private Shared ReadOnly s_newLine As SyntaxTrivia = SyntaxFactory.CarriageReturnLineFeed + Public Shared Function Organize([imports] As SyntaxList(Of ImportsStatementSyntax), - placeSystemNamespaceFirst As Boolean) As SyntaxList(Of ImportsStatementSyntax) + placeSystemNamespaceFirst As Boolean, + separateGroups As Boolean) As SyntaxList(Of ImportsStatementSyntax) + + [imports] = OrganizeWorker([imports], placeSystemNamespaceFirst) + + If separateGroups Then + For i = 1 To [imports].Count - 1 + Dim lastImport = [imports](i - 1) + Dim currentImport = [imports](i) + + If NeedsGrouping(lastImport, currentImport) Then + [imports] = [imports].Replace( + currentImport, currentImport.WithPrependedLeadingTrivia(s_newLine)) + End If + Next + End If + + Return [imports] + End Function + + Private Shared Function NeedsGrouping(import1 As ImportsStatementSyntax, + import2 As ImportsStatementSyntax) As Boolean + If import1.ImportsClauses.Count = 0 OrElse import2.ImportsClauses.Count = 0 Then + Return False + End If + + Dim importClause1 = import1.ImportsClauses(0) + Dim importClause2 = import2.ImportsClauses(0) + + Dim simpleClause1 = TryCast(importClause1, SimpleImportsClauseSyntax) + Dim simpleClause2 = TryCast(importClause2, SimpleImportsClauseSyntax) + + If simpleClause1 Is Nothing AndAlso simpleClause2 Is Nothing Then + Return False + End If + + If simpleClause1 IsNot Nothing AndAlso simpleClause2 IsNot Nothing Then + Dim isAlias1 = simpleClause1.Alias IsNot Nothing + Dim isAlias2 = simpleClause2.Alias IsNot Nothing + + If isAlias1 AndAlso isAlias2 Then + Return False + End If + + If Not isAlias1 AndAlso Not isAlias2 Then + ' named imports + Dim name1 = simpleClause1.Name.GetFirstToken().ValueText + Dim name2 = simpleClause2.Name.GetFirstToken().ValueText + + Return Not VisualBasicSyntaxFactsService.Instance.StringComparer.Equals(name1, name2) + End If + End If + + ' Different kinds of imports. Definitely place into separate groups. + Return True + End Function + + Public Shared Function OrganizeWorker([imports] As SyntaxList(Of ImportsStatementSyntax), + placeSystemNamespaceFirst As Boolean) As SyntaxList(Of ImportsStatementSyntax) If [imports].Count > 1 Then Dim initialList = New List(Of ImportsStatementSyntax)([imports]) If Not [imports].SpansPreprocessorDirective() Then @@ -51,7 +99,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Utilities Private Shared Sub EnsureNewLines(list As List(Of ImportsStatementSyntax)) Dim endOfLine = GetExistingEndOfLineTrivia(list) - endOfLine = If(endOfLine.Kind = SyntaxKind.None, SyntaxFactory.CarriageReturnLineFeed, endOfLine) + endOfLine = If(endOfLine.Kind = SyntaxKind.None, s_newLine, endOfLine) For i = 0 To list.Count - 1 If Not list(i).GetTrailingTrivia().Any(SyntaxKind.EndOfLineTrivia) Then From 3990b3c1cae2110912bf2833ce1f6e054148bb58 Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Tue, 11 Jul 2017 17:33:17 -0700 Subject: [PATCH 008/205] Add [Fact]s where missing and make helper methods private xunit.analyzers will flag public methods of types that have other facts in them. Sometimes this catches things we missed [Fact] on, and in other times was catching private test helpers. Make both of the fixes. --- .../Test/Emit/CodeGen/CodeGenAsyncTests.cs | 3 ++- .../Test/Emit/CodeGen/CodeGenRefReturnTests.cs | 4 ++++ .../Test/Emit/CodeGen/CodeGenThrowTests.cs | 5 +++++ .../CSharp/Test/Emit/CodeGen/SwitchTests.cs | 1 + .../CSharp/Test/Emit/CodeGen/UnsafeTests.cs | 1 + .../EditAndContinue/AssemblyReferencesTests.cs | 2 +- src/Compilers/CSharp/Test/Emit/PDB/PDBTests.cs | 1 + .../IOperation/IOperationTests_IArgument.cs | 1 + .../Semantic/Semantics/SemanticErrorTests.cs | 1 + .../Test/Syntax/LexicalAndXml/LexicalTests.cs | 2 ++ .../Syntax/Parsing/DeclarationParsingTests.cs | 17 +++++++++-------- .../Syntax/Parsing/ExpressionParsingTests.cs | 2 ++ .../Syntax/Parsing/ParserErrorMessageTests.cs | 1 + .../Syntax/Parsing/ParserRegressionTests.cs | 2 +- .../Test/Syntax/Parsing/RoundTrippingTests.cs | 2 +- .../Test/Syntax/Parsing/ScriptParsingTests.cs | 4 ++-- .../Syntax/Parsing/StatementParsingTests.cs | 1 + .../Collections/ArrayBuilderTests.cs | 2 +- .../AutomaticLiteralCompletionTests.cs | 2 ++ .../OverrideCompletionProviderTests.cs | 1 + .../SnippetCompletionProviderTests.cs | 1 + .../GenerateEnumMemberTests.cs | 2 +- .../NamingStyles/NamingStylesTests.cs | 1 + .../Formatting/FormattingEngineTests.cs | 4 ++-- .../Test/CodeFixes/CodeFixServiceTests.cs | 6 +++--- .../CodeRefactoringServiceTest.cs | 2 +- .../SolutionCrawler/WorkCoordinatorTests.cs | 8 ++++---- .../Test/ResultProvider/AccessibilityTests.cs | 6 +++--- .../HostTest/InteractiveHostTests.cs | 4 ++-- .../CSharpTest/ObjectFormatterTests.cs | 2 +- .../ProximityExpressionsGetterTests.cs | 2 +- .../Commands/InteractiveCommandHandlerTests.cs | 2 +- .../Services/ServiceHubServicesTests.cs | 2 +- .../LinkedFileDiffMergingTests.cs | 2 +- .../CoreTest/SolutionTests/SolutionTests.cs | 1 + .../CoreTest/UtilityTest/EditDistanceTests.cs | 1 + .../TemporaryStorageServiceTests.cs | 2 +- .../WorkspaceTests/AdhocWorkspaceTests.cs | 2 +- 38 files changed, 67 insertions(+), 38 deletions(-) diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncTests.cs index 291b70af9729a..ff0b15ff4bf24 100644 --- a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncTests.cs +++ b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncTests.cs @@ -3487,6 +3487,7 @@ namespace System.Runtime.CompilerServices { class AsyncMethodBuilderAttribute : ); } + [Fact] public void AsyncTasklikeBadAttributeArgument4() { var source = @" @@ -3851,7 +3852,7 @@ namespace System.Runtime.CompilerServices { class AsyncMethodBuilderAttribute : } // Should check constraints (see https://github.com/dotnet/roslyn/issues/12616). - //[Fact] + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/12616")] public void AsyncTasklikeBuilderConstraints() { var source1 = @" diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenRefReturnTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenRefReturnTests.cs index 213cda15a72fb..29c9bc1c23979 100644 --- a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenRefReturnTests.cs +++ b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenRefReturnTests.cs @@ -2838,6 +2838,7 @@ static void Main() ); } + [Fact] [WorkItem(16947, "https://github.com/dotnet/roslyn/issues/16947")] public void Dynamic001() { @@ -2867,6 +2868,8 @@ public static ref dynamic F(ref dynamic d) Diagnostic(ErrorCode.ERR_RefReturnLvalueExpected, "d.Length").WithLocation(14, 20) ); } + + [Fact] [WorkItem(16947, "https://github.com/dotnet/roslyn/issues/16947")] public void Dynamic002() { @@ -2897,6 +2900,7 @@ public static ref dynamic F(ref dynamic d) ); } + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/21079")] [WorkItem(16947, "https://github.com/dotnet/roslyn/issues/16947")] public void Dynamic003() { diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenThrowTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenThrowTests.cs index 988fb733d6583..02c6882e386e4 100644 --- a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenThrowTests.cs +++ b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenThrowTests.cs @@ -81,6 +81,7 @@ .maxstack 1 "); } + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/21079")] public void TestRethrowImplicit() { var source = @" @@ -121,6 +122,7 @@ .maxstack 1 "); } + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/21079")] public void TestRethrowTyped() { var source = @" @@ -161,6 +163,7 @@ .maxstack 1 "); } + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/21079")] public void TestRethrowNamed() { var source = @" @@ -201,6 +204,7 @@ .maxstack 1 "); } + [Fact] public void TestRethrowModified() { var source = @" @@ -234,6 +238,7 @@ static void Main() CompileAndVerify(source, expectedOutput: "B"); } + [Fact] public void TestRethrowOverwritten() { var source = @" diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/SwitchTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/SwitchTests.cs index e30c763ea3178..331b3a6f73023 100644 --- a/src/Compilers/CSharp/Test/Emit/CodeGen/SwitchTests.cs +++ b/src/Compilers/CSharp/Test/Emit/CodeGen/SwitchTests.cs @@ -895,6 +895,7 @@ .maxstack 2 ); } + [Fact] public void DegenerateSwitch007() { var text = @"using System; diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/UnsafeTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/UnsafeTests.cs index 25ca448082087..8d62aeaaa885b 100644 --- a/src/Compilers/CSharp/Test/Emit/CodeGen/UnsafeTests.cs +++ b/src/Compilers/CSharp/Test/Emit/CodeGen/UnsafeTests.cs @@ -8493,6 +8493,7 @@ .locals init (pinned char*& V_0) "); } + [Fact] public void FixedBufferAndStatementWithFixedArrayElementAsInitializerExe() { var text = @" diff --git a/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/AssemblyReferencesTests.cs b/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/AssemblyReferencesTests.cs index 35a8f0474cb8e..66f628a61eca0 100644 --- a/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/AssemblyReferencesTests.cs +++ b/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/AssemblyReferencesTests.cs @@ -491,7 +491,7 @@ class C Diagnostic(ErrorCode.ERR_ModuleEmitFailure).WithArguments("C")); } - public void VerifyAssemblyReferences(AggregatedMetadataReader reader, string[] expected) + private void VerifyAssemblyReferences(AggregatedMetadataReader reader, string[] expected) { AssertEx.Equal(expected, reader.GetAssemblyReferences().Select(aref => $"{reader.GetString(aref.Name)}, {aref.Version}")); } diff --git a/src/Compilers/CSharp/Test/Emit/PDB/PDBTests.cs b/src/Compilers/CSharp/Test/Emit/PDB/PDBTests.cs index b1c2b445fe8dc..d902e87ef9bdd 100644 --- a/src/Compilers/CSharp/Test/Emit/PDB/PDBTests.cs +++ b/src/Compilers/CSharp/Test/Emit/PDB/PDBTests.cs @@ -6795,6 +6795,7 @@ static void M() #region Patterns + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/21079")] public void SyntaxOffset_Pattern() { var source = @"class C { bool F(object o) => o is int i && o is 3 && o is bool; }"; diff --git a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IArgument.cs b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IArgument.cs index 98566c48fdc33..6fc4cad506991 100644 --- a/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IArgument.cs +++ b/src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IArgument.cs @@ -136,6 +136,7 @@ static void M2(int x, double y = 0.0) { } VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics); } + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/21079")] public void NamedArgumentInParameterOrderWithDefaultValue() { string source = @" diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/SemanticErrorTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/SemanticErrorTests.cs index 4bcd5e51a133f..2f14a44e910b8 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/SemanticErrorTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/SemanticErrorTests.cs @@ -22445,6 +22445,7 @@ static void Main(string[] args) } [WorkItem(543473, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543473")] + [Fact] public void CS0815ERR_CannotAssignLambdaExpressionToAnImplicitlyTypedLocalVariable() { var text = diff --git a/src/Compilers/CSharp/Test/Syntax/LexicalAndXml/LexicalTests.cs b/src/Compilers/CSharp/Test/Syntax/LexicalAndXml/LexicalTests.cs index e23513446b583..c17be868533e7 100644 --- a/src/Compilers/CSharp/Test/Syntax/LexicalAndXml/LexicalTests.cs +++ b/src/Compilers/CSharp/Test/Syntax/LexicalAndXml/LexicalTests.cs @@ -1275,6 +1275,8 @@ public void TestNumericLiteralWithHugeNumberAndDecimal() Assert.Equal(value, token.Value); } + [Fact] + [Trait("Feature", "Literals")] public void TestNumericLiteralWithHugeNumberAndHugeDecimal() { var value = 12332434234234234234234234324234234234.45623423423423423423423423423423423423; diff --git a/src/Compilers/CSharp/Test/Syntax/Parsing/DeclarationParsingTests.cs b/src/Compilers/CSharp/Test/Syntax/Parsing/DeclarationParsingTests.cs index 361c3df5d9e92..b002af646f827 100644 --- a/src/Compilers/CSharp/Test/Syntax/Parsing/DeclarationParsingTests.cs +++ b/src/Compilers/CSharp/Test/Syntax/Parsing/DeclarationParsingTests.cs @@ -2013,7 +2013,7 @@ public void TestDelegateWithBuiltInReturnTypes() TestDelegateWithBuiltInReturnType(SyntaxKind.ObjectKeyword); } - public void TestDelegateWithBuiltInReturnType(SyntaxKind builtInType) + private void TestDelegateWithBuiltInReturnType(SyntaxKind builtInType) { var typeText = SyntaxFacts.GetText(builtInType); var text = "delegate " + typeText + " b();"; @@ -2059,7 +2059,7 @@ public void TestDelegateWithBuiltInParameterTypes() TestDelegateWithBuiltInParameterType(SyntaxKind.ObjectKeyword); } - public void TestDelegateWithBuiltInParameterType(SyntaxKind builtInType) + private void TestDelegateWithBuiltInParameterType(SyntaxKind builtInType) { var typeText = SyntaxFacts.GetText(builtInType); var text = "delegate a b(" + typeText + " c);"; @@ -2482,6 +2482,7 @@ public void TestClassMethodWithRefReturn() Assert.Equal(SyntaxKind.None, ms.SemicolonToken.Kind()); } + [Fact] public void TestClassMethodWithRef() { var text = "class a { ref }"; @@ -2876,7 +2877,7 @@ public void TestClassMethodWithBuiltInReturnTypes() TestClassMethodWithBuiltInReturnType(SyntaxKind.ObjectKeyword); } - public void TestClassMethodWithBuiltInReturnType(SyntaxKind type) + private void TestClassMethodWithBuiltInReturnType(SyntaxKind type) { var typeText = SyntaxFacts.GetText(type); var text = "class a { " + typeText + " M() { } }"; @@ -2941,7 +2942,7 @@ public void TestClassMethodWithBuiltInParameterTypes() TestClassMethodWithBuiltInParameterType(SyntaxKind.ObjectKeyword); } - public void TestClassMethodWithBuiltInParameterType(SyntaxKind type) + private void TestClassMethodWithBuiltInParameterType(SyntaxKind type) { var typeText = SyntaxFacts.GetText(type); var text = "class a { b X(" + typeText + " c) { } }"; @@ -3299,7 +3300,7 @@ public void TestClassFieldWithBuiltInTypes() TestClassFieldWithBuiltInType(SyntaxKind.ObjectKeyword); } - public void TestClassFieldWithBuiltInType(SyntaxKind type) + private void TestClassFieldWithBuiltInType(SyntaxKind type) { var typeText = SyntaxFacts.GetText(type); var text = "class a { " + typeText + " c; }"; @@ -3873,7 +3874,7 @@ public void TestClassPropertyWithBuiltInTypes() TestClassPropertyWithBuiltInType(SyntaxKind.ObjectKeyword); } - public void TestClassPropertyWithBuiltInType(SyntaxKind type) + private void TestClassPropertyWithBuiltInType(SyntaxKind type) { var typeText = SyntaxFacts.GetText(type); var text = "class a { " + typeText + " c { get; set; } }"; @@ -4065,7 +4066,7 @@ public void TestClassPropertyOrEventWithValue() TestClassEventWithValue(SyntaxKind.RemoveAccessorDeclaration, SyntaxKind.RemoveKeyword, SyntaxKind.IdentifierToken); } - public void TestClassPropertyWithValue(SyntaxKind accessorKind, SyntaxKind accessorKeyword, SyntaxKind tokenKind) + private void TestClassPropertyWithValue(SyntaxKind accessorKind, SyntaxKind accessorKeyword, SyntaxKind tokenKind) { bool isEvent = accessorKeyword == SyntaxKind.AddKeyword || accessorKeyword == SyntaxKind.RemoveKeyword; var text = "class a { " + (isEvent ? "event" : string.Empty) + " b c { " + SyntaxFacts.GetText(accessorKeyword) + " { x = value; } } }"; @@ -4122,7 +4123,7 @@ public void TestClassPropertyWithValue(SyntaxKind accessorKind, SyntaxKind acces Assert.Equal(tokenKind, ((IdentifierNameSyntax)bx.Right).Identifier.Kind()); } - public void TestClassEventWithValue(SyntaxKind accessorKind, SyntaxKind accessorKeyword, SyntaxKind tokenKind) + private void TestClassEventWithValue(SyntaxKind accessorKind, SyntaxKind accessorKeyword, SyntaxKind tokenKind) { var text = "class a { event b c { " + SyntaxFacts.GetText(accessorKeyword) + " { x = value; } } }"; var file = this.ParseFile(text); diff --git a/src/Compilers/CSharp/Test/Syntax/Parsing/ExpressionParsingTests.cs b/src/Compilers/CSharp/Test/Syntax/Parsing/ExpressionParsingTests.cs index 8b69d6dc85e53..6073aa5627820 100644 --- a/src/Compilers/CSharp/Test/Syntax/Parsing/ExpressionParsingTests.cs +++ b/src/Compilers/CSharp/Test/Syntax/Parsing/ExpressionParsingTests.cs @@ -1852,6 +1852,7 @@ public void TestFromOrderByDescendingSelect() Assert.Null(qs.Body.Continuation); } + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/21079")] public void TestFromGroupBy() { var text = "from a in A group b by c"; @@ -1891,6 +1892,7 @@ public void TestFromGroupBy() Assert.Null(qs.Body.Continuation); } + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/21079")] public void TestFromGroupByIntoSelect() { var text = "from a in A group b by c into d select e"; diff --git a/src/Compilers/CSharp/Test/Syntax/Parsing/ParserErrorMessageTests.cs b/src/Compilers/CSharp/Test/Syntax/Parsing/ParserErrorMessageTests.cs index 62c7989839cd1..14f8f85be92f8 100644 --- a/src/Compilers/CSharp/Test/Syntax/Parsing/ParserErrorMessageTests.cs +++ b/src/Compilers/CSharp/Test/Syntax/Parsing/ParserErrorMessageTests.cs @@ -4395,6 +4395,7 @@ void M() Diagnostic(ErrorCode.ERR_InvalidExprTerm, "stackalloc").WithArguments("stackalloc").WithLocation(6, 24)); } + [Fact] public void CS1674ERR_StackAllocInUsing1() { // Diff errors diff --git a/src/Compilers/CSharp/Test/Syntax/Parsing/ParserRegressionTests.cs b/src/Compilers/CSharp/Test/Syntax/Parsing/ParserRegressionTests.cs index 5bc95323fecf4..69412b21d929c 100644 --- a/src/Compilers/CSharp/Test/Syntax/Parsing/ParserRegressionTests.cs +++ b/src/Compilers/CSharp/Test/Syntax/Parsing/ParserRegressionTests.cs @@ -169,7 +169,7 @@ public void LexerTooManyBadTokens_LongUnicode() #region "Helpers" - public static void ParseAndValidate(string text, params DiagnosticDescription[] expectedErrors) + private static void ParseAndValidate(string text, params DiagnosticDescription[] expectedErrors) { var parsedTree = ParseWithRoundTripCheck(text); var actualErrors = parsedTree.GetDiagnostics(); diff --git a/src/Compilers/CSharp/Test/Syntax/Parsing/RoundTrippingTests.cs b/src/Compilers/CSharp/Test/Syntax/Parsing/RoundTrippingTests.cs index c3e6f585288fd..b25c87a152a56 100644 --- a/src/Compilers/CSharp/Test/Syntax/Parsing/RoundTrippingTests.cs +++ b/src/Compilers/CSharp/Test/Syntax/Parsing/RoundTrippingTests.cs @@ -46,7 +46,7 @@ internal static void ParseAndRoundTripping(string text, CSharpParseOptions optio ParentChecker.CheckParents(tree.GetCompilationUnitRoot(), tree); } - public static void ParseAndCheckTerminalSpans(string text) + private static void ParseAndCheckTerminalSpans(string text) { var tree = SyntaxFactory.ParseSyntaxTree(text); var toText = tree.GetCompilationUnitRoot().ToFullString(); diff --git a/src/Compilers/CSharp/Test/Syntax/Parsing/ScriptParsingTests.cs b/src/Compilers/CSharp/Test/Syntax/Parsing/ScriptParsingTests.cs index 1962fb17cb584..965f9c0b32d55 100644 --- a/src/Compilers/CSharp/Test/Syntax/Parsing/ScriptParsingTests.cs +++ b/src/Compilers/CSharp/Test/Syntax/Parsing/ScriptParsingTests.cs @@ -21,12 +21,12 @@ protected override SyntaxTree ParseTree(string text, CSharpParseOptions options) return SyntaxFactory.ParseSyntaxTree(text, options: options ?? TestOptions.Script); } - public void ParseAndValidate(string text, params ErrorDescription[] errors) + private void ParseAndValidate(string text, params ErrorDescription[] errors) { ParseAndValidate(text, null, errors); } - public SyntaxTree ParseAndValidate(string text, CSharpParseOptions options, params ErrorDescription[] errors) + private SyntaxTree ParseAndValidate(string text, CSharpParseOptions options, params ErrorDescription[] errors) { var parsedTree = ParseTree(text, options); var parsedText = parsedTree.GetCompilationUnitRoot(); diff --git a/src/Compilers/CSharp/Test/Syntax/Parsing/StatementParsingTests.cs b/src/Compilers/CSharp/Test/Syntax/Parsing/StatementParsingTests.cs index b695a369406e8..8c5ef0c4acc52 100644 --- a/src/Compilers/CSharp/Test/Syntax/Parsing/StatementParsingTests.cs +++ b/src/Compilers/CSharp/Test/Syntax/Parsing/StatementParsingTests.cs @@ -263,6 +263,7 @@ public void TestLocalDeclarationStatementWithTuple() Assert.False(ds.SemicolonToken.IsMissing); } + [Fact] public void TestLocalDeclarationStatementWithNamedTuple() { var text = "(T x, (U k, V l, W m) y) a;"; diff --git a/src/Compilers/Core/CodeAnalysisTest/Collections/ArrayBuilderTests.cs b/src/Compilers/Core/CodeAnalysisTest/Collections/ArrayBuilderTests.cs index 61bbb4dd38446..8a4139d26ca90 100644 --- a/src/Compilers/Core/CodeAnalysisTest/Collections/ArrayBuilderTests.cs +++ b/src/Compilers/Core/CodeAnalysisTest/Collections/ArrayBuilderTests.cs @@ -6,7 +6,7 @@ namespace Microsoft.CodeAnalysis.UnitTests.Collections { - internal class ArrayBuilderTests + public class ArrayBuilderTests { [Fact] public void RemoveDuplicates1() diff --git a/src/EditorFeatures/CSharpTest/AutomaticCompletion/AutomaticLiteralCompletionTests.cs b/src/EditorFeatures/CSharpTest/AutomaticCompletion/AutomaticLiteralCompletionTests.cs index 1b0f2695b650c..8ffc46808e573 100644 --- a/src/EditorFeatures/CSharpTest/AutomaticCompletion/AutomaticLiteralCompletionTests.cs +++ b/src/EditorFeatures/CSharpTest/AutomaticCompletion/AutomaticLiteralCompletionTests.cs @@ -423,6 +423,7 @@ void Method() } } + [WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)] public void Preprocessor2() { var code = @"class C @@ -440,6 +441,7 @@ void Method() } } + [WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)] public void Preprocessor3() { var code = @"class C diff --git a/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/OverrideCompletionProviderTests.cs b/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/OverrideCompletionProviderTests.cs index b0f284bff7a59..64e50ee9815f6 100644 --- a/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/OverrideCompletionProviderTests.cs +++ b/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/OverrideCompletionProviderTests.cs @@ -2602,6 +2602,7 @@ public override int foo } [WorkItem(8257, "https://github.com/dotnet/roslyn/issues/8257")] + [WpfFact, Trait(Traits.Feature, Traits.Features.Completion)] public async Task NotImplementedQualifiedWhenSystemUsingNotPresent_Method() { var markupBeforeCommit = @"abstract class C diff --git a/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/SnippetCompletionProviderTests.cs b/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/SnippetCompletionProviderTests.cs index 8228c4eae1b0c..9d96987532c46 100644 --- a/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/SnippetCompletionProviderTests.cs +++ b/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/SnippetCompletionProviderTests.cs @@ -29,6 +29,7 @@ public async Task SnippetsInEmptyFile() await VerifyItemExistsAsync(@"$$", MockSnippetInfoService.SnippetShortcut, sourceCodeKind: SourceCodeKind.Regular); } + [Fact, Trait(Traits.Feature, Traits.Features.Completion)] public async Task SnippetDescriptions() { await VerifyItemExistsAsync(@"$$", MockSnippetInfoService.SnippetShortcut, MockSnippetInfoService.SnippetTitle + Environment.NewLine + MockSnippetInfoService.SnippetDescription, SourceCodeKind.Regular); diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/GenerateEnumMember/GenerateEnumMemberTests.cs b/src/EditorFeatures/CSharpTest/Diagnostics/GenerateEnumMember/GenerateEnumMemberTests.cs index c50c782734259..237103c88d0eb 100644 --- a/src/EditorFeatures/CSharpTest/Diagnostics/GenerateEnumMember/GenerateEnumMemberTests.cs +++ b/src/EditorFeatures/CSharpTest/Diagnostics/GenerateEnumMember/GenerateEnumMemberTests.cs @@ -334,7 +334,7 @@ enum Color }"); } - [Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)] + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEnumMember)] public async Task TestWithNonZeroInteger() { await TestInRegularAndScriptAsync( diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/NamingStyles/NamingStylesTests.cs b/src/EditorFeatures/CSharpTest/Diagnostics/NamingStyles/NamingStylesTests.cs index 4c8f91378ff53..b8aac80d4420f 100644 --- a/src/EditorFeatures/CSharpTest/Diagnostics/NamingStyles/NamingStylesTests.cs +++ b/src/EditorFeatures/CSharpTest/Diagnostics/NamingStyles/NamingStylesTests.cs @@ -322,6 +322,7 @@ internal interface ", new TestParameters(options: InterfaceNamesStartWithI)); } + [Fact, Trait(Traits.Feature, Traits.Features.NamingStyle)] [WorkItem(16562, "https://github.com/dotnet/roslyn/issues/16562")] public async Task TestRefactorNotify() { diff --git a/src/EditorFeatures/CSharpTest/Formatting/FormattingEngineTests.cs b/src/EditorFeatures/CSharpTest/Formatting/FormattingEngineTests.cs index 3e9574fabbe31..39969e0de834f 100644 --- a/src/EditorFeatures/CSharpTest/Formatting/FormattingEngineTests.cs +++ b/src/EditorFeatures/CSharpTest/Formatting/FormattingEngineTests.cs @@ -1591,7 +1591,7 @@ void M() } [WorkItem(7900, "https://github.com/dotnet/roslyn/issues/7900")] - [Trait(Traits.Feature, Traits.Features.Formatting)] + [WpfFact, Trait(Traits.Feature, Traits.Features.Formatting)] public void FormatLockStatementWithEmbeddedStatementOnSemicolonDifferentLine() { var code = @"class C @@ -1616,7 +1616,7 @@ public void M() } [WorkItem(7900, "https://github.com/dotnet/roslyn/issues/7900")] - [Trait(Traits.Feature, Traits.Features.Formatting)] + [WpfFact, Trait(Traits.Feature, Traits.Features.Formatting)] public void FormatLockStatementWithEmbeddedStatementOnSemicolonSameLine() { var code = @"class C diff --git a/src/EditorFeatures/Test/CodeFixes/CodeFixServiceTests.cs b/src/EditorFeatures/Test/CodeFixes/CodeFixServiceTests.cs index 1589de167f77a..c0ef2f0c25b23 100644 --- a/src/EditorFeatures/Test/CodeFixes/CodeFixServiceTests.cs +++ b/src/EditorFeatures/Test/CodeFixes/CodeFixServiceTests.cs @@ -91,7 +91,7 @@ public async Task TestGetCodeFixWithExceptionInGetFixAllProvider() await GetAddedFixesAsync(new ErrorCases.ExceptionInGetFixAllProvider()); } - public async Task GetDefaultFixesAsync(CodeFixProvider codefix) + private async Task GetDefaultFixesAsync(CodeFixProvider codefix) { var tuple = ServiceSetup(codefix); using (var workspace = tuple.Item1) @@ -103,7 +103,7 @@ public async Task GetDefaultFixesAsync(CodeFixProvider codefix) } } - public async Task GetAddedFixesAsync(CodeFixProvider codefix) + private async Task GetAddedFixesAsync(CodeFixProvider codefix) { var tuple = ServiceSetup(codefix); using (var workspace = tuple.Item1) @@ -121,7 +121,7 @@ public async Task GetAddedFixesAsync(CodeFixProvider codefix) } } - public async Task GetFirstDiagnosticWithFixAsync(CodeFixProvider codefix) + private async Task GetFirstDiagnosticWithFixAsync(CodeFixProvider codefix) { var tuple = ServiceSetup(codefix); using (var workspace = tuple.Item1) diff --git a/src/EditorFeatures/Test/CodeRefactorings/CodeRefactoringServiceTest.cs b/src/EditorFeatures/Test/CodeRefactorings/CodeRefactoringServiceTest.cs index a8d90c055b26d..6537436a7b6a9 100644 --- a/src/EditorFeatures/Test/CodeRefactorings/CodeRefactoringServiceTest.cs +++ b/src/EditorFeatures/Test/CodeRefactorings/CodeRefactoringServiceTest.cs @@ -31,7 +31,7 @@ public async Task TestExceptionInComputeRefactoringsAsync() await VerifyRefactoringDisabledAsync(new ErrorCases.ExceptionInComputeRefactoringsAsync()); } - public async Task VerifyRefactoringDisabledAsync(CodeRefactoringProvider codeRefactoring) + private async Task VerifyRefactoringDisabledAsync(CodeRefactoringProvider codeRefactoring) { var refactoringService = new CodeRefactorings.CodeRefactoringService(GetMetadata(codeRefactoring)); using (var workspace = TestWorkspace.CreateCSharp(@"class Program {}")) diff --git a/src/EditorFeatures/Test/SolutionCrawler/WorkCoordinatorTests.cs b/src/EditorFeatures/Test/SolutionCrawler/WorkCoordinatorTests.cs index 23743196c7896..69fa8bb8ecace 100644 --- a/src/EditorFeatures/Test/SolutionCrawler/WorkCoordinatorTests.cs +++ b/src/EditorFeatures/Test/SolutionCrawler/WorkCoordinatorTests.cs @@ -382,7 +382,7 @@ public async Task Document_Reanalyze() } } - [WorkItem(670335, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/670335")] + [Fact, WorkItem(670335, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/670335")] public async Task Document_Change() { using (var workspace = new WorkCoordinatorWorkspace(SolutionCrawler)) @@ -427,7 +427,7 @@ public async Task Document_AdditionalFileChange() } } - [WorkItem(670335, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/670335")] + [Fact, WorkItem(670335, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/670335")] public async Task Document_Cancellation() { using (var workspace = new WorkCoordinatorWorkspace(SolutionCrawler)) @@ -457,7 +457,7 @@ public async Task Document_Cancellation() } } - [WorkItem(670335, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/670335")] + [Fact, WorkItem(670335, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/670335")] public async Task Document_Cancellation_MultipleTimes() { using (var workspace = new WorkCoordinatorWorkspace(SolutionCrawler)) @@ -491,7 +491,7 @@ public async Task Document_Cancellation_MultipleTimes() } } - [WorkItem(670335, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/670335")] + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/21082"), WorkItem(670335, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/670335")] public async Task Document_InvocationReasons() { using (var workspace = new WorkCoordinatorWorkspace(SolutionCrawler)) diff --git a/src/ExpressionEvaluator/CSharp/Test/ResultProvider/AccessibilityTests.cs b/src/ExpressionEvaluator/CSharp/Test/ResultProvider/AccessibilityTests.cs index a0e755d4764be..a1433dd28c538 100644 --- a/src/ExpressionEvaluator/CSharp/Test/ResultProvider/AccessibilityTests.cs +++ b/src/ExpressionEvaluator/CSharp/Test/ResultProvider/AccessibilityTests.cs @@ -12,10 +12,10 @@ namespace Microsoft.CodeAnalysis.CSharp.ExpressionEvaluator.UnitTests { - internal class AccessibilityTests : CSharpResultProviderTestBase + public class AccessibilityTests : CSharpResultProviderTestBase { [WorkItem(889710, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/889710")] - [Fact] + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/21084")] public void HideNonPublicMembersBaseClass() { var sourceA = @@ -176,7 +176,7 @@ class C } [WorkItem(889710, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/889710")] - [Fact] + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/21084")] public void HideNonPublicMembersDerivedClass() { var sourceA = diff --git a/src/Interactive/HostTest/InteractiveHostTests.cs b/src/Interactive/HostTest/InteractiveHostTests.cs index f62cd67874d4e..0144189703881 100644 --- a/src/Interactive/HostTest/InteractiveHostTests.cs +++ b/src/Interactive/HostTest/InteractiveHostTests.cs @@ -118,14 +118,14 @@ public string ReadErrorOutputToEnd() return ReadOutputToEnd(isError: true); } - public void ClearOutput() + private void ClearOutput() { _outputReadPosition = new int[] { 0, 0 }; _synchronizedOutput.Clear(); _synchronizedErrorOutput.Clear(); } - public void RestartHost(string rspFile = null) + private void RestartHost(string rspFile = null) { ClearOutput(); diff --git a/src/Scripting/CSharpTest/ObjectFormatterTests.cs b/src/Scripting/CSharpTest/ObjectFormatterTests.cs index d039a0cd075ab..d37df5cc7074a 100644 --- a/src/Scripting/CSharpTest/ObjectFormatterTests.cs +++ b/src/Scripting/CSharpTest/ObjectFormatterTests.cs @@ -708,7 +708,7 @@ public void DebuggerProxy_FrameworkTypes_Lazy() ); } - public void TaskMethod() + private void TaskMethod() { } diff --git a/src/VisualStudio/CSharp/Test/Debugging/ProximityExpressionsGetterTests.cs b/src/VisualStudio/CSharp/Test/Debugging/ProximityExpressionsGetterTests.cs index 39743daf53cdb..c1ee697c888f3 100644 --- a/src/VisualStudio/CSharp/Test/Debugging/ProximityExpressionsGetterTests.cs +++ b/src/VisualStudio/CSharp/Test/Debugging/ProximityExpressionsGetterTests.cs @@ -32,7 +32,7 @@ private SyntaxTree GetTreeFromCode(string code) return SyntaxFactory.ParseSyntaxTree(code); } - public async Task GenerateBaseline() + private async Task GenerateBaseline() { Console.WriteLine(typeof(FactAttribute)); diff --git a/src/VisualStudio/CSharp/Test/Interactive/Commands/InteractiveCommandHandlerTests.cs b/src/VisualStudio/CSharp/Test/Interactive/Commands/InteractiveCommandHandlerTests.cs index a8d282e336541..0756436b64cd0 100644 --- a/src/VisualStudio/CSharp/Test/Interactive/Commands/InteractiveCommandHandlerTests.cs +++ b/src/VisualStudio/CSharp/Test/Interactive/Commands/InteractiveCommandHandlerTests.cs @@ -7,7 +7,7 @@ namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Interactive.Commands { - internal class InteractiveCommandHandlerTests + public class InteractiveCommandHandlerTests { private const string Caret = "$$"; private const string ExampleCode1 = @"var x = 1;"; diff --git a/src/VisualStudio/Core/Test.Next/Services/ServiceHubServicesTests.cs b/src/VisualStudio/Core/Test.Next/Services/ServiceHubServicesTests.cs index 21d1160c76101..d6fee8998a02a 100644 --- a/src/VisualStudio/Core/Test.Next/Services/ServiceHubServicesTests.cs +++ b/src/VisualStudio/Core/Test.Next/Services/ServiceHubServicesTests.cs @@ -400,7 +400,7 @@ private static RemoteHostService CreateService() return new RemoteHostService(stream, new InProcRemoteHostClient.ServiceProvider(runCacheCleanup: false)); } - public static void SetEqual(IEnumerable expected, IEnumerable actual) + private static void SetEqual(IEnumerable expected, IEnumerable actual) { var expectedSet = new HashSet(expected); var result = expected.Count() == actual.Count() && expectedSet.SetEquals(actual); diff --git a/src/Workspaces/CoreTest/LinkedFileDiffMerging/LinkedFileDiffMergingTests.cs b/src/Workspaces/CoreTest/LinkedFileDiffMerging/LinkedFileDiffMergingTests.cs index 011fc22bfab6e..72f3820dfcd98 100644 --- a/src/Workspaces/CoreTest/LinkedFileDiffMerging/LinkedFileDiffMergingTests.cs +++ b/src/Workspaces/CoreTest/LinkedFileDiffMerging/LinkedFileDiffMergingTests.cs @@ -8,7 +8,7 @@ namespace Microsoft.CodeAnalysis.UnitTests.LinkedFileDiffMerging { public partial class LinkedFileDiffMergingTests { - public void TestLinkedFileSet(string startText, List updatedTexts, string expectedMergedText, string languageName) + private void TestLinkedFileSet(string startText, List updatedTexts, string expectedMergedText, string languageName) { using (var workspace = new AdhocWorkspace()) { diff --git a/src/Workspaces/CoreTest/SolutionTests/SolutionTests.cs b/src/Workspaces/CoreTest/SolutionTests/SolutionTests.cs index f74a83a387562..b5a08bb3ec8ee 100644 --- a/src/Workspaces/CoreTest/SolutionTests/SolutionTests.cs +++ b/src/Workspaces/CoreTest/SolutionTests/SolutionTests.cs @@ -1116,6 +1116,7 @@ public void TestLoadProjectFromCommandLine() Assert.Equal(@"C:\ProjectDirectory\subdir\bar.cs", barDoc.FilePath); } + [Fact, Trait(Traits.Feature, Traits.Features.Workspace)] public void TestCommandLineProjectWithRelativePathOutsideProjectCone() { string commandLine = @"..\foo.cs"; diff --git a/src/Workspaces/CoreTest/UtilityTest/EditDistanceTests.cs b/src/Workspaces/CoreTest/UtilityTest/EditDistanceTests.cs index c5c9f189d7c78..63cce4fa84724 100644 --- a/src/Workspaces/CoreTest/UtilityTest/EditDistanceTests.cs +++ b/src/Workspaces/CoreTest/UtilityTest/EditDistanceTests.cs @@ -77,6 +77,7 @@ public void EditDistance4() VerifyEditDistance("XlmReade", "XmlReader", 2); } + [Fact] public void EditDistance5() { VerifyEditDistance("Zeil", "trials", 4); diff --git a/src/Workspaces/CoreTest/WorkspaceServiceTests/TemporaryStorageServiceTests.cs b/src/Workspaces/CoreTest/WorkspaceServiceTests/TemporaryStorageServiceTests.cs index 83cb2b5247124..643e76e12d63a 100644 --- a/src/Workspaces/CoreTest/WorkspaceServiceTests/TemporaryStorageServiceTests.cs +++ b/src/Workspaces/CoreTest/WorkspaceServiceTests/TemporaryStorageServiceTests.cs @@ -177,7 +177,7 @@ public void TestTemporaryStorageMemoryMappedFileManagement() // We want to keep this test around, but not have it disabled/associated with a bug // [Fact, Trait(Traits.Feature, Traits.Features.Workspace)] - public void TestTemporaryStorageScaling() + private void TestTemporaryStorageScaling() { // This will churn through 4GB of memory. It validates that we don't // use up our address space in a 32 bit process. diff --git a/src/Workspaces/CoreTest/WorkspaceTests/AdhocWorkspaceTests.cs b/src/Workspaces/CoreTest/WorkspaceTests/AdhocWorkspaceTests.cs index 5caeabc7b6061..55d5473bf1881 100644 --- a/src/Workspaces/CoreTest/WorkspaceTests/AdhocWorkspaceTests.cs +++ b/src/Workspaces/CoreTest/WorkspaceTests/AdhocWorkspaceTests.cs @@ -417,7 +417,7 @@ public async Task TestUpdatedDocumentTextIsObservablyConstantAsync() await CheckUpdatedDocumentTextIsObservablyConstantAsync(CreateWorkspaceWithRecoverableTrees()); } - public async Task CheckUpdatedDocumentTextIsObservablyConstantAsync(AdhocWorkspace ws) + private async Task CheckUpdatedDocumentTextIsObservablyConstantAsync(AdhocWorkspace ws) { var pid = ProjectId.CreateNewId(); var text = SourceText.From("public class C { }"); From 482bd26568f68260c1c6f707b8c0cae757ca6ad4 Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Tue, 11 Jul 2017 17:34:53 -0700 Subject: [PATCH 009/205] Disable xUnit1013 in one file where it doesn't make sense Right now this code is doing a pattern where it overrides the public methods in derived types, and those have facts. That forces the base type to also be public, but we can't put Facts there. This can be cleaned up in a better way, but I want to keep this first round of changes as mechanical as possible. --- .../IntegrationTest/IntegrationTests/Workspace/WorkspaceBase.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/VisualStudio/IntegrationTest/IntegrationTests/Workspace/WorkspaceBase.cs b/src/VisualStudio/IntegrationTest/IntegrationTests/Workspace/WorkspaceBase.cs index 0e256cb38070a..dcdc52963be7a 100644 --- a/src/VisualStudio/IntegrationTest/IntegrationTests/Workspace/WorkspaceBase.cs +++ b/src/VisualStudio/IntegrationTest/IntegrationTests/Workspace/WorkspaceBase.cs @@ -5,6 +5,8 @@ using Xunit; using ProjectUtils = Microsoft.VisualStudio.IntegrationTest.Utilities.Common.ProjectUtils; +#pragma warning disable xUnit1013 // currently there are public virtual methods that are overridden by derived types + namespace Roslyn.VisualStudio.IntegrationTests.Workspace { public abstract class WorkspaceBase : AbstractEditorTest From a349d82a5708d7a64387a8e2def3a6e55b66180d Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Tue, 11 Jul 2017 17:35:09 -0700 Subject: [PATCH 010/205] Ensure the parameter and InlineData types line up --- src/EditorFeatures/Test/Utilities/PatternMatcherTests.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/EditorFeatures/Test/Utilities/PatternMatcherTests.cs b/src/EditorFeatures/Test/Utilities/PatternMatcherTests.cs index 408275013e4ec..d03bdb51e8c15 100644 --- a/src/EditorFeatures/Test/Utilities/PatternMatcherTests.cs +++ b/src/EditorFeatures/Test/Utilities/PatternMatcherTests.cs @@ -237,13 +237,13 @@ private void VerifyBreakIntoCharacterParts(string original, params string[] part [InlineData("my[|_b|]utton", "_B", PatternMatchKind.CamelCaseSubstring, CaseInsensitive)] [InlineData("[|_|]my_[|b|]utton", "_B", PatternMatchKind.CamelCaseNonContiguousPrefix, CaseInsensitive)] - public void TestNonFuzzyMatch( - string candidate, string pattern, int matchKindInt, bool isCaseSensitive) + // Test is internal as PatternMatchKind is internal, but this is still ran. + internal void TestNonFuzzyMatch( + string candidate, string pattern, PatternMatchKind matchKind, bool isCaseSensitive) { var match = TestNonFuzzyMatch(candidate, pattern); Assert.NotNull(match); - var matchKind = (PatternMatchKind)matchKindInt; Assert.Equal(matchKind, match.Value.Kind); Assert.Equal(isCaseSensitive, match.Value.IsCaseSensitive); } From 811c8ed3ee2d65c36fe4ac480f28bf8892e0ac14 Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Mon, 24 Jul 2017 14:20:30 -0700 Subject: [PATCH 011/205] Remove duplicate implementation of IDisposable This works around https://github.com/xunit/xunit/issues/1379 --- src/Interactive/HostTest/StressTests.cs | 2 +- .../CoreTest.Desktop/MetadataShadowCopyProviderTests.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Interactive/HostTest/StressTests.cs b/src/Interactive/HostTest/StressTests.cs index 7aa6cde4e12e5..4f0a109e84bd3 100644 --- a/src/Interactive/HostTest/StressTests.cs +++ b/src/Interactive/HostTest/StressTests.cs @@ -10,7 +10,7 @@ namespace Microsoft.CodeAnalysis.UnitTests.Interactive { - public sealed class StressTests : AbstractInteractiveHostTests, IDisposable + public sealed class StressTests : AbstractInteractiveHostTests { private readonly List _processes = new List(); private readonly List _threads = new List(); diff --git a/src/Scripting/CoreTest.Desktop/MetadataShadowCopyProviderTests.cs b/src/Scripting/CoreTest.Desktop/MetadataShadowCopyProviderTests.cs index 33fcd6ba41da2..7488ce7462d59 100644 --- a/src/Scripting/CoreTest.Desktop/MetadataShadowCopyProviderTests.cs +++ b/src/Scripting/CoreTest.Desktop/MetadataShadowCopyProviderTests.cs @@ -16,7 +16,7 @@ namespace Microsoft.CodeAnalysis.Scripting.Hosting.UnitTests { // TODO: clean up and move to portable tests - public class MetadataShadowCopyProviderTests : TestBase, IDisposable + public class MetadataShadowCopyProviderTests : TestBase { private readonly MetadataShadowCopyProvider _provider; From 2f4307884f600f377ff5aa69a39cea47f780880c Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Tue, 11 Jul 2017 15:59:05 -0700 Subject: [PATCH 012/205] Add xunit.analyzers to all of our unit test projects --- build/Rulesets/Roslyn_BuildRules.ruleset | 11 +++++++++++ build/Targets/Packages.props | 1 + build/ToolsetPackages/BaseToolset.csproj | 1 + .../CSharp/Tests/CSharpCodeStyleTests.csproj | 3 ++- src/CodeStyle/Core/Tests/CodeStyleTests.csproj | 3 ++- .../VisualBasic/Tests/BasicCodeStyleTests.vbproj | 1 + .../Test/CommandLine/CSharpCommandLineTest.csproj | 3 ++- .../CSharp/Test/Emit/CSharpCompilerEmitTest.csproj | 3 ++- .../Test/Semantic/CSharpCompilerSemanticTest.csproj | 3 ++- .../Test/Symbol/CSharpCompilerSymbolTest.csproj | 3 ++- .../CSharp/Test/WinRT/CSharpWinRTTest.csproj | 3 ++- .../Core/CodeAnalysisTest/CodeAnalysisTest.csproj | 3 ++- .../Core/MSBuildTaskTests/MSBuildTaskTests.csproj | 3 ++- .../Server/VBCSCompilerTests/VBCSCompilerTests.csproj | 3 ++- .../Test/CommandLine/BasicCommandLineTest.vbproj | 3 ++- .../Test/Emit/BasicCompilerEmitTest.vbproj | 3 ++- .../Test/Semantic/BasicCompilerSemanticTest.vbproj | 3 ++- .../Test/Symbol/BasicCompilerSymbolTest.vbproj | 3 ++- .../Test/Syntax/BasicCompilerSyntaxTest.vbproj | 3 ++- .../TestUtilities/ServicesTestUtilities.csproj | 3 ++- .../CSharpExpressionCompilerTest.csproj | 3 ++- .../ResultProvider/CSharpResultProviderTest.csproj | 3 ++- .../ExpressionCompilerTestUtilities.csproj | 3 ++- .../Test/FunctionResolver/FunctionResolverTest.csproj | 3 ++- .../ResultProvider/ResultProviderTestUtilities.csproj | 1 + .../BasicExpressionCompilerTest.vbproj | 3 ++- .../ResultProvider/BasicResultProviderTest.vbproj | 3 ++- .../APISampleUnitTests/APISampleUnitTestsCS.csproj | 3 ++- .../Test/ConvertToConditionalCS.UnitTests.csproj | 3 ++- .../ImplementNotifyPropertyChangedCS.UnitTests.csproj | 3 ++- .../Shared/UnitTestFramework/UnitTestFramework.csproj | 3 ++- .../APISampleUnitTests/APISampleUnitTestsVB.vbproj | 3 ++- .../Test/ConvertToAutoPropertyVB.UnitTests.vbproj | 3 ++- .../ImplementNotifyPropertyChangedVB.UnitTests.vbproj | 3 ++- .../RemoveByVal/Test/RemoveByValVB.UnitTests.vbproj | 3 ++- .../CoreTest.Desktop/ScriptingTest.Desktop.csproj | 3 ++- .../CoreTestUtilities/ScriptingTestUtilities.csproj | 3 ++- .../BasicScriptingTest.Desktop.vbproj | 3 ++- .../Utilities/CoreClr/TestUtilities.CoreClr.csproj | 3 ++- .../Utilities/Desktop/TestUtilities.Desktop.csproj | 3 ++- src/Test/Utilities/Portable/TestUtilities.csproj | 3 ++- .../VisualStudioIntegrationTests.csproj | 3 ++- src/Workspaces/CSharpTest/CSharpServicesTest.csproj | 3 ++- src/Workspaces/CoreTest/ServicesTest.csproj | 3 ++- .../CoreTestUtilities/WorkspacesTestUtilities.csproj | 3 ++- .../VisualBasicTest/VisualBasicServicesTest.vbproj | 3 ++- 46 files changed, 97 insertions(+), 41 deletions(-) diff --git a/build/Rulesets/Roslyn_BuildRules.ruleset b/build/Rulesets/Roslyn_BuildRules.ruleset index f21cb00345ccd..497d6e1bb8d76 100644 --- a/build/Rulesets/Roslyn_BuildRules.ruleset +++ b/build/Rulesets/Roslyn_BuildRules.ruleset @@ -126,4 +126,15 @@ + + + + + + + + + + + diff --git a/build/Targets/Packages.props b/build/Targets/Packages.props index 653d276df49dc..74f0d8ab68327 100644 --- a/build/Targets/Packages.props +++ b/build/Targets/Packages.props @@ -224,6 +224,7 @@ 8.0.0.0-alpha 1.0.71 2.2.0-beta4-build3444 + 0.5.0 2.2.0-beta4-build3444 1.0.2-prerelease-00104 2.2.0-beta4-build3444 diff --git a/build/ToolsetPackages/BaseToolset.csproj b/build/ToolsetPackages/BaseToolset.csproj index d5e60f94eebb2..9872d0a6af949 100644 --- a/build/ToolsetPackages/BaseToolset.csproj +++ b/build/ToolsetPackages/BaseToolset.csproj @@ -17,6 +17,7 @@ + diff --git a/src/CodeStyle/CSharp/Tests/CSharpCodeStyleTests.csproj b/src/CodeStyle/CSharp/Tests/CSharpCodeStyleTests.csproj index 6f3d9b1addd9c..57c2d6a9511b5 100644 --- a/src/CodeStyle/CSharp/Tests/CSharpCodeStyleTests.csproj +++ b/src/CodeStyle/CSharp/Tests/CSharpCodeStyleTests.csproj @@ -26,7 +26,8 @@ + - \ No newline at end of file + diff --git a/src/CodeStyle/Core/Tests/CodeStyleTests.csproj b/src/CodeStyle/Core/Tests/CodeStyleTests.csproj index 1a61ff8516a17..4785cd2d0da7b 100644 --- a/src/CodeStyle/Core/Tests/CodeStyleTests.csproj +++ b/src/CodeStyle/Core/Tests/CodeStyleTests.csproj @@ -26,7 +26,8 @@ + - \ No newline at end of file + diff --git a/src/CodeStyle/VisualBasic/Tests/BasicCodeStyleTests.vbproj b/src/CodeStyle/VisualBasic/Tests/BasicCodeStyleTests.vbproj index 161b94cf4d4e1..7f5235aa6d2d6 100644 --- a/src/CodeStyle/VisualBasic/Tests/BasicCodeStyleTests.vbproj +++ b/src/CodeStyle/VisualBasic/Tests/BasicCodeStyleTests.vbproj @@ -25,6 +25,7 @@ + diff --git a/src/Compilers/CSharp/Test/CommandLine/CSharpCommandLineTest.csproj b/src/Compilers/CSharp/Test/CommandLine/CSharpCommandLineTest.csproj index 4a524ddb0b97c..1485927750c5a 100644 --- a/src/Compilers/CSharp/Test/CommandLine/CSharpCommandLineTest.csproj +++ b/src/Compilers/CSharp/Test/CommandLine/CSharpCommandLineTest.csproj @@ -35,6 +35,7 @@ + @@ -59,4 +60,4 @@ - \ No newline at end of file + diff --git a/src/Compilers/CSharp/Test/Emit/CSharpCompilerEmitTest.csproj b/src/Compilers/CSharp/Test/Emit/CSharpCompilerEmitTest.csproj index 508337f78854a..4bde35a4129e6 100644 --- a/src/Compilers/CSharp/Test/Emit/CSharpCompilerEmitTest.csproj +++ b/src/Compilers/CSharp/Test/Emit/CSharpCompilerEmitTest.csproj @@ -47,6 +47,7 @@ + @@ -60,4 +61,4 @@ - \ No newline at end of file + diff --git a/src/Compilers/CSharp/Test/Semantic/CSharpCompilerSemanticTest.csproj b/src/Compilers/CSharp/Test/Semantic/CSharpCompilerSemanticTest.csproj index 94f456d018d05..92e1cd0be1079 100644 --- a/src/Compilers/CSharp/Test/Semantic/CSharpCompilerSemanticTest.csproj +++ b/src/Compilers/CSharp/Test/Semantic/CSharpCompilerSemanticTest.csproj @@ -32,10 +32,11 @@ + - \ No newline at end of file + diff --git a/src/Compilers/CSharp/Test/Symbol/CSharpCompilerSymbolTest.csproj b/src/Compilers/CSharp/Test/Symbol/CSharpCompilerSymbolTest.csproj index c43628180a0e6..ab202486b9147 100644 --- a/src/Compilers/CSharp/Test/Symbol/CSharpCompilerSymbolTest.csproj +++ b/src/Compilers/CSharp/Test/Symbol/CSharpCompilerSymbolTest.csproj @@ -31,7 +31,8 @@ + - \ No newline at end of file + diff --git a/src/Compilers/CSharp/Test/WinRT/CSharpWinRTTest.csproj b/src/Compilers/CSharp/Test/WinRT/CSharpWinRTTest.csproj index 37b0a2c7855cf..5f7086f6f647a 100644 --- a/src/Compilers/CSharp/Test/WinRT/CSharpWinRTTest.csproj +++ b/src/Compilers/CSharp/Test/WinRT/CSharpWinRTTest.csproj @@ -29,10 +29,11 @@ + - \ No newline at end of file + diff --git a/src/Compilers/Core/CodeAnalysisTest/CodeAnalysisTest.csproj b/src/Compilers/Core/CodeAnalysisTest/CodeAnalysisTest.csproj index 0fd32b4eed873..cc070e00865dc 100644 --- a/src/Compilers/Core/CodeAnalysisTest/CodeAnalysisTest.csproj +++ b/src/Compilers/Core/CodeAnalysisTest/CodeAnalysisTest.csproj @@ -36,6 +36,7 @@ + @@ -63,4 +64,4 @@ - \ No newline at end of file + diff --git a/src/Compilers/Core/MSBuildTaskTests/MSBuildTaskTests.csproj b/src/Compilers/Core/MSBuildTaskTests/MSBuildTaskTests.csproj index 369b8496cce97..bd385af82dd75 100644 --- a/src/Compilers/Core/MSBuildTaskTests/MSBuildTaskTests.csproj +++ b/src/Compilers/Core/MSBuildTaskTests/MSBuildTaskTests.csproj @@ -32,6 +32,7 @@ + @@ -41,4 +42,4 @@ - \ No newline at end of file + diff --git a/src/Compilers/Server/VBCSCompilerTests/VBCSCompilerTests.csproj b/src/Compilers/Server/VBCSCompilerTests/VBCSCompilerTests.csproj index b9b9a7242fdb9..af0d37390ffbf 100644 --- a/src/Compilers/Server/VBCSCompilerTests/VBCSCompilerTests.csproj +++ b/src/Compilers/Server/VBCSCompilerTests/VBCSCompilerTests.csproj @@ -38,10 +38,11 @@ + - \ No newline at end of file + diff --git a/src/Compilers/VisualBasic/Test/CommandLine/BasicCommandLineTest.vbproj b/src/Compilers/VisualBasic/Test/CommandLine/BasicCommandLineTest.vbproj index 56c563c998290..bd14e66bda314 100644 --- a/src/Compilers/VisualBasic/Test/CommandLine/BasicCommandLineTest.vbproj +++ b/src/Compilers/VisualBasic/Test/CommandLine/BasicCommandLineTest.vbproj @@ -32,6 +32,7 @@ + @@ -88,4 +89,4 @@ - \ No newline at end of file + diff --git a/src/Compilers/VisualBasic/Test/Emit/BasicCompilerEmitTest.vbproj b/src/Compilers/VisualBasic/Test/Emit/BasicCompilerEmitTest.vbproj index e9e587cedee63..e400dd445ede0 100644 --- a/src/Compilers/VisualBasic/Test/Emit/BasicCompilerEmitTest.vbproj +++ b/src/Compilers/VisualBasic/Test/Emit/BasicCompilerEmitTest.vbproj @@ -31,6 +31,7 @@ + @@ -132,4 +133,4 @@ - \ No newline at end of file + diff --git a/src/Compilers/VisualBasic/Test/Semantic/BasicCompilerSemanticTest.vbproj b/src/Compilers/VisualBasic/Test/Semantic/BasicCompilerSemanticTest.vbproj index bcd7263cbac80..bcfacef600802 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/BasicCompilerSemanticTest.vbproj +++ b/src/Compilers/VisualBasic/Test/Semantic/BasicCompilerSemanticTest.vbproj @@ -30,6 +30,7 @@ + @@ -84,4 +85,4 @@ - \ No newline at end of file + diff --git a/src/Compilers/VisualBasic/Test/Symbol/BasicCompilerSymbolTest.vbproj b/src/Compilers/VisualBasic/Test/Symbol/BasicCompilerSymbolTest.vbproj index 3aa0105a28597..163fa7c4bcabc 100644 --- a/src/Compilers/VisualBasic/Test/Symbol/BasicCompilerSymbolTest.vbproj +++ b/src/Compilers/VisualBasic/Test/Symbol/BasicCompilerSymbolTest.vbproj @@ -30,6 +30,7 @@ + @@ -47,4 +48,4 @@ - \ No newline at end of file + diff --git a/src/Compilers/VisualBasic/Test/Syntax/BasicCompilerSyntaxTest.vbproj b/src/Compilers/VisualBasic/Test/Syntax/BasicCompilerSyntaxTest.vbproj index 6ed003c387082..bc42847c11538 100644 --- a/src/Compilers/VisualBasic/Test/Syntax/BasicCompilerSyntaxTest.vbproj +++ b/src/Compilers/VisualBasic/Test/Syntax/BasicCompilerSyntaxTest.vbproj @@ -35,6 +35,7 @@ + @@ -66,4 +67,4 @@ - \ No newline at end of file + diff --git a/src/EditorFeatures/TestUtilities/ServicesTestUtilities.csproj b/src/EditorFeatures/TestUtilities/ServicesTestUtilities.csproj index c5dd026e81a78..4a03202ac92f1 100644 --- a/src/EditorFeatures/TestUtilities/ServicesTestUtilities.csproj +++ b/src/EditorFeatures/TestUtilities/ServicesTestUtilities.csproj @@ -52,6 +52,7 @@ + @@ -112,4 +113,4 @@ - \ No newline at end of file + diff --git a/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/CSharpExpressionCompilerTest.csproj b/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/CSharpExpressionCompilerTest.csproj index 5fbf8b4838eed..a6b053fe60f1f 100644 --- a/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/CSharpExpressionCompilerTest.csproj +++ b/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/CSharpExpressionCompilerTest.csproj @@ -37,6 +37,7 @@ + @@ -48,4 +49,4 @@ - \ No newline at end of file + diff --git a/src/ExpressionEvaluator/CSharp/Test/ResultProvider/CSharpResultProviderTest.csproj b/src/ExpressionEvaluator/CSharp/Test/ResultProvider/CSharpResultProviderTest.csproj index 842d1ea32620a..d9757109c0594 100644 --- a/src/ExpressionEvaluator/CSharp/Test/ResultProvider/CSharpResultProviderTest.csproj +++ b/src/ExpressionEvaluator/CSharp/Test/ResultProvider/CSharpResultProviderTest.csproj @@ -33,6 +33,7 @@ + @@ -45,4 +46,4 @@ - \ No newline at end of file + diff --git a/src/ExpressionEvaluator/Core/Test/ExpressionCompiler/ExpressionCompilerTestUtilities.csproj b/src/ExpressionEvaluator/Core/Test/ExpressionCompiler/ExpressionCompilerTestUtilities.csproj index d98f84964453a..ff7e2f50298a2 100644 --- a/src/ExpressionEvaluator/Core/Test/ExpressionCompiler/ExpressionCompilerTestUtilities.csproj +++ b/src/ExpressionEvaluator/Core/Test/ExpressionCompiler/ExpressionCompilerTestUtilities.csproj @@ -17,6 +17,7 @@ + @@ -58,4 +59,4 @@ - \ No newline at end of file + diff --git a/src/ExpressionEvaluator/Core/Test/FunctionResolver/FunctionResolverTest.csproj b/src/ExpressionEvaluator/Core/Test/FunctionResolver/FunctionResolverTest.csproj index 9a1fe5622bed6..b4114d5e4b5e6 100644 --- a/src/ExpressionEvaluator/Core/Test/FunctionResolver/FunctionResolverTest.csproj +++ b/src/ExpressionEvaluator/Core/Test/FunctionResolver/FunctionResolverTest.csproj @@ -36,7 +36,8 @@ + - \ No newline at end of file + diff --git a/src/ExpressionEvaluator/Core/Test/ResultProvider/ResultProviderTestUtilities.csproj b/src/ExpressionEvaluator/Core/Test/ResultProvider/ResultProviderTestUtilities.csproj index dba0c36acb6f4..302eba66b8d09 100644 --- a/src/ExpressionEvaluator/Core/Test/ResultProvider/ResultProviderTestUtilities.csproj +++ b/src/ExpressionEvaluator/Core/Test/ResultProvider/ResultProviderTestUtilities.csproj @@ -26,6 +26,7 @@ + diff --git a/src/ExpressionEvaluator/VisualBasic/Test/ExpressionCompiler/BasicExpressionCompilerTest.vbproj b/src/ExpressionEvaluator/VisualBasic/Test/ExpressionCompiler/BasicExpressionCompilerTest.vbproj index 1ef7b48615806..699cc63973000 100644 --- a/src/ExpressionEvaluator/VisualBasic/Test/ExpressionCompiler/BasicExpressionCompilerTest.vbproj +++ b/src/ExpressionEvaluator/VisualBasic/Test/ExpressionCompiler/BasicExpressionCompilerTest.vbproj @@ -36,6 +36,7 @@ + @@ -45,4 +46,4 @@ - \ No newline at end of file + diff --git a/src/ExpressionEvaluator/VisualBasic/Test/ResultProvider/BasicResultProviderTest.vbproj b/src/ExpressionEvaluator/VisualBasic/Test/ResultProvider/BasicResultProviderTest.vbproj index 7ad8d126b665f..22dad4c5848a1 100644 --- a/src/ExpressionEvaluator/VisualBasic/Test/ResultProvider/BasicResultProviderTest.vbproj +++ b/src/ExpressionEvaluator/VisualBasic/Test/ResultProvider/BasicResultProviderTest.vbproj @@ -34,6 +34,7 @@ + @@ -46,4 +47,4 @@ - \ No newline at end of file + diff --git a/src/Samples/CSharp/APISampleUnitTests/APISampleUnitTestsCS.csproj b/src/Samples/CSharp/APISampleUnitTests/APISampleUnitTestsCS.csproj index e7de8358b89ff..9c7dbaf4794dc 100644 --- a/src/Samples/CSharp/APISampleUnitTests/APISampleUnitTestsCS.csproj +++ b/src/Samples/CSharp/APISampleUnitTests/APISampleUnitTestsCS.csproj @@ -28,7 +28,8 @@ + - \ No newline at end of file + diff --git a/src/Samples/CSharp/ConvertToConditional/Test/ConvertToConditionalCS.UnitTests.csproj b/src/Samples/CSharp/ConvertToConditional/Test/ConvertToConditionalCS.UnitTests.csproj index 138a0345269d8..2fa887fec0e10 100644 --- a/src/Samples/CSharp/ConvertToConditional/Test/ConvertToConditionalCS.UnitTests.csproj +++ b/src/Samples/CSharp/ConvertToConditional/Test/ConvertToConditionalCS.UnitTests.csproj @@ -31,10 +31,11 @@ + - \ No newline at end of file + diff --git a/src/Samples/CSharp/ImplementNotifyPropertyChanged/Test/ImplementNotifyPropertyChangedCS.UnitTests.csproj b/src/Samples/CSharp/ImplementNotifyPropertyChanged/Test/ImplementNotifyPropertyChangedCS.UnitTests.csproj index ea2e4f1ecbab9..f9fc68909a354 100644 --- a/src/Samples/CSharp/ImplementNotifyPropertyChanged/Test/ImplementNotifyPropertyChangedCS.UnitTests.csproj +++ b/src/Samples/CSharp/ImplementNotifyPropertyChanged/Test/ImplementNotifyPropertyChangedCS.UnitTests.csproj @@ -34,7 +34,8 @@ + - \ No newline at end of file + diff --git a/src/Samples/Shared/UnitTestFramework/UnitTestFramework.csproj b/src/Samples/Shared/UnitTestFramework/UnitTestFramework.csproj index cfa985a21c149..0567c7f88a08e 100644 --- a/src/Samples/Shared/UnitTestFramework/UnitTestFramework.csproj +++ b/src/Samples/Shared/UnitTestFramework/UnitTestFramework.csproj @@ -32,10 +32,11 @@ + - \ No newline at end of file + diff --git a/src/Samples/VisualBasic/APISampleUnitTests/APISampleUnitTestsVB.vbproj b/src/Samples/VisualBasic/APISampleUnitTests/APISampleUnitTestsVB.vbproj index 784b27f99cea7..197a5d875b6bb 100644 --- a/src/Samples/VisualBasic/APISampleUnitTests/APISampleUnitTestsVB.vbproj +++ b/src/Samples/VisualBasic/APISampleUnitTests/APISampleUnitTestsVB.vbproj @@ -32,10 +32,11 @@ + - \ No newline at end of file + diff --git a/src/Samples/VisualBasic/ConvertToAutoProperty/Test/ConvertToAutoPropertyVB.UnitTests.vbproj b/src/Samples/VisualBasic/ConvertToAutoProperty/Test/ConvertToAutoPropertyVB.UnitTests.vbproj index 3646afbbd8862..115db58eba9dc 100644 --- a/src/Samples/VisualBasic/ConvertToAutoProperty/Test/ConvertToAutoPropertyVB.UnitTests.vbproj +++ b/src/Samples/VisualBasic/ConvertToAutoProperty/Test/ConvertToAutoPropertyVB.UnitTests.vbproj @@ -38,10 +38,11 @@ + - \ No newline at end of file + diff --git a/src/Samples/VisualBasic/ImplementNotifyPropertyChanged/Test/ImplementNotifyPropertyChangedVB.UnitTests.vbproj b/src/Samples/VisualBasic/ImplementNotifyPropertyChanged/Test/ImplementNotifyPropertyChangedVB.UnitTests.vbproj index 4340eba9c4bdc..84a2ce82b7212 100644 --- a/src/Samples/VisualBasic/ImplementNotifyPropertyChanged/Test/ImplementNotifyPropertyChangedVB.UnitTests.vbproj +++ b/src/Samples/VisualBasic/ImplementNotifyPropertyChanged/Test/ImplementNotifyPropertyChangedVB.UnitTests.vbproj @@ -40,7 +40,8 @@ + - \ No newline at end of file + diff --git a/src/Samples/VisualBasic/RemoveByVal/Test/RemoveByValVB.UnitTests.vbproj b/src/Samples/VisualBasic/RemoveByVal/Test/RemoveByValVB.UnitTests.vbproj index b0400aaa7887c..430e551591781 100644 --- a/src/Samples/VisualBasic/RemoveByVal/Test/RemoveByValVB.UnitTests.vbproj +++ b/src/Samples/VisualBasic/RemoveByVal/Test/RemoveByValVB.UnitTests.vbproj @@ -41,10 +41,11 @@ + - \ No newline at end of file + diff --git a/src/Scripting/CoreTest.Desktop/ScriptingTest.Desktop.csproj b/src/Scripting/CoreTest.Desktop/ScriptingTest.Desktop.csproj index c6a07dc3a8295..d508848366607 100644 --- a/src/Scripting/CoreTest.Desktop/ScriptingTest.Desktop.csproj +++ b/src/Scripting/CoreTest.Desktop/ScriptingTest.Desktop.csproj @@ -35,7 +35,8 @@ + - \ No newline at end of file + diff --git a/src/Scripting/CoreTestUtilities/ScriptingTestUtilities.csproj b/src/Scripting/CoreTestUtilities/ScriptingTestUtilities.csproj index d5000e5d4e202..17c814b0996e0 100644 --- a/src/Scripting/CoreTestUtilities/ScriptingTestUtilities.csproj +++ b/src/Scripting/CoreTestUtilities/ScriptingTestUtilities.csproj @@ -43,7 +43,8 @@ + - \ No newline at end of file + diff --git a/src/Scripting/VisualBasicTest.Desktop/BasicScriptingTest.Desktop.vbproj b/src/Scripting/VisualBasicTest.Desktop/BasicScriptingTest.Desktop.vbproj index 3d829ab6288d4..0da96039c02f5 100644 --- a/src/Scripting/VisualBasicTest.Desktop/BasicScriptingTest.Desktop.vbproj +++ b/src/Scripting/VisualBasicTest.Desktop/BasicScriptingTest.Desktop.vbproj @@ -35,6 +35,7 @@ + @@ -44,4 +45,4 @@ - \ No newline at end of file + diff --git a/src/Test/Utilities/CoreClr/TestUtilities.CoreClr.csproj b/src/Test/Utilities/CoreClr/TestUtilities.CoreClr.csproj index baae51ae1f813..5df68e44d49c7 100644 --- a/src/Test/Utilities/CoreClr/TestUtilities.CoreClr.csproj +++ b/src/Test/Utilities/CoreClr/TestUtilities.CoreClr.csproj @@ -66,7 +66,8 @@ + - \ No newline at end of file + diff --git a/src/Test/Utilities/Desktop/TestUtilities.Desktop.csproj b/src/Test/Utilities/Desktop/TestUtilities.Desktop.csproj index 407a7ab6275af..d28aeee39692d 100644 --- a/src/Test/Utilities/Desktop/TestUtilities.Desktop.csproj +++ b/src/Test/Utilities/Desktop/TestUtilities.Desktop.csproj @@ -32,6 +32,7 @@ + @@ -76,4 +77,4 @@ - \ No newline at end of file + diff --git a/src/Test/Utilities/Portable/TestUtilities.csproj b/src/Test/Utilities/Portable/TestUtilities.csproj index 56553d5b18cf6..8be9624888dfc 100644 --- a/src/Test/Utilities/Portable/TestUtilities.csproj +++ b/src/Test/Utilities/Portable/TestUtilities.csproj @@ -104,8 +104,9 @@ + - \ No newline at end of file + diff --git a/src/VisualStudio/IntegrationTest/IntegrationTests/VisualStudioIntegrationTests.csproj b/src/VisualStudio/IntegrationTest/IntegrationTests/VisualStudioIntegrationTests.csproj index 55913c0c77b1c..e29dadc3fde07 100644 --- a/src/VisualStudio/IntegrationTest/IntegrationTests/VisualStudioIntegrationTests.csproj +++ b/src/VisualStudio/IntegrationTest/IntegrationTests/VisualStudioIntegrationTests.csproj @@ -63,7 +63,8 @@ + - \ No newline at end of file + diff --git a/src/Workspaces/CSharpTest/CSharpServicesTest.csproj b/src/Workspaces/CSharpTest/CSharpServicesTest.csproj index 124412ccfc59c..001b347f26ac5 100644 --- a/src/Workspaces/CSharpTest/CSharpServicesTest.csproj +++ b/src/Workspaces/CSharpTest/CSharpServicesTest.csproj @@ -37,6 +37,7 @@ + @@ -46,4 +47,4 @@ - \ No newline at end of file + diff --git a/src/Workspaces/CoreTest/ServicesTest.csproj b/src/Workspaces/CoreTest/ServicesTest.csproj index c583e5953c26a..c4d475c5bc418 100644 --- a/src/Workspaces/CoreTest/ServicesTest.csproj +++ b/src/Workspaces/CoreTest/ServicesTest.csproj @@ -40,6 +40,7 @@ + @@ -56,4 +57,4 @@ - \ No newline at end of file + diff --git a/src/Workspaces/CoreTestUtilities/WorkspacesTestUtilities.csproj b/src/Workspaces/CoreTestUtilities/WorkspacesTestUtilities.csproj index 2bf977d67f7dc..3ba4ba0617c08 100644 --- a/src/Workspaces/CoreTestUtilities/WorkspacesTestUtilities.csproj +++ b/src/Workspaces/CoreTestUtilities/WorkspacesTestUtilities.csproj @@ -54,6 +54,7 @@ + @@ -311,4 +312,4 @@ - \ No newline at end of file + diff --git a/src/Workspaces/VisualBasicTest/VisualBasicServicesTest.vbproj b/src/Workspaces/VisualBasicTest/VisualBasicServicesTest.vbproj index d1eaa463b6e19..7d55bde307dae 100644 --- a/src/Workspaces/VisualBasicTest/VisualBasicServicesTest.vbproj +++ b/src/Workspaces/VisualBasicTest/VisualBasicServicesTest.vbproj @@ -36,6 +36,7 @@ + @@ -64,4 +65,4 @@ - \ No newline at end of file + From caad842d84849150200be2e2d23466e90c456ccf Mon Sep 17 00:00:00 2001 From: CyrusNajmabadi Date: Tue, 25 Jul 2017 12:12:34 -0700 Subject: [PATCH 013/205] Add comment. --- .../CodeActions/Annotations/NavigationAnnotation.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Workspaces/Core/Portable/CodeActions/Annotations/NavigationAnnotation.cs b/src/Workspaces/Core/Portable/CodeActions/Annotations/NavigationAnnotation.cs index b72e5343a5779..11a430e0cd1ae 100644 --- a/src/Workspaces/Core/Portable/CodeActions/Annotations/NavigationAnnotation.cs +++ b/src/Workspaces/Core/Portable/CodeActions/Annotations/NavigationAnnotation.cs @@ -4,8 +4,17 @@ namespace Microsoft.CodeAnalysis.CodeActions { /// /// Apply this annotation to an appropriate Syntax element to request that it should be - /// navigated to by the user after the action. + /// navigated to by the user after a code action is applied. If present the host should + /// try to place the user's caret at the beginning of the element. /// + /// + /// By using a this navigation location will be resilient + /// to the transformations performed by the infrastructure. + /// Namely it will be resilient to the formatting, reduction or case correction that + /// automatically occures. This allows a code action to specify a desired location for + /// the user caret to be placed without knowing what actual position that location will + /// end up at when the action is finally applied. + /// internal static class NavigationAnnotation { public const string Kind = "CodeAction_Navigation"; From 2ad99512ce7d8d2dd728da31a02d91a6f04dba33 Mon Sep 17 00:00:00 2001 From: CyrusNajmabadi Date: Tue, 25 Jul 2017 12:51:25 -0700 Subject: [PATCH 014/205] Preserve trivia better when converting if to switch. --- .../ConvertIfToSwitchTests.cs | 74 +++++++++++++++++++ .../ConvertIfToSwitchTests.vb | 34 +++++++++ ...onvertIfToSwitchCodeRefactoringProvider.cs | 16 ++++ ...onvertIfToSwitchCodeRefactoringProvider.cs | 11 ++- ...onvertIfToSwitchCodeRefactoringProvider.vb | 5 ++ 5 files changed, 138 insertions(+), 2 deletions(-) diff --git a/src/EditorFeatures/CSharpTest/CodeActions/ConvertIfToSwitch/ConvertIfToSwitchTests.cs b/src/EditorFeatures/CSharpTest/CodeActions/ConvertIfToSwitch/ConvertIfToSwitchTests.cs index cf200b51f27ee..5f475123b5419 100644 --- a/src/EditorFeatures/CSharpTest/CodeActions/ConvertIfToSwitch/ConvertIfToSwitchTests.cs +++ b/src/EditorFeatures/CSharpTest/CodeActions/ConvertIfToSwitch/ConvertIfToSwitchTests.cs @@ -798,5 +798,79 @@ int M(int i) } }"); } + + [WorkItem(21109, "https://github.com/dotnet/roslyn/issues/21109")] + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertIfToSwitch)] + public async Task TestTrivia1() + { + await TestInRegularAndScriptAsync( +@"class C +{ + int M(int i) + { +#if TRUE + Console.WriteLine(); +#endif + + [||]if (x == 1) + { + Console.WriteLine(x + z); + } + else if (x == 2) + { + Console.WriteLine(x + z); + } + } +}", +@"class C +{ + int M(int i) + { +#if TRUE + Console.WriteLine(); +#endif + + switch (x) + { + case 1: + Console.WriteLine(x + z); + break; + case 2: + Console.WriteLine(x + z); + break; + } + } +}", ignoreTrivia: false); + } + + [WorkItem(21101, "https://github.com/dotnet/roslyn/issues/21101")] + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertIfToSwitch)] + public async Task TestTrivia2() + { + await TestInRegularAndScriptAsync( +@"class C +{ + int M(int i) + { + [||]if (/* t0 */args.Length /* t1*/ == /* t2 */ 2) + return /* t3 */ 0 /* t4 */; /* t5 */ + else /* t6 */ + return /* t7 */ 3 /* t8 */; + } +}", +@"class C +{ + int M(int i) + { + switch (/* t0 */args.Length /* t1*/ ) + { + case 2: + return /* t3 */ 0 /* t4 */; /* t5 */ + default: + return /* t7 */ 3 /* t8 */; + } + } +}", ignoreTrivia: false); + } } } diff --git a/src/EditorFeatures/VisualBasicTest/CodeActions/ConvertIfToSwitch/ConvertIfToSwitchTests.vb b/src/EditorFeatures/VisualBasicTest/CodeActions/ConvertIfToSwitch/ConvertIfToSwitchTests.vb index e2a17b430d331..a4eea5234b99b 100644 --- a/src/EditorFeatures/VisualBasicTest/CodeActions/ConvertIfToSwitch/ConvertIfToSwitchTests.vb +++ b/src/EditorFeatures/VisualBasicTest/CodeActions/ConvertIfToSwitch/ConvertIfToSwitchTests.vb @@ -360,5 +360,39 @@ End Class", End Sub End Class") End Function + + + Public Async Function TestTrivia1() As Task + Await TestInRegularAndScriptAsync( +"Class C + Sub M(i As Integer) +#if true + Console.WriteLine() +#end if + + [||]If i = 1 OrElse 2 = i OrElse i = 3 Then + M(0) + ElseIf i = 4 OrElse 5 = i OrElse i = 6 Then + M(1) + Else + M(2) + End If + End Sub +End Class", +"Class C + Sub M(i As Integer) +#if true + Console.WriteLine() +#end if + + Select i + Case 1, 2, 3 M(0) + Case 4, 5, 6 M(1) + Case Else + M(2) + End Select + End Sub +End Class", ignoreTrivia:=False) + End Function End Class End Namespace diff --git a/src/Features/CSharp/Portable/ConvertIfToSwitch/CSharpConvertIfToSwitchCodeRefactoringProvider.cs b/src/Features/CSharp/Portable/ConvertIfToSwitch/CSharpConvertIfToSwitchCodeRefactoringProvider.cs index 2237900f20d1b..85f2483ec0c40 100644 --- a/src/Features/CSharp/Portable/ConvertIfToSwitch/CSharpConvertIfToSwitchCodeRefactoringProvider.cs +++ b/src/Features/CSharp/Portable/ConvertIfToSwitch/CSharpConvertIfToSwitchCodeRefactoringProvider.cs @@ -8,6 +8,7 @@ using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.LanguageServices; using Microsoft.CodeAnalysis.ConvertIfToSwitch; +using Microsoft.CodeAnalysis.Shared.Extensions; namespace Microsoft.CodeAnalysis.CSharp.ConvertIfToSwitch { @@ -249,6 +250,21 @@ when expression.IsKind(SyntaxKind.AsExpression): return expression; } } + + protected override SyntaxNode CreateSwitchStatement( + IfStatementSyntax ifStatement, ExpressionSyntax expression, List sectionList) + { + var block = ifStatement.Statement as BlockSyntax; + + return SyntaxFactory.SwitchStatement( + SyntaxFactory.Token(SyntaxKind.SwitchKeyword).WithTriviaFrom(ifStatement.IfKeyword), + ifStatement.OpenParenToken, + expression, + ifStatement.CloseParenToken.WithPrependedLeadingTrivia(SyntaxFactory.ElasticMarker), + block?.OpenBraceToken ?? SyntaxFactory.Token(SyntaxKind.OpenBraceToken), + new SyntaxList(sectionList.OfType()), + block?.CloseBraceToken ?? SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); + } } } } diff --git a/src/Features/Core/Portable/ConvertIfToSwitch/AbstractConvertIfToSwitchCodeRefactoringProvider.cs b/src/Features/Core/Portable/ConvertIfToSwitch/AbstractConvertIfToSwitchCodeRefactoringProvider.cs index f32363aeab2d4..ff0497505e73e 100644 --- a/src/Features/Core/Portable/ConvertIfToSwitch/AbstractConvertIfToSwitchCodeRefactoringProvider.cs +++ b/src/Features/Core/Portable/ConvertIfToSwitch/AbstractConvertIfToSwitchCodeRefactoringProvider.cs @@ -227,14 +227,21 @@ private Task UpdateDocumentAsync( } var ifSpan = ifStatement.Span; - var @switch = generator.SwitchStatement(_switchExpression, sectionList); + var @switch = CreateSwitchStatement(ifStatement, _switchExpression, sectionList); var nodesToRemove = GetSubsequentStatements(ifStatement) - .Skip(1).Take(_numberOfSubsequentIfStatementsToRemove); + .Skip(1).Take(_numberOfSubsequentIfStatementsToRemove).ToList(); root = root.RemoveNodes(nodesToRemove, SyntaxRemoveOptions.KeepNoTrivia); + + var lastNode = nodesToRemove.LastOrDefault() ?? ifStatement; + @switch = @switch.WithLeadingTrivia(ifStatement.GetLeadingTrivia()) + .WithTrailingTrivia(lastNode.GetTrailingTrivia()); + root = root.ReplaceNode(root.FindNode(ifSpan), @switch); return Task.FromResult(document.WithSyntaxRoot(root)); } + protected abstract SyntaxNode CreateSwitchStatement(TIfStatementSyntax ifStatement, TExpressionSyntax expression, List sectionList); + protected abstract TExpressionSyntax UnwrapCast(TExpressionSyntax expression); protected abstract bool EndPointIsReachable(TIfStatementSyntax ifStatement); diff --git a/src/Features/VisualBasic/Portable/ConvertIfToSwitch/VisualBasicConvertIfToSwitchCodeRefactoringProvider.vb b/src/Features/VisualBasic/Portable/ConvertIfToSwitch/VisualBasicConvertIfToSwitchCodeRefactoringProvider.vb index 062cef99e1dd6..59cd98e92ad31 100644 --- a/src/Features/VisualBasic/Portable/ConvertIfToSwitch/VisualBasicConvertIfToSwitchCodeRefactoringProvider.vb +++ b/src/Features/VisualBasic/Portable/ConvertIfToSwitch/VisualBasicConvertIfToSwitchCodeRefactoringProvider.vb @@ -6,6 +6,7 @@ Imports Microsoft.CodeAnalysis.CodeRefactorings Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Imports Microsoft.CodeAnalysis.LanguageServices Imports Microsoft.CodeAnalysis.ConvertIfToSwitch +Imports Microsoft.CodeAnalysis.VisualBasic.CodeGeneration Namespace Microsoft.CodeAnalysis.VisualBasic.ConvertIfToSwitch @@ -183,6 +184,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.ConvertIfToSwitch Protected Overrides Function UnwrapCast(expression As ExpressionSyntax) As ExpressionSyntax Return expression End Function + + Protected Overrides Function CreateSwitchStatement(ifStatement As ExecutableStatementSyntax, expression As ExpressionSyntax, sectionList As List(Of SyntaxNode)) As SyntaxNode + Return VisualBasicSyntaxGenerator.Instance.SwitchStatement(expression, sectionList) + End Function End Class End Class End Namespace From 467dedf6732d9d88fbfc18f6c9795f8b3201eb25 Mon Sep 17 00:00:00 2001 From: CyrusNajmabadi Date: Tue, 25 Jul 2017 13:00:53 -0700 Subject: [PATCH 015/205] Fix VB formatting of case labels. --- .../ConvertIfToSwitch/ConvertIfToSwitchTests.vb | 7 +++++-- ...vertIfToSwitchCodeRefactoringProvider.Pattern.vb | 13 +++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/EditorFeatures/VisualBasicTest/CodeActions/ConvertIfToSwitch/ConvertIfToSwitchTests.vb b/src/EditorFeatures/VisualBasicTest/CodeActions/ConvertIfToSwitch/ConvertIfToSwitchTests.vb index a4eea5234b99b..25e854b02a232 100644 --- a/src/EditorFeatures/VisualBasicTest/CodeActions/ConvertIfToSwitch/ConvertIfToSwitchTests.vb +++ b/src/EditorFeatures/VisualBasicTest/CodeActions/ConvertIfToSwitch/ConvertIfToSwitchTests.vb @@ -361,6 +361,7 @@ End Class", End Class") End Function + Public Async Function TestTrivia1() As Task Await TestInRegularAndScriptAsync( @@ -386,8 +387,10 @@ End Class", #end if Select i - Case 1, 2, 3 M(0) - Case 4, 5, 6 M(1) + Case 1, 2, 3 + M(0) + Case 4, 5, 6 + M(1) Case Else M(2) End Select diff --git a/src/Features/VisualBasic/Portable/ConvertIfToSwitch/VisualBasicConvertIfToSwitchCodeRefactoringProvider.Pattern.vb b/src/Features/VisualBasic/Portable/ConvertIfToSwitch/VisualBasicConvertIfToSwitchCodeRefactoringProvider.Pattern.vb index 8c7819bc09477..20246127c7e15 100644 --- a/src/Features/VisualBasic/Portable/ConvertIfToSwitch/VisualBasicConvertIfToSwitchCodeRefactoringProvider.Pattern.vb +++ b/src/Features/VisualBasic/Portable/ConvertIfToSwitch/VisualBasicConvertIfToSwitchCodeRefactoringProvider.Pattern.vb @@ -29,7 +29,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.ConvertIfToSwitch _operatorTokenKind = operatorTokenKind End Sub - Public Overrides Function CreateSwitchLabel() As CaseClauseSyntax + Protected Overrides Function CreateSwitchLabelWorker() As CaseClauseSyntax Dim comparisonToken = If(_inverted, s_comparisonTokenMap(_operatorTokenKind).inverse, _operatorTokenKind) Return SyntaxFactory.RelationalCaseClause( s_comparisonTokenMap(comparisonToken).caseClause, @@ -47,7 +47,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.ConvertIfToSwitch _constant = constant End Sub - Public Overrides Function CreateSwitchLabel() As CaseClauseSyntax + Protected Overrides Function CreateSwitchLabelWorker() As CaseClauseSyntax Return SyntaxFactory.SimpleCaseClause(_constant) End Function End Class @@ -61,12 +61,17 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.ConvertIfToSwitch _rangeBounds = rangeBounds End Sub - Public Overrides Function CreateSwitchLabel() As CaseClauseSyntax + Protected Overrides Function CreateSwitchLabelWorker() As CaseClauseSyntax Return SyntaxFactory.RangeCaseClause(_rangeBounds.lower, _rangeBounds.upper) End Function End Class - Public MustOverride Function CreateSwitchLabel() As CaseClauseSyntax Implements IPattern(Of CaseClauseSyntax).CreateSwitchLabel + Public Function CreateSwitchLabel() As CaseClauseSyntax Implements IPattern(Of CaseClauseSyntax).CreateSwitchLabel + Return CreateSwitchLabelWorker().WithAppendedTrailingTrivia(SyntaxFactory.ElasticMarker) + End Function + + Protected MustOverride Function CreateSwitchLabelWorker() As CaseClauseSyntax + End Class End Class End Namespace From 16522a3ccd9b834bf92c3855efee3603eaf5ec2d Mon Sep 17 00:00:00 2001 From: CyrusNajmabadi Date: Tue, 25 Jul 2017 13:45:14 -0700 Subject: [PATCH 016/205] Format switch block. --- .../ConvertIfToSwitchTests.cs | 49 ++++++++++--------- ...onvertIfToSwitchCodeRefactoringProvider.cs | 4 +- 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/src/EditorFeatures/CSharpTest/CodeActions/ConvertIfToSwitch/ConvertIfToSwitchTests.cs b/src/EditorFeatures/CSharpTest/CodeActions/ConvertIfToSwitch/ConvertIfToSwitchTests.cs index 5f475123b5419..55ea133985642 100644 --- a/src/EditorFeatures/CSharpTest/CodeActions/ConvertIfToSwitch/ConvertIfToSwitchTests.cs +++ b/src/EditorFeatures/CSharpTest/CodeActions/ConvertIfToSwitch/ConvertIfToSwitchTests.cs @@ -38,7 +38,7 @@ void M(int i) return; } } -}"); +}", ignoreTrivia: false); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertIfToSwitch)] @@ -66,7 +66,7 @@ void M(int i) break; } } -}"); +}", ignoreTrivia: false); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertIfToSwitch)] @@ -103,7 +103,7 @@ void M(int i) break; } } -}"); +}", ignoreTrivia: false); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertIfToSwitch)] @@ -135,7 +135,7 @@ void M(object o) return; } } -}"); +}", ignoreTrivia: false); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertIfToSwitch)] @@ -162,7 +162,7 @@ void M(int i) return; } } -}"); +}", ignoreTrivia: false); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertIfToSwitch)] @@ -191,7 +191,7 @@ void M(int i) return; } } -}"); +}", ignoreTrivia: false); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertIfToSwitch)] @@ -259,7 +259,7 @@ void M(object o) return; } } -}"); +}", ignoreTrivia: false); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertIfToSwitch)] @@ -288,7 +288,7 @@ void M(object o) return; } } -}"); +}", ignoreTrivia: false); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertIfToSwitch)] @@ -317,7 +317,7 @@ void M(object o) return; } } -}"); +}", ignoreTrivia: false); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertIfToSwitch)] @@ -346,7 +346,7 @@ void M(object o) return; } } -}"); +}", ignoreTrivia: false); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertIfToSwitch)] @@ -375,7 +375,7 @@ void M(object o) return; } } -}"); +}", ignoreTrivia: false); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertIfToSwitch)] @@ -406,10 +406,10 @@ void M(object o) { case string s when s.Length > 5 && s.Length < 10: - M(o: 0); + M(o: 0); break; case int i: - M(o: 0); + M(o: 0); break; } } @@ -457,11 +457,12 @@ void M(int i) var x = i; break; } + case 4: break; } } -}"); +}", ignoreTrivia: false); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertIfToSwitch)] @@ -528,12 +529,13 @@ void M(int i) { break; } + break; case 2: break; } } -}"); +}", ignoreTrivia: false); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertIfToSwitch)] @@ -562,7 +564,7 @@ int M(int? i) } return 7; } -}"); +}", ignoreTrivia: false); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertIfToSwitch)] @@ -586,14 +588,14 @@ int M(int? i) switch (i) { case null: - return 5; + return 5; case 0: break; } if (i == 1) return 6; return 7; } -}"); +}", ignoreTrivia: false); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertIfToSwitch)] @@ -631,7 +633,7 @@ int M(int? i) return 7; } } -}"); +}", ignoreTrivia: false); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertIfToSwitch)] @@ -662,7 +664,7 @@ string M(object i) return i.ToString(); } } -}"); +}", ignoreTrivia: false); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertIfToSwitch)] @@ -693,7 +695,7 @@ int M(int i) if (i == i) return 0; reuturn 7; } -}"); +}", ignoreTrivia: false); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertIfToSwitch)] @@ -736,7 +738,7 @@ int M(int i) } reuturn 7; } -}"); +}", ignoreTrivia: false); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsConvertIfToSwitch)] @@ -782,6 +784,7 @@ int M(int i) case 1: return 1; } + if (i == 10) { return 5; @@ -796,7 +799,7 @@ int M(int i) } reuturn 7; } -}"); +}", ignoreTrivia: false); } [WorkItem(21109, "https://github.com/dotnet/roslyn/issues/21109")] diff --git a/src/Features/Core/Portable/ConvertIfToSwitch/AbstractConvertIfToSwitchCodeRefactoringProvider.cs b/src/Features/Core/Portable/ConvertIfToSwitch/AbstractConvertIfToSwitchCodeRefactoringProvider.cs index ff0497505e73e..ecf19fa6841db 100644 --- a/src/Features/Core/Portable/ConvertIfToSwitch/AbstractConvertIfToSwitchCodeRefactoringProvider.cs +++ b/src/Features/Core/Portable/ConvertIfToSwitch/AbstractConvertIfToSwitchCodeRefactoringProvider.cs @@ -10,6 +10,7 @@ using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Editing; using Microsoft.CodeAnalysis.CodeRefactorings; +using Microsoft.CodeAnalysis.Formatting; namespace Microsoft.CodeAnalysis.ConvertIfToSwitch { @@ -234,7 +235,8 @@ private Task UpdateDocumentAsync( var lastNode = nodesToRemove.LastOrDefault() ?? ifStatement; @switch = @switch.WithLeadingTrivia(ifStatement.GetLeadingTrivia()) - .WithTrailingTrivia(lastNode.GetTrailingTrivia()); + .WithTrailingTrivia(lastNode.GetTrailingTrivia()) + .WithAdditionalAnnotations(Formatter.Annotation); root = root.ReplaceNode(root.FindNode(ifSpan), @switch); return Task.FromResult(document.WithSyntaxRoot(root)); From 90db4fe44c402675f4da076b7c56c53a9dcbc194 Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Tue, 25 Jul 2017 16:57:45 -0700 Subject: [PATCH 017/205] Handle navigation to a doc ID without a corresponding doc --- .../ProjectSystem/VisualStudioWorkspaceImpl.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioWorkspaceImpl.cs b/src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioWorkspaceImpl.cs index 5f490069e1ff7..3c011e2d0248a 100644 --- a/src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioWorkspaceImpl.cs +++ b/src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioWorkspaceImpl.cs @@ -997,6 +997,12 @@ internal override DocumentId GetDocumentIdInCurrentContext(DocumentId documentId } var hostDocument = GetHostDocument(documentId); + if (hostDocument == null) + { + // This can happen if the document was temporary and has since been closed/deleted. + return base.GetDocumentIdInCurrentContext(documentId); + } + var itemId = hostDocument.GetItemId(); if (itemId == (uint)VSConstants.VSITEMID.Nil) { From 6e9895efe8c245870d2e424568377693996714f7 Mon Sep 17 00:00:00 2001 From: CyrusNajmabadi Date: Tue, 25 Jul 2017 17:22:48 -0700 Subject: [PATCH 018/205] Test trivia --- .../ConvertIfToSwitchTests.vb | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/EditorFeatures/VisualBasicTest/CodeActions/ConvertIfToSwitch/ConvertIfToSwitchTests.vb b/src/EditorFeatures/VisualBasicTest/CodeActions/ConvertIfToSwitch/ConvertIfToSwitchTests.vb index 25e854b02a232..1d9fb19bf3c26 100644 --- a/src/EditorFeatures/VisualBasicTest/CodeActions/ConvertIfToSwitch/ConvertIfToSwitchTests.vb +++ b/src/EditorFeatures/VisualBasicTest/CodeActions/ConvertIfToSwitch/ConvertIfToSwitchTests.vb @@ -37,7 +37,7 @@ End Class", M(2) End Select End Sub -End Class") +End Class", ignoreTrivia:=False) End Function @@ -59,7 +59,7 @@ End Class", M(0) End Select End Sub -End Class") +End Class", ignoreTrivia:=False) End Function @@ -115,7 +115,7 @@ End Class", Case 6 To 7 End Select End Sub -End Class") +End Class", ignoreTrivia:=False) End Function @@ -133,7 +133,7 @@ End Class", Case Is <= 5, Is >= 1 End Select End Sub -End Class") +End Class", ignoreTrivia:=False) End Function @@ -151,7 +151,7 @@ End Class", Case Is < 10, Is > 20, 30 To 40, 50 End Select End Sub -End Class") +End Class", ignoreTrivia:=False) End Function @@ -171,7 +171,7 @@ End Class", M(6) End Select End Sub -End Class") +End Class", ignoreTrivia:=False) End Function @@ -194,7 +194,7 @@ End Class", End Select Return 7 End Function -End Class") +End Class", ignoreTrivia:=False) End Function @@ -217,7 +217,7 @@ End Class", Return 7 End Select End Function -End Class") +End Class", ignoreTrivia:=False) End Function @@ -242,7 +242,7 @@ End Class", If i = 30 Then Return 6 Return 7 End Function -End Class") +End Class", ignoreTrivia:=False) End Function @@ -267,7 +267,7 @@ End Class", If i = i Then Return 0 Return 7 End Function -End Class") +End Class", ignoreTrivia:=False) End Function @@ -298,7 +298,7 @@ End Class", If i = i Then Return 0 Return 8 End Function -End Class") +End Class", ignoreTrivia:=False) End Function @@ -332,7 +332,7 @@ End Class", If i = 5 Then Return 0 Return 8 End Function -End Class") +End Class", ignoreTrivia:=False) End Function @@ -358,7 +358,7 @@ End Class", End Select End While End Sub -End Class") +End Class", ignoreTrivia:=False) End Function From 75d2afd6fa5e1aee3e6a7d1bb70d63b424638b17 Mon Sep 17 00:00:00 2001 From: CyrusNajmabadi Date: Tue, 25 Jul 2017 17:25:31 -0700 Subject: [PATCH 019/205] Fix up new test. --- .../GenerateConstructorFromMembersTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EditorFeatures/CSharpTest/GenerateFromMembers/GenerateConstructorFromMembers/GenerateConstructorFromMembersTests.cs b/src/EditorFeatures/CSharpTest/GenerateFromMembers/GenerateConstructorFromMembers/GenerateConstructorFromMembersTests.cs index 3f74bbbef12cf..66d037adb31d6 100644 --- a/src/EditorFeatures/CSharpTest/GenerateFromMembers/GenerateConstructorFromMembers/GenerateConstructorFromMembersTests.cs +++ b/src/EditorFeatures/CSharpTest/GenerateFromMembers/GenerateConstructorFromMembers/GenerateConstructorFromMembersTests.cs @@ -935,7 +935,7 @@ await TestInRegularAndScriptAsync( }", @"abstract class C { - protected C(int prop) + protected C(int prop{|Navigation:)|} { Prop = prop; } From dee3ab6f42f2a0c3ba83806ab1b0077f3ed29867 Mon Sep 17 00:00:00 2001 From: Tomas Matousek Date: Tue, 25 Jul 2017 17:52:10 -0700 Subject: [PATCH 020/205] Remove PackageTargetFallback that was necessary due to non-netstandard debugger packages --- build/Targets/Packages.props | 4 ++-- .../Source/ExpressionCompiler/CSharpExpressionCompiler.csproj | 2 -- .../Portable/CSharpResultProvider.Portable.csproj | 2 -- .../Core/Source/ExpressionCompiler/ExpressionCompiler.csproj | 2 -- .../Core/Source/FunctionResolver/FunctionResolver.csproj | 2 -- .../ResultProvider/Portable/ResultProvider.Portable.csproj | 2 -- .../Source/ExpressionCompiler/BasicExpressionCompiler.vbproj | 3 --- .../Portable/BasicResultProvider.Portable.vbproj | 2 -- 8 files changed, 2 insertions(+), 17 deletions(-) diff --git a/build/Targets/Packages.props b/build/Targets/Packages.props index 06bf1a89b0989..ed42821f0c73f 100644 --- a/build/Targets/Packages.props +++ b/build/Targets/Packages.props @@ -68,8 +68,8 @@ 15.0.26507-alpha 15.0.66-rc 15.0.26507-alpha - 15.0.26201-gamma - 15.0.26201-gamma + 15.0.26725-gamma + 15.0.26725-gamma 10.0.30319 1.1.4322 15.0.26507-alpha diff --git a/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/CSharpExpressionCompiler.csproj b/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/CSharpExpressionCompiler.csproj index 9e0bb0e3cf7c2..3c42f77d7d6e8 100644 --- a/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/CSharpExpressionCompiler.csproj +++ b/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/CSharpExpressionCompiler.csproj @@ -10,8 +10,6 @@ Microsoft.CodeAnalysis.CSharp.ExpressionEvaluator.ExpressionCompiler true netstandard1.3 - - portable-net46 diff --git a/src/ExpressionEvaluator/CSharp/Source/ResultProvider/Portable/CSharpResultProvider.Portable.csproj b/src/ExpressionEvaluator/CSharp/Source/ResultProvider/Portable/CSharpResultProvider.Portable.csproj index 0f18cf0da0fa1..cb52e81baf545 100644 --- a/src/ExpressionEvaluator/CSharp/Source/ResultProvider/Portable/CSharpResultProvider.Portable.csproj +++ b/src/ExpressionEvaluator/CSharp/Source/ResultProvider/Portable/CSharpResultProvider.Portable.csproj @@ -9,8 +9,6 @@ Microsoft.CodeAnalysis.CSharp.ExpressionEvaluator Microsoft.CodeAnalysis.CSharp.ExpressionEvaluator.ResultProvider netstandard1.3 - - portable-net45+win8 false diff --git a/src/ExpressionEvaluator/Core/Source/ExpressionCompiler/ExpressionCompiler.csproj b/src/ExpressionEvaluator/Core/Source/ExpressionCompiler/ExpressionCompiler.csproj index 9afbc252e7be3..0399566596dbd 100644 --- a/src/ExpressionEvaluator/Core/Source/ExpressionCompiler/ExpressionCompiler.csproj +++ b/src/ExpressionEvaluator/Core/Source/ExpressionCompiler/ExpressionCompiler.csproj @@ -10,8 +10,6 @@ Microsoft.CodeAnalysis.ExpressionEvaluator.ExpressionCompiler true netstandard1.3 - - portable-net46 $(DefineConstants);EXPRESSIONCOMPILER diff --git a/src/ExpressionEvaluator/Core/Source/FunctionResolver/FunctionResolver.csproj b/src/ExpressionEvaluator/Core/Source/FunctionResolver/FunctionResolver.csproj index 02689b5aa7438..41f68cf413c20 100644 --- a/src/ExpressionEvaluator/Core/Source/FunctionResolver/FunctionResolver.csproj +++ b/src/ExpressionEvaluator/Core/Source/FunctionResolver/FunctionResolver.csproj @@ -10,8 +10,6 @@ Microsoft.CodeAnalysis.ExpressionEvaluator.FunctionResolver true netstandard1.3 - - portable-net45+win8 false diff --git a/src/ExpressionEvaluator/Core/Source/ResultProvider/Portable/ResultProvider.Portable.csproj b/src/ExpressionEvaluator/Core/Source/ResultProvider/Portable/ResultProvider.Portable.csproj index 0d7c1320009b6..0ce1962d0f637 100644 --- a/src/ExpressionEvaluator/Core/Source/ResultProvider/Portable/ResultProvider.Portable.csproj +++ b/src/ExpressionEvaluator/Core/Source/ResultProvider/Portable/ResultProvider.Portable.csproj @@ -9,8 +9,6 @@ Microsoft.CodeAnalysis.ExpressionEvaluator Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider netstandard1.3 - - portable-net45+win8 false diff --git a/src/ExpressionEvaluator/VisualBasic/Source/ExpressionCompiler/BasicExpressionCompiler.vbproj b/src/ExpressionEvaluator/VisualBasic/Source/ExpressionCompiler/BasicExpressionCompiler.vbproj index 9cd43135bbd52..e6bced8e817c2 100644 --- a/src/ExpressionEvaluator/VisualBasic/Source/ExpressionCompiler/BasicExpressionCompiler.vbproj +++ b/src/ExpressionEvaluator/VisualBasic/Source/ExpressionCompiler/BasicExpressionCompiler.vbproj @@ -8,9 +8,6 @@ Library Microsoft.CodeAnalysis.VisualBasic.ExpressionEvaluator.ExpressionCompiler netstandard1.3 - - portable-net46 - diff --git a/src/ExpressionEvaluator/VisualBasic/Source/ResultProvider/Portable/BasicResultProvider.Portable.vbproj b/src/ExpressionEvaluator/VisualBasic/Source/ResultProvider/Portable/BasicResultProvider.Portable.vbproj index 8cdac6e214601..cd69819b26240 100644 --- a/src/ExpressionEvaluator/VisualBasic/Source/ResultProvider/Portable/BasicResultProvider.Portable.vbproj +++ b/src/ExpressionEvaluator/VisualBasic/Source/ResultProvider/Portable/BasicResultProvider.Portable.vbproj @@ -8,8 +8,6 @@ Library Microsoft.CodeAnalysis.VisualBasic.ExpressionEvaluator.ResultProvider netstandard1.3 - - portable-net45+win8 false From d198918eec4deba9a5d264eae1c547b88eb3bb48 Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Tue, 25 Jul 2017 20:31:03 -0700 Subject: [PATCH 021/205] update roslyn version --- build/Targets/Versions.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/Targets/Versions.props b/build/Targets/Versions.props index 21d63c7d200b0..4d946c2949b5e 100644 --- a/build/Targets/Versions.props +++ b/build/Targets/Versions.props @@ -9,9 +9,9 @@ - 2.3.0 + 2.4.0 - 2.3.2 + 2.4.0 dev From d270313c46d242eb585ae9304763274d96df6537 Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Tue, 25 Jul 2017 20:36:16 -0700 Subject: [PATCH 022/205] adding branch to publish list --- src/Tools/MicroBuild/publish-assets.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tools/MicroBuild/publish-assets.ps1 b/src/Tools/MicroBuild/publish-assets.ps1 index 3172e22919234..2db2388c7aa96 100644 --- a/src/Tools/MicroBuild/publish-assets.ps1 +++ b/src/Tools/MicroBuild/publish-assets.ps1 @@ -37,7 +37,7 @@ try switch ($branchName) { - "dev15.3.x" { } + "dev15.4.x" { } "master" { } default { From b41b3f298ad7c2a0b00a83501f35fc33b3c6ee2d Mon Sep 17 00:00:00 2001 From: Tomas Matousek Date: Wed, 26 Jul 2017 09:43:53 -0700 Subject: [PATCH 023/205] Set the CWD to the user profile dir, instead of current startup proj --- .../Repl/CSharpVsInteractiveWindowProvider.cs | 2 +- .../Interactive/CommonVsUtils.cs | 38 ------------------- .../VisualBasicVsInteractiveWindowProvider.vb | 2 +- 3 files changed, 2 insertions(+), 40 deletions(-) diff --git a/src/VisualStudio/CSharp/Repl/CSharpVsInteractiveWindowProvider.cs b/src/VisualStudio/CSharp/Repl/CSharpVsInteractiveWindowProvider.cs index 5b1d44e2cd210..aaf14a8cae7fb 100644 --- a/src/VisualStudio/CSharp/Repl/CSharpVsInteractiveWindowProvider.cs +++ b/src/VisualStudio/CSharp/Repl/CSharpVsInteractiveWindowProvider.cs @@ -61,7 +61,7 @@ protected override InteractiveEvaluator CreateInteractiveEvaluator( Commands, contentTypeRegistry, Path.GetDirectoryName(typeof(CSharpVsInteractiveWindowPackage).Assembly.Location), - CommonVsUtils.GetWorkingDirectory()); + Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)); } protected override FunctionId InteractiveWindowFunctionId diff --git a/src/VisualStudio/InteractiveServices/Interactive/CommonVsUtils.cs b/src/VisualStudio/InteractiveServices/Interactive/CommonVsUtils.cs index 8e66efa3f32f8..2f1b6ae6b7b05 100644 --- a/src/VisualStudio/InteractiveServices/Interactive/CommonVsUtils.cs +++ b/src/VisualStudio/InteractiveServices/Interactive/CommonVsUtils.cs @@ -18,19 +18,6 @@ internal static class CommonVsUtils { internal const string OutputWindowId = "34e76e81-ee4a-11d0-ae2e-00a0c90fffc3"; - internal static string GetWorkingDirectory() - { - var startupProject = GetStartupProject(); - if (startupProject != null) - { - return Path.GetDirectoryName(startupProject.FullName); - } - else - { - return Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); - } - } - internal static string GetFilePath(ITextBuffer textBuffer) { ITextDocument textDocument; @@ -94,30 +81,5 @@ public static IWpfTextView GetActiveTextView() return null; } - - private static EnvDTE.Project GetStartupProject() - { - var buildMgr = (IVsSolutionBuildManager)Package.GetGlobalService(typeof(IVsSolutionBuildManager)); - IVsHierarchy hierarchy; - if (buildMgr != null && ErrorHandler.Succeeded(buildMgr.get_StartupProject(out hierarchy)) && hierarchy != null) - { - return GetProject(hierarchy); - } - - return null; - } - - internal static EnvDTE.Project GetProject(IVsHierarchy hierarchy) - { - object project; - - ErrorHandler.ThrowOnFailure( - hierarchy.GetProperty( - VSConstants.VSITEMID_ROOT, - (int)__VSHPROPID.VSHPROPID_ExtObject, - out project)); - - return project as EnvDTE.Project; - } } } diff --git a/src/VisualStudio/VisualBasic/Repl/VisualBasicVsInteractiveWindowProvider.vb b/src/VisualStudio/VisualBasic/Repl/VisualBasicVsInteractiveWindowProvider.vb index 511e017045ac6..9d67d87ece7ee 100644 --- a/src/VisualStudio/VisualBasic/Repl/VisualBasicVsInteractiveWindowProvider.vb +++ b/src/VisualStudio/VisualBasic/Repl/VisualBasicVsInteractiveWindowProvider.vb @@ -62,7 +62,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Interactive Commands, contentTypeRegistry, Path.GetDirectoryName(GetType(VisualBasicVsInteractiveWindowPackage).Assembly.Location), - CommonVsUtils.GetWorkingDirectory()) + Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)) End Function Protected Overrides ReadOnly Property InteractiveWindowFunctionId As FunctionId From c462f345af54bf78d8c8edac22f2efb083896f2a Mon Sep 17 00:00:00 2001 From: David Poeschl Date: Wed, 26 Jul 2017 10:46:07 -0700 Subject: [PATCH 024/205] Disable Basic EE integration tests --- .../VisualBasic/BasicExpressionEvaluator.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/VisualStudio/IntegrationTest/IntegrationTests/VisualBasic/BasicExpressionEvaluator.cs b/src/VisualStudio/IntegrationTest/IntegrationTests/VisualBasic/BasicExpressionEvaluator.cs index 41e83af3c1e7c..9ac772cd7191e 100644 --- a/src/VisualStudio/IntegrationTest/IntegrationTests/VisualBasic/BasicExpressionEvaluator.cs +++ b/src/VisualStudio/IntegrationTest/IntegrationTests/VisualBasic/BasicExpressionEvaluator.cs @@ -55,7 +55,7 @@ End Sub End Module"); } - [Fact] + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/20979")] public void ValidateLocalsWindow() { VisualStudio.Debugger.Go(waitForBreakMode: true); @@ -83,7 +83,7 @@ public void ValidateLocalsWindow() VisualStudio.LocalsWindow.Verify.CheckEntry("myMulticastDelegate", "System.MulticastDelegate", "Nothing"); } - [Fact] + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/20979")] public void EvaluatePrimitiveValues() { VisualStudio.Debugger.Go(waitForBreakMode: true); @@ -104,14 +104,14 @@ public void EvaluateLambdaExpressions() VisualStudio.Debugger.CheckExpression("(Function(val)(val+val))(1)", "Integer", "2"); } - [Fact] + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/20979")] public void EvaluateInvalidExpressions() { VisualStudio.Debugger.Go(waitForBreakMode: true); VisualStudio.Debugger.CheckExpression("myNonsense", "", "error BC30451: 'myNonsense' is not declared. It may be inaccessible due to its protection level."); } - [Fact] + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/20979")] public void StateMachineTypeParameters() { VisualStudio.Editor.SetText(@" From cb558e909971e5d3e81d5346a2d8c178429fc930 Mon Sep 17 00:00:00 2001 From: Ashley Hauck Date: Wed, 26 Jul 2017 18:14:41 +0000 Subject: [PATCH 025/205] Move logic from the Makefile to either cibuild.sh or build/scripts Also update a couple docs to reflect more modern information. Docs are very out of date at this point, and a review pass should probably be done. --- Makefile | 69 --------------------------- build/scripts/obtain_dotnet.sh | 39 +++++++++++++++ build/scripts/tests.sh | 23 ++++++--- cibuild.sh | 65 +++++++++++++++---------- docs/infrastructure/cross-platform.md | 19 ++------ docs/infrastructure/unix-toolset.md | 29 ----------- 6 files changed, 100 insertions(+), 144 deletions(-) delete mode 100644 Makefile create mode 100644 build/scripts/obtain_dotnet.sh delete mode 100644 docs/infrastructure/unix-toolset.md diff --git a/Makefile b/Makefile deleted file mode 100644 index c00e72729f700..0000000000000 --- a/Makefile +++ /dev/null @@ -1,69 +0,0 @@ -SHELL = /usr/bin/env bash -OS_NAME = $(shell uname -s) -BUILD_CONFIGURATION = Debug -BINARIES_PATH = $(shell pwd)/Binaries -SRC_PATH = $(shell pwd)/src -BOOTSTRAP_PATH = $(BINARIES_PATH)/Bootstrap -BUILD_LOG_PATH = -HOME_DIR = $(shell cd ~ && pwd) -DOTNET_VERSION = 1.0.1 -DOTNET = $(BINARIES_PATH)/dotnet-cli/dotnet -TARGET_FX = netcoreapp1.1 - -MSBUILD_ADDITIONALARGS := /v:m /fl /fileloggerparameters:Verbosity=normal /p:Configuration=$(BUILD_CONFIGURATION) - -ifeq ($(OS_NAME),Linux) - RUNTIME_ID := $(shell . /etc/os-release && echo $$ID.$$VERSION_ID)-x64 -else ifeq ($(OS_NAME),Darwin) - RUNTIME_ID := osx.10.12-x64 -endif - -ifneq ($(BUILD_LOG_PATH),) - MSBUILD_ADDITIONALARGS := $(MSBUILD_ADDITIONALARGS) /fileloggerparameters:LogFile=$(BUILD_LOG_PATH) -endif - -ifeq ($(BOOTSTRAP),true) - MSBUILD_ARGS = $(MSBUILD_ADDITIONALARGS) /p:CscToolPath=$(BOOTSTRAP_PATH)/csc /p:CscToolExe=csc /p:VbcToolPath=$(BOOTSTRAP_PATH)/vbc /p:VbcToolExe=vbc -else - MSBUILD_ARGS = $(MSBUILD_ADDITIONALARGS) -endif - -BUILD_CMD = dotnet build $(MSBUILD_ARGS) - -.PHONY: all bootstrap test toolset - -all: restore - @export PATH="$(BINARIES_PATH)/dotnet-cli:$(PATH)" ; \ - export HOME="$(HOME_DIR)" ; \ - $(BUILD_CMD) CrossPlatform.sln - -bootstrap: restore - export HOME="$(HOME_DIR)" ; \ - export PATH="$(BINARIES_PATH)/dotnet-cli:$(PATH)" ; \ - $(BUILD_CMD) src/Compilers/CSharp/CscCore && \ - $(BUILD_CMD) src/Compilers/VisualBasic/VbcCore && \ - mkdir -p $(BOOTSTRAP_PATH)/csc && mkdir -p $(BOOTSTRAP_PATH)/vbc && \ - dotnet publish -c $(BUILD_CONFIGURATION) -r $(RUNTIME_ID) src/Compilers/CSharp/CscCore -o $(BOOTSTRAP_PATH)/csc && \ - dotnet publish -c $(BUILD_CONFIGURATION) -r $(RUNTIME_ID) src/Compilers/VisualBasic/VbcCore -o $(BOOTSTRAP_PATH)/vbc - rm -rf Binaries/$(BUILD_CONFIGURATION) - -test: - @export PATH="$(BINARIES_PATH)/dotnet-cli:$(PATH)" ; \ - export HOME="$(HOME_DIR)" ; \ - dotnet publish -r $(RUNTIME_ID) src/Test/DeployCoreClrTestRuntime -o $(BINARIES_PATH)/$(BUILD_CONFIGURATION)/CoreClrTest -p:RoslynRuntimeIdentifier=$(RUNTIME_ID) && \ - build/scripts/tests.sh $(BUILD_CONFIGURATION) - -restore: $(DOTNET) - export PATH="$(BINARIES_PATH)/dotnet-cli:$(PATH)" ; \ - ./build/scripts/restore.sh - -$(DOTNET): - mkdir -p $(BINARIES_PATH) ; \ - pushd $(BINARIES_PATH) ; \ - curl -O https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/dotnet-install.sh && \ - chmod +x dotnet-install.sh && \ - ./dotnet-install.sh --version "$(DOTNET_VERSION)" --install-dir "$(BINARIES_PATH)/dotnet-cli" - - -clean: - @rm -rf Binaries diff --git a/build/scripts/obtain_dotnet.sh b/build/scripts/obtain_dotnet.sh new file mode 100644 index 0000000000000..7410d0811171f --- /dev/null +++ b/build/scripts/obtain_dotnet.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +# Copyright (c) .NET Foundation and contributors. All rights reserved. +# Licensed under the MIT license. See LICENSE file in the project root for full license information. + +# Source this script to ensure dotnet is installed and on the path. +# If the FORCE_DOWNLOAD environment variable is set to "true", the system's dotnet install is ignored, +# and dotnet is downloaded and installed locally. + +set -e +set -u + +# check if `dotnet` is already on the PATH +if command -v dotnet >/dev/null 2>&1 +then + if [[ "${FORCE_DOWNLOAD:-false}" != true ]] + then + exit 0 + fi +fi + +# This is a function to keep variable assignments out of the parent script (that is sourcing this file) +install_dotnet () { + # Download and install `dotnet` locally + local DOTNET_VERSION=1.0.1 + local THIS_DIR=$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd) + local DOTNET_PATH=${THIS_DIR}/../../Binaries/dotnet-cli + + if [[ ! -x "${DOTNET_PATH}/dotnet" ]] + then + echo "Downloading and installing .NET CLI version ${DOTNET_VERSION} to ${DOTNET_PATH}" + curl https://raw.githubusercontent.com/dotnet/cli/rel/${DOTNET_VERSION}/scripts/obtain/dotnet-install.sh | \ + /usr/bin/env bash -s -- --version "${DOTNET_VERSION}" --install-dir "${DOTNET_PATH}" + else + echo "Skipping download of .NET CLI: Already installed at ${DOTNET_PATH}" + fi + + export PATH=${DOTNET_PATH}:${PATH} +} +install_dotnet diff --git a/build/scripts/tests.sh b/build/scripts/tests.sh index 2db9437ca5f4c..51b2a8d00ff1b 100755 --- a/build/scripts/tests.sh +++ b/build/scripts/tests.sh @@ -1,20 +1,29 @@ #!/usr/bin/env bash +# Copyright (c) .NET Foundation and contributors. All rights reserved. +# Licensed under the MIT license. See LICENSE file in the project root for full license information. -BUILD_CONFIGURATION=$1 +set -e +set -u -# This function will update the PATH variable to put the desired -# version of Mono ahead of the system one. +BUILD_CONFIGURATION=${1:-Debug} -cd Binaries/$BUILD_CONFIGURATION/CoreClrTest +THIS_DIR=$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd) +BINARIES_PATH=${THIS_DIR}/../../Binaries +SRC_PATH=${THIS_DIR}/../../src +TEST_DIR=${BINARIES_PATH}/${BUILD_CONFIGURATION}/CoreClrTest -chmod +x ./corerun +RUNTIME_ID=$(dotnet --info | awk '/RID:/{print $2;}') + +BUILD_ARGS="-c ${BUILD_CONFIGURATION} -r ${RUNTIME_ID} /consoleloggerparameters:Verbosity=minimal;summary /p:RoslynRuntimeIdentifier=${RUNTIME_ID}" +dotnet publish ${SRC_PATH}/Test/DeployCoreClrTestRuntime -o ${TEST_DIR} ${BUILD_ARGS} + +cd ${TEST_DIR} mkdir -p xUnitResults -./corerun ./xunit.console.netcore.exe *.UnitTests.dll -parallel all -xml xUnitResults/TestResults.xml +dotnet exec ./xunit.console.netcore.exe *.UnitTests.dll -parallel all -xml xUnitResults/TestResults.xml if [ $? -ne 0 ]; then echo Unit test failed exit 1 fi - diff --git a/cibuild.sh b/cibuild.sh index 7781ddb5f0c9f..c341c62233751 100755 --- a/cibuild.sh +++ b/cibuild.sh @@ -1,5 +1,9 @@ #!/usr/bin/env bash +# Copyright (c) .NET Foundation and contributors. All rights reserved. +# Licensed under the MIT license. See LICENSE file in the project root for full license information. + set -e +set -u usage() { @@ -9,23 +13,22 @@ usage() echo "Options" echo " --debug Build Debug (default)" echo " --release Build Release" + echo " --cleanrun Clean the project before building" echo " --skiptest Do not run tests" - echo " --skipcrossgen Do not crossgen the bootstrapped compiler" echo " --skipcommitprinting Do not print commit information" - echo " --nocache Force download of toolsets" } +THIS_DIR=$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd) +BINARIES_PATH=${THIS_DIR}/Binaries +BOOTSTRAP_PATH=${BINARIES_PATH}/Bootstrap +SRC_PATH=${THIS_DIR}/src +BUILD_LOG_PATH=${BINARIES_PATH}/Build.log + BUILD_CONFIGURATION=Debug -USE_CACHE=true +CLEAN_RUN=false SKIP_TESTS=false -SKIP_CROSSGEN=false SKIP_COMMIT_PRINTING=false -MAKE="make" -if [[ $OSTYPE == *[Bb][Ss][Dd]* ]]; then - MAKE="gmake" -fi - # LTTNG is the logging infrastructure used by coreclr. Need this variable set # so it doesn't output warnings to the console. export LTTNG_HOME=$HOME @@ -51,18 +54,14 @@ do BUILD_CONFIGURATION=Release shift 1 ;; - --nocache) - USE_CACHE=false + --cleanrun) + CLEAN_RUN=true shift 1 ;; --skiptests) SKIP_TESTS=true shift 1 ;; - --skipcrossgen) - SKIP_CROSSGEN=true - shift 1 - ;; --skipcommitprinting) SKIP_COMMIT_PRINTING=true shift 1 @@ -74,8 +73,6 @@ do esac done -MAKE_ARGS="BUILD_CONFIGURATION=$BUILD_CONFIGURATION SKIP_CROSSGEN=$SKIP_CROSSGEN" - if [ "$CLEAN_RUN" == "true" ]; then echo Clean out the enlistment git clean -dxf . @@ -86,13 +83,33 @@ if [ "$SKIP_COMMIT_PRINTING" == "false" ]; then git show --no-patch --pretty=raw HEAD fi -echo Building Bootstrap -$MAKE bootstrap $MAKE_ARGS +# obtain_dotnet.sh puts the right dotnet on the PATH +FORCE_DOWNLOAD=true +source ${THIS_DIR}/build/scripts/obtain_dotnet.sh -echo Building CrossPlatform.sln -$MAKE all $MAKE_ARGS BOOTSTRAP=true BUILD_LOG_PATH=Binaries/Build.log +RUNTIME_ID=$(dotnet --info | awk '/RID:/{print $2;}') +echo "Using Runtime Identifier: ${RUNTIME_ID}" -if [ "$SKIP_TESTS" == "false" ]; then - $MAKE test $MAKE_ARGS -fi +RESTORE_ARGS="-r ${RUNTIME_ID} -v Minimal --disable-parallel" +echo "Restoring BaseToolset.csproj" +dotnet restore ${RESTORE_ARGS} ${THIS_DIR}/build/ToolsetPackages/BaseToolset.csproj +echo "Restoring CrossPlatform.sln" +dotnet restore ${RESTORE_ARGS} ${THIS_DIR}/CrossPlatform.sln + +BUILD_ARGS="-c ${BUILD_CONFIGURATION} -r ${RUNTIME_ID} /nologo /consoleloggerparameters:Verbosity=minimal;summary /filelogger /fileloggerparameters:Verbosity=normal;logFile=${BUILD_LOG_PATH} /p:RoslynRuntimeIdentifier=${RUNTIME_ID}" +echo "Building bootstrap CscCore" +dotnet publish ${SRC_PATH}/Compilers/CSharp/CscCore -o ${BOOTSTRAP_PATH}/csc ${BUILD_ARGS} +echo "Building bootstrap VbcCore" +dotnet publish ${SRC_PATH}/Compilers/VisualBasic/VbcCore -o ${BOOTSTRAP_PATH}/vbc ${BUILD_ARGS} +rm -rf ${BINARIES_PATH}/${BUILD_CONFIGURATION} +BUILD_ARGS+=" /p:CscToolPath=${BOOTSTRAP_PATH}/csc /p:CscToolExe=csc /p:VbcToolPath=${BOOTSTRAP_PATH}/vbc /p:VbcToolExe=vbc" + +echo "Building CrossPlatform.sln" +dotnet build ${THIS_DIR}/CrossPlatform.sln ${BUILD_ARGS} + +if [[ "${SKIP_TESTS}" == false ]] +then + echo "Running tests" + ${THIS_DIR}/build/scripts/tests.sh ${BUILD_CONFIGURATION} +fi diff --git a/docs/infrastructure/cross-platform.md b/docs/infrastructure/cross-platform.md index 9d5be313efd0a..c24fbff412a1b 100644 --- a/docs/infrastructure/cross-platform.md +++ b/docs/infrastructure/cross-platform.md @@ -4,26 +4,15 @@ Linux and Mac support for developing Roslyn is very much a work in progress. Not everything is supported at the moment and the steps detailed on this page will change very frequently. If this is an area you are interested in then please check back frequently for updates. -## Building using a pre-made toolset +## Building -Right now Roslyn builds on *nix using a mix of Mono and CoreCLR. Patching the right Mono version and acquiring all the tools -can be very difficult, so we've saved pre-built versions on Azure. +Build all cross-platform projects with: `dotnet build CrossPlatform.sln`. -Running `make` should download all these toolset binaries and kick off a build using MSBuild running on Mono. +If you do not have a system-wide `dotnet` install, you can obtain one with `./build/scripts/obtain_dotnet.sh`. This will install a compatible version of the CLI to `./Binaries/dotnet-cli` - add this to your PATH before trying to build `CrossPlatform.sln`. Alternatively, sourcing the script with `source ./build/scripts/obtain_dotnet.sh` will add it to your PATH for you. ## Using the compiler -After building there should be at least two versions of `csc.exe` in your output directory. - -The first is in the `Binaries/Debug` directory. This is the "full .NET framework" version. That means it expects to run on a -full .NET framework, like either the Windows .NET framework or Mono. You would run this like you run other mono programs, i.e. -`mono csc.exe`. - -The second copy is in the `Binaries/Debug/csccore` directory. This is a version running directly on CoreCLR -- no Mono necessary. -Just run `csc` in that directory. Note that this version includes a copy of CoreCLR in the output directory, so it is not portable. -The version of CoreCLR copied is specific to whatever machine you built with, so if you're running OS X, this will only run on OS X. -Similarly with Linux (and whatever distro you're using). - +After building, there will be a `csc` in the `Binaries/Debug/Exes/CscCore` directory. ### Known issues when running `csc.exe` diff --git a/docs/infrastructure/unix-toolset.md b/docs/infrastructure/unix-toolset.md deleted file mode 100644 index 7946c32097366..0000000000000 --- a/docs/infrastructure/unix-toolset.md +++ /dev/null @@ -1,29 +0,0 @@ -Building a new Unix toolset -==== -This document describes building a new toolset for use in Mac or Linux. -Because the toolsets contain various targets and reference assemblies that -only exist on Windows, the toolsets currently must be built on Windows. - -### Building Roslyn Toolset -The new *toolset name* will be chosen as one of the follownig: - -- Linux: roslyn.linux.`` -- Mac: roslyn.mac.`` - -The value of *version number* will simply be the one number higher than the current version number of the toolset. - -To build the toolset do the following: - -- If necessary, make modifications to the dependencies in the - `build/MSBuildToolset/project.json` file to bring in anything new. -- Run the `build/MSBuildToolset/build-toolset.ps1` file. -- The script produces two zip files in bin\Debug\netcoreapp1.0 subdirectory: - - Rename `osx.10.10-x64.zip` to roslyn.mac.`.zip` - - Rename `ubuntu.14.04-x64.zip` to roslyn.linux.`.zip` -- Upload the files to the Azure in the dotnetci storage account in the roslyn container: - -``` -azcopy /Pattern:*.zip /Source:build\MSBuildToolset\bin\Debug\netcoreapp1.0 /Dest:https://dotnetci.blob.core.windows.net/roslyn /DestKey:<> -``` - -- Send a PR to change [Makefile](https://github.com/dotnet/roslyn/blob/master/Makefile) to use the new toolset. From fb30b4d4a91107e2c666a3d06629564e23e9313b Mon Sep 17 00:00:00 2001 From: Ashley Hauck Date: Wed, 26 Jul 2017 18:24:00 +0000 Subject: [PATCH 026/205] Remove unused nocache flag from CI --- netci.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/netci.groovy b/netci.groovy index 6be39abf538ab..32bd53b24de9f 100644 --- a/netci.groovy +++ b/netci.groovy @@ -103,7 +103,7 @@ commitPullList.each { isPr -> def myJob = job(jobName) { description("Ubuntu 14.04 tests") steps { - shell("./cibuild.sh --nocache --debug") + shell("./cibuild.sh --debug") } } @@ -120,7 +120,7 @@ commitPullList.each { isPr -> def myJob = job(jobName) { description("Ubuntu 16.04 tests") steps { - shell("./cibuild.sh --nocache --debug") + shell("./cibuild.sh --debug") } } @@ -137,7 +137,7 @@ commitPullList.each { isPr -> def myJob = job(jobName) { description("Mac tests") steps { - shell("./cibuild.sh --nocache --debug") + shell("./cibuild.sh --debug") } } From e7f382229fb96a0ab109e2f5094363ed038afabe Mon Sep 17 00:00:00 2001 From: Ravi Chande Date: Wed, 26 Jul 2017 11:27:43 -0700 Subject: [PATCH 027/205] Add WorkItem attribute to SigHelp test --- .../IntegrationTests/VisualBasic/BasicSignatureHelp.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/VisualStudio/IntegrationTest/IntegrationTests/VisualBasic/BasicSignatureHelp.cs b/src/VisualStudio/IntegrationTest/IntegrationTests/VisualBasic/BasicSignatureHelp.cs index e94dc0e3b9ab3..d71caaec7c663 100644 --- a/src/VisualStudio/IntegrationTest/IntegrationTests/VisualBasic/BasicSignatureHelp.cs +++ b/src/VisualStudio/IntegrationTest/IntegrationTests/VisualBasic/BasicSignatureHelp.cs @@ -180,8 +180,9 @@ End Sub VisualStudio.Editor.Verify.CurrentParameter("b", ""); } + [WorkItem(741415, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems?id=741415&fullScreen=true&_a=edit")] [Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)] - public void BufferTextReplacedWithSigHelpActiveWithLengthOfUpdatedTextLessThanPositionOfInvocationExpression() + public void HandleBufferTextChangesDuringComputation() { SetUpEditor(@" Class C From 6c5486cda2c8b70690f55c3ce23eadb12c346769 Mon Sep 17 00:00:00 2001 From: Ashley Hauck Date: Wed, 26 Jul 2017 19:49:25 +0000 Subject: [PATCH 028/205] Temporarily ignore --nocache flag Ignoring until the netci.groovy change gets merged, at which point another PR can be made to remove this ignore. --- cibuild.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cibuild.sh b/cibuild.sh index c341c62233751..a5fbecec5fb8a 100755 --- a/cibuild.sh +++ b/cibuild.sh @@ -66,6 +66,11 @@ do SKIP_COMMIT_PRINTING=true shift 1 ;; + --nocache) + # Temporarily ignore this argument until the change to netci.groovy gets merged. + # A follow-up PR will be made to remove this ignore. + shift 1 + ;; *) usage exit 1 From 4f60a212080074441c3840de73d757e71c6c3237 Mon Sep 17 00:00:00 2001 From: Elijah Date: Sun, 4 Jun 2017 22:34:08 +0100 Subject: [PATCH 029/205] Add unit tests for switch case casting --- .../Semantics/SpeculationAnalyzerTests.cs | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/src/EditorFeatures/CSharpTest/Semantics/SpeculationAnalyzerTests.cs b/src/EditorFeatures/CSharpTest/Semantics/SpeculationAnalyzerTests.cs index 2d25b30fa3a10..0d4f10e957122 100644 --- a/src/EditorFeatures/CSharpTest/Semantics/SpeculationAnalyzerTests.cs +++ b/src/EditorFeatures/CSharpTest/Semantics/SpeculationAnalyzerTests.cs @@ -340,6 +340,54 @@ public enum Directions { North, East, South, West } } ", "Directions.South", semanticChanges: false); } + [Fact, WorkItem(19987, "https://github.com/dotnet/roslyn/issues/19987")] + public void SpeculationAnalyzerSwitchCaseWithRedundantCast() + { + Test(@" +class Program +{ + static void Main(string[] arts) + { + var x = 1f; + switch (x) + { + case [|(float) 1|]: + System.Console.WriteLine(""one""); + break; + + default: + System.Console.WriteLine(""not one""); + break; + } + } +} + ", "1", semanticChanges: false); + } + + [Fact, WorkItem(19987, "https://github.com/dotnet/roslyn/issues/19987")] + public void SpeculationAnalyzerSwitchCaseWithRequiredCast() + { + Test(@" +class Program +{ + static void Main(string[] arts) + { + object x = 1f; + switch (x) + { + case [|(float) 1|]: // without the case, object x does not match int 1 + System.Console.WriteLine(""one""); + break; + + default: + System.Console.WriteLine(""not one""); + break; + } + } +} + ", "1", semanticChanges: true); + } + protected override SyntaxTree Parse(string text) { return SyntaxFactory.ParseSyntaxTree(text); From 933624a14fb25376a65ec1442574aef4ac768765 Mon Sep 17 00:00:00 2001 From: Elijah Date: Sun, 11 Jun 2017 13:54:27 +0100 Subject: [PATCH 030/205] add a rule for switch case casting --- .../Portable/Utilities/SpeculationAnalyzer.cs | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/Workspaces/CSharp/Portable/Utilities/SpeculationAnalyzer.cs b/src/Workspaces/CSharp/Portable/Utilities/SpeculationAnalyzer.cs index ad4277e2ed3bc..de0a7eccb5bbf 100644 --- a/src/Workspaces/CSharp/Portable/Utilities/SpeculationAnalyzer.cs +++ b/src/Workspaces/CSharp/Portable/Utilities/SpeculationAnalyzer.cs @@ -379,6 +379,37 @@ protected override bool ReplacementChangesSemanticsForNodeLanguageSpecific(Synta } } } + else if (currentOriginalNode.Kind() == SyntaxKind.CaseSwitchLabel) + { + var originalCaseSwitchLabel = (CaseSwitchLabelSyntax)currentOriginalNode; + var newCaseSwitchLabel = (CaseSwitchLabelSyntax)currentReplacedNode; + + // If case label is changing, then need to check if the semantics will change for the switch expression. + // e.g. if switch expression is "object x = 1f", "case 1:" and "case (float) 1:" are different. + var originalCaseType = this.OriginalSemanticModel.GetTypeInfo(previousOriginalNode, this.CancellationToken).Type; + var newCaseType = this.SpeculativeSemanticModel.GetTypeInfo(previousReplacedNode, this.CancellationToken).Type; + + if (originalCaseType == newCaseType) + return false; + + var oldSwitchStatement = originalCaseSwitchLabel?.Parent?.Parent as SwitchStatementSyntax; + var newSwitchStatement = newCaseSwitchLabel?.Parent?.Parent as SwitchStatementSyntax; + if (oldSwitchStatement == null || newSwitchStatement == null) + { + return false; + } + + var originalConversion = this.OriginalSemanticModel.ClassifyConversion(oldSwitchStatement.Expression, originalCaseType); + var newConversion = this.SpeculativeSemanticModel.ClassifyConversion(newSwitchStatement.Expression, newCaseType); + + if (originalConversion.Exists != newConversion.Exists) + { + return true; + } + + // if the conversions are equal and the target types are different, then semantics changed. + return originalConversion == newConversion; + } else if (currentOriginalNode.Kind() == SyntaxKind.SwitchStatement) { var originalSwitchStatement = (SwitchStatementSyntax)currentOriginalNode; From e8396a0e96087e9d0ea4e2eccdf94218b2b300f1 Mon Sep 17 00:00:00 2001 From: Elijah Date: Sun, 11 Jun 2017 14:01:17 +0100 Subject: [PATCH 031/205] modify comments --- .../CSharp/Portable/Utilities/SpeculationAnalyzer.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Workspaces/CSharp/Portable/Utilities/SpeculationAnalyzer.cs b/src/Workspaces/CSharp/Portable/Utilities/SpeculationAnalyzer.cs index de0a7eccb5bbf..bb7798ef2b0d4 100644 --- a/src/Workspaces/CSharp/Portable/Utilities/SpeculationAnalyzer.cs +++ b/src/Workspaces/CSharp/Portable/Utilities/SpeculationAnalyzer.cs @@ -385,7 +385,7 @@ protected override bool ReplacementChangesSemanticsForNodeLanguageSpecific(Synta var newCaseSwitchLabel = (CaseSwitchLabelSyntax)currentReplacedNode; // If case label is changing, then need to check if the semantics will change for the switch expression. - // e.g. if switch expression is "object x = 1f", "case 1:" and "case (float) 1:" are different. + // e.g. if switch expression is "switch(x)" where "object x = 1f", then "case 1:" and "case (float) 1:" are different. var originalCaseType = this.OriginalSemanticModel.GetTypeInfo(previousOriginalNode, this.CancellationToken).Type; var newCaseType = this.SpeculativeSemanticModel.GetTypeInfo(previousReplacedNode, this.CancellationToken).Type; @@ -402,12 +402,14 @@ protected override bool ReplacementChangesSemanticsForNodeLanguageSpecific(Synta var originalConversion = this.OriginalSemanticModel.ClassifyConversion(oldSwitchStatement.Expression, originalCaseType); var newConversion = this.SpeculativeSemanticModel.ClassifyConversion(newSwitchStatement.Expression, newCaseType); + // if conversion only exists for either original or new, then semantics changed. if (originalConversion.Exists != newConversion.Exists) { return true; } - // if the conversions are equal and the target types are different, then semantics changed. + // Same conversion cannot result in both originalCaseType and newCaseType, which means the semantics changed + // (since originalCaseType != newCaseType) return originalConversion == newConversion; } else if (currentOriginalNode.Kind() == SyntaxKind.SwitchStatement) From d1d660d18e8e008ad1d0b7ad71accd940eadb5f1 Mon Sep 17 00:00:00 2001 From: Elijah Date: Wed, 26 Jul 2017 21:20:11 +0100 Subject: [PATCH 032/205] Remove unnecessary casts --- .../CSharp/Portable/Utilities/SpeculationAnalyzer.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Workspaces/CSharp/Portable/Utilities/SpeculationAnalyzer.cs b/src/Workspaces/CSharp/Portable/Utilities/SpeculationAnalyzer.cs index bb7798ef2b0d4..5659dc5c614b3 100644 --- a/src/Workspaces/CSharp/Portable/Utilities/SpeculationAnalyzer.cs +++ b/src/Workspaces/CSharp/Portable/Utilities/SpeculationAnalyzer.cs @@ -392,12 +392,8 @@ protected override bool ReplacementChangesSemanticsForNodeLanguageSpecific(Synta if (originalCaseType == newCaseType) return false; - var oldSwitchStatement = originalCaseSwitchLabel?.Parent?.Parent as SwitchStatementSyntax; - var newSwitchStatement = newCaseSwitchLabel?.Parent?.Parent as SwitchStatementSyntax; - if (oldSwitchStatement == null || newSwitchStatement == null) - { - return false; - } + var oldSwitchStatement = (SwitchStatementSyntax) originalCaseSwitchLabel.Parent.Parent; + var newSwitchStatement = (SwitchStatementSyntax) newCaseSwitchLabel.Parent.Parent; var originalConversion = this.OriginalSemanticModel.ClassifyConversion(oldSwitchStatement.Expression, originalCaseType); var newConversion = this.SpeculativeSemanticModel.ClassifyConversion(newSwitchStatement.Expression, newCaseType); From 625a736d3e4212b109cedd2ac61744567484b2c8 Mon Sep 17 00:00:00 2001 From: Heejae Chang Date: Wed, 26 Jul 2017 13:49:25 -0700 Subject: [PATCH 033/205] replaced crash to NFW. it will now show info bar and throw cancellation exception --- .../TestUtilities/Remote/WatsonReporter.cs | 50 +++++----- .../Core/Next/Remote/JsonRpcClient.cs | 94 +++++++++++++------ 2 files changed, 92 insertions(+), 52 deletions(-) diff --git a/src/EditorFeatures/TestUtilities/Remote/WatsonReporter.cs b/src/EditorFeatures/TestUtilities/Remote/WatsonReporter.cs index 48d79a4cee667..f760b6b901192 100644 --- a/src/EditorFeatures/TestUtilities/Remote/WatsonReporter.cs +++ b/src/EditorFeatures/TestUtilities/Remote/WatsonReporter.cs @@ -1,23 +1,29 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - - using System; - - namespace Microsoft.VisualStudio.LanguageServices.Implementation - { - /// - /// Mock to make test project build - /// - internal class WatsonReporter - { - public static void Report(string description, Exception exception, Func callback) - { - // do nothing - } - - public interface IFaultUtility - { - void AddProcessDump(int pid); - void AddFile(string fullpathname); - } - } - } \ No newline at end of file + +using System; + +namespace Microsoft.VisualStudio.LanguageServices.Implementation +{ + /// + /// Mock to make test project build + /// + internal class WatsonReporter + { + public static void Report(string description, Exception exception, Func callback) + { + // do nothing + } + + public interface IFaultUtility + { + void AddProcessDump(int pid); + void AddFile(string fullpathname); + } + } + + // Mock resource to make test project build + internal static class ServicesVSResources + { + public const string Unfortunately_a_process_used_by_Visual_Studio_has_encountered_an_unrecoverable_error_We_recommend_saving_your_work_and_then_closing_and_restarting_Visual_Studio = ""; + } +} diff --git a/src/VisualStudio/Core/Next/Remote/JsonRpcClient.cs b/src/VisualStudio/Core/Next/Remote/JsonRpcClient.cs index f8d23432149eb..5d4f0bd4204cb 100644 --- a/src/VisualStudio/Core/Next/Remote/JsonRpcClient.cs +++ b/src/VisualStudio/Core/Next/Remote/JsonRpcClient.cs @@ -8,9 +8,10 @@ using System.Threading.Tasks; using StreamJsonRpc; using Microsoft.CodeAnalysis.ErrorReporting; +using Microsoft.CodeAnalysis.Extensions; using Microsoft.CodeAnalysis.Remote; -using Roslyn.Utilities; using Microsoft.VisualStudio.LanguageServices.Implementation; +using Roslyn.Utilities; namespace Microsoft.VisualStudio.LanguageServices.Remote { @@ -23,9 +24,6 @@ internal class JsonRpcClient : IDisposable private readonly JsonRpc _rpc; private readonly CancellationToken _cancellationToken; - private JsonRpcDisconnectedEventArgs _debuggingLastDisconnectReason; - private string _debuggingLastDisconnectCallstack; - public JsonRpcClient( Stream stream, object callbackTarget, bool useThisAsCallback, CancellationToken cancellationToken) { @@ -55,7 +53,10 @@ public async Task InvokeAsync(string targetName, params object[] arguments) // cancellation exception here. if any exception is thrown unrelated to cancellation, then we will rethrow // the exception _cancellationToken.ThrowIfCancellationRequested(); - throw; + + // this is to make us not crash. we should remove this once we figure out + // what is causing this + ThrowOwnCancellationToken(); } } @@ -74,7 +75,11 @@ public async Task InvokeAsync(string targetName, params object[] arguments // cancellation exception here. if any exception is thrown unrelated to cancellation, then we will rethrow // the exception _cancellationToken.ThrowIfCancellationRequested(); - throw; + + // this is to make us not crash. we should remove this once we figure out + // what is causing this + ThrowOwnCancellationToken(); + return Contract.FailWithReturn("can't reach here"); } } @@ -88,6 +93,33 @@ public Task InvokeAsync(string targetName, IEnumerable arguments, return Extensions.InvokeAsync(_rpc, targetName, arguments, funcWithDirectStreamAsync, _cancellationToken); } + public void Dispose() + { + OnDisposed(); + + _rpc.Dispose(); + } + + protected void StartListening() + { + // due to this issue - https://github.com/dotnet/roslyn/issues/16900#issuecomment-277378950 + // _rpc need to be explicitly started + _rpc.StartListening(); + } + + protected virtual void OnDisposed() + { + // do nothing + } + + // these are for debugging purpose. once we find out root cause of the issue + // we will remove these. + private static JsonRpcDisconnectedEventArgs s_debuggingLastDisconnectReason; + private static string s_debuggingLastDisconnectCallstack; + + private JsonRpcDisconnectedEventArgs _debuggingLastDisconnectReason; + private string _debuggingLastDisconnectCallstack; + private bool ReportUnlessCanceled(Exception ex, CancellationToken cancellationToken) { if (cancellationToken.IsCancellationRequested) @@ -95,16 +127,37 @@ private bool ReportUnlessCanceled(Exception ex, CancellationToken cancellationTo return true; } - // save extra info using NFW - ReportExtraInfoAsNFW(ex); + s_debuggingLastDisconnectReason = _debuggingLastDisconnectReason; + s_debuggingLastDisconnectCallstack = _debuggingLastDisconnectCallstack; - // make it to explicitly crash to get better info - FatalError.Report(ex); + // send NFW to figure out why this is happening + ReportExtraInfoAsNFW(ex); GC.KeepAlive(_debuggingLastDisconnectReason); GC.KeepAlive(_debuggingLastDisconnectCallstack); - return Contract.FailWithReturn("shouldn't be able to reach here"); + return true; + } + + private static bool s_reported = false; + + private void ThrowOwnCancellationToken() + { + if (CodeAnalysis.PrimaryWorkspace.Workspace != null && !s_reported) + { + // do not report it multiple times + s_reported = true; + + // use info bar to show warning to users + CodeAnalysis.PrimaryWorkspace.Workspace.Services.GetService()?.ShowGlobalErrorInfo( + ServicesVSResources.Unfortunately_a_process_used_by_Visual_Studio_has_encountered_an_unrecoverable_error_We_recommend_saving_your_work_and_then_closing_and_restarting_Visual_Studio); + } + + // create its own cancellation token and throw it + var ownCancellationSource = new CancellationTokenSource(); + ownCancellationSource.Cancel(); + + ownCancellationSource.Token.ThrowIfCancellationRequested(); } private void ReportExtraInfoAsNFW(Exception ex) @@ -150,25 +203,6 @@ private void ReportExtraInfoAsNFW(Exception ex) }); } - public void Dispose() - { - OnDisposed(); - - _rpc.Dispose(); - } - - protected void StartListening() - { - // due to this issue - https://github.com/dotnet/roslyn/issues/16900#issuecomment-277378950 - // _rpc need to be explicitly started - _rpc.StartListening(); - } - - protected virtual void OnDisposed() - { - // do nothing - } - protected virtual void OnDisconnected(object sender, JsonRpcDisconnectedEventArgs e) { // do nothing From 0ba3f250e70f788349180e95f986628007c474b9 Mon Sep 17 00:00:00 2001 From: Elijah Date: Wed, 26 Jul 2017 22:22:51 +0100 Subject: [PATCH 034/205] code style correction --- .../CSharp/Portable/Utilities/SpeculationAnalyzer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Workspaces/CSharp/Portable/Utilities/SpeculationAnalyzer.cs b/src/Workspaces/CSharp/Portable/Utilities/SpeculationAnalyzer.cs index 5659dc5c614b3..1da68fd1e4f0c 100644 --- a/src/Workspaces/CSharp/Portable/Utilities/SpeculationAnalyzer.cs +++ b/src/Workspaces/CSharp/Portable/Utilities/SpeculationAnalyzer.cs @@ -392,8 +392,8 @@ protected override bool ReplacementChangesSemanticsForNodeLanguageSpecific(Synta if (originalCaseType == newCaseType) return false; - var oldSwitchStatement = (SwitchStatementSyntax) originalCaseSwitchLabel.Parent.Parent; - var newSwitchStatement = (SwitchStatementSyntax) newCaseSwitchLabel.Parent.Parent; + var oldSwitchStatement = (SwitchStatementSyntax)originalCaseSwitchLabel.Parent.Parent; + var newSwitchStatement = (SwitchStatementSyntax)newCaseSwitchLabel.Parent.Parent; var originalConversion = this.OriginalSemanticModel.ClassifyConversion(oldSwitchStatement.Expression, originalCaseType); var newConversion = this.SpeculativeSemanticModel.ClassifyConversion(newSwitchStatement.Expression, newCaseType); From bc1585d871b5e0620031de1a8196fdadd69e1a67 Mon Sep 17 00:00:00 2001 From: Andy Gocke Date: Sat, 15 Jul 2017 16:06:52 -0700 Subject: [PATCH 035/205] Refactor out LambdaRewriter.Analysis visitors Duplicate functionality of existing LambdaRewriter.Analysis visitors with the new Scope tree visitors and assert that the same results are produced. --- .../LambdaRewriter.Analysis.Tree.cs | 83 +++++++++++++----- .../LambdaRewriter/LambdaRewriter.Analysis.cs | 86 ++++++++++++++++--- .../Lowering/LambdaRewriter/LambdaRewriter.cs | 61 ++++++++----- 3 files changed, 175 insertions(+), 55 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.Analysis.Tree.cs b/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.Analysis.Tree.cs index b06955cf638ba..28790d750e1f8 100644 --- a/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.Analysis.Tree.cs +++ b/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.Analysis.Tree.cs @@ -7,7 +7,6 @@ using Microsoft.CodeAnalysis.CSharp.Symbols; using Microsoft.CodeAnalysis.PooledObjects; using Roslyn.Utilities; -using System.Linq; namespace Microsoft.CodeAnalysis.CSharp { @@ -40,7 +39,13 @@ public sealed class Scope /// in this scope or nested scopes. "Declared" refers to the start of the variable /// lifetime (which, at this point in lowering, should be equivalent to lexical scope). /// - public ArrayBuilder DeclaredVariables { get; } = ArrayBuilder.GetInstance(); + /// + /// It's important that this is a set and that enumeration order is deterministic. We loop + /// over this list to generate proxies and if we loop out of order this will cause + /// non-deterministic compilation, and if we generate duplicate proxies we'll generate + /// wasteful code in the best case and incorrect code in the worst. + /// + public SetWithInsertionOrder DeclaredVariables { get; } = new SetWithInsertionOrder(); /// /// The bound node representing this scope. This roughly corresponds to the bound @@ -54,7 +59,7 @@ public sealed class Scope /// The closure that this scope is nested inside. Null if this scope is not nested /// inside a closure. /// - public Closure ContainingClosure { get; } + public Closure ContainingClosureOpt { get; } public Scope(Scope parent, BoundNode boundNode, Closure containingClosure) { @@ -62,7 +67,7 @@ public Scope(Scope parent, BoundNode boundNode, Closure containingClosure) Parent = parent; BoundNode = boundNode; - ContainingClosure = containingClosure; + ContainingClosureOpt = containingClosure; } public void Free() @@ -78,7 +83,6 @@ public void Free() closure.Free(); } Closures.Free(); - DeclaredVariables.Free(); } public override string ToString() => BoundNode.Syntax.GetText().ToString(); @@ -118,7 +122,7 @@ public void Free() /// Optimizes local functions such that if a local function only references other local functions /// that capture no variables, we don't need to create capture environments for any of them. /// - private void RemoveUnneededReferences() + private void RemoveUnneededReferences(ParameterSymbol thisParam) { var methodGraph = new MultiDictionary(); var capturesThis = new HashSet(); @@ -132,7 +136,7 @@ private void RemoveUnneededReferences() { methodGraph.Add(localFunc, closure.OriginalMethodSymbol); } - else if (capture == _topLevelMethod.ThisParameter) + else if (capture == thisParam) { if (capturesThis.Add(closure.OriginalMethodSymbol)) { @@ -168,7 +172,7 @@ private void RemoveUnneededReferences() } if (capturesThis.Contains(closure.OriginalMethodSymbol)) { - closure.CapturedVariables.Add(_topLevelMethod.ThisParameter); + closure.CapturedVariables.Add(thisParam); } }); } @@ -191,7 +195,7 @@ public static void VisitClosures(Scope scope, Action action) /// /// Builds a tree of nodes corresponding to a given method. - /// visits the bound tree and translates + /// visits the bound tree and translates /// information from the bound tree about variable scope, declared variables, and /// variable captures into the resulting tree. /// @@ -211,32 +215,53 @@ private class ScopeTreeBuilder : BoundTreeWalkerWithStackGuardWithoutRecursionOn /// private readonly SmallDictionary _localToScope = new SmallDictionary(); - private readonly Analysis _analysis; + private readonly MethodSymbol _topLevelMethod; - private ScopeTreeBuilder(Scope rootScope, Analysis analysis) + private bool _sawClosure = false; + + /// + /// If a local function is in the set, at some point in the code it is converted + /// to a delegate and should then not be optimized to a struct closure. + /// Also contains all lambdas (as they are converted to delegates implicitly). + /// + private readonly HashSet _methodsConvertedToDelegates; + + private ScopeTreeBuilder( + Scope rootScope, + MethodSymbol topLevelMethod, + HashSet methodsConvertedToDelegates) { Debug.Assert(rootScope != null); - Debug.Assert(analysis != null); + Debug.Assert(topLevelMethod != null); + Debug.Assert(methodsConvertedToDelegates != null); _currentScope = rootScope; - _analysis = analysis; + _topLevelMethod = topLevelMethod; + _methodsConvertedToDelegates = methodsConvertedToDelegates; } - public static Scope Build(BoundNode node, Analysis analysis) + public static Scope Build( + BoundNode node, + MethodSymbol topLevelMethod, + HashSet methodsConvertedToDelegates) { // This should be the top-level node Debug.Assert(node == FindNodeToAnalyze(node)); + Debug.Assert(topLevelMethod != null); var rootScope = new Scope(parent: null, boundNode: node, containingClosure: null); - var builder = new ScopeTreeBuilder(rootScope, analysis); + var builder = new ScopeTreeBuilder( + rootScope, + topLevelMethod, + methodsConvertedToDelegates); builder.Build(); - return rootScope; + return builder._sawClosure ? rootScope : null; } private void Build() { // Set up the current method locals - DeclareLocals(_currentScope, _analysis._topLevelMethod.Parameters); + DeclareLocals(_currentScope, _topLevelMethod.Parameters); Visit(_currentScope.BoundNode); } @@ -260,6 +285,11 @@ public override BoundNode VisitBlock(BoundBlock node) public override BoundNode VisitCatchBlock(BoundCatchBlock node) { + if (node.Locals.IsDefaultOrEmpty) + { + return base.VisitCatchBlock(node); + } + var oldScope = _currentScope; _currentScope = CreateOrReuseScope(node, node.Locals); var result = base.VisitCatchBlock(node); @@ -269,6 +299,11 @@ public override BoundNode VisitCatchBlock(BoundCatchBlock node) public override BoundNode VisitSequence(BoundSequence node) { + if (node.Locals.IsDefaultOrEmpty) + { + return base.VisitSequence(node); + } + var oldScope = _currentScope; _currentScope = CreateOrReuseScope(node, node.Locals); var result = base.VisitSequence(node); @@ -296,7 +331,7 @@ public override BoundNode VisitLambda(BoundLambda node) var oldInExpressionTree = _inExpressionTree; _inExpressionTree |= node.Type.IsExpressionTree(); - _analysis.MethodsConvertedToDelegates.Add(node.Symbol.OriginalDefinition); + _methodsConvertedToDelegates.Add(node.Symbol.OriginalDefinition); var result = VisitClosure(node.Symbol, node.Body); _inExpressionTree = oldInExpressionTree; @@ -323,7 +358,7 @@ public override BoundNode VisitDelegateCreationExpression(BoundDelegateCreationE // Use OriginalDefinition to strip generic type parameters var method = node.MethodOpt.OriginalDefinition; AddIfCaptured(method); - _analysis.MethodsConvertedToDelegates.Add(method); + _methodsConvertedToDelegates.Add(method); } return base.VisitDelegateCreationExpression(node); } @@ -342,13 +377,13 @@ public override BoundNode VisitLocal(BoundLocal node) public override BoundNode VisitBaseReference(BoundBaseReference node) { - AddIfCaptured(_analysis._topLevelMethod.ThisParameter); + AddIfCaptured(_topLevelMethod.ThisParameter); return base.VisitBaseReference(node); } public override BoundNode VisitThisReference(BoundThisReference node) { - var thisParam = _analysis._topLevelMethod.ThisParameter; + var thisParam = _topLevelMethod.ThisParameter; if (thisParam != null) { AddIfCaptured(thisParam); @@ -373,6 +408,8 @@ private BoundNode VisitClosure(MethodSymbol closureSymbol, BoundBlock body) { Debug.Assert((object)closureSymbol != null); + _sawClosure |= true; + // Closure is declared (lives) in the parent scope, but its // variables are in a nested scope var closure = new Closure(closureSymbol); @@ -426,11 +463,11 @@ private void AddIfCaptured(Symbol symbol) closure.CapturedVariables.Add(symbol); // Also mark captured in enclosing scopes - while (scope.ContainingClosure == closure) + while (scope.ContainingClosureOpt == closure) { scope = scope.Parent; } - closure = scope.ContainingClosure; + closure = scope.ContainingClosureOpt; } // Also record where the captured variable lives diff --git a/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.Analysis.cs b/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.Analysis.cs index c89d9dee02940..1d98fdb31c885 100644 --- a/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.Analysis.cs +++ b/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.Analysis.cs @@ -28,11 +28,6 @@ internal sealed partial class Analysis : BoundTreeWalkerWithStackGuardWithoutRec /// private bool _inExpressionLambda; - /// - /// Set to true of any lambda expressions were seen in the analyzed method body. - /// - public bool SeenLambda { get; private set; } - /// /// For each scope that defines variables, identifies the nearest enclosing scope that defines variables. /// @@ -116,12 +111,15 @@ public static Analysis Analyze(BoundNode node, MethodSymbol method) { var analysis = new Analysis(method); analysis.Analyze(node); - return analysis; + return analysis.ScopeTree == null ? null : analysis; } private void Analyze(BoundNode node) { - ScopeTree = ScopeTreeBuilder.Build(node, this); + ScopeTree = ScopeTreeBuilder.Build( + node, + _topLevelMethod, + MethodsConvertedToDelegates); _currentScope = FindNodeToAnalyze(node); Debug.Assert(!_inExpressionLambda); @@ -181,9 +179,9 @@ private static BoundNode FindNodeToAnalyze(BoundNode node) /// /// Create the optimized plan for the location of lambda methods and whether scopes need access to parent scopes /// - internal void ComputeLambdaScopesAndFrameCaptures() + internal void ComputeLambdaScopesAndFrameCaptures(ParameterSymbol thisParam) { - RemoveUnneededReferences(); + RemoveUnneededReferences(thisParam); LambdaScopes = new Dictionary(ReferenceEqualityComparer.Instance); NeedsParentFrame = new HashSet(); @@ -284,7 +282,76 @@ void RecordClosureScope(Scope innermost, Scope outermost, Closure closure) } } } + } + } + + /// + /// Walk up the scope tree looking for a variable declaration. + /// + public static Scope GetVariableDeclarationScope(Scope startingScope, Symbol variable) + { + if (variable is ParameterSymbol p && p.IsThis) + { + return null; + } + + var currentScope = startingScope; + while (currentScope != null) + { + if (variable.Kind == SymbolKind.Parameter || variable.Kind == SymbolKind.Local) + { + if (currentScope.DeclaredVariables.Contains(variable)) + { + return currentScope; + } + } + else + { + if (currentScope.Closures.Contains(c => variable == c.OriginalMethodSymbol)) + { + return currentScope; + } + } + currentScope = currentScope.Parent; + } + return null; + } + + /// + /// Find the parent of the corresponding to + /// the given . + /// + public static Scope GetScopeParent(Scope treeRoot, BoundNode scopeNode) + { + var correspondingScope = GetScopeWithMatchingBoundNode(treeRoot, scopeNode); + return correspondingScope.Parent; + } + + /// + /// Finds a with a matching + /// as the one given. + /// + public static Scope GetScopeWithMatchingBoundNode(Scope treeRoot, BoundNode node) + { + return Helper(treeRoot) ?? throw ExceptionUtilities.Unreachable; + + Scope Helper(Scope currentScope) + { + if (currentScope.BoundNode == node) + { + return currentScope; + } + + foreach (var nestedScope in currentScope.NestedScopes) + { + var found = Helper(nestedScope); + if (found != null) + { + return found; + } + } + return null; } } @@ -488,7 +555,6 @@ public override BoundNode VisitLocalFunctionStatement(BoundLocalFunctionStatemen private BoundNode VisitLambdaOrFunction(IBoundLambdaOrFunction node) { Debug.Assert((object)node.Symbol != null); - SeenLambda = true; var oldParent = _currentParent; var oldBlock = _currentScope; _currentParent = node.Symbol; diff --git a/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.cs b/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.cs index 6228f785c567a..189196ac0394e 100644 --- a/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.cs +++ b/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.cs @@ -228,13 +228,8 @@ public static BoundStatement Rewrite( Debug.Assert(compilationState.ModuleBuilderOpt != null); var analysis = Analysis.Analyze(loweredBody, method); - if (!analysis.SeenLambda) + if (analysis == null) { - // Unreachable anonymous functions are ignored by the analyzer. - // No closures or lambda methods are generated. - // E.g. - // int y = 0; - // var b = false && (from z in new X(y) select f(z + y)) return loweredBody; } @@ -252,7 +247,7 @@ public static BoundStatement Rewrite( diagnostics, assignLocals); - analysis.ComputeLambdaScopesAndFrameCaptures(); + analysis.ComputeLambdaScopesAndFrameCaptures(thisParameter); rewriter.MakeFrames(closureDebugInfoBuilder); // First, lower everything but references (calls, delegate conversions) @@ -341,8 +336,14 @@ private void MakeFrames(ArrayBuilder closureDebugInfo) foreach (var captured in capturedVars) { - if (!_analysis.VariableScope.TryGetValue(captured, out BoundNode captureScope)) + var declarationScope = Analysis.GetVariableDeclarationScope(scope, captured); + if (_analysis.VariableScope.TryGetValue(captured, out BoundNode captureScope)) { + Debug.Assert(declarationScope.BoundNode == captureScope); + } + else + { + Debug.Assert(declarationScope == null); continue; } @@ -357,7 +358,7 @@ private void MakeFrames(ArrayBuilder closureDebugInfo) continue; } - LambdaFrame frame = GetFrameForScope(captureScope, closureDebugInfo); + LambdaFrame frame = GetFrameForScope(declarationScope, closureDebugInfo); if (captured.Kind != SymbolKind.Method && !proxies.ContainsKey(captured)) { @@ -450,26 +451,28 @@ private bool OnlyCapturesThis( return result; } - private LambdaFrame GetFrameForScope(BoundNode scope, ArrayBuilder closureDebugInfo) + private LambdaFrame GetFrameForScope(Analysis.Scope scope, ArrayBuilder closureDebugInfo) { + var scopeBoundNode = scope.BoundNode; LambdaFrame frame; - if (!_frames.TryGetValue(scope, out frame)) + if (!_frames.TryGetValue(scopeBoundNode, out frame)) { - var syntax = scope.Syntax; + var syntax = scopeBoundNode.Syntax; Debug.Assert(syntax != null); DebugId methodId = GetTopLevelMethodId(); DebugId closureId = GetClosureId(syntax, closureDebugInfo); - var canBeStruct = !_analysis.ScopesThatCantBeStructs.Contains(scope); + var canBeStruct = !_analysis.ScopesThatCantBeStructs.Contains(scopeBoundNode); - var containingMethod = _analysis.ScopeOwner[scope]; + var containingMethod = scope.ContainingClosureOpt?.OriginalMethodSymbol ?? _topLevelMethod; + Debug.Assert(containingMethod == _analysis.ScopeOwner[scopeBoundNode]); if (_substitutedSourceMethod != null && containingMethod == _topLevelMethod) { containingMethod = _substitutedSourceMethod; } frame = new LambdaFrame(_topLevelMethod, containingMethod, canBeStruct, syntax, methodId, closureId); - _frames.Add(scope, frame); + _frames.Add(scopeBoundNode, frame); CompilationState.ModuleBuilderOpt.AddSynthesizedDefinition(ContainingType, frame); if (frame.Constructor != null) @@ -701,14 +704,20 @@ private BoundNode IntroduceFrame(BoundNode node, LambdaFrame frame, Func.GetInstance(); foreach (var variable in _analysis.CapturedVariables.Keys) { - BoundNode varNode; - if (!_analysis.VariableScope.TryGetValue(variable, out varNode) || varNode != node) + if (variable.Kind != SymbolKind.Method && + _analysis.VariableScope.TryGetValue(variable, out var varNode) && + varNode == node) { - continue; + variablesInThisScope.Add(variable); } - + } + Debug.Assert(variablesInThisScope.SequenceEqual(scope.DeclaredVariables)); + foreach (var variable in variablesInThisScope) + { InitVariableProxy(syntax, variable, framePointer, prologue); } @@ -1360,7 +1369,8 @@ private SynthesizedLambdaMethod RewriteLambdaOrLocalFunction( // strictly need `this`. if (_analysis.CanTakeRefParameters(node.Symbol)) { - lambdaScope = _analysis.ScopeParent[node.Body]; + lambdaScope = Analysis.GetScopeParent(_analysis.ScopeTree, node.Body)?.BoundNode; + Debug.Assert(lambdaScope == _analysis.ScopeParent[node.Body]); _ = _frames.TryGetValue(lambdaScope, out containerAsFrame); structClosures = GetStructClosures(containerAsFrame, lambdaScope); } @@ -1468,12 +1478,18 @@ private ImmutableArray GetStructClosures(LambdaFrame containerAsFram bool FindParentFrame(ref LambdaFrame container, ref BoundNode scope) { - while (_analysis.ScopeParent.TryGetValue(scope, out scope)) + var temp = Analysis.GetScopeParent(_analysis.ScopeTree, scope)?.BoundNode; + Debug.Assert(temp == null || _analysis.ScopeParent.TryGetValue(scope, out var tempScope) && tempScope == temp); + scope = temp; + while (scope != null) { if (_frames.TryGetValue(scope, out container)) { return true; } + temp = Analysis.GetScopeParent(_analysis.ScopeTree, scope)?.BoundNode; + Debug.Assert(temp == null || _analysis.ScopeParent.TryGetValue(scope, out tempScope) && tempScope == temp); + scope = temp; } return false; } @@ -1552,8 +1568,9 @@ private BoundNode RewriteLambdaConversion(BoundLambda node) // NOTE: We require "lambdaScope != null". // We do not want to introduce a field into an actual user's class (not a synthetic frame). + Debug.Assert(Analysis.GetScopeParent(_analysis.ScopeTree, node.Body).BoundNode == _analysis.ScopeParent[node.Body]); var shouldCacheInLoop = lambdaScope != null && - lambdaScope != _analysis.ScopeParent[node.Body] && + lambdaScope != Analysis.GetScopeParent(_analysis.ScopeTree, node.Body).BoundNode && InLoopOrLambda(node.Syntax, lambdaScope.Syntax); if (shouldCacheForStaticMethod || shouldCacheInLoop) From 4fba0266be8dc2feb4814cc67fd6829ccc887d5a Mon Sep 17 00:00:00 2001 From: Andy Gocke Date: Tue, 18 Jul 2017 00:40:19 -0700 Subject: [PATCH 036/205] Remove old visitors --- .../Portable/CSharpResources.Designer.cs | 2 +- .../CSharp/Portable/CSharpResources.resx | 2 +- .../LambdaRewriter.Analysis.Tree.cs | 118 +++--- .../LambdaRewriter/LambdaRewriter.Analysis.cs | 372 ++---------------- .../Lowering/LambdaRewriter/LambdaRewriter.cs | 71 ++-- 5 files changed, 133 insertions(+), 432 deletions(-) diff --git a/src/Compilers/CSharp/Portable/CSharpResources.Designer.cs b/src/Compilers/CSharp/Portable/CSharpResources.Designer.cs index 636a118d1b835..3478bcbbdd93b 100644 --- a/src/Compilers/CSharp/Portable/CSharpResources.Designer.cs +++ b/src/Compilers/CSharp/Portable/CSharpResources.Designer.cs @@ -8729,7 +8729,7 @@ internal static string ERR_SourceLinkRequiresPdb { } /// - /// Looks up a localized string similar to Instance of type '{0}' cannot be used inside an anonymous function, query expression, iterator block or async method. + /// Looks up a localized string similar to Instance of type '{0}' cannot be used inside a nested function, query expression, iterator block or async method. /// internal static string ERR_SpecialByRefInLambda { get { diff --git a/src/Compilers/CSharp/Portable/CSharpResources.resx b/src/Compilers/CSharp/Portable/CSharpResources.resx index 7eb60f444a9b4..35a4dae968a06 100644 --- a/src/Compilers/CSharp/Portable/CSharpResources.resx +++ b/src/Compilers/CSharp/Portable/CSharpResources.resx @@ -3906,7 +3906,7 @@ You should consider suppressing the warning only if you're sure that you don't w Indexed property '{0}' must have all arguments optional - Instance of type '{0}' cannot be used inside an anonymous function, query expression, iterator block or async method + Instance of type '{0}' cannot be used inside a nested function, query expression, iterator block or async method First argument to a security attribute must be a valid SecurityAction diff --git a/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.Analysis.Tree.cs b/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.Analysis.Tree.cs index 28790d750e1f8..386dc38534b59 100644 --- a/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.Analysis.Tree.cs +++ b/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.Analysis.Tree.cs @@ -195,9 +195,10 @@ public static void VisitClosures(Scope scope, Action action) /// /// Builds a tree of nodes corresponding to a given method. - /// visits the bound tree and translates - /// information from the bound tree about variable scope, declared variables, and - /// variable captures into the resulting tree. + /// + /// visits the bound tree and translates information from the bound tree about + /// variable scope, declared variables, and variable captures into the resulting + /// tree. /// private class ScopeTreeBuilder : BoundTreeWalkerWithStackGuardWithoutRecursionOnTheLeftOfBinaryOperator { @@ -217,33 +218,36 @@ private class ScopeTreeBuilder : BoundTreeWalkerWithStackGuardWithoutRecursionOn private readonly MethodSymbol _topLevelMethod; - private bool _sawClosure = false; - /// /// If a local function is in the set, at some point in the code it is converted /// to a delegate and should then not be optimized to a struct closure. /// Also contains all lambdas (as they are converted to delegates implicitly). /// private readonly HashSet _methodsConvertedToDelegates; + private readonly DiagnosticBag _diagnostics; private ScopeTreeBuilder( Scope rootScope, MethodSymbol topLevelMethod, - HashSet methodsConvertedToDelegates) + HashSet methodsConvertedToDelegates, + DiagnosticBag diagnostics) { Debug.Assert(rootScope != null); Debug.Assert(topLevelMethod != null); Debug.Assert(methodsConvertedToDelegates != null); + Debug.Assert(diagnostics != null); _currentScope = rootScope; _topLevelMethod = topLevelMethod; _methodsConvertedToDelegates = methodsConvertedToDelegates; + _diagnostics = diagnostics; } public static Scope Build( BoundNode node, MethodSymbol topLevelMethod, - HashSet methodsConvertedToDelegates) + HashSet methodsConvertedToDelegates, + DiagnosticBag diagnostics) { // This should be the top-level node Debug.Assert(node == FindNodeToAnalyze(node)); @@ -253,9 +257,10 @@ public static Scope Build( var builder = new ScopeTreeBuilder( rootScope, topLevelMethod, - methodsConvertedToDelegates); + methodsConvertedToDelegates, + diagnostics); builder.Build(); - return builder._sawClosure ? rootScope : null; + return rootScope; } private void Build() @@ -270,12 +275,6 @@ public override BoundNode VisitMethodGroup(BoundMethodGroup node) public override BoundNode VisitBlock(BoundBlock node) { - if (node.Locals.IsDefaultOrEmpty) - { - // Skip introducing a new scope if there are no new locals - return base.VisitBlock(node); - } - var oldScope = _currentScope; _currentScope = CreateOrReuseScope(node, node.Locals); var result = base.VisitBlock(node); @@ -285,11 +284,6 @@ public override BoundNode VisitBlock(BoundBlock node) public override BoundNode VisitCatchBlock(BoundCatchBlock node) { - if (node.Locals.IsDefaultOrEmpty) - { - return base.VisitCatchBlock(node); - } - var oldScope = _currentScope; _currentScope = CreateOrReuseScope(node, node.Locals); var result = base.VisitCatchBlock(node); @@ -299,11 +293,6 @@ public override BoundNode VisitCatchBlock(BoundCatchBlock node) public override BoundNode VisitSequence(BoundSequence node) { - if (node.Locals.IsDefaultOrEmpty) - { - return base.VisitSequence(node); - } - var oldScope = _currentScope; _currentScope = CreateOrReuseScope(node, node.Locals); var result = base.VisitSequence(node); @@ -313,12 +302,6 @@ public override BoundNode VisitSequence(BoundSequence node) public override BoundNode VisitSwitchStatement(BoundSwitchStatement node) { - if (node.InnerLocals.IsDefaultOrEmpty) - { - // Skip introducing a new scope if there are no new locals - return base.VisitSwitchStatement(node); - } - var oldScope = _currentScope; _currentScope = CreateOrReuseScope(node, node.InnerLocals); var result = base.VisitSwitchStatement(node); @@ -346,7 +329,7 @@ public override BoundNode VisitCall(BoundCall node) if (node.Method.MethodKind == MethodKind.LocalFunction) { // Use OriginalDefinition to strip generic type parameters - AddIfCaptured(node.Method.OriginalDefinition); + AddIfCaptured(node.Method.OriginalDefinition, node.Syntax); } return base.VisitCall(node); } @@ -357,7 +340,7 @@ public override BoundNode VisitDelegateCreationExpression(BoundDelegateCreationE { // Use OriginalDefinition to strip generic type parameters var method = node.MethodOpt.OriginalDefinition; - AddIfCaptured(method); + AddIfCaptured(method, node.Syntax); _methodsConvertedToDelegates.Add(method); } return base.VisitDelegateCreationExpression(node); @@ -365,19 +348,19 @@ public override BoundNode VisitDelegateCreationExpression(BoundDelegateCreationE public override BoundNode VisitParameter(BoundParameter node) { - AddIfCaptured(node.ParameterSymbol); + AddIfCaptured(node.ParameterSymbol, node.Syntax); return base.VisitParameter(node); } public override BoundNode VisitLocal(BoundLocal node) { - AddIfCaptured(node.LocalSymbol); + AddIfCaptured(node.LocalSymbol, node.Syntax); return base.VisitLocal(node); } public override BoundNode VisitBaseReference(BoundBaseReference node) { - AddIfCaptured(_topLevelMethod.ThisParameter); + AddIfCaptured(_topLevelMethod.ThisParameter, node.Syntax); return base.VisitBaseReference(node); } @@ -386,7 +369,7 @@ public override BoundNode VisitThisReference(BoundThisReference node) var thisParam = _topLevelMethod.ThisParameter; if (thisParam != null) { - AddIfCaptured(thisParam); + AddIfCaptured(thisParam, node.Syntax); } else { @@ -408,8 +391,6 @@ private BoundNode VisitClosure(MethodSymbol closureSymbol, BoundBlock body) { Debug.Assert((object)closureSymbol != null); - _sawClosure |= true; - // Closure is declared (lives) in the parent scope, but its // variables are in a nested scope var closure = new Closure(closureSymbol); @@ -439,8 +420,13 @@ private BoundNode VisitClosure(MethodSymbol closureSymbol, BoundBlock body) return result; } - private void AddIfCaptured(Symbol symbol) + private void AddIfCaptured(Symbol symbol, SyntaxNode syntax) { + Debug.Assert( + symbol.Kind == SymbolKind.Local || + symbol.Kind == SymbolKind.Parameter || + symbol.Kind == SymbolKind.Method); + if (_currentClosure == null) { // Can't be captured if we're not in a closure @@ -455,6 +441,9 @@ private void AddIfCaptured(Symbol symbol) if (symbol.ContainingSymbol != _currentClosure.OriginalMethodSymbol) { + // Restricted types can't be hoisted, so they are not permitted to be captured + AddDiagnosticIfRestrictedType(symbol, syntax); + // Record the captured variable where it's captured var scope = _currentScope; var closure = _currentClosure; @@ -498,6 +487,33 @@ private void AddIfCaptured(Symbol symbol) } } + /// + /// Add a diagnostic if the type of a captured variable is a restricted type + /// + private void AddDiagnosticIfRestrictedType(Symbol capturedVariable, SyntaxNode syntax) + { + TypeSymbol type; + switch (capturedVariable.Kind) + { + case SymbolKind.Local: + type = ((LocalSymbol)capturedVariable).Type; + break; + case SymbolKind.Parameter: + type = ((ParameterSymbol)capturedVariable).Type; + break; + default: + // This should only be called for captured variables, and captured + // variables must be a method, parameter, or local symbol + Debug.Assert(capturedVariable.Kind == SymbolKind.Method); + return; + } + + if (type.IsRestrictedType() == true) + { + _diagnostics.Add(ErrorCode.ERR_SpecialByRefInLambda, syntax.Location, type); + } + } + /// /// Create a new nested scope under the current scope, or reuse the current /// scope if there's no change in the bound node for the nested scope. @@ -506,14 +522,20 @@ private void AddIfCaptured(Symbol symbol) private Scope CreateOrReuseScope(BoundNode node, ImmutableArray locals) where TSymbol : Symbol { - // We should never create a new scope with the same bound - // node. We can get into this situation for methods and - // closures where a new scope is created to add parameters - // and a new scope would be created for the method block, - // despite the fact that they should be the same scope. - var scope = _currentScope.BoundNode == node - ? _currentScope - : CreateNestedScope(node, _currentScope, _currentClosure); + Scope scope; + if (locals.IsEmpty || _currentScope.BoundNode == node) + { + // We should never create a new scope with the same bound + // node. We can get into this situation for methods and + // closures where a new scope is created to add parameters + // and a new scope would be created for the method block, + // despite the fact that they should be the same scope. + scope = _currentScope; + } + else + { + scope = CreateNestedScope(node, _currentScope, _currentClosure); + } DeclareLocals(scope, locals); return scope; } diff --git a/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.Analysis.cs b/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.Analysis.cs index 1d98fdb31c885..ab857ae97a5cc 100644 --- a/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.Analysis.cs +++ b/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.Analysis.cs @@ -16,45 +16,13 @@ internal partial class LambdaRewriter /// Perform a first analysis pass in preparation for removing all lambdas from a method body. The entry point is Analyze. /// The results of analysis are placed in the fields seenLambda, blockParent, variableBlock, captured, and captures. /// - internal sealed partial class Analysis : BoundTreeWalkerWithStackGuardWithoutRecursionOnTheLeftOfBinaryOperator + internal sealed partial class Analysis { - private readonly MethodSymbol _topLevelMethod; - - private MethodSymbol _currentParent; - private BoundNode _currentScope; - - /// - /// Set to true while we are analyzing the interior of an expression lambda. - /// - private bool _inExpressionLambda; - - /// - /// For each scope that defines variables, identifies the nearest enclosing scope that defines variables. - /// - public readonly Dictionary ScopeParent = new Dictionary(); - - /// - /// For each captured variable, identifies the scope in which it will be moved to a frame class. This is - /// normally the node where the variable is introduced, but method parameters are moved - /// to a frame class within the body of the method. - /// - public readonly Dictionary VariableScope = new Dictionary(); - - /// - /// For each value in variableScope, identifies the closest owning method, lambda, or local function. - /// - public readonly Dictionary ScopeOwner = new Dictionary(); - - /// - /// The syntax nodes associated with each captured variable. - /// - public MultiDictionary CapturedVariables = new MultiDictionary(); - /// /// If a local function is in the set, at some point in the code it is converted to a delegate and should then not be optimized to a struct closure. /// Also contains all lambdas (as they are converted to delegates implicitly). /// - public readonly HashSet MethodsConvertedToDelegates = new HashSet(); + public readonly HashSet MethodsConvertedToDelegates; /// /// True if the method signature can be rewritten to contain ref/out parameters. @@ -98,53 +66,23 @@ public bool CanTakeRefParameters(MethodSymbol closure) => !(closure.IsAsync /// /// The root of the scope tree for this method. /// - public Scope ScopeTree { get; private set; } - - private Analysis(MethodSymbol method) - { - Debug.Assert((object)method != null); - - _currentParent = _topLevelMethod = method; - } + public readonly Scope ScopeTree; - public static Analysis Analyze(BoundNode node, MethodSymbol method) + private Analysis(Scope scopeTree, HashSet methodsConvertedToDelegates) { - var analysis = new Analysis(method); - analysis.Analyze(node); - return analysis.ScopeTree == null ? null : analysis; + ScopeTree = scopeTree; + MethodsConvertedToDelegates = methodsConvertedToDelegates; } - private void Analyze(BoundNode node) + public static Analysis Analyze(BoundNode node, MethodSymbol method, DiagnosticBag diagnostics) { - ScopeTree = ScopeTreeBuilder.Build( + var methodsConvertedToDelegates = new HashSet(); + var scopeTree = ScopeTreeBuilder.Build( node, - _topLevelMethod, - MethodsConvertedToDelegates); - _currentScope = FindNodeToAnalyze(node); - - Debug.Assert(!_inExpressionLambda); - Debug.Assert((object)_topLevelMethod != null); - Debug.Assert((object)_currentParent != null); - - foreach (ParameterSymbol parameter in _topLevelMethod.Parameters) - { - // parameters are counted as if they are inside the block - VariableScope[parameter] = _currentScope; - } - - Visit(node); - - // scopeOwner may already contain the same key/value if _currentScope is a BoundBlock. - MethodSymbol shouldBeCurrentParent; - if (ScopeOwner.TryGetValue(_currentScope, out shouldBeCurrentParent)) - { - // Check to make sure the above comment is right. - Debug.Assert(_currentParent == shouldBeCurrentParent); - } - else - { - ScopeOwner.Add(_currentScope, _currentParent); - } + method, + methodsConvertedToDelegates, + diagnostics); + return new Analysis(scopeTree, methodsConvertedToDelegates); } private static BoundNode FindNodeToAnalyze(BoundNode node) @@ -298,19 +236,28 @@ public static Scope GetVariableDeclarationScope(Scope startingScope, Symbol vari var currentScope = startingScope; while (currentScope != null) { - if (variable.Kind == SymbolKind.Parameter || variable.Kind == SymbolKind.Local) - { - if (currentScope.DeclaredVariables.Contains(variable)) - { - return currentScope; - } - } - else + switch (variable.Kind) { - if (currentScope.Closures.Contains(c => variable == c.OriginalMethodSymbol)) - { - return currentScope; - } + case SymbolKind.Parameter: + case SymbolKind.Local: + if (currentScope.DeclaredVariables.Contains(variable)) + { + return currentScope; + } + break; + + case SymbolKind.Method: + foreach (var closure in currentScope.Closures) + { + if (closure.OriginalMethodSymbol == variable) + { + return currentScope; + } + } + break; + + default: + throw ExceptionUtilities.UnexpectedValue(variable.Kind); } currentScope = currentScope.Parent; } @@ -407,257 +354,6 @@ Closure Helper(Scope scope) return null; } } - - /// - /// Compute the nesting depth of a given block. - /// Top-most block (where method locals and parameters are defined) are at the depth 0. - /// - private int BlockDepth(BoundNode node) - { - // TODO: this could be precomputed and stored by analysis phase - int result = -1; - while (node != null) - { - result = result + 1; - if (!ScopeParent.TryGetValue(node, out node)) - { - break; - } - } - - return result; - } - - public override BoundNode VisitCatchBlock(BoundCatchBlock node) - { - var locals = node.Locals; - - if (locals.IsEmpty) - { - return base.VisitCatchBlock(node); - } - - var previousBlock = PushBlock(node, locals); - var result = base.VisitCatchBlock(node); - PopBlock(previousBlock); - return node; - } - - private BoundNode PushBlock(BoundNode node, ImmutableArray locals) - { - // blocks are not allowed in expression lambda - Debug.Assert(!_inExpressionLambda); - - var previousBlock = _currentScope; - _currentScope = node; - if (_currentScope != previousBlock) // not top-level node of the method - { - // (Except for the top-level block) record the parent-child block structure - ScopeParent[_currentScope] = previousBlock; - } - - foreach (var local in locals) - { - VariableScope[local] = _currentScope; - } - - ScopeOwner.Add(_currentScope, _currentParent); - - return previousBlock; - } - - private void PopBlock(BoundNode previousBlock) - { - _currentScope = previousBlock; - } - - public override BoundNode VisitSwitchStatement(BoundSwitchStatement node) - { - var locals = node.InnerLocals; - if (locals.IsEmpty) - { - // no variables declared inside the switch statement. - return base.VisitSwitchStatement(node); - } - - var previousBlock = PushBlock(node, locals); - var result = base.VisitSwitchStatement(node); - PopBlock(previousBlock); - return result; - } - - public override BoundNode VisitBlock(BoundBlock node) - { - if (node.Locals.IsEmpty) - { - // ignore blocks that declare no variables. - return base.VisitBlock(node); - } - - VisitBlockInternal(node); - return node; - } - - private void VisitBlockInternal(BoundBlock node) - { - var previousBlock = PushBlock(node, node.Locals); - base.VisitBlock(node); - PopBlock(previousBlock); - } - - public override BoundNode VisitSequence(BoundSequence node) - { - if (node.Locals.IsDefaultOrEmpty) - { - // ignore blocks that declare no variables. - return base.VisitSequence(node); - } - - var previousBlock = PushBlock(node, node.Locals); - var result = base.VisitSequence(node); - PopBlock(previousBlock); - return result; - } - - public override BoundNode VisitCall(BoundCall node) - { - if (node.Method.MethodKind == MethodKind.LocalFunction) - { - // Use OriginalDefinition to strip generic type parameters - ReferenceVariable(node.Syntax, node.Method.OriginalDefinition); - } - return base.VisitCall(node); - } - - public override BoundNode VisitLambda(BoundLambda node) - { - MethodsConvertedToDelegates.Add(node.Symbol.OriginalDefinition); - return VisitLambdaOrFunction(node); - } - - public override BoundNode VisitDelegateCreationExpression(BoundDelegateCreationExpression node) - { - if (node.MethodOpt?.MethodKind == MethodKind.LocalFunction) - { - // Use OriginalDefinition to strip generic type parameters - ReferenceVariable(node.Syntax, node.MethodOpt.OriginalDefinition); - MethodsConvertedToDelegates.Add(node.MethodOpt.OriginalDefinition); - } - return base.VisitDelegateCreationExpression(node); - } - - public override BoundNode VisitLocalFunctionStatement(BoundLocalFunctionStatement node) - { - VariableScope[node.Symbol] = _currentScope; - return VisitLambdaOrFunction(node); - } - - private BoundNode VisitLambdaOrFunction(IBoundLambdaOrFunction node) - { - Debug.Assert((object)node.Symbol != null); - var oldParent = _currentParent; - var oldBlock = _currentScope; - _currentParent = node.Symbol; - _currentScope = node.Body; - ScopeParent[_currentScope] = oldBlock; - ScopeOwner.Add(_currentScope, _currentParent); - var wasInExpressionLambda = _inExpressionLambda; - _inExpressionLambda = _inExpressionLambda || ((node as BoundLambda)?.Type.IsExpressionTree() ?? false); - - if (!_inExpressionLambda) - { - // for the purpose of constructing frames parameters are scoped as if they are inside the lambda block - foreach (var parameter in node.Symbol.Parameters) - { - VariableScope[parameter] = _currentScope; - } - - foreach (var local in node.Body.Locals) - { - VariableScope[local] = _currentScope; - } - } - - var result = base.VisitBlock(node.Body); - _inExpressionLambda = wasInExpressionLambda; - _currentParent = oldParent; - _currentScope = oldBlock; - return result; - } - - private void ReferenceVariable(SyntaxNode syntax, Symbol symbol) - { - if (symbol is LocalSymbol localSymbol && localSymbol.IsConst) - { - // "constant variables" need not be captured - return; - } - - // "symbol == lambda" could happen if we're recursive - if (_currentParent is MethodSymbol lambda && symbol != lambda && symbol.ContainingSymbol != lambda) - { - CapturedVariables.Add(symbol, syntax); - } - } - - private static bool IsClosure(MethodSymbol symbol) - { - switch (symbol.MethodKind) - { - case MethodKind.LambdaMethod: - case MethodKind.LocalFunction: - return true; - - default: - return false; - } - } - - public override BoundNode VisitMethodGroup(BoundMethodGroup node) - { - throw ExceptionUtilities.Unreachable; - } - - public override BoundNode VisitThisReference(BoundThisReference node) - { - var thisParam = _topLevelMethod.ThisParameter; - if (thisParam != null) - { - ReferenceVariable(node.Syntax, thisParam); - } - else - { - // This can occur in a delegate creation expression because the method group - // in the argument can have a "this" receiver even when "this" - // is not captured because a static method is selected. But we do preserve - // the method group and its receiver in the bound tree. - // No need to capture "this" in such case. - - // TODO: Why don't we drop "this" while lowering if method is static? - // Actually, considering that method group expression does not evaluate to a particular value - // why do we have it in the lowered tree at all? - } - - return base.VisitThisReference(node); - } - - public override BoundNode VisitBaseReference(BoundBaseReference node) - { - ReferenceVariable(node.Syntax, _topLevelMethod.ThisParameter); - return base.VisitBaseReference(node); - } - - public override BoundNode VisitParameter(BoundParameter node) - { - ReferenceVariable(node.Syntax, node.ParameterSymbol); - return base.VisitParameter(node); - } - - public override BoundNode VisitLocal(BoundLocal node) - { - ReferenceVariable(node.Syntax, node.LocalSymbol); - return base.VisitLocal(node); - } } } } diff --git a/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.cs b/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.cs index 189196ac0394e..855f6a9971a9b 100644 --- a/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.cs +++ b/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.cs @@ -149,6 +149,15 @@ public MappedLocalFunction(SynthesizedLambdaMethod symbol, ClosureKind closureKi /// private ArrayBuilder _synthesizedMethods; + /// + /// TODO(https://github.com/dotnet/roslyn/projects/26): Delete this. + /// This should only be used by which + /// hasn't had logic to move the proxy analysis into , + /// where the could be walked to build + /// the proxy list. + /// + private readonly ImmutableHashSet _allCapturedVariables; + private LambdaRewriter( Analysis analysis, NamedTypeSymbol thisType, @@ -182,13 +191,20 @@ private LambdaRewriter( _framePointers[thisType] = thisParameterOpt; _seenBaseCall = method.MethodKind != MethodKind.Constructor; // only used for ctors _synthesizedFieldNameIdDispenser = 1; + + var allCapturedVars = ImmutableHashSet.CreateBuilder(); + Analysis.VisitClosures(analysis.ScopeTree, (scope, closure) => + { + allCapturedVars.UnionWith(closure.CapturedVariables); + }); + _allCapturedVariables = allCapturedVars.ToImmutable(); } protected override bool NeedsProxy(Symbol localOrParameter) { Debug.Assert(localOrParameter is LocalSymbol || localOrParameter is ParameterSymbol || (localOrParameter as MethodSymbol)?.MethodKind == MethodKind.LocalFunction); - return _analysis.CapturedVariables.ContainsKey(localOrParameter); + return _allCapturedVariables.Contains(localOrParameter); } /// @@ -227,11 +243,7 @@ public static BoundStatement Rewrite( Debug.Assert(((object)thisParameter == null) || (thisParameter.Type == thisType)); Debug.Assert(compilationState.ModuleBuilderOpt != null); - var analysis = Analysis.Analyze(loweredBody, method); - if (analysis == null) - { - return loweredBody; - } + var analysis = Analysis.Analyze(loweredBody, method, diagnostics); CheckLocalsDefined(loweredBody); var rewriter = new LambdaRewriter( @@ -337,13 +349,8 @@ private void MakeFrames(ArrayBuilder closureDebugInfo) foreach (var captured in capturedVars) { var declarationScope = Analysis.GetVariableDeclarationScope(scope, captured); - if (_analysis.VariableScope.TryGetValue(captured, out BoundNode captureScope)) - { - Debug.Assert(declarationScope.BoundNode == captureScope); - } - else + if (declarationScope == null) { - Debug.Assert(declarationScope == null); continue; } @@ -365,15 +372,6 @@ private void MakeFrames(ArrayBuilder closureDebugInfo) var hoistedField = LambdaCapturedVariable.Create(frame, captured, ref _synthesizedFieldNameIdDispenser); proxies.Add(captured, new CapturedToFrameSymbolReplacement(hoistedField, isReusable: false)); CompilationState.ModuleBuilderOpt.AddSynthesizedDefinition(frame, hoistedField); - - if (hoistedField.Type.IsRestrictedType()) - { - foreach (CSharpSyntaxNode syntax in _analysis.CapturedVariables[captured]) - { - // CS4013: Instance of type '{0}' cannot be used inside an anonymous function, query expression, iterator block or async method - this.Diagnostics.Add(ErrorCode.ERR_SpecialByRefInLambda, syntax.Location, hoistedField.Type); - } - } } } }); @@ -466,7 +464,6 @@ private LambdaFrame GetFrameForScope(Analysis.Scope scope, ArrayBuilder.GetInstance(); - foreach (var variable in _analysis.CapturedVariables.Keys) - { - if (variable.Kind != SymbolKind.Method && - _analysis.VariableScope.TryGetValue(variable, out var varNode) && - varNode == node) - { - variablesInThisScope.Add(variable); - } - } - Debug.Assert(variablesInThisScope.SequenceEqual(scope.DeclaredVariables)); - foreach (var variable in variablesInThisScope) + foreach (var variable in scope.DeclaredVariables) { InitVariableProxy(syntax, variable, framePointer, prologue); } @@ -1370,7 +1356,6 @@ private SynthesizedLambdaMethod RewriteLambdaOrLocalFunction( if (_analysis.CanTakeRefParameters(node.Symbol)) { lambdaScope = Analysis.GetScopeParent(_analysis.ScopeTree, node.Body)?.BoundNode; - Debug.Assert(lambdaScope == _analysis.ScopeParent[node.Body]); _ = _frames.TryGetValue(lambdaScope, out containerAsFrame); structClosures = GetStructClosures(containerAsFrame, lambdaScope); } @@ -1478,20 +1463,19 @@ private ImmutableArray GetStructClosures(LambdaFrame containerAsFram bool FindParentFrame(ref LambdaFrame container, ref BoundNode scope) { - var temp = Analysis.GetScopeParent(_analysis.ScopeTree, scope)?.BoundNode; - Debug.Assert(temp == null || _analysis.ScopeParent.TryGetValue(scope, out var tempScope) && tempScope == temp); - scope = temp; - while (scope != null) + while (true) { + scope = Analysis.GetScopeParent(_analysis.ScopeTree, scope)?.BoundNode; + if (scope == null) + { + return false; + } + if (_frames.TryGetValue(scope, out container)) { return true; } - temp = Analysis.GetScopeParent(_analysis.ScopeTree, scope)?.BoundNode; - Debug.Assert(temp == null || _analysis.ScopeParent.TryGetValue(scope, out tempScope) && tempScope == temp); - scope = temp; } - return false; } } @@ -1568,7 +1552,6 @@ private BoundNode RewriteLambdaConversion(BoundLambda node) // NOTE: We require "lambdaScope != null". // We do not want to introduce a field into an actual user's class (not a synthetic frame). - Debug.Assert(Analysis.GetScopeParent(_analysis.ScopeTree, node.Body).BoundNode == _analysis.ScopeParent[node.Body]); var shouldCacheInLoop = lambdaScope != null && lambdaScope != Analysis.GetScopeParent(_analysis.ScopeTree, node.Body).BoundNode && InLoopOrLambda(node.Syntax, lambdaScope.Syntax); From 1e6e3fb3a27374c7b4f877d7e97faa385b63aee4 Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Tue, 25 Jul 2017 16:57:45 -0700 Subject: [PATCH 037/205] Handle navigation to a doc ID without a corresponding doc --- .../ProjectSystem/VisualStudioWorkspaceImpl.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioWorkspaceImpl.cs b/src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioWorkspaceImpl.cs index d27587ad0e88b..36d7a9d200bba 100644 --- a/src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioWorkspaceImpl.cs +++ b/src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioWorkspaceImpl.cs @@ -997,6 +997,12 @@ internal override DocumentId GetDocumentIdInCurrentContext(DocumentId documentId } var hostDocument = GetHostDocument(documentId); + if (hostDocument == null) + { + // This can happen if the document was temporary and has since been closed/deleted. + return base.GetDocumentIdInCurrentContext(documentId); + } + var itemId = hostDocument.GetItemId(); if (itemId == (uint)VSConstants.VSITEMID.Nil) { From 2227434a99ec5f625539ba866623d66c007bdd7d Mon Sep 17 00:00:00 2001 From: David Poeschl Date: Wed, 26 Jul 2017 15:38:57 -0700 Subject: [PATCH 038/205] Disable GenerateTypeDialog tests They've been hanging the VS integration tests. I think CSharpToBasic or BasicToCSharp is the culprit (can't remember which I've seen). --- .../IntegrationTests/CSharp/CSharpGenerateTypeDialog.cs | 4 ++-- .../IntegrationTests/VisualBasic/BasicGenerateTypeDialog.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpGenerateTypeDialog.cs b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpGenerateTypeDialog.cs index 540e16f66a5ad..f4fa8bbb1d51b 100644 --- a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpGenerateTypeDialog.cs +++ b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpGenerateTypeDialog.cs @@ -21,7 +21,7 @@ public CSharpGenerateTypeDialog(VisualStudioInstanceFactory instanceFactory) { } - [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateType)] + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/21154"), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateType)] public void OpenAndCloseDialog() { SetUpEditor(@"class C @@ -42,7 +42,7 @@ void Method() GenerateTypeDialog.VerifyClosed(); } - [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateType)] + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/21154"), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateType)] public void CSharpToBasic() { var vbProj = new ProjectUtils.Project("VBProj"); diff --git a/src/VisualStudio/IntegrationTest/IntegrationTests/VisualBasic/BasicGenerateTypeDialog.cs b/src/VisualStudio/IntegrationTest/IntegrationTests/VisualBasic/BasicGenerateTypeDialog.cs index 83454ea334e95..2c7826541ab71 100644 --- a/src/VisualStudio/IntegrationTest/IntegrationTests/VisualBasic/BasicGenerateTypeDialog.cs +++ b/src/VisualStudio/IntegrationTest/IntegrationTests/VisualBasic/BasicGenerateTypeDialog.cs @@ -21,7 +21,7 @@ public BasicGenerateTypeDialog(VisualStudioInstanceFactory instanceFactory) { } - [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateType)] + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/21154"), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateType)] public void BasicToCSharp() { var csProj = new ProjectUtils.Project("CSProj"); @@ -68,7 +68,7 @@ public struct A }", actualText); } - [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateType)] + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/21154"), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateType)] public void SameProject() { SetUpEditor(@" From aeafd4547da16e4983fe0579993f65c4ae4733e4 Mon Sep 17 00:00:00 2001 From: Jared Parsons Date: Wed, 26 Jul 2017 16:43:21 -0700 Subject: [PATCH 039/205] Avoid logging storage diagnostic to runtests.log This diagnostic is non-fatal but throws off a lot of developers who look at runtests.log. Avoid generating it by checking for directory existance before asking for files. Would be much better if we had non-throwing IO operations so we could avoid unnecessary Exists calls. --- src/Tools/Source/RunTests/Cache/LocalDataStorage.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Tools/Source/RunTests/Cache/LocalDataStorage.cs b/src/Tools/Source/RunTests/Cache/LocalDataStorage.cs index e862b24cca971..5448147f4b9c1 100644 --- a/src/Tools/Source/RunTests/Cache/LocalDataStorage.cs +++ b/src/Tools/Source/RunTests/Cache/LocalDataStorage.cs @@ -140,6 +140,13 @@ private void CleanupStorage() { try { + // This is a spot check to avoid dumping entries into the log file if the + // directory doesn't exist + if (!Directory.Exists(_storagePath)) + { + return; + } + var files = Directory.GetFiles(_storagePath); if (files.Length < MaxStorageCount) { From c52d9f601f0cae538d6003ad1329c693fb9eebea Mon Sep 17 00:00:00 2001 From: Ashley Hauck Date: Thu, 27 Jul 2017 15:57:01 +0000 Subject: [PATCH 040/205] Remove ignored flag This is a follow-up to PR #21146, which was unable to be merged without keeping this flag ignore. --- cibuild.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/cibuild.sh b/cibuild.sh index a5fbecec5fb8a..c341c62233751 100755 --- a/cibuild.sh +++ b/cibuild.sh @@ -66,11 +66,6 @@ do SKIP_COMMIT_PRINTING=true shift 1 ;; - --nocache) - # Temporarily ignore this argument until the change to netci.groovy gets merged. - # A follow-up PR will be made to remove this ignore. - shift 1 - ;; *) usage exit 1 From e3cd3164ddacec6c3792d96ab6859735b37be042 Mon Sep 17 00:00:00 2001 From: Jared Parsons Date: Thu, 27 Jul 2017 09:24:29 -0700 Subject: [PATCH 041/205] VS integration tests should use common dump directory Changes the VS integration tests to use the common dump directory that all of our other infrastructure uses. Make it easy to debug failures when all of the dump files are in the same directory. --- .../Utilities/Portable/FX/DumpProcRunner.cs | 46 ------------ src/Tools/Source/RunTests/ITestExecutor.cs | 6 +- src/Tools/Source/RunTests/ProcDumpUtil.cs | 75 +++++++++++++++++++ .../Source/RunTests/ProcessTestExecutor.cs | 15 +++- src/Tools/Source/RunTests/Program.cs | 24 ++++-- src/Tools/Source/RunTests/RunTests.csproj | 3 - .../VisualStudioInstanceFactory.cs | 8 +- ...isualStudioIntegrationTestUtilities.csproj | 5 +- 8 files changed, 117 insertions(+), 65 deletions(-) delete mode 100644 src/Test/Utilities/Portable/FX/DumpProcRunner.cs create mode 100644 src/Tools/Source/RunTests/ProcDumpUtil.cs diff --git a/src/Test/Utilities/Portable/FX/DumpProcRunner.cs b/src/Test/Utilities/Portable/FX/DumpProcRunner.cs deleted file mode 100644 index 10b5b6c80a2db..0000000000000 --- a/src/Test/Utilities/Portable/FX/DumpProcRunner.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Diagnostics; -using System.IO; - -namespace Microsoft.CodeAnalysis.Test.Utilities -{ - public class ProcDumpRunner - { - public const string ProcDumpPathEnvironmentVariableKey = "ProcDumpPath"; - - private const string ProcDumpExeFileName = "procdump.exe"; - - // /accepteula command line option to automatically accept the Sysinternals license agreement. - // -ma Write a 'Full' dump file. Includes All the Image, Mapped and Private memory. - // -e Write a dump when the process encounters an unhandled exception. Include the 1 to create dump on first chance exceptions. - // -t Write a dump when the process terminates. - private const string ProcDumpSwitches = "/accepteula -ma -e -t"; - - /// - /// Starts procdump.exe against the process. - /// - /// The path to the procdump executable - /// process id - /// process name - /// method to log diagnostics to - /// destination directory for dumps - public static void StartProcDump(string procDumpPath, int processId, string processName, string destinationDirectory, Action loggingMethod) - { - if (!string.IsNullOrWhiteSpace(procDumpPath)) - { - var procDumpFilePath = Path.Combine(procDumpPath, ProcDumpExeFileName); - var dumpDirectory = Path.Combine(destinationDirectory, "Dumps"); - Directory.CreateDirectory(dumpDirectory); - - var procDumpProcess = Process.Start(procDumpFilePath, $" {ProcDumpSwitches} {processId} \"{dumpDirectory}\""); - loggingMethod($"Launched ProcDump attached to {processName} (process Id: {processId})"); - } - else - { - loggingMethod($"Environment variables do not contain {ProcDumpPathEnvironmentVariableKey} (path to procdump.exe). Will skip attaching procdump to VS instance."); - } - } - } -} diff --git a/src/Tools/Source/RunTests/ITestExecutor.cs b/src/Tools/Source/RunTests/ITestExecutor.cs index a206b6d084012..38def79f5fc95 100644 --- a/src/Tools/Source/RunTests/ITestExecutor.cs +++ b/src/Tools/Source/RunTests/ITestExecutor.cs @@ -11,7 +11,7 @@ namespace RunTests internal struct TestExecutionOptions { internal string XunitPath { get; } - internal string ProcDumpPath { get; } + internal ProcDumpInfo? ProcDumpInfo { get; } internal string LogFilePath { get; } internal string Trait { get; } internal string NoTrait { get; } @@ -19,10 +19,10 @@ internal struct TestExecutionOptions internal bool Test64 { get; } internal bool TestVsi { get; } - internal TestExecutionOptions(string xunitPath, string procDumpPath, string logFilePath, string trait, string noTrait, bool useHtml, bool test64, bool testVsi) + internal TestExecutionOptions(string xunitPath, ProcDumpInfo? procDumpInfo, string logFilePath, string trait, string noTrait, bool useHtml, bool test64, bool testVsi) { XunitPath = xunitPath; - ProcDumpPath = procDumpPath; + ProcDumpInfo = procDumpInfo; LogFilePath = logFilePath; Trait = trait; NoTrait = noTrait; diff --git a/src/Tools/Source/RunTests/ProcDumpUtil.cs b/src/Tools/Source/RunTests/ProcDumpUtil.cs new file mode 100644 index 0000000000000..6cc00aca918bb --- /dev/null +++ b/src/Tools/Source/RunTests/ProcDumpUtil.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; + +namespace RunTests +{ + internal struct ProcDumpInfo + { + private const string s_KeyProcDumpFilePath = "ProcDumpFilePath"; + private const string s_KeyDumpDirectory = "ProcDumpOutputPath"; + + internal string ProcDumpFilePath { get; } + internal string DumpDirectory { get; } + + internal ProcDumpInfo(string procDumpFilePath, string dumpDirectory) + { + Debug.Assert(Path.IsPathRooted(procDumpFilePath)); + Debug.Assert(Path.IsPathRooted(dumpDirectory)); + ProcDumpFilePath = procDumpFilePath; + DumpDirectory = dumpDirectory; + } + + internal void WriteEnvironmentVariables(Dictionary environment) + { + environment[s_KeyProcDumpFilePath] = ProcDumpFilePath; + environment[s_KeyDumpDirectory] = DumpDirectory; + } + + internal static ProcDumpInfo? ReadFromEnvironment() + { + bool validate(string s) => !string.IsNullOrEmpty(s) && Path.IsPathRooted(s); + + var procDumpFilePath = Environment.GetEnvironmentVariable(s_KeyProcDumpFilePath); + var dumpDirectory = Environment.GetEnvironmentVariable(s_KeyDumpDirectory); + + if (!validate(procDumpFilePath) || !validate(dumpDirectory)) + { + return null; + } + + return new ProcDumpInfo(procDumpFilePath, dumpDirectory); + } + } + + internal static class ProcDumpUtil + { + internal static Process AttachProcDump(ProcDumpInfo procDumpInfo, int processId, string processName) + { + return AttachProcDump(procDumpInfo.ProcDumpFilePath, processId, processName, procDumpInfo.DumpDirectory); + } + + /// + /// Attaches a new procdump.exe against the specified process. + /// + /// The path to the procdump executable + /// process id + /// process name + /// destination directory for dumps + internal static Process AttachProcDump(string procDumpFilePath, int processId, string processName, string dumpDirectory) + { + // /accepteula command line option to automatically accept the Sysinternals license agreement. + // -ma Write a 'Full' dump file. Includes All the Image, Mapped and Private memory. + // -e Write a dump when the process encounters an unhandled exception. Include the 1 to create dump on first chance exceptions. + // -t Write a dump when the process terminates. + const string procDumpSwitches = "/accepteula -ma -e -t"; + Directory.CreateDirectory(dumpDirectory); + dumpDirectory = dumpDirectory.TrimEnd('\\'); + + return Process.Start(procDumpFilePath, $" {procDumpSwitches} {processId} \"{dumpDirectory}\""); + } + } +} diff --git a/src/Tools/Source/RunTests/ProcessTestExecutor.cs b/src/Tools/Source/RunTests/ProcessTestExecutor.cs index b38450c8f74dd..16e33f9a501a8 100644 --- a/src/Tools/Source/RunTests/ProcessTestExecutor.cs +++ b/src/Tools/Source/RunTests/ProcessTestExecutor.cs @@ -9,7 +9,6 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -using Microsoft.CodeAnalysis.Test.Utilities; namespace RunTests { @@ -84,12 +83,22 @@ public async Task RunTestAsync(AssemblyInfo assemblyInfo, Cancellati // Define environment variables for processes started via ProcessRunner. var environmentVariables = new Dictionary(); - environmentVariables.Add(ProcDumpRunner.ProcDumpPathEnvironmentVariableKey, _options.ProcDumpPath); + _options.ProcDumpInfo?.WriteEnvironmentVariables(environmentVariables); var outputDirectory = _options.LogFilePath != null ? Path.GetDirectoryName(_options.LogFilePath) : Directory.GetCurrentDirectory(); + // Attach procDump to processes when the are started so we can watch for + // unexepected crashes. + void onProcessStart(Process process) + { + if (_options.ProcDumpInfo != null) + { + ProcDumpUtil.AttachProcDump(_options.ProcDumpInfo.Value, process.Id, process.ProcessName); + } + } + var start = DateTime.UtcNow; var xunitPath = _options.XunitPath; var processOutput = await ProcessRunner.RunProcessAsync( @@ -100,7 +109,7 @@ public async Task RunTestAsync(AssemblyInfo assemblyInfo, Cancellati captureOutput: true, cancellationToken: cancellationToken, environmentVariables: environmentVariables, - onProcessStartHandler: (process) => ProcDumpRunner.StartProcDump(_options.ProcDumpPath, process.Id, process.ProcessName, outputDirectory, Logger.Log)); + onProcessStartHandler: onProcessStart); var span = DateTime.UtcNow - start; if (processOutput.ExitCode != 0) diff --git a/src/Tools/Source/RunTests/Program.cs b/src/Tools/Source/RunTests/Program.cs index 212ddac8117d5..e531b681a4f1e 100644 --- a/src/Tools/Source/RunTests/Program.cs +++ b/src/Tools/Source/RunTests/Program.cs @@ -190,13 +190,10 @@ async Task DumpProcess(Process targetProcess, string dumpFilePath) } Console.WriteLine("Roslyn Error: test timeout exceeded, dumping remaining processes"); - if (!string.IsNullOrEmpty(options.ProcDumpPath)) + var procDumpInfo = GetProcDumpInfo(options); + if (procDumpInfo != null) { - var dumpDir = options.LogFilePath != null - ? Path.GetDirectoryName(options.LogFilePath) - : Directory.GetCurrentDirectory(); - Console.WriteLine($"Dump file location is {dumpDir}"); - + var dumpDir = procDumpInfo.Value.DumpDirectory; var counter = 0; foreach (var proc in ProcessUtil.GetProcessTree(Process.GetCurrentProcess()).OrderBy(x => x.ProcessName)) { @@ -213,6 +210,19 @@ async Task DumpProcess(Process targetProcess, string dumpFilePath) WriteLogFile(options); } + private static ProcDumpInfo? GetProcDumpInfo(Options options) + { + if (!string.IsNullOrEmpty(options.ProcDumpPath)) + { + var dumpDir = options.LogFilePath != null + ? Path.GetDirectoryName(options.LogFilePath) + : Directory.GetCurrentDirectory(); + return new ProcDumpInfo(options.ProcDumpPath, dumpDir); + } + + return null; + } + /// /// Quick sanity check to look over the set of assemblies to make sure they are valid and something was /// specified. @@ -314,7 +324,7 @@ private static ITestExecutor CreateTestExecutor(Options options) { var testExecutionOptions = new TestExecutionOptions( xunitPath: options.XunitPath, - procDumpPath: options.ProcDumpPath, + procDumpInfo: GetProcDumpInfo(options), logFilePath: options.LogFilePath, trait: options.Trait, noTrait: options.NoTrait, diff --git a/src/Tools/Source/RunTests/RunTests.csproj b/src/Tools/Source/RunTests/RunTests.csproj index e5bf6cb6059c7..7e69fb02cc6c9 100644 --- a/src/Tools/Source/RunTests/RunTests.csproj +++ b/src/Tools/Source/RunTests/RunTests.csproj @@ -26,8 +26,5 @@ - - - \ No newline at end of file diff --git a/src/VisualStudio/IntegrationTest/TestUtilities/VisualStudioInstanceFactory.cs b/src/VisualStudio/IntegrationTest/TestUtilities/VisualStudioInstanceFactory.cs index bd4b65fadd556..a49432df5a248 100644 --- a/src/VisualStudio/IntegrationTest/TestUtilities/VisualStudioInstanceFactory.cs +++ b/src/VisualStudio/IntegrationTest/TestUtilities/VisualStudioInstanceFactory.cs @@ -16,6 +16,7 @@ using Microsoft.VisualStudio.IntegrationTest.Utilities.Interop; using Microsoft.VisualStudio.Setup.Configuration; using Process = System.Diagnostics.Process; +using RunTests; namespace Microsoft.VisualStudio.IntegrationTest.Utilities { @@ -168,8 +169,11 @@ private void UpdateCurrentlyRunningInstance(ImmutableHashSet requiredPac hostProcess = StartNewVisualStudioProcess(installationPath); - var procDumpPath = Environment.GetEnvironmentVariable(ProcDumpRunner.ProcDumpPathEnvironmentVariableKey); - ProcDumpRunner.StartProcDump(procDumpPath, hostProcess.Id, hostProcess.ProcessName, Path.Combine(GetAssemblyDirectory(), "xUnitResults"), s => Debug.WriteLine(s)); + var procDumpInfo = ProcDumpInfo.ReadFromEnvironment(); + if (procDumpInfo != null) + { + ProcDumpUtil.AttachProcDump(procDumpInfo.Value, hostProcess.Id, hostProcess.ProcessName); + } // We wait until the DTE instance is up before we're good dte = IntegrationHelper.WaitForNotNullAsync(() => IntegrationHelper.TryLocateDteForProcess(hostProcess)).Result; diff --git a/src/VisualStudio/IntegrationTest/TestUtilities/VisualStudioIntegrationTestUtilities.csproj b/src/VisualStudio/IntegrationTest/TestUtilities/VisualStudioIntegrationTestUtilities.csproj index 06e471f7d8310..5cd4d5b914b44 100644 --- a/src/VisualStudio/IntegrationTest/TestUtilities/VisualStudioIntegrationTestUtilities.csproj +++ b/src/VisualStudio/IntegrationTest/TestUtilities/VisualStudioIntegrationTestUtilities.csproj @@ -72,9 +72,12 @@ + + + - \ No newline at end of file + From cec4b267a073a47c5df6eeb45a09430f79ed2366 Mon Sep 17 00:00:00 2001 From: Ashley Hauck Date: Thu, 27 Jul 2017 16:53:53 +0000 Subject: [PATCH 042/205] Set HOME if it is not set in the CI build This broke in #21146, but the mac build was not tested. --- cibuild.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cibuild.sh b/cibuild.sh index c341c62233751..cbd41c6e91570 100755 --- a/cibuild.sh +++ b/cibuild.sh @@ -29,6 +29,15 @@ CLEAN_RUN=false SKIP_TESTS=false SKIP_COMMIT_PRINTING=false +# $HOME is unset when running the mac unit tests. +if [[ -z ${HOME+x} ]] +then + # Note that while ~ usually refers to $HOME, in the case where $HOME is unset, + # it looks up the current user's home dir, which is what we want. + # https://www.gnu.org/software/bash/manual/html_node/Tilde-Expansion.html + export HOME=$(cd ~ && pwd) +fi + # LTTNG is the logging infrastructure used by coreclr. Need this variable set # so it doesn't output warnings to the console. export LTTNG_HOME=$HOME From e05095096b3f1c51641b2cc02807232b13ea0004 Mon Sep 17 00:00:00 2001 From: Jared Parsons Date: Thu, 27 Jul 2017 10:30:01 -0700 Subject: [PATCH 043/205] Respond to PR feedback --- src/Tools/Source/RunTests/ProcDumpUtil.cs | 19 +++++++++---------- .../Source/RunTests/ProcessTestExecutor.cs | 2 +- .../VisualStudioInstanceFactory.cs | 2 +- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/Tools/Source/RunTests/ProcDumpUtil.cs b/src/Tools/Source/RunTests/ProcDumpUtil.cs index 6cc00aca918bb..c692f4648b3e9 100644 --- a/src/Tools/Source/RunTests/ProcDumpUtil.cs +++ b/src/Tools/Source/RunTests/ProcDumpUtil.cs @@ -9,8 +9,8 @@ namespace RunTests { internal struct ProcDumpInfo { - private const string s_KeyProcDumpFilePath = "ProcDumpFilePath"; - private const string s_KeyDumpDirectory = "ProcDumpOutputPath"; + private const string KeyProcDumpFilePath = "ProcDumpFilePath"; + private const string KeyProcDumpDirectory = "ProcDumpOutputPath"; internal string ProcDumpFilePath { get; } internal string DumpDirectory { get; } @@ -25,16 +25,16 @@ internal ProcDumpInfo(string procDumpFilePath, string dumpDirectory) internal void WriteEnvironmentVariables(Dictionary environment) { - environment[s_KeyProcDumpFilePath] = ProcDumpFilePath; - environment[s_KeyDumpDirectory] = DumpDirectory; + environment[KeyProcDumpFilePath] = ProcDumpFilePath; + environment[KeyProcDumpDirectory] = DumpDirectory; } internal static ProcDumpInfo? ReadFromEnvironment() { bool validate(string s) => !string.IsNullOrEmpty(s) && Path.IsPathRooted(s); - var procDumpFilePath = Environment.GetEnvironmentVariable(s_KeyProcDumpFilePath); - var dumpDirectory = Environment.GetEnvironmentVariable(s_KeyDumpDirectory); + var procDumpFilePath = Environment.GetEnvironmentVariable(KeyProcDumpFilePath); + var dumpDirectory = Environment.GetEnvironmentVariable(KeyProcDumpDirectory); if (!validate(procDumpFilePath) || !validate(dumpDirectory)) { @@ -47,9 +47,9 @@ internal void WriteEnvironmentVariables(Dictionary environment) internal static class ProcDumpUtil { - internal static Process AttachProcDump(ProcDumpInfo procDumpInfo, int processId, string processName) + internal static Process AttachProcDump(ProcDumpInfo procDumpInfo, int processId) { - return AttachProcDump(procDumpInfo.ProcDumpFilePath, processId, processName, procDumpInfo.DumpDirectory); + return AttachProcDump(procDumpInfo.ProcDumpFilePath, processId, procDumpInfo.DumpDirectory); } /// @@ -57,9 +57,8 @@ internal static Process AttachProcDump(ProcDumpInfo procDumpInfo, int processId, /// /// The path to the procdump executable /// process id - /// process name /// destination directory for dumps - internal static Process AttachProcDump(string procDumpFilePath, int processId, string processName, string dumpDirectory) + internal static Process AttachProcDump(string procDumpFilePath, int processId, string dumpDirectory) { // /accepteula command line option to automatically accept the Sysinternals license agreement. // -ma Write a 'Full' dump file. Includes All the Image, Mapped and Private memory. diff --git a/src/Tools/Source/RunTests/ProcessTestExecutor.cs b/src/Tools/Source/RunTests/ProcessTestExecutor.cs index 16e33f9a501a8..66c3eb1f5e3c6 100644 --- a/src/Tools/Source/RunTests/ProcessTestExecutor.cs +++ b/src/Tools/Source/RunTests/ProcessTestExecutor.cs @@ -95,7 +95,7 @@ void onProcessStart(Process process) { if (_options.ProcDumpInfo != null) { - ProcDumpUtil.AttachProcDump(_options.ProcDumpInfo.Value, process.Id, process.ProcessName); + ProcDumpUtil.AttachProcDump(_options.ProcDumpInfo.Value, process.Id); } } diff --git a/src/VisualStudio/IntegrationTest/TestUtilities/VisualStudioInstanceFactory.cs b/src/VisualStudio/IntegrationTest/TestUtilities/VisualStudioInstanceFactory.cs index a49432df5a248..b91fd12d7466a 100644 --- a/src/VisualStudio/IntegrationTest/TestUtilities/VisualStudioInstanceFactory.cs +++ b/src/VisualStudio/IntegrationTest/TestUtilities/VisualStudioInstanceFactory.cs @@ -172,7 +172,7 @@ private void UpdateCurrentlyRunningInstance(ImmutableHashSet requiredPac var procDumpInfo = ProcDumpInfo.ReadFromEnvironment(); if (procDumpInfo != null) { - ProcDumpUtil.AttachProcDump(procDumpInfo.Value, hostProcess.Id, hostProcess.ProcessName); + ProcDumpUtil.AttachProcDump(procDumpInfo.Value, hostProcess.Id); } // We wait until the DTE instance is up before we're good From e6a8433527ad4a2849fd59babc8b5fc2fe3c5b7a Mon Sep 17 00:00:00 2001 From: Ashley Hauck Date: Thu, 27 Jul 2017 18:22:50 +0000 Subject: [PATCH 044/205] Set /maxcpucount:1 for Linux/Mac builds Hitting a file lock issue caused by parallel builds --- cibuild.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cibuild.sh b/cibuild.sh index cbd41c6e91570..fa600d76797f0 100755 --- a/cibuild.sh +++ b/cibuild.sh @@ -105,7 +105,7 @@ dotnet restore ${RESTORE_ARGS} ${THIS_DIR}/build/ToolsetPackages/BaseToolset.csp echo "Restoring CrossPlatform.sln" dotnet restore ${RESTORE_ARGS} ${THIS_DIR}/CrossPlatform.sln -BUILD_ARGS="-c ${BUILD_CONFIGURATION} -r ${RUNTIME_ID} /nologo /consoleloggerparameters:Verbosity=minimal;summary /filelogger /fileloggerparameters:Verbosity=normal;logFile=${BUILD_LOG_PATH} /p:RoslynRuntimeIdentifier=${RUNTIME_ID}" +BUILD_ARGS="-c ${BUILD_CONFIGURATION} -r ${RUNTIME_ID} /nologo /consoleloggerparameters:Verbosity=minimal;summary /filelogger /fileloggerparameters:Verbosity=normal;logFile=${BUILD_LOG_PATH} /p:RoslynRuntimeIdentifier=${RUNTIME_ID} /maxcpucount:1" echo "Building bootstrap CscCore" dotnet publish ${SRC_PATH}/Compilers/CSharp/CscCore -o ${BOOTSTRAP_PATH}/csc ${BUILD_ARGS} From 846e02cd477bcf67b890c8feb9656daa8a5f1846 Mon Sep 17 00:00:00 2001 From: CyrusNajmabadi Date: Thu, 27 Jul 2017 12:48:08 -0700 Subject: [PATCH 045/205] No pattern matching with dynamic. --- .../CSharpAsAndNullCheckTests.cs | 17 ++++++++++++++++ ...rpIsAndCastCheckDiagnosticAnalyzerTests.cs | 20 +++++++++++++++++++ .../CSharpAsAndNullCheckDiagnosticAnalyzer.cs | 6 ++++++ .../CSharpIsAndCastCheckDiagnosticAnalyzer.cs | 6 ++++++ 4 files changed, 49 insertions(+) diff --git a/src/EditorFeatures/CSharpTest/UsePatternMatching/CSharpAsAndNullCheckTests.cs b/src/EditorFeatures/CSharpTest/UsePatternMatching/CSharpAsAndNullCheckTests.cs index f514b7cbe0b07..6170954f319e0 100644 --- a/src/EditorFeatures/CSharpTest/UsePatternMatching/CSharpAsAndNullCheckTests.cs +++ b/src/EditorFeatures/CSharpTest/UsePatternMatching/CSharpAsAndNullCheckTests.cs @@ -726,6 +726,23 @@ void M() { } } +}"); + } + + [WorkItem(21172, "https://github.com/dotnet/roslyn/issues/21172")] + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsInlineTypeCheck)] + public async Task TestMissingWithDynamic() + { + await TestMissingAsync( +@"class C +{ + void M(object o) + { + [|var|] x = o as dynamic; + if (x != null) + { + } + } }"); } } diff --git a/src/EditorFeatures/CSharpTest/UsePatternMatching/CSharpIsAndCastCheckDiagnosticAnalyzerTests.cs b/src/EditorFeatures/CSharpTest/UsePatternMatching/CSharpIsAndCastCheckDiagnosticAnalyzerTests.cs index 7f16164a55d6b..90a9d1d5be3c9 100644 --- a/src/EditorFeatures/CSharpTest/UsePatternMatching/CSharpIsAndCastCheckDiagnosticAnalyzerTests.cs +++ b/src/EditorFeatures/CSharpTest/UsePatternMatching/CSharpIsAndCastCheckDiagnosticAnalyzerTests.cs @@ -538,5 +538,25 @@ public object Convert(object value) } }"); } + + [WorkItem(21172, "https://github.com/dotnet/roslyn/issues/21172")] + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsInlineTypeCheck)] + public async Task TestMissingWithDynamic() + { + await TestMissingInRegularAndScriptAsync( +@" +class C +{ + public object Convert(object value) + { + if (value is dynamic) + { + [|dynamic|] tmp = (dynamic)value; + } + + return null; + } +}"); + } } } diff --git a/src/Features/CSharp/Portable/UsePatternMatching/CSharpAsAndNullCheckDiagnosticAnalyzer.cs b/src/Features/CSharp/Portable/UsePatternMatching/CSharpAsAndNullCheckDiagnosticAnalyzer.cs index 33733171a2dbb..2a8fe989e9a61 100644 --- a/src/Features/CSharp/Portable/UsePatternMatching/CSharpAsAndNullCheckDiagnosticAnalyzer.cs +++ b/src/Features/CSharp/Portable/UsePatternMatching/CSharpAsAndNullCheckDiagnosticAnalyzer.cs @@ -103,6 +103,12 @@ private void SyntaxNodeAction(SyntaxNodeAnalysisContext syntaxContext) return; } + if (asType?.TypeKind == TypeKind.Dynamic) + { + // Not legal to use dynamic in a pattern. + return; + } + var localSymbol = (ILocalSymbol)semanticModel.GetDeclaredSymbol(declarator); if (!localSymbol.Type.Equals(asType)) { diff --git a/src/Features/CSharp/Portable/UsePatternMatching/CSharpIsAndCastCheckDiagnosticAnalyzer.cs b/src/Features/CSharp/Portable/UsePatternMatching/CSharpIsAndCastCheckDiagnosticAnalyzer.cs index 1428762ef9a67..1d8249673bd57 100644 --- a/src/Features/CSharp/Portable/UsePatternMatching/CSharpIsAndCastCheckDiagnosticAnalyzer.cs +++ b/src/Features/CSharp/Portable/UsePatternMatching/CSharpIsAndCastCheckDiagnosticAnalyzer.cs @@ -112,6 +112,12 @@ private void SyntaxNodeAction(SyntaxNodeAnalysisContext syntaxContext) return; } + if (isType?.TypeKind == TypeKind.Dynamic) + { + // Not legal to use dynamic in a pattern. + return; + } + if (!localSymbol.Type.Equals(isType)) { // we have something like: From 5a7087f84a48db5ab3182ec241e1532bd62b560f Mon Sep 17 00:00:00 2001 From: CyrusNajmabadi Date: Thu, 27 Jul 2017 12:00:34 -0700 Subject: [PATCH 046/205] Change Generated-Code analysis to be a language service, not a workspace service. --- .../Utilities/GoToHelpers/GoToTestHelpers.vb | 5 ++++- .../CSharp/Portable/CSharpWorkspace.csproj | 1 + .../CSharpGeneratedCodeRecognitionService.cs | 13 +++++++++++++ ...s => AbstractGeneratedCodeRecognitionService.cs} | 6 +----- .../IGeneratedCodeRecognitionService.cs | 2 +- .../Shared/Extensions/DocumentExtensions.cs | 3 +-- src/Workspaces/Core/Portable/Workspaces.csproj | 2 +- .../VisualBasic/Portable/BasicWorkspace.vbproj | 1 + .../VisualBasicGeneratedCodeRecognitionService.vb | 12 ++++++++++++ 9 files changed, 35 insertions(+), 10 deletions(-) create mode 100644 src/Workspaces/CSharp/Portable/GeneratedCodeRecognition/CSharpGeneratedCodeRecognitionService.cs rename src/Workspaces/Core/Portable/GeneratedCodeRecognition/{GeneratedCodeRecognitionServiceFactory.cs => AbstractGeneratedCodeRecognitionService.cs} (78%) create mode 100644 src/Workspaces/VisualBasic/Portable/GeneratedCodeRecognition/VisualBasicGeneratedCodeRecognitionService.vb diff --git a/src/EditorFeatures/TestUtilities2/Utilities/GoToHelpers/GoToTestHelpers.vb b/src/EditorFeatures/TestUtilities2/Utilities/GoToHelpers/GoToTestHelpers.vb index c7c42d392eab7..f820ecba7c926 100644 --- a/src/EditorFeatures/TestUtilities2/Utilities/GoToHelpers/GoToTestHelpers.vb +++ b/src/EditorFeatures/TestUtilities2/Utilities/GoToHelpers/GoToTestHelpers.vb @@ -1,10 +1,12 @@ ' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +Imports Microsoft.CodeAnalysis.CSharp.GeneratedCodeRecognition Imports Microsoft.CodeAnalysis.Editor.Host Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces Imports Microsoft.CodeAnalysis.GeneratedCodeRecognition Imports Microsoft.CodeAnalysis.Navigation Imports Microsoft.CodeAnalysis.Text +Imports Microsoft.CodeAnalysis.VisualBasic.GeneratedCodeRecognition Imports Microsoft.VisualStudio.Composition Imports Microsoft.VisualStudio.Text @@ -13,7 +15,8 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Utilities.GoToHelpers Public ReadOnly Catalog As ComposableCatalog = TestExportProvider.MinimumCatalogWithCSharpAndVisualBasic.WithParts( GetType(MockDocumentNavigationServiceFactory), GetType(DefaultSymbolNavigationServiceFactory), - GetType(GeneratedCodeRecognitionService)) + GetType(CSharpGeneratedCodeRecognitionService), + GetType(VisualBasicGeneratedCodeRecognitionService)) Public ReadOnly ExportProvider As ExportProvider = MinimalTestExportProvider.CreateExportProvider(Catalog) diff --git a/src/Workspaces/CSharp/Portable/CSharpWorkspace.csproj b/src/Workspaces/CSharp/Portable/CSharpWorkspace.csproj index 51ab5ed07fab4..89eab58af1adc 100644 --- a/src/Workspaces/CSharp/Portable/CSharpWorkspace.csproj +++ b/src/Workspaces/CSharp/Portable/CSharpWorkspace.csproj @@ -190,6 +190,7 @@ + diff --git a/src/Workspaces/CSharp/Portable/GeneratedCodeRecognition/CSharpGeneratedCodeRecognitionService.cs b/src/Workspaces/CSharp/Portable/GeneratedCodeRecognition/CSharpGeneratedCodeRecognitionService.cs new file mode 100644 index 0000000000000..bf975578d67fd --- /dev/null +++ b/src/Workspaces/CSharp/Portable/GeneratedCodeRecognition/CSharpGeneratedCodeRecognitionService.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Composition; +using Microsoft.CodeAnalysis.GeneratedCodeRecognition; +using Microsoft.CodeAnalysis.Host.Mef; + +namespace Microsoft.CodeAnalysis.CSharp.GeneratedCodeRecognition +{ + [ExportLanguageService(typeof(IGeneratedCodeRecognitionService), LanguageNames.CSharp), Shared] + internal class CSharpGeneratedCodeRecognitionService : AbstractGeneratedCodeRecognitionService + { + } +} diff --git a/src/Workspaces/Core/Portable/GeneratedCodeRecognition/GeneratedCodeRecognitionServiceFactory.cs b/src/Workspaces/Core/Portable/GeneratedCodeRecognition/AbstractGeneratedCodeRecognitionService.cs similarity index 78% rename from src/Workspaces/Core/Portable/GeneratedCodeRecognition/GeneratedCodeRecognitionServiceFactory.cs rename to src/Workspaces/Core/Portable/GeneratedCodeRecognition/AbstractGeneratedCodeRecognitionService.cs index 80c3e0707c6c2..84ac0f73a4242 100644 --- a/src/Workspaces/Core/Portable/GeneratedCodeRecognition/GeneratedCodeRecognitionServiceFactory.cs +++ b/src/Workspaces/Core/Portable/GeneratedCodeRecognition/AbstractGeneratedCodeRecognitionService.cs @@ -1,18 +1,14 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System.Composition; using System.Threading; -using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.LanguageServices; using Microsoft.CodeAnalysis.Shared.Extensions; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.GeneratedCodeRecognition { - [ExportWorkspaceService(typeof(IGeneratedCodeRecognitionService)), Shared] - internal class GeneratedCodeRecognitionService : IGeneratedCodeRecognitionService + internal abstract class AbstractGeneratedCodeRecognitionService : IGeneratedCodeRecognitionService { - public bool IsGeneratedCode(Document document, CancellationToken cancellationToken) { var syntaxTree = document.GetSyntaxTreeSynchronously(cancellationToken); diff --git a/src/Workspaces/Core/Portable/GeneratedCodeRecognition/IGeneratedCodeRecognitionService.cs b/src/Workspaces/Core/Portable/GeneratedCodeRecognition/IGeneratedCodeRecognitionService.cs index ba0bdf5d951f1..9a20c4fc86672 100644 --- a/src/Workspaces/Core/Portable/GeneratedCodeRecognition/IGeneratedCodeRecognitionService.cs +++ b/src/Workspaces/Core/Portable/GeneratedCodeRecognition/IGeneratedCodeRecognitionService.cs @@ -5,7 +5,7 @@ namespace Microsoft.CodeAnalysis.GeneratedCodeRecognition { - internal interface IGeneratedCodeRecognitionService : IWorkspaceService + internal interface IGeneratedCodeRecognitionService : ILanguageService { bool IsGeneratedCode(Document document, CancellationToken cancellationToken); } diff --git a/src/Workspaces/Core/Portable/Shared/Extensions/DocumentExtensions.cs b/src/Workspaces/Core/Portable/Shared/Extensions/DocumentExtensions.cs index ee2d675d304ca..e2ac624346e20 100644 --- a/src/Workspaces/Core/Portable/Shared/Extensions/DocumentExtensions.cs +++ b/src/Workspaces/Core/Portable/Shared/Extensions/DocumentExtensions.cs @@ -192,8 +192,7 @@ public static async Task GetPartialSemanticModelAsync(this Docume public static bool IsGeneratedCode(this Document document, CancellationToken cancellationToken) { - var solution = document.Project.Solution; - var generatedCodeRecognitionService = solution.Workspace.Services.GetService(); + var generatedCodeRecognitionService = document.GetLanguageService(); return generatedCodeRecognitionService?.IsGeneratedCode(document, cancellationToken) == true; } } diff --git a/src/Workspaces/Core/Portable/Workspaces.csproj b/src/Workspaces/Core/Portable/Workspaces.csproj index 28273206767e3..b28ed182c129e 100644 --- a/src/Workspaces/Core/Portable/Workspaces.csproj +++ b/src/Workspaces/Core/Portable/Workspaces.csproj @@ -773,7 +773,7 @@ - + diff --git a/src/Workspaces/VisualBasic/Portable/BasicWorkspace.vbproj b/src/Workspaces/VisualBasic/Portable/BasicWorkspace.vbproj index 0959f53dce06a..5739a5d554b48 100644 --- a/src/Workspaces/VisualBasic/Portable/BasicWorkspace.vbproj +++ b/src/Workspaces/VisualBasic/Portable/BasicWorkspace.vbproj @@ -164,6 +164,7 @@ + diff --git a/src/Workspaces/VisualBasic/Portable/GeneratedCodeRecognition/VisualBasicGeneratedCodeRecognitionService.vb b/src/Workspaces/VisualBasic/Portable/GeneratedCodeRecognition/VisualBasicGeneratedCodeRecognitionService.vb new file mode 100644 index 0000000000000..f50df15a3fa96 --- /dev/null +++ b/src/Workspaces/VisualBasic/Portable/GeneratedCodeRecognition/VisualBasicGeneratedCodeRecognitionService.vb @@ -0,0 +1,12 @@ +' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +Imports System.Composition +Imports Microsoft.CodeAnalysis.GeneratedCodeRecognition +Imports Microsoft.CodeAnalysis.Host.Mef + +Namespace Microsoft.CodeAnalysis.VisualBasic.GeneratedCodeRecognition + + Friend Class VisualBasicGeneratedCodeRecognitionService + Inherits AbstractGeneratedCodeRecognitionService + End Class +End Namespace From ca2cdf8a4706df2a91004f580d4ccbc0932bfe3b Mon Sep 17 00:00:00 2001 From: Jared Parsons Date: Thu, 27 Jul 2017 15:20:02 -0700 Subject: [PATCH 047/205] Work around sdk 1.1 compat bug Recent builds of the SDK introduced a bug around referencing netstandard 1.6 projects. This trigged on several Roslyn projects and cause build breaks with newer builds of VS. Suppressing the check for now. Will undo when we move to 2.0 SDK https://github.com/dotnet/roslyn/issues/21183 --- build/Targets/Settings.props | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build/Targets/Settings.props b/build/Targets/Settings.props index ddaee2cec1419..f4414d14df677 100644 --- a/build/Targets/Settings.props +++ b/build/Targets/Settings.props @@ -75,6 +75,9 @@ {RawFileName}; + + false + $(MSBuildSDKsPath)\Microsoft.NET.Sdk\Sdk\ PackageReference From 2eadfcd952c78b28fd65bd0a8f66c4068b379a71 Mon Sep 17 00:00:00 2001 From: CyrusNajmabadi Date: Thu, 27 Jul 2017 16:45:11 -0700 Subject: [PATCH 048/205] Remove Esent entirely from Roslyn. --- build/Targets/Packages.props | 1 - build/ToolsetPackages/BaseToolset.csproj | 1 - build/config/SignToolData.json | 1 - ...soft.CodeAnalysis.Workspaces.Common.nuspec | 1 - .../BuildDevDivInsertionFiles.vb | 3 - .../Roslyn/DevDivPackagesRoslyn.csproj | 3 - .../EsentPersistentStorageTests1.cs | 18 - .../VisualStudioWorkspaceImpl.cs | 4 - src/VisualStudio/Setup/AssemblyRedirects.cs | 1 - .../Setup/VisualStudioSetup.csproj | 1 - .../Workspace/Esent/EsentPersistentStorage.cs | 397 ------------------ .../Esent/EsentPersistentStorageService.cs | 48 --- .../Esent/EsentStorage.AbstractTable.cs | 117 ------ .../EsentStorage.AbstractTableAccessor.cs | 149 ------- .../Esent/EsentStorage.DocumentTable.cs | 68 --- .../EsentStorage.DocumentTableAccessor.cs | 63 --- .../EsentStorage.IdentifierLocationTable.cs | 67 --- ...Storage.IdentifierLocationTableAccessor.cs | 103 ----- .../Esent/EsentStorage.IdentifierTable.cs | 62 --- .../Workspace/Esent/EsentStorage.NameTable.cs | 62 --- .../Esent/EsentStorage.OpenSession.cs | 82 ---- .../Workspace/Esent/EsentStorage.Pool.cs | 71 ---- .../EsentStorage.ProjectDocumentTable.cs | 90 ---- ...entStorage.ProjectDocumentTableAccessor.cs | 99 ----- .../Esent/EsentStorage.ProjectTable.cs | 62 --- .../EsentStorage.ProjectTableAccessor.cs | 64 --- .../Esent/EsentStorage.SolutionTable.cs | 59 --- .../EsentStorage.SolutionTableAccessor.cs | 65 --- .../EsentStorage.StringNameTableAccessor.cs | 63 --- .../Esent/EsentStorage.TableKinds.cs | 17 - .../Desktop/Workspace/Esent/EsentStorage.cs | 332 --------------- .../PersistenceStorageServiceFactory.cs | 5 - .../Workspace/Storage/StorageDatabase.cs | 1 - .../Core/Desktop/Workspaces.Desktop.csproj | 1 - 34 files changed, 2181 deletions(-) delete mode 100644 src/VisualStudio/CSharp/Test/PersistentStorage/EsentPersistentStorageTests1.cs delete mode 100644 src/Workspaces/Core/Desktop/Workspace/Esent/EsentPersistentStorage.cs delete mode 100644 src/Workspaces/Core/Desktop/Workspace/Esent/EsentPersistentStorageService.cs delete mode 100644 src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.AbstractTable.cs delete mode 100644 src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.AbstractTableAccessor.cs delete mode 100644 src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.DocumentTable.cs delete mode 100644 src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.DocumentTableAccessor.cs delete mode 100644 src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.IdentifierLocationTable.cs delete mode 100644 src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.IdentifierLocationTableAccessor.cs delete mode 100644 src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.IdentifierTable.cs delete mode 100644 src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.NameTable.cs delete mode 100644 src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.OpenSession.cs delete mode 100644 src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.Pool.cs delete mode 100644 src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.ProjectDocumentTable.cs delete mode 100644 src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.ProjectDocumentTableAccessor.cs delete mode 100644 src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.ProjectTable.cs delete mode 100644 src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.ProjectTableAccessor.cs delete mode 100644 src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.SolutionTable.cs delete mode 100644 src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.SolutionTableAccessor.cs delete mode 100644 src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.StringNameTableAccessor.cs delete mode 100644 src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.TableKinds.cs delete mode 100644 src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.cs diff --git a/build/Targets/Packages.props b/build/Targets/Packages.props index bf08f35add45e..ce9a796d247f4 100644 --- a/build/Targets/Packages.props +++ b/build/Targets/Packages.props @@ -10,7 +10,6 @@ 0.9.2 3.0.0-unstable0090 0.22.0 - 1.9.4 0.2.0 1.0.0 1.1.0-g0701ee829f diff --git a/build/ToolsetPackages/BaseToolset.csproj b/build/ToolsetPackages/BaseToolset.csproj index 9872d0a6af949..9ba6a3b5e89d8 100644 --- a/build/ToolsetPackages/BaseToolset.csproj +++ b/build/ToolsetPackages/BaseToolset.csproj @@ -27,6 +27,5 @@ - diff --git a/build/config/SignToolData.json b/build/config/SignToolData.json index 4cf776083649d..1d6bfc3ed7269 100644 --- a/build/config/SignToolData.json +++ b/build/config/SignToolData.json @@ -108,7 +108,6 @@ ], "exclude": [ - "Esent.Interop.dll", "Microsoft.CodeAnalysis.Elfie.dll", "Microsoft.DiaSymReader.dll", "Microsoft.DiaSymReader.Native.amd64.dll", diff --git a/src/NuGet/Microsoft.CodeAnalysis.Workspaces.Common.nuspec b/src/NuGet/Microsoft.CodeAnalysis.Workspaces.Common.nuspec index 1e3cba09cc498..f22c777b09b43 100644 --- a/src/NuGet/Microsoft.CodeAnalysis.Workspaces.Common.nuspec +++ b/src/NuGet/Microsoft.CodeAnalysis.Workspaces.Common.nuspec @@ -21,7 +21,6 @@ - diff --git a/src/Setup/DevDivInsertionFiles/BuildDevDivInsertionFiles.vb b/src/Setup/DevDivInsertionFiles/BuildDevDivInsertionFiles.vb index b436d9ac7d627..8269db37530bc 100644 --- a/src/Setup/DevDivInsertionFiles/BuildDevDivInsertionFiles.vb +++ b/src/Setup/DevDivInsertionFiles/BuildDevDivInsertionFiles.vb @@ -158,7 +158,6 @@ Public Class BuildDevDivInsertionFiles Private ReadOnly IntegrationTestFiles As String() = { "xunit.*.dll", "*.UnitTests.dll.config", - "Esent.Interop.dll", "InteractiveHost.exe", "Microsoft.CodeAnalysis.CSharp.dll", "Microsoft.CodeAnalysis.CSharp.EditorFeatures.dll", @@ -293,7 +292,6 @@ Public Class BuildDevDivInsertionFiles "xunit.*.dll", "PerfTests", "BasicUndo.dll", - "Esent.Interop.dll", "InteractiveHost.exe", "Microsoft.CodeAnalysis.CSharp.dll", "Microsoft.CodeAnalysis.CSharp.EditorFeatures.dll", @@ -862,7 +860,6 @@ Public Class BuildDevDivInsertionFiles add("Dlls\TestUtilities.Desktop\Roslyn.Test.Utilities.Desktop.dll") add("Dlls\TestUtilities\Roslyn.Test.Utilities.dll") add("UnitTests\EditorServicesTest\BasicUndo.dll") - add("UnitTests\EditorServicesTest\Esent.Interop.dll") add("UnitTests\EditorServicesTest\Moq.dll") add("UnitTests\EditorServicesTest\Microsoft.CodeAnalysis.Test.Resources.Proprietary.dll") add("UnitTests\EditorServicesTest\Microsoft.DiaSymReader.PortablePdb.dll") diff --git a/src/Setup/DevDivPackages/Roslyn/DevDivPackagesRoslyn.csproj b/src/Setup/DevDivPackages/Roslyn/DevDivPackagesRoslyn.csproj index 30790c9e53c2b..888007be7ef7d 100644 --- a/src/Setup/DevDivPackages/Roslyn/DevDivPackagesRoslyn.csproj +++ b/src/Setup/DevDivPackages/Roslyn/DevDivPackagesRoslyn.csproj @@ -37,9 +37,6 @@ $(SystemReflectionMetadataVersion) - - $(ManagedEsentVersion) - $(SystemAppContextVersion) diff --git a/src/VisualStudio/CSharp/Test/PersistentStorage/EsentPersistentStorageTests1.cs b/src/VisualStudio/CSharp/Test/PersistentStorage/EsentPersistentStorageTests1.cs deleted file mode 100644 index 1dccf320a3847..0000000000000 --- a/src/VisualStudio/CSharp/Test/PersistentStorage/EsentPersistentStorageTests1.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.CodeAnalysis.Esent; -using Microsoft.CodeAnalysis.Host; - -namespace Microsoft.CodeAnalysis.UnitTests.WorkspaceServices -{ - /// - /// Tests are inherited from . That way we can - /// write tests once and have them run against all - /// implementations. - /// - public class EsentPersistentStorageTests : AbstractPersistentStorageTests - { - internal override IPersistentStorageService GetStorageService(IPersistentStorageFaultInjector faultInjector) - => new EsentPersistentStorageService(_persistentEnabledOptionService, testing: true); - } -} diff --git a/src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioWorkspaceImpl.cs b/src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioWorkspaceImpl.cs index 3c011e2d0248a..e7878e73b248e 100644 --- a/src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioWorkspaceImpl.cs +++ b/src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioWorkspaceImpl.cs @@ -14,7 +14,6 @@ using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Notification; -using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.Utilities; using Microsoft.CodeAnalysis.SolutionCrawler; using Microsoft.CodeAnalysis.Storage; @@ -26,14 +25,11 @@ using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell.Interop; using Microsoft.VisualStudio.Text; -using Microsoft.VisualStudio.TextManager.Interop; using Roslyn.Utilities; using Roslyn.VisualStudio.ProjectSystem; using VSLangProj; using VSLangProj140; -using OLEServiceProvider = Microsoft.VisualStudio.OLE.Interop.IServiceProvider; using OleInterop = Microsoft.VisualStudio.OLE.Interop; -using Microsoft.CodeAnalysis.Esent; namespace Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem { diff --git a/src/VisualStudio/Setup/AssemblyRedirects.cs b/src/VisualStudio/Setup/AssemblyRedirects.cs index d2c2f6e515fe9..058ff808aeccf 100644 --- a/src/VisualStudio/Setup/AssemblyRedirects.cs +++ b/src/VisualStudio/Setup/AssemblyRedirects.cs @@ -23,7 +23,6 @@ [assembly: ProvideRoslynBindingRedirection("Microsoft.VisualStudio.LanguageServices.CSharp.dll")] [assembly: ProvideRoslynBindingRedirection("Microsoft.VisualStudio.LanguageServices.SolutionExplorer.dll")] -[assembly: ProvideRoslynBindingRedirection("Esent.Interop.dll")] [assembly: ProvideRoslynBindingRedirection("Microsoft.CodeAnalysis.Elfie.dll")] [assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\SQLitePCLRaw.batteries_green.DLL")] diff --git a/src/VisualStudio/Setup/VisualStudioSetup.csproj b/src/VisualStudio/Setup/VisualStudioSetup.csproj index 2ba9e958dea17..873a922c5e7ce 100644 --- a/src/VisualStudio/Setup/VisualStudioSetup.csproj +++ b/src/VisualStudio/Setup/VisualStudioSetup.csproj @@ -184,7 +184,6 @@ - diff --git a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentPersistentStorage.cs b/src/Workspaces/Core/Desktop/Workspace/Esent/EsentPersistentStorage.cs deleted file mode 100644 index ac17abd648e70..0000000000000 --- a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentPersistentStorage.cs +++ /dev/null @@ -1,397 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Concurrent; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.CodeAnalysis.Host; -using Microsoft.CodeAnalysis.Internal.Log; -using Microsoft.CodeAnalysis.Options; -using Microsoft.CodeAnalysis.Storage; -using Microsoft.Isam.Esent; -using Microsoft.Isam.Esent.Interop; -using Roslyn.Utilities; - -namespace Microsoft.CodeAnalysis.Esent -{ - internal partial class EsentPersistentStorage : AbstractPersistentStorage - { - // cache delegates so that we don't re-create it every times - private readonly Func _readStreamSolution; - private readonly Func _readStream; - private readonly Func _writeStreamSolution; - private readonly Func _writeStream; - - private readonly ConcurrentDictionary _nameTableCache; - private readonly EsentStorage _esentStorage; - - public EsentPersistentStorage( - IOptionService optionService, - string workingFolderPath, - string solutionFilePath, - string databaseFile, - Action disposer) - : base(optionService, workingFolderPath, solutionFilePath, databaseFile, disposer) - { - // cache delegates - _readStreamSolution = ReadStreamSolution; - _readStream = ReadStream; - _writeStreamSolution = WriteStreamSolution; - _writeStream = WriteStream; - - // solution must exist in disk. otherwise, we shouldn't be here at all. - Contract.ThrowIfTrue(string.IsNullOrWhiteSpace(solutionFilePath)); - - _nameTableCache = new ConcurrentDictionary(StringComparer.OrdinalIgnoreCase); - - var enablePerformanceMonitor = optionService.GetOption(PersistentStorageOptions.EsentPerformanceMonitor); - _esentStorage = new EsentStorage(DatabaseFile, enablePerformanceMonitor); - } - - public override void Initialize(Solution solution) - { - _esentStorage.Initialize(); - } - - public override Task ReadStreamAsync(Document document, string name, CancellationToken cancellationToken = default) - { - Contract.ThrowIfTrue(string.IsNullOrWhiteSpace(name)); - - if (!PersistenceEnabled) - { - return SpecializedTasks.Default(); - } - - if (!TryGetProjectAndDocumentKey(document, out var key) || - !TryGetUniqueNameId(name, out var nameId)) - { - return SpecializedTasks.Default(); - } - - var stream = EsentExceptionWrapper(key, nameId, _readStream, cancellationToken); - return SpecializedTasks.DefaultOrResult(stream); - } - - public override Task ReadStreamAsync(Project project, string name, CancellationToken cancellationToken = default) - { - Contract.ThrowIfTrue(string.IsNullOrWhiteSpace(name)); - - if (!PersistenceEnabled) - { - return SpecializedTasks.Default(); - } - - if (!TryGetProjectKey(project, out var key) || - !TryGetUniqueNameId(name, out var nameId)) - { - return SpecializedTasks.Default(); - } - - var stream = EsentExceptionWrapper(key, nameId, _readStream, cancellationToken); - return SpecializedTasks.DefaultOrResult(stream); - } - - public override Task ReadStreamAsync(string name, CancellationToken cancellationToken = default) - { - Contract.ThrowIfTrue(string.IsNullOrWhiteSpace(name)); - - if (!PersistenceEnabled) - { - return SpecializedTasks.Default(); - } - - if (!TryGetUniqueNameId(name, out var nameId)) - { - return SpecializedTasks.Default(); - } - - var stream = EsentExceptionWrapper(nameId, _readStreamSolution, cancellationToken); - return SpecializedTasks.DefaultOrResult(stream); - } - - private Stream ReadStream(EsentStorage.Key key, int nameId, object unused1, object unused2, CancellationToken cancellationToken) - { - using (var accessor = GetAccessor(key)) - using (var esentStream = accessor.GetReadStream(key, nameId)) - { - if (esentStream == null) - { - return null; - } - - // this will copy over esent stream and let it go. - return SerializableBytes.CreateReadableStream(esentStream, cancellationToken); - } - } - - private Stream ReadStreamSolution(int nameId, object unused1, object unused2, object unused3, CancellationToken cancellationToken) - { - using (var accessor = _esentStorage.GetSolutionTableAccessor()) - using (var esentStream = accessor.GetReadStream(nameId)) - { - if (esentStream == null) - { - return null; - } - - // this will copy over esent stream and let it go. - return SerializableBytes.CreateReadableStream(esentStream, cancellationToken); - } - } - - public override Task WriteStreamAsync(Document document, string name, Stream stream, CancellationToken cancellationToken = default) - { - Contract.ThrowIfTrue(string.IsNullOrWhiteSpace(name)); - Contract.ThrowIfNull(stream); - - if (!PersistenceEnabled) - { - return SpecializedTasks.False; - } - - if (!TryGetProjectAndDocumentKey(document, out var key) || - !TryGetUniqueNameId(name, out var nameId)) - { - return SpecializedTasks.False; - } - - var success = EsentExceptionWrapper(key, nameId, stream, _writeStream, cancellationToken); - return success ? SpecializedTasks.True : SpecializedTasks.False; - } - - public override Task WriteStreamAsync(Project project, string name, Stream stream, CancellationToken cancellationToken = default) - { - Contract.ThrowIfTrue(string.IsNullOrWhiteSpace(name)); - Contract.ThrowIfNull(stream); - - if (!PersistenceEnabled) - { - return SpecializedTasks.False; - } - - if (!TryGetProjectKey(project, out var key) || - !TryGetUniqueNameId(name, out var nameId)) - { - return SpecializedTasks.False; - } - - var success = EsentExceptionWrapper(key, nameId, stream, _writeStream, cancellationToken); - return success ? SpecializedTasks.True : SpecializedTasks.False; - } - - public override Task WriteStreamAsync(string name, Stream stream, CancellationToken cancellationToken = default) - { - Contract.ThrowIfTrue(string.IsNullOrWhiteSpace(name)); - Contract.ThrowIfNull(stream); - - if (!PersistenceEnabled) - { - return SpecializedTasks.False; - } - - if (!TryGetUniqueNameId(name, out var nameId)) - { - return SpecializedTasks.False; - } - - var success = EsentExceptionWrapper(nameId, stream, _writeStreamSolution, cancellationToken); - - return success ? SpecializedTasks.True : SpecializedTasks.False; - } - - private bool WriteStream(EsentStorage.Key key, int nameId, Stream stream, object unused1, CancellationToken cancellationToken) - { - using (var accessor = GetAccessor(key)) - using (var esentStream = accessor.GetWriteStream(key, nameId)) - { - WriteToStream(stream, esentStream, cancellationToken); - return accessor.ApplyChanges(); - } - } - - private bool WriteStreamSolution(int nameId, Stream stream, object unused1, object unused2, CancellationToken cancellationToken) - { - using (var accessor = _esentStorage.GetSolutionTableAccessor()) - using (var esentStream = accessor.GetWriteStream(nameId)) - { - WriteToStream(stream, esentStream, cancellationToken); - return accessor.ApplyChanges(); - } - } - - public override void Close() - { - _esentStorage.Close(); - } - - private bool TryGetUniqueNameId(string name, out int id) - { - return TryGetUniqueId(name, false, out id); - } - - private bool TryGetUniqueFileId(string path, out int id) - { - return TryGetUniqueId(path, true, out id); - } - - private bool TryGetUniqueId(string value, bool fileCheck, out int id) - { - id = default; - - if (string.IsNullOrWhiteSpace(value)) - { - return false; - } - - // if we already know, get the id - if (_nameTableCache.TryGetValue(value, out id)) - { - return true; - } - - // we only persist for things that actually exist - if (fileCheck && !File.Exists(value)) - { - return false; - } - - try - { - var uniqueIdValue = fileCheck ? PathUtilities.GetRelativePath(Path.GetDirectoryName(SolutionFilePath), value) : value; - id = _nameTableCache.GetOrAdd(value, _esentStorage.GetUniqueId(uniqueIdValue)); - - return true; - } - catch (Exception ex) - { - // if we get fatal errors from esent such as disk out of space or log file corrupted by other process and etc - // don't crash VS, but let VS know it can't use esent. we will gracefully recover issue by using memory. - StorageDatabaseLogger.LogException(ex); - - return false; - } - } - - private static void WriteToStream(Stream inputStream, Stream esentStream, CancellationToken cancellationToken) - { - var buffer = SharedPools.ByteArray.Allocate(); - try - { - int bytesRead; - do - { - cancellationToken.ThrowIfCancellationRequested(); - - bytesRead = inputStream.Read(buffer, 0, buffer.Length); - if (bytesRead > 0) - { - esentStream.Write(buffer, 0, bytesRead); - } - } - while (bytesRead > 0); - - // flush the data and trim column size of necessary - esentStream.Flush(); - } - finally - { - SharedPools.ByteArray.Free(buffer); - } - } - - private EsentStorage.ProjectDocumentTableAccessor GetAccessor(EsentStorage.Key key) - { - return key.DocumentIdOpt.HasValue ? - _esentStorage.GetDocumentTableAccessor() : - (EsentStorage.ProjectDocumentTableAccessor)_esentStorage.GetProjectTableAccessor(); - } - - private bool TryGetProjectAndDocumentKey(Document document, out EsentStorage.Key key) - { - key = default; - if (!TryGetProjectId(document.Project, out var projectId, out var projectNameId) || - !TryGetUniqueFileId(document.FilePath, out var documentId)) - { - return false; - } - - key = new EsentStorage.Key(projectId, projectNameId, documentId); - return true; - } - - private bool TryGetProjectKey(Project project, out EsentStorage.Key key) - { - key = default; - if (!TryGetProjectId(project, out var projectId, out var projectNameId)) - { - return false; - } - - key = new EsentStorage.Key(projectId, projectNameId); - return true; - } - - private bool TryGetProjectId(Project project, out int projectId, out int projectNameId) - { - projectId = default; - projectNameId = default; - - return TryGetUniqueFileId(project.FilePath, out projectId) && TryGetUniqueNameId(project.Name, out projectNameId); - } - - private TResult EsentExceptionWrapper(TArg1 arg1, Func func, CancellationToken cancellationToken) - { - return EsentExceptionWrapper(arg1, (object)null, func, cancellationToken); - } - - private TResult EsentExceptionWrapper( - TArg1 arg1, TArg2 arg2, Func func, CancellationToken cancellationToken) - { - return EsentExceptionWrapper(arg1, arg2, (object)null, func, cancellationToken); - } - - private TResult EsentExceptionWrapper( - TArg1 arg1, TArg2 arg2, TArg3 arg3, Func func, CancellationToken cancellationToken) - { - return EsentExceptionWrapper(arg1, arg2, arg3, (object)null, func, cancellationToken); - } - - private TResult EsentExceptionWrapper( - TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4, Func func, CancellationToken cancellationToken) - { - try - { - return func(arg1, arg2, arg3, arg4, cancellationToken); - } - catch (EsentInvalidSesidException) - { - // operation was in-fly when Esent instance was shutdown - ignore the error - } - catch (OperationCanceledException) - { - } - catch (EsentException ex) - { - if (!_esentStorage.IsClosed) - { - // ignore esent exception if underlying storage was closed - // there is not much we can do here. - // internally we use it as a way to cache information between sessions anyway. - // no functionality will be affected by this except perf - Logger.Log(FunctionId.PersistenceService_WriteAsyncFailed, "Esent Failed : " + ex.Message); - } - } - catch (Exception ex) - { - // ignore exception - // there is not much we can do here. - // internally we use it as a way to cache information between sessions anyway. - // no functionality will be affected by this except perf - Logger.Log(FunctionId.PersistenceService_WriteAsyncFailed, "Failed : " + ex.Message); - } - - return default; - } - } -} diff --git a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentPersistentStorageService.cs b/src/Workspaces/Core/Desktop/Workspace/Esent/EsentPersistentStorageService.cs deleted file mode 100644 index 282358f41e43d..0000000000000 --- a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentPersistentStorageService.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.IO; -using Microsoft.CodeAnalysis.Host; -using Microsoft.CodeAnalysis.Options; -using Microsoft.CodeAnalysis.SolutionSize; -using Microsoft.CodeAnalysis.Storage; -using Microsoft.Isam.Esent.Interop; -using Roslyn.Utilities; - -namespace Microsoft.CodeAnalysis.Esent -{ - internal partial class EsentPersistentStorageService : AbstractPersistentStorageService - { - private const string StorageExtension = "vbcs.cache"; - private const string PersistentStorageFileName = "storage.ide"; - - public EsentPersistentStorageService( - IOptionService optionService, - SolutionSizeTracker solutionSizeTracker) - : base(optionService, solutionSizeTracker) - { - } - - public EsentPersistentStorageService(IOptionService optionService, bool testing) - : base(optionService, testing) - { - } - - protected override string GetDatabaseFilePath(string workingFolderPath) - { - Contract.ThrowIfTrue(string.IsNullOrWhiteSpace(workingFolderPath)); - return Path.Combine(workingFolderPath, StorageExtension, PersistentStorageFileName); - } - - protected override AbstractPersistentStorage OpenDatabase(Solution solution, string workingFolderPath, string databaseFilePath) - => new EsentPersistentStorage( - OptionService, workingFolderPath, solution.FilePath, databaseFilePath, this.Release); - - protected override bool ShouldDeleteDatabase(Exception exception) - { - // Access denied can happen when some other process is holding onto the DB. - // Don't want to delete it in that case. For all other cases, delete the db. - return !(exception is EsentAccessDeniedException); - } - } -} diff --git a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.AbstractTable.cs b/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.AbstractTable.cs deleted file mode 100644 index 8c2b89374e0c0..0000000000000 --- a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.AbstractTable.cs +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.Isam.Esent.Interop; -using Microsoft.Isam.Esent.Interop.Vista; - -namespace Microsoft.CodeAnalysis.Esent -{ - internal partial class EsentStorage - { - public abstract class AbstractTable - { - protected const string PrimaryIndexName = "PrimaryIndex"; - - public abstract void Create(JET_SESID sessionId, JET_DBID databaseId); - public abstract void Initialize(JET_SESID sessionId, JET_DBID databaseId); - public abstract AbstractTableAccessor GetTableAccessor(OpenSession openSession); - - protected JET_COLUMNCREATE CreateAutoIncrementIdColumn(string columnName) - { - return new JET_COLUMNCREATE() - { - szColumnName = columnName, - coltyp = JET_coltyp.Long, - grbit = ColumndefGrbit.ColumnAutoincrement | ColumndefGrbit.ColumnNotNULL - }; - } - - protected JET_COLUMNCREATE CreateIdColumn(string columnName) - { - return new JET_COLUMNCREATE() - { - szColumnName = columnName, - coltyp = JET_coltyp.Long, - grbit = ColumndefGrbit.ColumnNotNULL - }; - } - - protected JET_COLUMNCREATE CreateBinaryColumn(string columnName) - { - return new JET_COLUMNCREATE() - { - szColumnName = columnName, - coltyp = JET_coltyp.LongBinary, - grbit = ColumndefGrbit.None - }; - } - - protected JET_COLUMNCREATE CreateTextColumn(string columnName) - { - return new JET_COLUMNCREATE() - { - szColumnName = columnName, - coltyp = JET_coltyp.LongText, - cp = JET_CP.Unicode, - grbit = ColumndefGrbit.ColumnNotNULL - }; - } - - protected string CreateIndexKey(params string[] indexNames) - { - return "+" + string.Join("\0+", indexNames) + "\0\0"; - } - - protected JET_INDEXCREATE CreatePrimaryIndex(string indexKey) - { - return new JET_INDEXCREATE - { - szIndexName = PrimaryIndexName, - szKey = indexKey, - cbKey = indexKey.Length, - grbit = CreateIndexGrbit.IndexPrimary | CreateIndexGrbit.IndexUnique | CreateIndexGrbit.IndexDisallowNull, - ulDensity = 80 - }; - } - - protected JET_INDEXCREATE CreateIndex(string name, string indexKey) - { - return new JET_INDEXCREATE - { - szIndexName = name, - szKey = indexKey, - cbKey = indexKey.Length, - grbit = CreateIndexGrbit.IndexDisallowNull, - ulDensity = 80 - }; - } - - protected JET_INDEXCREATE CreateUniqueTextIndex(string name, string indexKey) - { - return new JET_INDEXCREATE - { - szIndexName = name, - szKey = indexKey, - cbKey = indexKey.Length, - grbit = CreateIndexGrbit.IndexUnique | CreateIndexGrbit.IndexDisallowNull | VistaGrbits.IndexDisallowTruncation, - ulDensity = 80, - // this should be 2000 bytes Max after vista - cbKeyMost = SystemParameters.KeyMost - }; - } - - protected JET_TABLECREATE CreateTable(string tableName, JET_COLUMNCREATE[] columns, JET_INDEXCREATE[] indexes) - { - return new JET_TABLECREATE() - { - szTableName = tableName, - ulPages = 16, - ulDensity = 80, - rgcolumncreate = columns, - cColumns = columns.Length, - rgindexcreate = indexes, - cIndexes = indexes.Length - }; - } - } - } -} diff --git a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.AbstractTableAccessor.cs b/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.AbstractTableAccessor.cs deleted file mode 100644 index e18101863a248..0000000000000 --- a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.AbstractTableAccessor.cs +++ /dev/null @@ -1,149 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.Isam.Esent.Interop; -using Roslyn.Utilities; - -namespace Microsoft.CodeAnalysis.Esent -{ - internal partial class EsentStorage - { - public abstract class AbstractTableAccessor : IDisposable - { - private readonly OpenSession _session; - private readonly string _tableName; - - private Table _table; - private Transaction _transaction; - private Update _updater; - - protected AbstractTableAccessor(OpenSession session, string tableName) - { - _session = session; - _tableName = tableName; - } - - protected void OpenTableForReading() - { - Contract.ThrowIfFalse(_table == null); - - _table = new Table(_session.SessionId, _session.DatabaseId, _tableName, OpenTableGrbit.ReadOnly); - } - - protected void OpenTableForUpdating() - { - OpenTableForUpdatingWithoutTransaction(); - - _transaction = new Transaction(_session.SessionId); - } - - protected void OpenTableForUpdatingWithoutTransaction() - { - Contract.ThrowIfFalse(_table == null); - _table = new Table(_session.SessionId, _session.DatabaseId, _tableName, OpenTableGrbit.Updatable); - } - - protected void EnsureTableForUpdating() - { - if (_table == null) - { - _table = new Table(_session.SessionId, _session.DatabaseId, _tableName, OpenTableGrbit.Updatable); - } - - if (_transaction == null) - { - _transaction = new Transaction(_session.SessionId); - } - } - - protected void PrepareUpdate(JET_prep mode) - { - Contract.ThrowIfFalse(_table != null); - - if (_updater != null) - { - _updater.Dispose(); - } - - _updater = new Update(_session.SessionId, TableId, mode); - } - - protected JET_SESID SessionId - { - get - { - return _session.SessionId; - } - } - - protected JET_TABLEID TableId - { - get - { - // one of OpenTable should have been called. otherwise, throw exception - return _table.JetTableid; - } - } - - public void Flush() - { - if (_transaction == null) - { - return; - } - - // commit existing transaction - _transaction.Commit(CommitTransactionGrbit.LazyFlush); - _transaction.Dispose(); - _transaction = null; - } - - public bool ApplyChanges() - { - try - { - var local = _updater; - _updater = null; - - if (local != null) - { - local.Save(); - local.Dispose(); - } - } - catch (EsentKeyDuplicateException) - { - return false; - } - catch (EsentWriteConflictException) - { - return false; - } - - Flush(); - - return true; - } - - public void Dispose() - { - if (_updater != null) - { - _updater.Dispose(); - } - - if (_transaction != null) - { - _transaction.Dispose(); - } - - if (_table != null) - { - _table.Dispose(); - } - - _session.Dispose(); - } - } - } -} diff --git a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.DocumentTable.cs b/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.DocumentTable.cs deleted file mode 100644 index ad0575e496ac3..0000000000000 --- a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.DocumentTable.cs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.Isam.Esent.Interop; -using Roslyn.Utilities; - -namespace Microsoft.CodeAnalysis.Esent -{ - internal partial class EsentStorage - { - public class DocumentTable : ProjectDocumentTable - { - private const string TableName = "DocumentTable"; - private const string NameColumnName = "Name"; - private const string ValueColumnName = "Value"; - - private JET_COLUMNID _projectColumnId; - private JET_COLUMNID _projectNameColumnId; - private JET_COLUMNID _documentColumnId; - private JET_COLUMNID _nameColumnId; - private JET_COLUMNID _valueColumnId; - - public override void Create(JET_SESID sessionId, JET_DBID databaseId) - { - var nameColumnCreate = CreateIdColumn(NameColumnName); - var valueColumnCreate = CreateBinaryColumn(ValueColumnName); - - var columns = CreateProjectDocumentColumns(nameColumnCreate, valueColumnCreate); - - var primaryIndexKey = CreateProjectDocumentIndexKey(NameColumnName); - - var indexes = new JET_INDEXCREATE[] - { - CreatePrimaryIndex(primaryIndexKey) - }; - - var tableCreate = CreateTable(TableName, columns, indexes); - - Api.JetCreateTableColumnIndex3(sessionId, databaseId, tableCreate); - - GetColumnIds(columns, out _projectColumnId, out _projectNameColumnId, out _documentColumnId); - - _nameColumnId = nameColumnCreate.columnid; - _valueColumnId = valueColumnCreate.columnid; - - Api.JetCloseTable(sessionId, tableCreate.tableid); - } - - public override void Initialize(JET_SESID sessionId, JET_DBID databaseId) - { - using (var table = new Table(sessionId, databaseId, TableName, OpenTableGrbit.ReadOnly)) - { - GetColumnIds(sessionId, table, out _projectColumnId, out _projectNameColumnId, out _documentColumnId); - - _nameColumnId = Api.GetTableColumnid(sessionId, table, NameColumnName); - _valueColumnId = Api.GetTableColumnid(sessionId, table, ValueColumnName); - } - } - - public override AbstractTableAccessor GetTableAccessor(OpenSession openSession) - { - return new DocumentTableAccessor( - openSession, TableName, PrimaryIndexName, - _projectColumnId, _projectNameColumnId, _documentColumnId, _nameColumnId, _valueColumnId); - } - } - } -} diff --git a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.DocumentTableAccessor.cs b/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.DocumentTableAccessor.cs deleted file mode 100644 index 3673fdcd31435..0000000000000 --- a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.DocumentTableAccessor.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.IO; -using Microsoft.Isam.Esent.Interop; - -namespace Microsoft.CodeAnalysis.Esent -{ - internal partial class EsentStorage - { - public class DocumentTableAccessor : ProjectDocumentTableAccessor - { - private readonly JET_COLUMNID _nameColumnId; - private readonly JET_COLUMNID _valueColumnId; - - public DocumentTableAccessor( - OpenSession session, string tableName, string primaryIndexName, - JET_COLUMNID projectColumnId, JET_COLUMNID projectNameColumnId, - JET_COLUMNID documentColumnId, JET_COLUMNID nameColumnId, JET_COLUMNID valueColumnId) : - base(session, tableName, primaryIndexName, projectColumnId, projectNameColumnId, documentColumnId) - { - _nameColumnId = nameColumnId; - _valueColumnId = valueColumnId; - } - - private bool TrySeek(Key key, int nameId) - { - return TrySeek(IndexName, key, nameId); - } - - public override Stream GetReadStream(Key key, int nameId) - { - OpenTableForReading(); - - if (TrySeek(key, nameId)) - { - return new ColumnStream(SessionId, TableId, _valueColumnId); - } - - return null; - } - - public override Stream GetWriteStream(Key key, int nameId) - { - OpenTableForUpdating(); - - if (TrySeek(key, nameId)) - { - PrepareUpdate(JET_prep.ReplaceNoLock); - } - else - { - PrepareUpdate(JET_prep.Insert); - - var args = GetColumnValues(key, _nameColumnId, nameId); - Api.SetColumns(SessionId, TableId, args); - Free(args); - } - - return new ColumnStream(SessionId, TableId, _valueColumnId); - } - } - } -} diff --git a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.IdentifierLocationTable.cs b/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.IdentifierLocationTable.cs deleted file mode 100644 index 9c6933e8d5223..0000000000000 --- a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.IdentifierLocationTable.cs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.Isam.Esent.Interop; - -namespace Microsoft.CodeAnalysis.Esent -{ - internal partial class EsentStorage - { - public class IdentifierLocationTable : ProjectDocumentTable - { - private const string TableName = "IdentifierLocationTable"; - - private const string IdentifierColumnName = "Identifier"; - private const string LocationsColumnName = "Locations"; - - private JET_COLUMNID _projectColumnId; - private JET_COLUMNID _projectNameColumnId; - private JET_COLUMNID _documentColumnId; - private JET_COLUMNID _identifierColumnId; - private JET_COLUMNID _locationsColumnId; - - public override void Create(JET_SESID sessionId, JET_DBID databaseId) - { - var identifierColumnCreate = CreateIdColumn(IdentifierColumnName); - var locationsColumnCreate = CreateBinaryColumn(LocationsColumnName); - - var columns = CreateProjectDocumentColumns(identifierColumnCreate, locationsColumnCreate); - - var primaryIndexKey = CreateProjectDocumentIndexKey(IdentifierColumnName); - - var indexes = new JET_INDEXCREATE[] - { - CreatePrimaryIndex(primaryIndexKey) - }; - - var tableCreate = CreateTable(TableName, columns, indexes); - - Api.JetCreateTableColumnIndex3(sessionId, databaseId, tableCreate); - - GetColumnIds(columns, out _projectColumnId, out _projectNameColumnId, out _documentColumnId); - - _identifierColumnId = identifierColumnCreate.columnid; - _locationsColumnId = locationsColumnCreate.columnid; - - Api.JetCloseTable(sessionId, tableCreate.tableid); - } - - public override void Initialize(JET_SESID sessionId, JET_DBID databaseId) - { - using (var table = new Table(sessionId, databaseId, TableName, OpenTableGrbit.ReadOnly)) - { - GetColumnIds(sessionId, table, out _projectColumnId, out _projectNameColumnId, out _documentColumnId); - - _identifierColumnId = Api.GetTableColumnid(sessionId, table, IdentifierColumnName); - _locationsColumnId = Api.GetTableColumnid(sessionId, table, LocationsColumnName); - } - } - - public override AbstractTableAccessor GetTableAccessor(OpenSession openSession) - { - return new IdentifierLocationTableAccessor( - openSession, TableName, PrimaryIndexName, - _projectColumnId, _projectNameColumnId, _documentColumnId, _identifierColumnId, _locationsColumnId); - } - } - } -} diff --git a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.IdentifierLocationTableAccessor.cs b/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.IdentifierLocationTableAccessor.cs deleted file mode 100644 index 1800c80897869..0000000000000 --- a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.IdentifierLocationTableAccessor.cs +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.IO; -using System.Threading; -using Microsoft.Isam.Esent.Interop; - -namespace Microsoft.CodeAnalysis.Esent -{ - internal partial class EsentStorage - { - public class IdentifierLocationTableAccessor : ProjectDocumentTableAccessor - { - private readonly JET_COLUMNID _identifierColumnId; - private readonly JET_COLUMNID _valueColumnId; - - public IdentifierLocationTableAccessor( - OpenSession session, string tableName, string primaryIndexName, - JET_COLUMNID projectColumnId, JET_COLUMNID projectNameColumnId, JET_COLUMNID documentColumnId, - JET_COLUMNID identifierColumnId, JET_COLUMNID valueColumnId) : - base(session, tableName, primaryIndexName, projectColumnId, projectNameColumnId, documentColumnId) - { - _identifierColumnId = identifierColumnId; - _valueColumnId = valueColumnId; - } - - private bool TrySeek(Key key, int identifierId) - { - return TrySeek(IndexName, key, identifierId); - } - - public bool Contains(Key key, int identifierId) - { - OpenTableForReading(); - - return TrySeek(key, identifierId); - } - - public void Delete(Key key, CancellationToken cancellationToken) - { - OpenTableForUpdating(); - - // set upper bound using index - Api.JetSetCurrentIndex(SessionId, TableId, IndexName); - MakeKey(key); - - // put the cursor at the first record and set range for exact match - if (!Api.TrySeek(SessionId, TableId, SeekGrbit.SeekEQ)) - { - return; - } - - MakeKey(key); - if (!Api.TrySetIndexRange(SessionId, TableId, SetIndexRangeGrbit.RangeInclusive | SetIndexRangeGrbit.RangeUpperLimit)) - { - return; - } - - // delete all matching record - do - { - cancellationToken.ThrowIfCancellationRequested(); - - Api.JetDelete(SessionId, TableId); - } - while (Api.TryMoveNext(SessionId, TableId)); - } - - public override Stream GetReadStream(Key key, int nameId) - { - OpenTableForReading(); - - if (TrySeek(key, nameId)) - { - return new ColumnStream(SessionId, TableId, _valueColumnId); - } - - return null; - } - - public void PrepareBatchOneInsert() - { - EnsureTableForUpdating(); - - Api.JetPrepareUpdate(SessionId, TableId, JET_prep.Insert); - } - - public void FinishBatchOneInsert() - { - Api.JetUpdate(SessionId, TableId); - } - - public override Stream GetWriteStream(Key key, int nameId) - { - var args = GetColumnValues(key, _identifierColumnId, nameId); - Api.SetColumns(SessionId, TableId, args); - Free(args); - - return new ColumnStream(SessionId, TableId, _valueColumnId); - } - } - } -} diff --git a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.IdentifierTable.cs b/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.IdentifierTable.cs deleted file mode 100644 index 1d08189877995..0000000000000 --- a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.IdentifierTable.cs +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.Isam.Esent.Interop; - -namespace Microsoft.CodeAnalysis.Esent -{ - internal partial class EsentStorage - { - private class IdentifierNameTable : AbstractTable - { - private const string TableName = "IdentifierTable"; - - private const string IdColumnName = "Id"; - - private const string IdentifierIndexName = "IdentifierIndex"; - private const string IdentifierColumnName = "Identifier"; - - private JET_COLUMNID _idColumnId; - private JET_COLUMNID _identifierColumnId; - - public override void Create(JET_SESID sessionId, JET_DBID databaseId) - { - var idColumnCreate = CreateAutoIncrementIdColumn(IdColumnName); - var identifierColumnCreate = CreateTextColumn(IdentifierColumnName); - - var columns = new JET_COLUMNCREATE[] { idColumnCreate, identifierColumnCreate }; - - var primaryIndexKey = CreateIndexKey(IdColumnName); - var identifierIndexKey = CreateIndexKey(IdentifierColumnName); - - var indexes = new JET_INDEXCREATE[] - { - CreatePrimaryIndex(primaryIndexKey), - CreateUniqueTextIndex(IdentifierIndexName, identifierIndexKey) - }; - - var tableCreate = CreateTable(TableName, columns, indexes); - - Api.JetCreateTableColumnIndex3(sessionId, databaseId, tableCreate); - - _idColumnId = idColumnCreate.columnid; - _identifierColumnId = identifierColumnCreate.columnid; - - Api.JetCloseTable(sessionId, tableCreate.tableid); - } - - public override void Initialize(JET_SESID sessionId, JET_DBID databaseId) - { - using (var table = new Table(sessionId, databaseId, TableName, OpenTableGrbit.ReadOnly)) - { - _idColumnId = Api.GetTableColumnid(sessionId, table, IdColumnName); - _identifierColumnId = Api.GetTableColumnid(sessionId, table, IdentifierColumnName); - } - } - - public override AbstractTableAccessor GetTableAccessor(OpenSession openSession) - { - return new StringNameTableAccessor(openSession, TableName, IdentifierIndexName, _idColumnId, _identifierColumnId); - } - } - } -} diff --git a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.NameTable.cs b/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.NameTable.cs deleted file mode 100644 index 1b2697b6b8cc5..0000000000000 --- a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.NameTable.cs +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.Isam.Esent.Interop; - -namespace Microsoft.CodeAnalysis.Esent -{ - internal partial class EsentStorage - { - private class NameTable : AbstractTable - { - private const string TableName = "NameTable"; - - private const string IdColumnName = "Id"; - - private const string NameIndexName = "NameIndex"; - private const string NameColumnName = "Name"; - - private JET_COLUMNID _idColumnId; - private JET_COLUMNID _nameColumnId; - - public override void Create(JET_SESID sessionId, JET_DBID databaseId) - { - var idColumnCreate = CreateAutoIncrementIdColumn(IdColumnName); - var nameColumnCreate = CreateTextColumn(NameColumnName); - - var columns = new JET_COLUMNCREATE[] { idColumnCreate, nameColumnCreate }; - - var primaryIndexKey = CreateIndexKey(IdColumnName); - var nameIndexKey = CreateIndexKey(NameColumnName); - - var indexes = new JET_INDEXCREATE[] - { - CreatePrimaryIndex(primaryIndexKey), - CreateUniqueTextIndex(NameIndexName, nameIndexKey) - }; - - var tableCreate = CreateTable(TableName, columns, indexes); - - Api.JetCreateTableColumnIndex3(sessionId, databaseId, tableCreate); - - _idColumnId = idColumnCreate.columnid; - _nameColumnId = nameColumnCreate.columnid; - - Api.JetCloseTable(sessionId, tableCreate.tableid); - } - - public override void Initialize(JET_SESID sessionId, JET_DBID databaseId) - { - using (var table = new Table(sessionId, databaseId, TableName, OpenTableGrbit.ReadOnly)) - { - _idColumnId = Api.GetTableColumnid(sessionId, table, IdColumnName); - _nameColumnId = Api.GetTableColumnid(sessionId, table, NameColumnName); - } - } - - public override AbstractTableAccessor GetTableAccessor(OpenSession openSession) - { - return new StringNameTableAccessor(openSession, TableName, NameIndexName, _idColumnId, _nameColumnId); - } - } - } -} diff --git a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.OpenSession.cs b/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.OpenSession.cs deleted file mode 100644 index 19f7737865ac5..0000000000000 --- a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.OpenSession.cs +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Threading; -using Microsoft.Isam.Esent.Interop; - -namespace Microsoft.CodeAnalysis.Esent -{ - internal partial class EsentStorage - { - public class OpenSession : IDisposable - { -#if false - private static int globalId; - private readonly int id; -#endif - - private readonly string _databaseFile; - - private readonly EsentStorage _storage; - private readonly CancellationToken _shutdownCancellationToken; - private readonly CancellationTokenRegistration _cancellationTokenRegistration; - - private Session _session; - private JET_DBID _databaseId; - - public OpenSession(EsentStorage storage, string databaseFile, CancellationToken shutdownCancellationToken) - { - _storage = storage; - -#if false - id = Interlocked.Increment(ref globalId); - System.Diagnostics.Trace.WriteLine("open sessionId: " + id); -#endif - - _session = new Session(storage._instance); - - _databaseFile = databaseFile; - _databaseId = OpenExistingDatabase(_session, databaseFile); - - _shutdownCancellationToken = shutdownCancellationToken; - _cancellationTokenRegistration = shutdownCancellationToken.Register(() => Dispose(), useSynchronizationContext: false); - } - - public JET_SESID SessionId { get { return _session.JetSesid; } } - public JET_DBID DatabaseId { get { return _databaseId; } } - - public void Dispose() - { - _storage.CloseSession(this); - } - - public void Close() - { - _cancellationTokenRegistration.Dispose(); - - if (_databaseId != JET_DBID.Nil) - { - Api.JetCloseDatabase(_session, _databaseId, CloseDatabaseGrbit.None); - _databaseId = JET_DBID.Nil; - } - - if (_session != null) - { -#if false - System.Diagnostics.Trace.WriteLine("close sessionId: " + id); -#endif - - _session.Dispose(); - _session = null; - } - } - - private JET_DBID OpenExistingDatabase(JET_SESID session, string databaseFile) - { - Api.JetOpenDatabase(SessionId, databaseFile, null, out var databaseId, OpenDatabaseGrbit.None); - - return databaseId; - } - } - } -} diff --git a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.Pool.cs b/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.Pool.cs deleted file mode 100644 index b1259d65f08f5..0000000000000 --- a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.Pool.cs +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.CodeAnalysis.PooledObjects; -using Microsoft.Isam.Esent.Interop; -using Roslyn.Utilities; - -namespace Microsoft.CodeAnalysis.Esent -{ - internal partial class EsentStorage - { - private static class Pool - { - private static readonly ObjectPool[] s_columnValuePool = new[] - { - new ObjectPool(() => new ColumnValue[3], 20), - new ObjectPool(() => new ColumnValue[4], 20) - }; - - public static ColumnValue[] GetInt32Columns(JET_COLUMNID columnId1, int value1, JET_COLUMNID columnId2, int value2, JET_COLUMNID columnId3, int value3) - { - var array = s_columnValuePool[0].Allocate(); - - array[0] = GetInt32Column(columnId1, value1); - array[1] = GetInt32Column(columnId2, value2); - array[2] = GetInt32Column(columnId3, value3); - - return array; - } - - public static ColumnValue[] GetInt32Columns(JET_COLUMNID columnId1, int value1, JET_COLUMNID columnId2, int value2, JET_COLUMNID columnId3, int value3, JET_COLUMNID columnId4, int value4) - { - var array = s_columnValuePool[1].Allocate(); - - array[0] = GetInt32Column(columnId1, value1); - array[1] = GetInt32Column(columnId2, value2); - array[2] = GetInt32Column(columnId3, value3); - array[3] = GetInt32Column(columnId4, value4); - - return array; - } - - public static Int32ColumnValue GetInt32Column(JET_COLUMNID columnId, int value) - { - var column = SharedPools.Default().Allocate(); - column.Columnid = columnId; - column.Value = value; - - return column; - } - - public static void Free(ColumnValue[] values) - { - for (int i = 0; i < values.Length; i++) - { - Free(values[i]); - } - - s_columnValuePool[values.Length - 3].Free(values); - } - - public static void Free(ColumnValue value) - { - var intValue = value as Int32ColumnValue; - if (intValue != null) - { - SharedPools.Default().Free(intValue); - } - } - } - } -} diff --git a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.ProjectDocumentTable.cs b/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.ProjectDocumentTable.cs deleted file mode 100644 index a3869764be884..0000000000000 --- a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.ProjectDocumentTable.cs +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.Isam.Esent.Interop; - -namespace Microsoft.CodeAnalysis.Esent -{ - internal partial class EsentStorage - { - public abstract class ProjectDocumentTable : AbstractTable - { - private const string ProjectColumnName = "Project"; - private const string ProjectNameColumnName = "ProjectName"; - private const string DocumentColumnName = "Document"; - - protected JET_COLUMNCREATE[] CreateProjectDocumentColumns(JET_COLUMNCREATE column1, JET_COLUMNCREATE column2) - { - var projectColumnCreate = CreateIdColumn(ProjectColumnName); - var projectNameColumnCreate = CreateIdColumn(ProjectNameColumnName); - var documentColumnCreate = CreateIdColumn(DocumentColumnName); - - return new JET_COLUMNCREATE[] { - projectColumnCreate, - projectNameColumnCreate, - documentColumnCreate, - column1, column2 }; - } - - protected string CreateProjectDocumentIndexKey() - { - return CreateIndexKey(ProjectColumnName, ProjectNameColumnName, DocumentColumnName); - } - - protected string CreateProjectDocumentIndexKey(string columnName) - { - return CreateIndexKey(ProjectColumnName, ProjectNameColumnName, DocumentColumnName, columnName); - } - - protected void GetColumnIds( - JET_COLUMNCREATE[] columns, out JET_COLUMNID projectColumnId, out JET_COLUMNID projectNameColumnId, out JET_COLUMNID documentColumnId) - { - projectColumnId = columns[0].columnid; - projectNameColumnId = columns[1].columnid; - documentColumnId = columns[2].columnid; - } - - protected void GetColumnIds( - JET_SESID sessionId, Table table, out JET_COLUMNID projectColumnId, out JET_COLUMNID projectNameColumnId, out JET_COLUMNID documentColumnId) - { - projectColumnId = Api.GetTableColumnid(sessionId, table, ProjectColumnName); - projectNameColumnId = Api.GetTableColumnid(sessionId, table, ProjectNameColumnName); - documentColumnId = Api.GetTableColumnid(sessionId, table, DocumentColumnName); - } - - protected JET_COLUMNCREATE[] CreateProjectColumns(JET_COLUMNCREATE column1, JET_COLUMNCREATE column2) - { - var projectColumnCreate = CreateIdColumn(ProjectColumnName); - var projectNameColumnCreate = CreateIdColumn(ProjectNameColumnName); - - return new JET_COLUMNCREATE[] { - projectColumnCreate, - projectNameColumnCreate, - column1, column2 }; - } - - protected string CreateProjectIndexKey() - { - return CreateIndexKey(ProjectColumnName, ProjectNameColumnName); - } - - protected string CreateProjectIndexKey(string columnName) - { - return CreateIndexKey(ProjectColumnName, ProjectNameColumnName, columnName); - } - - protected void GetColumnIds( - JET_COLUMNCREATE[] columns, out JET_COLUMNID projectColumnId, out JET_COLUMNID projectNameColumnId) - { - projectColumnId = columns[0].columnid; - projectNameColumnId = columns[1].columnid; - } - - protected void GetColumnIds( - JET_SESID sessionId, Table table, out JET_COLUMNID projectColumnId, out JET_COLUMNID projectNameColumnId) - { - projectColumnId = Api.GetTableColumnid(sessionId, table, ProjectColumnName); - projectNameColumnId = Api.GetTableColumnid(sessionId, table, ProjectNameColumnName); - } - } - } -} diff --git a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.ProjectDocumentTableAccessor.cs b/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.ProjectDocumentTableAccessor.cs deleted file mode 100644 index 261f3aa40b7f5..0000000000000 --- a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.ProjectDocumentTableAccessor.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.IO; -using Microsoft.Isam.Esent.Interop; - -namespace Microsoft.CodeAnalysis.Esent -{ - internal partial class EsentStorage - { - public abstract class ProjectDocumentTableAccessor : AbstractTableAccessor - { - protected readonly JET_COLUMNID ProjectColumnId; - protected readonly JET_COLUMNID ProjectNameColumnId; - protected readonly JET_COLUMNID DocumentColumnId; - - protected readonly string IndexName; - - public ProjectDocumentTableAccessor( - OpenSession session, string tableName, string indexName, - JET_COLUMNID projectColumnId, JET_COLUMNID projectNameColumnId, JET_COLUMNID documentColumnId) : base(session, tableName) - { - IndexName = indexName; - ProjectColumnId = projectColumnId; - ProjectNameColumnId = projectNameColumnId; - DocumentColumnId = documentColumnId; - } - - public abstract Stream GetReadStream(Key key, int nameId); - public abstract Stream GetWriteStream(Key key, int nameId); - - protected bool TrySeek(string indexName, Key key, int id1) - { - SetIndexAndMakeKey(indexName, key, id1); - - return Api.TrySeek(SessionId, TableId, SeekGrbit.SeekEQ); - } - - protected void SetIndexAndMakeKey(string indexName, Key key, int id1) - { - Api.JetSetCurrentIndex(SessionId, TableId, indexName); - MakeKey(key, id1); - } - - protected void MakeKey(Key key) - { - Api.MakeKey(SessionId, TableId, key.ProjectId, MakeKeyGrbit.NewKey); - Api.MakeKey(SessionId, TableId, key.ProjectNameId, MakeKeyGrbit.None); - - if (key.DocumentIdOpt.HasValue) - { - Api.MakeKey(SessionId, TableId, key.DocumentIdOpt.Value, MakeKeyGrbit.None); - } - } - - protected void MakeKey(Key key, int id1) - { - MakeKey(key); - - Api.MakeKey(SessionId, TableId, id1, MakeKeyGrbit.None); - } - - protected ColumnValue[] GetColumnValues(Key key, JET_COLUMNID columnId1, int id1) - { - if (key.DocumentIdOpt.HasValue) - { - return Pool.GetInt32Columns(ProjectColumnId, key.ProjectId, ProjectNameColumnId, key.ProjectNameId, DocumentColumnId, key.DocumentIdOpt.Value, columnId1, id1); - } - - return Pool.GetInt32Columns(ProjectColumnId, key.ProjectId, ProjectNameColumnId, key.ProjectNameId, columnId1, id1); - } - - protected void Free(ColumnValue[] values) - { - Pool.Free(values); - } - } - - public struct Key - { - public int ProjectId; - public int ProjectNameId; - public int? DocumentIdOpt; - - public Key(int projectId, int projectNameId, int documentId) - { - ProjectId = projectId; - ProjectNameId = projectNameId; - DocumentIdOpt = documentId; - } - - public Key(int projectId, int projectNameId) - { - ProjectId = projectId; - ProjectNameId = projectNameId; - DocumentIdOpt = null; - } - } - } -} diff --git a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.ProjectTable.cs b/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.ProjectTable.cs deleted file mode 100644 index 41e4982c54579..0000000000000 --- a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.ProjectTable.cs +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.Isam.Esent.Interop; - -namespace Microsoft.CodeAnalysis.Esent -{ - internal partial class EsentStorage - { - private class ProjectTable : ProjectDocumentTable - { - private const string TableName = "ProjectTable"; - - private const string NameColumnName = "Name"; - private const string ValueColumnName = "Value"; - - private JET_COLUMNID _projectColumnId; - private JET_COLUMNID _projectNameColumnId; - private JET_COLUMNID _nameColumnId; - private JET_COLUMNID _valueColumnId; - - public override void Create(JET_SESID sessionId, JET_DBID databaseId) - { - var nameColumnCreate = CreateIdColumn(NameColumnName); - var valueColumnCreate = CreateBinaryColumn(ValueColumnName); - - var columns = CreateProjectColumns(nameColumnCreate, valueColumnCreate); - - var projectAndNameIndexKey = CreateProjectIndexKey(NameColumnName); - - var indexes = new JET_INDEXCREATE[] - { - CreatePrimaryIndex(projectAndNameIndexKey) - }; - - var tableCreate = CreateTable(TableName, columns, indexes); - - Api.JetCreateTableColumnIndex3(sessionId, databaseId, tableCreate); - - GetColumnIds(columns, out _projectColumnId, out _projectNameColumnId); - _nameColumnId = nameColumnCreate.columnid; - _valueColumnId = valueColumnCreate.columnid; - - Api.JetCloseTable(sessionId, tableCreate.tableid); - } - - public override void Initialize(JET_SESID sessionId, JET_DBID databaseId) - { - using (var table = new Table(sessionId, databaseId, TableName, OpenTableGrbit.ReadOnly)) - { - GetColumnIds(sessionId, table, out _projectColumnId, out _projectNameColumnId); - _nameColumnId = Api.GetTableColumnid(sessionId, table, NameColumnName); - _valueColumnId = Api.GetTableColumnid(sessionId, table, ValueColumnName); - } - } - - public override AbstractTableAccessor GetTableAccessor(OpenSession openSession) - { - return new ProjectTableAccessor(openSession, TableName, PrimaryIndexName, _projectColumnId, _projectNameColumnId, _nameColumnId, _valueColumnId); - } - } - } -} diff --git a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.ProjectTableAccessor.cs b/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.ProjectTableAccessor.cs deleted file mode 100644 index 8d29220a668f1..0000000000000 --- a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.ProjectTableAccessor.cs +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.IO; -using System.Text; -using Microsoft.Isam.Esent.Interop; - -namespace Microsoft.CodeAnalysis.Esent -{ - internal partial class EsentStorage - { - public class ProjectTableAccessor : ProjectDocumentTableAccessor - { - private readonly JET_COLUMNID _nameColumnId; - private readonly JET_COLUMNID _valueColumnId; - - public ProjectTableAccessor( - OpenSession session, string tableName, string indexName, - JET_COLUMNID projectColumnId, JET_COLUMNID projectNameColumnId, JET_COLUMNID nameColumnId, JET_COLUMNID valueColumnId) : - base(session, tableName, indexName, projectColumnId, projectNameColumnId, default) - { - _nameColumnId = nameColumnId; - _valueColumnId = valueColumnId; - } - - private bool TrySeek(Key key, int nameId) - { - return TrySeek(IndexName, key, nameId); - } - - public override Stream GetReadStream(Key key, int nameId) - { - OpenTableForReading(); - - if (TrySeek(key, nameId)) - { - return new ColumnStream(SessionId, TableId, _valueColumnId); - } - - return null; - } - - public override Stream GetWriteStream(Key key, int nameId) - { - OpenTableForUpdating(); - - if (TrySeek(key, nameId)) - { - PrepareUpdate(JET_prep.ReplaceNoLock); - } - else - { - PrepareUpdate(JET_prep.Insert); - - var args = GetColumnValues(key, _nameColumnId, nameId); - - Api.SetColumns(SessionId, TableId, args); - Free(args); - } - - return new ColumnStream(SessionId, TableId, _valueColumnId); - } - } - } -} diff --git a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.SolutionTable.cs b/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.SolutionTable.cs deleted file mode 100644 index a1aabd7e0c421..0000000000000 --- a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.SolutionTable.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.Isam.Esent.Interop; -using Roslyn.Utilities; - -namespace Microsoft.CodeAnalysis.Esent -{ - internal partial class EsentStorage - { - private class SolutionTable : AbstractTable - { - private const string TableName = "SolutionTable"; - - private const string NameColumnName = "Name"; - private const string ValueColumnName = "Value"; - - private JET_COLUMNID _nameColumnId; - private JET_COLUMNID _valueColumnId; - - public override void Create(JET_SESID sessionId, JET_DBID databaseId) - { - var nameColumnCreate = CreateIdColumn(NameColumnName); - var valueColumnCreate = CreateBinaryColumn(ValueColumnName); - - var columns = new JET_COLUMNCREATE[] { nameColumnCreate, valueColumnCreate }; - - var nameIndexKey = CreateIndexKey(NameColumnName); - - var indexes = new JET_INDEXCREATE[] - { - CreatePrimaryIndex(nameIndexKey) - }; - - var tableCreate = CreateTable(TableName, columns, indexes); - - Api.JetCreateTableColumnIndex3(sessionId, databaseId, tableCreate); - - _nameColumnId = nameColumnCreate.columnid; - _valueColumnId = valueColumnCreate.columnid; - - Api.JetCloseTable(sessionId, tableCreate.tableid); - } - - public override void Initialize(JET_SESID sessionId, JET_DBID databaseId) - { - using (var table = new Table(sessionId, databaseId, TableName, OpenTableGrbit.ReadOnly)) - { - _nameColumnId = Api.GetTableColumnid(sessionId, table, NameColumnName); - _valueColumnId = Api.GetTableColumnid(sessionId, table, ValueColumnName); - } - } - - public override AbstractTableAccessor GetTableAccessor(OpenSession openSession) - { - return new SolutionTableAccessor(openSession, TableName, PrimaryIndexName, _nameColumnId, _valueColumnId); - } - } - } -} diff --git a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.SolutionTableAccessor.cs b/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.SolutionTableAccessor.cs deleted file mode 100644 index df8323d0b4daa..0000000000000 --- a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.SolutionTableAccessor.cs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.IO; -using System.Text; -using Microsoft.Isam.Esent.Interop; - -namespace Microsoft.CodeAnalysis.Esent -{ - internal partial class EsentStorage - { - public class SolutionTableAccessor : AbstractTableAccessor - { - private readonly JET_COLUMNID _nameColumnId; - private readonly JET_COLUMNID _valueColumnId; - - private readonly string _indexName; - - public SolutionTableAccessor( - OpenSession session, string tableName, string indexName, JET_COLUMNID nameColumnId, JET_COLUMNID valueColumnId) : base(session, tableName) - { - _indexName = indexName; - - _nameColumnId = nameColumnId; - _valueColumnId = valueColumnId; - } - - protected bool TrySeek(int nameId) - { - Api.JetSetCurrentIndex(SessionId, TableId, _indexName); - Api.MakeKey(SessionId, TableId, nameId, MakeKeyGrbit.NewKey); - - return Api.TrySeek(SessionId, TableId, SeekGrbit.SeekEQ); - } - - public Stream GetReadStream(int nameId) - { - OpenTableForReading(); - - if (TrySeek(nameId)) - { - return new ColumnStream(SessionId, TableId, _valueColumnId); - } - - return null; - } - - public Stream GetWriteStream(int nameId) - { - OpenTableForUpdating(); - - if (TrySeek(nameId)) - { - PrepareUpdate(JET_prep.ReplaceNoLock); - } - else - { - PrepareUpdate(JET_prep.Insert); - Api.SetColumn(SessionId, TableId, _nameColumnId, nameId); - } - - return new ColumnStream(SessionId, TableId, _valueColumnId); - } - } - } -} diff --git a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.StringNameTableAccessor.cs b/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.StringNameTableAccessor.cs deleted file mode 100644 index c67bfd41e49af..0000000000000 --- a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.StringNameTableAccessor.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Text; -using Microsoft.Isam.Esent.Interop; - -namespace Microsoft.CodeAnalysis.Esent -{ - internal partial class EsentStorage - { - public class StringNameTableAccessor : AbstractTableAccessor - { - private readonly JET_COLUMNID _idColumnId; - private readonly JET_COLUMNID _nameColumnId; - - private readonly string _indexName; - - public StringNameTableAccessor( - OpenSession session, string tableName, string indexName, JET_COLUMNID idColumnId, JET_COLUMNID nameColumnId) : base(session, tableName) - { - _indexName = indexName; - _idColumnId = idColumnId; - _nameColumnId = nameColumnId; - } - - private bool TrySeek(string value) - { - Api.JetSetCurrentIndex(SessionId, TableId, _indexName); - Api.MakeKey(SessionId, TableId, value, Encoding.Unicode, MakeKeyGrbit.NewKey); - - return Api.TrySeek(SessionId, TableId, SeekGrbit.SeekEQ); - } - - public int GetUniqueId(string value) - { - OpenTableForUpdatingWithoutTransaction(); - - while (true) - { - if (TrySeek(value)) - { - return Api.RetrieveColumnAsInt32(SessionId, TableId, _idColumnId).Value; - } - - using (var transaction = new Transaction(SessionId)) - { - PrepareUpdate(JET_prep.Insert); - - var id = Api.RetrieveColumnAsInt32(SessionId, TableId, _idColumnId, RetrieveColumnGrbit.RetrieveCopy).Value; - - // set name - Api.SetColumn(SessionId, TableId, _nameColumnId, value, Encoding.Unicode); - - if (ApplyChanges()) - { - transaction.Commit(CommitTransactionGrbit.LazyFlush); - return id; - } - } - } - } - } - } -} diff --git a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.TableKinds.cs b/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.TableKinds.cs deleted file mode 100644 index 5662c3a7d492c..0000000000000 --- a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.TableKinds.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace Microsoft.CodeAnalysis.Esent -{ - internal partial class EsentStorage - { - private enum TableKinds - { - Name, - Solution, - Project, - Document, - Identifier, - IdentifierLocations - } - } -} diff --git a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.cs b/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.cs deleted file mode 100644 index bd35e24464db2..0000000000000 --- a/src/Workspaces/Core/Desktop/Workspace/Esent/EsentStorage.cs +++ /dev/null @@ -1,332 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.IO; -using System.Threading; -using Microsoft.Isam.Esent.Interop; -using Roslyn.Utilities; - -namespace Microsoft.CodeAnalysis.Esent -{ - internal partial class EsentStorage - { - // set db page size to 8K and version store page size to 16K - private const int DatabasePageSize = 2 * 4 * 1024; - private const int VersionStorePageSize = 4 * 4 * 1024; - - // JET parameter consts - private const int JET_paramIOPriority = 152; - private const int JET_paramCheckpointIOMax = 135; - private const int JET_paramVerPageSize = 128; - private const int JET_paramDisablePerfmon = 107; - private const int JET_paramPageHintCacheSize = 101; - private const int JET_paramLogFileCreateAsynch = 69; - private const int JET_paramOutstandingIOMax = 30; - private const int JET_paramLRUKHistoryMax = 26; - private const int JET_paramCommitDefault = 16; - - private readonly string _databaseFile; - private readonly bool _enablePerformanceMonitor; - private readonly Dictionary _tables; - - private readonly ConcurrentStack _sessionCache; - private readonly CancellationTokenSource _shutdownCancellationTokenSource; - - private Instance _instance; - private Session _primarySessionId; - private JET_DBID _primaryDatabaseId; - - public EsentStorage(string databaseFile, bool enablePerformanceMonitor = false) - { - Contract.Requires(!string.IsNullOrWhiteSpace(databaseFile)); - - _databaseFile = databaseFile; - _enablePerformanceMonitor = enablePerformanceMonitor; - - // order of tables are fixed. don't change it - _tables = new Dictionary() - { - { TableKinds.Name, new NameTable() }, - { TableKinds.Solution, new SolutionTable() }, - { TableKinds.Project, new ProjectTable() }, - { TableKinds.Document, new DocumentTable() }, - { TableKinds.Identifier, new IdentifierNameTable() }, - { TableKinds.IdentifierLocations, new IdentifierLocationTable() }, - }; - - _sessionCache = new ConcurrentStack(); - _shutdownCancellationTokenSource = new CancellationTokenSource(); - } - - public void Initialize() - { - _instance = CreateEsentInstance(); - _primarySessionId = new Session(_instance); - - InitializeDatabaseAndTables(); - } - - public bool IsClosed - { - get { return _instance == null; } - } - - public void Close() - { - if (_instance != null) - { - var handle = _instance; - _instance = null; - - // try to free all allocated session - if succeeded we can try to do a clean shutdown - _shutdownCancellationTokenSource.Cancel(); - - try - { - // just close the instance - all associated objects will be closed as well - _primarySessionId.Dispose(); - handle.Dispose(); - } - catch - { - // ignore exception if whatever reason esent throws an exception. - } - - _shutdownCancellationTokenSource.Dispose(); - } - } - - public int GetUniqueId(string value) - { - return GetUniqueId(value, TableKinds.Name); - } - - public int GetUniqueIdentifierId(string value) - { - return GetUniqueId(value, TableKinds.Identifier); - } - - private int GetUniqueId(string value, TableKinds tableKind) - { - Contract.ThrowIfTrue(string.IsNullOrWhiteSpace(value)); - - using (var accessor = (StringNameTableAccessor)GetTableAccessor(tableKind)) - { - return accessor.GetUniqueId(value); - } - } - - public SolutionTableAccessor GetSolutionTableAccessor() - { - return (SolutionTableAccessor)GetTableAccessor(TableKinds.Solution); - } - - public ProjectTableAccessor GetProjectTableAccessor() - { - return (ProjectTableAccessor)GetTableAccessor(TableKinds.Project); - } - - public DocumentTableAccessor GetDocumentTableAccessor() - { - return (DocumentTableAccessor)GetTableAccessor(TableKinds.Document); - } - - public IdentifierLocationTableAccessor GetIdentifierLocationTableAccessor() - { - return (IdentifierLocationTableAccessor)GetTableAccessor(TableKinds.IdentifierLocations); - } - - private AbstractTableAccessor GetTableAccessor(TableKinds tableKind) - { - return _tables[tableKind].GetTableAccessor(GetOpenSession()); - } - - private OpenSession GetOpenSession() - { - if (_sessionCache.TryPop(out var session)) - { - return session; - } - - return new OpenSession(this, _databaseFile, _shutdownCancellationTokenSource.Token); - } - - private void CloseSession(OpenSession session) - { - if (_shutdownCancellationTokenSource.IsCancellationRequested) - { - session.Close(); - return; - } - - if (_sessionCache.Count > 5) - { - session.Close(); - return; - } - - _sessionCache.Push(session); - } - - private Instance CreateEsentInstance() - { - var instanceDataFolder = Path.GetDirectoryName(_databaseFile); - - TryInitializeGlobalParameters(); - - var instance = new Instance(Path.GetFileName(_databaseFile), _databaseFile, TermGrbit.Complete); - - // create log file preemptively - Api.JetSetSystemParameter(instance.JetInstance, JET_SESID.Nil, (JET_param)JET_paramLogFileCreateAsynch, /* true */ 1, null); - - // set default commit mode - Api.JetSetSystemParameter(instance.JetInstance, JET_SESID.Nil, (JET_param)JET_paramCommitDefault, /* lazy */ 1, null); - - // remove transaction log file that is not needed anymore - instance.Parameters.CircularLog = true; - - // transaction log file buffer 1M (1024 * 2 * 512 bytes) - instance.Parameters.LogBuffers = 2 * 1024; - - // transaction log file is 2M (2 * 1024 * 1024 bytes) - instance.Parameters.LogFileSize = 2 * 1024; - - // db directories - instance.Parameters.LogFileDirectory = instanceDataFolder; - instance.Parameters.SystemDirectory = instanceDataFolder; - instance.Parameters.TempDirectory = instanceDataFolder; - - // Esent uses version pages to store intermediate non-committed data during transactions - // smaller values may cause VersionStoreOutOfMemory error when dealing with multiple transactions\writing lot's of data in transaction or both - // it is about 16MB - this is okay to be big since most of it is temporary memory that will be released once the last transaction goes away - instance.Parameters.MaxVerPages = 16 * 1024 * 1024 / VersionStorePageSize; - - // set the size of max transaction log size (in bytes) that should be replayed after the crash - // small values: smaller log files but potentially longer transaction flushes if there was a crash (6M) - instance.Parameters.CheckpointDepthMax = 6 * 1024 * 1024; - - // how much db grows when it finds db is full (1M) - // (less I/O as value gets bigger) - instance.Parameters.DbExtensionSize = 1024 * 1024 / DatabasePageSize; - - // fail fast if log file is wrong. we will recover from it by creating db from scratch - instance.Parameters.CleanupMismatchedLogFiles = true; - instance.Parameters.EnableIndexChecking = true; - - // now, actually initialize instance - instance.Init(); - - return instance; - } - - private void TryInitializeGlobalParameters() - { - Api.JetGetInstanceInfo(out var instances, out var infos); - - // already initialized nothing we can do. - if (instances != 0) - { - return; - } - - try - { - // use small configuration so that esent use process heap and windows file cache - SystemParameters.Configuration = 0; - - // allow many esent instances - SystemParameters.MaxInstances = 1024; - - // enable perf monitor if requested - Api.JetSetSystemParameter(JET_INSTANCE.Nil, JET_SESID.Nil, (JET_param)JET_paramDisablePerfmon, _enablePerformanceMonitor ? 0 : 1, null); - - // set max IO queue (bigger value better IO perf) - Api.JetSetSystemParameter(JET_INSTANCE.Nil, JET_SESID.Nil, (JET_param)JET_paramOutstandingIOMax, 1024, null); - - // set max current write to db - Api.JetSetSystemParameter(JET_INSTANCE.Nil, JET_SESID.Nil, (JET_param)JET_paramCheckpointIOMax, 32, null); - - // better cache management (4M) - Api.JetSetSystemParameter(JET_INSTANCE.Nil, JET_SESID.Nil, (JET_param)JET_paramLRUKHistoryMax, 4 * 1024 * 1024 / DatabasePageSize, null); - - // better db performance (100K bytes) - Api.JetSetSystemParameter(JET_INSTANCE.Nil, JET_SESID.Nil, (JET_param)JET_paramPageHintCacheSize, 100 * 1024, null); - - // set version page size to normal 16K - Api.JetSetSystemParameter(JET_INSTANCE.Nil, JET_SESID.Nil, (JET_param)JET_paramVerPageSize, VersionStorePageSize, null); - - // use windows file system cache - SystemParameters.EnableFileCache = true; - - // don't use mapped file for database. this will waste more VM. - SystemParameters.EnableViewCache = false; - - // this is the unit where chunks are loaded into memory/locked and etc - SystemParameters.DatabasePageSize = DatabasePageSize; - - // set max cache size - don't use too much memory for cache (8MB) - SystemParameters.CacheSizeMax = 8 * 1024 * 1024 / DatabasePageSize; - - // set min cache size - Esent tries to adjust this value automatically but often it is better to help him. - // small cache sizes => more I\O during random seeks - // currently set to 2MB - SystemParameters.CacheSizeMin = 2 * 1024 * 1024 / DatabasePageSize; - - // set box of when cache eviction starts (1% - 2% of max cache size) - SystemParameters.StartFlushThreshold = 20; - SystemParameters.StopFlushThreshold = 40; - } - catch (EsentAlreadyInitializedException) - { - // can't change global status - } - } - - private void InitializeDatabaseAndTables() - { - // open database for the first time: database file will be created if necessary - - // first quick check whether file exist - if (!File.Exists(_databaseFile)) - { - Api.JetCreateDatabase(_primarySessionId, _databaseFile, null, out _primaryDatabaseId, CreateDatabaseGrbit.None); - CreateTables(); - return; - } - - // file exist, just attach the db. - try - { - // if this succeed, it will lock the file. - Api.JetAttachDatabase(_primarySessionId, _databaseFile, AttachDatabaseGrbit.None); - } - catch (EsentFileNotFoundException) - { - // if someone has deleted the file, while we are attaching. - Api.JetCreateDatabase(_primarySessionId, _databaseFile, null, out _primaryDatabaseId, CreateDatabaseGrbit.None); - CreateTables(); - return; - } - - Api.JetOpenDatabase(_primarySessionId, _databaseFile, null, out _primaryDatabaseId, OpenDatabaseGrbit.None); - InitializeTables(); - } - - private void CreateTables() - { - foreach (var table in _tables.Values) - { - table.Create(_primarySessionId, _primaryDatabaseId); - } - } - - private void InitializeTables() - { - foreach (var table in _tables.Values) - { - table.Initialize(_primarySessionId, _primaryDatabaseId); - } - } - } -} diff --git a/src/Workspaces/Core/Desktop/Workspace/Storage/PersistenceStorageServiceFactory.cs b/src/Workspaces/Core/Desktop/Workspace/Storage/PersistenceStorageServiceFactory.cs index a05ce7eae69b9..0332a556fb9ff 100644 --- a/src/Workspaces/Core/Desktop/Workspace/Storage/PersistenceStorageServiceFactory.cs +++ b/src/Workspaces/Core/Desktop/Workspace/Storage/PersistenceStorageServiceFactory.cs @@ -1,9 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System; using System.Composition; -using System.Threading; -using Microsoft.CodeAnalysis.Esent; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Options; @@ -47,8 +44,6 @@ private IPersistentStorageService GetPersistentStorageService(HostWorkspaceServi { case StorageDatabase.SQLite: return new SQLitePersistentStorageService(optionService, _solutionSizeTracker); - case StorageDatabase.Esent: - return new EsentPersistentStorageService(optionService, _solutionSizeTracker); case StorageDatabase.None: default: return NoOpPersistentStorageService.Instance; diff --git a/src/Workspaces/Core/Desktop/Workspace/Storage/StorageDatabase.cs b/src/Workspaces/Core/Desktop/Workspace/Storage/StorageDatabase.cs index 14faa54fe00a5..371b9fd0f9889 100644 --- a/src/Workspaces/Core/Desktop/Workspace/Storage/StorageDatabase.cs +++ b/src/Workspaces/Core/Desktop/Workspace/Storage/StorageDatabase.cs @@ -6,6 +6,5 @@ internal enum StorageDatabase { None = 0, SQLite = 1, - Esent = 2, } } diff --git a/src/Workspaces/Core/Desktop/Workspaces.Desktop.csproj b/src/Workspaces/Core/Desktop/Workspaces.Desktop.csproj index 4291c0486f759..5c6c320b0a2f1 100644 --- a/src/Workspaces/Core/Desktop/Workspaces.Desktop.csproj +++ b/src/Workspaces/Core/Desktop/Workspaces.Desktop.csproj @@ -21,7 +21,6 @@ - From 8a24e4a3db4db8217a60e48b8b75165ce523d4c6 Mon Sep 17 00:00:00 2001 From: Jared Parsons Date: Thu, 27 Jul 2017 17:13:32 -0700 Subject: [PATCH 049/205] Include UseBasicParsing switch By default Invoke-WebRequest will fail if IE hasn't gone through first configuration setup on the machine. Parts of our infrastructure don't run IE and as a result our uses of Invoke-WebRequest were failing. Fixed by passing the UseBasicParsing switch. --- build/scripts/build.ps1 | 2 +- build/scripts/run_perf.ps1 | 2 +- src/Tools/MicroBuild/publish-assets.ps1 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build/scripts/build.ps1 b/build/scripts/build.ps1 index d48acef745789..e42437b52925d 100644 --- a/build/scripts/build.ps1 +++ b/build/scripts/build.ps1 @@ -445,7 +445,7 @@ function Ensure-ProcDump() { Remove-Item -Re $filePath -ErrorAction SilentlyContinue Create-Directory $outDir $zipFilePath = Join-Path $toolsDir "procdump.zip" - Invoke-WebRequest "https://download.sysinternals.com/files/Procdump.zip" -outfile $zipFilePath | Out-Null + Invoke-WebRequest "https://download.sysinternals.com/files/Procdump.zip" -UseBasicParsing -outfile $zipFilePath | Out-Null Add-Type -AssemblyName System.IO.Compression.FileSystem [IO.Compression.ZipFile]::ExtractToDirectory($zipFilePath, $outDir) } diff --git a/build/scripts/run_perf.ps1 b/build/scripts/run_perf.ps1 index bcd50bfd47765..5bca5dcfcabe4 100644 --- a/build/scripts/run_perf.ps1 +++ b/build/scripts/run_perf.ps1 @@ -12,7 +12,7 @@ if ( -not $? ) exit 1 } -Invoke-WebRequest -Uri http://dotnetci.blob.core.windows.net/roslyn-perf/cpc.zip -OutFile cpc.zip +Invoke-WebRequest -Uri http://dotnetci.blob.core.windows.net/roslyn-perf/cpc.zip -OutFile cpc.zip -UseBasicParsing [Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') | Out-Null [IO.Compression.ZipFile]::ExtractToDirectory('cpc.zip', $CPCLocation) diff --git a/src/Tools/MicroBuild/publish-assets.ps1 b/src/Tools/MicroBuild/publish-assets.ps1 index b337ef385b7de..8ac5ec199df61 100644 --- a/src/Tools/MicroBuild/publish-assets.ps1 +++ b/src/Tools/MicroBuild/publish-assets.ps1 @@ -156,7 +156,7 @@ try { } Write-Host "Downloading PublishData.json" - $publishFileContent = (Invoke-WebRequest -Uri "https://raw.githubusercontent.com/dotnet/roslyn/master/build/config/PublishData.json").Content + $publishFileContent = (Invoke-WebRequest -Uri "https://raw.githubusercontent.com/dotnet/roslyn/master/build/config/PublishData.json" -UseBasicParsing).Content $data = ConvertFrom-Json $publishFileContent if ($branchName -ne "" -and $releaseName -ne "") { From 915fe6dedfe5c592ccec5e30e934b62cbc403cb7 Mon Sep 17 00:00:00 2001 From: Jared Parsons Date: Thu, 27 Jul 2017 15:20:02 -0700 Subject: [PATCH 050/205] Work around sdk 1.1 compat bug Recent builds of the SDK introduced a bug around referencing netstandard 1.6 projects. This trigged on several Roslyn projects and cause build breaks with newer builds of VS. Suppressing the check for now. Will undo when we move to 2.0 SDK https://github.com/dotnet/roslyn/issues/21183 --- build/Targets/Settings.props | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build/Targets/Settings.props b/build/Targets/Settings.props index 3592746db7005..f47f7a4fbbbcb 100644 --- a/build/Targets/Settings.props +++ b/build/Targets/Settings.props @@ -69,6 +69,9 @@ {RawFileName}; + + false + $(MSBuildSDKsPath)\Microsoft.NET.Sdk\Sdk\ PackageReference From a85432e3195aee138a6a48da6c7d999baaba8c41 Mon Sep 17 00:00:00 2001 From: Jared Parsons Date: Thu, 27 Jul 2017 17:13:32 -0700 Subject: [PATCH 051/205] Include UseBasicParsing switch By default Invoke-WebRequest will fail if IE hasn't gone through first configuration setup on the machine. Parts of our infrastructure don't run IE and as a result our uses of Invoke-WebRequest were failing. Fixed by passing the UseBasicParsing switch. --- build/scripts/run_perf.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/scripts/run_perf.ps1 b/build/scripts/run_perf.ps1 index bcd50bfd47765..5bca5dcfcabe4 100644 --- a/build/scripts/run_perf.ps1 +++ b/build/scripts/run_perf.ps1 @@ -12,7 +12,7 @@ if ( -not $? ) exit 1 } -Invoke-WebRequest -Uri http://dotnetci.blob.core.windows.net/roslyn-perf/cpc.zip -OutFile cpc.zip +Invoke-WebRequest -Uri http://dotnetci.blob.core.windows.net/roslyn-perf/cpc.zip -OutFile cpc.zip -UseBasicParsing [Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') | Out-Null [IO.Compression.ZipFile]::ExtractToDirectory('cpc.zip', $CPCLocation) From 2906a2e5f15d26bba5a2c50eed5fade8eaf70f23 Mon Sep 17 00:00:00 2001 From: Heejae Chang Date: Thu, 27 Jul 2017 17:53:43 -0700 Subject: [PATCH 052/205] added link to the bug --- src/VisualStudio/Core/Next/Remote/JsonRpcClient.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/VisualStudio/Core/Next/Remote/JsonRpcClient.cs b/src/VisualStudio/Core/Next/Remote/JsonRpcClient.cs index 5d4f0bd4204cb..17738a2dfc00e 100644 --- a/src/VisualStudio/Core/Next/Remote/JsonRpcClient.cs +++ b/src/VisualStudio/Core/Next/Remote/JsonRpcClient.cs @@ -141,6 +141,11 @@ private bool ReportUnlessCanceled(Exception ex, CancellationToken cancellationTo private static bool s_reported = false; + /// + /// Show info bar and throw its own cancellation exception until + /// we figure out this issue + /// https://devdiv.visualstudio.com/DevDiv/_workitems/edit/453544 + /// private void ThrowOwnCancellationToken() { if (CodeAnalysis.PrimaryWorkspace.Workspace != null && !s_reported) From 093cf36c56feefbf081b575378db41a6279ebe51 Mon Sep 17 00:00:00 2001 From: Heejae Chang Date: Thu, 27 Jul 2017 23:55:40 -0700 Subject: [PATCH 053/205] addressed PR feedback. --- src/VisualStudio/Core/Next/Remote/JsonRpcClient.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/VisualStudio/Core/Next/Remote/JsonRpcClient.cs b/src/VisualStudio/Core/Next/Remote/JsonRpcClient.cs index 17738a2dfc00e..d9a59c3fc1024 100644 --- a/src/VisualStudio/Core/Next/Remote/JsonRpcClient.cs +++ b/src/VisualStudio/Core/Next/Remote/JsonRpcClient.cs @@ -143,8 +143,11 @@ private bool ReportUnlessCanceled(Exception ex, CancellationToken cancellationTo /// /// Show info bar and throw its own cancellation exception until - /// we figure out this issue + /// we figure out this issue. /// https://devdiv.visualstudio.com/DevDiv/_workitems/edit/453544 + /// + /// the issue is basically we are getting unexpected exception from InvokeAsync + /// and we don't know exactly why that is happening. /// private void ThrowOwnCancellationToken() { @@ -159,10 +162,11 @@ private void ThrowOwnCancellationToken() } // create its own cancellation token and throw it - var ownCancellationSource = new CancellationTokenSource(); - ownCancellationSource.Cancel(); - - ownCancellationSource.Token.ThrowIfCancellationRequested(); + using (var ownCancellationSource = new CancellationTokenSource()) + { + ownCancellationSource.Cancel(); + ownCancellationSource.Token.ThrowIfCancellationRequested(); + } } private void ReportExtraInfoAsNFW(Exception ex) From 527eb90fd3af7aa4e91e3db8033cec28efc2a5ae Mon Sep 17 00:00:00 2001 From: Marek Safar Date: Tue, 7 Mar 2017 17:36:56 +0100 Subject: [PATCH 054/205] Rewrite CryptoBlobParser to use BlobReader/BlobWriter instead of casts. --- .../Portable/StrongName/CryptoBlobParser.cs | 210 ++++++------------ 1 file changed, 69 insertions(+), 141 deletions(-) diff --git a/src/Compilers/Core/Portable/StrongName/CryptoBlobParser.cs b/src/Compilers/Core/Portable/StrongName/CryptoBlobParser.cs index b630987b90f82..d95b8678aaddb 100644 --- a/src/Compilers/Core/Portable/StrongName/CryptoBlobParser.cs +++ b/src/Compilers/Core/Portable/StrongName/CryptoBlobParser.cs @@ -7,6 +7,7 @@ using System.Diagnostics; using System.IO; using System.Runtime.InteropServices; +using System.Reflection.Metadata; namespace Microsoft.CodeAnalysis { @@ -70,35 +71,14 @@ public AlgorithmId(uint flags) // From ECMAKey.h private static readonly ImmutableArray s_ecmaKey = ImmutableArray.Create(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0 }); - // From strongname.h - // Note: different from the PUBLICKEYBLOB specified in wincrypt.h. The - // PublicKey in the SnPublicKeyBlob contains a PUBLICKEYBLOB - // - // The public key blob has the following format as a little-endian packed C struct: - // - [StructLayout(LayoutKind.Sequential, Pack = 1)] -#pragma warning disable 0649 - private unsafe struct SnPublicKeyBlob - { - public UInt32 SigAlgId; // Signature algorithm ID - public UInt32 HashAlgId; // Hash algorithm ID - public UInt32 PublicKeySize; // Size of public key data in bytes, not including the header - // Note: PublicKey is variable sized - public fixed byte PublicKey[1]; // PublicKeySize bytes of public key data - } + private const int SnPublicKeyBlobSize = 13; // From wincrypt.h private const byte PublicKeyBlobId = 0x06; private const byte PrivateKeyBlobId = 0x07; // internal for testing - internal unsafe static readonly int s_publicKeyHeaderSize = sizeof(SnPublicKeyBlob) - 1; - - private static uint ToUInt32(ImmutableArray bytes, int offset) - { - Debug.Assert((bytes.Length - offset) > sizeof(int)); - return (uint)(bytes[offset] | (bytes[offset + 1] << 8) | (bytes[offset + 2] << 16) | (bytes[offset + 3] << 24)); - } + internal const int s_publicKeyHeaderSize = SnPublicKeyBlobSize - 1; // From StrongNameInternal.cpp // Checks to see if a public key is a valid instance of a PublicKeyBlob as @@ -116,13 +96,21 @@ internal static bool IsValidPublicKey(ImmutableArray blob) private static unsafe bool IsValidPublicKeyUnsafe(ImmutableArray blob) { - var blobArray = blob.DangerousGetUnderlyingArray(); - fixed (byte* blobPtr = blobArray) + fixed (byte* ptr = blob.DangerousGetUnderlyingArray()) { - var pkb = (SnPublicKeyBlob*)blobPtr; + var blobReader = new BlobReader(ptr, blob.Length); + + // Signature algorithm ID + var sigAlgId = blobReader.ReadUInt32(); + // Hash algorithm ID + var hashAlgId = blobReader.ReadUInt32(); + // Size of public key data in bytes, not including the header + var publicKeySize = blobReader.ReadUInt32(); + // publicKeySize bytes of public key data + var publicKey = blobReader.ReadByte(); // The number of public key bytes must be the same as the size of the header plus the size of the public key data. - if (blob.Length != s_publicKeyHeaderSize + pkb->PublicKeySize) + if (blob.Length != s_publicKeyHeaderSize + publicKeySize) { return false; } @@ -134,18 +122,18 @@ private static unsafe bool IsValidPublicKeyUnsafe(ImmutableArray blob) } // The public key must be in the wincrypto PUBLICKEYBLOB format - if (pkb->PublicKey[0] != PublicKeyBlobId) + if (publicKey != PublicKeyBlobId) { return false; } - var signatureAlgorithmId = new AlgorithmId(pkb->SigAlgId); + var signatureAlgorithmId = new AlgorithmId(sigAlgId); if (signatureAlgorithmId.IsSet && signatureAlgorithmId.Class != AlgorithmClass.Signature) { return false; } - var hashAlgorithmId = new AlgorithmId(pkb->HashAlgId); + var hashAlgorithmId = new AlgorithmId(hashAlgId); if (hashAlgorithmId.IsSet && (hashAlgorithmId.Class != AlgorithmClass.Hash || hashAlgorithmId.SubId < AlgorithmSubId.Sha1Hash)) { return false; @@ -155,128 +143,46 @@ private static unsafe bool IsValidPublicKeyUnsafe(ImmutableArray blob) return true; } - // PUBLICKEYSTRUC struct from wincrypt.h - [StructLayout(LayoutKind.Sequential)] - private struct BlobHeader - { - public byte Type; // Blob type - public byte Version; // Blob format version - public UInt16 Reserved; // Must be 0 - public UInt32 AlgId; // Algorithm ID. Must be one of ALG_ID specified in wincrypto.h - } + private const int BlobHeaderSize = sizeof(byte) + sizeof(byte) + sizeof(ushort) + sizeof(uint); + + private const int RsaPubKeySize = sizeof(uint) + sizeof(uint) + sizeof(uint); - // RSAPUBKEY struct from wincrypt.h - [StructLayout(LayoutKind.Sequential)] - private struct RsaPubKey - { - public UInt32 Magic; // Indicates RSA1 or RSA2 - public UInt32 BitLen; // Number of bits in the modulus. Must be multiple of 8. - public UInt32 PubExp; // The public exponent - } private const UInt32 RSA1 = 0x31415352; private const UInt32 RSA2 = 0x32415352; // In wincrypt.h both public and private key blobs start with a // PUBLICKEYSTRUC and RSAPUBKEY and then start the key data - private unsafe static readonly int s_offsetToKeyData = sizeof(BlobHeader) + sizeof(RsaPubKey); + private const int s_offsetToKeyData = BlobHeaderSize + RsaPubKeySize; - private static ImmutableArray CreateSnPublicKeyBlob(BlobHeader header, RsaPubKey rsa, byte[] pubKeyData) + private static ImmutableArray CreateSnPublicKeyBlob(byte type, byte version, ushort reserved, uint algId, uint magic, uint bitLen, uint pubExp, byte[] pubKeyData) { - var snPubKey = new SnPublicKeyBlob() - { - SigAlgId = AlgorithmId.RsaSign, - HashAlgId = AlgorithmId.Sha, - PublicKeySize = (UInt32)(s_offsetToKeyData + pubKeyData.Length) - }; - - using (var ms = new MemoryStream(160)) - using (var binaryWriter = new BinaryWriter(ms)) - { - binaryWriter.Write(snPubKey.SigAlgId); - binaryWriter.Write(snPubKey.HashAlgId); - binaryWriter.Write(snPubKey.PublicKeySize); + var w = new BlobWriter(3 * sizeof(uint) + s_offsetToKeyData + pubKeyData.Length); + w.WriteUInt32(AlgorithmId.RsaSign); + w.WriteUInt32(AlgorithmId.Sha); + w.WriteUInt32((uint)(s_offsetToKeyData + pubKeyData.Length)); - binaryWriter.Write(header.Type); - binaryWriter.Write(header.Version); - binaryWriter.Write(header.Reserved); - binaryWriter.Write(header.AlgId); + w.WriteByte(type); + w.WriteByte(version); + w.WriteUInt16(reserved); + w.WriteUInt32(algId); - binaryWriter.Write(rsa.Magic); - binaryWriter.Write(rsa.BitLen); - binaryWriter.Write(rsa.PubExp); + w.WriteUInt32(magic); + w.WriteUInt32(bitLen); + w.WriteUInt32(pubExp); - binaryWriter.Write(pubKeyData); + w.WriteBytes(pubKeyData); - return ms.ToImmutable(); - } - } - - private unsafe static bool TryGetPublicKeyFromPublicKeyBlob(byte* blob, int blobLen, out ImmutableArray publicKey) - { - var header = Marshal.PtrToStructure((IntPtr)blob); - var rsaPubKey = Marshal.PtrToStructure((IntPtr)(blob + sizeof(BlobHeader))); - var modulus = new byte[rsaPubKey.BitLen >> 3]; - - // The key blob data just contains the modulus - if (blobLen - s_offsetToKeyData != modulus.Length) - { - publicKey = ImmutableArray.Empty; - return false; - } - - Marshal.Copy((IntPtr)(blob + s_offsetToKeyData), modulus, 0, modulus.Length); - - publicKey = CreateSnPublicKeyBlob(header, rsaPubKey, modulus); - return true; - } - - private unsafe static bool TryGetPublicKeyFromPrivateKeyBlob(byte* blob, int blobLen, out ImmutableArray publicKey) - { - var header = (BlobHeader*)blob; - var rsa = (RsaPubKey*)(blob + sizeof(BlobHeader)); - - var version = header->Version; - var modulusBitLength = rsa->BitLen; - var exponent = rsa->PubExp; - var modulus = new byte[modulusBitLength >> 3]; - - if (blobLen - s_offsetToKeyData < modulus.Length) - { - publicKey = ImmutableArray.Empty; - return false; - } - - Marshal.Copy((IntPtr)(blob + s_offsetToKeyData), modulus, 0, modulus.Length); - - var newHeader = new BlobHeader() - { - Type = PublicKeyBlobId, - Version = version, - Reserved = 0, - AlgId = AlgorithmId.RsaSign - }; - - var newRsaKey = new RsaPubKey() - { - Magic = RSA1, // Public key - BitLen = modulusBitLength, - PubExp = exponent - }; - - publicKey = CreateSnPublicKeyBlob(newHeader, newRsaKey, modulus); - return true; + return w.ToImmutableArray(); } /// /// Try to retrieve the public key from a crypto blob. /// /// - /// Can be either a PUBLICKEYBLOB or PRIVATEKEYBLOB. The BLOB must /// be unencrypted. + /// Can be either a PUBLICKEYBLOB or PRIVATEKEYBLOB. The BLOB must be unencrypted. /// public unsafe static bool TryGetPublicKey(ImmutableArray blob, out ImmutableArray publicKey) { - publicKey = ImmutableArray.Empty; - // Is this already a strong name PublicKeyBlob? if (IsValidPublicKey(blob)) { @@ -284,27 +190,49 @@ public unsafe static bool TryGetPublicKey(ImmutableArray blob, out Immutab return true; } + publicKey = ImmutableArray.Empty; + // Must be at least as large as header + RSA info - if (blob.Length < sizeof(BlobHeader) + sizeof(RsaPubKey)) + if (blob.Length < BlobHeaderSize + RsaPubKeySize) { return false; } - fixed (byte* backing = blob.DangerousGetUnderlyingArray()) + fixed (byte* ptr = blob.DangerousGetUnderlyingArray()) { - var header = (BlobHeader*)backing; - var rsa = (RsaPubKey*)(backing + sizeof(BlobHeader)); + var blobReader = new BlobReader(ptr, blob.Length); + + // Header (corresponds to PUBLICKEYSTRUC struct in wincrypt.h) + var type = blobReader.ReadByte(); + var version = blobReader.ReadByte(); + var reserved = blobReader.ReadUInt16(); + var algId = blobReader.ReadUInt32(); + + // Info (corresponds to RSAPUBKEY struct in wincrypt.h) + var magic = blobReader.ReadUInt32(); + var bitLen = blobReader.ReadUInt32(); + var pubExp = blobReader.ReadUInt32(); + + var modulusLength = (int)(bitLen >> 3); + // The key blob data just contains the modulus + if (blob.Length - s_offsetToKeyData < modulusLength) + { + return false; + } + + byte[] pubKeyData = blobReader.ReadBytes(modulusLength); // The RSA magic key must match the blob id - if (header->Type == PrivateKeyBlobId && - rsa->Magic == RSA2) + if (type == PrivateKeyBlobId && magic == RSA2) { - return TryGetPublicKeyFromPrivateKeyBlob(backing, blob.Length, out publicKey); + publicKey = CreateSnPublicKeyBlob(PublicKeyBlobId, version, 0, AlgorithmId.RsaSign, RSA1, bitLen, pubExp, pubKeyData); + return true; } - else if (header->Type == PublicKeyBlobId && - rsa->Magic == RSA1) + + if (type == PublicKeyBlobId && magic == RSA1) { - return TryGetPublicKeyFromPublicKeyBlob(backing, blob.Length, out publicKey); + publicKey = CreateSnPublicKeyBlob(type, version, reserved, algId, magic, bitLen, pubExp, pubKeyData); + return true; } } From cebebd2609320cf658871299a48344f47b5355cd Mon Sep 17 00:00:00 2001 From: Patrick Fenelon Date: Fri, 28 Jul 2017 08:37:51 -0700 Subject: [PATCH 055/205] Correct badge icon URLs to reflect renamed builds in DotNet's Jenkins CI --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b6b24fb2521d8..d59c465fc8863 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ |:--:|:--:|:--:|:--:| |**master**|[![BuildStatus](https://ci.dot.net/job/dotnet_roslyn/job/master/job/ubuntu_14_debug/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/master/job/ubuntu_14_debug/)|[![BuildStatus](https://ci.dot.net/job/dotnet_roslyn/job/master/job/ubuntu_16_debug/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/master/job/ubuntu_16_debug/)|[![BuildStatus](https://ci.dot.net/job/dotnet_roslyn/job/master/job/mac_debug/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/master/job/mac_debug/)| |**dev15.0.x**|[![BuildStatus](https://ci.dot.net/job/dotnet_roslyn/job/dev15.0.x/job/linux_debug/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.0.x/job/linux_debug/)||[![BuildStatus](https://ci.dot.net/job/dotnet_roslyn/job/dev15.0.x/job/mac_debug/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.0.x/job/mac_debug/)| -|**dev15.3.x**|[![BuildStatus](https://ci.dot.net/job/dotnet_roslyn/job/dev15.3.x/job/linux_debug/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.3.x/job/linux_debug/)||[![BuildStatus](https://ci.dot.net/job/dotnet_roslyn/job/dev15.3.x/job/mac_debug/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.3.x/job/mac_debug/)| +|**dev15.3.x**|[![BuildStatus](https://ci.dot.net/job/dotnet_roslyn/job/dev15.3.x/job/ubuntu_14_debug/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.3.x/job/ubuntu_14_debug/)|[![BuildStatus](https://ci.dot.net/job/dotnet_roslyn/job/dev15.3.x/job/ubuntu_16_debug/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.3.x/job/ubuntu_16_debug/)|[![BuildStatus](https://ci.dot.net/job/dotnet_roslyn/job/dev15.3.x/job/mac_debug/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev15.3.x/job/mac_debug/)| |**dev16**|[![BuildStatus](https://ci.dot.net/job/dotnet_roslyn/job/dev16/job/ubuntu_14_debug/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev16/job/ubuntu_14_debug/)|[![BuildStatus](https://ci.dot.net/job/dotnet_roslyn/job/dev16/job/ubuntu_16_debug/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev16/job/ubuntu_16_debug/)|[![BuildStatus](https://ci.dot.net/job/dotnet_roslyn/job/dev16/job/mac_debug/badge/icon)](https://ci.dot.net/job/dotnet_roslyn/job/dev16/job/mac_debug/)| [//]: # (End current test results) From 43d3a31bc698aa248e86b82176abf47ce75ca191 Mon Sep 17 00:00:00 2001 From: Jared Parsons Date: Thu, 27 Jul 2017 15:20:02 -0700 Subject: [PATCH 056/205] Work around sdk 1.1 compat bug Recent builds of the SDK introduced a bug around referencing netstandard 1.6 projects. This trigged on several Roslyn projects and cause build breaks with newer builds of VS. Suppressing the check for now. Will undo when we move to 2.0 SDK https://github.com/dotnet/roslyn/issues/21183 --- build/Targets/Settings.props | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build/Targets/Settings.props b/build/Targets/Settings.props index ddaee2cec1419..f4414d14df677 100644 --- a/build/Targets/Settings.props +++ b/build/Targets/Settings.props @@ -75,6 +75,9 @@ {RawFileName}; + + false + $(MSBuildSDKsPath)\Microsoft.NET.Sdk\Sdk\ PackageReference From 8c8a8c0b9bb91ddba6ae1c0e4c77d435d53a1284 Mon Sep 17 00:00:00 2001 From: Jared Parsons Date: Thu, 27 Jul 2017 17:13:32 -0700 Subject: [PATCH 057/205] Include UseBasicParsing switch By default Invoke-WebRequest will fail if IE hasn't gone through first configuration setup on the machine. Parts of our infrastructure don't run IE and as a result our uses of Invoke-WebRequest were failing. Fixed by passing the UseBasicParsing switch. --- build/scripts/build.ps1 | 2 +- build/scripts/run_perf.ps1 | 2 +- src/Tools/MicroBuild/publish-assets.ps1 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build/scripts/build.ps1 b/build/scripts/build.ps1 index d48acef745789..e42437b52925d 100644 --- a/build/scripts/build.ps1 +++ b/build/scripts/build.ps1 @@ -445,7 +445,7 @@ function Ensure-ProcDump() { Remove-Item -Re $filePath -ErrorAction SilentlyContinue Create-Directory $outDir $zipFilePath = Join-Path $toolsDir "procdump.zip" - Invoke-WebRequest "https://download.sysinternals.com/files/Procdump.zip" -outfile $zipFilePath | Out-Null + Invoke-WebRequest "https://download.sysinternals.com/files/Procdump.zip" -UseBasicParsing -outfile $zipFilePath | Out-Null Add-Type -AssemblyName System.IO.Compression.FileSystem [IO.Compression.ZipFile]::ExtractToDirectory($zipFilePath, $outDir) } diff --git a/build/scripts/run_perf.ps1 b/build/scripts/run_perf.ps1 index bcd50bfd47765..5bca5dcfcabe4 100644 --- a/build/scripts/run_perf.ps1 +++ b/build/scripts/run_perf.ps1 @@ -12,7 +12,7 @@ if ( -not $? ) exit 1 } -Invoke-WebRequest -Uri http://dotnetci.blob.core.windows.net/roslyn-perf/cpc.zip -OutFile cpc.zip +Invoke-WebRequest -Uri http://dotnetci.blob.core.windows.net/roslyn-perf/cpc.zip -OutFile cpc.zip -UseBasicParsing [Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') | Out-Null [IO.Compression.ZipFile]::ExtractToDirectory('cpc.zip', $CPCLocation) diff --git a/src/Tools/MicroBuild/publish-assets.ps1 b/src/Tools/MicroBuild/publish-assets.ps1 index b337ef385b7de..8ac5ec199df61 100644 --- a/src/Tools/MicroBuild/publish-assets.ps1 +++ b/src/Tools/MicroBuild/publish-assets.ps1 @@ -156,7 +156,7 @@ try { } Write-Host "Downloading PublishData.json" - $publishFileContent = (Invoke-WebRequest -Uri "https://raw.githubusercontent.com/dotnet/roslyn/master/build/config/PublishData.json").Content + $publishFileContent = (Invoke-WebRequest -Uri "https://raw.githubusercontent.com/dotnet/roslyn/master/build/config/PublishData.json" -UseBasicParsing).Content $data = ConvertFrom-Json $publishFileContent if ($branchName -ne "" -and $releaseName -ne "") { From 514ab6145e6fb3eb28f00d4f35091ca43c21c588 Mon Sep 17 00:00:00 2001 From: Jared Parsons Date: Fri, 21 Jul 2017 16:50:41 -0700 Subject: [PATCH 058/205] Use multi-targeting to control compilation helpers This changes our core Roslyn.Test.Utilities project to use multi-targeting to control how we create our core compilation helper. Previously this was done by having a separate runtime specific assembly which was probed at runtime. The intent of this change is to make our build more correct here. I can now target just Roslyn.Test.Utilties with a net46 framework and get a runnable asset out of it. This is necessary in order for our unit tests to successfully run when moved to multi-target. Presently this makes it multi-target across net46, netcoreapp2.0 and netstandard1.3. The impl in netstandard 1.3 simply throw for this specific API. Over the long term it make make sense to pull this out to a separate library that only targets net46 + netcoreapp2.0. That requires a much deeper investment in multi-targeting though. Decided to start smaller for now. --- build/Targets/Imports.targets | 2 +- build/Targets/Settings.props | 8 ++++ .../InternalsVisibleToAndStrongNameTests.cs | 1 + .../Test/WinRT/Metadata/WinMdDumpTest.cs | 1 + .../Test/WinRT/PEParameterSymbolTests.cs | 1 + .../AnalyzerFileReferenceTests.cs | 1 + .../Test/Emit/CodeGen/CodeGenWinMdEvents.vb | 7 +--- .../Metadata/PE/PEParameterSymbolTests.vb | 1 + .../SymbolsTests/Source/ComClassTests.vb | 1 + ...ualStudio.IntegrationTest.Utilities.nuspec | 2 +- .../BuildDevDivInsertionFiles.vb | 2 +- .../Compilation/IRuntimeEnvironment.cs | 41 ++++--------------- .../Utilities/Portable/Metadata/ModuleData.cs | 2 +- .../CoreClr/CoreCLRRuntimeEnvironment.cs | 8 ++-- .../CoreCLRRuntimeEnvironmentFactory.cs | 5 ++- .../CoreClr/SharedConsoleOutWriter.cs | 9 +++- .../CoreClr/TestExecutionLoadContext.cs | 5 ++- .../Desktop}/AppDomainAssemblyCache.cs | 5 ++- .../Platform}/Desktop/AppDomainUtils.cs | 5 ++- .../Platform}/Desktop/CLRHelpers.cs | 10 +++-- .../Desktop}/DesktopRuntimeEnvironment.cs | 13 +++--- .../DesktopRuntimeEnvironmentFactory.cs | 7 +++- .../Platform}/Desktop/DesktopRuntimeUtil.cs | 7 +++- .../Platform/Desktop}/Exceptions.cs | 4 +- .../Platform}/Desktop/Extensions.cs | 5 ++- .../Desktop/MetadataSignatureHelper.cs | 6 ++- .../Desktop}/RuntimeAssemblyManager.cs | 11 +++-- .../Platform/Desktop}/RuntimeModuleData.cs | 5 ++- .../Utilities/Portable/TestUtilities.csproj | 3 +- src/Tools/BuildBoss/ProjectUtil.cs | 5 ++- 30 files changed, 101 insertions(+), 82 deletions(-) rename src/Test/Utilities/{ => Portable/Platform}/CoreClr/CoreCLRRuntimeEnvironment.cs (97%) rename src/Test/Utilities/{ => Portable/Platform}/CoreClr/CoreCLRRuntimeEnvironmentFactory.cs (88%) rename src/Test/Utilities/{ => Portable/Platform}/CoreClr/SharedConsoleOutWriter.cs (94%) rename src/Test/Utilities/{ => Portable/Platform}/CoreClr/TestExecutionLoadContext.cs (99%) rename src/Test/Utilities/{Desktop/CodeRuntime => Portable/Platform/Desktop}/AppDomainAssemblyCache.cs (98%) rename src/Test/Utilities/{ => Portable/Platform}/Desktop/AppDomainUtils.cs (97%) rename src/Test/Utilities/{ => Portable/Platform}/Desktop/CLRHelpers.cs (98%) rename src/Test/Utilities/{Desktop/CodeRuntime => Portable/Platform/Desktop}/DesktopRuntimeEnvironment.cs (97%) rename src/Test/Utilities/{Desktop/CodeRuntime => Portable/Platform/Desktop}/DesktopRuntimeEnvironmentFactory.cs (76%) rename src/Test/Utilities/{ => Portable/Platform}/Desktop/DesktopRuntimeUtil.cs (98%) rename src/Test/Utilities/{Desktop/CodeRuntime => Portable/Platform/Desktop}/Exceptions.cs (95%) rename src/Test/Utilities/{ => Portable/Platform}/Desktop/Extensions.cs (97%) rename src/Test/Utilities/{ => Portable/Platform}/Desktop/MetadataSignatureHelper.cs (99%) rename src/Test/Utilities/{Desktop/CodeRuntime => Portable/Platform/Desktop}/RuntimeAssemblyManager.cs (98%) rename src/Test/Utilities/{Desktop/CodeRuntime => Portable/Platform/Desktop}/RuntimeModuleData.cs (97%) diff --git a/build/Targets/Imports.targets b/build/Targets/Imports.targets index e023fabe73946..5d87f8554cc6e 100644 --- a/build/Targets/Imports.targets +++ b/build/Targets/Imports.targets @@ -100,7 +100,7 @@ true - false + false false portable + + + netcoreapp2.0 - - <_CopyReferences>$(DeveloperBuild) - <_CopyProjectReferences>$(DeveloperBuild) - <_IsAnyUnitTest>true - <_IsAnyPortableUnitTest>true - false - $(OutputPath)Dlls\$(MSBuildProjectName)\ - - <_CopyReferences>false @@ -38,15 +17,6 @@ $(OutputPath)Vsix\$(MSBuildProjectName)\ - - - - $(AllowedReferenceRelatedFileExtensions);.pdb - true - $(OutputPath)$(RoslynUnitTestDir) - - diff --git a/build/scripts/build.ps1 b/build/scripts/build.ps1 index e42437b52925d..9a66ad3405051 100644 --- a/build/scripts/build.ps1 +++ b/build/scripts/build.ps1 @@ -344,6 +344,9 @@ function Test-XUnit() { $args += " -trait:Feature=NetCore" } + # Exclude out the multi-targetted netcore app projects + $dlls = $dlls | ?{ -not ($_.FullName -match ".*netcoreapp.*") } + if ($cibuild) { # Use a 50 minute timeout on CI $args += " -xml -timeout:50" diff --git a/src/CodeStyle/CSharp/Tests/CSharpCodeStyleTests.csproj b/src/CodeStyle/CSharp/Tests/CSharpCodeStyleTests.csproj index 57c2d6a9511b5..60982a8a45da7 100644 --- a/src/CodeStyle/CSharp/Tests/CSharpCodeStyleTests.csproj +++ b/src/CodeStyle/CSharp/Tests/CSharpCodeStyleTests.csproj @@ -9,7 +9,7 @@ Library Microsoft.CodeAnalysis.CSharp Microsoft.CodeAnalysis.CSharp.CodeStyle.UnitTests - netstandard1.3 + $(RoslynPortableTargetFrameworks) UnitTestPortable diff --git a/src/CodeStyle/Core/Tests/CodeStyleTests.csproj b/src/CodeStyle/Core/Tests/CodeStyleTests.csproj index 4785cd2d0da7b..c73eb02dacf43 100644 --- a/src/CodeStyle/Core/Tests/CodeStyleTests.csproj +++ b/src/CodeStyle/Core/Tests/CodeStyleTests.csproj @@ -9,7 +9,7 @@ Library Microsoft.CodeAnalysis Microsoft.CodeAnalysis.CodeStyle.UnitTests - netstandard1.3 + $(RoslynPortableTargetFrameworks) UnitTestPortable diff --git a/src/CodeStyle/VisualBasic/Tests/BasicCodeStyleTests.vbproj b/src/CodeStyle/VisualBasic/Tests/BasicCodeStyleTests.vbproj index 7f5235aa6d2d6..0402a439ca485 100644 --- a/src/CodeStyle/VisualBasic/Tests/BasicCodeStyleTests.vbproj +++ b/src/CodeStyle/VisualBasic/Tests/BasicCodeStyleTests.vbproj @@ -8,7 +8,7 @@ AnyCPU Library Microsoft.CodeAnalysis.VisualBasic.CodeStyle.UnitTests - netstandard1.3 + $(RoslynPortableTargetFrameworks) UnitTestPortable @@ -29,4 +29,4 @@ - \ No newline at end of file + diff --git a/src/Compilers/CSharp/Test/Symbol/CSharpCompilerSymbolTest.csproj b/src/Compilers/CSharp/Test/Symbol/CSharpCompilerSymbolTest.csproj index ab202486b9147..83b4058bd50cf 100644 --- a/src/Compilers/CSharp/Test/Symbol/CSharpCompilerSymbolTest.csproj +++ b/src/Compilers/CSharp/Test/Symbol/CSharpCompilerSymbolTest.csproj @@ -9,9 +9,9 @@ Library Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests Roslyn.Compilers.CSharp.Symbol.UnitTests - netstandard1.3 true - UnitTestPortable + $(RoslynPortableTargetFrameworks) + UnitTest true diff --git a/src/Compilers/CSharp/Test/Syntax/CSharpCompilerSyntaxTest.csproj b/src/Compilers/CSharp/Test/Syntax/CSharpCompilerSyntaxTest.csproj index f073084ebb857..b385564f94f46 100644 --- a/src/Compilers/CSharp/Test/Syntax/CSharpCompilerSyntaxTest.csproj +++ b/src/Compilers/CSharp/Test/Syntax/CSharpCompilerSyntaxTest.csproj @@ -10,9 +10,9 @@ Microsoft.CodeAnalysis.CSharp.UnitTests Roslyn.Compilers.CSharp.Syntax.UnitTests false - netstandard1.3 true true + $(RoslynPortableTargetFrameworks) UnitTestPortable $(NoWarn);1570;1587 @@ -49,4 +49,4 @@ - \ No newline at end of file + diff --git a/src/Scripting/CSharpTest/CSharpScriptingTest.csproj b/src/Scripting/CSharpTest/CSharpScriptingTest.csproj index b7f456c57b2e4..9a19505c7cf69 100644 --- a/src/Scripting/CSharpTest/CSharpScriptingTest.csproj +++ b/src/Scripting/CSharpTest/CSharpScriptingTest.csproj @@ -10,8 +10,8 @@ Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests true - netstandard1.3 - UnitTestDesktop + $(RoslynPortableTargetFrameworks) + UnitTestPortable @@ -37,4 +37,4 @@ - \ No newline at end of file + diff --git a/src/Scripting/CSharpTest/ScriptTests.cs b/src/Scripting/CSharpTest/ScriptTests.cs index 2d0161e2530b6..78258f169d190 100644 --- a/src/Scripting/CSharpTest/ScriptTests.cs +++ b/src/Scripting/CSharpTest/ScriptTests.cs @@ -944,7 +944,8 @@ private async Task VerifyStackTraceAsync(Func> scriptProvider, in catch (Exception ex) { // line information is only available when PDBs have been emitted - var stackTrace = new StackTrace(ex, needFileInfo: true); + var needFileInfo = true; + var stackTrace = new StackTrace(ex, needFileInfo); var firstFrame = stackTrace.GetFrames()[0]; Assert.Equal(filename, firstFrame.GetFileName()); Assert.Equal(line, firstFrame.GetFileLineNumber()); diff --git a/src/Scripting/CoreTest/ScriptingTest.csproj b/src/Scripting/CoreTest/ScriptingTest.csproj index bce89db027c5a..45a7b991f5d50 100644 --- a/src/Scripting/CoreTest/ScriptingTest.csproj +++ b/src/Scripting/CoreTest/ScriptingTest.csproj @@ -10,7 +10,7 @@ Microsoft.CodeAnalysis.Scripting.Test Microsoft.CodeAnalysis.Scripting.UnitTests true - netstandard1.3 + $(RoslynPortableTargetFrameworks) UnitTestPortable @@ -40,4 +40,4 @@ - \ No newline at end of file + diff --git a/src/Scripting/VisualBasicTest/BasicScriptingTest.vbproj b/src/Scripting/VisualBasicTest/BasicScriptingTest.vbproj index 717f3081a41ae..75459afde0ee8 100644 --- a/src/Scripting/VisualBasicTest/BasicScriptingTest.vbproj +++ b/src/Scripting/VisualBasicTest/BasicScriptingTest.vbproj @@ -8,8 +8,8 @@ AnyCPU Library Microsoft.CodeAnalysis.VisualBasic.Scripting.UnitTests - netstandard1.3 - UnitTestDesktop + net46 + UnitTest @@ -32,4 +32,4 @@ - \ No newline at end of file + diff --git a/src/Test/DeployDesktopTestRuntime/DeployDesktopTestRuntime.csproj b/src/Test/DeployDesktopTestRuntime/DeployDesktopTestRuntime.csproj deleted file mode 100644 index 03be39719d160..0000000000000 --- a/src/Test/DeployDesktopTestRuntime/DeployDesktopTestRuntime.csproj +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - AnyCPU - AnyCPU - Library - DeplyDesktopTestRuntime_DoNotUse - true - net46 - win7 - DeploymentTest - UnitTests\Portable - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Tools/BuildBoss/ProjectCheckerUtil.cs b/src/Tools/BuildBoss/ProjectCheckerUtil.cs index 8eeea54393540..fc4102b856014 100644 --- a/src/Tools/BuildBoss/ProjectCheckerUtil.cs +++ b/src/Tools/BuildBoss/ProjectCheckerUtil.cs @@ -64,8 +64,6 @@ public bool Check(TextWriter textWriter) allGood &= CheckDeploymentSettings(textWriter); } - allGood &= CheckTestDeploymentProjects(textWriter); - return allGood; } @@ -414,60 +412,5 @@ private bool IsUnitTestCorrectlySpecified(TextWriter textWriter, RoslynProjectDa return true; } - - /// - /// Verify our test deployment projects properly reference everything which is labeled as a portable - /// unit test. This ensurse they are properly deployed during build and test. - /// - private bool CheckTestDeploymentProjects(TextWriter textWriter) - { - var fileName = Path.GetFileNameWithoutExtension(_data.FileName); - var isDesktop = fileName == "DeployDesktopTestRuntime"; - if (!isDesktop) - { - return true; - } - - var allGood = true; - var data = _projectUtil.TryGetRoslynProjectData(); - if (data?.DeclaredKind != RoslynProjectKind.DeploymentTest) - { - textWriter.WriteLine("Test deployment project must be marked as DeploymentTest"); - allGood = false; - } - - var set = new HashSet(_projectUtil.GetDeclaredProjectReferences().Select(x => x.ProjectKey)); - foreach (var projectData in _solutionMap.Values) - { - var rosData = projectData.ProjectUtil.TryGetRoslynProjectData(); - if (rosData == null) - { - continue; - } - - var kind = rosData.Value.DeclaredKind; - bool include; - switch (kind) - { - case RoslynProjectKind.UnitTestPortable: - include = true; - break; - case RoslynProjectKind.UnitTestDesktop: - include = isDesktop; - break; - default: - include = false; - break; - } - - if (include && !set.Contains(projectData.Key)) - { - textWriter.WriteLine($"Portable unit test {projectData.FileName} must be referenced"); - allGood = false; - } - } - - return allGood; - } } } diff --git a/src/Tools/BuildBoss/RoslynProjectData.cs b/src/Tools/BuildBoss/RoslynProjectData.cs index 929315785072c..2aa2f7ee23f63 100644 --- a/src/Tools/BuildBoss/RoslynProjectData.cs +++ b/src/Tools/BuildBoss/RoslynProjectData.cs @@ -13,9 +13,7 @@ internal enum RoslynProjectKind Exe, ExeNonDeployment, UnitTest, - UnitTestDesktop, UnitTestPortable, - DeploymentTest, Vsix, Depedency, Custom @@ -32,12 +30,8 @@ internal static class RoslynProjectKindUtil { case "UnitTestPortable": return RoslynProjectKind.UnitTestPortable; - case "UnitTestDesktop": - return RoslynProjectKind.UnitTestDesktop; case "UnitTest": return RoslynProjectKind.UnitTest; - case "DeploymentTest": - return RoslynProjectKind.DeploymentTest; case "Vsix": return RoslynProjectKind.Vsix; case "Dependency": @@ -53,7 +47,6 @@ internal static bool IsAnyUnitTest(RoslynProjectKind kind) { return kind == RoslynProjectKind.UnitTest || - kind == RoslynProjectKind.UnitTestDesktop || kind == RoslynProjectKind.UnitTestPortable; } @@ -61,7 +54,6 @@ internal static bool IsDeploymentProject(RoslynProjectKind kind) { return kind == RoslynProjectKind.Exe || - kind == RoslynProjectKind.DeploymentTest || IsAnyUnitTest(kind); } } diff --git a/src/VisualStudio/Core/Def/ServicesVisualStudio.csproj b/src/VisualStudio/Core/Def/ServicesVisualStudio.csproj index 69b7db33f592e..b9f38e7bb5313 100644 --- a/src/VisualStudio/Core/Def/ServicesVisualStudio.csproj +++ b/src/VisualStudio/Core/Def/ServicesVisualStudio.csproj @@ -138,7 +138,6 @@ - @@ -249,4 +248,4 @@ - \ No newline at end of file + diff --git a/src/VisualStudio/Setup/VisualStudioSetup.csproj b/src/VisualStudio/Setup/VisualStudioSetup.csproj index 873a922c5e7ce..d4f6c71235575 100644 --- a/src/VisualStudio/Setup/VisualStudioSetup.csproj +++ b/src/VisualStudio/Setup/VisualStudioSetup.csproj @@ -217,7 +217,6 @@ - - \ No newline at end of file + From bdce85dd8700190677b71af7447b7ea8edf0f4db Mon Sep 17 00:00:00 2001 From: David Poeschl Date: Fri, 28 Jul 2017 13:38:03 -0700 Subject: [PATCH 063/205] Fix spacing --- .../OrganizeImports/CSharpOrganizeImportsService.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Features/CSharp/Portable/OrganizeImports/CSharpOrganizeImportsService.cs b/src/Features/CSharp/Portable/OrganizeImports/CSharpOrganizeImportsService.cs index a78908dc043ad..02f434a984ace 100644 --- a/src/Features/CSharp/Portable/OrganizeImports/CSharpOrganizeImportsService.cs +++ b/src/Features/CSharp/Portable/OrganizeImports/CSharpOrganizeImportsService.cs @@ -12,11 +12,7 @@ namespace Microsoft.CodeAnalysis.CSharp.OrganizeImports [ExportLanguageService(typeof(IOrganizeImportsService), LanguageNames.CSharp), Shared] internal partial class CSharpOrganizeImportsService : IOrganizeImportsService { - public async Task OrganizeImportsAsync(Document - - - - document, CancellationToken cancellationToken) + public async Task OrganizeImportsAsync(Document document, CancellationToken cancellationToken) { var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); var options = await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false); From a0caa657dec24d27199bcd3c8976e982f3aae1e3 Mon Sep 17 00:00:00 2001 From: David Poeschl Date: Fri, 28 Jul 2017 14:15:57 -0700 Subject: [PATCH 064/205] Fix spelling --- .../Portable/Utilities/UsingsAndExternAliasesOrganizer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Workspaces/CSharp/Portable/Utilities/UsingsAndExternAliasesOrganizer.cs b/src/Workspaces/CSharp/Portable/Utilities/UsingsAndExternAliasesOrganizer.cs index d94a64ed01fad..15dd1b17d35ac 100644 --- a/src/Workspaces/CSharp/Portable/Utilities/UsingsAndExternAliasesOrganizer.cs +++ b/src/Workspaces/CSharp/Portable/Utilities/UsingsAndExternAliasesOrganizer.cs @@ -77,7 +77,7 @@ private static bool NeedsGrouping( if (directive1IsNamespace && directive2IsNamespace) { - // Both normal usings. Place them in groups if they're first namespace + // Both normal usings. Place them in groups if their first namespace // component differs. var name1 = using1.Name.GetFirstToken().ValueText; var name2 = using2.Name.GetFirstToken().ValueText; From 02fbbc506d73036c87f3466774c2eaec0a5e987b Mon Sep 17 00:00:00 2001 From: David Poeschl Date: Fri, 28 Jul 2017 14:16:42 -0700 Subject: [PATCH 065/205] Fix spelling of .editorconfig option --- src/Workspaces/Core/Portable/Editing/GenerationOptions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Workspaces/Core/Portable/Editing/GenerationOptions.cs b/src/Workspaces/Core/Portable/Editing/GenerationOptions.cs index 5d2d9f34e2fb4..8759a24a78dae 100644 --- a/src/Workspaces/Core/Portable/Editing/GenerationOptions.cs +++ b/src/Workspaces/Core/Portable/Editing/GenerationOptions.cs @@ -15,7 +15,7 @@ internal class GenerationOptions public static readonly PerLanguageOption SeparateImportDirectiveGroups = new PerLanguageOption( nameof(GenerationOptions), nameof(SeparateImportDirectiveGroups), defaultValue: false, storageLocations: new OptionStorageLocation[] { - EditorConfigStorageLocation.ForBoolOption("dotnet_seperate_import_directive_groups"), + EditorConfigStorageLocation.ForBoolOption("dotnet_separate_import_directive_groups"), new RoamingProfileStorageLocation($"TextEditor.%LANGUAGE%.Specific.{nameof(SeparateImportDirectiveGroups)}")}); } } From a2ad5c2ae0d11fdfc49c3ac5c26e5a65b56c768c Mon Sep 17 00:00:00 2001 From: Andy Gocke Date: Fri, 28 Jul 2017 16:34:59 -0700 Subject: [PATCH 066/205] Fix free in lambda analysis (#21088) Lambda analysis uses a lot of pooled data structures (as it should, since it will be redone from scratch using the exact same structure for every method) but did not properly free everything. This should properly recursively free all pooled data structures used in analysis. --- .../LambdaRewriter/LambdaRewriter.Analysis.cs | 33 +++++++++---------- .../Lowering/LambdaRewriter/LambdaRewriter.cs | 2 ++ 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.Analysis.cs b/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.Analysis.cs index ab857ae97a5cc..8e3e0d936d140 100644 --- a/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.Analysis.cs +++ b/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.Analysis.cs @@ -1,8 +1,5 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System.Collections.Generic; -using System.Collections.Immutable; -using System.Diagnostics; using System.Linq; using Microsoft.CodeAnalysis.CSharp.Symbols; using Microsoft.CodeAnalysis.PooledObjects; @@ -22,7 +19,7 @@ internal sealed partial class Analysis /// If a local function is in the set, at some point in the code it is converted to a delegate and should then not be optimized to a struct closure. /// Also contains all lambdas (as they are converted to delegates implicitly). /// - public readonly HashSet MethodsConvertedToDelegates; + public readonly PooledHashSet MethodsConvertedToDelegates; /// /// True if the method signature can be rewritten to contain ref/out parameters. @@ -36,19 +33,16 @@ public bool CanTakeRefParameters(MethodSymbol closure) => !(closure.IsAsync /// Any scope that a method that doesn't close over. /// If a scope is in this set, don't use a struct closure. /// - public readonly HashSet ScopesThatCantBeStructs = new HashSet(); + public readonly PooledHashSet ScopesThatCantBeStructs = PooledHashSet.GetInstance(); /// /// Blocks that are positioned between a block declaring some lifted variables /// and a block that contains the lambda that lifts said variables. /// If such block itself requires a closure, then it must lift parent frame pointer into the closure /// in addition to whatever else needs to be lifted. - /// - /// NOTE: This information is computed in addition to the regular analysis of the tree and only needed for rewriting. - /// If someone only needs diagnostics or information about captures, this information is not necessary. /// needs to be called to compute this. /// - public HashSet NeedsParentFrame; + public readonly PooledHashSet NeedsParentFrame = PooledHashSet.GetInstance(); /// /// Optimized locations of lambdas. @@ -56,19 +50,17 @@ public bool CanTakeRefParameters(MethodSymbol closure) => !(closure.IsAsync /// Lambda does not need to be placed in a frame that corresponds to its lexical scope if lambda does not reference any local state in that scope. /// It is advantageous to place lambdas higher in the scope tree, ideally in the innermost scope of all scopes that contain variables captured by a given lambda. /// Doing so reduces indirections needed when captured locals are accessed. For example locals from the innermost scope can be accessed with no indirection at all. - /// - /// NOTE: This information is computed in addition to the regular analysis of the tree and only needed for rewriting. - /// If someone only needs diagnostics or information about captures, this information is not necessary. /// needs to be called to compute this. /// - public Dictionary LambdaScopes; + public readonly SmallDictionary LambdaScopes = + new SmallDictionary(ReferenceEqualityComparer.Instance); /// /// The root of the scope tree for this method. /// public readonly Scope ScopeTree; - private Analysis(Scope scopeTree, HashSet methodsConvertedToDelegates) + private Analysis(Scope scopeTree, PooledHashSet methodsConvertedToDelegates) { ScopeTree = scopeTree; MethodsConvertedToDelegates = methodsConvertedToDelegates; @@ -76,7 +68,7 @@ private Analysis(Scope scopeTree, HashSet methodsConvertedToDelega public static Analysis Analyze(BoundNode node, MethodSymbol method, DiagnosticBag diagnostics) { - var methodsConvertedToDelegates = new HashSet(); + var methodsConvertedToDelegates = PooledHashSet.GetInstance(); var scopeTree = ScopeTreeBuilder.Build( node, method, @@ -121,9 +113,6 @@ internal void ComputeLambdaScopesAndFrameCaptures(ParameterSymbol thisParam) { RemoveUnneededReferences(thisParam); - LambdaScopes = new Dictionary(ReferenceEqualityComparer.Instance); - NeedsParentFrame = new HashSet(); - VisitClosures(ScopeTree, (scope, closure) => { if (closure.CapturedVariables.Count > 0) @@ -354,6 +343,14 @@ Closure Helper(Scope scope) return null; } } + + public void Free() + { + MethodsConvertedToDelegates.Free(); + ScopesThatCantBeStructs.Free(); + NeedsParentFrame.Free(); + ScopeTree.Free(); + } } } } diff --git a/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.cs b/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.cs index 855f6a9971a9b..b0e9ffca56a38 100644 --- a/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.cs +++ b/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.cs @@ -289,6 +289,8 @@ public static BoundStatement Rewrite( CheckLocalsDefined(body); + analysis.Free(); + return body; } From f52d600b74ad4c2c38df34e364552e045b49a3cc Mon Sep 17 00:00:00 2001 From: Petr Onderka Date: Sat, 29 Jul 2017 02:21:43 +0200 Subject: [PATCH 067/205] Order of all parameters matters for determinism (#19666) --- docs/compilers/Deterministic Inputs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/compilers/Deterministic Inputs.md b/docs/compilers/Deterministic Inputs.md index b43e9971f2b8b..2c47ccf10a7aa 100644 --- a/docs/compilers/Deterministic Inputs.md +++ b/docs/compilers/Deterministic Inputs.md @@ -5,7 +5,7 @@ We are aiming to make the compilers ultimately deterministic (https://github.com The following are considered inputs to the compiler for the purpose of determinism: -- The sequence of command-line flags +- The sequence of command-line parameters - The contents of the compiler's `.rsp` response file. - The precise version of the compiler used, and its referenced assemblies - Current full directory path (you can reduce this to a relative path; see https://github.com/dotnet/roslyn/issues/949) From 238eced1557c278ef7f1bc6d3c82480bd5a6f6b8 Mon Sep 17 00:00:00 2001 From: CyrusNajmabadi Date: Sat, 29 Jul 2017 19:40:18 -0700 Subject: [PATCH 068/205] Add feature to add missing File-Banner to a file. --- .../AddFileBanner/AddFileBannerTests.cs | 201 ++++++++++++++++++ src/EditorFeatures/TestUtilities/Traits.cs | 1 + ...arpAddFileBannerCodeRefactoringProvider.cs | 15 ++ ...actAddFileBannerCodeRefactoringProvider.cs | 113 ++++++++++ .../Portable/FeaturesResources.Designer.cs | 9 + .../Core/Portable/FeaturesResources.resx | 3 + ...sicAddFileBannerCodeRefactoringProvider.vb | 16 ++ .../CSharpSyntaxFactsService.cs | 3 + .../AbstractSyntaxFactsService.cs | 8 +- .../SyntaxFactsService/ISyntaxFactsService.cs | 3 + .../VisualBasicSyntaxFactsService.vb | 8 + 11 files changed, 379 insertions(+), 1 deletion(-) create mode 100644 src/EditorFeatures/CSharpTest/AddFileBanner/AddFileBannerTests.cs create mode 100644 src/Features/CSharp/Portable/AddFileBanner/CSharpAddFileBannerCodeRefactoringProvider.cs create mode 100644 src/Features/Core/Portable/AddFileBanner/AbstractAddFileBannerCodeRefactoringProvider.cs create mode 100644 src/Features/VisualBasic/Portable/AddFileBanner/VisualBasicAddFileBannerCodeRefactoringProvider.vb diff --git a/src/EditorFeatures/CSharpTest/AddFileBanner/AddFileBannerTests.cs b/src/EditorFeatures/CSharpTest/AddFileBanner/AddFileBannerTests.cs new file mode 100644 index 0000000000000..2e15b02610c3f --- /dev/null +++ b/src/EditorFeatures/CSharpTest/AddFileBanner/AddFileBannerTests.cs @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.CodeRefactorings; +using Microsoft.CodeAnalysis.CSharp.AddFileBanner; +using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.CodeRefactorings; +using Roslyn.Test.Utilities; +using Xunit; + +namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.AddFileBanner +{ + public partial class AddFileBannerTests : AbstractCSharpCodeActionTest + { + protected override CodeRefactoringProvider CreateCodeRefactoringProvider(Workspace workspace, TestParameters parameters) + => new CSharpAddFileBannerCodeRefactoringProvider(); + + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsAddFileBanner)] + public async Task TestBanner1() + { + await TestInRegularAndScriptAsync( +@" + + + [||]using System; + +class Program1 +{ + static void Main() + { + } +} + + // This is the banner + +class Program2 +{ +} + + +", +@" + + + // This is the banner + +using System; + +class Program1 +{ + static void Main() + { + } +} + + // This is the banner + +class Program2 +{ +} + + +", ignoreTrivia: false); + } + + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsAddFileBanner)] + public async Task TestMultiLineBanner1() + { + await TestInRegularAndScriptAsync( +@" + + + [||]using System; + +class Program1 +{ + static void Main() + { + } +} + + // This is the banner +// It goes over multiple lines + +class Program2 +{ +} + + +", +@" + + + // This is the banner +// It goes over multiple lines + +using System; + +class Program1 +{ + static void Main() + { + } +} + + // This is the banner +// It goes over multiple lines + +class Program2 +{ +} + + +", ignoreTrivia: false); + } + + + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsAddFileBanner)] + public async Task TestMissingWhenAlreadyThere() + { + await TestMissingAsync( +@" + + + [||]// I already have a banner + +using System; + +class Program1 +{ + static void Main() + { + } +} + + // This is the banner + +class Program2 +{ +} + + +"); + } + + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsAddFileBanner)] + public async Task TestMissingIfOtherFileDoesNotHaveBanner() + { + await TestMissingAsync( +@" + + + [||] + +using System; + +class Program1 +{ + static void Main() + { + } +} + + + +class Program2 +{ +} + + +"); + } + + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsAddFileBanner)] + public async Task TestMissingIfOtherFileIsAutoGenerated() + { + await TestMissingAsync( +@" + + + [||] + +using System; + +class Program1 +{ + static void Main() + { + } +} + + // <autogenerated /> + +class Program2 +{ +} + + +"); + } + } +} diff --git a/src/EditorFeatures/TestUtilities/Traits.cs b/src/EditorFeatures/TestUtilities/Traits.cs index 192e017aab000..8e03c0de49996 100644 --- a/src/EditorFeatures/TestUtilities/Traits.cs +++ b/src/EditorFeatures/TestUtilities/Traits.cs @@ -34,6 +34,7 @@ public static class Features public const string CodeActionsUpgradeProject = "CodeActions.UpgradeProject"; public const string CodeActionsAddAccessibilityModifiers = "CodeActions.AddAccessibilityModifiers"; public const string CodeActionsAddBraces = "CodeActions.AddBraces"; + public const string CodeActionsAddFileBanner = "CodeActions.AddFileBanner"; public const string CodeActionsAddImport = "CodeActions.AddImport"; public const string CodeActionsAddMissingReference = "CodeActions.AddMissingReference"; public const string CodeActionsAddParameter = "CodeActions.AddParameter"; diff --git a/src/Features/CSharp/Portable/AddFileBanner/CSharpAddFileBannerCodeRefactoringProvider.cs b/src/Features/CSharp/Portable/AddFileBanner/CSharpAddFileBannerCodeRefactoringProvider.cs new file mode 100644 index 0000000000000..e15b7fd3f9ecd --- /dev/null +++ b/src/Features/CSharp/Portable/AddFileBanner/CSharpAddFileBannerCodeRefactoringProvider.cs @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Composition; +using Microsoft.CodeAnalysis.AddFileBanner; +using Microsoft.CodeAnalysis.CodeRefactorings; + +namespace Microsoft.CodeAnalysis.CSharp.AddFileBanner +{ + [ExportCodeRefactoringProvider(LanguageNames.CSharp), Shared] + internal class CSharpAddFileBannerCodeRefactoringProvider : AbstractAddFileBannerCodeRefactoringProvider + { + protected override bool IsCommentStartCharacter(char ch) + => ch == '/'; + } +} diff --git a/src/Features/Core/Portable/AddFileBanner/AbstractAddFileBannerCodeRefactoringProvider.cs b/src/Features/Core/Portable/AddFileBanner/AbstractAddFileBannerCodeRefactoringProvider.cs new file mode 100644 index 0000000000000..4c3e5b2642a5a --- /dev/null +++ b/src/Features/Core/Portable/AddFileBanner/AbstractAddFileBannerCodeRefactoringProvider.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Immutable; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.CodeActions; +using Microsoft.CodeAnalysis.CodeRefactorings; +using Microsoft.CodeAnalysis.LanguageServices; +using Microsoft.CodeAnalysis.Shared.Extensions; +using Roslyn.Utilities; + +namespace Microsoft.CodeAnalysis.AddFileBanner +{ + internal abstract class AbstractAddFileBannerCodeRefactoringProvider : CodeRefactoringProvider + { + protected abstract bool IsCommentStartCharacter(char ch); + + public override async Task ComputeRefactoringsAsync(CodeRefactoringContext context) + { + var cancellationToken = context.CancellationToken; + var document = context.Document; + + if (!context.Span.IsEmpty) + { + return; + } + + var position = context.Span.Start; + var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); + + var firstToken = root.GetFirstToken(); + if (!firstToken.FullSpan.IntersectsWith(position)) + { + return; + } + + var syntaxFacts = document.GetLanguageService(); + var banner = syntaxFacts.GetFileBanner(root); + + if (banner.Length > 0) + { + // Already has a banner. + return; + } + + // Process the other documents in this document's project. Look at the + // ones that we can get a root from (without having to parse). Then + // look at the ones we'd need to parse. + var siblingDocumentsAndRoots = + document.Project.Documents + .Where(d => d != document) + .Select(d => + { + d.TryGetSyntaxRoot(out var siblingRoot); + return (document: d, root: siblingRoot); + }) + .OrderBy((t1, t2) => (t1.root != null) == (t2.root != null) ? 0 : t1.root != null ? -1 : 1); + + foreach (var (siblingDocument, siblingRoot) in siblingDocumentsAndRoots) + { + var siblingBanner = await TryGetBannerAsync(siblingDocument, siblingRoot, cancellationToken).ConfigureAwait(false); + if (siblingBanner.Length > 0 && !siblingDocument.IsGeneratedCode(cancellationToken)) + { + context.RegisterRefactoring( + new MyCodeAction(c => AddBannerAsync(document, root, siblingBanner, c))); + return; + } + } + } + + private Task AddBannerAsync( + Document document, SyntaxNode root, ImmutableArray banner, CancellationToken c) + { + var newRoot = root.WithPrependedLeadingTrivia(new SyntaxTriviaList(banner)); + return Task.FromResult(document.WithSyntaxRoot(newRoot)); + } + + private async Task> TryGetBannerAsync( + Document document, SyntaxNode root, CancellationToken cancellationToken) + { + var syntaxFacts = document.GetLanguageService(); + + // If we have a tree already for this document, then just check to see + // if it has a banner. + if (root != null) + { + return syntaxFacts.GetFileBanner(root); + } + + // Didn't have a tree. Don't want to parse the file if we can avoid it. + var text = await document.GetTextAsync(cancellationToken).ConfigureAwait(false); + if (text.Length == 0 || !IsCommentStartCharacter(text[0])) + { + // Didn't start with a comment character, don't bother looking at + // this file. + return ImmutableArray.Empty; + } + + var token = syntaxFacts.ParseToken(text.ToString()); + return syntaxFacts.GetFileBanner(token); + } + + private class MyCodeAction : CodeAction.DocumentChangeAction + { + public MyCodeAction(Func> createChangedDocument) + : base(FeaturesResources.Add_file_banner, createChangedDocument) + { + } + } + } +} diff --git a/src/Features/Core/Portable/FeaturesResources.Designer.cs b/src/Features/Core/Portable/FeaturesResources.Designer.cs index 370bba7d7ad4b..b51f74a48943d 100644 --- a/src/Features/Core/Portable/FeaturesResources.Designer.cs +++ b/src/Features/Core/Portable/FeaturesResources.Designer.cs @@ -161,6 +161,15 @@ internal static string Add_document_0 { } } + /// + /// Looks up a localized string similar to Add file banner. + /// + internal static string Add_file_banner { + get { + return ResourceManager.GetString("Add_file_banner", resourceCulture); + } + } + /// /// Looks up a localized string similar to Add missing cases. /// diff --git a/src/Features/Core/Portable/FeaturesResources.resx b/src/Features/Core/Portable/FeaturesResources.resx index ae2e8df26dbf7..6828538ccdbc3 100644 --- a/src/Features/Core/Portable/FeaturesResources.resx +++ b/src/Features/Core/Portable/FeaturesResources.resx @@ -1295,4 +1295,7 @@ This version used in: {2} Generate constructor in '{0}' (without fields) + + Add file banner + \ No newline at end of file diff --git a/src/Features/VisualBasic/Portable/AddFileBanner/VisualBasicAddFileBannerCodeRefactoringProvider.vb b/src/Features/VisualBasic/Portable/AddFileBanner/VisualBasicAddFileBannerCodeRefactoringProvider.vb new file mode 100644 index 0000000000000..d8c1929abb574 --- /dev/null +++ b/src/Features/VisualBasic/Portable/AddFileBanner/VisualBasicAddFileBannerCodeRefactoringProvider.vb @@ -0,0 +1,16 @@ +' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +Imports System.Composition +Imports Microsoft.CodeAnalysis.AddFileBanner +Imports Microsoft.CodeAnalysis.CodeRefactorings + +Namespace Microsoft.CodeAnalysis.VisualBasic.AddFileBanner + + Friend Class VisualBasicAddFileBannerCodeRefactoringProvider + Inherits AbstractAddFileBannerCodeRefactoringProvider + + Protected Overrides Function IsCommentStartCharacter(ch As Char) As Boolean + Return ch = "'"c + End Function + End Class +End Namespace diff --git a/src/Workspaces/CSharp/Portable/LanguageServices/CSharpSyntaxFactsService.cs b/src/Workspaces/CSharp/Portable/LanguageServices/CSharpSyntaxFactsService.cs index e1ebf40f3ad55..f04663fd044a1 100644 --- a/src/Workspaces/CSharp/Portable/LanguageServices/CSharpSyntaxFactsService.cs +++ b/src/Workspaces/CSharp/Portable/LanguageServices/CSharpSyntaxFactsService.cs @@ -45,6 +45,9 @@ public bool SupportsIndexingInitializer(ParseOptions options) public bool SupportsThrowExpression(ParseOptions options) => ((CSharpParseOptions)options).LanguageVersion >= LanguageVersion.CSharp7; + public SyntaxToken ParseToken(string text) + => SyntaxFactory.ParseToken(text); + public bool IsAwaitKeyword(SyntaxToken token) { return token.IsKind(SyntaxKind.AwaitKeyword); diff --git a/src/Workspaces/Core/Portable/LanguageServices/SyntaxFactsService/AbstractSyntaxFactsService.cs b/src/Workspaces/Core/Portable/LanguageServices/SyntaxFactsService/AbstractSyntaxFactsService.cs index eb5b77ff73d43..04b1b8a5765a5 100644 --- a/src/Workspaces/Core/Portable/LanguageServices/SyntaxFactsService/AbstractSyntaxFactsService.cs +++ b/src/Workspaces/Core/Portable/LanguageServices/SyntaxFactsService/AbstractSyntaxFactsService.cs @@ -373,8 +373,14 @@ public TSyntaxNode GetNodeWithoutLeadingBannerAndPreprocessorDirectives GetFileBanner(SyntaxNode root) { Debug.Assert(root.FullSpan.Start == 0); + return GetFileBanner(root.GetFirstToken(includeZeroWidth: true)); + } + + public ImmutableArray GetFileBanner(SyntaxToken firstToken) + { + Debug.Assert(firstToken.FullSpan.Start == 0); - var leadingTrivia = root.GetLeadingTrivia(); + var leadingTrivia = firstToken.LeadingTrivia; var index = 0; _fileBannerMatcher.TryMatch(leadingTrivia.ToList(), ref index); diff --git a/src/Workspaces/Core/Portable/LanguageServices/SyntaxFactsService/ISyntaxFactsService.cs b/src/Workspaces/Core/Portable/LanguageServices/SyntaxFactsService/ISyntaxFactsService.cs index 2b34bbeaf934d..12509240dfb1d 100644 --- a/src/Workspaces/Core/Portable/LanguageServices/SyntaxFactsService/ISyntaxFactsService.cs +++ b/src/Workspaces/Core/Portable/LanguageServices/SyntaxFactsService/ISyntaxFactsService.cs @@ -19,6 +19,8 @@ internal interface ISyntaxFactsService : ILanguageService bool SupportsIndexingInitializer(ParseOptions options); bool SupportsThrowExpression(ParseOptions options); + SyntaxToken ParseToken(string text); + bool IsAwaitKeyword(SyntaxToken token); bool IsIdentifier(SyntaxToken token); bool IsGlobalNamespaceKeyword(SyntaxToken token); @@ -303,6 +305,7 @@ void AddFirstMissingCloseBrace( TSyntaxNode GetNodeWithoutLeadingBlankLines(TSyntaxNode node) where TSyntaxNode : SyntaxNode; ImmutableArray GetFileBanner(SyntaxNode root); + ImmutableArray GetFileBanner(SyntaxToken firstToken); bool ContainsInterleavedDirective(SyntaxNode node, CancellationToken cancellationToken); bool ContainsInterleavedDirective(ImmutableArray nodes, CancellationToken cancellationToken); diff --git a/src/Workspaces/VisualBasic/Portable/LanguageServices/VisualBasicSyntaxFactsService.vb b/src/Workspaces/VisualBasic/Portable/LanguageServices/VisualBasicSyntaxFactsService.vb index 0ad08fd1fed74..fa35376af377c 100644 --- a/src/Workspaces/VisualBasic/Portable/LanguageServices/VisualBasicSyntaxFactsService.vb +++ b/src/Workspaces/VisualBasic/Portable/LanguageServices/VisualBasicSyntaxFactsService.vb @@ -66,6 +66,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Return False End Function + Public Function ParseToken(text As String) As SyntaxToken Implements ISyntaxFactsService.ParseToken + Return SyntaxFactory.ParseToken(text, startStatement:=True) + End Function + Public Function IsAwaitKeyword(token As SyntaxToken) As Boolean Implements ISyntaxFactsService.IsAwaitKeyword Return token.Kind = SyntaxKind.AwaitKeyword End Function @@ -1586,6 +1590,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Return GetFileBanner(root) End Function + Private Function ISyntaxFactsService_GetFileBanner(firstToken As SyntaxToken) As ImmutableArray(Of SyntaxTrivia) Implements ISyntaxFactsService.GetFileBanner + Return GetFileBanner(firstToken) + End Function + Protected Overrides Function ContainsInterleavedDirective(span As TextSpan, token As SyntaxToken, cancellationToken As CancellationToken) As Boolean Return token.ContainsInterleavedDirective(span, cancellationToken) End Function From 6535888e8cbf66c021dc093545d288f1db5bed09 Mon Sep 17 00:00:00 2001 From: CyrusNajmabadi Date: Sat, 29 Jul 2017 19:58:00 -0700 Subject: [PATCH 069/205] Add VB tests. --- .../AddFileBanner/AddFileBannerTests.vb | 175 ++++++++++++++++++ 1 file changed, 175 insertions(+) create mode 100644 src/EditorFeatures/VisualBasicTest/AddFileBanner/AddFileBannerTests.vb diff --git a/src/EditorFeatures/VisualBasicTest/AddFileBanner/AddFileBannerTests.vb b/src/EditorFeatures/VisualBasicTest/AddFileBanner/AddFileBannerTests.vb new file mode 100644 index 0000000000000..aacc1b16d022b --- /dev/null +++ b/src/EditorFeatures/VisualBasicTest/AddFileBanner/AddFileBannerTests.vb @@ -0,0 +1,175 @@ +' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +Imports System.Threading.Tasks +Imports Microsoft.CodeAnalysis.CodeRefactorings +Imports Microsoft.CodeAnalysis.VisualBasic.AddFileBanner +Imports Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.CodeRefactorings +Imports Roslyn.Test.Utilities +Imports Xunit + +Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.AddFileBanner + Partial Public Class AddFileBannerTests + Inherits AbstractVisualBasicCodeActionTest + + Protected Overrides Function CreateCodeRefactoringProvider(workspace As Workspace, parameters As TestParameters) As CodeRefactoringProvider + Return New VisualBasicAddFileBannerCodeRefactoringProvider() + End Function + + + Public Async Function TestBanner1() As Task + Await TestInRegularAndScriptAsync( +" + + + [||]Imports System + +class Program1 + sub Main() + end sub +end class + + ' This is the banner + +class Program2 +end class + + +", +" + + + ' This is the banner + +Imports System + +class Program1 + sub Main() + end sub +end class + + ' This is the banner + +class Program2 +end class + + +", ignoreTrivia:=False) + End Function + + + Public Async Function TestMultiLineBanner1() As Task + Await TestInRegularAndScriptAsync( +" + + + [||]Imports System + +class Program1 + sub Main() + end sub +end class + + ' This is the banner +' It goes over multiple lines + +class Program2 +end class + + +", +" + + + ' This is the banner +' It goes over multiple lines + +Imports System + +class Program1 + sub Main() + end sub +end class + + ' This is the banner +' It goes over multiple lines + +class Program2 +end class + + +", ignoreTrivia:=False) + End Function + + + Public Async Function TestMissingWhenAlreadyThere() As Task + Await TestMissingAsync( +" + + + [||]' I already have a banner + +Imports System + +class Program1 + sub Main() + end sub +end class + + ' This is the banner + +class Program2 +end class + + +") + End Function + + + Public Async Function TestMissingIfOtherFileDoesNotHaveBanner() As Task + Await TestMissingAsync( +" + + + [||] + +Imports System + +class Program1 + sub Main() + end sub +end class + + + +class Program2 +end class + + +") + End Function + + + Public Async Function TestMissingIfOtherFileIsAutoGenerated() As Task + Await TestMissingAsync( +" + + + [||] + +Imports System + +class Program1 + sub Main() + end sub +end class + + ' <autogenerated /> + +class Program2 +end class + + +") + End Function + End Class +End Namespace From d508c23f09da448d098e14c6356a6d6d2706664c Mon Sep 17 00:00:00 2001 From: Charles Stoner Date: Mon, 31 Jul 2017 07:46:43 -0700 Subject: [PATCH 070/205] Fix possible null reference warnings --- .../Portable/Binder/Binder_Expressions.cs | 2 +- .../CSharp/Portable/Binder/Binder_Query.cs | 2 +- .../Portable/Binder/Binder_QueryErrors.cs | 4 +-- .../Portable/FlowAnalysis/ExitPointsWalker.cs | 6 ++--- .../Lowering/DiagnosticsPass_Warnings.cs | 20 +++++++------- .../IteratorRewriter/IteratorRewriter.cs | 2 +- .../Lowering/SyntheticBoundNodeFactory.cs | 26 +++++++------------ .../Symbols/Source/SourceNamespaceSymbol.cs | 3 +-- .../Syntax/CSharpPragmaWarningStateMap.cs | 6 ++--- 9 files changed, 32 insertions(+), 39 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs index 75465b1b43517..5cb5f204b7b1e 100644 --- a/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs +++ b/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs @@ -3627,7 +3627,7 @@ private BoundExpression BindDelegateCreationExpression(ObjectCreationExpressionS // 4. A delegate type. else if (argument.Type.TypeKind == TypeKind.Delegate) { - var sourceDelegate = argument.Type as NamedTypeSymbol; + var sourceDelegate = (NamedTypeSymbol)argument.Type; MethodGroup methodGroup = MethodGroup.GetInstance(); try { diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Query.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Query.cs index eaa7cddcfeea0..569cea3042685 100644 --- a/src/Compilers/CSharp/Portable/Binder/Binder_Query.cs +++ b/src/Compilers/CSharp/Portable/Binder/Binder_Query.cs @@ -298,7 +298,7 @@ private void ReduceJoin(JoinClauseSyntax join, QueryTranslationState state, Diag if (state.clauses.IsEmpty() && state.selectOrGroup.Kind() == SyntaxKind.SelectClause) { - var select = state.selectOrGroup as SelectClauseSyntax; + var select = (SelectClauseSyntax)state.selectOrGroup; BoundCall invocation; if (join.Into == null) { diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_QueryErrors.cs b/src/Compilers/CSharp/Portable/Binder/Binder_QueryErrors.cs index c572d31ea1645..e35c683f11bcf 100644 --- a/src/Compilers/CSharp/Portable/Binder/Binder_QueryErrors.cs +++ b/src/Compilers/CSharp/Portable/Binder/Binder_QueryErrors.cs @@ -133,7 +133,7 @@ private static bool IsJoinRangeVariableInLeftKey(SimpleNameSyntax node) { if (parent.Kind() == SyntaxKind.JoinClause) { - var join = parent as JoinClauseSyntax; + var join = (JoinClauseSyntax)parent; if (join.LeftExpression.Span.Contains(node.Span) && join.Identifier.ValueText == node.Identifier.ValueText) return true; } } @@ -149,7 +149,7 @@ private static bool IsInJoinRightKey(SimpleNameSyntax node) { if (parent.Kind() == SyntaxKind.JoinClause) { - var join = parent as JoinClauseSyntax; + var join = (JoinClauseSyntax)parent; if (join.RightExpression.Span.Contains(node.Span)) return true; } } diff --git a/src/Compilers/CSharp/Portable/FlowAnalysis/ExitPointsWalker.cs b/src/Compilers/CSharp/Portable/FlowAnalysis/ExitPointsWalker.cs index 62a795d91cbbc..a3da2ef30d924 100644 --- a/src/Compilers/CSharp/Portable/FlowAnalysis/ExitPointsWalker.cs +++ b/src/Compilers/CSharp/Portable/FlowAnalysis/ExitPointsWalker.cs @@ -127,13 +127,13 @@ override protected void LeaveRegion() switch (pending.Branch.Kind) { case BoundKind.GotoStatement: - if (_labelsInside.Contains(((pending.Branch) as BoundGotoStatement).Label)) continue; + if (_labelsInside.Contains(((BoundGotoStatement)pending.Branch).Label)) continue; break; case BoundKind.BreakStatement: - if (_labelsInside.Contains(((pending.Branch) as BoundBreakStatement).Label)) continue; + if (_labelsInside.Contains(((BoundBreakStatement)pending.Branch).Label)) continue; break; case BoundKind.ContinueStatement: - if (_labelsInside.Contains(((pending.Branch) as BoundContinueStatement).Label)) continue; + if (_labelsInside.Contains(((BoundContinueStatement)pending.Branch).Label)) continue; break; case BoundKind.YieldBreakStatement: case BoundKind.ReturnStatement: diff --git a/src/Compilers/CSharp/Portable/Lowering/DiagnosticsPass_Warnings.cs b/src/Compilers/CSharp/Portable/Lowering/DiagnosticsPass_Warnings.cs index 60a1c5084f49d..ff7d8fbb449c8 100644 --- a/src/Compilers/CSharp/Portable/Lowering/DiagnosticsPass_Warnings.cs +++ b/src/Compilers/CSharp/Portable/Lowering/DiagnosticsPass_Warnings.cs @@ -197,26 +197,26 @@ private static bool IsSameLocalOrField(BoundExpression expr1, BoundExpression ex switch (expr1.Kind) { case BoundKind.Local: - var local1 = expr1 as BoundLocal; - var local2 = expr2 as BoundLocal; + var local1 = (BoundLocal)expr1; + var local2 = (BoundLocal)expr2; return local1.LocalSymbol == local2.LocalSymbol; case BoundKind.FieldAccess: - var field1 = expr1 as BoundFieldAccess; - var field2 = expr2 as BoundFieldAccess; + var field1 = (BoundFieldAccess)expr1; + var field2 = (BoundFieldAccess)expr2; return field1.FieldSymbol == field2.FieldSymbol && (field1.FieldSymbol.IsStatic || IsSameLocalOrField(field1.ReceiverOpt, field2.ReceiverOpt)); case BoundKind.EventAccess: - var event1 = expr1 as BoundEventAccess; - var event2 = expr2 as BoundEventAccess; + var event1 = (BoundEventAccess)expr1; + var event2 = (BoundEventAccess)expr2; return event1.EventSymbol == event2.EventSymbol && (event1.EventSymbol.IsStatic || IsSameLocalOrField(event1.ReceiverOpt, event2.ReceiverOpt)); case BoundKind.Parameter: - var param1 = expr1 as BoundParameter; - var param2 = expr2 as BoundParameter; + var param1 = (BoundParameter)expr1; + var param2 = (BoundParameter)expr2; return param1.ParameterSymbol == param2.ParameterSymbol; case BoundKind.RangeVariable: - var rangeVar1 = expr1 as BoundRangeVariable; - var rangeVar2 = expr2 as BoundRangeVariable; + var rangeVar1 = (BoundRangeVariable)expr1; + var rangeVar2 = (BoundRangeVariable)expr2; return rangeVar1.RangeVariableSymbol == rangeVar2.RangeVariableSymbol; case BoundKind.ThisReference: case BoundKind.PreviousSubmissionReference: diff --git a/src/Compilers/CSharp/Portable/Lowering/IteratorRewriter/IteratorRewriter.cs b/src/Compilers/CSharp/Portable/Lowering/IteratorRewriter/IteratorRewriter.cs index ca99d9de6f630..32b7a2c671bd8 100644 --- a/src/Compilers/CSharp/Portable/Lowering/IteratorRewriter/IteratorRewriter.cs +++ b/src/Compilers/CSharp/Portable/Lowering/IteratorRewriter/IteratorRewriter.cs @@ -172,7 +172,7 @@ protected override void GenerateControlFields() // Add a field: T current _currentField = F.StateMachineField(_elementType, GeneratedNames.MakeIteratorCurrentFieldName()); - // if it is an enumerable, and either Environment.CurrentManagedThreadId or System.Thread are available + // if it is an enumerable, and either Environment.CurrentManagedThreadId or Thread.ManagedThreadId are available // add a field: int initialThreadId bool addInitialThreadId = _isEnumerable && diff --git a/src/Compilers/CSharp/Portable/Lowering/SyntheticBoundNodeFactory.cs b/src/Compilers/CSharp/Portable/Lowering/SyntheticBoundNodeFactory.cs index 39b2ce911f909..1c3becde5b662 100644 --- a/src/Compilers/CSharp/Portable/Lowering/SyntheticBoundNodeFactory.cs +++ b/src/Compilers/CSharp/Portable/Lowering/SyntheticBoundNodeFactory.cs @@ -269,28 +269,22 @@ public BoundFieldAccess Field(BoundExpression receiver, FieldSymbol f) public BoundExpression Property(WellKnownMember member) { - var propertySym = WellKnownMember(member) as PropertySymbol; - //if (propertySym == null) return BoundBadExpression - Binder.ReportUseSiteDiagnostics(propertySym, Diagnostics, Syntax); - Debug.Assert(propertySym.IsStatic); - return Call(null, propertySym.GetMethod); + return Property(null, member); } - public BoundExpression Property(BoundExpression receiver, WellKnownMember member) + public BoundExpression Property(BoundExpression receiverOpt, WellKnownMember member) { - var propertySym = WellKnownMember(member) as PropertySymbol; - Debug.Assert(!propertySym.IsStatic); - Debug.Assert(receiver.Type.GetMembers(propertySym.Name).OfType().Single() == propertySym); - //if (propertySym == null) return BoundBadExpression + var propertySym = (PropertySymbol)WellKnownMember(member); + Debug.Assert(receiverOpt == null || + receiverOpt.Type.GetMembers(propertySym.Name).OfType().Single() == propertySym); Binder.ReportUseSiteDiagnostics(propertySym, Diagnostics, Syntax); - Debug.Assert(!propertySym.IsStatic); - return Call(receiver, propertySym.GetMethod); + return Property(receiverOpt, propertySym); } - public BoundExpression Property(BoundExpression receiver, PropertySymbol property) + public BoundExpression Property(BoundExpression receiverOpt, PropertySymbol property) { - Debug.Assert(!property.IsStatic); - return Call(receiver, property.GetMethod); // TODO: should we use property.GetBaseProperty().GetMethod to ensure we generate a call to the overridden method? + Debug.Assert((receiverOpt == null) == property.IsStatic); + return Call(receiverOpt, property.GetMethod); // TODO: should we use property.GetBaseProperty().GetMethod to ensure we generate a call to the overridden method? } public NamedTypeSymbol SpecialType(SpecialType st) @@ -601,7 +595,7 @@ public BoundExpression StaticCall(TypeSymbol receiver, MethodSymbol method, para { if ((object)method == null) { - return new BoundBadExpression(Syntax, default(LookupResultKind), ImmutableArray.Empty, args.AsImmutableOrNull(), receiver); + return new BoundBadExpression(Syntax, default(LookupResultKind), ImmutableArray.Empty, args.AsImmutable(), receiver); } return Call(null, method, args); diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourceNamespaceSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourceNamespaceSymbol.cs index e7526be75b2ad..cd7dfe53f0b49 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Source/SourceNamespaceSymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourceNamespaceSymbol.cs @@ -374,8 +374,7 @@ private Dictionary> MakeNameToMemb if ((object)other != null) { - if (nts is SourceNamedTypeSymbol && other is SourceNamedTypeSymbol && - (nts as SourceNamedTypeSymbol).IsPartial && (other as SourceNamedTypeSymbol).IsPartial) + if ((nts as SourceNamedTypeSymbol)?.IsPartial == true && (other as SourceNamedTypeSymbol)?.IsPartial == true) { diagnostics.Add(ErrorCode.ERR_PartialTypeKindConflict, symbol.Locations[0], symbol); } diff --git a/src/Compilers/CSharp/Portable/Syntax/CSharpPragmaWarningStateMap.cs b/src/Compilers/CSharp/Portable/Syntax/CSharpPragmaWarningStateMap.cs index 5508837fe7920..c7c536c7f5318 100644 --- a/src/Compilers/CSharp/Portable/Syntax/CSharpPragmaWarningStateMap.cs +++ b/src/Compilers/CSharp/Portable/Syntax/CSharpPragmaWarningStateMap.cs @@ -31,7 +31,7 @@ private static void GetAllPragmaWarningDirectives(SyntaxTree syntaxTree, ArrayBu { if (d.Kind() == SyntaxKind.PragmaWarningDirectiveTrivia) { - var w = d as PragmaWarningDirectiveTriviaSyntax; + var w = (PragmaWarningDirectiveTriviaSyntax)d; // Ignore directives with errors (i.e., Unrecognized #pragma directive) and // directives inside disabled code (by #if and #endif) @@ -83,12 +83,12 @@ private static WarningStateMapEntry[] CreatePragmaWarningStateEntries(ImmutableA var errorId = string.Empty; if (currentErrorCode.Kind() == SyntaxKind.NumericLiteralExpression) { - var token = (currentErrorCode as LiteralExpressionSyntax).Token; + var token = ((LiteralExpressionSyntax)currentErrorCode).Token; errorId = MessageProvider.Instance.GetIdForErrorCode((int)token.Value); } else if (currentErrorCode.Kind() == SyntaxKind.IdentifierName) { - errorId = (currentErrorCode as IdentifierNameSyntax).Identifier.ValueText; + errorId = ((IdentifierNameSyntax)currentErrorCode).Identifier.ValueText; } if (!string.IsNullOrWhiteSpace(errorId)) From a7d341c620ef71e3d992cb300af94f0073a0575d Mon Sep 17 00:00:00 2001 From: Jared Parsons Date: Mon, 31 Jul 2017 09:30:33 -0700 Subject: [PATCH 071/205] Fix build correctness issues --- Compilers.sln | 7 ------- CrossPlatform.sln | 7 ------- 2 files changed, 14 deletions(-) diff --git a/Compilers.sln b/Compilers.sln index d60ca6d0d5602..6de7fab9a8500 100644 --- a/Compilers.sln +++ b/Compilers.sln @@ -93,8 +93,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RunTests", "src\Tools\Sourc EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CSharpCompilerTestUtilities.Desktop", "src\Compilers\Test\Utilities\CSharp.Desktop\CSharpCompilerTestUtilities.Desktop.csproj", "{7A4B2176-7BFD-4B75-A61A-E25A1FDD0A1E}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DeployDesktopTestRuntime", "src\Test\DeployDesktopTestRuntime\DeployDesktopTestRuntime.csproj", "{23683607-168A-4189-955E-908F0E80E60D}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestUtilities", "src\Test\Utilities\Portable\TestUtilities.csproj", "{CCBD3438-3E84-40A9-83AD-533F23BCFCA5}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DeployCompilerGeneratorToolsRuntime", "src\Tools\Source\CompilerGeneratorTools\DeployCompilerGeneratorToolsRuntime\DeployCompilerGeneratorToolsRuntime.csproj", "{6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B}" @@ -331,10 +329,6 @@ Global {7A4B2176-7BFD-4B75-A61A-E25A1FDD0A1E}.Debug|Any CPU.Build.0 = Debug|Any CPU {7A4B2176-7BFD-4B75-A61A-E25A1FDD0A1E}.Release|Any CPU.ActiveCfg = Release|Any CPU {7A4B2176-7BFD-4B75-A61A-E25A1FDD0A1E}.Release|Any CPU.Build.0 = Release|Any CPU - {23683607-168A-4189-955E-908F0E80E60D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {23683607-168A-4189-955E-908F0E80E60D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {23683607-168A-4189-955E-908F0E80E60D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {23683607-168A-4189-955E-908F0E80E60D}.Release|Any CPU.Build.0 = Release|Any CPU {CCBD3438-3E84-40A9-83AD-533F23BCFCA5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CCBD3438-3E84-40A9-83AD-533F23BCFCA5}.Debug|Any CPU.Build.0 = Debug|Any CPU {CCBD3438-3E84-40A9-83AD-533F23BCFCA5}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -479,7 +473,6 @@ Global {59BABFC3-C19B-4472-A93D-3DD3835BC219} = {6F016299-BA96-45BA-9BFF-6C0793979177} {1A3941F1-1E1F-4EF7-8064-7729C4C2E2AA} = {6F016299-BA96-45BA-9BFF-6C0793979177} {7A4B2176-7BFD-4B75-A61A-E25A1FDD0A1E} = {32A48625-F0AD-419D-828B-A50BDABA38EA} - {23683607-168A-4189-955E-908F0E80E60D} = {6F016299-BA96-45BA-9BFF-6C0793979177} {CCBD3438-3E84-40A9-83AD-533F23BCFCA5} = {6F016299-BA96-45BA-9BFF-6C0793979177} {6DA08F12-32F2-4DD9-BBAD-982EB71A2C9B} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} {C1930979-C824-496B-A630-70F5369A636F} = {3CDEA9FB-CD44-4AB4-98A8-5537AAA2169B} diff --git a/CrossPlatform.sln b/CrossPlatform.sln index c5b076db9d040..4460a2cf7f40a 100644 --- a/CrossPlatform.sln +++ b/CrossPlatform.sln @@ -73,8 +73,6 @@ Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "BasicScripting", "src\Scrip EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CSharpScriptingTest", "src\Scripting\CSharpTest\CSharpScriptingTest.csproj", "{2DAE4406-7A89-4B5F-95C3-BC5422CE47CE}" EndProject -Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "BasicScriptingTest", "src\Scripting\VisualBasicTest\BasicScriptingTest.vbproj", "{ABC7262E-1053-49F3-B846-E3091BB92E8C}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Dependencies", "Dependencies", "{A18BACE1-BB66-4156-8E89-81429A5814C6}" EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Microsoft.CodeAnalysis.Debugging", "src\Dependencies\CodeAnalysis.Debugging\Microsoft.CodeAnalysis.Debugging.shproj", "{D73ADF7D-2C1C-42AE-B2AB-EDC9497E4B71}" @@ -242,10 +240,6 @@ Global {2DAE4406-7A89-4B5F-95C3-BC5422CE47CE}.Debug|Any CPU.Build.0 = Debug|Any CPU {2DAE4406-7A89-4B5F-95C3-BC5422CE47CE}.Release|Any CPU.ActiveCfg = Release|Any CPU {2DAE4406-7A89-4B5F-95C3-BC5422CE47CE}.Release|Any CPU.Build.0 = Release|Any CPU - {ABC7262E-1053-49F3-B846-E3091BB92E8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {ABC7262E-1053-49F3-B846-E3091BB92E8C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {ABC7262E-1053-49F3-B846-E3091BB92E8C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {ABC7262E-1053-49F3-B846-E3091BB92E8C}.Release|Any CPU.Build.0 = Release|Any CPU {7AD4FE65-9A30-41A6-8004-AA8F89BCB7F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7AD4FE65-9A30-41A6-8004-AA8F89BCB7F3}.Debug|Any CPU.Build.0 = Debug|Any CPU {7AD4FE65-9A30-41A6-8004-AA8F89BCB7F3}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -341,7 +335,6 @@ Global {066F0DBD-C46C-4C20-AFEC-99829A172625} = {A6F70573-57FE-49F9-A26C-75B8D202B795} {3E7DEA65-317B-4F43-A25D-62F18D96CFD7} = {A6F70573-57FE-49F9-A26C-75B8D202B795} {2DAE4406-7A89-4B5F-95C3-BC5422CE47CE} = {A6F70573-57FE-49F9-A26C-75B8D202B795} - {ABC7262E-1053-49F3-B846-E3091BB92E8C} = {A6F70573-57FE-49F9-A26C-75B8D202B795} {D73ADF7D-2C1C-42AE-B2AB-EDC9497E4B71} = {A18BACE1-BB66-4156-8E89-81429A5814C6} {C1930979-C824-496B-A630-70F5369A636F} = {A18BACE1-BB66-4156-8E89-81429A5814C6} {7AD4FE65-9A30-41A6-8004-AA8F89BCB7F3} = {A41D1B99-F489-4C43-BBDF-96D61B19A6B9} From 8f5336fb1cef6f6525420e4f999caae33499d5c1 Mon Sep 17 00:00:00 2001 From: Jared Parsons Date: Wed, 26 Jul 2017 13:15:37 -0700 Subject: [PATCH 072/205] Restrict discovered VS versions Restrict the versions of VS we discover to those which meet our minimal MSBuild requirements for Roslyn. --- build/scripts/build-utils.ps1 | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/build/scripts/build-utils.ps1 b/build/scripts/build-utils.ps1 index c0882b07769a3..a377c034501c9 100644 --- a/build/scripts/build-utils.ps1 +++ b/build/scripts/build-utils.ps1 @@ -215,10 +215,10 @@ function Get-PackageDir([string]$name, [string]$version = "") { # The intent of this script is to locate and return the path to the MSBuild directory that # we should use for bulid operations. The preference order for MSBuild to use is as -# follows +# follows: # # 1. MSBuild from an active VS command prompt -# 2. MSBuild from a machine wide VS install +# 2. MSBuild from a compatible VS installation # 3. MSBuild from the xcopy toolset # # This function will return two values: the kind of MSBuild chosen and the MSBuild directory. @@ -232,9 +232,6 @@ function Get-MSBuildKindAndDir([switch]$xcopy = $false) { # MSBuild from an active VS command prompt. if (${env:VSINSTALLDIR} -ne $null) { - - # This line deliberately avoids using -ErrorAction. Inside a VS command prompt - # an MSBuild command should always be available. $command = (Get-Command msbuild -ErrorAction SilentlyContinue) if ($command -ne $null) { $p = Split-Path -parent $command.Path @@ -278,14 +275,29 @@ function Get-MSBuildDir([switch]$xcopy = $false) { # meets our minimal requirements for the Roslyn repo. function Get-VisualStudioDirAndId() { $vswhere = Join-Path (Ensure-BasicTool "vswhere") "tools\vswhere.exe" - $output = & $vswhere -requires Microsoft.Component.MSBuild -format json | Out-String - if (-not $?) { - throw "Could not locate a valid Visual Studio" + $output = Exec-Command $vswhere "-requires Microsoft.Component.MSBuild -format json" | Out-String + $j = ConvertFrom-Json $output + foreach ($obj in $j) { + + # Need to be using at least Visual Studio 15.2 in order to have the appropriate + # set of SDK fixes. Parsing the installationName is the only place where this is + # recorded in that form. + $name = $obj.installationName + if ($name -match "VisualStudio/([\d.]+)\+.*") { + $minVersion = New-Object System.Version "15.1.0" + $version = New-Object System.Version $matches[1] + if ($version -ge $minVersion) { + Write-Output $obj.installationPath + Write-Output $obj.instanceId + return + } + } + else { + Write-Host "Unrecognized installationName format $name" + } } - $j = ConvertFrom-Json $output - Write-Output $j[0].installationPath - Write-Output $j[0].instanceId + throw "Could not find a suitable Visual Studio Version" } # Get the directory of the first Visual Studio which meets our minimal From cfb19ce4616c5b573ab82ded92b3a8add3f0b81a Mon Sep 17 00:00:00 2001 From: Jared Parsons Date: Wed, 26 Jul 2017 16:29:13 -0700 Subject: [PATCH 073/205] Enforce minimum MSBuild version The Roslyn build depends on having a minimum of MSBuild 15.1 in order to function. Anything less than that will fail with very crpytic errors, usually around NuGet runtime identifiers. This change causes our build to declaratively fail with a very specific message if the wrong version of MSBuild is used. It should help point customers in the right direction to fixing up the problem. Note: This was made to be parameterized in Imports.targets because very soon it will be changing to depend on 15.3. --- build/Targets/Imports.targets | 8 + build/Targets/Packages.props | 2 +- build/Targets/Settings.props | 5 +- .../BuildUtil/BuildUtil/BuildUtil.csproj | 2 +- .../BuildUtil/BuildUtil/BuildUtil.nuspec | 4 +- .../BuildUtil/ValidateBuildEnvironment.cs | 53 +++++ .../BuildUtil/WriteCodeFragmentEx.cs | 186 ------------------ 7 files changed, 69 insertions(+), 191 deletions(-) create mode 100644 src/Tools/BuildUtil/BuildUtil/ValidateBuildEnvironment.cs delete mode 100644 src/Tools/BuildUtil/BuildUtil/WriteCodeFragmentEx.cs diff --git a/build/Targets/Imports.targets b/build/Targets/Imports.targets index e023fabe73946..d50b069d4ab3e 100644 --- a/build/Targets/Imports.targets +++ b/build/Targets/Imports.targets @@ -492,6 +492,14 @@ + + + + diff --git a/src/Tools/BuildUtil/BuildUtil/BuildUtil.csproj b/src/Tools/BuildUtil/BuildUtil/BuildUtil.csproj index 21dd52729fdee..594ab96008523 100644 --- a/src/Tools/BuildUtil/BuildUtil/BuildUtil.csproj +++ b/src/Tools/BuildUtil/BuildUtil/BuildUtil.csproj @@ -9,7 +9,7 @@ Library Roslyn.MSBuild.Util Roslyn.MSBuild.Util - netstandard1.3 + net46 Key.snk diff --git a/src/Tools/BuildUtil/BuildUtil/BuildUtil.nuspec b/src/Tools/BuildUtil/BuildUtil/BuildUtil.nuspec index 61df68d4c6e5e..df846ef28477c 100644 --- a/src/Tools/BuildUtil/BuildUtil/BuildUtil.nuspec +++ b/src/Tools/BuildUtil/BuildUtil/BuildUtil.nuspec @@ -2,7 +2,7 @@ Roslyn.Build.Util - 0.9.6-beta + 0.9.7-beta Roslyn.Build.Util RoslynTeam RoslynTeam @@ -12,6 +12,6 @@ Provides a number of small tasks used in the Roslyn build process. - + diff --git a/src/Tools/BuildUtil/BuildUtil/ValidateBuildEnvironment.cs b/src/Tools/BuildUtil/BuildUtil/ValidateBuildEnvironment.cs new file mode 100644 index 0000000000000..d79aaa999a00e --- /dev/null +++ b/src/Tools/BuildUtil/BuildUtil/ValidateBuildEnvironment.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Text; +using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; + +namespace Roslyn.MSBuild.Util +{ + public sealed class ValidateBuildEnvironment : Task + { + [Required] + public string MSBuildBinPath { get; set; } + + /// + /// The minimum file version for MSBuild.exe. The task will fail if the MSBuild version exceeds + /// this value. + /// + /// Use the following page to map releases to file versions + /// + /// https://github.com/Microsoft/msbuild/releases + /// + [Required] + public string MSBuildMinimimFileVersion { get; set; } + + /// + /// Friendly developer facing version of the MSBuild message. + /// + [Required] + public string MSBuildMinimimDisplayVersion { get; set; } + + public override bool Execute() + { + var allGood = true; + + if (MSBuildMinimimFileVersion != null) + { + var msbuildFilePath = Path.Combine(MSBuildBinPath, "msbuild.exe"); + var fileVersionInfo = FileVersionInfo.GetVersionInfo(msbuildFilePath); + var fileVersion = new Version(fileVersionInfo.FileVersion); + var minimumVersion = new Version(MSBuildMinimimFileVersion); + if (fileVersion < minimumVersion) + { + Log.LogError($"MSBuild version {fileVersion} is less than the required minimum version {minimumVersion} ({MSBuildMinimimDisplayVersion})"); + allGood = false; + } + } + + return allGood; + } + } +} diff --git a/src/Tools/BuildUtil/BuildUtil/WriteCodeFragmentEx.cs b/src/Tools/BuildUtil/BuildUtil/WriteCodeFragmentEx.cs deleted file mode 100644 index 7686ecef66939..0000000000000 --- a/src/Tools/BuildUtil/BuildUtil/WriteCodeFragmentEx.cs +++ /dev/null @@ -1,186 +0,0 @@ -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; - -namespace Roslyn.MSBuild.Util -{ - public class WriteCodeFragmentEx : Task - { - [Required] - public string Language { get; set; } - - public ITaskItem[] AssemblyAttributes { get; set; } - - [Output] - public ITaskItem OutputFile { get; set; } - - public override bool Execute() - { - if (string.IsNullOrEmpty(Language)) - { - Log.LogError($"The {nameof(Language)} parameter is required"); - return false; - } - - if (OutputFile == null) - { - Log.LogError($"The {nameof(OutputFile)} parameter is required"); - return false; - } - - try - { - string extension; - - var code = GenerateCodeCoreClr(out extension); - if (code == null) - { - Log.LogError("No code"); - } - - File.WriteAllText(OutputFile.ItemSpec, code); - return true; - } - catch (Exception ex) - { - Log.LogErrorFromException(ex, showStackTrace: true, showDetail: true, file: null); - } - - return false; - } - - /// - /// Generates the code into a string. - /// If it fails, logs an error and returns null. - /// If no meaningful code is generated, returns empty string. - /// Returns the default language extension as an out parameter. - /// - private string GenerateCodeCoreClr(out string extension) - { - extension = null; - bool haveGeneratedContent = false; - - StringBuilder code = new StringBuilder(); - switch (Language.ToLowerInvariant()) - { - case "c#": - if (AssemblyAttributes == null) return string.Empty; - - extension = "cs"; - code.AppendLine("// WriteCodeFragment.Comment"); - code.AppendLine(); - code.AppendLine("using System;"); - code.AppendLine("using System.Reflection;"); - code.AppendLine(); - - foreach (ITaskItem attributeItem in AssemblyAttributes) - { - string args = GetAttributeArguments(attributeItem, "="); - if (args == null) return null; - - code.AppendLine(string.Format($"[assembly: {attributeItem.ItemSpec}({args})]")); - haveGeneratedContent = true; - } - - break; - case "visual basic": - case "visualbasic": - case "vb": - if (AssemblyAttributes == null) return string.Empty; - - extension = "vb"; - code.AppendLine("' WriteCodeFragment.Comment"); - code.AppendLine(); - code.AppendLine("Option Strict Off"); - code.AppendLine("Option Explicit On"); - code.AppendLine(); - code.AppendLine("Imports System"); - code.AppendLine("Imports System.Reflection"); - - foreach (ITaskItem attributeItem in AssemblyAttributes) - { - string args = GetAttributeArguments(attributeItem, ":="); - if (args == null) return null; - - code.AppendLine(string.Format($"")); - haveGeneratedContent = true; - } - break; - default: - Log.LogError($"No language provider for language \"{Language}\""); - return null; - } - - // If we just generated infrastructure, don't bother returning anything - // as there's no point writing the file - return haveGeneratedContent ? code.ToString() : string.Empty; - } - - private string GetAttributeArguments(ITaskItem attributeItem, string namedArgumentString) - { - // Some attributes only allow positional constructor arguments, or the user may just prefer them. - // To set those, use metadata names like "_Parameter1", "_Parameter2" etc. - // If a parameter index is skipped, it's an error. - IDictionary customMetadata = attributeItem.CloneCustomMetadata(); - - // Initialize count + 1 to access starting at 1 - List orderedParameters = new List(new string[customMetadata.Count + 1]); - List namedParameters = new List(); - - foreach (DictionaryEntry entry in customMetadata) - { - string name = (string) entry.Key; - string value = entry.Value is string ? $@"""{entry.Value}""" : entry.Value.ToString(); - - if (name.StartsWith("_Parameter", StringComparison.OrdinalIgnoreCase)) - { - int index; - - if (!int.TryParse(name.Substring("_Parameter".Length), out index)) - { - Log.LogErrorWithCodeFromResources("General.InvalidValue", name, "WriteCodeFragment"); - return null; - } - - if (index > orderedParameters.Count || index < 1) - { - Log.LogErrorWithCodeFromResources("WriteCodeFragment.SkippedNumberedParameter", index); - return null; - } - - // "_Parameter01" and "_Parameter1" would overwrite each other - orderedParameters[index - 1] = value; - } - else - { - namedParameters.Add($"{name}{namedArgumentString}{value}"); - } - } - - bool encounteredNull = false; - - for (int i = 0; i < orderedParameters.Count; i++) - { - if (orderedParameters[i] == null) - { - // All subsequent args should be null, else a slot was missed - encounteredNull = true; - continue; - } - - if (encounteredNull) - { - Log.LogErrorWithCodeFromResources("WriteCodeFragment.SkippedNumberedParameter", i + 1 /* back to 1 based */); - return null; - } - } - - return string.Join(", ", orderedParameters.Union(namedParameters).Where(p => !string.IsNullOrWhiteSpace(p))); - } - } -} From e47543b238cd0adf8ed146aedf25ff48f76482ec Mon Sep 17 00:00:00 2001 From: Ravi Chande Date: Mon, 24 Apr 2017 15:01:37 -0700 Subject: [PATCH 074/205] Implement INavigableSymbols Breaks the internal GTD infrastructure into seperate symbols for determining the navigable symbol at the caret position and performing the navigation. --- build/Defaults/Net460/app.config | 2 +- build/Defaults/Net462/app.config | 2 +- build/Targets/Packages.props | 71 ++++++++--------- .../Extension/CompilerExtension.csproj | 3 + .../CSharp/CSharpEditorFeatures.csproj | 2 + .../CSharpGoToDefinitionItemService.cs | 16 ++++ .../CSharpGoToDefinitionService.cs | 5 -- .../CSharpGoToDefinitionSymbolService.cs | 20 +++++ src/EditorFeatures/Core/EditorFeatures.csproj | 6 ++ .../AbstractGoToDefinitionItemService.cs | 48 ++++++++++++ .../AbstractGoToDefinitionService.cs | 33 +------- .../AbstractGoToDefinitionSymbolService.cs | 35 +++++++++ .../GoToDefinition/GoToDefinitionContext.cs | 43 +++++++++++ .../GoToDefinition/GoToDefinitionHelpers.cs | 43 +++++++++-- .../IGoToDefinitionSymbolService.cs | 14 ++++ .../Core/GoToDefinition/IGoToSymbolService.cs | 18 +++++ .../WellKnownDefinitionTypes.cs | 10 +++ .../NavigableSymbolService.NavigableSymbol.cs | 61 +++++++++++++++ ...ableSymbolService.NavigableSymbolSource.cs | 76 +++++++++++++++++++ .../NavigableSymbolService.cs | 39 ++++++++++ ...ntUncommentSelectionCommandHandlerTests.cs | 4 +- .../Test/Utilities/PatternMatcherTests.cs | 4 +- .../NavigableSymbols/NavigableSymbolsTest.vb | 73 ++++++++++++++++++ .../TextEditorFactoryExtensions.cs | 12 ++- .../Workspaces/TestHostDocument.cs | 19 ++++- .../ServicesTestUtilities2.vbproj | 1 + .../Utilities/GoToHelpers/GoToTestHelpers.vb | 6 +- .../VisualBasic/BasicEditorFeatures.vbproj | 2 + .../VisualBasicGoToDefinitionItemService.vb | 11 +++ .../VisualBasicGoToDefinitionService.vb | 4 - .../VisualBasicGoToDefinitionSymbolService.vb | 18 +++++ .../Core/Def/ServicesVisualStudio.csproj | 3 + .../Next/ServicesVisualStudio.Next.csproj | 6 ++ .../Extensions/SemanticModelExtensions.cs | 10 ++- 34 files changed, 625 insertions(+), 95 deletions(-) create mode 100644 src/EditorFeatures/CSharp/GoToDefinition/CSharpGoToDefinitionItemService.cs create mode 100644 src/EditorFeatures/CSharp/GoToDefinition/CSharpGoToDefinitionSymbolService.cs create mode 100644 src/EditorFeatures/Core/GoToDefinition/AbstractGoToDefinitionItemService.cs create mode 100644 src/EditorFeatures/Core/GoToDefinition/AbstractGoToDefinitionSymbolService.cs create mode 100644 src/EditorFeatures/Core/GoToDefinition/GoToDefinitionContext.cs create mode 100644 src/EditorFeatures/Core/GoToDefinition/IGoToDefinitionSymbolService.cs create mode 100644 src/EditorFeatures/Core/GoToDefinition/IGoToSymbolService.cs create mode 100644 src/EditorFeatures/Core/GoToDefinition/WellKnownDefinitionTypes.cs create mode 100644 src/EditorFeatures/Core/NavigableSymbols/NavigableSymbolService.NavigableSymbol.cs create mode 100644 src/EditorFeatures/Core/NavigableSymbols/NavigableSymbolService.NavigableSymbolSource.cs create mode 100644 src/EditorFeatures/Core/NavigableSymbols/NavigableSymbolService.cs create mode 100644 src/EditorFeatures/Test2/NavigableSymbols/NavigableSymbolsTest.vb create mode 100644 src/EditorFeatures/VisualBasic/GoToDefinition/VisualBasicGoToDefinitionItemService.vb create mode 100644 src/EditorFeatures/VisualBasic/GoToDefinition/VisualBasicGoToDefinitionSymbolService.vb diff --git a/build/Defaults/Net460/app.config b/build/Defaults/Net460/app.config index 8db45c0c5c11b..5194a2fa0a970 100644 --- a/build/Defaults/Net460/app.config +++ b/build/Defaults/Net460/app.config @@ -75,7 +75,7 @@ - + @@ -18417,7 +18417,7 @@ namespace ConsoleApplication1 using System.Runtime.InteropServices; public struct Parent{ - public int Foo([Optional] int i, [Optional] long j, [Optional] float f, [Optional] decimal d){ + public int Goo([Optional] int i, [Optional] long j, [Optional] float f, [Optional] decimal d){ if(d==0 ) return 0; return 1; } @@ -18426,7 +18426,7 @@ public struct Parent{ class Test{ public static int Main(){ Parent p = new Parent(); - return p.Foo(); + return p.Goo(); } } @@ -18444,7 +18444,7 @@ class Test{ public class Parent{ - public int Foo( int x=2,params object[] array= null){ + public int Goo( int x=2,params object[] array= null){ x=2; if(x ==2) return 0; return 1; @@ -18454,7 +18454,7 @@ public class Parent{ class Test{ public static int Main(){ Parent p = new Parent(); - return p.Foo(); + return p.Goo(); } diff --git a/src/Compilers/CSharp/Test/Syntax/Syntax/StructuredTriviaTests.cs b/src/Compilers/CSharp/Test/Syntax/Syntax/StructuredTriviaTests.cs index 22ddc8cdc9188..74a7974b6b447 100644 --- a/src/Compilers/CSharp/Test/Syntax/Syntax/StructuredTriviaTests.cs +++ b/src/Compilers/CSharp/Test/Syntax/Syntax/StructuredTriviaTests.cs @@ -31,7 +31,7 @@ public void TestStructuredTrivia() var spaceTrivia = SyntaxTriviaListBuilder.Create().Add(SyntaxFactory.Whitespace(" ")).ToList(); var emptyTrivia = SyntaxTriviaListBuilder.Create().ToList(); - var name = "foo"; + var name = "goo"; var xmlStartElement = SyntaxFactory.XmlElementStartTag( SyntaxFactory.Token(spaceTrivia, SyntaxKind.LessThanToken, default(SyntaxTriviaList)), SyntaxFactory.XmlName(null, @@ -46,33 +46,33 @@ public void TestStructuredTrivia() SyntaxFactory.Token(default(SyntaxTriviaList), SyntaxKind.GreaterThanToken, spaceTrivia)); var xmlElement = SyntaxFactory.XmlElement(xmlStartElement, default(SyntaxList), xmlEndElement); - Assert.Equal(" ", xmlElement.ToFullString()); - Assert.Equal(" ", xmlElement.ToString()); + Assert.Equal(" ", xmlElement.ToFullString()); + Assert.Equal(" ", xmlElement.ToString()); var docComment = SyntaxFactory.DocumentationCommentTrivia(SyntaxKind.SingleLineDocumentationCommentTrivia).WithContent(new SyntaxList(xmlElement)); - Assert.Equal(" ", docComment.ToFullString()); - // Assert.Equal(" ", docComment.GetText()); + Assert.Equal(" ", docComment.ToFullString()); + // Assert.Equal(" ", docComment.GetText()); var child = (XmlElementSyntax)docComment.ChildNodesAndTokens()[0]; - Assert.Equal(" ", child.ToFullString()); - Assert.Equal(" ", child.ToString()); - Assert.Equal(" ", child.StartTag.ToFullString()); - Assert.Equal("", child.StartTag.ToString()); + Assert.Equal(" ", child.ToFullString()); + Assert.Equal(" ", child.ToString()); + Assert.Equal(" ", child.StartTag.ToFullString()); + Assert.Equal("", child.StartTag.ToString()); var sTrivia = SyntaxFactory.Trivia(docComment); Assert.NotEqual(default(SyntaxTrivia), sTrivia); var ident = SyntaxFactory.Identifier(SyntaxTriviaList.Create(sTrivia), "banana", spaceTrivia); - Assert.Equal(" banana ", ident.ToFullString()); + Assert.Equal(" banana ", ident.ToFullString()); Assert.Equal("banana", ident.ToString()); - Assert.Equal(" ", ident.LeadingTrivia[0].ToFullString()); - // Assert.Equal(" ", ident.LeadingTrivia[0].GetText()); + Assert.Equal(" ", ident.LeadingTrivia[0].ToFullString()); + // Assert.Equal(" ", ident.LeadingTrivia[0].GetText()); var identExpr = SyntaxFactory.IdentifierName(ident); // make sure FindLeaf digs into the structured trivia. var result = identExpr.FindToken(3, true); Assert.Equal(SyntaxKind.IdentifierToken, result.Kind()); - Assert.Equal("foo", result.ToString()); + Assert.Equal("goo", result.ToString()); var trResult = identExpr.FindTrivia(6, SyntaxTrivia.Any); Assert.Equal(SyntaxKind.WhitespaceTrivia, trResult.Kind()); @@ -95,7 +95,7 @@ public void ReferenceDirectives1() { var tree = SyntaxFactory.ParseSyntaxTree(@" #r ""ref0"" -#define Foo +#define Goo #r ""ref1"" #r ""ref2"" using Blah; @@ -183,7 +183,7 @@ static void Main() { } [Fact] public void TestTriviaList_getItemFailures() { - var tree = SyntaxFactory.ParseSyntaxTree(" class foo {}"); + var tree = SyntaxFactory.ParseSyntaxTree(" class goo {}"); var trivia = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia(); var t1 = trivia[0]; diff --git a/src/Compilers/CSharp/Test/Syntax/Syntax/SyntaxDiffingTests.cs b/src/Compilers/CSharp/Test/Syntax/Syntax/SyntaxDiffingTests.cs index 81f20d7a899ae..a70e3d448bc72 100644 --- a/src/Compilers/CSharp/Test/Syntax/Syntax/SyntaxDiffingTests.cs +++ b/src/Compilers/CSharp/Test/Syntax/Syntax/SyntaxDiffingTests.cs @@ -267,7 +267,7 @@ void F() { class Type { - void Foo() + void Goo() { int x = 1 "" + Sign + @"" "" + Sign + @""3; } diff --git a/src/Compilers/CSharp/Test/Syntax/Syntax/SyntaxEquivalenceTests.cs b/src/Compilers/CSharp/Test/Syntax/Syntax/SyntaxEquivalenceTests.cs index 15df962cf21e0..204e6c002364a 100644 --- a/src/Compilers/CSharp/Test/Syntax/Syntax/SyntaxEquivalenceTests.cs +++ b/src/Compilers/CSharp/Test/Syntax/Syntax/SyntaxEquivalenceTests.cs @@ -44,7 +44,7 @@ public void TestAddingComment() { var text = ""; var tree1 = SyntaxFactory.ParseSyntaxTree(text); - var tree2 = tree1.WithInsertAt(0, "/* foo */"); + var tree2 = tree1.WithInsertAt(0, "/* goo */"); VerifyEquivalent(tree1, tree2, topLevel: true); VerifyEquivalent(tree1, tree2, topLevel: false); @@ -106,7 +106,7 @@ public void TestRenameOuter() [Fact] public void TestRenameInner() { - var tree1 = SyntaxFactory.ParseSyntaxTree("namespace N { class C { void Foo() { int z = 0; } } }"); + var tree1 = SyntaxFactory.ParseSyntaxTree("namespace N { class C { void Goo() { int z = 0; } } }"); var tree2 = tree1.WithReplaceFirst("z", "y"); VerifyEquivalent(tree1, tree2, topLevel: true); @@ -126,7 +126,7 @@ public void TestRenameOuterToSamename() [Fact] public void TestRenameInnerToSameName() { - var tree1 = SyntaxFactory.ParseSyntaxTree("namespace N { class C { void Foo() { int z = 0; } } }"); + var tree1 = SyntaxFactory.ParseSyntaxTree("namespace N { class C { void Goo() { int z = 0; } } }"); var tree2 = tree1.WithReplaceFirst("z", "z"); VerifyEquivalent(tree1, tree2, topLevel: true); @@ -137,7 +137,7 @@ public void TestRenameInnerToSameName() public void TestAddingMethod() { var tree1 = SyntaxFactory.ParseSyntaxTree("namespace N { class C { } }"); - var tree2 = tree1.WithInsertBefore("}", "void Foo() { } "); + var tree2 = tree1.WithInsertBefore("}", "void Goo() { } "); VerifyNotEquivalent(tree1, tree2, topLevel: true); VerifyNotEquivalent(tree1, tree2, topLevel: false); @@ -146,7 +146,7 @@ public void TestAddingMethod() [Fact] public void TestAddingLocal() { - var tree1 = SyntaxFactory.ParseSyntaxTree("namespace N { class C { void Foo() { } } }"); + var tree1 = SyntaxFactory.ParseSyntaxTree("namespace N { class C { void Goo() { } } }"); var tree2 = tree1.WithInsertBefore("}", "int i; "); VerifyEquivalent(tree1, tree2, topLevel: true); @@ -156,7 +156,7 @@ public void TestAddingLocal() [Fact] public void TestRemovingLocal() { - var tree1 = SyntaxFactory.ParseSyntaxTree("namespace N { class C { void Foo() { int i; } } }"); + var tree1 = SyntaxFactory.ParseSyntaxTree("namespace N { class C { void Goo() { int i; } } }"); var tree2 = tree1.WithRemoveFirst("int i;"); VerifyEquivalent(tree1, tree2, topLevel: true); @@ -235,7 +235,7 @@ public void TestChangingConstField2() [Fact] public void TestChangingConstLocal() { - var tree1 = SyntaxFactory.ParseSyntaxTree("namespace N { class C { void Foo() { const int i = 5; } } }"); + var tree1 = SyntaxFactory.ParseSyntaxTree("namespace N { class C { void Goo() { const int i = 5; } } }"); var tree2 = tree1.WithReplaceFirst("5", "6"); VerifyEquivalent(tree1, tree2, topLevel: true); @@ -265,7 +265,7 @@ public void TestChangingAttribute() [Fact] public void TestChangingMethodCall() { - var tree1 = SyntaxFactory.ParseSyntaxTree("namespace N { class C { void Foo() { Console.Write(0); } } }"); + var tree1 = SyntaxFactory.ParseSyntaxTree("namespace N { class C { void Goo() { Console.Write(0); } } }"); var tree2 = tree1.WithReplaceFirst("Write", "WriteLine"); VerifyEquivalent(tree1, tree2, topLevel: true); @@ -275,7 +275,7 @@ public void TestChangingMethodCall() [Fact] public void TestChangingUsing() { - var tree1 = SyntaxFactory.ParseSyntaxTree("using System; namespace N { class C { void Foo() { Console.Write(0); } } }"); + var tree1 = SyntaxFactory.ParseSyntaxTree("using System; namespace N { class C { void Goo() { Console.Write(0); } } }"); var tree2 = tree1.WithReplaceFirst("System", "System.Linq"); VerifyNotEquivalent(tree1, tree2, topLevel: true); @@ -285,7 +285,7 @@ public void TestChangingUsing() [Fact] public void TestChangingBaseType() { - var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Foo() { Console.Write(0); } }"); + var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Goo() { Console.Write(0); } }"); var tree2 = tree1.WithInsertBefore("{", ": B "); VerifyNotEquivalent(tree1, tree2, topLevel: true); @@ -295,7 +295,7 @@ public void TestChangingBaseType() [Fact] public void TestChangingMethodType() { - var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Foo() { Console.Write(0); } }"); + var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Goo() { Console.Write(0); } }"); var tree2 = tree1.WithReplaceFirst("void", "int"); VerifyNotEquivalent(tree1, tree2, topLevel: true); @@ -305,7 +305,7 @@ public void TestChangingMethodType() [Fact] public void TestAddComment() { - var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Foo() { Console.Write(0); } }"); + var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Goo() { Console.Write(0); } }"); var tree2 = tree1.WithInsertBefore("class", "// Comment\r\n"); VerifyEquivalent(tree1, tree2, topLevel: true); @@ -315,7 +315,7 @@ public void TestAddComment() [Fact] public void TestCommentOutCode() { - var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Foo() { Console.Write(0); } }"); + var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Goo() { Console.Write(0); } }"); var tree2 = tree1.WithInsertBefore("class", "// "); VerifyNotEquivalent(tree1, tree2, topLevel: true); @@ -325,7 +325,7 @@ public void TestCommentOutCode() [Fact] public void TestAddDocComment() { - var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Foo() { Console.Write(0); } }"); + var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Goo() { Console.Write(0); } }"); var tree2 = tree1.WithInsertBefore("class", "/// Comment\r\n"); VerifyEquivalent(tree1, tree2, topLevel: true); @@ -335,7 +335,7 @@ public void TestAddDocComment() [Fact] public void TestCommentOutMethodCode() { - var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Foo() { Console.Write(0); } }"); + var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Goo() { Console.Write(0); } }"); var tree2 = tree1.WithReplaceFirst("Console.Write(0);", "/* Console.Write(0); */"); VerifyEquivalent(tree1, tree2, topLevel: true); @@ -345,8 +345,8 @@ public void TestCommentOutMethodCode() [Fact] public void TestCommentOutMethod() { - var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Foo() { } }"); - var tree2 = tree1.WithReplaceFirst("void Foo() { }", "/* void Foo() { } */"); + var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Goo() { } }"); + var tree2 = tree1.WithReplaceFirst("void Goo() { }", "/* void Goo() { } */"); VerifyNotEquivalent(tree1, tree2, topLevel: true); VerifyNotEquivalent(tree1, tree2, topLevel: false); @@ -355,8 +355,8 @@ public void TestCommentOutMethod() [Fact] public void TestSurroundMethodWithActivePPRegion() { - var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Foo() { } }"); - var tree2 = tree1.WithReplaceFirst("void Foo() { }", "\r\n#if true\r\n void Foo() { }\r\n#endif\r\n"); + var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Goo() { } }"); + var tree2 = tree1.WithReplaceFirst("void Goo() { }", "\r\n#if true\r\n void Goo() { }\r\n#endif\r\n"); VerifyEquivalent(tree1, tree2, topLevel: true); VerifyEquivalent(tree1, tree2, topLevel: false); @@ -365,8 +365,8 @@ public void TestSurroundMethodWithActivePPRegion() [Fact] public void TestSurroundMethodWithInactivePPRegion() { - var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Foo() { } }"); - var tree2 = tree1.WithReplaceFirst("void Foo() { }", "\r\n#if false\r\n void Foo() { }\r\n#endif\r\n"); + var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Goo() { } }"); + var tree2 = tree1.WithReplaceFirst("void Goo() { }", "\r\n#if false\r\n void Goo() { }\r\n#endif\r\n"); VerifyNotEquivalent(tree1, tree2, topLevel: true); VerifyNotEquivalent(tree1, tree2, topLevel: false); @@ -375,7 +375,7 @@ public void TestSurroundMethodWithInactivePPRegion() [Fact] public void TestSurroundStatementWithActivePPRegion() { - var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Foo() { int i; } }"); + var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Goo() { int i; } }"); var tree2 = tree1.WithReplaceFirst("int i;", "\r\n#if true\r\n int i;\r\n#endif\r\n"); VerifyEquivalent(tree1, tree2, topLevel: true); @@ -385,7 +385,7 @@ public void TestSurroundStatementWithActivePPRegion() [Fact] public void TestSurroundStatementWithInactivePPRegion() { - var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Foo() { int i; } }"); + var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Goo() { int i; } }"); var tree2 = tree1.WithReplaceFirst("int i;", "\r\n#if false\r\n int i;\r\n#endif\r\n"); VerifyEquivalent(tree1, tree2, topLevel: true); @@ -395,8 +395,8 @@ public void TestSurroundStatementWithInactivePPRegion() [Fact] public void TestAddLotsOfComments() { - var text = "class C { void Foo() { int i; } }"; - var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Foo() { int i; } }"); + var text = "class C { void Goo() { int i; } }"; + var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Goo() { int i; } }"); var tree2 = SyntaxFactory.ParseSyntaxTree(text.Replace(" ", " /**/ ")); VerifyEquivalent(tree1, tree2, topLevel: true); @@ -406,8 +406,8 @@ public void TestAddLotsOfComments() [Fact] public void TestChangeWhitespace() { - var text = "class C { void Foo() { int i; } }"; - var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Foo() { int i; } }"); + var text = "class C { void Goo() { int i; } }"; + var tree1 = SyntaxFactory.ParseSyntaxTree("class C { void Goo() { int i; } }"); var tree2 = SyntaxFactory.ParseSyntaxTree(text.Replace(" ", " ")); VerifyEquivalent(tree1, tree2, topLevel: true); @@ -427,7 +427,7 @@ public void TestSkippedTest() [Fact] public void TestUpdateInterpolatedString() { - var tree1 = SyntaxFactory.ParseSyntaxTree("namespace N { class C { void Foo() { Console.Write($\"Hello{123:N1}\"); } } }"); + var tree1 = SyntaxFactory.ParseSyntaxTree("namespace N { class C { void Goo() { Console.Write($\"Hello{123:N1}\"); } } }"); var tree2 = tree1.WithReplaceFirst("N1", "N2"); VerifyEquivalent(tree1, tree2, topLevel: true); diff --git a/src/Compilers/CSharp/Test/Syntax/Syntax/SyntaxFactoryTests.cs b/src/Compilers/CSharp/Test/Syntax/Syntax/SyntaxFactoryTests.cs index b13961793966f..2da9d0a4e4078 100644 --- a/src/Compilers/CSharp/Test/Syntax/Syntax/SyntaxFactoryTests.cs +++ b/src/Compilers/CSharp/Test/Syntax/Syntax/SyntaxFactoryTests.cs @@ -34,7 +34,7 @@ public void SyntaxTreeFromNode() [Fact] public void TestConstructNamespaceWithNameOnly() { - var n = SyntaxFactory.NamespaceDeclaration(name: SyntaxFactory.IdentifierName(SyntaxFactory.Identifier("foo"))); + var n = SyntaxFactory.NamespaceDeclaration(name: SyntaxFactory.IdentifierName(SyntaxFactory.Identifier("goo"))); Assert.NotNull(n); Assert.Equal(0, n.Errors().Length); Assert.Equal(0, n.Externs.Count); @@ -54,7 +54,7 @@ public void TestConstructNamespaceWithNameOnly() [Fact] public void TestConstructClassWithKindAndNameOnly() { - var c = SyntaxFactory.ClassDeclaration(identifier: SyntaxFactory.Identifier("foo")); + var c = SyntaxFactory.ClassDeclaration(identifier: SyntaxFactory.Identifier("goo")); Assert.NotNull(c); Assert.Equal(0, c.AttributeLists.Count); Assert.Equal(0, c.Modifiers.Count); diff --git a/src/Compilers/CSharp/Test/Syntax/Syntax/SyntaxNodeTests.cs b/src/Compilers/CSharp/Test/Syntax/Syntax/SyntaxNodeTests.cs index a2a9f89540faf..eab3eddcdcaa3 100644 --- a/src/Compilers/CSharp/Test/Syntax/Syntax/SyntaxNodeTests.cs +++ b/src/Compilers/CSharp/Test/Syntax/Syntax/SyntaxNodeTests.cs @@ -280,7 +280,7 @@ public void TestDescendantNodesAndTokensAndSelfForEmptyCompilationUnit() [Fact] public void TestDescendantNodesAndTokensAndSelfForDocumentationComment() { - var text = "/// Foo\r\n x"; + var text = "/// Goo\r\n x"; var expr = SyntaxFactory.ParseExpression(text); var nodesAndTokens = expr.DescendantNodesAndTokensAndSelf(descendIntoTrivia: true).ToList(); @@ -334,7 +334,7 @@ public void TestGetAllAnnotatedNodesUsingDescendantNodes() [Fact] public void TestDescendantTokens() { - var s1 = "using Foo;"; + var s1 = "using Goo;"; var t1 = SyntaxFactory.ParseSyntaxTree(s1); var tokens = t1.GetCompilationUnitRoot().DescendantTokens().ToList(); Assert.Equal(4, tokens.Count); @@ -347,7 +347,7 @@ public void TestDescendantTokens() [Fact] public void TestDescendantTokensWithExtraWhitespace() { - var s1 = " using Foo ; "; + var s1 = " using Goo ; "; var t1 = SyntaxFactory.ParseSyntaxTree(s1); var tokens = t1.GetCompilationUnitRoot().DescendantTokens().ToList(); Assert.Equal(4, tokens.Count); @@ -360,7 +360,7 @@ public void TestDescendantTokensWithExtraWhitespace() [Fact] public void TestDescendantTokensEntireRange() { - var s1 = "extern alias Bar;\r\n" + "using Foo;"; + var s1 = "extern alias Bar;\r\n" + "using Goo;"; var t1 = SyntaxFactory.ParseSyntaxTree(s1); var tokens = t1.GetCompilationUnitRoot().DescendantTokens().ToList(); Assert.Equal(8, tokens.Count); @@ -377,7 +377,7 @@ public void TestDescendantTokensEntireRange() [Fact] public void TestDescendantTokensOverFullSpan() { - var s1 = "extern alias Bar;\r\n" + "using Foo;"; + var s1 = "extern alias Bar;\r\n" + "using Goo;"; var t1 = SyntaxFactory.ParseSyntaxTree(s1); var tokens = t1.GetCompilationUnitRoot().DescendantTokens(new TextSpan(0, 16)).ToList(); Assert.Equal(3, tokens.Count); @@ -389,7 +389,7 @@ public void TestDescendantTokensOverFullSpan() [Fact] public void TestDescendantTokensOverInsideSpan() { - var s1 = "extern alias Bar;\r\n" + "using Foo;"; + var s1 = "extern alias Bar;\r\n" + "using Goo;"; var t1 = SyntaxFactory.ParseSyntaxTree(s1); var tokens = t1.GetCompilationUnitRoot().DescendantTokens(new TextSpan(1, 14)).ToList(); Assert.Equal(3, tokens.Count); @@ -401,7 +401,7 @@ public void TestDescendantTokensOverInsideSpan() [Fact] public void TestDescendantTokensOverFullSpanOffset() { - var s1 = "extern alias Bar;\r\n" + "using Foo;"; + var s1 = "extern alias Bar;\r\n" + "using Goo;"; var t1 = SyntaxFactory.ParseSyntaxTree(s1); var tokens = t1.GetCompilationUnitRoot().DescendantTokens(new TextSpan(7, 17)).ToList(); Assert.Equal(4, tokens.Count); @@ -414,7 +414,7 @@ public void TestDescendantTokensOverFullSpanOffset() [Fact] public void TestDescendantTokensOverInsideSpanOffset() { - var s1 = "extern alias Bar;\r\n" + "using Foo;"; + var s1 = "extern alias Bar;\r\n" + "using Goo;"; var t1 = SyntaxFactory.ParseSyntaxTree(s1); var tokens = t1.GetCompilationUnitRoot().DescendantTokens(new TextSpan(8, 15)).ToList(); Assert.Equal(4, tokens.Count); @@ -427,7 +427,7 @@ public void TestDescendantTokensOverInsideSpanOffset() [Fact] public void TestDescendantTrivia() { - var text = "// foo\r\na + b"; + var text = "// goo\r\na + b"; var expr = SyntaxFactory.ParseExpression(text); var list = expr.DescendantTrivia().ToList(); @@ -442,8 +442,8 @@ public void TestDescendantTrivia() public void TestDescendantTriviaIntoStructuredTrivia() { var text = @" -/// -/// +/// +/// a + b"; var expr = SyntaxFactory.ParseExpression(text); @@ -461,23 +461,23 @@ public void TestDescendantTriviaIntoStructuredTrivia() [Fact] public void Bug877223() { - var s1 = "using Foo;"; + var s1 = "using Goo;"; var t1 = SyntaxFactory.ParseSyntaxTree(s1); // var node = t1.GetCompilationUnitRoot().Usings[0].GetTokens(new TextSpan(6, 3)).First(); var node = t1.GetCompilationUnitRoot().DescendantTokens(new TextSpan(6, 3)).First(); - Assert.Equal(node.ToString(), "Foo"); + Assert.Equal(node.ToString(), "Goo"); } [Fact] public void TestFindToken() { - var text = "class\n #if XX\n#endif\n foo { }"; + var text = "class\n #if XX\n#endif\n goo { }"; var tree = SyntaxFactory.ParseSyntaxTree(text); var token = tree.GetCompilationUnitRoot().FindToken("class\n #i".Length); Assert.Equal(SyntaxKind.IdentifierToken, token.Kind()); - Assert.Equal("foo", token.ToString()); + Assert.Equal("goo", token.ToString()); token = tree.GetCompilationUnitRoot().FindToken("class\n #i".Length, findInsideTrivia: true); Assert.Equal(SyntaxKind.IfKeyword, token.Kind()); } @@ -524,7 +524,7 @@ private void CheckFindToken(SyntaxNode node) [Fact] public void TestFindNode() { - var text = "class\n #if XX\n#endif\n foo { }\n class bar { }"; + var text = "class\n #if XX\n#endif\n goo { }\n class bar { }"; var tree = SyntaxFactory.ParseSyntaxTree(text); var root = tree.GetRoot(); @@ -579,7 +579,7 @@ public void TestFindNode() [Fact] public void TestFindTriviaNoTriviaExistsAtPosition() { - var code = @"class Foo + var code = @"class Goo { void Bar() { @@ -599,7 +599,7 @@ void Bar() [Fact] public void TestTreeEquivalentToSelf() { - var text = "class foo { }"; + var text = "class goo { }"; var tree = SyntaxFactory.ParseSyntaxTree(text); Assert.True(tree.GetCompilationUnitRoot().IsEquivalentTo(tree.GetCompilationUnitRoot())); } @@ -607,7 +607,7 @@ public void TestTreeEquivalentToSelf() [Fact] public void TestTreeNotEquivalentToNull() { - var text = "class foo { }"; + var text = "class goo { }"; var tree = SyntaxFactory.ParseSyntaxTree(text); Assert.False(tree.GetCompilationUnitRoot().IsEquivalentTo(null)); } @@ -615,7 +615,7 @@ public void TestTreeNotEquivalentToNull() [Fact] public void TestTreesFromSameSourceEquivalent() { - var text = "class foo { }"; + var text = "class goo { }"; var tree1 = SyntaxFactory.ParseSyntaxTree(text); var tree2 = SyntaxFactory.ParseSyntaxTree(text); Assert.NotEqual(tree1.GetCompilationUnitRoot(), tree2.GetCompilationUnitRoot()); @@ -625,7 +625,7 @@ public void TestTreesFromSameSourceEquivalent() [Fact] public void TestDifferentTreesNotEquivalent() { - var tree1 = SyntaxFactory.ParseSyntaxTree("class foo { }"); + var tree1 = SyntaxFactory.ParseSyntaxTree("class goo { }"); var tree2 = SyntaxFactory.ParseSyntaxTree("class bar { }"); Assert.NotEqual(tree1.GetCompilationUnitRoot(), tree2.GetCompilationUnitRoot()); Assert.False(tree1.GetCompilationUnitRoot().IsEquivalentTo(tree2.GetCompilationUnitRoot())); @@ -634,7 +634,7 @@ public void TestDifferentTreesNotEquivalent() [Fact] public void TestVastlyDifferentTreesNotEquivalent() { - var tree1 = SyntaxFactory.ParseSyntaxTree("class foo { }"); + var tree1 = SyntaxFactory.ParseSyntaxTree("class goo { }"); var tree2 = SyntaxFactory.ParseSyntaxTree(string.Empty); Assert.NotEqual(tree1.GetCompilationUnitRoot(), tree2.GetCompilationUnitRoot()); Assert.False(tree1.GetCompilationUnitRoot().IsEquivalentTo(tree2.GetCompilationUnitRoot())); @@ -643,7 +643,7 @@ public void TestVastlyDifferentTreesNotEquivalent() [Fact] public void TestSimilarSubtreesEquivalent() { - var tree1 = SyntaxFactory.ParseSyntaxTree("class foo { void M() { } }"); + var tree1 = SyntaxFactory.ParseSyntaxTree("class goo { void M() { } }"); var tree2 = SyntaxFactory.ParseSyntaxTree("class bar { void M() { } }"); var m1 = ((TypeDeclarationSyntax)tree1.GetCompilationUnitRoot().Members[0]).Members[0]; var m2 = ((TypeDeclarationSyntax)tree2.GetCompilationUnitRoot().Members[0]).Members[0]; @@ -656,15 +656,15 @@ public void TestSimilarSubtreesEquivalent() [Fact] public void TestTreesWithDifferentTriviaAreNotEquivalent() { - var tree1 = SyntaxFactory.ParseSyntaxTree("class foo {void M() { }}"); - var tree2 = SyntaxFactory.ParseSyntaxTree("class foo { void M() { } }"); + var tree1 = SyntaxFactory.ParseSyntaxTree("class goo {void M() { }}"); + var tree2 = SyntaxFactory.ParseSyntaxTree("class goo { void M() { } }"); Assert.False(tree1.GetCompilationUnitRoot().IsEquivalentTo(tree2.GetCompilationUnitRoot())); } [Fact, WorkItem(536664, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/536664")] public void TestTriviaNodeCached() { - var tree = SyntaxFactory.ParseSyntaxTree(" class foo {}"); + var tree = SyntaxFactory.ParseSyntaxTree(" class goo {}"); // get to the trivia node var trivia = tree.GetCompilationUnitRoot().Members[0].GetLeadingTrivia()[0]; @@ -679,7 +679,7 @@ public void TestTriviaNodeCached() [Fact] public void TestGetFirstToken() { - var tree = SyntaxFactory.ParseSyntaxTree("public static class foo { }"); + var tree = SyntaxFactory.ParseSyntaxTree("public static class goo { }"); var first = tree.GetCompilationUnitRoot().GetFirstToken(); Assert.Equal(SyntaxKind.PublicKeyword, first.Kind()); } @@ -687,7 +687,7 @@ public void TestGetFirstToken() [Fact] public void TestGetFirstTokenIncludingZeroWidth() { - var tree = SyntaxFactory.ParseSyntaxTree("public static class foo { }"); + var tree = SyntaxFactory.ParseSyntaxTree("public static class goo { }"); var first = tree.GetCompilationUnitRoot().GetFirstToken(includeZeroWidth: true); Assert.Equal(SyntaxKind.PublicKeyword, first.Kind()); } @@ -695,7 +695,7 @@ public void TestGetFirstTokenIncludingZeroWidth() [Fact] public void TestGetLastToken() { - var tree = SyntaxFactory.ParseSyntaxTree("public static class foo { }"); + var tree = SyntaxFactory.ParseSyntaxTree("public static class goo { }"); var last = tree.GetCompilationUnitRoot().GetLastToken(); Assert.Equal(SyntaxKind.CloseBraceToken, last.Kind()); } @@ -703,7 +703,7 @@ public void TestGetLastToken() [Fact] public void TestGetLastTokenIncludingZeroWidth() { - var tree = SyntaxFactory.ParseSyntaxTree("public static class foo { "); + var tree = SyntaxFactory.ParseSyntaxTree("public static class goo { "); var last = tree.GetCompilationUnitRoot().GetLastToken(includeZeroWidth: true); Assert.Equal(SyntaxKind.EndOfFileToken, last.Kind()); @@ -739,7 +739,7 @@ private void TestReverse(ChildSyntaxList children) [Fact] public void TestGetNextToken() { - var tree = SyntaxFactory.ParseSyntaxTree("public static class foo { }"); + var tree = SyntaxFactory.ParseSyntaxTree("public static class goo { }"); var tokens = tree.GetCompilationUnitRoot().DescendantTokens().ToList(); var list = new List(); @@ -763,7 +763,7 @@ public void TestGetNextTokenIncludingSkippedTokens() { var text = @"garbage -using foo.bar; +using goo.bar; "; var tree = SyntaxFactory.ParseSyntaxTree(text); Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); @@ -792,7 +792,7 @@ public void TestGetNextTokenExcludingSkippedTokens() { var tree = SyntaxFactory.ParseSyntaxTree( @"garbage -using foo.bar; +using goo.bar; "); var tokens = tree.GetCompilationUnitRoot().DescendantTokens().ToList(); Assert.Equal(6, tokens.Count); @@ -816,7 +816,7 @@ public void TestGetNextTokenExcludingSkippedTokens() [Fact] public void TestGetNextTokenCommon() { - SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree("public static class foo { }"); + SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree("public static class goo { }"); List tokens = syntaxTree.GetRoot().DescendantTokens().ToList(); List list = new List(); @@ -838,7 +838,7 @@ public void TestGetNextTokenCommon() [Fact] public void TestGetPreviousToken() { - var tree = SyntaxFactory.ParseSyntaxTree("public static class foo { }"); + var tree = SyntaxFactory.ParseSyntaxTree("public static class goo { }"); var tokens = tree.GetCompilationUnitRoot().DescendantTokens().ToList(); var list = new List(); @@ -863,7 +863,7 @@ public void TestGetPreviousTokenIncludingSkippedTokens() { var text = @"garbage -using foo.bar; +using goo.bar; "; var tree = SyntaxFactory.ParseSyntaxTree(text); Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); @@ -893,7 +893,7 @@ public void TestGetPreviousTokenExcludingSkippedTokens() { var text = @"garbage -using foo.bar; +using goo.bar; "; var tree = SyntaxFactory.ParseSyntaxTree(text); Assert.Equal(text, tree.GetCompilationUnitRoot().ToFullString()); @@ -921,7 +921,7 @@ public void TestGetPreviousTokenExcludingSkippedTokens() [Fact] public void TestGetPreviousTokenCommon() { - SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree("public static class foo { }"); + SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree("public static class goo { }"); List tokens = syntaxTree.GetRoot().DescendantTokens().ToList(); List list = new List(); @@ -945,7 +945,7 @@ public void TestGetPreviousTokenCommon() [Fact] public void TestGetNextTokenIncludingZeroWidth() { - var tree = SyntaxFactory.ParseSyntaxTree("public static class foo {"); + var tree = SyntaxFactory.ParseSyntaxTree("public static class goo {"); var tokens = tree.GetCompilationUnitRoot().DescendantTokens().ToList(); var list = new List(); @@ -966,7 +966,7 @@ public void TestGetNextTokenIncludingZeroWidth() [Fact] public void TestGetNextTokenIncludingZeroWidthCommon() { - SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree("public static class foo {"); + SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree("public static class goo {"); List tokens = syntaxTree.GetRoot().DescendantTokens().ToList(); List list = new List(); @@ -987,7 +987,7 @@ public void TestGetNextTokenIncludingZeroWidthCommon() [Fact] public void TestGetPreviousTokenIncludingZeroWidth() { - var tree = SyntaxFactory.ParseSyntaxTree("public static class foo {"); + var tree = SyntaxFactory.ParseSyntaxTree("public static class goo {"); var tokens = tree.GetCompilationUnitRoot().DescendantTokens().ToList(); var list = new List(); @@ -1011,7 +1011,7 @@ public void TestGetPreviousTokenIncludingZeroWidth() [Fact] public void TestGetPreviousTokenIncludingZeroWidthCommon() { - SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree("public static class foo {"); + SyntaxTree syntaxTree = SyntaxFactory.ParseSyntaxTree("public static class goo {"); List tokens = syntaxTree.GetRoot().DescendantTokens().ToList(); List list = new List(); @@ -1034,7 +1034,7 @@ public void TestGetPreviousTokenIncludingZeroWidthCommon() [Fact] public void TestGetNextSibling() { - var tree = SyntaxFactory.ParseSyntaxTree("public static class foo { }"); + var tree = SyntaxFactory.ParseSyntaxTree("public static class goo { }"); var children = tree.GetCompilationUnitRoot().Members[0].ChildNodesAndTokens().ToList(); var list = new List(); for (var child = children[0]; child.Kind() != SyntaxKind.None; child = child.GetNextSibling()) @@ -1052,7 +1052,7 @@ public void TestGetNextSibling() [Fact] public void TestGetPreviousSibling() { - var tree = SyntaxFactory.ParseSyntaxTree("public static class foo { }"); + var tree = SyntaxFactory.ParseSyntaxTree("public static class goo { }"); var children = tree.GetCompilationUnitRoot().Members[0].ChildNodesAndTokens().ToList(); var reversed = children.AsEnumerable().Reverse().ToList(); var list = new List(); @@ -1071,7 +1071,7 @@ public void TestGetPreviousSibling() [Fact] public void TestSyntaxNodeOrTokenEquality() { - var tree = SyntaxFactory.ParseSyntaxTree("public static class foo { }"); + var tree = SyntaxFactory.ParseSyntaxTree("public static class goo { }"); var child = tree.GetCompilationUnitRoot().ChildNodesAndTokens()[0]; var member = (TypeDeclarationSyntax)tree.GetCompilationUnitRoot().Members[0]; Assert.Equal((SyntaxNodeOrToken)member, child); @@ -1088,7 +1088,7 @@ public void TestSyntaxNodeOrTokenEquality() [Fact] public void TestStructuredTriviaHasNoParent() { - var tree = SyntaxFactory.ParseSyntaxTree("#define FOO"); + var tree = SyntaxFactory.ParseSyntaxTree("#define GOO"); var trivia = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia()[0]; Assert.Equal(SyntaxKind.DefineDirectiveTrivia, trivia.Kind()); Assert.True(trivia.HasStructure); @@ -1099,7 +1099,7 @@ public void TestStructuredTriviaHasNoParent() [Fact] public void TestStructuredTriviaHasParentTrivia() { - var tree = SyntaxFactory.ParseSyntaxTree("#define FOO"); + var tree = SyntaxFactory.ParseSyntaxTree("#define GOO"); var trivia = tree.GetCompilationUnitRoot().EndOfFileToken.GetLeadingTrivia()[0]; Assert.Equal(SyntaxKind.DefineDirectiveTrivia, trivia.Kind()); Assert.True(trivia.HasStructure); @@ -1112,7 +1112,7 @@ public void TestStructuredTriviaHasParentTrivia() [Fact] public void TestStructuredTriviaParentTrivia() { - var def = SyntaxFactory.DefineDirectiveTrivia(SyntaxFactory.Identifier("FOO"), false); + var def = SyntaxFactory.DefineDirectiveTrivia(SyntaxFactory.Identifier("GOO"), false); // unrooted structured trivia should report parent trivia as default Assert.Equal(default(SyntaxTrivia), def.ParentTrivia); @@ -1135,7 +1135,7 @@ public void TestStructuredTriviaParentTrivia() [Fact] public void TestGetFirstDirective() { - var tree = SyntaxFactory.ParseSyntaxTree("#define FOO"); + var tree = SyntaxFactory.ParseSyntaxTree("#define GOO"); var d = tree.GetCompilationUnitRoot().GetFirstDirective(); Assert.NotNull(d); Assert.Equal(SyntaxKind.DefineDirectiveTrivia, d.Kind()); @@ -1145,8 +1145,8 @@ public void TestGetFirstDirective() public void TestGetLastDirective() { var tree = SyntaxFactory.ParseSyntaxTree( -@"#define FOO -#undef FOO +@"#define GOO +#undef GOO "); var d = tree.GetCompilationUnitRoot().GetLastDirective(); Assert.NotNull(d); @@ -1157,10 +1157,10 @@ public void TestGetLastDirective() public void TestGetNextDirective() { var tree = SyntaxFactory.ParseSyntaxTree( -@"#define FOO +@"#define GOO #define BAR class C { -#if FOO +#if GOO void M() { } #endif } @@ -1185,10 +1185,10 @@ void M() { } public void TestGetPreviousDirective() { var tree = SyntaxFactory.ParseSyntaxTree( -@"#define FOO +@"#define GOO #define BAR class C { -#if FOO +#if GOO void M() { } #endif } @@ -1213,8 +1213,8 @@ void M() { } public void TestGetDirectivesRelatedToIf() { var tree = SyntaxFactory.ParseSyntaxTree( -@"#define FOO -#if FOO +@"#define GOO +#if GOO class A { } #elif BAR class B { } @@ -1244,8 +1244,8 @@ class C { } public void TestGetDirectivesRelatedToIfElements() { var tree = SyntaxFactory.ParseSyntaxTree( -@"#define FOO -#if FOO +@"#define GOO +#if GOO class A { } #elif BAR class B { } @@ -1283,8 +1283,8 @@ class C { } public void TestGetDirectivesRelatedToEndIf() { var tree = SyntaxFactory.ParseSyntaxTree( -@"#define FOO -#if FOO +@"#define GOO +#if GOO class A { } #elif BAR class B { } @@ -1311,8 +1311,8 @@ class C { } public void TestGetDirectivesRelatedToIfWithNestedIfEndIF() { var tree = SyntaxFactory.ParseSyntaxTree( -@"#define FOO -#if FOO +@"#define GOO +#if GOO class A { } #if ZED class A1 { } @@ -1345,8 +1345,8 @@ class C { } public void TestGetDirectivesRelatedToIfWithNestedRegionEndRegion() { var tree = SyntaxFactory.ParseSyntaxTree( -@"#define FOO -#if FOO +@"#define GOO +#if GOO class A { } #region some region class A1 { } @@ -1379,8 +1379,8 @@ class C { } public void TestGetDirectivesRelatedToEndIfWithNestedIfEndIf() { var tree = SyntaxFactory.ParseSyntaxTree( -@"#define FOO -#if FOO +@"#define GOO +#if GOO class A { } #if ZED class A1 { } @@ -1410,8 +1410,8 @@ class C { } public void TestGetDirectivesRelatedToEndIfWithNestedRegionEndRegion() { var tree = SyntaxFactory.ParseSyntaxTree( -@"#define FOO -#if FOO +@"#define GOO +#if GOO #region some region class A { } #endregion @@ -1443,7 +1443,7 @@ public void TestGetDirectivesRelatedToRegion() @"#region Some Region class A { } #endregion -#if FOO +#if GOO #endif "); var d = tree.GetCompilationUnitRoot().GetFirstDirective(); @@ -1461,7 +1461,7 @@ public void TestGetDirectivesRelatedToEndRegion() { var tree = SyntaxFactory.ParseSyntaxTree( @" -#if FOO +#if GOO #endif #region Some Region class A { } @@ -1562,12 +1562,12 @@ public void SyntaxNames() var gp = SyntaxFactory.SingletonSeparatedList(SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.IntKeyword))); var externAlias = SyntaxFactory.IdentifierName("alias"); - var foo = SyntaxFactory.IdentifierName("Foo"); + var goo = SyntaxFactory.IdentifierName("Goo"); var bar = SyntaxFactory.IdentifierName("Bar"); - // Foo.Bar - var qualified = SyntaxFactory.QualifiedName(foo, dot, bar); - Assert.Equal("Foo.Bar", qualified.ToString()); + // Goo.Bar + var qualified = SyntaxFactory.QualifiedName(goo, dot, bar); + Assert.Equal("Goo.Bar", qualified.ToString()); Assert.Equal("Bar", qualified.GetUnqualifiedName().Identifier.ValueText); // Bar @@ -1575,29 +1575,29 @@ public void SyntaxNames() Assert.Equal("Bar", generic.ToString()); Assert.Equal("Bar", generic.GetUnqualifiedName().Identifier.ValueText); - // Foo.Bar - var qualifiedGeneric = SyntaxFactory.QualifiedName(foo, dot, generic); - Assert.Equal("Foo.Bar", qualifiedGeneric.ToString()); + // Goo.Bar + var qualifiedGeneric = SyntaxFactory.QualifiedName(goo, dot, generic); + Assert.Equal("Goo.Bar", qualifiedGeneric.ToString()); Assert.Equal("Bar", qualifiedGeneric.GetUnqualifiedName().Identifier.ValueText); - // alias::Foo - var alias = SyntaxFactory.AliasQualifiedName(externAlias, cc, foo); - Assert.Equal("alias::Foo", alias.ToString()); - Assert.Equal("Foo", alias.GetUnqualifiedName().Identifier.ValueText); + // alias::Goo + var alias = SyntaxFactory.AliasQualifiedName(externAlias, cc, goo); + Assert.Equal("alias::Goo", alias.ToString()); + Assert.Equal("Goo", alias.GetUnqualifiedName().Identifier.ValueText); // alias::Bar var aliasGeneric = SyntaxFactory.AliasQualifiedName(externAlias, cc, generic); Assert.Equal("alias::Bar", aliasGeneric.ToString()); Assert.Equal("Bar", aliasGeneric.GetUnqualifiedName().Identifier.ValueText); - // alias::Foo.Bar + // alias::Goo.Bar var aliasQualified = SyntaxFactory.QualifiedName(alias, dot, bar); - Assert.Equal("alias::Foo.Bar", aliasQualified.ToString()); + Assert.Equal("alias::Goo.Bar", aliasQualified.ToString()); Assert.Equal("Bar", aliasQualified.GetUnqualifiedName().Identifier.ValueText); - // alias::Foo.Bar + // alias::Goo.Bar var aliasQualifiedGeneric = SyntaxFactory.QualifiedName(alias, dot, generic); - Assert.Equal("alias::Foo.Bar", aliasQualifiedGeneric.ToString()); + Assert.Equal("alias::Goo.Bar", aliasQualifiedGeneric.ToString()); Assert.Equal("Bar", aliasQualifiedGeneric.GetUnqualifiedName().Identifier.ValueText); } @@ -1645,7 +1645,7 @@ public void ZeroWidthStructuredTrivia() Assert.Equal(0, zeroWidth.Width); // create token with more than one instance of same zero width structured trivia! - var someToken = SyntaxFactory.Identifier(default(SyntaxTriviaList), "foo", SyntaxFactory.TriviaList(SyntaxFactory.Trivia(zeroWidth), SyntaxFactory.Trivia(zeroWidth))); + var someToken = SyntaxFactory.Identifier(default(SyntaxTriviaList), "goo", SyntaxFactory.TriviaList(SyntaxFactory.Trivia(zeroWidth), SyntaxFactory.Trivia(zeroWidth))); // create node with this token var someNode = SyntaxFactory.IdentifierName(someToken); @@ -1719,10 +1719,10 @@ public void TestIncompleteDeclWithDotToken() @" class Test { - int IX.FOO + int IX.GOO "); - // Verify the kind of the CSharpSyntaxNode "int IX.FOO" is MethodDeclaration and NOT FieldDeclaration + // Verify the kind of the CSharpSyntaxNode "int IX.GOO" is MethodDeclaration and NOT FieldDeclaration Assert.Equal(SyntaxKind.MethodDeclaration, tree.GetCompilationUnitRoot().ChildNodesAndTokens()[0].ChildNodesAndTokens()[3].Kind()); } @@ -2049,7 +2049,7 @@ public void ReplaceMissingToken() [Fact] public void ReplaceEndOfCommentToken() { - var text = "/// Foo\r\n return x;"; + var text = "/// Goo\r\n return x;"; var expr = SyntaxFactory.ParseStatement(text); var tokens = expr.DescendantTokens(descendIntoTrivia: true).ToList(); @@ -2058,7 +2058,7 @@ public void ReplaceEndOfCommentToken() var expr2 = expr.ReplaceToken(token, SyntaxFactory.Token(SyntaxTriviaList.Create(SyntaxFactory.Whitespace("garbage")), token.Kind(), default(SyntaxTriviaList))); var text2 = expr2.ToFullString(); - Assert.Equal("/// Foo\r\ngarbage return x;", text2); + Assert.Equal("/// Goo\r\ngarbage return x;", text2); } [Fact] @@ -2163,7 +2163,7 @@ public void TestReplaceSingleTriviaInToken() [Fact] public void TestReplaceMultipleTriviaInToken() { - var id = SyntaxFactory.ParseToken("a // foo\r\n"); + var id = SyntaxFactory.ParseToken("a // goo\r\n"); // replace each trivia with a single space var id2 = id.ReplaceTrivia(id.GetAllTrivia(), (tr, tr2) => SyntaxFactory.Space); @@ -2396,7 +2396,7 @@ class C [Fact] public void SeparatorsOfSeparatedSyntaxLists() { - var s1 = "int foo(int a, int b, int c) {}"; + var s1 = "int goo(int a, int b, int c) {}"; var tree = SyntaxFactory.ParseSyntaxTree(s1); dynamic root = tree.GetCompilationUnitRoot(); @@ -2833,7 +2833,7 @@ static void Main(string[] args) public void TestTriviaExists() { // token constructed using factory w/o specifying trivia (should have zero-width elastic trivia) - var idToken = SyntaxFactory.Identifier("foo"); + var idToken = SyntaxFactory.Identifier("goo"); Assert.Equal(true, idToken.HasLeadingTrivia); Assert.Equal(1, idToken.LeadingTrivia.Count); Assert.Equal(0, idToken.LeadingTrivia.Span.Length); // zero-width elastic trivia @@ -2858,7 +2858,7 @@ public void TestTriviaExists() Assert.Equal(2, idToken.TrailingTrivia.Span.Length); // node constructed using factory w/o specifying trivia - SyntaxNode namedNode = SyntaxFactory.IdentifierName("foo"); + SyntaxNode namedNode = SyntaxFactory.IdentifierName("goo"); Assert.Equal(true, namedNode.HasLeadingTrivia); Assert.Equal(1, namedNode.GetLeadingTrivia().Count); Assert.Equal(0, namedNode.GetLeadingTrivia().Span.Length); // zero-width elastic trivia @@ -2867,14 +2867,14 @@ public void TestTriviaExists() Assert.Equal(0, namedNode.GetTrailingTrivia().Span.Length); // zero-width elastic trivia // node constructed by parse w/o trivia - namedNode = SyntaxFactory.ParseExpression("foo"); + namedNode = SyntaxFactory.ParseExpression("goo"); Assert.Equal(false, namedNode.HasLeadingTrivia); Assert.Equal(0, namedNode.GetLeadingTrivia().Count); Assert.Equal(false, namedNode.HasTrailingTrivia); Assert.Equal(0, namedNode.GetTrailingTrivia().Count); // node constructed by parse with trivia - namedNode = SyntaxFactory.ParseExpression(" foo "); + namedNode = SyntaxFactory.ParseExpression(" goo "); Assert.Equal(true, namedNode.HasLeadingTrivia); Assert.Equal(1, namedNode.GetLeadingTrivia().Count); Assert.Equal(1, namedNode.GetLeadingTrivia().Span.Length); @@ -2883,7 +2883,7 @@ public void TestTriviaExists() Assert.Equal(2, namedNode.GetTrailingTrivia().Span.Length); // nodeOrToken with token constructed from factory w/o specifying trivia - SyntaxNodeOrToken nodeOrToken = SyntaxFactory.Identifier("foo"); + SyntaxNodeOrToken nodeOrToken = SyntaxFactory.Identifier("goo"); Assert.Equal(true, nodeOrToken.HasLeadingTrivia); Assert.Equal(1, nodeOrToken.GetLeadingTrivia().Count); Assert.Equal(0, nodeOrToken.GetLeadingTrivia().Span.Length); // zero-width elastic trivia @@ -2892,7 +2892,7 @@ public void TestTriviaExists() Assert.Equal(0, nodeOrToken.GetTrailingTrivia().Span.Length); // zero-width elastic trivia // nodeOrToken with node constructed from factory w/o specifying trivia - nodeOrToken = SyntaxFactory.IdentifierName("foo"); + nodeOrToken = SyntaxFactory.IdentifierName("goo"); Assert.Equal(true, nodeOrToken.HasLeadingTrivia); Assert.Equal(1, nodeOrToken.GetLeadingTrivia().Count); Assert.Equal(0, nodeOrToken.GetLeadingTrivia().Span.Length); // zero-width elastic trivia @@ -2901,21 +2901,21 @@ public void TestTriviaExists() Assert.Equal(0, nodeOrToken.GetTrailingTrivia().Span.Length); // zero-width elastic trivia // nodeOrToken with token parsed from factory w/o trivia - nodeOrToken = SyntaxFactory.ParseToken("foo"); + nodeOrToken = SyntaxFactory.ParseToken("goo"); Assert.Equal(false, nodeOrToken.HasLeadingTrivia); Assert.Equal(0, nodeOrToken.GetLeadingTrivia().Count); Assert.Equal(false, nodeOrToken.HasTrailingTrivia); Assert.Equal(0, nodeOrToken.GetTrailingTrivia().Count); // nodeOrToken with node parsed from factory w/o trivia - nodeOrToken = SyntaxFactory.ParseExpression("foo"); + nodeOrToken = SyntaxFactory.ParseExpression("goo"); Assert.Equal(false, nodeOrToken.HasLeadingTrivia); Assert.Equal(0, nodeOrToken.GetLeadingTrivia().Count); Assert.Equal(false, nodeOrToken.HasTrailingTrivia); Assert.Equal(0, nodeOrToken.GetTrailingTrivia().Count); // nodeOrToken with token parsed from factory with trivia - nodeOrToken = SyntaxFactory.ParseToken(" foo "); + nodeOrToken = SyntaxFactory.ParseToken(" goo "); Assert.Equal(true, nodeOrToken.HasLeadingTrivia); Assert.Equal(1, nodeOrToken.GetLeadingTrivia().Count); Assert.Equal(1, nodeOrToken.GetLeadingTrivia().Span.Length); // zero-width elastic trivia @@ -2924,7 +2924,7 @@ public void TestTriviaExists() Assert.Equal(2, nodeOrToken.GetTrailingTrivia().Span.Length); // zero-width elastic trivia // nodeOrToken with node parsed from factory with trivia - nodeOrToken = SyntaxFactory.ParseExpression(" foo "); + nodeOrToken = SyntaxFactory.ParseExpression(" goo "); Assert.Equal(true, nodeOrToken.HasLeadingTrivia); Assert.Equal(1, nodeOrToken.GetLeadingTrivia().Count); Assert.Equal(1, nodeOrToken.GetLeadingTrivia().Span.Length); // zero-width elastic trivia @@ -2940,7 +2940,7 @@ public void TestFindTrivia_NoStackOverflowOnLargeExpression() { StringBuilder code = new StringBuilder(); code.Append( -@"class Foo +@"class Goo { void Bar() { diff --git a/src/Compilers/CSharp/Test/Syntax/Syntax/SyntaxNormalizerTests.cs b/src/Compilers/CSharp/Test/Syntax/Syntax/SyntaxNormalizerTests.cs index a677713b7ae08..9a59e599a6544 100644 --- a/src/Compilers/CSharp/Test/Syntax/Syntax/SyntaxNormalizerTests.cs +++ b/src/Compilers/CSharp/Test/Syntax/Syntax/SyntaxNormalizerTests.cs @@ -128,8 +128,8 @@ public void TestNormalizeStatement1() TestNormalizeStatement("{;;}", "{\r\n ;\r\n ;\r\n}"); // labelled statements - TestNormalizeStatement("foo:;", "foo:\r\n ;"); - TestNormalizeStatement("foo:a;", "foo:\r\n a;"); + TestNormalizeStatement("goo:;", "goo:\r\n ;"); + TestNormalizeStatement("goo:a;", "goo:\r\n a;"); // return/goto TestNormalizeStatement("return;", "return;"); @@ -153,11 +153,11 @@ public void TestNormalizeStatement1() TestNormalizeStatement("switch(a){case b:{c();}}", "switch (a)\r\n{\r\n case b:\r\n {\r\n c();\r\n }\r\n}"); // curlies - TestNormalizeStatement("{if(foo){}if(bar){}}", "{\r\n if (foo)\r\n {\r\n }\r\n\r\n if (bar)\r\n {\r\n }\r\n}"); + TestNormalizeStatement("{if(goo){}if(bar){}}", "{\r\n if (goo)\r\n {\r\n }\r\n\r\n if (bar)\r\n {\r\n }\r\n}"); // Queries TestNormalizeStatement("int i=from v in vals select v;", "int i =\r\n from v in vals\r\n select v;"); - TestNormalizeStatement("Foo(from v in vals select v);", "Foo(\r\n from v in vals\r\n select v);"); + TestNormalizeStatement("Goo(from v in vals select v);", "Goo(\r\n from v in vals\r\n select v);"); TestNormalizeStatement("int i=from v in vals select from x in xxx where x > 10 select x;", "int i =\r\n from v in vals\r\n select\r\n from x in xxx\r\n where x > 10\r\n select x;"); TestNormalizeStatement("int i=from v in vals group v by x into g where g > 10 select g;", "int i =\r\n from v in vals\r\n group v by x into g\r\n where g > 10\r\n select g;"); @@ -303,12 +303,12 @@ public void TestNormalizeComments() TestNormalizeStatement("{\r\n//a\r\n}", "{\r\n//a\r\n}"); TestNormalizeStatement("{\r\n//a\r\nb}", "{\r\n //a\r\n b\r\n}"); TestNormalizeStatement("{\r\n/*a*/b}", "{\r\n /*a*/\r\n b\r\n}"); - TestNormalizeStatement("{\r\n/// \r\na}", "{\r\n /// \r\n a\r\n}"); - TestNormalizeStatement("{\r\n///\r\na}", "{\r\n ///\r\n a\r\n}"); - TestNormalizeStatement("{\r\n/// \r\n/// \r\na}", "{\r\n /// \r\n /// \r\n a\r\n}"); - TestNormalizeToken("/// \r\n/// \r\na", "/// \r\n/// \r\na"); - TestNormalizeStatement("{\r\n/*** ***/\r\na}", "{\r\n /*** ***/\r\n a\r\n}"); - TestNormalizeStatement("{\r\n/*** \r\n ***/\r\na}", "{\r\n /*** \r\n ***/\r\n a\r\n}"); + TestNormalizeStatement("{\r\n/// \r\na}", "{\r\n /// \r\n a\r\n}"); + TestNormalizeStatement("{\r\n///\r\na}", "{\r\n ///\r\n a\r\n}"); + TestNormalizeStatement("{\r\n/// \r\n/// \r\na}", "{\r\n /// \r\n /// \r\n a\r\n}"); + TestNormalizeToken("/// \r\n/// \r\na", "/// \r\n/// \r\na"); + TestNormalizeStatement("{\r\n/*** ***/\r\na}", "{\r\n /*** ***/\r\n a\r\n}"); + TestNormalizeStatement("{\r\n/*** \r\n ***/\r\na}", "{\r\n /*** \r\n ***/\r\n a\r\n}"); } private void TestNormalizeToken(string text, string expected) @@ -339,17 +339,17 @@ public void TestNormalizePreprocessorDirectives() SyntaxFactory.EndIfDirectiveTrivia(false))), "#if a\r\n#endif\r\n"); - TestNormalizeTrivia("#endregion foo", "#endregion foo\r\n"); + TestNormalizeTrivia("#endregion goo", "#endregion goo\r\n"); TestNormalizeDeclaration( @"#pragma warning disable 123 -namespace foo { +namespace goo { } #pragma warning restore 123", @"#pragma warning disable 123 -namespace foo +namespace goo { } #pragma warning restore 123 @@ -387,8 +387,8 @@ public void TestNormalizeLineDirectiveTrivia() public void TestNormalizeWithinDirectives() { TestNormalizeDeclaration( -"class C\r\n{\r\n#if true\r\nvoid Foo(A x) { }\r\n#else\r\n#endif\r\n}\r\n", -"class C\r\n{\r\n#if true\r\n void Foo(A x)\r\n {\r\n }\r\n#else\r\n#endif\r\n}"); +"class C\r\n{\r\n#if true\r\nvoid Goo(A x) { }\r\n#else\r\n#endif\r\n}\r\n", +"class C\r\n{\r\n#if true\r\n void Goo(A x)\r\n {\r\n }\r\n#else\r\n#endif\r\n}"); } [WorkItem(542887, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542887")] @@ -398,7 +398,7 @@ public void TestFormattingForBlockSyntax() var code = @"class c1 { -void foo() +void goo() { { int i = 1; @@ -409,7 +409,7 @@ void foo() TestNormalize(tree.GetCompilationUnitRoot(), @"class c1 { - void foo() + void goo() { { int i = 1; @@ -428,7 +428,7 @@ public void TestNormalizeDocumentationComments() /// /// A documentation comment /// - void foo() + void goo() { } }"; @@ -441,7 +441,7 @@ void foo() $" ///{Environment.NewLine}" + $" /// A documentation comment{Environment.NewLine}" + $" ///{Environment.NewLine}" + -" void foo()\r\n" + +" void goo()\r\n" + " {\r\n" + " }\r\n" + "}"); @@ -456,7 +456,7 @@ public void TestNormalizeDocumentationComments2() /// /// A documentation comment /// - void foo() + void goo() { } }"; @@ -468,7 +468,7 @@ void foo() $" /// {Environment.NewLine}" + $" /// A documentation comment{Environment.NewLine}" + $" /// {Environment.NewLine}" + -" void foo()\r\n" + +" void goo()\r\n" + " {\r\n" + " }\r\n" + "}"); diff --git a/src/Compilers/CSharp/Test/Syntax/Syntax/SyntaxTests.cs b/src/Compilers/CSharp/Test/Syntax/Syntax/SyntaxTests.cs index 905478fd6e937..8f5823d9b120e 100644 --- a/src/Compilers/CSharp/Test/Syntax/Syntax/SyntaxTests.cs +++ b/src/Compilers/CSharp/Test/Syntax/Syntax/SyntaxTests.cs @@ -43,14 +43,14 @@ public void TextIsCompleteSubmission() AssertIncompleteSubmission("using X; /*"); AssertIncompleteSubmission(@" -void foo() +void goo() { #if F } "); AssertIncompleteSubmission(@" -void foo() +void goo() { #region R } @@ -81,28 +81,28 @@ void foo() // invalid escape sequence in a string AssertCompleteSubmission("\"\\q\""); - AssertIncompleteSubmission("void foo("); - AssertIncompleteSubmission("void foo()"); - AssertIncompleteSubmission("void foo() {"); - AssertCompleteSubmission("void foo() {}"); - AssertCompleteSubmission("void foo() { int a = 1 }"); - - AssertIncompleteSubmission("int foo {"); - AssertCompleteSubmission("int foo { }"); - AssertCompleteSubmission("int foo { get }"); - - AssertIncompleteSubmission("enum foo {"); - AssertCompleteSubmission("enum foo {}"); - AssertCompleteSubmission("enum foo { a = }"); - AssertIncompleteSubmission("class foo {"); - AssertCompleteSubmission("class foo {}"); - AssertCompleteSubmission("class foo { void }"); - AssertIncompleteSubmission("struct foo {"); - AssertCompleteSubmission("struct foo {}"); - AssertCompleteSubmission("[A struct foo {}"); - AssertIncompleteSubmission("interface foo {"); - AssertCompleteSubmission("interface foo {}"); - AssertCompleteSubmission("interface foo : {}"); + AssertIncompleteSubmission("void goo("); + AssertIncompleteSubmission("void goo()"); + AssertIncompleteSubmission("void goo() {"); + AssertCompleteSubmission("void goo() {}"); + AssertCompleteSubmission("void goo() { int a = 1 }"); + + AssertIncompleteSubmission("int goo {"); + AssertCompleteSubmission("int goo { }"); + AssertCompleteSubmission("int goo { get }"); + + AssertIncompleteSubmission("enum goo {"); + AssertCompleteSubmission("enum goo {}"); + AssertCompleteSubmission("enum goo { a = }"); + AssertIncompleteSubmission("class goo {"); + AssertCompleteSubmission("class goo {}"); + AssertCompleteSubmission("class goo { void }"); + AssertIncompleteSubmission("struct goo {"); + AssertCompleteSubmission("struct goo {}"); + AssertCompleteSubmission("[A struct goo {}"); + AssertIncompleteSubmission("interface goo {"); + AssertCompleteSubmission("interface goo {}"); + AssertCompleteSubmission("interface goo : {}"); AssertCompleteSubmission("partial"); AssertIncompleteSubmission("partial class"); diff --git a/src/Compilers/CSharp/Test/WinRT/AnonymousTypesSymbolTests.cs b/src/Compilers/CSharp/Test/WinRT/AnonymousTypesSymbolTests.cs index a2bea4e8a707b..60bb6fe1e5c61 100644 --- a/src/Compilers/CSharp/Test/WinRT/AnonymousTypesSymbolTests.cs +++ b/src/Compilers/CSharp/Test/WinRT/AnonymousTypesSymbolTests.cs @@ -100,10 +100,10 @@ class Program { static void Main(string[] args) { - Console.WriteLine(Foo()()); + Console.WriteLine(Goo()()); } - static Func Foo() + static Func Goo() { T x2 = default(T); return (Func) (() => new { x2 }); @@ -125,10 +125,10 @@ class Program { static void Main(string[] args) { - Console.WriteLine(Foo()()); + Console.WriteLine(Goo()()); } - static Func Foo() + static Func Goo() { T x2 = default(T); Func x3 = () => new { x2 }; @@ -151,12 +151,12 @@ class Program { static void Main(string[] args) { - Console.WriteLine(Foo()); - Console.WriteLine(Foo()); - Console.WriteLine(Foo()); + Console.WriteLine(Goo()); + Console.WriteLine(Goo()); + Console.WriteLine(Goo()); } - static object Foo() + static object Goo() { T x2 = default(T); return new { x2 }; @@ -182,13 +182,13 @@ class Program { static void Main(string[] args) { - foreach(var x in Foo()) + foreach(var x in Goo()) { Console.Write(x); } } - static IEnumerable Foo() + static IEnumerable Goo() { T x2 = default(T); yield return new { x2 }.ToString(); @@ -211,10 +211,10 @@ class Program { static void Main(string[] args) { - Console.WriteLine(Foo()()); + Console.WriteLine(Goo()()); } - static Func Foo() + static Func Goo() { T x2 = default(T); return (Func) (() => new { }); diff --git a/src/Compilers/CSharp/Test/WinRT/Metadata/WinMdEventTests.cs b/src/Compilers/CSharp/Test/WinRT/Metadata/WinMdEventTests.cs index 9f164c6aa6cae..c064345d674cb 100644 --- a/src/Compilers/CSharp/Test/WinRT/Metadata/WinMdEventTests.cs +++ b/src/Compilers/CSharp/Test/WinRT/Metadata/WinMdEventTests.cs @@ -2474,20 +2474,20 @@ public void WinMdEventLambda() using Windows.ApplicationModel; public class abcdef{ - public void foo(){ + public void goo(){ Application x = null; x.Suspending += (object sender, SuspendingEventArgs e) => {}; } public static void Main(){ var a = new abcdef(); - a.foo(); + a.goo(); } } "; var cv = this.CompileAndVerifyOnWin8Only(text); - cv.VerifyIL("abcdef.foo()", @" + cv.VerifyIL("abcdef.goo()", @" { // Code size 65 (0x41) .maxstack 4 @@ -2507,7 +2507,7 @@ .locals init (Windows.UI.Xaml.Application V_0) IL_0022: brtrue.s IL_003b IL_0024: pop IL_0025: ldsfld ""abcdef.<>c abcdef.<>c.<>9"" - IL_002a: ldftn ""void abcdef.<>c.b__0_0(object, Windows.ApplicationModel.SuspendingEventArgs)"" + IL_002a: ldftn ""void abcdef.<>c.b__0_0(object, Windows.ApplicationModel.SuspendingEventArgs)"" IL_0030: newobj ""Windows.UI.Xaml.SuspendingEventHandler..ctor(object, System.IntPtr)"" IL_0035: dup IL_0036: stsfld ""Windows.UI.Xaml.SuspendingEventHandler abcdef.<>c.<>9__0_0"" @@ -2533,7 +2533,7 @@ private void OnSuspending(object sender, SuspendingEventArgs e) { } - public void foo(){ + public void goo(){ Application x = null; x.Suspending += OnSuspending; x.Suspending -= OnSuspending; @@ -2541,7 +2541,7 @@ public void foo(){ public static void Main(){ var a = new abcdef(); - a.foo(); + a.goo(); } } "; @@ -2578,7 +2578,7 @@ .locals init (Windows.UI.Xaml.Application V_0) IL_004b: ret } "; - cv.VerifyIL("abcdef.foo()", ExpectedIl); + cv.VerifyIL("abcdef.goo()", ExpectedIl); } /// @@ -2598,20 +2598,20 @@ private void OnSuspending(object sender, SuspendingEventArgs e) private Application getApplication(){return null;} - public void foo(){ + public void goo(){ getApplication().Suspending += OnSuspending; getApplication().Suspending -= OnSuspending; } public static void Main(){ var a = new abcdef(); - a.foo(); + a.goo(); } }"; var cv = this.CompileAndVerifyOnWin8Only(text); - cv.VerifyIL("abcdef.foo()", @" + cv.VerifyIL("abcdef.goo()", @" { // Code size 86 (0x56) .maxstack 4 diff --git a/src/Compilers/CSharp/Test/WinRT/PdbTests.cs b/src/Compilers/CSharp/Test/WinRT/PdbTests.cs index 84386be7b3ace..41dc50bcd4978 100644 --- a/src/Compilers/CSharp/Test/WinRT/PdbTests.cs +++ b/src/Compilers/CSharp/Test/WinRT/PdbTests.cs @@ -48,9 +48,9 @@ public void EmitToMemoryStreams() Assert.True(result.Success); result = comp.Emit(output, options: EmitOptions.Default.WithHighEntropyVirtualAddressSpace(true)); Assert.True(result.Success); - result = comp.Emit(output, options: EmitOptions.Default.WithOutputNameOverride("foo")); + result = comp.Emit(output, options: EmitOptions.Default.WithOutputNameOverride("goo")); Assert.True(result.Success); - result = comp.Emit(output, options: EmitOptions.Default.WithPdbFilePath("foo.pdb")); + result = comp.Emit(output, options: EmitOptions.Default.WithPdbFilePath("goo.pdb")); Assert.True(result.Success); } } diff --git a/src/Compilers/Core/CodeAnalysisTest/AnalyzerFileReferenceTests.cs b/src/Compilers/Core/CodeAnalysisTest/AnalyzerFileReferenceTests.cs index 1cda80bbed3d3..504fb447396d2 100644 --- a/src/Compilers/Core/CodeAnalysisTest/AnalyzerFileReferenceTests.cs +++ b/src/Compilers/Core/CodeAnalysisTest/AnalyzerFileReferenceTests.cs @@ -263,10 +263,10 @@ private static Assembly OnResolve(object sender, ResolveEventArgs e) public void BadAnalyzerReference_DisplayName() { var directory = Temp.CreateDirectory(); - var textFile = directory.CreateFile("Foo.txt").WriteAllText("I am the very model of a modern major general."); + var textFile = directory.CreateFile("Goo.txt").WriteAllText("I am the very model of a modern major general."); AnalyzerFileReference reference = CreateAnalyzerFileReference(textFile.Path); - Assert.Equal(expected: "Foo", actual: reference.Display); + Assert.Equal(expected: "Goo", actual: reference.Display); } [Fact] @@ -300,10 +300,10 @@ public void ValidAnalyzerReference_Id() public void BadAnalyzerReference_Id() { var directory = Temp.CreateDirectory(); - var textFile = directory.CreateFile("Foo.txt").WriteAllText("I am the very model of a modern major general."); + var textFile = directory.CreateFile("Goo.txt").WriteAllText("I am the very model of a modern major general."); AnalyzerFileReference reference = CreateAnalyzerFileReference(textFile.Path); - Assert.Equal(expected: "Foo", actual: reference.Id); + Assert.Equal(expected: "Goo", actual: reference.Id); } [Fact] diff --git a/src/Compilers/Core/CodeAnalysisTest/CachingLookupTests.cs b/src/Compilers/Core/CodeAnalysisTest/CachingLookupTests.cs index 6955803bc6643..a7532817d8baa 100644 --- a/src/Compilers/Core/CodeAnalysisTest/CachingLookupTests.cs +++ b/src/Compilers/Core/CodeAnalysisTest/CachingLookupTests.cs @@ -104,7 +104,7 @@ private void CompareLookups1(ILookup look1, CachingDictionary - + @@ -444,7 +444,7 @@ public void TestRuleSetInclude() var ruleSet = ParseRuleSet(source); Assert.True(ruleSet.Includes.Count() == 1); Assert.Equal(ruleSet.Includes.First().Action, ReportDiagnostic.Default); - Assert.Equal(ruleSet.Includes.First().IncludePath, "foo.ruleset"); + Assert.Equal(ruleSet.Includes.First().IncludePath, "goo.ruleset"); } #pragma warning disable CA2243 // Attribute string literals should parse correctly @@ -455,7 +455,7 @@ public void TestRuleSetInclude1() { string source = @" - + diff --git a/src/Compilers/Core/CodeAnalysisTest/CommonTypedConstantTests.cs b/src/Compilers/Core/CodeAnalysisTest/CommonTypedConstantTests.cs index 9c84af3f75fed..1be57f07d6043 100644 --- a/src/Compilers/Core/CodeAnalysisTest/CommonTypedConstantTests.cs +++ b/src/Compilers/Core/CodeAnalysisTest/CommonTypedConstantTests.cs @@ -37,8 +37,8 @@ public void Equality() new TypedConstant(_intType, TypedConstantKind.Primitive, 1), new TypedConstant(_intType, TypedConstantKind.Primitive, 1)); - var s1 = "foo"; - var s2 = String.Format("{0}{1}{1}", "f", "o"); + var s1 = "goo"; + var s2 = String.Format("{0}{1}{1}", "g", "o"); EqualityTesting.AssertEqual( new TypedConstant(_stringType, TypedConstantKind.Primitive, s1), diff --git a/src/Compilers/Core/CodeAnalysisTest/Diagnostics/SuppressMessageTargetSymbolResolverTests.cs b/src/Compilers/Core/CodeAnalysisTest/Diagnostics/SuppressMessageTargetSymbolResolverTests.cs index 9f37dc289f448..a75e37282e4de 100644 --- a/src/Compilers/Core/CodeAnalysisTest/Diagnostics/SuppressMessageTargetSymbolResolverTests.cs +++ b/src/Compilers/Core/CodeAnalysisTest/Diagnostics/SuppressMessageTargetSymbolResolverTests.cs @@ -59,26 +59,26 @@ End Namespace public void TestResolveNamespaceWithSameNameAsGenericInterface1() { VerifyNamespaceResolution(@" -namespace $$IFoo +namespace $$IGoo { } -interface IFoo +interface IGoo { } ", - LanguageNames.CSharp, false, "IFoo"); + LanguageNames.CSharp, false, "IGoo"); } [Fact] public void TestResolveNamespaceWithSameNameAsGenericInterface2() { VerifyNamespaceResolution(@" -Namespace $$IFoo +Namespace $$IGoo End Namespace -Interface IFoo(Of T) +Interface IGoo(Of T) End Interface ", - LanguageNames.VisualBasic, false, "IFoo"); + LanguageNames.VisualBasic, false, "IGoo"); } [Fact] @@ -522,14 +522,14 @@ public void TestResolveVoidMethod1() VerifyMemberResolution(@" class C { - void Foo() {} - void $$Foo(int x) {} - void Foo(string x) {} + void Goo() {} + void $$Goo(int x) {} + void Goo(string x) {} } ", LanguageNames.CSharp, false, - "C.#Foo(System.Int32)", - "C.Foo(System.Int32):System.Void"); + "C.#Goo(System.Int32)", + "C.Goo(System.Int32):System.Void"); } [Fact] @@ -537,17 +537,17 @@ public void TestResolveVoidMethod2() { VerifyMemberResolution(@" Class C - Sub Foo() + Sub Goo() End Sub - Sub $$Foo(ByVal x as Integer) + Sub $$Goo(ByVal x as Integer) End Sub - Sub Foo(ByVal x as String) + Sub Goo(ByVal x as String) End Sub End Class ", LanguageNames.VisualBasic, false, - "C.#Foo(System.Int32)", - "C.Foo(System.Int32):System.Void"); + "C.#Goo(System.Int32)", + "C.Goo(System.Int32):System.Void"); } [Fact] @@ -556,14 +556,14 @@ public void TestResolveMethod1() VerifyMemberResolution(@" class C { - void Foo() {} - string Foo(int x) {} - string $$Foo(string x) {} + void Goo() {} + string Goo(int x) {} + string $$Goo(string x) {} } ", LanguageNames.CSharp, false, - "C.#Foo(System.String)", - "C.Foo(System.String):System.String"); + "C.#Goo(System.String)", + "C.Goo(System.String):System.String"); } [Fact] @@ -571,17 +571,17 @@ public void TestResolveMethod2() { VerifyMemberResolution(@" Class C - Sub Foo() + Sub Goo() End Sub - Function Foo(ByVal x As Integer) As String + Function Goo(ByVal x As Integer) As String End Function - Function $$Foo(ByVal x As String) As String + Function $$Goo(ByVal x As String) As String End Function End Class ", LanguageNames.VisualBasic, false, - "C.#Foo(System.String)", - "C.Foo(System.String):System.String"); + "C.#Goo(System.String)", + "C.Goo(System.String):System.String"); } [Fact] @@ -590,22 +590,22 @@ public void TestResolveOverloadedGenericMethod1() VerifyMemberResolution(@" class C { - int Foo(T x) {} - int $$Foo(T x, params T[] y) {} + int Goo(T x) {} + int $$Goo(T x, params T[] y) {} } ", LanguageNames.CSharp, false, - "C.#Foo`1(!!0,!!0[])", - "C.Foo(T,T[]):System.Int32"); + "C.#Goo`1(!!0,!!0[])", + "C.Goo(T,T[]):System.Int32"); VerifyMemberResolution(@" class C { - int [|Foo|](T x) {} - int [|Foo|](T x, T y) {} + int [|Goo|](T x) {} + int [|Goo|](T x, T y) {} } ", - LanguageNames.CSharp, false, "C.Foo():System.Int32"); + LanguageNames.CSharp, false, "C.Goo():System.Int32"); } [Fact] @@ -613,25 +613,25 @@ public void TestResolveOverloadedGenericMethod2() { VerifyMemberResolution(@" Class C - Function Foo(Of T)(ByVal x As T) As Integer + Function Goo(Of T)(ByVal x As T) As Integer End Function - Function $$Foo(Of T)(ByVal x As T, ByVal y as T()) As Integer + Function $$Goo(Of T)(ByVal x As T, ByVal y as T()) As Integer End Function End Class ", LanguageNames.VisualBasic, false, - "C.#Foo`1(!!0,!!0[])", - "C.Foo(T,T[]):System.Int32"); + "C.#Goo`1(!!0,!!0[])", + "C.Goo(T,T[]):System.Int32"); VerifyMemberResolution(@" Class C - Function [|Foo|](Of T)(ByVal x As T) As Integer + Function [|Goo|](Of T)(ByVal x As T) As Integer End Function - Function [|Foo|](Of T)(ByVal x As T, ByVal y As T) As Integer + Function [|Goo|](Of T)(ByVal x As T, ByVal y As T) As Integer End Function End Class ", - LanguageNames.VisualBasic, false, "C.Foo():System.Int32"); + LanguageNames.VisualBasic, false, "C.Goo():System.Int32"); } [Fact] @@ -1138,15 +1138,15 @@ public void TestResolveMethodIgnoresConvention1() VerifyMemberResolution(@" class C { - string $$Foo(string x) {} + string $$Goo(string x) {} } ", LanguageNames.CSharp, false, - "C.#[vararg]Foo(System.String)", - "C.#[cdecl]Foo(System.String)", - "C.#[fastcall]Foo(System.String)", - "C.#[stdcall]Foo(System.String)", - "C.#[thiscall]Foo(System.String)"); + "C.#[vararg]Goo(System.String)", + "C.#[cdecl]Goo(System.String)", + "C.#[fastcall]Goo(System.String)", + "C.#[stdcall]Goo(System.String)", + "C.#[thiscall]Goo(System.String)"); } [Fact] @@ -1154,16 +1154,16 @@ public void TestResolveMethodIgnoresConvention2() { VerifyMemberResolution(@" Class C - Private Function $$Foo(x As String) As String + Private Function $$Goo(x As String) As String End Function End Class ", LanguageNames.VisualBasic, false, - "C.#[vararg]Foo(System.String)", - "C.#[cdecl]Foo(System.String)", - "C.#[fastcall]Foo(System.String)", - "C.#[stdcall]Foo(System.String)", - "C.#[thiscall]Foo(System.String)"); + "C.#[vararg]Goo(System.String)", + "C.#[cdecl]Goo(System.String)", + "C.#[fastcall]Goo(System.String)", + "C.#[stdcall]Goo(System.String)", + "C.#[thiscall]Goo(System.String)"); } [Fact] diff --git a/src/Compilers/Core/CodeAnalysisTest/FileLinePositionSpanTests.cs b/src/Compilers/Core/CodeAnalysisTest/FileLinePositionSpanTests.cs index ba360b233b2e9..935e63aec26e4 100644 --- a/src/Compilers/Core/CodeAnalysisTest/FileLinePositionSpanTests.cs +++ b/src/Compilers/Core/CodeAnalysisTest/FileLinePositionSpanTests.cs @@ -15,14 +15,14 @@ public void Equality1() EqualityUtil.RunAll( (left, right) => object.Equals(left, right), (left, right) => !object.Equals(left, right), - EqualityUnit.Create(new FileLinePositionSpan("C:\\foo.cs", new LinePosition(1, 2), new LinePosition(3, 5))) - .WithNotEqualValues(new FileLinePositionSpan("C:\\Foo.cs", new LinePosition(1, 2), new LinePosition(3, 5))), - EqualityUnit.Create(new FileLinePositionSpan("C:\\foo.cs", new LinePosition(1, 2), new LinePosition(3, 5))) + EqualityUnit.Create(new FileLinePositionSpan("C:\\goo.cs", new LinePosition(1, 2), new LinePosition(3, 5))) + .WithNotEqualValues(new FileLinePositionSpan("C:\\Goo.cs", new LinePosition(1, 2), new LinePosition(3, 5))), + EqualityUnit.Create(new FileLinePositionSpan("C:\\goo.cs", new LinePosition(1, 2), new LinePosition(3, 5))) .WithNotEqualValues(new FileLinePositionSpan("C:\\bar.cs", new LinePosition(1, 2), new LinePosition(3, 5))), - EqualityUnit.Create(new FileLinePositionSpan("C:\\foo.cs", new LinePosition(1, 2), new LinePosition(3, 5))) - .WithNotEqualValues(new FileLinePositionSpan("C:\\foo.cs", new LinePosition(1, 4), new LinePosition(3, 5))), - EqualityUnit.Create(new FileLinePositionSpan("C:\\foo.cs", new LinePosition(1, 2), new LinePosition(3, 5))) - .WithNotEqualValues(new FileLinePositionSpan("C:\\foo.cs", new LinePosition(1, 2), new LinePosition(4, 5)))); + EqualityUnit.Create(new FileLinePositionSpan("C:\\goo.cs", new LinePosition(1, 2), new LinePosition(3, 5))) + .WithNotEqualValues(new FileLinePositionSpan("C:\\goo.cs", new LinePosition(1, 4), new LinePosition(3, 5))), + EqualityUnit.Create(new FileLinePositionSpan("C:\\goo.cs", new LinePosition(1, 2), new LinePosition(3, 5))) + .WithNotEqualValues(new FileLinePositionSpan("C:\\goo.cs", new LinePosition(1, 2), new LinePosition(4, 5)))); } [Fact] @@ -39,14 +39,14 @@ public void Ctor1() typeof(ArgumentException), () => { - var notUsed = new FileLinePositionSpan("C:\\foo.cs", new LinePosition(3, 2), new LinePosition(2, 4)); + var notUsed = new FileLinePositionSpan("C:\\goo.cs", new LinePosition(3, 2), new LinePosition(2, 4)); }); Assert.Throws( typeof(ArgumentException), () => { - var notUsed = new FileLinePositionSpan("C:\\foo.cs", new LinePosition(1, 2), new LinePosition(1, 1)); + var notUsed = new FileLinePositionSpan("C:\\goo.cs", new LinePosition(1, 2), new LinePosition(1, 1)); }); } @@ -60,12 +60,12 @@ public void Ctor1() [Fact] public void SaneHashCode() { - var hash1 = new FileLinePositionSpan("C:\\foo.cs", new LinePosition(1, 2), new LinePosition(3, 5)).GetHashCode(); - var hash2 = new FileLinePositionSpan("C:\\foo1.cs", new LinePosition(1, 2), new LinePosition(3, 5)).GetHashCode(); - var hash3 = new FileLinePositionSpan("C:\\foo.cs", new LinePosition(1, 3), new LinePosition(3, 5)).GetHashCode(); - var hash4 = new FileLinePositionSpan("C:\\foo.cs", new LinePosition(1, 2), new LinePosition(6, 5)).GetHashCode(); - var hash5 = new FileLinePositionSpan("C:\\foo.cs", new LinePosition(2, 2), new LinePosition(6, 5)).GetHashCode(); - var hash6 = new FileLinePositionSpan("C:\\foo.cs", new LinePosition(2, 2), new LinePosition(6, 8)).GetHashCode(); + var hash1 = new FileLinePositionSpan("C:\\goo.cs", new LinePosition(1, 2), new LinePosition(3, 5)).GetHashCode(); + var hash2 = new FileLinePositionSpan("C:\\goo1.cs", new LinePosition(1, 2), new LinePosition(3, 5)).GetHashCode(); + var hash3 = new FileLinePositionSpan("C:\\goo.cs", new LinePosition(1, 3), new LinePosition(3, 5)).GetHashCode(); + var hash4 = new FileLinePositionSpan("C:\\goo.cs", new LinePosition(1, 2), new LinePosition(6, 5)).GetHashCode(); + var hash5 = new FileLinePositionSpan("C:\\goo.cs", new LinePosition(2, 2), new LinePosition(6, 5)).GetHashCode(); + var hash6 = new FileLinePositionSpan("C:\\goo.cs", new LinePosition(2, 2), new LinePosition(6, 8)).GetHashCode(); Assert.NotEqual(hash1, hash2); Assert.NotEqual(hash1, hash3); @@ -79,9 +79,9 @@ public void SaneHashCode() [Fact] public void TestToString() { - Assert.Equal("C:\\foo.cs: (1,2)-(3,5)", new FileLinePositionSpan("C:\\foo.cs", new LinePosition(1, 2), new LinePosition(3, 5)).ToString()); - Assert.Equal("\\server\foo.vb: (1,2)-(3,5)", new FileLinePositionSpan("\\server\foo.vb", new LinePosition(1, 2), new LinePosition(3, 5)).ToString()); - Assert.Equal("~\foo.huh: (1,2)-(3,5)", new FileLinePositionSpan("~\foo.huh", new LinePosition(1, 2), new LinePosition(3, 5)).ToString()); + Assert.Equal("C:\\goo.cs: (1,2)-(3,5)", new FileLinePositionSpan("C:\\goo.cs", new LinePosition(1, 2), new LinePosition(3, 5)).ToString()); + Assert.Equal("\\server\\goo.vb: (1,2)-(3,5)", new FileLinePositionSpan("\\server\\goo.vb", new LinePosition(1, 2), new LinePosition(3, 5)).ToString()); + Assert.Equal("~\\goo.huh: (1,2)-(3,5)", new FileLinePositionSpan("~\\goo.huh", new LinePosition(1, 2), new LinePosition(3, 5)).ToString()); } } } diff --git a/src/Compilers/Core/CodeAnalysisTest/FileSystem/PathUtilitiesTests.cs b/src/Compilers/Core/CodeAnalysisTest/FileSystem/PathUtilitiesTests.cs index ff9d3addbbcb4..c7e3883299996 100644 --- a/src/Compilers/Core/CodeAnalysisTest/FileSystem/PathUtilitiesTests.cs +++ b/src/Compilers/Core/CodeAnalysisTest/FileSystem/PathUtilitiesTests.cs @@ -23,8 +23,8 @@ private void TestGetDirectoryNameAndCompareToDotnet(string expectedDirectoryName [Fact] public void TestGetDirectoryName_WindowsPaths_Absolute() { - TestGetDirectoryNameAndCompareToDotnet(@"C:\temp", @"C:\temp\foo.txt"); - TestGetDirectoryNameAndCompareToDotnet(@"C:\temp", @"C:\temp\foo"); + TestGetDirectoryNameAndCompareToDotnet(@"C:\temp", @"C:\temp\goo.txt"); + TestGetDirectoryNameAndCompareToDotnet(@"C:\temp", @"C:\temp\goo"); TestGetDirectoryNameAndCompareToDotnet(@"C:\temp", @"C:\temp\"); TestGetDirectoryNameAndCompareToDotnet(@"C:\", @"C:\temp"); TestGetDirectoryNameAndCompareToDotnet(null, @"C:\"); @@ -41,12 +41,12 @@ public void TestGetDirectoryName_WindowsPaths_Absolute() [Fact] public void TestGetDirectoryName_WindowsPaths_Relative() { - TestGetDirectoryNameAndCompareToDotnet(@"foo\temp", @"foo\temp\foo.txt"); - TestGetDirectoryNameAndCompareToDotnet(@"foo\temp", @"foo\temp\foo"); - TestGetDirectoryNameAndCompareToDotnet(@"foo\temp", @"foo\temp\"); - TestGetDirectoryNameAndCompareToDotnet(@"foo", @"foo\temp"); - TestGetDirectoryNameAndCompareToDotnet(@"foo", @"foo\"); - TestGetDirectoryNameAndCompareToDotnet("", @"foo"); + TestGetDirectoryNameAndCompareToDotnet(@"goo\temp", @"goo\temp\goo.txt"); + TestGetDirectoryNameAndCompareToDotnet(@"goo\temp", @"goo\temp\goo"); + TestGetDirectoryNameAndCompareToDotnet(@"goo\temp", @"goo\temp\"); + TestGetDirectoryNameAndCompareToDotnet(@"goo", @"goo\temp"); + TestGetDirectoryNameAndCompareToDotnet(@"goo", @"goo\"); + TestGetDirectoryNameAndCompareToDotnet("", @"goo"); } [Fact] @@ -54,11 +54,11 @@ public void TestGetDirectoryName_UnixPaths_Absolute() { Assert.Equal( @"/temp", - PathUtilities.GetDirectoryName(@"/temp/foo.txt", isUnixLike: true)); + PathUtilities.GetDirectoryName(@"/temp/goo.txt", isUnixLike: true)); Assert.Equal( @"/temp", - PathUtilities.GetDirectoryName(@"/temp/foo", isUnixLike: true)); + PathUtilities.GetDirectoryName(@"/temp/goo", isUnixLike: true)); Assert.Equal( @"/temp", @@ -85,28 +85,28 @@ public void TestGetDirectoryName_UnixPaths_Absolute() public void TestGetDirectoryName_UnixPaths_Relative() { Assert.Equal( - @"foo/temp", - PathUtilities.GetDirectoryName(@"foo/temp/foo.txt", isUnixLike: true)); + @"goo/temp", + PathUtilities.GetDirectoryName(@"goo/temp/goo.txt", isUnixLike: true)); Assert.Equal( - @"foo/temp", - PathUtilities.GetDirectoryName(@"foo/temp/foo", isUnixLike: true)); + @"goo/temp", + PathUtilities.GetDirectoryName(@"goo/temp/goo", isUnixLike: true)); Assert.Equal( - @"foo/temp", - PathUtilities.GetDirectoryName(@"foo/temp/", isUnixLike: true)); + @"goo/temp", + PathUtilities.GetDirectoryName(@"goo/temp/", isUnixLike: true)); Assert.Equal( - @"foo", - PathUtilities.GetDirectoryName(@"foo/temp", isUnixLike: true)); + @"goo", + PathUtilities.GetDirectoryName(@"goo/temp", isUnixLike: true)); Assert.Equal( - @"foo", - PathUtilities.GetDirectoryName(@"foo/", isUnixLike: true)); + @"goo", + PathUtilities.GetDirectoryName(@"goo/", isUnixLike: true)); Assert.Equal( "", - PathUtilities.GetDirectoryName(@"foo", isUnixLike: true)); + PathUtilities.GetDirectoryName(@"goo", isUnixLike: true)); Assert.Equal( null, @@ -120,8 +120,8 @@ public void TestGetDirectoryName_UnixPaths_Relative() [Fact] public void TestGetDirectoryName_WindowsSharePaths() { - TestGetDirectoryNameAndCompareToDotnet(@"\\server\temp", @"\\server\temp\foo.txt"); - TestGetDirectoryNameAndCompareToDotnet(@"\\server\temp", @"\\server\temp\foo"); + TestGetDirectoryNameAndCompareToDotnet(@"\\server\temp", @"\\server\temp\goo.txt"); + TestGetDirectoryNameAndCompareToDotnet(@"\\server\temp", @"\\server\temp\goo"); TestGetDirectoryNameAndCompareToDotnet(@"\\server\temp", @"\\server\temp\"); TestGetDirectoryNameAndCompareToDotnet(null, @"\\server\temp"); TestGetDirectoryNameAndCompareToDotnet(null, @"\\server\"); @@ -133,13 +133,13 @@ public void TestGetDirectoryName_WindowsSharePaths() [Fact] public void TestGetDirectoryName_EsotericCases() { - TestGetDirectoryNameAndCompareToDotnet(@"C:\temp", @"C:\temp\\foo.txt"); - TestGetDirectoryNameAndCompareToDotnet(@"C:\temp", @"C:\temp\\\foo.txt"); + TestGetDirectoryNameAndCompareToDotnet(@"C:\temp", @"C:\temp\\goo.txt"); + TestGetDirectoryNameAndCompareToDotnet(@"C:\temp", @"C:\temp\\\goo.txt"); // Dotnet does normalization of dots, so we can't compare against it here. Assert.Equal( @"C:\temp\..", - PathUtilities.GetDirectoryName(@"C:\temp\..\foo.txt", isUnixLike: false)); + PathUtilities.GetDirectoryName(@"C:\temp\..\goo.txt", isUnixLike: false)); Assert.Equal( @"C:\temp", @@ -147,18 +147,18 @@ public void TestGetDirectoryName_EsotericCases() Assert.Equal( @"C:\temp\.", - PathUtilities.GetDirectoryName(@"C:\temp\.\foo.txt", isUnixLike: false)); + PathUtilities.GetDirectoryName(@"C:\temp\.\goo.txt", isUnixLike: false)); Assert.Equal( @"C:\temp", PathUtilities.GetDirectoryName(@"C:\temp\.", isUnixLike: false)); - TestGetDirectoryNameAndCompareToDotnet(@"C:temp", @"C:temp\\foo.txt"); - TestGetDirectoryNameAndCompareToDotnet(@"C:temp", @"C:temp\\\foo.txt"); + TestGetDirectoryNameAndCompareToDotnet(@"C:temp", @"C:temp\\goo.txt"); + TestGetDirectoryNameAndCompareToDotnet(@"C:temp", @"C:temp\\\goo.txt"); Assert.Equal( @"C:temp\..", - PathUtilities.GetDirectoryName(@"C:temp\..\foo.txt", isUnixLike: false)); + PathUtilities.GetDirectoryName(@"C:temp\..\goo.txt", isUnixLike: false)); Assert.Equal( @"C:temp", @@ -166,7 +166,7 @@ public void TestGetDirectoryName_EsotericCases() Assert.Equal( @"C:temp\.", - PathUtilities.GetDirectoryName(@"C:temp\.\foo.txt", isUnixLike: false)); + PathUtilities.GetDirectoryName(@"C:temp\.\goo.txt", isUnixLike: false)); Assert.Equal( @"C:temp", diff --git a/src/Compilers/Core/CodeAnalysisTest/FileSystem/RelativePathResolverTests.cs b/src/Compilers/Core/CodeAnalysisTest/FileSystem/RelativePathResolverTests.cs index 29439d677ce05..1f46c6378f2f7 100644 --- a/src/Compilers/Core/CodeAnalysisTest/FileSystem/RelativePathResolverTests.cs +++ b/src/Compilers/Core/CodeAnalysisTest/FileSystem/RelativePathResolverTests.cs @@ -39,7 +39,7 @@ public void ResolveMetadataFile1() Assert.Equal(subFilePath, path); // prefer the base file over base directory: - path = resolver.ResolvePath(fileName, baseFilePath: PathUtilities.CombineAbsoluteAndRelativePaths(dir, "foo.csx")); + path = resolver.ResolvePath(fileName, baseFilePath: PathUtilities.CombineAbsoluteAndRelativePaths(dir, "goo.csx")); Assert.Equal(filePath, path); path = resolver.ResolvePath(@"\" + fileName, baseFilePath: null); @@ -109,7 +109,7 @@ public void ResolveMetadataFile2() baseDirectory: subdir); // using base path - var path = resolver.ResolvePath(fileName, baseFilePath: PathUtilities.CombineAbsoluteAndRelativePaths(dir, "foo.csx")); + var path = resolver.ResolvePath(fileName, baseFilePath: PathUtilities.CombineAbsoluteAndRelativePaths(dir, "goo.csx")); Assert.Equal(filePath, path); // using base dir @@ -120,7 +120,7 @@ public void ResolveMetadataFile2() var resolverSP = new VirtualizedRelativePathResolver( existingFullPaths: fs, searchPaths: new[] { dir, subdir }.AsImmutableOrNull(), - baseDirectory: @"C:\foo"); + baseDirectory: @"C:\goo"); path = resolverSP.ResolvePath(fileName, baseFilePath: null); Assert.Equal(filePath, path); diff --git a/src/Compilers/Core/CodeAnalysisTest/FileUtilitiesTests.cs b/src/Compilers/Core/CodeAnalysisTest/FileUtilitiesTests.cs index e9e76518f5c81..300ffdcb19ae6 100644 --- a/src/Compilers/Core/CodeAnalysisTest/FileUtilitiesTests.cs +++ b/src/Compilers/Core/CodeAnalysisTest/FileUtilitiesTests.cs @@ -105,16 +105,16 @@ public void CombinePaths() Assert.Equal(@"C:\x/y", PathUtilities.CombineAbsoluteAndRelativePaths(@"C:\x/y", null)); Assert.Equal(@"C:\x/y", PathUtilities.CombineAbsoluteAndRelativePaths(@"C:\x/y", null)); - Assert.Equal(null, PathUtilities.CombineAbsoluteAndRelativePaths(@"C:\", @"C:\foo")); - Assert.Equal(null, PathUtilities.CombineAbsoluteAndRelativePaths(@"C:\", @"C:foo")); - Assert.Equal(null, PathUtilities.CombineAbsoluteAndRelativePaths(@"C:\", @"\foo")); - - Assert.Equal(@"C:\x\y\foo", PathUtilities.CombineAbsoluteAndRelativePaths(@"C:\x\y", @"foo")); - Assert.Equal(@"C:\x/y\foo", PathUtilities.CombineAbsoluteAndRelativePaths(@"C:\x/y", @"foo")); - Assert.Equal(@"C:\x/y\.\foo", PathUtilities.CombineAbsoluteAndRelativePaths(@"C:\x/y", @".\foo")); - Assert.Equal(@"C:\x/y\./foo", PathUtilities.CombineAbsoluteAndRelativePaths(@"C:\x/y", @"./foo")); - Assert.Equal(@"C:\x/y\..\foo", PathUtilities.CombineAbsoluteAndRelativePaths(@"C:\x/y", @"..\foo")); - Assert.Equal(@"C:\x/y\../foo", PathUtilities.CombineAbsoluteAndRelativePaths(@"C:\x/y", @"../foo")); + Assert.Equal(null, PathUtilities.CombineAbsoluteAndRelativePaths(@"C:\", @"C:\goo")); + Assert.Equal(null, PathUtilities.CombineAbsoluteAndRelativePaths(@"C:\", @"C:goo")); + Assert.Equal(null, PathUtilities.CombineAbsoluteAndRelativePaths(@"C:\", @"\goo")); + + Assert.Equal(@"C:\x\y\goo", PathUtilities.CombineAbsoluteAndRelativePaths(@"C:\x\y", @"goo")); + Assert.Equal(@"C:\x/y\goo", PathUtilities.CombineAbsoluteAndRelativePaths(@"C:\x/y", @"goo")); + Assert.Equal(@"C:\x/y\.\goo", PathUtilities.CombineAbsoluteAndRelativePaths(@"C:\x/y", @".\goo")); + Assert.Equal(@"C:\x/y\./goo", PathUtilities.CombineAbsoluteAndRelativePaths(@"C:\x/y", @"./goo")); + Assert.Equal(@"C:\x/y\..\goo", PathUtilities.CombineAbsoluteAndRelativePaths(@"C:\x/y", @"..\goo")); + Assert.Equal(@"C:\x/y\../goo", PathUtilities.CombineAbsoluteAndRelativePaths(@"C:\x/y", @"../goo")); } [Fact] @@ -130,9 +130,9 @@ public void ResolveRelativePath() // root-relative path: TestPath(@"\abc\def.dll", @"Q:\baz\x.csx", baseDir, noSearchPaths, @"Q:\abc\def.dll"); TestPath(@"\abc\def.dll", null, baseDir, noSearchPaths, @"X:\abc\def.dll"); - TestPath(@"\abc\def.dll", "foo.csx", null, noSearchPaths, null); - // TestPath(@"\abc\def.dll", @"C:foo.csx", null, noSearchPaths, null); - // TestPath(@"/abc\def.dll", @"\foo.csx", null, noSearchPaths, null); + TestPath(@"\abc\def.dll", "goo.csx", null, noSearchPaths, null); + // TestPath(@"\abc\def.dll", @"C:goo.csx", null, noSearchPaths, null); + // TestPath(@"/abc\def.dll", @"\goo.csx", null, noSearchPaths, null); TestPath(@"/abc\def.dll", null, @"\\x\y\z", noSearchPaths, @"\\x\y\abc\def.dll"); TestPath(@"/abc\def.dll", null, null, noSearchPaths, null); TestPath(@"/**/", null, baseDir, noSearchPaths, @"X:\**/"); @@ -145,7 +145,7 @@ public void ResolveRelativePath() // incomplete UNC paths (considered absolute and returned as they are): TestPath(@"\\", null, @"\\mymachine\root\x.csx", noSearchPaths, @"\\"); - TestPath(@"\\foo", null, @"\\mymachine\root\x.csx", noSearchPaths, @"\\foo"); + TestPath(@"\\goo", null, @"\\mymachine\root\x.csx", noSearchPaths, @"\\goo"); // long UNC path: // TODO (tomat): @@ -154,15 +154,15 @@ public void ResolveRelativePath() TestPath(@"./def.dll", @"Q:\abc\x.csx", baseDir, noSearchPaths, @"Q:\abc\./def.dll"); TestPath(@"./def.dll", @"Q:\abc\x.csx", baseDir, noSearchPaths, @"Q:\abc\./def.dll"); - TestPath(@".", @"Q:\foo\x.csx", baseDir, noSearchPaths, @"Q:\foo"); - TestPath(@"..", @"Q:\foo\x.csx", baseDir, noSearchPaths, @"Q:\foo\.."); // doesn't normalize - TestPath(@".\", @"Q:\foo\x.csx", baseDir, noSearchPaths, @"Q:\foo\.\"); - TestPath(@"..\", @"Q:\foo\x.csx", baseDir, noSearchPaths, @"Q:\foo\..\"); // doesn't normalize + TestPath(@".", @"Q:\goo\x.csx", baseDir, noSearchPaths, @"Q:\goo"); + TestPath(@"..", @"Q:\goo\x.csx", baseDir, noSearchPaths, @"Q:\goo\.."); // doesn't normalize + TestPath(@".\", @"Q:\goo\x.csx", baseDir, noSearchPaths, @"Q:\goo\.\"); + TestPath(@"..\", @"Q:\goo\x.csx", baseDir, noSearchPaths, @"Q:\goo\..\"); // doesn't normalize // relative base paths: TestPath(@".\y.dll", @"x.csx", baseDir, noSearchPaths, @"X:\rootdir\dir\.\y.dll"); - TestPath(@".\y.dll", @"foo\x.csx", baseDir, noSearchPaths, @"X:\rootdir\dir\foo\.\y.dll"); - TestPath(@".\y.dll", @".\foo\x.csx", baseDir, noSearchPaths, @"X:\rootdir\dir\.\foo\.\y.dll"); + TestPath(@".\y.dll", @"goo\x.csx", baseDir, noSearchPaths, @"X:\rootdir\dir\goo\.\y.dll"); + TestPath(@".\y.dll", @".\goo\x.csx", baseDir, noSearchPaths, @"X:\rootdir\dir\.\goo\.\y.dll"); TestPath(@".\y.dll", @"..\x.csx", baseDir, noSearchPaths, @"X:\rootdir\dir\..\.\y.dll"); // doesn't normalize TestPath(@".\\y.dll", @"..\x.csx", baseDir, noSearchPaths, @"X:\rootdir\dir\..\.\\y.dll"); // doesn't normalize TestPath(@".\/y.dll", @"..\x.csx", baseDir, noSearchPaths, @"X:\rootdir\dir\..\.\/y.dll"); // doesn't normalize @@ -234,23 +234,23 @@ public void Extension() { TestGetExtension(path: "a.dll", expected: ".dll"); TestGetExtension(path: "a.exe.config", expected: ".config"); - TestGetExtension(path: ".foo", expected: ".foo"); - TestGetExtension(path: ".foo.dll", expected: ".dll"); - TestGetExtension(path: "foo", expected: ""); - TestGetExtension(path: "foo.", expected: ""); - TestGetExtension(path: "foo..", expected: ""); - TestGetExtension(path: "foo...", expected: ""); + TestGetExtension(path: ".goo", expected: ".goo"); + TestGetExtension(path: ".goo.dll", expected: ".dll"); + TestGetExtension(path: "goo", expected: ""); + TestGetExtension(path: "goo.", expected: ""); + TestGetExtension(path: "goo..", expected: ""); + TestGetExtension(path: "goo...", expected: ""); Assert.Equal(".dll", PathUtilities.GetExtension("*.dll")); TestRemoveExtension(path: "a.dll", expected: "a"); TestRemoveExtension(path: "a.exe.config", expected: "a.exe"); - TestRemoveExtension(path: ".foo", expected: ""); - TestRemoveExtension(path: ".foo.dll", expected: ".foo"); - TestRemoveExtension(path: "foo", expected: "foo"); - TestRemoveExtension(path: "foo.", expected: "foo"); - TestRemoveExtension(path: "foo..", expected: "foo."); - TestRemoveExtension(path: "foo...", expected: "foo.."); + TestRemoveExtension(path: ".goo", expected: ""); + TestRemoveExtension(path: ".goo.dll", expected: ".goo"); + TestRemoveExtension(path: "goo", expected: "goo"); + TestRemoveExtension(path: "goo.", expected: "goo"); + TestRemoveExtension(path: "goo..", expected: "goo."); + TestRemoveExtension(path: "goo...", expected: "goo.."); Assert.Equal("*", PathUtilities.RemoveExtension("*.dll")); diff --git a/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/AssemblyIdentityComparerTests.cs b/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/AssemblyIdentityComparerTests.cs index 8508adbee9105..388cbf10a3559 100644 --- a/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/AssemblyIdentityComparerTests.cs +++ b/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/AssemblyIdentityComparerTests.cs @@ -128,20 +128,20 @@ public void Mscorlib() public void SimpleName() { TestMatch( - "Foo", - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF", + "Goo", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF", AssemblyIdentityComparer.ComparisonResult.Equivalent, partial: true); TestMatch( - "Foo2", - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF", + "Goo2", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF", AssemblyIdentityComparer.ComparisonResult.NotEquivalent, partial: true); TestMatch( - "Foo1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF", - "Foo2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF", + "Goo1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF", + "Goo2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF", AssemblyIdentityComparer.ComparisonResult.NotEquivalent, partial: false); } @@ -150,62 +150,62 @@ public void SimpleName() public void Version_StrongDefinition() { TestMatch( - "Foo, Version=1.0", - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF", + "Goo, Version=1.0", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF", AssemblyIdentityComparer.ComparisonResult.NotEquivalent, partial: true); TestMatch( - "Foo, Version=1.0.0", - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF", + "Goo, Version=1.0.0", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF", AssemblyIdentityComparer.ComparisonResult.NotEquivalent, partial: true); TestMatch( - "Foo, Version=1.0", - "Foo, Version=1.0.65535.65535, Culture=neutral, PublicKeyToken=0123456789ABCDEF", + "Goo, Version=1.0", + "Goo, Version=1.0.65535.65535, Culture=neutral, PublicKeyToken=0123456789ABCDEF", AssemblyIdentityComparer.ComparisonResult.NotEquivalent, partial: true); TestMatch( - "Foo, Version=1.0.0", - "Foo, Version=1.0.0.65535, Culture=neutral, PublicKeyToken=0123456789ABCDEF", + "Goo, Version=1.0.0", + "Goo, Version=1.0.0.65535, Culture=neutral, PublicKeyToken=0123456789ABCDEF", AssemblyIdentityComparer.ComparisonResult.NotEquivalent, partial: true); TestMatch( - "Foo, Version=1.0.0.65535", - "Foo, Version=1.0.0.65535, Culture=neutral, PublicKeyToken=0123456789ABCDEF", + "Goo, Version=1.0.0.65535", + "Goo, Version=1.0.0.65535, Culture=neutral, PublicKeyToken=0123456789ABCDEF", AssemblyIdentityComparer.ComparisonResult.Equivalent, partial: true); TestMatch( - "Foo, Version=1.0.65535.65535", - "Foo, Version=1.0.65535.65535, Culture=neutral, PublicKeyToken=0123456789ABCDEF", + "Goo, Version=1.0.65535.65535", + "Goo, Version=1.0.65535.65535, Culture=neutral, PublicKeyToken=0123456789ABCDEF", AssemblyIdentityComparer.ComparisonResult.Equivalent, partial: true); TestMatch( - "Foo, PublicKeyToken=0123456789ABCDEF", - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF", + "Goo, PublicKeyToken=0123456789ABCDEF", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF", AssemblyIdentityComparer.ComparisonResult.Equivalent, partial: true); TestMatch( - "Foo, Version=1.0.0.0, PublicKeyToken=0123456789ABCDEF", - "Foo, Version=1.0.0.1, Culture=neutral, PublicKeyToken=0123456789ABCDEF", + "Goo, Version=1.0.0.0, PublicKeyToken=0123456789ABCDEF", + "Goo, Version=1.0.0.1, Culture=neutral, PublicKeyToken=0123456789ABCDEF", AssemblyIdentityComparer.ComparisonResult.NotEquivalent, partial: true); TestMatch( - "Foo, Version=1.0.0.0, PublicKeyToken=0123456789ABCDEF", - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF", + "Goo, Version=1.0.0.0, PublicKeyToken=0123456789ABCDEF", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF", AssemblyIdentityComparer.ComparisonResult.Equivalent, partial: true); TestMatch( - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF", - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF", AssemblyIdentityComparer.ComparisonResult.Equivalent, partial: false); } @@ -216,104 +216,104 @@ public void Version_WeakDefinition() // if the reference is partial version is ignored TestMatch( - "Foo, Version=1.0", - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", + "Goo, Version=1.0", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", AssemblyIdentityComparer.ComparisonResult.Equivalent, partial: true); TestMatch( - "Foo, Version=1.0", - "Foo, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null", + "Goo, Version=1.0", + "Goo, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null", AssemblyIdentityComparer.ComparisonResult.Equivalent, partial: true); TestMatch( - "Foo, Version=1.0.0", - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", + "Goo, Version=1.0.0", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", AssemblyIdentityComparer.ComparisonResult.Equivalent, partial: true); TestMatch( - "Foo, Version=1.0.0.", - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", + "Goo, Version=1.0.0.", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", AssemblyIdentityComparer.ComparisonResult.Equivalent, partial: true); TestMatch( - "Foo, Version=1.0..0", - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", + "Goo, Version=1.0..0", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", AssemblyIdentityComparer.ComparisonResult.Equivalent, partial: true); TestMatch( - "Foo, Version=1.0..0", - "Foo, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null", + "Goo, Version=1.0..0", + "Goo, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null", AssemblyIdentityComparer.ComparisonResult.Equivalent, partial: true); TestMatch( - "Foo, Version=1.0", - "Foo, Version=1.0.65535.65535, Culture=neutral, PublicKeyToken=null", + "Goo, Version=1.0", + "Goo, Version=1.0.65535.65535, Culture=neutral, PublicKeyToken=null", AssemblyIdentityComparer.ComparisonResult.Equivalent, partial: true); TestMatch( - "Foo, Version=1.0.0", - "Foo, Version=1.0.0.65535, Culture=neutral, PublicKeyToken=null", + "Goo, Version=1.0.0", + "Goo, Version=1.0.0.65535, Culture=neutral, PublicKeyToken=null", AssemblyIdentityComparer.ComparisonResult.Equivalent, partial: true); TestMatch( - "Foo, Version=1.0.0.65535", - "Foo, Version=1.0.0.65535, Culture=neutral, PublicKeyToken=null", + "Goo, Version=1.0.0.65535", + "Goo, Version=1.0.0.65535, Culture=neutral, PublicKeyToken=null", AssemblyIdentityComparer.ComparisonResult.Equivalent, partial: true); TestMatch( - "Foo, Version=1.0.65535.65535", - "Foo, Version=1.0.65535.65535, Culture=neutral, PublicKeyToken=null", + "Goo, Version=1.0.65535.65535", + "Goo, Version=1.0.65535.65535, Culture=neutral, PublicKeyToken=null", AssemblyIdentityComparer.ComparisonResult.Equivalent, partial: true); TestMatch( - "Foo, PublicKeyToken=null", - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", + "Goo, PublicKeyToken=null", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", AssemblyIdentityComparer.ComparisonResult.Equivalent, partial: true); TestMatch( - "Foo, Version=1.0.0.0, PublicKeyToken=null", - "Foo, Version=1.0.0.1, Culture=neutral, PublicKeyToken=null", + "Goo, Version=1.0.0.0, PublicKeyToken=null", + "Goo, Version=1.0.0.1, Culture=neutral, PublicKeyToken=null", AssemblyIdentityComparer.ComparisonResult.Equivalent, partial: true); TestMatch( - "Foo, Version=1.0.0.0, PublicKeyToken=null", - "Foo, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null", + "Goo, Version=1.0.0.0, PublicKeyToken=null", + "Goo, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null", AssemblyIdentityComparer.ComparisonResult.Equivalent, partial: true); TestMatch( - "Foo, Version=1.0, Culture=neutral, PublicKeyToken=null", - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", + "Goo, Version=1.0, Culture=neutral, PublicKeyToken=null", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", AssemblyIdentityComparer.ComparisonResult.Equivalent, partial: true); TestMatch( - "Foo, Version=1.0.0, Culture=neutral, PublicKeyToken=null", - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", + "Goo, Version=1.0.0, Culture=neutral, PublicKeyToken=null", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", AssemblyIdentityComparer.ComparisonResult.Equivalent, partial: true); TestMatch( - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", - "Foo, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", + "Goo, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null", AssemblyIdentityComparer.ComparisonResult.Equivalent, partial: false); TestMatch( - "Foo, Version=., Culture=neutral, PublicKeyToken=null", - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", + "Goo, Version=., Culture=neutral, PublicKeyToken=null", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", AssemblyIdentityComparer.ComparisonResult.Equivalent, partial: true); } @@ -322,20 +322,20 @@ public void Version_WeakDefinition() public void Culture_StrongDefinition() { TestMatch( - "Foo, Culture=en-US, PublicKeyToken=0123456789ABCDEF", - "Foo, Version=1.0.0.0, Culture=en-US, PublicKeyToken=0123456789ABCDEF", + "Goo, Culture=en-US, PublicKeyToken=0123456789ABCDEF", + "Goo, Version=1.0.0.0, Culture=en-US, PublicKeyToken=0123456789ABCDEF", AssemblyIdentityComparer.ComparisonResult.Equivalent, partial: true); TestMatch( - "Foo, Culture=en-US, PublicKeyToken=0123456789ABCDEF", - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF", + "Goo, Culture=en-US, PublicKeyToken=0123456789ABCDEF", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF", AssemblyIdentityComparer.ComparisonResult.NotEquivalent, partial: true); TestMatch( - "Foo, Culture=neutral, PublicKeyToken=0123456789ABCDEF", - "Foo, Version=1.0.0.0, Culture=en-US, PublicKeyToken=0123456789ABCDEF", + "Goo, Culture=neutral, PublicKeyToken=0123456789ABCDEF", + "Goo, Version=1.0.0.0, Culture=en-US, PublicKeyToken=0123456789ABCDEF", AssemblyIdentityComparer.ComparisonResult.NotEquivalent, partial: true); } @@ -344,38 +344,38 @@ public void Culture_StrongDefinition() public void Culture_WeakDefinition() { TestMatch( - "Foo, Version=1.0.0.0, Culture=en-US, PublicKeyToken=null", - "Foo, Version=1.0.0.0, Culture=en-US, PublicKeyToken=null", + "Goo, Version=1.0.0.0, Culture=en-US, PublicKeyToken=null", + "Goo, Version=1.0.0.0, Culture=en-US, PublicKeyToken=null", AssemblyIdentityComparer.ComparisonResult.Equivalent, partial: false); TestMatch( - "Foo, Version=1.0.0.0, Culture=en-US, PublicKeyToken=null", - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", + "Goo, Version=1.0.0.0, Culture=en-US, PublicKeyToken=null", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", AssemblyIdentityComparer.ComparisonResult.NotEquivalent, partial: false); TestMatch( - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", - "Foo, Version=1.0.0.0, Culture=en-US, PublicKeyToken=null", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", + "Goo, Version=1.0.0.0, Culture=en-US, PublicKeyToken=null", AssemblyIdentityComparer.ComparisonResult.NotEquivalent, partial: false); TestMatch( - "Foo, Culture=en-US, PublicKeyToken=null", - "Foo, Version=1.0.0.0, Culture=en-US, PublicKeyToken=null", + "Goo, Culture=en-US, PublicKeyToken=null", + "Goo, Version=1.0.0.0, Culture=en-US, PublicKeyToken=null", AssemblyIdentityComparer.ComparisonResult.Equivalent, partial: true); TestMatch( - "Foo, Culture=en-US, PublicKeyToken=null", - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", + "Goo, Culture=en-US, PublicKeyToken=null", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", AssemblyIdentityComparer.ComparisonResult.NotEquivalent, partial: true); TestMatch( - "Foo, Culture=neutral, PublicKeyToken=null", - "Foo, Version=1.0.0.0, Culture=en-US, PublicKeyToken=null", + "Goo, Culture=neutral, PublicKeyToken=null", + "Goo, Version=1.0.0.0, Culture=en-US, PublicKeyToken=null", AssemblyIdentityComparer.ComparisonResult.NotEquivalent, partial: true); } @@ -384,62 +384,62 @@ public void Culture_WeakDefinition() public void PublicKeyToken() { TestMatch( - "Foo", - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", + "Goo", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", AssemblyIdentityComparer.ComparisonResult.Equivalent, partial: true); TestMatch( - "Foo", - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF", + "Goo", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF", AssemblyIdentityComparer.ComparisonResult.Equivalent, partial: true); TestMatch( - "Foo, PublicKeyToken=0123456789ABCDEF", - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", + "Goo, PublicKeyToken=0123456789ABCDEF", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", AssemblyIdentityComparer.ComparisonResult.NotEquivalent, partial: true); TestMatch( - "Foo, PublicKeyToken=null", - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF", + "Goo, PublicKeyToken=null", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF", AssemblyIdentityComparer.ComparisonResult.NotEquivalent, partial: true); TestMatch( - "Foo, PublicKeyToken=1111111111111111", - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=2222222222222222", + "Goo, PublicKeyToken=1111111111111111", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=2222222222222222", AssemblyIdentityComparer.ComparisonResult.NotEquivalent, partial: true); TestMatch( - "Foo, PublicKeyToken=null", - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", + "Goo, PublicKeyToken=null", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", AssemblyIdentityComparer.ComparisonResult.Equivalent, partial: true); TestMatch( - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF", - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", AssemblyIdentityComparer.ComparisonResult.NotEquivalent, partial: false); TestMatch( - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF", AssemblyIdentityComparer.ComparisonResult.NotEquivalent, partial: false); TestMatch( - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1111111111111111", - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=2222222222222222", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1111111111111111", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=2222222222222222", AssemblyIdentityComparer.ComparisonResult.NotEquivalent, partial: false); TestMatch( - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", AssemblyIdentityComparer.ComparisonResult.Equivalent, partial: false); } @@ -448,26 +448,26 @@ public void PublicKeyToken() public void IgnoreOrFwUnifyVersion() { TestMatch( - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF", - "Foo, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF", + "Goo, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF", AssemblyIdentityComparer.ComparisonResult.EquivalentIgnoringVersion, ignoreVersion: true); TestMatch( - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF, ContentType=WindowsRuntime", - "Foo, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF, ContentType=WindowsRuntime", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF, ContentType=WindowsRuntime", + "Goo, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF, ContentType=WindowsRuntime", AssemblyIdentityComparer.ComparisonResult.EquivalentIgnoringVersion, ignoreVersion: true); TestMatch( - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", - "Foo, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", + "Goo, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null", AssemblyIdentityComparer.ComparisonResult.Equivalent, ignoreVersion: true); TestMatch( - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime", - "Foo, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime", + "Goo, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime", AssemblyIdentityComparer.ComparisonResult.Equivalent, ignoreVersion: true); @@ -714,64 +714,64 @@ public void Retargetable_RefAndDef() public void WinRT_Basic() { TestMatch( - "Foo, ContentType=WindowsRuntime", - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF, ContentType=WindowsRuntime", + "Goo, ContentType=WindowsRuntime", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF, ContentType=WindowsRuntime", AssemblyIdentityComparer.ComparisonResult.Equivalent, partial: true); TestMatch( - "Foo, ContentType=WindowsRuntime", - "Foo2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF, ContentType=WindowsRuntime", + "Goo, ContentType=WindowsRuntime", + "Goo2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF, ContentType=WindowsRuntime", AssemblyIdentityComparer.ComparisonResult.NotEquivalent, partial: true); TestMatch( - "Foo, PublicKeyToken=0123456789ABCDEF, ContentType=WindowsRuntime", - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF, ContentType=WindowsRuntime", + "Goo, PublicKeyToken=0123456789ABCDEF, ContentType=WindowsRuntime", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF, ContentType=WindowsRuntime", AssemblyIdentityComparer.ComparisonResult.Equivalent, partial: true); TestMatch( - "Foo, Version=1.0.0.0, PublicKeyToken=0123456789ABCDEF, ContentType=WindowsRuntime", - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF, ContentType=WindowsRuntime", + "Goo, Version=1.0.0.0, PublicKeyToken=0123456789ABCDEF, ContentType=WindowsRuntime", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF, ContentType=WindowsRuntime", AssemblyIdentityComparer.ComparisonResult.Equivalent, partial: true); TestMatch( - "Foo, Version=1.0.0.0, PublicKeyToken=1123456789ABCDEF, ContentType=WindowsRuntime", - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=2123456789ABCDEF, ContentType=WindowsRuntime", + "Goo, Version=1.0.0.0, PublicKeyToken=1123456789ABCDEF, ContentType=WindowsRuntime", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=2123456789ABCDEF, ContentType=WindowsRuntime", AssemblyIdentityComparer.ComparisonResult.NotEquivalent, partial: true); TestMatch( - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF, ContentType=WindowsRuntime", - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF, ContentType=WindowsRuntime", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF, ContentType=WindowsRuntime", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF, ContentType=WindowsRuntime", AssemblyIdentityComparer.ComparisonResult.Equivalent, partial: false); TestMatch( - "Foo, Version=1.0.0.0, Culture=en-US, PublicKeyToken=0123456789ABCDEF, ContentType=WindowsRuntime", - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF, ContentType=WindowsRuntime", + "Goo, Version=1.0.0.0, Culture=en-US, PublicKeyToken=0123456789ABCDEF, ContentType=WindowsRuntime", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF, ContentType=WindowsRuntime", AssemblyIdentityComparer.ComparisonResult.NotEquivalent, partial: false); TestMatch( - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF, ContentType=WindowsRuntime", - "Foo, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF, ContentType=WindowsRuntime", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF, ContentType=WindowsRuntime", + "Goo, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF, ContentType=WindowsRuntime", AssemblyIdentityComparer.ComparisonResult.NotEquivalent, partial: false); // comparing WinRT with Default or vice versa: TestMatch( - "Foo", - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF, ContentType=WindowsRuntime", + "Goo", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF, ContentType=WindowsRuntime", AssemblyIdentityComparer.ComparisonResult.NotEquivalent, fusionMatch: AssemblyIdentityComparer.ComparisonResult.Equivalent, partial: true); TestMatch( - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF, ContentType=WindowsRuntime", - "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF, ContentType=WindowsRuntime", + "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF", AssemblyIdentityComparer.ComparisonResult.NotEquivalent, fusionMatch: AssemblyIdentityComparer.ComparisonResult.Equivalent); diff --git a/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/AssemblyIdentityDisplayNameTests.cs b/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/AssemblyIdentityDisplayNameTests.cs index 5ea0142c8cd9d..cc96f94e2e07a 100644 --- a/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/AssemblyIdentityDisplayNameTests.cs +++ b/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/AssemblyIdentityDisplayNameTests.cs @@ -68,7 +68,7 @@ private void TestParseVersion(string value, int major, int minor, int build, int private void TestParseVersion(string value) { - string displayName = "Foo, Version=" + value; + string displayName = "Goo, Version=" + value; var fusion = FusionAssemblyIdentity.ToAssemblyIdentity(FusionAssemblyIdentity.ToAssemblyNameObject(displayName)); AssemblyIdentity id = null; @@ -119,38 +119,38 @@ private void TestParseDisplayName(string displayName, AssemblyIdentity expected, [Fact] public void GetDisplayName() { - var id = new AssemblyIdentity("foo"); - Assert.Equal("foo, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", id.GetDisplayName()); + var id = new AssemblyIdentity("goo"); + Assert.Equal("goo, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", id.GetDisplayName()); - id = new AssemblyIdentity("foo", new Version(1, 2, 3, 4)); - Assert.Equal("foo, Version=1.2.3.4, Culture=neutral, PublicKeyToken=null", id.GetDisplayName()); + id = new AssemblyIdentity("goo", new Version(1, 2, 3, 4)); + Assert.Equal("goo, Version=1.2.3.4, Culture=neutral, PublicKeyToken=null", id.GetDisplayName()); - id = new AssemblyIdentity("foo", cultureName: "en-US"); - Assert.Equal("foo, Version=0.0.0.0, Culture=en-US, PublicKeyToken=null", id.GetDisplayName()); + id = new AssemblyIdentity("goo", cultureName: "en-US"); + Assert.Equal("goo, Version=0.0.0.0, Culture=en-US, PublicKeyToken=null", id.GetDisplayName()); - id = new AssemblyIdentity("foo", publicKeyOrToken: new byte[] { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF }.AsImmutableOrNull()); - Assert.Equal("foo, Version=0.0.0.0, Culture=neutral, PublicKeyToken=0123456789abcdef", id.GetDisplayName(), StringComparer.OrdinalIgnoreCase); + id = new AssemblyIdentity("goo", publicKeyOrToken: new byte[] { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF }.AsImmutableOrNull()); + Assert.Equal("goo, Version=0.0.0.0, Culture=neutral, PublicKeyToken=0123456789abcdef", id.GetDisplayName(), StringComparer.OrdinalIgnoreCase); - id = new AssemblyIdentity("foo", isRetargetable: true); - Assert.Equal("foo, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null, Retargetable=Yes", id.GetDisplayName()); + id = new AssemblyIdentity("goo", isRetargetable: true); + Assert.Equal("goo, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null, Retargetable=Yes", id.GetDisplayName()); - id = new AssemblyIdentity("foo", contentType: AssemblyContentType.WindowsRuntime); - Assert.Equal("foo, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime", id.GetDisplayName()); + id = new AssemblyIdentity("goo", contentType: AssemblyContentType.WindowsRuntime); + Assert.Equal("goo, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime", id.GetDisplayName()); - id = new AssemblyIdentity("Foo", publicKeyOrToken: RoPublicKey1, hasPublicKey: true); + id = new AssemblyIdentity("Goo", publicKeyOrToken: RoPublicKey1, hasPublicKey: true); string dn1 = id.GetDisplayName(); string dn2 = id.GetDisplayName(fullKey: false); Assert.True(ReferenceEquals(dn1, dn2), "cached full name expected"); - Assert.Equal("Foo, Version=0.0.0.0, Culture=neutral, PublicKeyToken=" + StrPublicKeyToken1, dn1); + Assert.Equal("Goo, Version=0.0.0.0, Culture=neutral, PublicKeyToken=" + StrPublicKeyToken1, dn1); string dnFull = id.GetDisplayName(fullKey: true); - Assert.Equal("Foo, Version=0.0.0.0, Culture=neutral, PublicKey=" + StrPublicKey1, dnFull); + Assert.Equal("Goo, Version=0.0.0.0, Culture=neutral, PublicKey=" + StrPublicKey1, dnFull); - id = new AssemblyIdentity("Foo", cultureName: "neutral"); - Assert.Equal("Foo, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", id.GetDisplayName()); + id = new AssemblyIdentity("Goo", cultureName: "neutral"); + Assert.Equal("Goo, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", id.GetDisplayName()); - id = new AssemblyIdentity("Foo", cultureName: " '\t\r\n\\=, "); - Assert.Equal(@"Foo, Version=0.0.0.0, Culture="" \'\t\r\n\\\=\, "", PublicKeyToken=null", id.GetDisplayName()); + id = new AssemblyIdentity("Goo", cultureName: " '\t\r\n\\=, "); + Assert.Equal(@"Goo, Version=0.0.0.0, Culture="" \'\t\r\n\\\=\, "", PublicKeyToken=null", id.GetDisplayName()); } [Fact] @@ -309,7 +309,7 @@ public void TryParseDisplayName_QuotingAndEscaping() // invalid characters: foreach (var c in ClrInvalidCharacters) { - TestParseSimpleName("foo" + c, "foo" + c); + TestParseSimpleName("goo" + c, "goo" + c); } TestParseSimpleName("'*', Version=1.0.0.0", expected: "*", expectedFusion: null); @@ -364,57 +364,57 @@ public void TryParseDisplayName() TestParseDisplayName("", null); TestParseDisplayName("fo=o, Culture=neutral, Version=1.0.0.0", null); - TestParseDisplayName("foo, Culture=neutral, Version,1.0.0.0", null); + TestParseDisplayName("goo, Culture=neutral, Version,1.0.0.0", null); // custom properties: - TestParseDisplayName("foo, A=B", - new AssemblyIdentity("foo"), N | AssemblyIdentityParts.Unknown); + TestParseDisplayName("goo, A=B", + new AssemblyIdentity("goo"), N | AssemblyIdentityParts.Unknown); // we don't allow CT=WinRT + Retargetable, fusion does. Assert.False( - AssemblyIdentity.TryParseDisplayName("foo, Version=1.0.0.0, Culture=en-US, Retargetable=Yes, ContentType=WindowsRuntime, PublicKeyToken=" + StrPublicKeyToken1, out id)); + AssemblyIdentity.TryParseDisplayName("goo, Version=1.0.0.0, Culture=en-US, Retargetable=Yes, ContentType=WindowsRuntime, PublicKeyToken=" + StrPublicKeyToken1, out id)); // order - TestParseDisplayName("foo, Culture=neutral, Version=1.0.0.0", - new AssemblyIdentity("foo", new Version(1, 0, 0, 0)), NVC); + TestParseDisplayName("goo, Culture=neutral, Version=1.0.0.0", + new AssemblyIdentity("goo", new Version(1, 0, 0, 0)), NVC); - TestParseDisplayName("foo, Version=1.0.0.0, Culture=en-US, Retargetable=Yes, PublicKeyToken=" + StrPublicKeyToken1, - new AssemblyIdentity("foo", new Version(1, 0, 0, 0), "en-US", RoPublicKeyToken1, hasPublicKey: false, isRetargetable: true), + TestParseDisplayName("goo, Version=1.0.0.0, Culture=en-US, Retargetable=Yes, PublicKeyToken=" + StrPublicKeyToken1, + new AssemblyIdentity("goo", new Version(1, 0, 0, 0), "en-US", RoPublicKeyToken1, hasPublicKey: false, isRetargetable: true), NVCT | AssemblyIdentityParts.Retargetability); - TestParseDisplayName("foo, PublicKey=" + StrPublicKey1 + ", Version=1.0.0.1", - new AssemblyIdentity("foo", new Version(1, 0, 0, 1), publicKeyOrToken: RoPublicKey1, hasPublicKey: true), + TestParseDisplayName("goo, PublicKey=" + StrPublicKey1 + ", Version=1.0.0.1", + new AssemblyIdentity("goo", new Version(1, 0, 0, 1), publicKeyOrToken: RoPublicKey1, hasPublicKey: true), NVK); - TestParseDisplayName(@"Foo, Version=0.0.0.0, Culture="" \'\t\r\n\\\=\, "", PublicKeyToken=null", - new AssemblyIdentity("Foo", cultureName: " '\t\r\n\\=, "), + TestParseDisplayName(@"Goo, Version=0.0.0.0, Culture="" \'\t\r\n\\\=\, "", PublicKeyToken=null", + new AssemblyIdentity("Goo", cultureName: " '\t\r\n\\=, "), NVCT); // duplicates - TestParseDisplayName("foo, Version=1.0.0.0, Version=1.0.0.0", null); - TestParseDisplayName("foo, Version=1.0.0.0, Version=2.0.0.0", null); - TestParseDisplayName("foo, Culture=neutral, Version=1.0.0.0, Culture=en-US", null); + TestParseDisplayName("goo, Version=1.0.0.0, Version=1.0.0.0", null); + TestParseDisplayName("goo, Version=1.0.0.0, Version=2.0.0.0", null); + TestParseDisplayName("goo, Culture=neutral, Version=1.0.0.0, Culture=en-US", null); } [Fact] public void TryParseDisplayName_Version() { - TestParseDisplayName("Version=1.2.3.4, foo", null); + TestParseDisplayName("Version=1.2.3.4, goo", null); TestParseDisplayName("Version=1.2.3.4", null); TestParseDisplayName("Version=", null); - TestParseDisplayName("foo, Version=", null); - TestParseDisplayName("foo, Version", null); + TestParseDisplayName("goo, Version=", null); + TestParseDisplayName("goo, Version", null); - TestParseDisplayName("foo, Version=1", - new AssemblyIdentity("foo", new Version(1, 0, 0, 0)), N | AssemblyIdentityParts.VersionMajor); + TestParseDisplayName("goo, Version=1", + new AssemblyIdentity("goo", new Version(1, 0, 0, 0)), N | AssemblyIdentityParts.VersionMajor); - TestParseDisplayName("foo, Version=.", new AssemblyIdentity("foo"), N); - TestParseDisplayName("foo, Version=..", new AssemblyIdentity("foo"), N); - TestParseDisplayName("foo, Version=...", new AssemblyIdentity("foo"), N); + TestParseDisplayName("goo, Version=.", new AssemblyIdentity("goo"), N); + TestParseDisplayName("goo, Version=..", new AssemblyIdentity("goo"), N); + TestParseDisplayName("goo, Version=...", new AssemblyIdentity("goo"), N); - TestParseDisplayName("foo, Version=*, Culture=en-US", - new AssemblyIdentity("foo", cultureName: "en-US"), + TestParseDisplayName("goo, Version=*, Culture=en-US", + new AssemblyIdentity("goo", cultureName: "en-US"), AssemblyIdentityParts.Name | AssemblyIdentityParts.Culture); } @@ -492,80 +492,80 @@ public void TestParseVersionAll() [Fact] public void TryParseDisplayName_Culture() { - TestParseDisplayName("foo, Version=1.0.0.1, Culture=null", - new AssemblyIdentity("foo", new Version(1, 0, 0, 1), cultureName: "null"), NVC); + TestParseDisplayName("goo, Version=1.0.0.1, Culture=null", + new AssemblyIdentity("goo", new Version(1, 0, 0, 1), cultureName: "null"), NVC); - TestParseDisplayName("foo, Version=1.0.0.1, cULture=en-US", - new AssemblyIdentity("foo", new Version(1, 0, 0, 1), cultureName: "en-US"), NVC); + TestParseDisplayName("goo, Version=1.0.0.1, cULture=en-US", + new AssemblyIdentity("goo", new Version(1, 0, 0, 1), cultureName: "en-US"), NVC); - TestParseDisplayName("foo, Version=1.0.0.1, Language=en-US", - new AssemblyIdentity("foo", new Version(1, 0, 0, 1), cultureName: "en-US"), NVC); + TestParseDisplayName("goo, Version=1.0.0.1, Language=en-US", + new AssemblyIdentity("goo", new Version(1, 0, 0, 1), cultureName: "en-US"), NVC); - TestParseDisplayName("foo, Version=1.0.0.1, languagE=en-US", - new AssemblyIdentity("foo", new Version(1, 0, 0, 1), cultureName: "en-US"), NVC); + TestParseDisplayName("goo, Version=1.0.0.1, languagE=en-US", + new AssemblyIdentity("goo", new Version(1, 0, 0, 1), cultureName: "en-US"), NVC); - TestParseDisplayName("foo, Culture=*, Version=1.0.0.1", - new AssemblyIdentity("foo", new Version(1, 0, 0, 1)), NV); + TestParseDisplayName("goo, Culture=*, Version=1.0.0.1", + new AssemblyIdentity("goo", new Version(1, 0, 0, 1)), NV); - TestParseDisplayName("foo, Culture=*", new AssemblyIdentity("foo"), N); + TestParseDisplayName("goo, Culture=*", new AssemblyIdentity("goo"), N); - TestParseDisplayName("foo, Culture=*, Culture=en-US, Version=1.0.0.1", null); + TestParseDisplayName("goo, Culture=*, Culture=en-US, Version=1.0.0.1", null); - TestParseDisplayName("Foo, Version=1.0.0.0, Culture='neutral', PublicKeyToken=null", - new AssemblyIdentity("Foo", new Version(1, 0, 0, 0), cultureName: null), NVCT); + TestParseDisplayName("Goo, Version=1.0.0.0, Culture='neutral', PublicKeyToken=null", + new AssemblyIdentity("Goo", new Version(1, 0, 0, 0), cultureName: null), NVCT); } [Fact] public void TryParseDisplayName_Keys() { // empty keys: - TestParseDisplayName("foo, PublicKeyToken=null, Version=1.0.0.1", - new AssemblyIdentity("foo", new Version(1, 0, 0, 1)), NVT); + TestParseDisplayName("goo, PublicKeyToken=null, Version=1.0.0.1", + new AssemblyIdentity("goo", new Version(1, 0, 0, 1)), NVT); - TestParseDisplayName("foo, PublicKeyToken=neutral, Version=1.0.0.1", - new AssemblyIdentity("foo", new Version(1, 0, 0, 1)), NVT); + TestParseDisplayName("goo, PublicKeyToken=neutral, Version=1.0.0.1", + new AssemblyIdentity("goo", new Version(1, 0, 0, 1)), NVT); - TestParseDisplayName("foo, PublicKeyToken=*, Version=1.0.0.1", - new AssemblyIdentity("foo", new Version(1, 0, 0, 1)), NV); + TestParseDisplayName("goo, PublicKeyToken=*, Version=1.0.0.1", + new AssemblyIdentity("goo", new Version(1, 0, 0, 1)), NV); - TestParseDisplayName("foo, PublicKey=null, Version=1.0.0.1", null); - TestParseDisplayName("foo, PublicKey=neutral, Version=1.0.0.1", null); + TestParseDisplayName("goo, PublicKey=null, Version=1.0.0.1", null); + TestParseDisplayName("goo, PublicKey=neutral, Version=1.0.0.1", null); - TestParseDisplayName("foo, PublicKey=*, Version=1.0.0.1", - new AssemblyIdentity("foo", new Version(1, 0, 0, 1)), NV); + TestParseDisplayName("goo, PublicKey=*, Version=1.0.0.1", + new AssemblyIdentity("goo", new Version(1, 0, 0, 1)), NV); // keys - TestParseDisplayName("foo, PublicKeyToken=, Version=1.0.0.1", null); - TestParseDisplayName("foo, PublicKeyToken=1, Version=1.0.0.1", null); - TestParseDisplayName("foo, PublicKeyToken=111111111111111, Version=1.0.0.1", null); - TestParseDisplayName("foo, PublicKeyToken=1111111111111111111, Version=1.0.0.1", null); - TestParseDisplayName("foo, PublicKey=1, Version=1.0.0.1", null); - TestParseDisplayName("foo, PublicKey=1000000040000000", null); - TestParseDisplayName("foo, PublicKey=11, Version=1.0.0.1", null); + TestParseDisplayName("goo, PublicKeyToken=, Version=1.0.0.1", null); + TestParseDisplayName("goo, PublicKeyToken=1, Version=1.0.0.1", null); + TestParseDisplayName("goo, PublicKeyToken=111111111111111, Version=1.0.0.1", null); + TestParseDisplayName("goo, PublicKeyToken=1111111111111111111, Version=1.0.0.1", null); + TestParseDisplayName("goo, PublicKey=1, Version=1.0.0.1", null); + TestParseDisplayName("goo, PublicKey=1000000040000000", null); + TestParseDisplayName("goo, PublicKey=11, Version=1.0.0.1", null); // TODO: need to calculate the correct token for the ECMA key. - // TestParseDisplayName("foo, PublicKey=0000000040000000", + // TestParseDisplayName("goo, PublicKey=0000000040000000", // expectedParts: 0, // expectedFusion: null, // Fusion rejects the ECMA key. - // expected: new AssemblyIdentity("foo", hasPublicKey: true, publicKeyOrToken: new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0 }.AsImmutable())); + // expected: new AssemblyIdentity("goo", hasPublicKey: true, publicKeyOrToken: new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0 }.AsImmutable())); // if public key token calculated from public key matches, then it's ok to specify both - TestParseDisplayName("foo, Culture=neutral, Version=1.0.0.0, PublicKey=" + StrPublicKey1 + ", PublicKeyToken=" + StrPublicKeyToken1, - new AssemblyIdentity("foo", new Version(1, 0, 0, 0), publicKeyOrToken: RoPublicKey1, hasPublicKey: true), NVC | AssemblyIdentityParts.PublicKeyOrToken); + TestParseDisplayName("goo, Culture=neutral, Version=1.0.0.0, PublicKey=" + StrPublicKey1 + ", PublicKeyToken=" + StrPublicKeyToken1, + new AssemblyIdentity("goo", new Version(1, 0, 0, 0), publicKeyOrToken: RoPublicKey1, hasPublicKey: true), NVC | AssemblyIdentityParts.PublicKeyOrToken); - TestParseDisplayName("foo, Culture=neutral, Version=1.0.0.0, PublicKey=" + StrPublicKey1 + ", PublicKeyToken=1111111111111111", null); + TestParseDisplayName("goo, Culture=neutral, Version=1.0.0.0, PublicKey=" + StrPublicKey1 + ", PublicKeyToken=1111111111111111", null); } [Fact] public void TryParseDisplayName_ContentType() { - TestParseDisplayName("foo, Version=1.0.0.1, ContentType=WindowsRuntime", - new AssemblyIdentity("foo", new Version(1, 0, 0, 1), contentType: AssemblyContentType.WindowsRuntime), NV | AssemblyIdentityParts.ContentType); + TestParseDisplayName("goo, Version=1.0.0.1, ContentType=WindowsRuntime", + new AssemblyIdentity("goo", new Version(1, 0, 0, 1), contentType: AssemblyContentType.WindowsRuntime), NV | AssemblyIdentityParts.ContentType); - TestParseDisplayName("foo, Version=1.0.0.1, ContentType=*", - new AssemblyIdentity("foo", new Version(1, 0, 0, 1)), NV); + TestParseDisplayName("goo, Version=1.0.0.1, ContentType=*", + new AssemblyIdentity("goo", new Version(1, 0, 0, 1)), NV); - TestParseDisplayName("foo, Version=1.0.0.1, ContentType=Default", null); + TestParseDisplayName("goo, Version=1.0.0.1, ContentType=Default", null); } [Fact] @@ -573,30 +573,30 @@ public void TryParseDisplayName_Retargetable() { // for some reason the Fusion rejects to parse Retargetable if they are not full names - TestParseDisplayName("foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=" + StrPublicKeyToken1 + ", Retargetable=yEs", - new AssemblyIdentity("foo", new Version(1, 0, 0, 0), publicKeyOrToken: RoPublicKeyToken1, isRetargetable: true), + TestParseDisplayName("goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=" + StrPublicKeyToken1 + ", Retargetable=yEs", + new AssemblyIdentity("goo", new Version(1, 0, 0, 0), publicKeyOrToken: RoPublicKeyToken1, isRetargetable: true), NVCT | AssemblyIdentityParts.Retargetability); - TestParseDisplayName("foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=" + StrPublicKeyToken1 + ", Retargetable=*", - new AssemblyIdentity("foo", new Version(1, 0, 0, 0), publicKeyOrToken: RoPublicKeyToken1), + TestParseDisplayName("goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=" + StrPublicKeyToken1 + ", Retargetable=*", + new AssemblyIdentity("goo", new Version(1, 0, 0, 0), publicKeyOrToken: RoPublicKeyToken1), NVCT); - TestParseDisplayName("foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=" + StrPublicKeyToken1 + ", retargetable=NO", - new AssemblyIdentity("foo", new Version(1, 0, 0, 0), publicKeyOrToken: RoPublicKeyToken1), + TestParseDisplayName("goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=" + StrPublicKeyToken1 + ", retargetable=NO", + new AssemblyIdentity("goo", new Version(1, 0, 0, 0), publicKeyOrToken: RoPublicKeyToken1), NVCT | AssemblyIdentityParts.Retargetability); - TestParseDisplayName("foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=" + StrPublicKeyToken1 + ", Retargetable=Bar", + TestParseDisplayName("goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=" + StrPublicKeyToken1 + ", Retargetable=Bar", null); - TestParseDisplayName("foo, Version=1.0.0.1, Retargetable=*", - new AssemblyIdentity("foo", new Version(1, 0, 0, 1)), NV); + TestParseDisplayName("goo, Version=1.0.0.1, Retargetable=*", + new AssemblyIdentity("goo", new Version(1, 0, 0, 1)), NV); - TestParseDisplayName("foo, Version=1.0.0.1, Retargetable=No", - new AssemblyIdentity("foo", new Version(1, 0, 0, 1)), NV | AssemblyIdentityParts.Retargetability, + TestParseDisplayName("goo, Version=1.0.0.1, Retargetable=No", + new AssemblyIdentity("goo", new Version(1, 0, 0, 1)), NV | AssemblyIdentityParts.Retargetability, expectedFusion: null); - TestParseDisplayName("foo, Version=1.0.0.1, retargetable=YEs", - new AssemblyIdentity("foo", new Version(1, 0, 0, 1), isRetargetable: true), NV | AssemblyIdentityParts.Retargetability, + TestParseDisplayName("goo, Version=1.0.0.1, retargetable=YEs", + new AssemblyIdentity("goo", new Version(1, 0, 0, 1), isRetargetable: true), NV | AssemblyIdentityParts.Retargetability, expectedFusion: null); } } diff --git a/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/AssemblyIdentityTests.cs b/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/AssemblyIdentityTests.cs index 6fdde41d54710..67bceeefa0787 100644 --- a/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/AssemblyIdentityTests.cs +++ b/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/AssemblyIdentityTests.cs @@ -15,20 +15,20 @@ public class AssemblyIdentityTests : AssemblyIdentityTestBase [Fact] public void Equality() { - var id1 = new AssemblyIdentity("Foo", new Version(1, 0, 0, 0), "", RoPublicKey1, hasPublicKey: true, isRetargetable: false); - var id11 = new AssemblyIdentity("Foo", new Version(1, 0, 0, 0), "", RoPublicKey1, hasPublicKey: true, isRetargetable: false); - var id2 = new AssemblyIdentity("Foo", new Version(1, 0, 0, 0), "", RoPublicKeyToken1, hasPublicKey: false, isRetargetable: false); - var id22 = new AssemblyIdentity("Foo", new Version(1, 0, 0, 0), "", RoPublicKeyToken1, hasPublicKey: false, isRetargetable: false); - - var id3 = new AssemblyIdentity("Foo!", new Version(1, 0, 0, 0), "", RoPublicKeyToken1, hasPublicKey: false, isRetargetable: false); - var id4 = new AssemblyIdentity("Foo", new Version(1, 0, 1, 0), "", RoPublicKeyToken1, hasPublicKey: false, isRetargetable: false); - var id5 = new AssemblyIdentity("Foo", new Version(1, 0, 0, 0), "en-US", RoPublicKeyToken1, hasPublicKey: false, isRetargetable: false); - var id6 = new AssemblyIdentity("Foo", new Version(1, 0, 0, 0), "", default(ImmutableArray), hasPublicKey: false, isRetargetable: false); - var id7 = new AssemblyIdentity("Foo", new Version(1, 0, 0, 0), "", RoPublicKey1, hasPublicKey: true, isRetargetable: true); - - var win1 = new AssemblyIdentity("Foo", new Version(1, 0, 0, 0), "", RoPublicKey1, hasPublicKey: true, isRetargetable: false, contentType: AssemblyContentType.WindowsRuntime); + var id1 = new AssemblyIdentity("Goo", new Version(1, 0, 0, 0), "", RoPublicKey1, hasPublicKey: true, isRetargetable: false); + var id11 = new AssemblyIdentity("Goo", new Version(1, 0, 0, 0), "", RoPublicKey1, hasPublicKey: true, isRetargetable: false); + var id2 = new AssemblyIdentity("Goo", new Version(1, 0, 0, 0), "", RoPublicKeyToken1, hasPublicKey: false, isRetargetable: false); + var id22 = new AssemblyIdentity("Goo", new Version(1, 0, 0, 0), "", RoPublicKeyToken1, hasPublicKey: false, isRetargetable: false); + + var id3 = new AssemblyIdentity("Goo!", new Version(1, 0, 0, 0), "", RoPublicKeyToken1, hasPublicKey: false, isRetargetable: false); + var id4 = new AssemblyIdentity("Goo", new Version(1, 0, 1, 0), "", RoPublicKeyToken1, hasPublicKey: false, isRetargetable: false); + var id5 = new AssemblyIdentity("Goo", new Version(1, 0, 0, 0), "en-US", RoPublicKeyToken1, hasPublicKey: false, isRetargetable: false); + var id6 = new AssemblyIdentity("Goo", new Version(1, 0, 0, 0), "", default(ImmutableArray), hasPublicKey: false, isRetargetable: false); + var id7 = new AssemblyIdentity("Goo", new Version(1, 0, 0, 0), "", RoPublicKey1, hasPublicKey: true, isRetargetable: true); + + var win1 = new AssemblyIdentity("Goo", new Version(1, 0, 0, 0), "", RoPublicKey1, hasPublicKey: true, isRetargetable: false, contentType: AssemblyContentType.WindowsRuntime); var win2 = new AssemblyIdentity("Bar", new Version(1, 0, 0, 0), "", RoPublicKey1, hasPublicKey: true, isRetargetable: false, contentType: AssemblyContentType.WindowsRuntime); - var win3 = new AssemblyIdentity("Foo", new Version(1, 0, 0, 0), "", RoPublicKey1, hasPublicKey: true, isRetargetable: false, contentType: AssemblyContentType.WindowsRuntime); + var win3 = new AssemblyIdentity("Goo", new Version(1, 0, 0, 0), "", RoPublicKey1, hasPublicKey: true, isRetargetable: false, contentType: AssemblyContentType.WindowsRuntime); Assert.True(id1.Equals(id1)); Assert.True(id1.Equals(id2)); @@ -60,10 +60,10 @@ public void Equality() [Fact] public void Equality_InvariantCulture() { - var neutral1 = new AssemblyIdentity("Foo", new Version(1, 0, 0, 0), "NEUtral", RoPublicKeyToken1, hasPublicKey: false, isRetargetable: false); - var neutral2 = new AssemblyIdentity("Foo", new Version(1, 0, 0, 0), null, RoPublicKeyToken1, hasPublicKey: false, isRetargetable: false); - var neutral3 = new AssemblyIdentity("Foo", new Version(1, 0, 0, 0), "neutral", RoPublicKeyToken1, hasPublicKey: false, isRetargetable: false); - var invariant = new AssemblyIdentity("Foo", new Version(1, 0, 0, 0), "", RoPublicKeyToken1, hasPublicKey: false, isRetargetable: false); + var neutral1 = new AssemblyIdentity("Goo", new Version(1, 0, 0, 0), "NEUtral", RoPublicKeyToken1, hasPublicKey: false, isRetargetable: false); + var neutral2 = new AssemblyIdentity("Goo", new Version(1, 0, 0, 0), null, RoPublicKeyToken1, hasPublicKey: false, isRetargetable: false); + var neutral3 = new AssemblyIdentity("Goo", new Version(1, 0, 0, 0), "neutral", RoPublicKeyToken1, hasPublicKey: false, isRetargetable: false); + var invariant = new AssemblyIdentity("Goo", new Version(1, 0, 0, 0), "", RoPublicKeyToken1, hasPublicKey: false, isRetargetable: false); Assert.True(neutral1.Equals(invariant)); Assert.True(neutral2.Equals(invariant)); @@ -80,7 +80,7 @@ public void FromAssemblyDefinitionInvalidParameters() [Fact] public void FromAssemblyDefinition() { - var name = new AssemblyName("foo"); + var name = new AssemblyName("goo"); name.Flags = AssemblyNameFlags.Retargetable | AssemblyNameFlags.PublicKey | AssemblyNameFlags.EnableJITcompileOptimizer | AssemblyNameFlags.EnableJITcompileTracking; name.CultureInfo = new CultureInfo("en-US"); name.ContentType = AssemblyContentType.Default; @@ -88,7 +88,7 @@ public void FromAssemblyDefinition() name.ProcessorArchitecture = ProcessorArchitecture.X86; var id = AssemblyIdentity.FromAssemblyDefinition(name); - Assert.Equal("foo", id.Name); + Assert.Equal("goo", id.Name); Assert.True(id.IsRetargetable); Assert.Equal(new Version(1, 2, 3, 4), id.Version); Assert.Equal(AssemblyContentType.Default, id.ContentType); @@ -96,30 +96,30 @@ public void FromAssemblyDefinition() Assert.False(id.IsStrongName); - name = new AssemblyName("foo"); + name = new AssemblyName("goo"); name.SetPublicKey(PublicKey1); name.Version = new Version(1, 2, 3, 4); id = AssemblyIdentity.FromAssemblyDefinition(name); - Assert.Equal("foo", id.Name); + Assert.Equal("goo", id.Name); Assert.Equal(new Version(1, 2, 3, 4), id.Version); Assert.True(id.HasPublicKey); Assert.True(id.IsStrongName); AssertEx.Equal(id.PublicKey, PublicKey1); - name = new AssemblyName("foo"); + name = new AssemblyName("goo"); name.ContentType = AssemblyContentType.WindowsRuntime; id = AssemblyIdentity.FromAssemblyDefinition(name); - Assert.Equal("foo", id.Name); + Assert.Equal("goo", id.Name); Assert.Equal(AssemblyContentType.WindowsRuntime, id.ContentType); } [Fact] public void FromAssemblyDefinition_InvariantCulture() { - var name = new AssemblyName("foo"); + var name = new AssemblyName("goo"); name.Flags = AssemblyNameFlags.None; name.CultureInfo = CultureInfo.InvariantCulture; name.ContentType = AssemblyContentType.Default; @@ -133,8 +133,8 @@ public void FromAssemblyDefinition_InvariantCulture() [Fact] public void Properties() { - var id = new AssemblyIdentity("Foo", hasPublicKey: false, isRetargetable: false); - Assert.Equal("Foo", id.Name); + var id = new AssemblyIdentity("Goo", hasPublicKey: false, isRetargetable: false); + Assert.Equal("Goo", id.Name); Assert.Equal(new Version(0, 0, 0, 0), id.Version); Assert.Equal(AssemblyNameFlags.None, id.Flags); Assert.Equal("", id.CultureName); @@ -144,8 +144,8 @@ public void Properties() Assert.Equal(0, id.PublicKeyToken.Length); Assert.Equal(AssemblyContentType.Default, id.ContentType); - id = new AssemblyIdentity("Foo", publicKeyOrToken: RoPublicKey1, hasPublicKey: true, isRetargetable: false); - Assert.Equal("Foo", id.Name); + id = new AssemblyIdentity("Goo", publicKeyOrToken: RoPublicKey1, hasPublicKey: true, isRetargetable: false); + Assert.Equal("Goo", id.Name); Assert.Equal(new Version(0, 0, 0, 0), id.Version); Assert.Equal(AssemblyNameFlags.PublicKey, id.Flags); Assert.Equal("", id.CultureName); @@ -155,8 +155,8 @@ public void Properties() AssertEx.Equal(PublicKeyToken1, id.PublicKeyToken); Assert.Equal(AssemblyContentType.Default, id.ContentType); - id = new AssemblyIdentity("Foo", publicKeyOrToken: RoPublicKeyToken1, hasPublicKey: false, isRetargetable: true); - Assert.Equal("Foo", id.Name); + id = new AssemblyIdentity("Goo", publicKeyOrToken: RoPublicKeyToken1, hasPublicKey: false, isRetargetable: true); + Assert.Equal("Goo", id.Name); Assert.Equal(new Version(0, 0, 0, 0), id.Version); Assert.Equal(AssemblyNameFlags.Retargetable, id.Flags); Assert.Equal("", id.CultureName); @@ -166,8 +166,8 @@ public void Properties() AssertEx.Equal(PublicKeyToken1, id.PublicKeyToken); Assert.Equal(AssemblyContentType.Default, id.ContentType); - id = new AssemblyIdentity("Foo", publicKeyOrToken: RoPublicKey1, hasPublicKey: true, isRetargetable: true); - Assert.Equal("Foo", id.Name); + id = new AssemblyIdentity("Goo", publicKeyOrToken: RoPublicKey1, hasPublicKey: true, isRetargetable: true); + Assert.Equal("Goo", id.Name); Assert.Equal(new Version(0, 0, 0, 0), id.Version); Assert.Equal(AssemblyNameFlags.PublicKey | AssemblyNameFlags.Retargetable, id.Flags); Assert.Equal("", id.CultureName); @@ -177,8 +177,8 @@ public void Properties() AssertEx.Equal(PublicKeyToken1, id.PublicKeyToken); Assert.Equal(AssemblyContentType.Default, id.ContentType); - id = new AssemblyIdentity("Foo", publicKeyOrToken: RoPublicKey1, hasPublicKey: true, contentType: AssemblyContentType.WindowsRuntime); - Assert.Equal("Foo", id.Name); + id = new AssemblyIdentity("Goo", publicKeyOrToken: RoPublicKey1, hasPublicKey: true, contentType: AssemblyContentType.WindowsRuntime); + Assert.Equal("Goo", id.Name); Assert.Equal(new Version(0, 0, 0, 0), id.Version); Assert.Equal(AssemblyNameFlags.PublicKey, id.Flags); Assert.Equal("", id.CultureName); @@ -192,21 +192,21 @@ public void Properties() [Fact] public void IsStrongName() { - var id1 = new AssemblyIdentity("Foo", new Version(1, 0, 0, 0), "", RoPublicKey1, hasPublicKey: true, isRetargetable: false); + var id1 = new AssemblyIdentity("Goo", new Version(1, 0, 0, 0), "", RoPublicKey1, hasPublicKey: true, isRetargetable: false); Assert.True(id1.IsStrongName); - var id2 = new AssemblyIdentity("Foo", new Version(1, 0, 0, 0), "", RoPublicKeyToken1, hasPublicKey: false, isRetargetable: false); + var id2 = new AssemblyIdentity("Goo", new Version(1, 0, 0, 0), "", RoPublicKeyToken1, hasPublicKey: false, isRetargetable: false); Assert.True(id2.IsStrongName); - var id3 = new AssemblyIdentity("Foo", new Version(1, 0, 0, 0), "", ImmutableArray.Empty, hasPublicKey: false, isRetargetable: false); + var id3 = new AssemblyIdentity("Goo", new Version(1, 0, 0, 0), "", ImmutableArray.Empty, hasPublicKey: false, isRetargetable: false); Assert.False(id3.IsStrongName); // for WinRT references "strong name" doesn't make sense: - var id4 = new AssemblyIdentity("Foo", new Version(1, 0, 0, 0), "", ImmutableArray.Empty, hasPublicKey: false, isRetargetable: false, contentType: AssemblyContentType.WindowsRuntime); + var id4 = new AssemblyIdentity("Goo", new Version(1, 0, 0, 0), "", ImmutableArray.Empty, hasPublicKey: false, isRetargetable: false, contentType: AssemblyContentType.WindowsRuntime); Assert.False(id4.IsStrongName); - var id5 = new AssemblyIdentity("Foo", new Version(1, 0, 0, 0), "", RoPublicKeyToken1, hasPublicKey: false, isRetargetable: false, contentType: AssemblyContentType.WindowsRuntime); + var id5 = new AssemblyIdentity("Goo", new Version(1, 0, 0, 0), "", RoPublicKeyToken1, hasPublicKey: false, isRetargetable: false, contentType: AssemblyContentType.WindowsRuntime); Assert.True(id5.IsStrongName); } @@ -218,10 +218,10 @@ public void InvalidConstructorArgs() Assert.Throws(() => new AssemblyIdentity(null)); Assert.Throws( - () => new AssemblyIdentity("Foo", new Version(1, 0, 0, 0), "", ImmutableArray.Empty, hasPublicKey: true, isRetargetable: false)); + () => new AssemblyIdentity("Goo", new Version(1, 0, 0, 0), "", ImmutableArray.Empty, hasPublicKey: true, isRetargetable: false)); Assert.Throws( - () => new AssemblyIdentity("Foo", new Version(1, 0, 0, 0), "", new byte[] { 1, 2, 3 }.AsImmutableOrNull(), hasPublicKey: false, isRetargetable: false)); + () => new AssemblyIdentity("Goo", new Version(1, 0, 0, 0), "", new byte[] { 1, 2, 3 }.AsImmutableOrNull(), hasPublicKey: false, isRetargetable: false)); foreach (var v in new Version[] { @@ -234,22 +234,22 @@ public void InvalidConstructorArgs() new Version(0, 0, 0, int.MaxValue), }) { - Assert.Throws(() => new AssemblyIdentity("Foo", v)); + Assert.Throws(() => new AssemblyIdentity("Goo", v)); } - Assert.Throws(() => new AssemblyIdentity("Foo", contentType: (AssemblyContentType)(-1))); - Assert.Throws(() => new AssemblyIdentity("Foo", contentType: (AssemblyContentType)int.MaxValue)); + Assert.Throws(() => new AssemblyIdentity("Goo", contentType: (AssemblyContentType)(-1))); + Assert.Throws(() => new AssemblyIdentity("Goo", contentType: (AssemblyContentType)int.MaxValue)); Assert.Throws(() => - new AssemblyIdentity("Foo", publicKeyOrToken: RoPublicKey1, hasPublicKey: true, isRetargetable: true, contentType: AssemblyContentType.WindowsRuntime)); + new AssemblyIdentity("Goo", publicKeyOrToken: RoPublicKey1, hasPublicKey: true, isRetargetable: true, contentType: AssemblyContentType.WindowsRuntime)); } [Fact] public void MetadataConstructor() { - var id = new AssemblyIdentity(/*noThrow:*/true, "Foo", new Version(1, 2, 3, 4), "en-US", RoPublicKey1, + var id = new AssemblyIdentity(/*noThrow:*/true, "Goo", new Version(1, 2, 3, 4), "en-US", RoPublicKey1, hasPublicKey: true, isRetargetable: true, contentType: AssemblyContentType.Default); - Assert.Equal("Foo", id.Name); + Assert.Equal("Goo", id.Name); Assert.Equal(new Version(1, 2, 3, 4), id.Version); Assert.Equal(AssemblyNameFlags.PublicKey | AssemblyNameFlags.Retargetable, id.Flags); Assert.Equal("en-US", id.CultureName); @@ -260,7 +260,7 @@ public void MetadataConstructor() Assert.Equal(AssemblyContentType.Default, id.ContentType); // invalid content type: - id = new AssemblyIdentity(/*noThrow:*/true, "Foo", new Version(1, 2, 3, 4), null, ImmutableArray.Empty, + id = new AssemblyIdentity(/*noThrow:*/true, "Goo", new Version(1, 2, 3, 4), null, ImmutableArray.Empty, hasPublicKey: false, isRetargetable: false, contentType: (AssemblyContentType)2); Assert.Equal(AssemblyNameFlags.None, id.Flags); Assert.Equal("", id.CultureName); @@ -270,9 +270,9 @@ public void MetadataConstructor() Assert.Equal(AssemblyContentType.Default, id.ContentType); // default Retargetable=No if content type is WinRT - id = new AssemblyIdentity(/*noThrow:*/true, "Foo", new Version(1, 2, 3, 4), null, ImmutableArray.Empty, + id = new AssemblyIdentity(/*noThrow:*/true, "Goo", new Version(1, 2, 3, 4), null, ImmutableArray.Empty, hasPublicKey: false, isRetargetable: true, contentType: AssemblyContentType.WindowsRuntime); - Assert.Equal("Foo", id.Name); + Assert.Equal("Goo", id.Name); Assert.Equal(new Version(1, 2, 3, 4), id.Version); Assert.Equal(AssemblyNameFlags.None, id.Flags); Assert.Equal("", id.CultureName); @@ -283,15 +283,15 @@ public void MetadataConstructor() // invalid culture: // The native compiler doesn't enforce that the culture be anything in particular. // AssemblyIdentity should preserve user input even if it is of dubious utility. - id = new AssemblyIdentity(/*noThrow:*/true, "Foo", new Version(1, 2, 3, 4), "blah,", ImmutableArray.Empty, + id = new AssemblyIdentity(/*noThrow:*/true, "Goo", new Version(1, 2, 3, 4), "blah,", ImmutableArray.Empty, hasPublicKey: false, isRetargetable: false, contentType: AssemblyContentType.Default); Assert.Equal("blah,", id.CultureName); - id = new AssemblyIdentity(/*noThrow:*/true, "Foo", new Version(1, 2, 3, 4), "*", ImmutableArray.Empty, + id = new AssemblyIdentity(/*noThrow:*/true, "Goo", new Version(1, 2, 3, 4), "*", ImmutableArray.Empty, hasPublicKey: false, isRetargetable: false, contentType: AssemblyContentType.Default); Assert.Equal("*", id.CultureName); - id = new AssemblyIdentity(/*noThrow:*/true, "Foo", new Version(1, 2, 3, 4), "neutral", ImmutableArray.Empty, + id = new AssemblyIdentity(/*noThrow:*/true, "Goo", new Version(1, 2, 3, 4), "neutral", ImmutableArray.Empty, hasPublicKey: false, isRetargetable: false, contentType: AssemblyContentType.Default); Assert.Equal("", id.CultureName); } @@ -299,9 +299,9 @@ public void MetadataConstructor() [Fact] public void ToAssemblyName() { - var ai = new AssemblyIdentity("foo"); + var ai = new AssemblyIdentity("goo"); var an = ai.ToAssemblyName(); - Assert.Equal("foo", an.Name); + Assert.Equal("goo", an.Name); Assert.Equal(new Version(0, 0, 0, 0), an.Version); Assert.Equal(CultureInfo.InvariantCulture, an.CultureInfo); AssertEx.Equal(new byte[0], an.GetPublicKeyToken()); @@ -309,12 +309,12 @@ public void ToAssemblyName() Assert.Equal(AssemblyNameFlags.None, an.Flags); Assert.Equal(null, an.CodeBase); - ai = new AssemblyIdentity("foo", new Version(1, 2, 3, 4), "en-US", RoPublicKey1, + ai = new AssemblyIdentity("goo", new Version(1, 2, 3, 4), "en-US", RoPublicKey1, hasPublicKey: true, isRetargetable: true); an = ai.ToAssemblyName(); - Assert.Equal("foo", an.Name); + Assert.Equal("goo", an.Name); Assert.Equal(new Version(1, 2, 3, 4), an.Version); Assert.Equal(CultureInfo.GetCultureInfo("en-US"), an.CultureInfo); AssertEx.Equal(PublicKeyToken1, an.GetPublicKeyToken()); @@ -341,7 +341,7 @@ public void ToAssemblyName() [Fact] public void ToAssemblyName_Errors() { - var ai = new AssemblyIdentity("foo", cultureName: "*"); + var ai = new AssemblyIdentity("goo", cultureName: "*"); Assert.Throws(() => ai.ToAssemblyName()); } @@ -349,7 +349,7 @@ public void ToAssemblyName_Errors() public void Keys() { var an = new AssemblyName(); - an.Name = "Foo"; + an.Name = "Goo"; an.Version = new Version(1, 0, 0, 0); an.SetPublicKey(PublicKey1); var anPkt = an.GetPublicKeyToken(); @@ -361,8 +361,8 @@ public void Keys() [Fact] public void FullKeyAndToken() { - string displayPkt = "Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=" + StrPublicKeyToken1; - string displayPk = "Foo, Version=1.0.0.0, Culture=neutral, PublicKey=" + StrPublicKey1; + string displayPkt = "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=" + StrPublicKeyToken1; + string displayPk = "Goo, Version=1.0.0.0, Culture=neutral, PublicKey=" + StrPublicKey1; bool equivalent; FusionAssemblyIdentityComparer.AssemblyComparisonResult result; diff --git a/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/AssemblyPortabilityPolicyTests.cs b/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/AssemblyPortabilityPolicyTests.cs index 4e51071717827..26d4101fca502 100644 --- a/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/AssemblyPortabilityPolicyTests.cs +++ b/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/AssemblyPortabilityPolicyTests.cs @@ -165,8 +165,8 @@ public void LoadFromFile_NoValues() // ok, but no configuration: appConfig.WriteAllText( @" - - + + "); AssertIsEnabled(appConfig.Path, platform: true, nonPlatform: true); @@ -192,14 +192,14 @@ public void LoadFromFile_NoValues() appConfig.WriteAllText( @" - + - + - + - + "); AssertIsEnabled(appConfig.Path, platform: true, nonPlatform: true); @@ -325,7 +325,7 @@ public void LoadFromFile_UnknownAttributes2() - + @@ -347,14 +347,14 @@ public void LoadFromFile_InterleavingElements() appConfig.WriteAllText( @" - + - + "); AssertIsEnabled(appConfig.Path, platform: true, nonPlatform: true); @@ -367,11 +367,11 @@ public void LoadFromFile_EmptyElement() appConfig.WriteAllText( @" - + - + "); AssertIsEnabled(appConfig.Path, platform: true, nonPlatform: true); diff --git a/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/FusionAssemblyIdentityTests.cs b/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/FusionAssemblyIdentityTests.cs index b884a1018b0d2..b26b795dd6d27 100644 --- a/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/FusionAssemblyIdentityTests.cs +++ b/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/FusionAssemblyIdentityTests.cs @@ -76,75 +76,75 @@ private void RoundTrip(AssemblyName name, bool testFullName = true) [Fact] public void FusionAssemblyNameRoundTrip() { - RoundTrip(new AssemblyName("foo")); + RoundTrip(new AssemblyName("goo")); RoundTrip(new AssemblyName { Name = "~!@#$%^&*()_+={}:\"<>?[];',./" }); RoundTrip(new AssemblyName("\\,")); RoundTrip(new AssemblyName("\\\"")); - RoundTrip(new AssemblyIdentity("foo").ToAssemblyName()); + RoundTrip(new AssemblyIdentity("goo").ToAssemblyName()); // 0xffff version is not included in AssemblyName.FullName for some reason: - var name = new AssemblyIdentity("foo", version: new Version(0xffff, 0xffff, 0xffff, 0xffff)).ToAssemblyName(); + var name = new AssemblyIdentity("goo", version: new Version(0xffff, 0xffff, 0xffff, 0xffff)).ToAssemblyName(); RoundTrip(name, testFullName: false); var obj = FusionAssemblyIdentity.ToAssemblyNameObject(name); var display = FusionAssemblyIdentity.GetDisplayName(obj, FusionAssemblyIdentity.ASM_DISPLAYF.FULL); - Assert.Equal("foo, Version=65535.65535.65535.65535, Culture=neutral, PublicKeyToken=null", display); + Assert.Equal("goo, Version=65535.65535.65535.65535, Culture=neutral, PublicKeyToken=null", display); - RoundTrip(new AssemblyIdentity("foo", version: new Version(1, 2, 3, 4)).ToAssemblyName()); - RoundTrip(new AssemblyName("foo") { Version = new Version(1, 2, 3, 4) }); + RoundTrip(new AssemblyIdentity("goo", version: new Version(1, 2, 3, 4)).ToAssemblyName()); + RoundTrip(new AssemblyName("goo") { Version = new Version(1, 2, 3, 4) }); - RoundTrip(new AssemblyIdentity("foo", cultureName: CultureInfo.CurrentCulture.Name).ToAssemblyName()); - RoundTrip(new AssemblyIdentity("foo", cultureName: "").ToAssemblyName()); - RoundTrip(new AssemblyName("foo") { CultureInfo = CultureInfo.InvariantCulture }); + RoundTrip(new AssemblyIdentity("goo", cultureName: CultureInfo.CurrentCulture.Name).ToAssemblyName()); + RoundTrip(new AssemblyIdentity("goo", cultureName: "").ToAssemblyName()); + RoundTrip(new AssemblyName("goo") { CultureInfo = CultureInfo.InvariantCulture }); - RoundTrip(new AssemblyIdentity("foo", version: new Version(1, 2, 3, 4), cultureName: "en-US").ToAssemblyName()); - RoundTrip(new AssemblyIdentity("foo", publicKeyOrToken: new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }.AsImmutableOrNull()).ToAssemblyName()); - RoundTrip(new AssemblyIdentity("foo", version: new Version(1, 2, 3, 4), cultureName: CultureInfo.CurrentCulture.Name, publicKeyOrToken: new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }.AsImmutableOrNull()).ToAssemblyName()); + RoundTrip(new AssemblyIdentity("goo", version: new Version(1, 2, 3, 4), cultureName: "en-US").ToAssemblyName()); + RoundTrip(new AssemblyIdentity("goo", publicKeyOrToken: new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }.AsImmutableOrNull()).ToAssemblyName()); + RoundTrip(new AssemblyIdentity("goo", version: new Version(1, 2, 3, 4), cultureName: CultureInfo.CurrentCulture.Name, publicKeyOrToken: new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }.AsImmutableOrNull()).ToAssemblyName()); - RoundTrip(new AssemblyIdentity("foo", isRetargetable: true).ToAssemblyName()); - RoundTrip(new AssemblyIdentity("foo", contentType: AssemblyContentType.WindowsRuntime).ToAssemblyName()); + RoundTrip(new AssemblyIdentity("goo", isRetargetable: true).ToAssemblyName()); + RoundTrip(new AssemblyIdentity("goo", contentType: AssemblyContentType.WindowsRuntime).ToAssemblyName()); } [Fact] public void FusionGetBestMatch() { - var foo = FusionAssemblyIdentity.ToAssemblyNameObject("foo"); - var foo1 = FusionAssemblyIdentity.ToAssemblyNameObject("foo, Version=1.0.0.0, Culture=neutral"); - var foo2 = FusionAssemblyIdentity.ToAssemblyNameObject("foo, Version=2.0.0.0, Culture=neutral"); - var foo3 = FusionAssemblyIdentity.ToAssemblyNameObject("foo, Version=3.0.0.0, Culture=neutral"); - var foo3_enUS = FusionAssemblyIdentity.ToAssemblyNameObject("foo, Version=3.0.0.0, Culture=en-US"); - var foo3_deDE = FusionAssemblyIdentity.ToAssemblyNameObject("foo, Version=3.0.0.0, Culture=de-DE"); + var goo = FusionAssemblyIdentity.ToAssemblyNameObject("goo"); + var goo1 = FusionAssemblyIdentity.ToAssemblyNameObject("goo, Version=1.0.0.0, Culture=neutral"); + var goo2 = FusionAssemblyIdentity.ToAssemblyNameObject("goo, Version=2.0.0.0, Culture=neutral"); + var goo3 = FusionAssemblyIdentity.ToAssemblyNameObject("goo, Version=3.0.0.0, Culture=neutral"); + var goo3_enUS = FusionAssemblyIdentity.ToAssemblyNameObject("goo, Version=3.0.0.0, Culture=en-US"); + var goo3_deDE = FusionAssemblyIdentity.ToAssemblyNameObject("goo, Version=3.0.0.0, Culture=de-DE"); - var m = FusionAssemblyIdentity.GetBestMatch(new[] { foo2, foo1, foo3 }, null); - Assert.Equal(foo3, m); + var m = FusionAssemblyIdentity.GetBestMatch(new[] { goo2, goo1, goo3 }, null); + Assert.Equal(goo3, m); - m = FusionAssemblyIdentity.GetBestMatch(new[] { foo3, foo2, foo1 }, null); - Assert.Equal(foo3, m); + m = FusionAssemblyIdentity.GetBestMatch(new[] { goo3, goo2, goo1 }, null); + Assert.Equal(goo3, m); // only simple name is used - m = FusionAssemblyIdentity.GetBestMatch(new[] { foo2, foo3 }, null); - Assert.Equal(foo3, m); + m = FusionAssemblyIdentity.GetBestMatch(new[] { goo2, goo3 }, null); + Assert.Equal(goo3, m); // the first match if preferred cultures not specified - m = FusionAssemblyIdentity.GetBestMatch(new[] { foo1, foo3_deDE, foo3_enUS, foo2 }, null); - Assert.Equal(foo3_deDE, m); + m = FusionAssemblyIdentity.GetBestMatch(new[] { goo1, goo3_deDE, goo3_enUS, goo2 }, null); + Assert.Equal(goo3_deDE, m); // the first match if preferred cultures not specified - m = FusionAssemblyIdentity.GetBestMatch(new[] { foo1, foo3_deDE, foo3_enUS, foo2 }, null); - Assert.Equal(foo3_deDE, m); + m = FusionAssemblyIdentity.GetBestMatch(new[] { goo1, goo3_deDE, goo3_enUS, goo2 }, null); + Assert.Equal(goo3_deDE, m); - m = FusionAssemblyIdentity.GetBestMatch(new[] { foo1, foo3, foo3_deDE, foo3_enUS, foo2 }, "en-US"); - Assert.Equal(foo3_enUS, m); + m = FusionAssemblyIdentity.GetBestMatch(new[] { goo1, goo3, goo3_deDE, goo3_enUS, goo2 }, "en-US"); + Assert.Equal(goo3_enUS, m); - m = FusionAssemblyIdentity.GetBestMatch(new[] { foo1, foo3_deDE, foo3, foo3_enUS, foo2 }, "cz-CZ"); - Assert.Equal(foo3, m); + m = FusionAssemblyIdentity.GetBestMatch(new[] { goo1, goo3_deDE, goo3, goo3_enUS, goo2 }, "cz-CZ"); + Assert.Equal(goo3, m); - m = FusionAssemblyIdentity.GetBestMatch(new[] { foo3_deDE, foo2 }, "en-US"); - Assert.Equal(foo3_deDE, m); + m = FusionAssemblyIdentity.GetBestMatch(new[] { goo3_deDE, goo2 }, "en-US"); + Assert.Equal(goo3_deDE, m); // neutral culture wins over specific non-matching one: - m = FusionAssemblyIdentity.GetBestMatch(new[] { foo3_deDE, foo3, foo2 }, "en-US"); - Assert.Equal(foo3, m); + m = FusionAssemblyIdentity.GetBestMatch(new[] { goo3_deDE, goo3, goo2 }, "en-US"); + Assert.Equal(goo3, m); } [Fact] diff --git a/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/MetadataReferencePropertiesTests.cs b/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/MetadataReferencePropertiesTests.cs index 3e1e5c12190ae..5bfb80f71f136 100644 --- a/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/MetadataReferencePropertiesTests.cs +++ b/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/MetadataReferencePropertiesTests.cs @@ -18,8 +18,8 @@ public void Constructor() Assert.False(m.EmbedInteropTypes); Assert.Equal(MetadataImageKind.Assembly, m.Kind); - m = new MetadataReferenceProperties(MetadataImageKind.Assembly, aliases: ImmutableArray.Create("\\/[.'\":_)??\t\n*#$@^%*&)", "foo"), embedInteropTypes: true); - AssertEx.Equal(new[] { "\\/[.'\":_)??\t\n*#$@^%*&)", "foo" }, m.Aliases); + m = new MetadataReferenceProperties(MetadataImageKind.Assembly, aliases: ImmutableArray.Create("\\/[.'\":_)??\t\n*#$@^%*&)", "goo"), embedInteropTypes: true); + AssertEx.Equal(new[] { "\\/[.'\":_)??\t\n*#$@^%*&)", "goo" }, m.Aliases); Assert.True(m.EmbedInteropTypes); Assert.Equal(MetadataImageKind.Assembly, m.Kind); @@ -55,7 +55,7 @@ public void WithXxx() Assert.Equal(a.WithAliases(default(ImmutableArray)), new MetadataReferenceProperties(MetadataImageKind.Assembly, ImmutableArray.Empty, embedInteropTypes: true)); Assert.Equal(a.WithAliases(ImmutableArray.Empty), new MetadataReferenceProperties(MetadataImageKind.Assembly, default(ImmutableArray), embedInteropTypes: true)); Assert.Equal(a.WithAliases(new string[0]), new MetadataReferenceProperties(MetadataImageKind.Assembly, default(ImmutableArray), embedInteropTypes: true)); - Assert.Equal(a.WithAliases(new[] { "foo", "aaa" }), new MetadataReferenceProperties(MetadataImageKind.Assembly, ImmutableArray.Create("foo", "aaa"), embedInteropTypes: true)); + Assert.Equal(a.WithAliases(new[] { "goo", "aaa" }), new MetadataReferenceProperties(MetadataImageKind.Assembly, ImmutableArray.Create("goo", "aaa"), embedInteropTypes: true)); Assert.Equal(a.WithEmbedInteropTypes(false), new MetadataReferenceProperties(MetadataImageKind.Assembly, ImmutableArray.Create("a"), embedInteropTypes: false)); Assert.Equal(a.WithRecursiveAliases(true), new MetadataReferenceProperties(MetadataImageKind.Assembly, ImmutableArray.Create("a"), embedInteropTypes: true, hasRecursiveAliases: true)); diff --git a/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/MetadataReferenceTests.cs b/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/MetadataReferenceTests.cs index ae9b05f2c9789..d03ee4dbd3fea 100644 --- a/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/MetadataReferenceTests.cs +++ b/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/MetadataReferenceTests.cs @@ -31,7 +31,7 @@ public void CreateFrom_Errors() Assert.Throws(() => MetadataReference.CreateFromAssemblyInternal(null)); Assert.Throws(() => MetadataReference.CreateFromAssemblyInternal(typeof(object).Assembly, new MetadataReferenceProperties(MetadataImageKind.Module))); - var dynamicAssembly = AppDomain.CurrentDomain.DefineDynamicAssembly(new AssemblyName { Name = "Foo" }, System.Reflection.Emit.AssemblyBuilderAccess.Run); + var dynamicAssembly = AppDomain.CurrentDomain.DefineDynamicAssembly(new AssemblyName { Name = "Goo" }, System.Reflection.Emit.AssemblyBuilderAccess.Run); Assert.Throws(() => MetadataReference.CreateFromAssemblyInternal(dynamicAssembly)); } @@ -461,18 +461,18 @@ public void Equivalence() var i1 = AssemblyMetadata.CreateFromImage(TestResources.NetFX.v4_0_30319.mscorlib).GetReference(display: "i1"); var i2 = AssemblyMetadata.CreateFromImage(TestResources.NetFX.v4_0_30319.mscorlib).GetReference(display: "i2"); - var m1a = new MyReference(@"c:\a\foo.dll", display: "m1a"); + var m1a = new MyReference(@"c:\a\goo.dll", display: "m1a"); Assert.Equal("m1a", m1a.Display); - var m1b = new MyReference(@"c:\b\..\a\foo.dll", display: "m1b"); + var m1b = new MyReference(@"c:\b\..\a\goo.dll", display: "m1b"); Assert.Equal("m1b", m1b.Display); - var m2 = new MyReference(@"c:\b\foo.dll", display: "m2"); + var m2 = new MyReference(@"c:\b\goo.dll", display: "m2"); Assert.Equal("m2", m2.Display); var m3 = new MyReference(null, display: "m3"); var m4 = new MyReference(null, display: "m4"); - var c1a = CS.CSharpCompilation.Create("foo").ToMetadataReference(); + var c1a = CS.CSharpCompilation.Create("goo").ToMetadataReference(); var c1b = c1a.Compilation.ToMetadataReference(); - var c2 = CS.CSharpCompilation.Create("foo").ToMetadataReference(); + var c2 = CS.CSharpCompilation.Create("goo").ToMetadataReference(); var all = new MetadataReference[] { f1, f2, i1, i2, m1a, m1b, m2, c1a, c1b, c2 }; foreach (var r in all) @@ -503,9 +503,9 @@ public void PortableReference_Display() var f1 = MscorlibRef; var f2 = SystemCoreRef; - var m1a = new MyReference2(@"c:\a\foo.dll", display: "m1a"); - Assert.Equal(@"c:\a\foo.dll", m1a.Display); - Assert.Equal(@"c:\a\foo.dll", m1a.FilePath); + var m1a = new MyReference2(@"c:\a\goo.dll", display: "m1a"); + Assert.Equal(@"c:\a\goo.dll", m1a.Display); + Assert.Equal(@"c:\a\goo.dll", m1a.FilePath); } [Fact] @@ -515,7 +515,7 @@ public void DocCommentProvider() var corlib = AssemblyMetadata.CreateFromImage(TestResources.NetFX.v4_0_30319.mscorlib). GetReference(display: "corlib", documentation: docProvider); - var comp = CS.CSharpCompilation.Create("foo", + var comp = CS.CSharpCompilation.Create("goo", syntaxTrees: new[] { CS.SyntaxFactory.ParseSyntaxTree("class C : System.Collections.ArrayList { }") }, references: new[] { corlib }); diff --git a/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/ModuleMetadataTests.cs b/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/ModuleMetadataTests.cs index 4f4f1b0655b55..0969650cbd34c 100644 --- a/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/ModuleMetadataTests.cs +++ b/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/ModuleMetadataTests.cs @@ -82,7 +82,7 @@ public void CreateFromFile() { Assert.Throws(() => ModuleMetadata.CreateFromFile((string)null)); Assert.Throws(() => ModuleMetadata.CreateFromFile("")); - Assert.Throws(() => ModuleMetadata.CreateFromFile(@"http://foo.bar")); + Assert.Throws(() => ModuleMetadata.CreateFromFile(@"http://goo.bar")); Assert.Throws(() => ModuleMetadata.CreateFromFile(@"c:\*")); Assert.Throws(() => ModuleMetadata.CreateFromFile(@"\\.\COM1")); diff --git a/src/Compilers/Core/CodeAnalysisTest/StringTableTests.cs b/src/Compilers/Core/CodeAnalysisTest/StringTableTests.cs index 80f78d2e71cd4..d3bccb11f0fd7 100644 --- a/src/Compilers/Core/CodeAnalysisTest/StringTableTests.cs +++ b/src/Compilers/Core/CodeAnalysisTest/StringTableTests.cs @@ -13,8 +13,8 @@ public sealed class StringTableTests public void TestAddSameWithStringBuilderProducesSameStringInstance() { var st = new StringTable(); - var sb1 = new StringBuilder("foo"); - var sb2 = new StringBuilder("foo"); + var sb1 = new StringBuilder("goo"); + var sb2 = new StringBuilder("goo"); var s1 = st.Add(sb1); var s2 = st.Add(sb2); Assert.Same(s1, s2); @@ -24,7 +24,7 @@ public void TestAddSameWithStringBuilderProducesSameStringInstance() public void TestAddDifferentWithStringBuilderProducesDifferentStringInstance() { var st = new StringTable(); - var sb1 = new StringBuilder("foo"); + var sb1 = new StringBuilder("goo"); var sb2 = new StringBuilder("bar"); var s1 = st.Add(sb1); var s2 = st.Add(sb2); @@ -62,8 +62,8 @@ public void TestAddSameWithCharProducesSameStringInstance() [Fact] public void TestSharedAddSameWithStringBuilderProducesSameStringInstance() { - var sb1 = new StringBuilder("foo"); - var sb2 = new StringBuilder("foo"); + var sb1 = new StringBuilder("goo"); + var sb2 = new StringBuilder("goo"); var s1 = new StringTable().Add(sb1); var s2 = new StringTable().Add(sb2); Assert.Same(s1, s2); diff --git a/src/Compilers/Core/CodeAnalysisTest/StrongNameProviderTests.cs b/src/Compilers/Core/CodeAnalysisTest/StrongNameProviderTests.cs index 042d3cfa12235..b3ea19a2ef4c6 100644 --- a/src/Compilers/Core/CodeAnalysisTest/StrongNameProviderTests.cs +++ b/src/Compilers/Core/CodeAnalysisTest/StrongNameProviderTests.cs @@ -40,7 +40,7 @@ public void ResolveStrongNameKeyFile() // search paths var providerSP = new VirtualizedStrongNameProvider( existingFullPaths: fs, - searchPaths: ImmutableArray.Create(@"C:\foo", dir, subdir)); + searchPaths: ImmutableArray.Create(@"C:\goo", dir, subdir)); path = providerSP.ResolveStrongNameKeyFile(fileName); Assert.Equal(filePath, path, StringComparer.OrdinalIgnoreCase); diff --git a/src/Compilers/Core/CodeAnalysisTest/Text/LargeTextTests.cs b/src/Compilers/Core/CodeAnalysisTest/Text/LargeTextTests.cs index 31f98cc762cff..6ef102ca82e4f 100644 --- a/src/Compilers/Core/CodeAnalysisTest/Text/LargeTextTests.cs +++ b/src/Compilers/Core/CodeAnalysisTest/Text/LargeTextTests.cs @@ -191,9 +191,9 @@ private static void CheckLine(SourceText text, int lineNumber, int start, int le [Fact] public void NewLines1() { - var data = CreateSourceText("foo" + Environment.NewLine + " bar"); + var data = CreateSourceText("goo" + Environment.NewLine + " bar"); Assert.Equal(2, data.Lines.Count); - CheckLine(data, lineNumber: 0, start: 0, length: 3, newlineLength: 2, lineText: "foo"); + CheckLine(data, lineNumber: 0, start: 0, length: 3, newlineLength: 2, lineText: "goo"); CheckLine(data, lineNumber: 1, start: 5, length: 4, newlineLength: 0, lineText: " bar"); } @@ -201,12 +201,12 @@ public void NewLines1() public void NewLines2() { var text = -@"foo +@"goo bar baz"; var data = CreateSourceText(text); Assert.Equal(3, data.Lines.Count); - CheckLine(data, lineNumber: 0, start: 0, length: 3, newlineLength: 2, lineText: "foo"); + CheckLine(data, lineNumber: 0, start: 0, length: 3, newlineLength: 2, lineText: "goo"); CheckLine(data, lineNumber: 1, start: 5, length: 3, newlineLength: 2, lineText: "bar"); CheckLine(data, lineNumber: 2, start: 10, length: 3, newlineLength: 0, lineText: "baz"); } @@ -214,18 +214,18 @@ public void NewLines2() [Fact] public void NewLines3() { - var data = CreateSourceText("foo\r\nbar"); + var data = CreateSourceText("goo\r\nbar"); Assert.Equal(2, data.Lines.Count); - CheckLine(data, lineNumber: 0, start: 0, length: 3, newlineLength: 2, lineText: "foo"); + CheckLine(data, lineNumber: 0, start: 0, length: 3, newlineLength: 2, lineText: "goo"); CheckLine(data, lineNumber: 1, start: 5, length: 3, newlineLength: 0, lineText: "bar"); } [Fact] public void NewLines4() { - var data = CreateSourceText("foo\n\rbar\u2028"); + var data = CreateSourceText("goo\n\rbar\u2028"); Assert.Equal(4, data.Lines.Count); - CheckLine(data, lineNumber: 0, start: 0, length: 3, newlineLength: 1, lineText: "foo"); + CheckLine(data, lineNumber: 0, start: 0, length: 3, newlineLength: 1, lineText: "goo"); CheckLine(data, lineNumber: 1, start: 4, length: 0, newlineLength: 1, lineText: ""); CheckLine(data, lineNumber: 2, start: 5, length: 3, newlineLength: 1, lineText: "bar"); CheckLine(data, lineNumber: 3, start: 9, length: 0, newlineLength: 0, lineText: ""); @@ -235,9 +235,9 @@ public void NewLines4() public void NewLines5() { // Trailing CR - var data = CreateSourceText("foo\r"); + var data = CreateSourceText("goo\r"); Assert.Equal(2, data.Lines.Count); - CheckLine(data, lineNumber: 0, start: 0, length: 3, newlineLength: 1, lineText: "foo"); + CheckLine(data, lineNumber: 0, start: 0, length: 3, newlineLength: 1, lineText: "goo"); CheckLine(data, lineNumber: 1, start: 4, length: 0, newlineLength: 0, lineText: ""); } @@ -245,9 +245,9 @@ public void NewLines5() public void NewLines6() { // Trailing CR+LF - var data = CreateSourceText("foo\r\n"); + var data = CreateSourceText("goo\r\n"); Assert.Equal(2, data.Lines.Count); - CheckLine(data, lineNumber: 0, start: 0, length: 3, newlineLength: 2, lineText: "foo"); + CheckLine(data, lineNumber: 0, start: 0, length: 3, newlineLength: 2, lineText: "goo"); CheckLine(data, lineNumber: 1, start: 5, length: 0, newlineLength: 0, lineText: ""); } @@ -255,9 +255,9 @@ public void NewLines6() public void NewLines7() { // Consecutive CR - var data = CreateSourceText("foo\r\rbar"); + var data = CreateSourceText("goo\r\rbar"); Assert.Equal(3, data.Lines.Count); - CheckLine(data, lineNumber: 0, start: 0, length: 3, newlineLength: 1, lineText: "foo"); + CheckLine(data, lineNumber: 0, start: 0, length: 3, newlineLength: 1, lineText: "goo"); CheckLine(data, lineNumber: 1, start: 4, length: 0, newlineLength: 1, lineText: ""); CheckLine(data, lineNumber: 2, start: 5, length: 3, newlineLength: 0, lineText: "bar"); } @@ -268,9 +268,9 @@ public void NewLines8() // Mix CR with CR+LF const string cr = "\r"; const string crLf = "\r\n"; - var data = CreateSourceText("foo" + cr + crLf + cr + "bar"); + var data = CreateSourceText("goo" + cr + crLf + cr + "bar"); Assert.Equal(4, data.Lines.Count); - CheckLine(data, lineNumber: 0, start: 0, length: 3, newlineLength: 1, lineText: "foo"); + CheckLine(data, lineNumber: 0, start: 0, length: 3, newlineLength: 1, lineText: "goo"); CheckLine(data, lineNumber: 1, start: 4, length: 0, newlineLength: 2, lineText: ""); CheckLine(data, lineNumber: 2, start: 6, length: 0, newlineLength: 1, lineText: ""); CheckLine(data, lineNumber: 3, start: 7, length: 3, newlineLength: 0, lineText: "bar"); @@ -283,9 +283,9 @@ public void NewLines9() const string cr = "\r"; const string crLf = "\r\n"; const string lf = "\n"; - var data = CreateSourceText("foo" + cr + crLf + lf + "bar"); + var data = CreateSourceText("goo" + cr + crLf + lf + "bar"); Assert.Equal(4, data.Lines.Count); - CheckLine(data, lineNumber: 0, start: 0, length: 3, newlineLength: 1, lineText: "foo"); + CheckLine(data, lineNumber: 0, start: 0, length: 3, newlineLength: 1, lineText: "goo"); CheckLine(data, lineNumber: 1, start: 4, length: 0, newlineLength: 2, lineText: ""); CheckLine(data, lineNumber: 2, start: 6, length: 0, newlineLength: 1, lineText: ""); CheckLine(data, lineNumber: 3, start: 7, length: 3, newlineLength: 0, lineText: "bar"); @@ -303,32 +303,32 @@ public void Empty() public void LinesGetText1() { var text = -@"foo +@"goo bar baz"; var data = CreateSourceText(text); Assert.Equal(2, data.Lines.Count); - Assert.Equal("foo", data.Lines[0].ToString()); + Assert.Equal("goo", data.Lines[0].ToString()); Assert.Equal("bar baz", data.Lines[1].ToString()); } [Fact] public void LinesGetText2() { - var text = "foo"; + var text = "goo"; var data = CreateSourceText(text); - Assert.Equal("foo", data.Lines[0].ToString()); + Assert.Equal("goo", data.Lines[0].ToString()); } [Fact] public void FromTextReader() { - var expected = "foo"; + var expected = "goo"; var expectedSourceText = CreateSourceText(expected); var actual = new StringReader(expected); var actualSourceText = CreateSourceText(actual, expected.Length); - Assert.Equal("foo", actualSourceText.Lines[0].ToString()); + Assert.Equal("goo", actualSourceText.Lines[0].ToString()); Assert.Equal(expectedSourceText.GetChecksum(), actualSourceText.GetChecksum()); } } diff --git a/src/Compilers/Core/CodeAnalysisTest/Text/StringTextDecodingTests.cs b/src/Compilers/Core/CodeAnalysisTest/Text/StringTextDecodingTests.cs index 91b90dbb69cfe..48fd50f131f1c 100644 --- a/src/Compilers/Core/CodeAnalysisTest/Text/StringTextDecodingTests.cs +++ b/src/Compilers/Core/CodeAnalysisTest/Text/StringTextDecodingTests.cs @@ -237,7 +237,7 @@ public void MemoryStreamBasedEncodedText1() { foreach (var readEncoding in encodings) { - var text = CreateMemoryStreamBasedEncodedText("foo", writeEncoding, readEncoding); + var text = CreateMemoryStreamBasedEncodedText("goo", writeEncoding, readEncoding); Assert.Equal(1, text.Lines.Count); Assert.Equal(3, text.Lines[0].Span.Length); } @@ -267,7 +267,7 @@ public void MemoryStreamBasedEncodedText2() { foreach (var readEncoding in readEncodings) { - var text = CreateMemoryStreamBasedEncodedText("foo", writeEncoding, readEncoding); + var text = CreateMemoryStreamBasedEncodedText("goo", writeEncoding, readEncoding); Assert.Equal(1, text.Lines.Count); Assert.Equal(3, text.Lines[0].Span.Length); } diff --git a/src/Compilers/Core/CodeAnalysisTest/Text/StringTextTest.cs b/src/Compilers/Core/CodeAnalysisTest/Text/StringTextTest.cs index 317fd6544bebc..e0fc2972998c5 100644 --- a/src/Compilers/Core/CodeAnalysisTest/Text/StringTextTest.cs +++ b/src/Compilers/Core/CodeAnalysisTest/Text/StringTextTest.cs @@ -39,7 +39,7 @@ internal static string ChecksumToHexQuads(ImmutableArray checksum) [Fact] public void FromString() { - var data = SourceText.From("foo", Encoding.UTF8); + var data = SourceText.From("goo", Encoding.UTF8); Assert.Equal(1, data.Lines.Count); Assert.Equal(3, data.Lines[0].Span.Length); } @@ -47,7 +47,7 @@ public void FromString() [Fact] public void FromString_DefaultEncoding() { - var data = SourceText.From("foo"); + var data = SourceText.From("goo"); Assert.Null(data.Encoding); } @@ -145,9 +145,9 @@ private void CheckLine(SourceText text, int lineNumber, int start, int length, i [Fact] public void NewLines1() { - var data = SourceText.From("foo" + Environment.NewLine + " bar"); + var data = SourceText.From("goo" + Environment.NewLine + " bar"); Assert.Equal(2, data.Lines.Count); - CheckLine(data, lineNumber: 0, start: 0, length: 3, newlineLength: 2, lineText: "foo"); + CheckLine(data, lineNumber: 0, start: 0, length: 3, newlineLength: 2, lineText: "goo"); CheckLine(data, lineNumber: 1, start: 5, length: 4, newlineLength: 0, lineText: " bar"); } @@ -155,12 +155,12 @@ public void NewLines1() public void NewLines2() { var text = -@"foo +@"goo bar baz"; var data = SourceText.From(text); Assert.Equal(3, data.Lines.Count); - CheckLine(data, lineNumber: 0, start: 0, length: 3, newlineLength: 2, lineText: "foo"); + CheckLine(data, lineNumber: 0, start: 0, length: 3, newlineLength: 2, lineText: "goo"); CheckLine(data, lineNumber: 1, start: 5, length: 3, newlineLength: 2, lineText: "bar"); CheckLine(data, lineNumber: 2, start: 10, length: 3, newlineLength: 0, lineText: "baz"); } @@ -168,18 +168,18 @@ public void NewLines2() [Fact] public void NewLines3() { - var data = SourceText.From("foo\r\nbar"); + var data = SourceText.From("goo\r\nbar"); Assert.Equal(2, data.Lines.Count); - CheckLine(data, lineNumber: 0, start: 0, length: 3, newlineLength: 2, lineText: "foo"); + CheckLine(data, lineNumber: 0, start: 0, length: 3, newlineLength: 2, lineText: "goo"); CheckLine(data, lineNumber: 1, start: 5, length: 3, newlineLength: 0, lineText: "bar"); } [Fact] public void NewLines4() { - var data = SourceText.From("foo\n\rbar\u2028"); + var data = SourceText.From("goo\n\rbar\u2028"); Assert.Equal(4, data.Lines.Count); - CheckLine(data, lineNumber: 0, start: 0, length: 3, newlineLength: 1, lineText: "foo"); + CheckLine(data, lineNumber: 0, start: 0, length: 3, newlineLength: 1, lineText: "goo"); CheckLine(data, lineNumber: 1, start: 4, length: 0, newlineLength: 1, lineText: ""); CheckLine(data, lineNumber: 2, start: 5, length: 3, newlineLength: 1, lineText: "bar"); CheckLine(data, lineNumber: 3, start: 9, length: 0, newlineLength: 0, lineText: ""); @@ -197,20 +197,20 @@ public void Empty() public void LinesGetText1() { var text = -@"foo +@"goo bar baz"; var data = SourceText.From(text); Assert.Equal(2, data.Lines.Count); - Assert.Equal("foo", data.Lines[0].ToString()); + Assert.Equal("goo", data.Lines[0].ToString()); Assert.Equal("bar baz", data.Lines[1].ToString()); } [Fact] public void LinesGetText2() { - var text = "foo"; + var text = "goo"; var data = SourceText.From(text); - Assert.Equal("foo", data.Lines[0].ToString()); + Assert.Equal("goo", data.Lines[0].ToString()); } [Fact] diff --git a/src/Compilers/Core/CodeAnalysisTest/Text/StringTextTests_Default.cs b/src/Compilers/Core/CodeAnalysisTest/Text/StringTextTests_Default.cs index b427f6e6e8f19..047c7cfc73185 100644 --- a/src/Compilers/Core/CodeAnalysisTest/Text/StringTextTests_Default.cs +++ b/src/Compilers/Core/CodeAnalysisTest/Text/StringTextTests_Default.cs @@ -51,7 +51,7 @@ public void Indexer1() [Fact] public void NewLines1() { - var data = Create("foo" + Environment.NewLine + " bar"); + var data = Create("goo" + Environment.NewLine + " bar"); Assert.Equal(2, data.Lines.Count); Assert.Equal(3, data.Lines[0].Span.Length); Assert.Equal(5, data.Lines[1].Span.Start); @@ -61,12 +61,12 @@ public void NewLines1() public void NewLines2() { var text = -@"foo +@"goo bar baz"; var data = Create(text); Assert.Equal(3, data.Lines.Count); - Assert.Equal("foo", data.ToString(data.Lines[0].Span)); + Assert.Equal("goo", data.ToString(data.Lines[0].Span)); Assert.Equal("bar", data.ToString(data.Lines[1].Span)); Assert.Equal("baz", data.ToString(data.Lines[2].Span)); } @@ -74,16 +74,16 @@ public void NewLines2() [Fact] public void NewLines3() { - var data = Create("foo\r\nbar"); + var data = Create("goo\r\nbar"); Assert.Equal(2, data.Lines.Count); - Assert.Equal("foo", data.ToString(data.Lines[0].Span)); + Assert.Equal("goo", data.ToString(data.Lines[0].Span)); Assert.Equal("bar", data.ToString(data.Lines[1].Span)); } [Fact] public void NewLines4() { - var data = Create("foo\n\rbar"); + var data = Create("goo\n\rbar"); Assert.Equal(3, data.Lines.Count); } @@ -91,25 +91,25 @@ public void NewLines4() public void LinesGetText1() { var data = Create( -@"foo +@"goo bar baz"); Assert.Equal(2, data.Lines.Count); - Assert.Equal("foo", data.Lines[0].ToString()); + Assert.Equal("goo", data.Lines[0].ToString()); Assert.Equal("bar baz", data.Lines[1].ToString()); } [Fact] public void LinesGetText2() { - var data = Create("foo"); - Assert.Equal("foo", data.Lines[0].ToString()); + var data = Create("goo"); + Assert.Equal("goo", data.Lines[0].ToString()); } #if false [Fact] public void TextLine1() { - var text = Create("foo" + Environment.NewLine); + var text = Create("goo" + Environment.NewLine); var span = new TextSpan(0, 3); var line = new TextLine(text, 0, 0, text.Length); Assert.Equal(span, line.Extent); @@ -120,7 +120,7 @@ public void TextLine1() [Fact] public void GetText1() { - var text = Create("foo"); + var text = Create("goo"); var line = new TextLine(text, 0, 0, 2); Assert.Equal("fo", line.ToString()); Assert.Equal(0, line.LineNumber); diff --git a/src/Compilers/Core/CodeAnalysisTest/Text/StringText_LineTest.cs b/src/Compilers/Core/CodeAnalysisTest/Text/StringText_LineTest.cs index 397d634d7cd7f..39f9730c6fa48 100644 --- a/src/Compilers/Core/CodeAnalysisTest/Text/StringText_LineTest.cs +++ b/src/Compilers/Core/CodeAnalysisTest/Text/StringText_LineTest.cs @@ -11,7 +11,7 @@ public class StringText_LineTest [Fact] public void FromSpanNotIncludingBreaks() { - var text = SourceText.From("foo" + Environment.NewLine); + var text = SourceText.From("goo" + Environment.NewLine); var span = new TextSpan(0, 3); var line = TextLine.FromSpan(text, span); Assert.Equal(span, line.Span); @@ -22,7 +22,7 @@ public void FromSpanNotIncludingBreaks() [Fact] public void FromSpanIncludingBreaksAtEnd() { - var text = SourceText.From("foo" + Environment.NewLine); + var text = SourceText.From("goo" + Environment.NewLine); var span = TextSpan.FromBounds(0, text.Length); var line = TextLine.FromSpan(text, span); Assert.Equal(span, line.SpanIncludingLineBreak); @@ -33,7 +33,7 @@ public void FromSpanIncludingBreaksAtEnd() [Fact] public void FromSpanIncludingBreaks() { - var text = SourceText.From("foo" + Environment.NewLine + "bar"); + var text = SourceText.From("goo" + Environment.NewLine + "bar"); var span = TextSpan.FromBounds(0, 5); var line = TextLine.FromSpan(text, span); Assert.Equal(span, line.SpanIncludingLineBreak); @@ -44,9 +44,9 @@ public void FromSpanIncludingBreaks() [Fact] public void FromSpanNoBreaksBeforeOrAfter() { - var text = SourceText.From("foo"); + var text = SourceText.From("goo"); var line = TextLine.FromSpan(text, new TextSpan(0, 3)); - Assert.Equal("foo", line.ToString()); + Assert.Equal("goo", line.ToString()); Assert.Equal(0, line.LineNumber); } @@ -74,7 +74,7 @@ public void FromSpanNotStartOfLineThrows() [Fact] public void FromSpanZeroLengthAtEnd() { - var text = SourceText.From("foo" + Environment.NewLine); + var text = SourceText.From("goo" + Environment.NewLine); var start = text.Length; var line = TextLine.FromSpan(text, new TextSpan(start, 0)); Assert.Equal("", line.ToString()); diff --git a/src/Compilers/Core/CodeAnalysisTest/Win32Res.cs b/src/Compilers/Core/CodeAnalysisTest/Win32Res.cs index 0bdef3d833aa3..06f050cbeeae3 100644 --- a/src/Compilers/Core/CodeAnalysisTest/Win32Res.cs +++ b/src/Compilers/Core/CodeAnalysisTest/Win32Res.cs @@ -44,7 +44,7 @@ public void BasicResourcesWithStringTypes() private IEnumerable BuildResources() { - yield return new Win32Resource(null, 0, 0, -1, "foo", 1, null);//4 + yield return new Win32Resource(null, 0, 0, -1, "goo", 1, null);//4 yield return new Win32Resource(null, 0, 0, -1, "b", -1, "a");//0 yield return new Win32Resource(null, 0, 0, 1, null, 1, null);//5 yield return new Win32Resource(null, 0, 0, -1, "b", 2, null);//6 @@ -73,7 +73,7 @@ public void EnsureResourceSorting() Assert.Equal("B", elem.Name); elem = resources[4]; Assert.Equal(1, elem.TypeId); - Assert.Equal("foo", elem.Name); + Assert.Equal("goo", elem.Name); elem = resources[5]; Assert.Equal(1, elem.TypeId); Assert.Equal(1, elem.Id); diff --git a/src/Compilers/Core/CodeAnalysisTest/XmlDocumentationCommentTextReaderTests.cs b/src/Compilers/Core/CodeAnalysisTest/XmlDocumentationCommentTextReaderTests.cs index bb39bef53937a..fb9eed9ccc68d 100644 --- a/src/Compilers/Core/CodeAnalysisTest/XmlDocumentationCommentTextReaderTests.cs +++ b/src/Compilers/Core/CodeAnalysisTest/XmlDocumentationCommentTextReaderTests.cs @@ -68,8 +68,8 @@ public void XmlValidation() var reader = new XmlDocumentationCommentTextReader(); Assert.Null(reader.ParseInternal("aaa")); - Assert.Null(reader.ParseInternal("")); - Assert.NotNull(reader.ParseInternal("")); + Assert.Null(reader.ParseInternal("")); + Assert.NotNull(reader.ParseInternal("")); Assert.NotNull(reader.ParseInternal("/a>")); Assert.NotNull(reader.ParseInternal("")); Assert.Null(reader.ParseInternal("")); diff --git a/src/Compilers/Core/MSBuildTask/CanonicalError.cs b/src/Compilers/Core/MSBuildTask/CanonicalError.cs index 27f6efd725ced..9d49c538ac3ca 100644 --- a/src/Compilers/Core/MSBuildTask/CanonicalError.cs +++ b/src/Compilers/Core/MSBuildTask/CanonicalError.cs @@ -289,7 +289,7 @@ internal static Parts Parse(string message) // First, split the message into three parts--Origin, Category, Code, Text. // Example, - // Main.cs(17,20):Command line warning CS0168: The variable 'foo' is declared but never used + // Main.cs(17,20):Command line warning CS0168: The variable 'goo' is declared but never used // -------------- ------------ ------- ------ ---------------------------------------------- // Origin SubCategory Cat. Code Text // @@ -336,13 +336,13 @@ internal static Parts Parse(string message) } // Origin is not a simple file, but it still could be of the form, - // foo.cpp(location) + // goo.cpp(location) match = s_filenameLocationFromOrigin.Match(origin); if (match.Success) { // The origin is in the form, - // foo.cpp(location) + // goo.cpp(location) // Assume the filename exists, but don't verify it. What else could it be? string location = match.Groups["LOCATION"].Value.Trim(); parsedMessage.origin = match.Groups["FILENAME"].Value.Trim(); diff --git a/src/Compilers/Core/MSBuildTask/CommandLineBuilderExtension.cs b/src/Compilers/Core/MSBuildTask/CommandLineBuilderExtension.cs index 79744f8b4ee66..5023505ef26a3 100644 --- a/src/Compilers/Core/MSBuildTask/CommandLineBuilderExtension.cs +++ b/src/Compilers/Core/MSBuildTask/CommandLineBuilderExtension.cs @@ -100,7 +100,7 @@ string parameterName /// /// Adds an aliased switch, used for ResGen: - /// /reference:Foo=System.Xml.dll + /// /reference:Goo=System.Xml.dll /// internal void AppendSwitchAliased(string switchName, string alias, string parameter) { diff --git a/src/Compilers/Core/MSBuildTask/Csc.cs b/src/Compilers/Core/MSBuildTask/Csc.cs index 6f0f0c5711ca0..de8fb96433ad6 100644 --- a/src/Compilers/Core/MSBuildTask/Csc.cs +++ b/src/Compilers/Core/MSBuildTask/Csc.cs @@ -18,7 +18,7 @@ namespace Microsoft.CodeAnalysis.BuildTasks /// meaning that the code is compiled by using the Roslyn compiler server, rather /// than csc.exe. The two should be functionally identical, but the compiler server /// should be significantly faster with larger projects and have a smaller memory - /// footprint. + /// gootprint. /// public class Csc : ManagedCompiler { @@ -262,7 +262,7 @@ protected internal override void AddResponseFileCommands(CommandLineBuilderExten /// This method handles the necessary work of looking at the "Aliases" attribute on /// the incoming "References" items, and making sure to generate the correct /// command-line on csc.exe. The syntax for aliasing a reference is: - /// csc.exe /reference:Foo=System.Xml.dll + /// csc.exe /reference:Goo=System.Xml.dll /// /// The "Aliases" attribute on the "References" items is actually a comma-separated /// list of aliases, and if any of the aliases specified is the string "global", @@ -349,7 +349,7 @@ internal static void AddReferencesToCommandLine( { // We have a valid (and explicit) alias for this reference. Add // it to the command-line using the syntax: - // /reference:Foo=System.Xml.dll + // /reference:Goo=System.Xml.dll commandLine.AppendSwitchAliased(switchName, trimmedAlias, reference.ItemSpec); } } diff --git a/src/Compilers/Core/MSBuildTask/Vbc.cs b/src/Compilers/Core/MSBuildTask/Vbc.cs index 025374b9a9d84..a672bff1e649f 100644 --- a/src/Compilers/Core/MSBuildTask/Vbc.cs +++ b/src/Compilers/Core/MSBuildTask/Vbc.cs @@ -19,7 +19,7 @@ namespace Microsoft.CodeAnalysis.BuildTasks /// meaning that the code is compiled by using the Roslyn compiler server, rather /// than vbc.exe. The two should be functionally identical, but the compiler server /// should be significantly faster with larger projects and have a smaller memory - /// footprint. + /// gootprint. /// public class Vbc : ManagedCompiler { @@ -778,10 +778,10 @@ string originalDefineConstants /// accordingly. /// /// Example: - /// If we attempted to pass in Platform="foobar", then this method would + /// If we attempted to pass in Platform="goobar", then this method would /// set HostCompilerSupportsAllParameters=true, but it would throw an /// exception because the host compiler fully supports - /// the Platform parameter, but "foobar" is an illegal value. + /// the Platform parameter, but "goobar" is an illegal value. /// /// Example: /// If we attempted to pass in NoConfig=false, then this method would set diff --git a/src/Compilers/Core/MSBuildTaskTests/IntegrationTests.cs b/src/Compilers/Core/MSBuildTaskTests/IntegrationTests.cs index 58c9e25ddb418..4ab633820e278 100644 --- a/src/Compilers/Core/MSBuildTaskTests/IntegrationTests.cs +++ b/src/Compilers/Core/MSBuildTaskTests/IntegrationTests.cs @@ -615,14 +615,14 @@ public void ReportAnalyzerMSBuild() [Fact(Skip = "failing msbuild")] public void SolutionWithPunctuation() { - var testDir = _tempDirectory.CreateDirectory(@"SLN;!@(foo)'^1"); - var slnFile = testDir.CreateFile("Console;!@(foo)'^(Application1.sln").WriteAllText( + var testDir = _tempDirectory.CreateDirectory(@"SLN;!@(goo)'^1"); + var slnFile = testDir.CreateFile("Console;!@(goo)'^(Application1.sln").WriteAllText( @" Microsoft Visual Studio Solution File, Format Version 10.00 # Visual Studio 2005 -Project(""{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"") = ""Cons.ole;!@(foo)'^(Application1"", ""Console;!@(foo)'^(Application1\Cons.ole;!@(foo)'^(Application1.csproj"", ""{770F2381-8C39-49E9-8C96-0538FA4349A7}"" +Project(""{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"") = ""Cons.ole;!@(goo)'^(Application1"", ""Console;!@(goo)'^(Application1\Cons.ole;!@(goo)'^(Application1.csproj"", ""{770F2381-8C39-49E9-8C96-0538FA4349A7}"" EndProject -Project(""{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"") = ""Class;!@(foo)'^(Library1"", ""Class;!@(foo)'^(Library1\Class;!@(foo)'^(Library1.csproj"", ""{0B4B78CC-C752-43C2-BE9A-319D20216129}"" +Project(""{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"") = ""Class;!@(goo)'^(Library1"", ""Class;!@(goo)'^(Library1\Class;!@(goo)'^(Library1.csproj"", ""{0B4B78CC-C752-43C2-BE9A-319D20216129}"" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -644,8 +644,8 @@ public void SolutionWithPunctuation() EndGlobalSection EndGlobal "); - var appDir = testDir.CreateDirectory(@"Console;!@(foo)'^(Application1"); - var appProjFile = appDir.CreateFile(@"Cons.ole;!@(foo)'^(Application1.csproj").WriteAllText( + var appDir = testDir.CreateDirectory(@"Console;!@(goo)'^(Application1"); + var appProjFile = appDir.CreateFile(@"Cons.ole;!@(goo)'^(Application1.csproj").WriteAllText( @" @@ -657,8 +657,8 @@ public void SolutionWithPunctuation() {770F2381-8C39-49E9-8C96-0538FA4349A7} Exe Properties - Console____foo____Application1 - Console%3b!%40%28foo%29%27^%28Application1 + Console____goo____Application1 + Console%3b!%40%28goo%29%27^%28Application1 true @@ -686,9 +686,9 @@ public void SolutionWithPunctuation() - + {0B4B78CC-C752-43C2-BE9A-319D20216129} - Class%3b!%40%28foo%29%27^%28Library1 + Class%3b!%40%28goo%29%27^%28Library1 @@ -701,19 +701,19 @@ public void SolutionWithPunctuation() using System.Collections.Generic; using System.Text; -namespace Console____foo____Application1 +namespace Console____goo____Application1 { class Program { static void Main(string[] args) { - Class____foo____Library1.Class1 foo = new Class____foo____Library1.Class1(); + Class____goo____Library1.Class1 goo = new Class____goo____Library1.Class1(); } } }"); - var libraryDir = testDir.CreateDirectory(@"Class;!@(foo)'^(Library1"); - var libraryProjFile = libraryDir.CreateFile("Class;!@(foo)'^(Library1.csproj").WriteAllText( + var libraryDir = testDir.CreateDirectory(@"Class;!@(goo)'^(Library1"); + var libraryProjFile = libraryDir.CreateFile("Class;!@(goo)'^(Library1.csproj").WriteAllText( @" @@ -725,8 +725,8 @@ static void Main(string[] args) {0B4B78CC-C752-43C2-BE9A-319D20216129} Library Properties - Class____foo____Library1 - Class%3b!%40%28foo%29%27^%28Library1 + Class____goo____Library1 + Class%3b!%40%28goo%29%27^%28Library1 true @@ -771,7 +771,7 @@ information again. --> var libraryClassFile = libraryDir.CreateFile("Class1.cs").WriteAllText( @" -namespace Class____foo____Library1 +namespace Class____goo____Library1 { public class Class1 { diff --git a/src/Compilers/Core/Portable/Collections/IdentifierCollection.cs b/src/Compilers/Core/Portable/Collections/IdentifierCollection.cs index 10839d0253c05..ffc8921e51d86 100644 --- a/src/Compilers/Core/Portable/Collections/IdentifierCollection.cs +++ b/src/Compilers/Core/Portable/Collections/IdentifierCollection.cs @@ -11,7 +11,7 @@ namespace Microsoft.CodeAnalysis /// /// A dictionary that maps strings to all known spellings of that string. Can be used to /// efficiently store the set of known type names for a module for both VB and C# while also - /// answering questions like "do you have a type called Foo" in either a case sensitive or + /// answering questions like "do you have a type called Goo" in either a case sensitive or /// insensitive manner. /// internal partial class IdentifierCollection diff --git a/src/Compilers/Core/Portable/CommandLine/CommonCommandLineParser.cs b/src/Compilers/Core/Portable/CommandLine/CommonCommandLineParser.cs index 7851d03e8d676..1e94743eb7655 100644 --- a/src/Compilers/Core/Portable/CommandLine/CommonCommandLineParser.cs +++ b/src/Compilers/Core/Portable/CommandLine/CommonCommandLineParser.cs @@ -89,7 +89,7 @@ internal static bool TryParseOption(string arg, out string name, out string valu int colon = arg.IndexOf(':'); // temporary heuristic to detect Unix-style rooted paths - // pattern /foo/* or //* will not be treated as a compiler option + // pattern /goo/* or //* will not be treated as a compiler option // // TODO: consider introducing "/s:path" to disambiguate paths starting with / if (arg.Length > 1) @@ -97,7 +97,7 @@ internal static bool TryParseOption(string arg, out string name, out string valu int separator = arg.IndexOf('/', 1); if (separator > 0 && (colon < 0 || separator < colon)) { - // "/foo/ + // "/goo/ // "// name = null; value = null; @@ -811,9 +811,9 @@ internal IEnumerable ParseFileArgument(string arg, string Debug.Assert(IsScriptRunner || !arg.StartsWith("-", StringComparison.Ordinal) && !arg.StartsWith("@", StringComparison.Ordinal)); // We remove all doubles quotes from a file name. So that, for example: - // "Path With Spaces"\foo.cs + // "Path With Spaces"\goo.cs // becomes - // Path With Spaces\foo.cs + // Path With Spaces\goo.cs string path = RemoveQuotesAndSlashes(arg); diff --git a/src/Compilers/Core/Portable/FileSystem/PathUtilities.cs b/src/Compilers/Core/Portable/FileSystem/PathUtilities.cs index dd9aa762754b0..14d1550c68f5d 100644 --- a/src/Compilers/Core/Portable/FileSystem/PathUtilities.cs +++ b/src/Compilers/Core/Portable/FileSystem/PathUtilities.cs @@ -283,13 +283,13 @@ public static PathKind GetPathKind(string path) if (!IsUnixLikePlatform) { // "\" - // "\foo" + // "\goo" if (path.Length >= 1 && IsDirectorySeparator(path[0])) { return PathKind.RelativeToCurrentRoot; } - // "C:foo" + // "C:goo" if (path.Length >= 2 && path[1] == VolumeSeparatorChar && (path.Length <= 2 || !IsDirectorySeparator(path[2]))) { @@ -297,7 +297,7 @@ public static PathKind GetPathKind(string path) } } - // "foo.dll" + // "goo.dll" return PathKind.Relative; } @@ -324,7 +324,7 @@ public static bool IsAbsolute(string path) } // "\\machine\share" - // Including invalid/incomplete UNC paths (e.g. "\\foo") + // Including invalid/incomplete UNC paths (e.g. "\\goo") return path.Length >= 2 && IsDirectorySeparator(path[0]) && IsDirectorySeparator(path[1]); @@ -428,13 +428,13 @@ public static bool IsFilePath(string assemblyDisplayNameOrPath) /// /// Determines if "path" contains 'component' within itself. - /// i.e. asking if the path "c:\foo\bar\baz" has component "bar" would return 'true'. - /// On the other hand, if you had "c:\foo\bar1\baz" then it would not have "bar" as a + /// i.e. asking if the path "c:\goo\bar\baz" has component "bar" would return 'true'. + /// On the other hand, if you had "c:\goo\bar1\baz" then it would not have "bar" as a /// component. /// /// A path contains a component if any file name or directory name in the path - /// matches 'component'. As such, if you had something like "\\foo" then that would - /// not have "foo" as a component. That's because here "foo" is the server name portion + /// matches 'component'. As such, if you had something like "\\goo" then that would + /// not have "goo" as a component. That's because here "goo" is the server name portion /// of the UNC path, and not an actual directory or file name. /// public static bool ContainsPathComponent(string path, string component, bool ignoreCase) diff --git a/src/Compilers/Core/Portable/InternalUtilities/FileNameUtilities.cs b/src/Compilers/Core/Portable/InternalUtilities/FileNameUtilities.cs index 95216286fe9e6..85e4ce2528168 100644 --- a/src/Compilers/Core/Portable/InternalUtilities/FileNameUtilities.cs +++ b/src/Compilers/Core/Portable/InternalUtilities/FileNameUtilities.cs @@ -33,8 +33,8 @@ internal static bool IsFileName(string path) /// Returns the offset in where the dot that starts an extension is, or -1 if the path doesn't have an extension. /// /// - /// Returns 0 for path ".foo". - /// Returns -1 for path "foo.". + /// Returns 0 for path ".goo". + /// Returns -1 for path "goo.". /// private static int IndexOfExtension(string path) { @@ -90,8 +90,8 @@ internal static string GetExtension(string path) /// Removes extension from path. /// /// - /// Returns "foo" for path "foo.". - /// Returns "foo.." for path "foo...". + /// Returns "goo" for path "goo.". + /// Returns "goo.." for path "goo...". /// private static string RemoveExtension(string path) { diff --git a/src/Compilers/Core/Portable/InternalUtilities/StringExtensions.cs b/src/Compilers/Core/Portable/InternalUtilities/StringExtensions.cs index 9a0aa357d9806..2cea9d4098781 100644 --- a/src/Compilers/Core/Portable/InternalUtilities/StringExtensions.cs +++ b/src/Compilers/Core/Portable/InternalUtilities/StringExtensions.cs @@ -71,8 +71,8 @@ private static string ConvertCase( bool trimLeadingTypePrefix, Func convert) { - // Special case the common .net pattern of "IFoo" as a type name. In this case we - // want to generate "foo" as the parameter name. + // Special case the common .net pattern of "IGoo" as a type name. In this case we + // want to generate "goo" as the parameter name. if (!string.IsNullOrEmpty(shortName)) { if (trimLeadingTypePrefix && (shortName.LooksLikeInterfaceName() || shortName.LooksLikeTypeParameterName())) diff --git a/src/Compilers/Core/Portable/MetadataReader/MetadataDecoder.cs b/src/Compilers/Core/Portable/MetadataReader/MetadataDecoder.cs index 031e3342f11b5..b4b3970f66b79 100644 --- a/src/Compilers/Core/Portable/MetadataReader/MetadataDecoder.cs +++ b/src/Compilers/Core/Portable/MetadataReader/MetadataDecoder.cs @@ -677,7 +677,7 @@ private ImmutableArray> DecodeModifiersOrThrow(ref Blob { ArrayBuilder> modifiers = null; - for (;;) + for (; ; ) { typeCode = signatureReader.ReadSignatureTypeCode(); @@ -711,10 +711,10 @@ private TypeSymbol DecodeModifierTypeOrThrow(ref BlobReader signatureReader) TypeSymbol type; bool isNoPiaLocalType; - // According to ECMA spec: - // The CMOD_OPT or CMOD_REQD is followed by a metadata token that - // indexes a row in the TypeDef table or the TypeRef table. - tryAgain: + // According to ECMA spec: + // The CMOD_OPT or CMOD_REQD is followed by a metadata token that + // indexes a row in the TypeDef table or the TypeRef table. + tryAgain: switch (token.Kind) { case HandleKind.TypeDefinition: @@ -1102,7 +1102,7 @@ private void DecodeParameterOrThrow(ref BlobReader signatureReader, /*out*/ ref if (typeCode == SignatureTypeCode.ByReference) { info.IsByRef = true; - info.RefCustomModifiers = info.CustomModifiers; + info.RefCustomModifiers = info.CustomModifiers; info.CustomModifiers = DecodeModifiersOrThrow(ref signatureReader, out typeCode); } @@ -1849,7 +1849,7 @@ protected TypeSymbol DecodeFieldSignature(ref BlobReader signatureReader, out bo SignatureTypeCode typeCode; ArrayBuilder> customModifierBuilder = null; - for (;;) + for (; ; ) { typeCode = signatureReader.ReadSignatureTypeCode(); diff --git a/src/Compilers/Core/Portable/MetadataReader/MetadataHelpers.cs b/src/Compilers/Core/Portable/MetadataReader/MetadataHelpers.cs index 18a8e696dc32f..7ffa5c30d3cf9 100644 --- a/src/Compilers/Core/Portable/MetadataReader/MetadataHelpers.cs +++ b/src/Compilers/Core/Portable/MetadataReader/MetadataHelpers.cs @@ -972,7 +972,7 @@ private static string GetAssemblyOrModuleNameErrorArgumentResourceName(string na /// Checks that the specified name is a valid metadata String and a file name. /// The specification isn't entirely consistent and complete but it mentions: /// - /// 22.19.2: "Name shall index a non-empty string in the String heap. It shall be in the format {filename}.{extension} (e.g., 'foo.dll', but not 'c:\utils\foo.dll')." + /// 22.19.2: "Name shall index a non-empty string in the String heap. It shall be in the format {filename}.{extension} (e.g., 'goo.dll', but not 'c:\utils\goo.dll')." /// 22.30.2: "The format of Name is {file name}.{file extension} with no path or drive letter; on POSIX-compliant systems Name contains no colon, no forward-slash, no backslash." /// As Microsoft specific constraint. /// diff --git a/src/Compilers/Core/Portable/SymbolDisplay/SymbolDisplayCompilerInternalOptions.cs b/src/Compilers/Core/Portable/SymbolDisplay/SymbolDisplayCompilerInternalOptions.cs index 00f602a2ba4b0..dcba5a54779c1 100644 --- a/src/Compilers/Core/Portable/SymbolDisplay/SymbolDisplayCompilerInternalOptions.cs +++ b/src/Compilers/Core/Portable/SymbolDisplay/SymbolDisplayCompilerInternalOptions.cs @@ -14,7 +14,7 @@ internal enum SymbolDisplayCompilerInternalOptions None = 0, /// - /// ".ctor" instead of "Foo" + /// ".ctor" instead of "Goo" /// UseMetadataMethodNames = 1 << 0, diff --git a/src/Compilers/Core/Portable/SymbolDisplay/SymbolDisplayGenericsOptions.cs b/src/Compilers/Core/Portable/SymbolDisplay/SymbolDisplayGenericsOptions.cs index 215e58c507fcc..c72d95a4637e9 100644 --- a/src/Compilers/Core/Portable/SymbolDisplay/SymbolDisplayGenericsOptions.cs +++ b/src/Compilers/Core/Portable/SymbolDisplay/SymbolDisplayGenericsOptions.cs @@ -17,7 +17,7 @@ public enum SymbolDisplayGenericsOptions /// /// Includes the type parameters. - /// For example, "Foo<T>" in C# or "Foo(Of T)" in Visual Basic. + /// For example, "Goo<T>" in C# or "Goo(Of T)" in Visual Basic. /// IncludeTypeParameters = 1 << 0, @@ -29,7 +29,7 @@ public enum SymbolDisplayGenericsOptions /// /// Includes in or out keywords before variant type parameters. - /// For example, "Foo<out T>" in C# or (Foo Of Out T" in Visual Basic. + /// For example, "Goo<out T>" in C# or (Goo Of Out T" in Visual Basic. /// IncludeVariance = 1 << 2, } diff --git a/src/Compilers/Core/Portable/SymbolDisplay/SymbolDisplayMemberOptions.cs b/src/Compilers/Core/Portable/SymbolDisplay/SymbolDisplayMemberOptions.cs index 46d41f1c5f81b..4355b6d6db501 100644 --- a/src/Compilers/Core/Portable/SymbolDisplay/SymbolDisplayMemberOptions.cs +++ b/src/Compilers/Core/Portable/SymbolDisplay/SymbolDisplayMemberOptions.cs @@ -38,7 +38,7 @@ public enum SymbolDisplayMemberOptions /// /// Includes the name of corresponding interface on members that explicitly implement /// interface members. - /// For example, "IFoo.Bar { get; }". + /// For example, "IGoo.Bar { get; }". /// /// /// This option has no effect in Visual Basic. diff --git a/src/Compilers/Core/Portable/Symbols/IErrorTypeSymbol.cs b/src/Compilers/Core/Portable/Symbols/IErrorTypeSymbol.cs index 0d578a07172fd..ad93171cb8d84 100644 --- a/src/Compilers/Core/Portable/Symbols/IErrorTypeSymbol.cs +++ b/src/Compilers/Core/Portable/Symbols/IErrorTypeSymbol.cs @@ -8,7 +8,7 @@ namespace Microsoft.CodeAnalysis { /// /// An IErrorTypeSymbol is used when the compiler cannot determine a symbol object to return because - /// of an error. For example, if a field is declared "Foo x;", and the type "Foo" cannot be + /// of an error. For example, if a field is declared "Goo x;", and the type "Goo" cannot be /// found, an IErrorTypeSymbol is returned when asking the field "x" what it's type is. /// /// diff --git a/src/Compilers/Server/VBCSCompilerTests/CompilerServerTests.cs b/src/Compilers/Server/VBCSCompilerTests/CompilerServerTests.cs index 255e90c9b2935..026604b35d145 100644 --- a/src/Compilers/Server/VBCSCompilerTests/CompilerServerTests.cs +++ b/src/Compilers/Server/VBCSCompilerTests/CompilerServerTests.cs @@ -1301,7 +1301,7 @@ public void BadKeepAlive1() [Fact] public void BadKeepAlive2() { - var result = RunCommandLineCompiler(CSharpCompilerClientExecutable, "/shared /keepalive:foo", _tempDirectory.Path); + var result = RunCommandLineCompiler(CSharpCompilerClientExecutable, "/shared /keepalive:goo", _tempDirectory.Path); Assert.True(result.ContainsErrors); Assert.Equal(1, result.ExitCode); diff --git a/src/Compilers/Test/Resources/Core/MetadataTests/InterfaceAndClass/CSClasses01.cs b/src/Compilers/Test/Resources/Core/MetadataTests/InterfaceAndClass/CSClasses01.cs index c7b3d23ade213..24ffc9503339c 100644 --- a/src/Compilers/Test/Resources/Core/MetadataTests/InterfaceAndClass/CSClasses01.cs +++ b/src/Compilers/Test/Resources/Core/MetadataTests/InterfaceAndClass/CSClasses01.cs @@ -6,18 +6,18 @@ namespace Metadata { public class ICSPropImpl : ICSProp { - protected EFoo efoo; - public virtual EFoo ReadOnlyProp + protected EGoo efoo; + public virtual EGoo ReadOnlyProp { get { return efoo; } } - public virtual EFoo WriteOnlyProp + public virtual EGoo WriteOnlyProp { set { efoo = value; } } - public virtual EFoo ReadWriteProp + public virtual EGoo ReadWriteProp { get { return efoo; } set { efoo = value; } @@ -41,7 +41,7 @@ public virtual void M01(params T[] ary) Console.Write("Base_ParamsT "); } - public abstract void M01(T p1, ref T p2, out DFoo p3); + public abstract void M01(T p1, ref T p2, out DGoo p3); public string M01(V p1, V p2) { diff --git a/src/Compilers/Test/Resources/Core/MetadataTests/InterfaceAndClass/CSInterfaces01.cs b/src/Compilers/Test/Resources/Core/MetadataTests/InterfaceAndClass/CSInterfaces01.cs index 318ad13ec9472..c674612fb8f79 100644 --- a/src/Compilers/Test/Resources/Core/MetadataTests/InterfaceAndClass/CSInterfaces01.cs +++ b/src/Compilers/Test/Resources/Core/MetadataTests/InterfaceAndClass/CSInterfaces01.cs @@ -4,14 +4,14 @@ namespace Metadata { - public enum EFoo { Zero, One, Two, Three } - public delegate void DFoo(T p1, T p2); + public enum EGoo { Zero, One, Two, Three } + public delegate void DGoo(T p1, T p2); public interface ICSProp { - EFoo ReadOnlyProp { get; } - EFoo WriteOnlyProp { set; } - EFoo ReadWriteProp { get; set; } + EGoo ReadOnlyProp { get; } + EGoo WriteOnlyProp { set; } + EGoo ReadWriteProp { get; set; } } public interface ICSGen @@ -19,7 +19,7 @@ public interface ICSGen void M01(T p1, T p2); void M01(T p1, params T[] ary); void M01(params T[] ary); - void M01(T p1, ref T p2, out DFoo p3); + void M01(T p1, ref T p2, out DGoo p3); string M01(V p1, V p2); string M01(V p1, object p2); diff --git a/src/Compilers/Test/Resources/Core/MetadataTests/Interop/Interop.Mock01.Impl.cs b/src/Compilers/Test/Resources/Core/MetadataTests/Interop/Interop.Mock01.Impl.cs index 3729c7816a55e..cf082f756b96a 100644 --- a/src/Compilers/Test/Resources/Core/MetadataTests/Interop/Interop.Mock01.Impl.cs +++ b/src/Compilers/Test/Resources/Core/MetadataTests/Interop/Interop.Mock01.Impl.cs @@ -5,23 +5,23 @@ namespace MockInterop01.Impl { - public class IFooImplExp : IFoo + public class IGooImplExp : IGoo { - InteropEnum IFoo.IFooReadOnlyProp { get { return InteropEnum.White; } } + InteropEnum IGoo.IGooReadOnlyProp { get { return InteropEnum.White; } } - ComplexStruct IFoo.MethodForStruct(ref UnionStruct p1, out InteropDeleWithStructArray p2) { p2 = null; return new ComplexStruct(); } + ComplexStruct IGoo.MethodForStruct(ref UnionStruct p1, out InteropDeleWithStructArray p2) { p2 = null; return new ComplexStruct(); } - string IFoo.this[string p, IFoo p2] + string IGoo.this[string p, IGoo p2] { get { return p; } set { } } - InteropDeleWithStructArray _FooEvent; - event InteropDeleWithStructArray IFoo.IFooEvent + InteropDeleWithStructArray _GooEvent; + event InteropDeleWithStructArray IGoo.IGooEvent { - add { _FooEvent += value; } - remove { _FooEvent -= value; } + add { _GooEvent += value; } + remove { _GooEvent -= value; } } } @@ -49,7 +49,7 @@ public class EventImpl : IEventEvent public event EventDele02 OnEvent02; public event EventDele03 OnEvent03; - public void Fire1(IFoo p) + public void Fire1(IGoo p) { if (OnEvent01 != null) OnEvent01(p); } diff --git a/src/Compilers/Test/Resources/Core/MetadataTests/Interop/Interop.Mock01.cs b/src/Compilers/Test/Resources/Core/MetadataTests/Interop/Interop.Mock01.cs index 5f80157caea4f..a67ab0958a33b 100644 --- a/src/Compilers/Test/Resources/Core/MetadataTests/Interop/Interop.Mock01.cs +++ b/src/Compilers/Test/Resources/Core/MetadataTests/Interop/Interop.Mock01.cs @@ -72,10 +72,10 @@ public struct InnerStruct [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] [Guid("5720C75D-2448-447A-B786-64682CBEF156")] [TypeLibType(TypeLibTypeFlags.FAggregatable)] - public interface IFoo + public interface IGoo { [DispId(1010)] - InteropEnum IFooReadOnlyProp { + InteropEnum IGooReadOnlyProp { [return: MarshalAs(UnmanagedType.U4), ComConversionLoss] get; } @@ -85,12 +85,12 @@ InteropEnum IFooReadOnlyProp { ComplexStruct MethodForStruct(ref UnionStruct p1, out InteropDeleWithStructArray p2); [DispId(1012)] - string this[string p, IFoo p2] { + string this[string p, IGoo p2] { [return: MarshalAs(UnmanagedType.BStr)] get; set; } [DispId(1013)] - event InteropDeleWithStructArray IFooEvent; + event InteropDeleWithStructArray IGooEvent; } [ComImport, Guid("ABCDEF5D-2448-447A-B786-64682CBEF123")] @@ -115,7 +115,7 @@ public interface IBar public interface IEventSource { [DispId(101), PreserveSig] - void Event01(IFoo p1); + void Event01(IGoo p1); [DispId(102), PreserveSig] void Event02(InteropEnum p1); [DispId(103), PreserveSig] @@ -133,7 +133,7 @@ public interface IEventEvent event EventDele03 OnEvent03; } - public delegate void EventDele01(IFoo p); + public delegate void EventDele01(IGoo p); public delegate void EventDele02(InteropEnum p); public delegate void EventDele03(ComplexStruct p); diff --git a/src/Compilers/Test/Resources/Core/MetadataTests/NetModule01/AppCS.cs b/src/Compilers/Test/Resources/Core/MetadataTests/NetModule01/AppCS.cs index 60beef0f1e230..95bd4591bf1f7 100644 --- a/src/Compilers/Test/Resources/Core/MetadataTests/NetModule01/AppCS.cs +++ b/src/Compilers/Test/Resources/Core/MetadataTests/NetModule01/AppCS.cs @@ -35,14 +35,14 @@ public class UseModule ModVBClass AppField02 = default(ModVBClass); ModVBClass.ModVBInnerEnum this[ModVBClass.ModVBInnerEnum p] { get { return p; } } - public NS.Module.CS01.CS02.ModClassImplImp Use() + public NS.Module.CS01.CS02.ModClassImplImp Use() { // x-modules - NS.Module.CS01.CS02.ModClassImplImp v = null; + NS.Module.CS01.CS02.ModClassImplImp v = null; if (null != AppField02) { - v = default(NS.Module.CS01.CS02.ModClassImplImp); - ModVBStruct.ModVBInnerStruct.ModVBInnerIFoo refVal = null; + v = default(NS.Module.CS01.CS02.ModClassImplImp); + ModVBStruct.ModVBInnerStruct.ModVBInnerIGoo refVal = null; v.M01(ref refVal); } return v; @@ -54,30 +54,30 @@ namespace AppCS { public interface IContraVar where CT: class { - CT ContraFooProp { set; } + CT ContraGooProp { set; } } public interface ICoVar { - CO CoFooMethod(); + CO CoGooMethod(); } interface INormal { - T NormalFoo(T t); + T NormalGoo(T t); } internal class ContraInClass : IContraVar where CT1 : class { - public CT1 ContraFooProp { set { } } + public CT1 ContraGooProp { set { } } } internal class CoOutClass : ICoVar where CO1 : new() { - public CO1 CoFooMethod() { return new CO1(); } + public CO1 CoGooMethod() { return new CO1(); } } internal class NormalClass : INormal { - public T1 NormalFoo(T1 t) { return default(T1); } + public T1 NormalGoo(T1 t) { return default(T1); } } class Animal { } @@ -90,11 +90,11 @@ public static int Main() IContraVar v1 = new ContraInClass(); CoOutClass v2 = new CoOutClass(); ICoVar v3 = v2; - var x = v2.CoFooMethod(); + var x = v2.CoGooMethod(); INormal vv1 = new NormalClass(); INormal vv2 = new NormalClass(); - vv1.NormalFoo(new Animal()); + vv1.NormalGoo(new Animal()); return 0; } } diff --git a/src/Compilers/Test/Resources/Core/MetadataTests/NetModule01/ModuleVB01.vb.txt b/src/Compilers/Test/Resources/Core/MetadataTests/NetModule01/ModuleVB01.vb.txt index d126aefd5e3dd..8f4b68017805c 100644 --- a/src/Compilers/Test/Resources/Core/MetadataTests/NetModule01/ModuleVB01.vb.txt +++ b/src/Compilers/Test/Resources/Core/MetadataTests/NetModule01/ModuleVB01.vb.txt @@ -1,4 +1,4 @@ -Imports System.Collections.Generic +Imports System.Collections.Generic ' Use types exposed from ModuleCS00 Public Class ModVBClass @@ -40,7 +40,7 @@ End Class Public Structure ModVBStruct Public Structure ModVBInnerStruct - Public Interface ModVBInnerIFoo + Public Interface ModVBInnerIGoo End Interface End Structure diff --git a/src/Compilers/Test/Resources/Core/PerfTests/CSPerfTest.cs b/src/Compilers/Test/Resources/Core/PerfTests/CSPerfTest.cs index 9db9fc9ba879e..94d197cb7f8cc 100644 --- a/src/Compilers/Test/Resources/Core/PerfTests/CSPerfTest.cs +++ b/src/Compilers/Test/Resources/Core/PerfTests/CSPerfTest.cs @@ -94,7 +94,7 @@ public void test() string s = "c1.test()"; { Console.WriteLine(s); - this.foo(o); foo(i); this.foo(b); this.foo(b1); // Overload Resolution, Implicit Conversions + this.goo(o); goo(i); this.goo(b); this.goo(b1); // Overload Resolution, Implicit Conversions } } } @@ -212,9 +212,9 @@ public virtual int virt(params int[] x) return new int(); } - internal int foo(int x) + internal int goo(int x) { - Console.WriteLine(" c1.foo(int)"); + Console.WriteLine(" c1.goo(int)"); // Read, Write Fields this.ui = 0u + this.ui; @@ -247,9 +247,9 @@ internal int foo(int x) return x; } - public bool foo(object x) + public bool goo(object x) { - Console.WriteLine(" c1.foo(object)"); + Console.WriteLine(" c1.goo(object)"); // Read, Write Fields ui = 0u; @@ -261,7 +261,7 @@ public bool foo(object x) bool b = true; string s = string.Empty; s = null; b = this.i != 1; ui = ui1; i = i1; - bar4(b); this.foo(i1); bar4(b == (true != b)); + bar4(b); this.goo(i1); bar4(b == (true != b)); // Read, Write Params x = null; x = new c1(this.i, this.ui, a); @@ -292,7 +292,7 @@ private void bar1(string x) this.ui = 0u - 0u; i = this.i * 1; this.a = new c1(); - this.foo(i.GetHashCode()); this.a = this; + this.goo(i.GetHashCode()); this.a = this; // Read, Write Locals c1 c = new c1(1, 0u, (null)); @@ -305,7 +305,7 @@ private void bar1(string x) c.a = c; c.a = c = this.a = c.a = null; c = new c1(i.GetHashCode()); - this.foo(c.i); bar3(c != null); + this.goo(c.i); bar3(c != null); if (this.i == 10321) { @@ -322,7 +322,7 @@ private void bar1(string x) string[] a1 = new string[] { "", null, null }; a1[1] = null; a1[2] = ""; string s = null; - s = a1[1]; foo(a1[2]); + s = a1[1]; goo(a1[2]); } protected string bar2(object x) @@ -333,7 +333,7 @@ protected string bar2(object x) this.ui = ui - this.ui; i = i / 1; a = null; - foo(i); + goo(i); // Read, Write Locals c1 c; @@ -382,7 +382,7 @@ internal object bar3(bool x) // Read, Write Params x = (this.i == i + 1); - foo(x.GetHashCode()); + goo(x.GetHashCode()); // Read, Write Array Element bool[] a1 = new bool[] { true, false, x }; @@ -390,7 +390,7 @@ internal object bar3(bool x) b = (a1[1]); b = a1[2]; object o = b != a1[2]; o = (a1[1].ToString()) == (a1[2].ToString()); - foo(a1[1].GetHashCode()); + goo(a1[1].GetHashCode()); if (b) { @@ -411,7 +411,7 @@ public c1 bar4(object x) this.ui = this.ui - (this.ui + this.ui) * this.ui; this.i = (i + 1) - (1 * (i / 1)); this.a = (null); - foo(this.i.GetHashCode()); + goo(this.i.GetHashCode()); // Read, Write Locals object o = null; @@ -424,17 +424,17 @@ public c1 bar4(object x) c.i = 1; c.i = this.i * (this.i / c.i + c.i); c.a = c = this.a = c.a = new c1(); c.a = c; - foo(c.GetHashCode()); bar3(c.a.GetHashCode() != i); + goo(c.GetHashCode()); bar3(c.a.GetHashCode() != i); // Read, Write Params x = (o.ToString()); - x = x.ToString(); foo(x.GetHashCode()); foo(x.ToString().GetHashCode()); + x = x.ToString(); goo(x.GetHashCode()); goo(x.ToString().GetHashCode()); // Read, Write Array Element object[] a1 = new object[] { (null), (this.a), c }; a1[1] = ((this.a)); a1[2] = (c); a1[1] = (i); Array.Reverse(a1); - o = a1[1]; foo(a1.GetHashCode()); bar3(a1[2] == null); + o = a1[1]; goo(a1.GetHashCode()); bar3(a1[2] == null); if (b) { @@ -472,7 +472,7 @@ public void TEST() if (b == 0) { Console.WriteLine(s); - this.foo(x: b, y: sb); // Named Arguments + this.goo(x: b, y: sb); // Named Arguments } } if (sb != 1) @@ -488,7 +488,7 @@ public void TEST() if (sb2 == 0) { Console.WriteLine(s2); - foo(x: b, y: sb2); // Named Arguments + goo(x: b, y: sb2); // Named Arguments } } if (b == sb2) @@ -576,14 +576,14 @@ private void bar(T x) const c1 const3 = null; if (true) { - this.bar4(const1); c.foo(const2 != 1); this.a = const3; + this.bar4(const1); c.goo(const2 != 1); this.a = const3; } } } - private T foo1(T x) + private T goo1(T x) { - Console.WriteLine(" c2.foo1(T)"); + Console.WriteLine(" c2.goo1(T)"); int aa = 1; @@ -601,15 +601,15 @@ private T foo1(T x) while (const2 == const1 - aa + aa) { - this.bar4(const1); c.foo(const2 != 1U); + this.bar4(const1); c.goo(const2 != 1U); return x; } return x; } - private bool foo(bool x) + private bool goo(bool x) { - Console.WriteLine(" c2.foo(bool)"); + Console.WriteLine(" c2.goo(bool)"); int aa = 1; @@ -631,14 +631,14 @@ private bool foo(bool x) return x; } - protected c1 foo(byte x, object y) + protected c1 goo(byte x, object y) { - Console.WriteLine(" c2.foo(byte, object)"); + Console.WriteLine(" c2.goo(byte, object)"); // Read, Write Params y = x; x = 1; c1 c = new c1(); - c.bar4(y); c.foo(x); + c.bar4(y); c.goo(x); // Read Consts const string const1 = ""; @@ -653,7 +653,7 @@ protected c1 foo(byte x, object y) byte bb = 1; if (bb == x) { - this.bar4(const1); this.foo(const2 != 1); this.a = const3; + this.bar4(const1); this.goo(const2 != 1); this.a = const3; break; } else @@ -673,7 +673,7 @@ internal void bar1(byte x, object y) // Read, Write Params y = x; x = 1; c1 c = new c1(); - c.bar4(y); c.foo(x); + c.bar4(y); c.goo(x); // Read Consts const long const1 = 1; @@ -682,7 +682,7 @@ internal void bar1(byte x, object y) while (const2 == 1U) { - this.bar4(const1); this.foo(const2 != 1); + this.bar4(const1); this.goo(const2 != 1); break; } } @@ -694,7 +694,7 @@ public int bar2(byte x, object y) // Read, Write Params y = x; x = 1; c1 c = new c1(); - c.bar4(y); this.foo(x); + c.bar4(y); this.goo(x); // Read Consts const long const1 = 1; @@ -704,7 +704,7 @@ public int bar2(byte x, object y) const c1 const3 = null; if (c != const3) { - c.bar4(const1); this.foo(const2 != 1); this.a = const3; + c.bar4(const1); this.goo(const2 != 1); this.a = const3; } } return (int)const1; @@ -718,7 +718,7 @@ internal float bar3(byte x, object y) y = x; x = 1; double d = 1.1; c1 c = new c1(); - this.bar4(y); c.foo(x); + this.bar4(y); c.goo(x); // Read Consts const string const1 = "hi"; @@ -729,7 +729,7 @@ internal float bar3(byte x, object y) const c1 const3 = null; if (const3 != c) { - this.bar4(const1); c.foo(const2 != 1); c.a = const3; + this.bar4(const1); c.goo(const2 != 1); c.a = const3; return (float)d; } return (float)(1.1f + (float)1.1); @@ -745,7 +745,7 @@ public static void test() string s = "c3.test()"; { Console.WriteLine(s); - foo(); foo(1); foo("1"); foo(1.1); // Overload Resolution, Implicit Conversions + goo(); goo(1); goo("1"); goo(1.1); // Overload Resolution, Implicit Conversions } // Nested Scopes { @@ -824,38 +824,38 @@ public static void test() } // Static Methods - protected static int foo(T x, U y) + protected static int goo(T x, U y) { - Console.WriteLine(" c3.foo(T, U)"); + Console.WriteLine(" c3.goo(T, U)"); int[] a = new int[3] { 1, 2, 3 }; a[1] = a[2]; return (int)((long)x.GetHashCode() + (long)(int)(long)y.GetHashCode()); } - internal static c1 foo(object x) + internal static c1 goo(object x) { - Console.WriteLine(" c3.foo(object)"); + Console.WriteLine(" c3.goo(object)"); c1[] a = new c1[3] { null, new c1(), new c1(1) }; a[1] = a[2]; x = "hi"; return new c1((int)1.1f, (uint)1, new c1(x.GetHashCode())); } - private static float foo(string x) + private static float goo(string x) { - Console.WriteLine(" c3.foo(string)"); + Console.WriteLine(" c3.goo(string)"); string[] a = new string[] { x, x, "", null }; a[1] = a[2]; a[2] = a[1]; - return (float)foo(x.GetHashCode()); + return (float)goo(x.GetHashCode()); } - public static int foo(int x) + public static int goo(int x) { - Console.WriteLine(" c3.foo(int)"); + Console.WriteLine(" c3.goo(int)"); int[] a = new int[] { x, x, 1, 0 }; a[1] = a[2]; a[2] = a[1]; return (int)x.GetHashCode() + x; } - public static string foo() + public static string goo() { - Console.WriteLine(" c3.foo()"); + Console.WriteLine(" c3.goo()"); string[] a = new string[] { "", null }; a[0] = a[1]; a[1] = a[0]; return (string)null; } @@ -880,7 +880,7 @@ public float bar(string x) Console.WriteLine(" c3.bar(string)"); string[] a = new string[] { x, x, "", null }; a[1] = a[2]; a[2] = a[1]; x = a[2]; - return (float)foo(x.GetHashCode()); + return (float)goo(x.GetHashCode()); } public int bar(int x) @@ -916,15 +916,15 @@ public static bool Test() int i = 2; Console.WriteLine(str); { - c1 a = new c1(i); a.foo(i); + c1 a = new c1(i); a.goo(i); } double d = 1.1; { sbyte sb = 1; c1 a = new c1(i + (i + i)); - a.foo(sb); + a.goo(sb); { - a.foo(d); + a.goo(d); } } @@ -1078,9 +1078,9 @@ public static bool Test() } // Non-Overloaded Method - public static c4 foo(int i, string s, bool b, byte b1, long l, string s1) + public static c4 goo(int i, string s, bool b, byte b1, long l, string s1) { - Console.WriteLine(" c4.foo(int, string, bool, byte, long, string)"); + Console.WriteLine(" c4.goo(int, string, bool, byte, long, string)"); return new c4(); } @@ -1117,18 +1117,18 @@ public int Test() { byte b1 = 1; long l = i; string s1 = s; float f = 1.2f; o = f; l = ui; - c4.foo(sh, s, b, b1, i, s1); // Implicit Conversions + c4.goo(sh, s, b, b1, i, s1); // Implicit Conversions c4 c = new c4(); - c.foo(sh); this.bar(sh); - cc.bar(c5.foo(cc.bar())); - c5.foo(cc.bar(c5.foo())); + c.goo(sh); this.bar(sh); + cc.bar(c5.goo(cc.bar())); + c5.goo(cc.bar(c5.goo())); if (b == false) { double d = f; ulong ul = 1; sbyte sb = 1; s1 = s; c4.bar(sh, us, sb, f, d, ui, ul); // Implicit Conversions c.bar4(us); this.bar(cc.bar(), c); - c5.foo(this.bar(c5.foo(), c)); + c5.goo(this.bar(c5.goo(), c)); } if (b1 >= l) { @@ -1138,18 +1138,18 @@ public int Test() { byte b11 = 1; long l1 = i; string s11 = s1; float f1 = 1.2f; o = f1; l1 = ui1; - c4.foo(sh, s1, b, b11, i, s11); // Implicit Conversions - c.foo(b); - this.bar(b); if (c5.foo() != null) c5.foo().ToString().GetHashCode(); - cc.bar(this.bar(c5.foo())); + c4.goo(sh, s1, b, b11, i, s11); // Implicit Conversions + c.goo(b); + this.bar(b); if (c5.goo() != null) c5.goo().ToString().GetHashCode(); + cc.bar(this.bar(c5.goo())); if (!false) { double d1 = f1; ulong ul1 = 1; sbyte sb1 = 1; s1 = s; c4.bar(sh, us, sb1, f1, d1, ui1, ul1); // Implicit Conversions - c.foo(b1, sb1); + c.goo(b1, sb1); this.bar(o).bar4(c); - cc.bar(c5.foo(o)).bar4(c).ToString(); + cc.bar(c5.goo(o)).bar4(c).ToString(); d1 = d; if (d != d1) return i; } @@ -1160,15 +1160,15 @@ public int Test() { byte b12 = 1; long l2 = i; string s12 = s11; float f2 = 1.2f; o = f1; l2 = ui1; - c4.foo(sh, s1, b, b12, i, s12); // Implicit Conversions + c4.goo(sh, s1, b, b12, i, s12); // Implicit Conversions c.bar4(b.ToString() == b.ToString()); - this.bar(c5.foo(cc.bar(i))); + this.bar(c5.goo(cc.bar(i))); { double d2 = f2; ulong ul2 = 1; sbyte sb2 = 1; s1 = s; c4.bar(sh, us, sb2, f2, d2, ui2, ul2); // Implicit Conversions - c.foo(false == true != false == b); + c.goo(false == true != false == b); c.bar4(sh > us == sh <= us); - this.bar((object)c5.foo((object)cc.bar((object)i))); + this.bar((object)c5.goo((object)cc.bar((object)i))); if (i != i + 1 - 1) @@ -2814,9 +2814,9 @@ public class c1 }; // Generic Method - protected void foo(Func x, Func y, Func z) + protected void goo(Func x, Func y, Func z) { - Console.WriteLine(" c1.foo(Func x, Func y, Func z)"); + Console.WriteLine(" c1.goo(Func x, Func y, Func z)"); TT t = default(TT); UU u = default(UU); VV v = default(VV); // Invoke Lambdas @@ -2824,15 +2824,15 @@ protected void foo(Func x, Func y, Func(TT xx, UU yy, VV zz) + protected void goo(TT xx, UU yy, VV zz) { - Console.WriteLine(" c1.foo(TT xx, UU yy, VV zz)"); + Console.WriteLine(" c1.goo(TT xx, UU yy, VV zz)"); } // Generic Method - protected void foo(Func, UU, Dictionary, UU>> x, Del y, Action, Dictionary, TT>> z) + protected void goo(Func, UU, Dictionary, UU>> x, Del y, Action, Dictionary, TT>> z) { - Console.WriteLine(" c1.foo(Func, Dictionary, UU>> x, Del y, Action, Dictionary, TT>> z)"); + Console.WriteLine(" c1.goo(Func, Dictionary, UU>> x, Del y, Action, Dictionary, TT>> z)"); TT t = default(TT); UU u = default(UU); VV v = default(VV); // Invoke Lambdas @@ -2934,9 +2934,9 @@ private void bar() func(tt, uu)(uu, vv)(vv, tt)(t, u)(u); } - public void foo(Func x, Func y, Func z, Func a, Func b, Func c) + public void goo(Func x, Func y, Func z, Func a, Func b, Func c) { - Console.WriteLine(" c1.foo(Func x, Func y, Func z, Func a, Func b, Func c)"); + Console.WriteLine(" c1.goo(Func x, Func y, Func z, Func a, Func b, Func c)"); } public void Test() @@ -2950,20 +2950,20 @@ public void Test() Del del = (a, b, c) => a; // Generic Methods, Simple Closures - foo>(y, x.ToString(), (a, b, c) => u); - foo, int>(x.ToString(), (a, b, c) => x, y); - foo((c, a) => a.ToString(), + goo>(y, x.ToString(), (a, b, c) => u); + goo, int>(x.ToString(), (a, b, c) => x, y); + goo((c, a) => a.ToString(), (int a, string b) => del, (b, c) => y - c(x, y, null)); // Generic Type Inference, Nested Lambdas - foo(x, "", del1); - foo(func, del2, + goo(x, "", del1); + goo(func, del2, (T a, List b, Dictionary, T> c) => { int z = x; { - foo(new Action(() => x = 2), + goo(new Action(() => x = 2), new Func((aa) => { return y + x + +z + b.Count; @@ -2975,35 +2975,35 @@ public void Test() } x = z; { - foo((aa, bb) => a.ToString(), + goo((aa, bb) => a.ToString(), (long bb, string cc) => y - (int)bb + b.Count - z, (string cc, int aa) => x + y + aa + c.Values.Count); } }); // Generic Type Inference, Dominant Type - foo((Exception a, Exception b) => new ArgumentException(), + goo((Exception a, Exception b) => new ArgumentException(), (Exception a, Exception b) => new ArgumentException(), (Exception a, Exception b) => new ArgumentException()); - foo((a, b) => new ArgumentException(), + goo((a, b) => new ArgumentException(), (a, b) => new ArgumentException(), (ArgumentException a, Exception b) => new Exception()); Func func2 = (Exception a) => new ArgumentException(); Func func3 = (ArgumentException a) => new ArgumentException(); - foo(func2, func2, func2, func2, func3, func3); - foo((a) => new ArgumentException(), + goo(func2, func2, func2, func2, func3, func3); + goo((a) => new ArgumentException(), (Exception a) => new InvalidCastException(), (a) => new InvalidCastException(), (ArgumentException a) => new Exception(), (a) => new ArgumentException(), (InvalidCastException a) => new ArgumentException()); - foo((Exception a) => new Exception(), + goo((Exception a) => new Exception(), (Exception a) => new ArgumentException(), (Exception a) => new ArgumentException(), (Exception a) => new Exception(), (Exception a) => new ArgumentException(), (Exception a) => new Exception()); - foo((a) => new Exception(), + goo((a) => new Exception(), (Exception a) => new ArgumentException(), (a) => new ArgumentException(), (a) => new Exception(), @@ -3030,54 +3030,54 @@ private void bar() T t = default(T); U u = default(U); // Delegate Binding, Compound Assignment - Del2 d2 = foo; d2 += foo; d2 -= foo; - Del3 d3 = foo; d3 += foo; d3 -= foo; - Del4 d4 = foo; d4 += foo; d4 -= foo; + Del2 d2 = goo; d2 += goo; d2 -= goo; + Del3 d3 = goo; d3 += goo; d3 -= goo; + Del4 d4 = goo; d4 += goo; d4 -= goo; // Invoke Delegates d2((a, b) => vv, (b, c) => tt, (c, a) => uu); d3(tt, vv, uu); d4((a, b, c) => null, (a, b, c) => vv, (a, b, c) => { uu.Equals(vv); }); // Delegate Binding, Compound Assignment - Del2 d22 = foo; d22 += (foo); d22 -= foo; - Del3 d32 = foo; d32 += foo; d32 -= ((foo)); - Del4, Dictionary, VV>>> d42 = foo; d42 += foo; d42 -= foo; + Del2 d22 = goo; d22 += (goo); d22 -= goo; + Del3 d32 = goo; d32 += goo; d32 -= ((goo)); + Del4, Dictionary, VV>>> d42 = goo; d42 += goo; d42 -= goo; // Invoke Delegates d22((a, b) => vv, (b, c) => 1, (c, a) => null); d32(1, 0, null); d42((a, b, c) => null, (a, b, c) => null, (a, b, c) => { uu.Equals(vv); }); // Delegate Relaxation, Compound Assignment - Del1 d1 = foo; d1 += foo; - Del3 d33 = foo; - d33 -= foo; d33 += foo; + Del1 d1 = goo; d1 += goo; + Del3 d33 = goo; + d33 -= goo; d33 += goo; // Invoke Delegates d1(t, u, null, null); d33(new InvalidCastException(), new ArgumentNullException(), new NullReferenceException()); // Delegate Relaxation, Generic Methods - foo(foo, foo, foo); - foo(foo, - foo, - foo); - foo(bar, bar, bar); + goo(goo, goo, goo); + goo(goo, + goo, + goo); + goo(bar, bar, bar); } - private ArgumentException foo(Exception x, Exception y, Exception z) + private ArgumentException goo(Exception x, Exception y, Exception z) { - Console.WriteLine(" c2.foo(Exception x, Exception y, Exception z)"); + Console.WriteLine(" c2.goo(Exception x, Exception y, Exception z)"); return null; } - private ArgumentException foo(TT x, UU y, Exception a, Exception b) + private ArgumentException goo(TT x, UU y, Exception a, Exception b) { - Console.WriteLine(" c2.foo(TT x, UU y, Exception a, Exception b)"); + Console.WriteLine(" c2.goo(TT x, UU y, Exception a, Exception b)"); return null; } - private ArgumentException foo(Exception a, Exception b) + private ArgumentException goo(Exception a, Exception b) { - Console.WriteLine(" c2.foo(Exception a, Exception b)"); + Console.WriteLine(" c2.goo(Exception a, Exception b)"); return null; } @@ -3087,9 +3087,9 @@ private ArgumentException bar(Exception a, Exception b) return null; } - private UU foo(TT a, TT b) + private UU goo(TT a, TT b) { - Console.WriteLine(" c2.foo(TT a, TT b)"); + Console.WriteLine(" c2.goo(TT a, TT b)"); return default(UU); } diff --git a/src/Compilers/Test/Resources/Core/PerfTests/VBPerfTest.vb b/src/Compilers/Test/Resources/Core/PerfTests/VBPerfTest.vb index 55652f309d384..1a1a0546cab43 100644 --- a/src/Compilers/Test/Resources/Core/PerfTests/VBPerfTest.vb +++ b/src/Compilers/Test/Resources/Core/PerfTests/VBPerfTest.vb @@ -85,7 +85,7 @@ Namespace ns1 Dim s As String = "c1.test()" If True Then Console.WriteLine(s) - Me.foo(o) : foo(i) : Me.foo(b) : Me.foo(b1) ' Overload Resolution, Implicit Conversions + Me.goo(o) : goo(i) : Me.goo(b) : Me.goo(b1) ' Overload Resolution, Implicit Conversions End If End If End If @@ -192,8 +192,8 @@ Namespace ns1 Return New Integer() End Function - Friend Function foo(x As Integer) As Integer - Console.WriteLine(" c1.foo(int)") + Friend Function goo(x As Integer) As Integer + Console.WriteLine(" c1.goo(int)") ' Read, Write Fields Me.ui = 0UI + Me.ui @@ -226,8 +226,8 @@ Namespace ns1 Return x End Function - Public Function foo(x As Object) As Boolean - Console.WriteLine(" c1.foo(object)") + Public Function goo(x As Object) As Boolean + Console.WriteLine(" c1.goo(object)") ' Read, Write Fields ui = 0UI @@ -239,7 +239,7 @@ Namespace ns1 Dim b As Boolean = True : Dim s As String = String.Empty s = Nothing : b = Me.i <> 1 ui = ui1 : i = i1 - bar4(b) : Me.foo(i1) : bar4(b = (True <> b)) + bar4(b) : Me.goo(i1) : bar4(b = (True <> b)) ' Read, Write Params x = Nothing : x = New c1(Me.i, Me.ui, a) @@ -266,7 +266,7 @@ Namespace ns1 Me.ui = 0UI - 0UI i = Me.i * 1 Me.a = New c1() - Me.foo(i.GetHashCode()) : Me.a = Me + Me.goo(i.GetHashCode()) : Me.a = Me ' Read, Write Locals Dim c As c1 = New c1(1, 0UI, (Nothing)) @@ -279,7 +279,7 @@ Namespace ns1 c.a = c c.a = Nothing : Me.a = c.a : c = Me.a c = New c1(i.GetHashCode()) - Me.foo(c.i) : bar3(c IsNot Nothing) + Me.goo(c.i) : bar3(c IsNot Nothing) If Me.i = 10321 Then Return @@ -293,7 +293,7 @@ Namespace ns1 Dim a1 As String() = New String() {"", Nothing, Nothing} a1(1) = Nothing : a1(2) = "" Dim s As String = Nothing - s = a1(1) : foo(a1(2)) + s = a1(1) : goo(a1(2)) End Sub Protected Function bar2(x As Object) As String @@ -303,7 +303,7 @@ Namespace ns1 Me.ui = ui - Me.ui i = i / 1 a = Nothing - foo(i) + goo(i) ' Read, Write Locals Dim c As c1 @@ -348,7 +348,7 @@ Namespace ns1 ' Read, Write Params x = (Me.i = i + 1) - foo(x.GetHashCode) + goo(x.GetHashCode) ' Read, Write Array Element Dim a1 As Boolean() = New Boolean() {True, False, x} @@ -356,7 +356,7 @@ Namespace ns1 b = (a1(1)) : b = a1(2) Dim o As Object = b <> a1(2) o = (a1(1).ToString()) = (a1(2).ToString()) - foo(a1(1).GetHashCode()) + goo(a1(1).GetHashCode()) If b Then Return Me.i @@ -373,7 +373,7 @@ Namespace ns1 Me.ui = Me.ui - (Me.ui + Me.ui) * Me.ui Me.i = (i + 1) - (1 * (i / 1)) Me.a = (Nothing) - foo(Me.i.GetHashCode()) + goo(Me.i.GetHashCode()) ' Read, Write Locals Dim o As Object = Nothing @@ -386,17 +386,17 @@ Namespace ns1 c.i = 1 c.i = Me.i * (Me.i / c.i + c.i) c.a = New c1 : Me.a = c.a : c = Me.a : c.a = c : c.a = c - foo(c.GetHashCode()) : bar3(c.a.GetHashCode() <> i) + goo(c.GetHashCode()) : bar3(c.a.GetHashCode() <> i) ' Read, Write Params x = (o.ToString()) - x = x.ToString() : foo(x.GetHashCode()) : foo(x.ToString().GetHashCode()) + x = x.ToString() : goo(x.GetHashCode()) : goo(x.ToString().GetHashCode()) ' Read, Write Array Element Dim a1 As Object() = New Object() {(Nothing), (Me.a), c} a1(1) = ((Me.a)) : a1(2) = (c) : a1(1) = (i) Array.Reverse(a1) - o = a1(1) : foo(a1.GetHashCode()) : bar3(a1(2) Is Nothing) + o = a1(1) : goo(a1.GetHashCode()) : bar3(a1(2) Is Nothing) If b Then Return Me @@ -423,7 +423,7 @@ Namespace ns1 Dim s As String = "c2.test()" If b = 0 Then Console.WriteLine(s) - Me.foo(x:=b, y:=sb) ' Named Arguments + Me.goo(x:=b, y:=sb) ' Named Arguments End If End If If sb <> 1 Then @@ -436,7 +436,7 @@ Namespace ns1 Dim s2 As String = "c2.test()" If sb2 = 0 Then Console.WriteLine(s2) - foo(x:=b, y:=sb2) ' Named Arguments + goo(x:=b, y:=sb2) ' Named Arguments End If End If If b = sb2 Then @@ -514,13 +514,13 @@ Namespace ns1 Const const2 As Integer = 1 Const const3 As Object = Nothing If True Then - Me.bar4(const1) : c.foo(const2 <> const2) : Me.a = const3 + Me.bar4(const1) : c.goo(const2 <> const2) : Me.a = const3 End If End If End Sub - Private Function foo1(x As T) As T - Console.WriteLine(" c2.foo1(T)") + Private Function goo1(x As T) As T + Console.WriteLine(" c2.goo1(T)") Dim aa As Integer = 1 @@ -536,14 +536,14 @@ Namespace ns1 Loop Do While const2 = const1 - aa + aa - Me.bar4(const1) : c.foo(const2 <> const2) + Me.bar4(const1) : c.goo(const2 <> const2) Return x Loop Return x End Function - Private Overloads Function foo(x As Boolean) As Boolean - Console.WriteLine(" c2.foo(bool)") + Private Overloads Function goo(x As Boolean) As Boolean + Console.WriteLine(" c2.goo(bool)") Dim aa As Integer = 1 @@ -563,13 +563,13 @@ Namespace ns1 Return x End Function - Protected Overloads Function foo(x As Byte, y As Object) As c1 - Console.WriteLine(" c2.foo(byte, object)") + Protected Overloads Function goo(x As Byte, y As Object) As c1 + Console.WriteLine(" c2.goo(byte, object)") ' Read, Write Params y = x : x = 1 Dim c As c1 = New c1() - c.bar4(y) : c.foo(x) + c.bar4(y) : c.goo(x) ' Read Consts Const const1 As String = "" @@ -581,7 +581,7 @@ Namespace ns1 Const const3 As Object = Nothing Dim bb As Byte = 1 If bb = x Then - Me.bar4(const1) : Me.foo(const2 <> const2) : Me.a = const3 + Me.bar4(const1) : Me.goo(const2 <> const2) : Me.a = const3 Exit Do Else Return const3 @@ -598,7 +598,7 @@ Namespace ns1 ' Read, Write Params y = x : x = 1 Dim c As c1 = New c1() - c.bar4(y) : c.foo(x) + c.bar4(y) : c.goo(x) ' Read Consts Const const1 As Long = 1 @@ -608,7 +608,7 @@ Namespace ns1 Loop Do While const2 = const2 - Me.bar4(const1) : Me.foo(const2 <> const2) + Me.bar4(const1) : Me.goo(const2 <> const2) Exit Do Loop End Sub @@ -619,7 +619,7 @@ Namespace ns1 ' Read, Write Params y = x : x = 1 Dim c As c1 = New c1() - c.bar4(y) : Me.foo(x) + c.bar4(y) : Me.goo(x) ' Read Consts Const const1 As Long = 1 @@ -627,7 +627,7 @@ Namespace ns1 Const const2 As SByte = 1 Const const3 As Object = Nothing If c IsNot const3 Then - c.bar4(const1) : Me.foo(const2 <> const2) : Me.a = const3 + c.bar4(const1) : Me.goo(const2 <> const2) : Me.a = const3 End If End If Return const1 @@ -640,7 +640,7 @@ Namespace ns1 y = x : x = 1 Dim d As Double = 1.1 Dim c As c1 = New c1() - Me.bar4(y) : c.foo(x) + Me.bar4(y) : c.goo(x) ' Read Consts Const const1 As String = "hi" @@ -649,7 +649,7 @@ Namespace ns1 Const const2 As Byte = 1 Const const3 As Object = Nothing If const3 IsNot c Then - Me.bar4(const1) : c.foo(const2 <> const2) : c.a = const3 + Me.bar4(const1) : c.goo(const2 <> const2) : c.a = const3 Return d End If Return 1.1F + 1.1 @@ -663,7 +663,7 @@ Namespace ns1 Dim s As String = "c3.test()" If True Then Console.WriteLine(s) - foo() : foo(1) : foo("1") : foo(1.1) ' Overload Resolution, Implicit Conversions + goo() : goo(1) : goo("1") : goo(1.1) ' Overload Resolution, Implicit Conversions End If ' Nested Scopes If Not Not True Then @@ -732,33 +732,33 @@ Namespace ns1 End Sub ' Static Methods - Protected Shared Function foo(x As T, y As U) As Integer - Console.WriteLine(" c3.foo(T, U)") + Protected Shared Function goo(x As T, y As U) As Integer + Console.WriteLine(" c3.goo(T, U)") Dim a As Integer() = New Integer(2) {1, 2, 3} : a(1) = a(2) Return CType((CType(x.GetHashCode(), Long) + CLng(CInt(CLng(y.GetHashCode())))), Integer) End Function - Friend Shared Function foo(x As Object) As c1 - Console.WriteLine(" c3.foo(object)") + Friend Shared Function goo(x As Object) As c1 + Console.WriteLine(" c3.goo(object)") Dim a As c1() = New c1(2) {Nothing, New c1(), New c1(1)} : a(1) = a(2) x = "hi" Return New c1(1.1F, CUInt(1), New c1(x.GetHashCode())) End Function - Private Shared Function foo(x As String) As Single - Console.WriteLine(" c3.foo(string)") + Private Shared Function goo(x As String) As Single + Console.WriteLine(" c3.goo(string)") Dim a As String() = New String() {x, x, "", Nothing} : a(1) = a(2) : a(2) = a(1) - Return foo(x.GetHashCode()) + Return goo(x.GetHashCode()) End Function - Public Shared Function foo(x As Integer) As Integer - Console.WriteLine(" c3.foo(int)") + Public Shared Function goo(x As Integer) As Integer + Console.WriteLine(" c3.goo(int)") Dim a As Integer() = New Integer() {x, x, 1, 0} : a(1) = a(2) : a(2) = a(1) Return CInt(x.GetHashCode()) + x End Function - Public Shared Function foo() As String - Console.WriteLine(" c3.foo()") + Public Shared Function goo() As String + Console.WriteLine(" c3.goo()") Dim a As String() = New String() {"", Nothing} : a(0) = a(1) : a(1) = a(0) Return DirectCast(Nothing, String) End Function @@ -780,7 +780,7 @@ Namespace ns1 Console.WriteLine(" c3.bar(string)") Dim a As String() = New String() {x, x, "", Nothing} : a(1) = a(2) : a(2) = a(1) x = a(2) - Return CSng(foo(x.GetHashCode())) + Return CSng(goo(x.GetHashCode())) End Function Public Function bar(x As Integer) As Integer @@ -813,15 +813,15 @@ Namespace ns1 Dim i As Integer = 2 Console.WriteLine(str) If Not False Then - Dim a As c1 = New c1(i) : a.foo(i) + Dim a As c1 = New c1(i) : a.goo(i) End If Dim d As Double = 1.1 If Not (Not (Not False)) Then Dim sb As SByte = 1 Dim a As c1 = New c1(i + (i + i)) - a.foo(sb) + a.goo(sb) If True Then - a.foo(d) + a.goo(d) End If End If @@ -946,8 +946,8 @@ Namespace ns1 End Function ' Non-Overloaded Method - Public Overloads Shared Function foo(i As Integer, s As String, b As Boolean, b1 As Byte, l As Long, s1 As String) As c4 - Console.WriteLine(" c4.foo(int, string, bool, byte, long, string)") + Public Overloads Shared Function goo(i As Integer, s As String, b As Boolean, b1 As Byte, l As Long, s1 As String) As c4 + Console.WriteLine(" c4.goo(int, string, bool, byte, long, string)") Return New c4 End Function @@ -980,17 +980,17 @@ Namespace ns1 If True Then Dim b1 As Byte = 1, l As Long = i, s1 As String = s Dim f As Single = 1.2F : o = f : l = ui - c4.foo(sh, s, b, b1, i, s1) ' Implicit Conversions + c4.goo(sh, s, b, b1, i, s1) ' Implicit Conversions Dim c As c4 = New c4() - c.foo(sh) : Me.bar(sh) - cc.bar(c5.foo(cc.bar())) - c5.foo(cc.bar(c5.foo())) + c.goo(sh) : Me.bar(sh) + cc.bar(c5.goo(cc.bar())) + c5.goo(cc.bar(c5.goo())) If b = False Then Dim d As Double = f, ul As ULong = 1, sb As SByte = 1 : s1 = s c4.bar(sh, us, sb, f, d, ui, ul) ' Implicit Conversions c.bar4(us) Me.bar(cc.bar(), c) - c5.foo(Me.bar(c5.foo(), c)) + c5.goo(Me.bar(c5.goo(), c)) End If If b1 >= l Then Dim ui1 As UInteger = 1 : o = ui1 @@ -998,17 +998,17 @@ Namespace ns1 Do While i <> 1000 Dim b11 As Byte = 1, l1 As Long = i, s11 As String = s1 Dim f1 As Single = 1.2F : o = f1 : l1 = ui1 - c4.foo(sh, s1, b, b11, i, s11) ' Implicit Conversions - c.foo(b) - Me.bar(b) : If c5.foo() IsNot Nothing Then c5.foo().ToString().GetHashCode() - cc.bar(Me.bar(c5.foo())) + c4.goo(sh, s1, b, b11, i, s11) ' Implicit Conversions + c.goo(b) + Me.bar(b) : If c5.goo() IsNot Nothing Then c5.goo().ToString().GetHashCode() + cc.bar(Me.bar(c5.goo())) If Not False Then Dim d1 As Double = f1, ul1 As ULong = 1, sb1 As SByte = 1 : s1 = s c4.bar(sh, us, sb1, f1, d1, ui1, ul1) ' Implicit Conversions - c.foo(b1, sb1) + c.goo(b1, sb1) Me.bar(o).bar4(c) - cc.bar(c5.foo(o)).bar4(c).ToString() + cc.bar(c5.goo(o)).bar4(c).ToString() d1 = d If d <> d1 Then Return i End If @@ -1018,15 +1018,15 @@ Namespace ns1 If True Then Dim b12 As Byte = 1, l2 As Long = i, s12 As String = s11 Dim f2 As Single = 1.2F : o = f1 : l2 = ui1 - c4.foo(sh, s1, b, b12, i, s12) ' Implicit Conversions + c4.goo(sh, s1, b, b12, i, s12) ' Implicit Conversions c.bar4(b.ToString() = b.ToString()) - Me.bar(c5.foo(cc.bar(i))) + Me.bar(c5.goo(cc.bar(i))) If Not False Then Dim d2 As Double = f2, ul2 As ULong = 1, sb2 As SByte = 1 : s1 = s c4.bar(sh, us, sb2, f2, d2, ui2, ul2) ' Implicit Conversions - c.foo(False = True <> False = b) + c.goo(False = True <> False = b) c.bar4(sh > us = sh <= us) - Me.bar(TryCast(c5.foo(TryCast(cc.bar(TryCast(i, Object)), Object)), Object)) + Me.bar(TryCast(c5.goo(TryCast(cc.bar(TryCast(i, Object)), Object)), Object)) If i <> i + 1 - 1 Then _ @@ -2537,8 +2537,8 @@ Namespace ns1 End Function ' Generic Method - Protected Sub foo(Of TT, UU, VV)(x As Func(Of TT, UU, VV), y As Func(Of UU, VV, TT), z As Func(Of VV, TT, UU)) - Console.WriteLine(" c1.foo(Func x, Func y, Func z)") + Protected Sub goo(Of TT, UU, VV)(x As Func(Of TT, UU, VV), y As Func(Of UU, VV, TT), z As Func(Of VV, TT, UU)) + Console.WriteLine(" c1.goo(Func x, Func y, Func z)") Dim t As TT = Nothing, u As UU = Nothing, v As VV = Nothing ' Invoke Lambdas @@ -2546,13 +2546,13 @@ Namespace ns1 End Sub ' Generic Method - Protected Sub foo(Of TT, UU, VV)(xx As TT, yy As UU, zz As VV) - Console.WriteLine(" c1.foo(TT xx, UU yy, VV zz)") + Protected Sub goo(Of TT, UU, VV)(xx As TT, yy As UU, zz As VV) + Console.WriteLine(" c1.goo(TT xx, UU yy, VV zz)") End Sub ' Generic Method - Protected Sub foo(Of TT, UU, VV)(x As Func(Of TT, List(Of TT), UU, Dictionary(Of List(Of TT), UU)), y As Del(Of UU, VV), z As Action(Of VV, List(Of VV), Dictionary(Of List(Of VV), TT))) - Console.WriteLine(" c1.foo(Func, Dictionary, UU>> x, Del y, Action, Dictionary, TT>> z)") + Protected Sub goo(Of TT, UU, VV)(x As Func(Of TT, List(Of TT), UU, Dictionary(Of List(Of TT), UU)), y As Del(Of UU, VV), z As Action(Of VV, List(Of VV), Dictionary(Of List(Of VV), TT))) + Console.WriteLine(" c1.goo(Func, Dictionary, UU>> x, Del y, Action, Dictionary, TT>> z)") Dim t As TT = Nothing, u As UU = Nothing, v As VV = Nothing ' Invoke Lambdas @@ -2633,8 +2633,8 @@ Namespace ns1 func(ttt, uuu)(uuu, vvv)(vvv, ttt)(t, u)(u) End Sub - Public Sub foo(Of TT, UU, VV)(x As Func(Of TT, UU), y As Func(Of TT, VV), z As Func(Of UU, VV), a As Func(Of UU, TT), b As Func(Of VV, TT), c As Func(Of VV, UU)) - Console.WriteLine(" c1.foo(Func x, Func y, Func z, Func a, Func b, Func c)") + Public Sub goo(Of TT, UU, VV)(x As Func(Of TT, UU), y As Func(Of TT, VV), z As Func(Of UU, VV), a As Func(Of UU, TT), b As Func(Of VV, TT), c As Func(Of VV, UU)) + Console.WriteLine(" c1.goo(Func x, Func y, Func z, Func a, Func b, Func c)") End Sub Public Sub Test() @@ -2647,20 +2647,20 @@ Namespace ns1 Dim del As Del = Function(a, b, c) a ' Generic Methods, Simple Closures - foo(Of Integer, String, Del(Of T, U))(y, x.ToString(), Function(a, b, c) uu) - foo(Of String, Del(Of T), Integer)(x.ToString(), Function(a, b, c) x, y) - foo(Of Del, Integer, String)(Function(c, a) a.ToString(), + goo(Of Integer, String, Del(Of T, U))(y, x.ToString(), Function(a, b, c) uu) + goo(Of String, Del(Of T), Integer)(x.ToString(), Function(a, b, c) x, y) + goo(Of Del, Integer, String)(Function(c, a) a.ToString(), Function(a As Integer, b As String) del, Function(b, c) y - c(x, y, Nothing)) ' Generic Type Inference, Nested Lambdas - foo(x, "", del1) + goo(x, "", del1) 'TODO: Below call currently binds to the wrong overload because we don't 'have anonymous delegates. Delete this comment once this support becomes available. - foo(func, del2, + goo(func, del2, Sub(a As T, b As List(Of T), c As Dictionary(Of List(Of T), T)) Dim z As Integer = x - foo(New Action(Sub() x = 2), + goo(New Action(Sub() x = 2), New Func(Of ArgumentException, Integer)(Function(aa) Return y + x + +z + b.Count End Function), @@ -2669,7 +2669,7 @@ Namespace ns1 End Function)) x = z If True Then - foo(Function(aa, bb) a.ToString(), + goo(Function(aa, bb) a.ToString(), Function(bb As Long, cc As String) y - CInt(bb) + b.Count - z, Function(cc As String, aa As Integer) x + y + aa + c.Values.Count) End If @@ -2678,31 +2678,31 @@ Namespace ns1 ' Generic Type Inference, Dominant Type 'TODO: Below call currently binds to the wrong overload because we don't 'have anonymous delegates. Delete this comment once this support becomes available. - foo(Function(a As Exception, b As Exception) New ArgumentException(), + goo(Function(a As Exception, b As Exception) New ArgumentException(), Function(a As Exception, b As Exception) New ArgumentException(), Function(a As Exception, b As Exception) New ArgumentException()) 'TODO: Below call currently binds to the wrong overload because we don't 'have anonymous delegates. Delete this comment once this support becomes available. - foo(Function(a, b) New ArgumentException(), + goo(Function(a, b) New ArgumentException(), Function(a, b) New ArgumentException(), Function(a As ArgumentException, b As Exception) New Exception()) Dim func2 As Func(Of Exception, ArgumentException) = Function(a As Exception) New ArgumentException() Dim func3 As Func(Of ArgumentException, Exception) = Function(a As ArgumentException) New ArgumentException() 'TODO: Uncomment below call once we have support for variance. See bug 9029. - 'foo(func2, func2, func2, func2, func3, func3) - foo(Function(a) New ArgumentException(), + 'goo(func2, func2, func2, func2, func3, func3) + goo(Function(a) New ArgumentException(), Function(a As Exception) New InvalidCastException(), Function(a) New InvalidCastException(), Function(a As ArgumentException) New Exception(), Function(a) New ArgumentException(), Function(a As InvalidCastException) New ArgumentException()) - foo(Function(a As Exception) New Exception(), + goo(Function(a As Exception) New Exception(), Function(a As Exception) New ArgumentException(), Function(a As Exception) New ArgumentException(), Function(a As Exception) New Exception(), Function(a As Exception) New ArgumentException(), Function(a As Exception) New Exception()) - foo(Function(a) New Exception(), + goo(Function(a) New Exception(), Function(a As Exception) New ArgumentException(), Function(a) New ArgumentException(), Function(a) New Exception(), @@ -2730,9 +2730,9 @@ Namespace ns1 'TODO: Below lines are commented because of what seems like a bug in Dev10 that 'results in bad (unverifiable) code generation. Investigate whether we can 'work around this somehow. - 'Dim d2 As Del2(Of TT, UU, VV) = AddressOf foo(Of TT, UU, VV) : d2 = AddressOf foo(Of TT, UU, VV) - 'Dim d3 As Del3(Of TT, VV, UU) = AddressOf foo : d3 = AddressOf foo(Of TT, VV, UU) - Dim d4 As Del4(Of UU, TT, VV) = AddressOf foo : d4 = AddressOf foo + 'Dim d2 As Del2(Of TT, UU, VV) = AddressOf goo(Of TT, UU, VV) : d2 = AddressOf goo(Of TT, UU, VV) + 'Dim d3 As Del3(Of TT, VV, UU) = AddressOf goo : d3 = AddressOf goo(Of TT, VV, UU) + Dim d4 As Del4(Of UU, TT, VV) = AddressOf goo : d4 = AddressOf goo ' Invoke Delegates 'd2(Function(a, b) vvv, Function(b, c) ttt, Function(c, a) uuu) 'd3(ttt, vvv, uuu) @@ -2742,42 +2742,42 @@ Namespace ns1 'TODO: Below lines are commented because of what seems like a bug in Dev10 that 'results in bad (unverifiable) code generation. Investigate whether we can 'work around this somehow. - 'Dim d22 As Del2(Of Integer, Del, VV) = AddressOf foo(Of Integer, Del, VV) : d22 = AddressOf foo(Of Integer, Del, VV) - 'Dim d32 As Del3(Of Long, Integer, Exception) = AddressOf foo : d32 = AddressOf foo(Of Long, Integer, Exception) - Dim d42 As Del4(Of T, U, Dictionary(Of List(Of TT), Dictionary(Of List(Of UU), VV))) = AddressOf foo : d42 = AddressOf foo + 'Dim d22 As Del2(Of Integer, Del, VV) = AddressOf goo(Of Integer, Del, VV) : d22 = AddressOf goo(Of Integer, Del, VV) + 'Dim d32 As Del3(Of Long, Integer, Exception) = AddressOf goo : d32 = AddressOf goo(Of Long, Integer, Exception) + Dim d42 As Del4(Of T, U, Dictionary(Of List(Of TT), Dictionary(Of List(Of UU), VV))) = AddressOf goo : d42 = AddressOf goo ' Invoke Delegates 'd22(Function(a, b) vvv, Function(b, c) 1, Function(c, a) Nothing) 'd32(1, 0, Nothing) d42(Function(a, b, c) Nothing, Function(a, b, c) Nothing, Sub(a, b, c) uuu.Equals(vvv)) ' Delegate Relaxation - Dim d1 As Del1 = AddressOf foo : d1 = AddressOf foo(Of T, U) + Dim d1 As Del1 = AddressOf goo : d1 = AddressOf goo(Of T, U) Dim d33 As Del3(Of InvalidCastException, ArgumentNullException, NullReferenceException, Exception) = - AddressOf foo(Of Integer, Long) : d33 = AddressOf foo(Of Integer, Long) : d33 = AddressOf foo(Of Integer, Double) + AddressOf goo(Of Integer, Long) : d33 = AddressOf goo(Of Integer, Long) : d33 = AddressOf goo(Of Integer, Double) ' Invoke Delegates d1(t, u, Nothing, Nothing) d33(New InvalidCastException(), New ArgumentNullException(), New NullReferenceException()) ' Delegate Relaxation, Generic Methods - foo(Of ArgumentException, ArgumentException, Exception)(AddressOf foo(Of Integer), AddressOf foo(Of Long), AddressOf foo(Of Double)) - foo(Of ArgumentException, ArgumentException, Exception)(AddressOf foo(Of Exception, ArgumentException), - AddressOf foo(Of Exception, ArgumentException), - AddressOf foo(Of Exception, ArgumentException)) - foo(Of ArgumentException, ArgumentException, Exception)(AddressOf bar, AddressOf bar, AddressOf bar) + goo(Of ArgumentException, ArgumentException, Exception)(AddressOf goo(Of Integer), AddressOf goo(Of Long), AddressOf goo(Of Double)) + goo(Of ArgumentException, ArgumentException, Exception)(AddressOf goo(Of Exception, ArgumentException), + AddressOf goo(Of Exception, ArgumentException), + AddressOf goo(Of Exception, ArgumentException)) + goo(Of ArgumentException, ArgumentException, Exception)(AddressOf bar, AddressOf bar, AddressOf bar) End Sub - Private Overloads Function foo(Of TT, UU)(x As Exception, y As Exception, z As Exception) As ArgumentException - Console.WriteLine(" c2.foo(Exception x, Exception y, Exception z)") + Private Overloads Function goo(Of TT, UU)(x As Exception, y As Exception, z As Exception) As ArgumentException + Console.WriteLine(" c2.goo(Exception x, Exception y, Exception z)") Return Nothing End Function - Private Overloads Function foo(Of TT, UU)(x As TT, y As UU, a As Exception, b As Exception) As ArgumentException - Console.WriteLine(" c2.foo(TT x, UU y, Exception a, Exception b)") + Private Overloads Function goo(Of TT, UU)(x As TT, y As UU, a As Exception, b As Exception) As ArgumentException + Console.WriteLine(" c2.goo(TT x, UU y, Exception a, Exception b)") Return Nothing End Function - Private Overloads Function foo(Of TT)(a As Exception, b As Exception) As ArgumentException - Console.WriteLine(" c2.foo(Exception a, Exception b)") + Private Overloads Function goo(Of TT)(a As Exception, b As Exception) As ArgumentException + Console.WriteLine(" c2.goo(Exception a, Exception b)") Return Nothing End Function @@ -2786,8 +2786,8 @@ Namespace ns1 Return Nothing End Function - Private Overloads Function foo(Of TT, UU)(a As TT, b As TT) As UU - Console.WriteLine(" c2.foo(TT a, TT b)") + Private Overloads Function goo(Of TT, UU)(a As TT, b As TT) As UU + Console.WriteLine(" c2.goo(TT a, TT b)") Return Nothing End Function diff --git a/src/Compilers/Test/Resources/Core/SymbolsTests/CustomModifiers/ModoptTestOrignal.cs b/src/Compilers/Test/Resources/Core/SymbolsTests/CustomModifiers/ModoptTestOrignal.cs index f79e59f50a0c1..bd4b762712822 100644 --- a/src/Compilers/Test/Resources/Core/SymbolsTests/CustomModifiers/ModoptTestOrignal.cs +++ b/src/Compilers/Test/Resources/Core/SymbolsTests/CustomModifiers/ModoptTestOrignal.cs @@ -40,7 +40,7 @@ public class ModoptPropAmbiguous public virtual string /*modreq*/ P2 { get { return "1 modreq"; } } } // - public interface IFooAmbiguous + public interface IGooAmbiguous { // not in R M(T /*modreq*/ t); @@ -50,7 +50,7 @@ public interface IFooAmbiguous R M2(T /*modopt*/ t); } - public interface IFoo + public interface IGoo { // 2 string /*modopt*/ M(T /*modopt*/ t); diff --git a/src/Compilers/Test/Resources/Core/SymbolsTests/Cyclic/Cyclic2.vb b/src/Compilers/Test/Resources/Core/SymbolsTests/Cyclic/Cyclic2.vb index 9273c07a3dd58..fb2c7237cf2cf 100644 --- a/src/Compilers/Test/Resources/Core/SymbolsTests/Cyclic/Cyclic2.vb +++ b/src/Compilers/Test/Resources/Core/SymbolsTests/Cyclic/Cyclic2.vb @@ -3,7 +3,7 @@ 'vbc /t:library /vbruntime- Cyclic2.vb /r:Cyclic1.dll Public Class Class2 -Sub Foo +Sub Goo Dim x As New Class1 End Sub End Class diff --git a/src/Compilers/Test/Resources/Core/SymbolsTests/DifferByCase/CsharpCaseSen.cs b/src/Compilers/Test/Resources/Core/SymbolsTests/DifferByCase/CsharpCaseSen.cs index be100eee9f894..a0ac8186d8d68 100644 --- a/src/Compilers/Test/Resources/Core/SymbolsTests/DifferByCase/CsharpCaseSen.cs +++ b/src/Compilers/Test/Resources/Core/SymbolsTests/DifferByCase/CsharpCaseSen.cs @@ -1,9 +1,9 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -public class Foo +public class Goo { - public static void Foo1() { } - public static void foo1() { } + public static void Goo1() { } + public static void goo1() { } } namespace CsharpCodeSensible { diff --git a/src/Compilers/Test/Resources/Core/SymbolsTests/InheritIComparable.cs b/src/Compilers/Test/Resources/Core/SymbolsTests/InheritIComparable.cs index d2ee4d474a5ba..770bc47f2b0d8 100644 --- a/src/Compilers/Test/Resources/Core/SymbolsTests/InheritIComparable.cs +++ b/src/Compilers/Test/Resources/Core/SymbolsTests/InheritIComparable.cs @@ -4,7 +4,7 @@ class BaseTypeSpecifierClass : global::System.IComparable { public int CompareTo(object o) { return 0; } } -class FooAttribute : System.Attribute { } +class GooAttribute : System.Attribute { } interface I1 { int Method(); diff --git a/src/Compilers/Test/Resources/Core/SymbolsTests/Interface/MDInterfaceMapping.cs b/src/Compilers/Test/Resources/Core/SymbolsTests/Interface/MDInterfaceMapping.cs index b5255ba527aeb..4779a7f7ad421 100644 --- a/src/Compilers/Test/Resources/Core/SymbolsTests/Interface/MDInterfaceMapping.cs +++ b/src/Compilers/Test/Resources/Core/SymbolsTests/Interface/MDInterfaceMapping.cs @@ -7,22 +7,22 @@ using System.Linq; using System.Text; -public interface IFoo +public interface IGoo { - void Foo(); + void Goo(); } public class A { - public void Foo() { Console.WriteLine("A.Foo"); } + public void Goo() { Console.WriteLine("A.Goo"); } } -public class B : A, IFoo +public class B : A, IGoo { } public class C : B { - public new void Foo() { Console.WriteLine("C.Foo"); } + public new void Goo() { Console.WriteLine("C.Goo"); } } diff --git a/src/Compilers/Test/Resources/Core/SymbolsTests/Metadata/AttributeInterop01.cs b/src/Compilers/Test/Resources/Core/SymbolsTests/Metadata/AttributeInterop01.cs index 9ce9e1d2cc99a..3e8c0c349cc6e 100644 --- a/src/Compilers/Test/Resources/Core/SymbolsTests/Metadata/AttributeInterop01.cs +++ b/src/Compilers/Test/Resources/Core/SymbolsTests/Metadata/AttributeInterop01.cs @@ -22,7 +22,7 @@ namespace Interop [ComImport, Guid("ABCDEF5D-2448-447A-B786-64682CBEF123")] [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] [TypeLibImportClass(typeof(object)), TypeLibType(TypeLibTypeFlags.FAggregatable)] - public interface IFoo + public interface IGoo { [AllowReversePInvokeCalls()] void DoSomething(); @@ -35,19 +35,19 @@ public interface IFoo } [TypeLibType(TypeLibTypeFlags.FAppObject)] - public enum EFoo + public enum EGoo { One, Two, Three } [Serializable, ComVisible(false)] [UnmanagedFunctionPointerAttribute(CallingConvention.StdCall, BestFitMapping = true, CharSet = CharSet.Ansi, SetLastError = true, ThrowOnUnmappableChar = true)] - public delegate void DFoo(char p1, sbyte p2); + public delegate void DGoo(char p1, sbyte p2); - [TypeIdentifier("1234C65D-1234-447A-B786-64682CBEF136", "SFoo, INteropAttribute, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")] + [TypeIdentifier("1234C65D-1234-447A-B786-64682CBEF136", "SGoo, INteropAttribute, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")] [Guid("C3957C2A-07DD-4A56-AF01-FFD56664600F"), BestFitMapping(false, ThrowOnUnmappableChar = true)] [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode, Pack = 8, Size = 64)] - public struct SFoo + public struct SGoo { [FieldOffset(0)] public sbyte field01; @@ -61,7 +61,7 @@ public struct SFoo } [ComDefaultInterface(typeof(object)), ProgId("ProgId")] - public class CFoo + public class CGoo { [DllImport("app.dll")] static extern bool DllImport(); diff --git a/src/Compilers/Test/Resources/Core/SymbolsTests/Metadata/AttributeTestLib01.cs b/src/Compilers/Test/Resources/Core/SymbolsTests/Metadata/AttributeTestLib01.cs index 0afedbd297ca0..4f2106ccf19d4 100644 --- a/src/Compilers/Test/Resources/Core/SymbolsTests/Metadata/AttributeTestLib01.cs +++ b/src/Compilers/Test/Resources/Core/SymbolsTests/Metadata/AttributeTestLib01.cs @@ -12,7 +12,7 @@ namespace AttributeUse { // attribute on type parameter (with target typevar or not) - public interface IFoo<[typevar: AllInheritMultiple(3.1415926)] T, [AllInheritMultiple('q', 2)] V> + public interface IGoo<[typevar: AllInheritMultiple(3.1415926)] T, [AllInheritMultiple('q', 2)] V> { // default: method [AllInheritMultiple(p3:1.234f, p2: 1056, p1: "555")] @@ -25,7 +25,7 @@ public interface IFoo<[typevar: AllInheritMultiple(3.1415926)] T, [AllInheritMul [AllInheritMultiple(new char[] { '1', '2' }, UIntField = 112233)] [type: AllInheritMultiple(new char[] { 'a', '\0', '\t' }, AryField = new ulong[] { 0, 1, ulong.MaxValue })] [AllInheritMultiple(null, "", null, "1234", AryProp = new object[2] { new ushort[] { 1 }, new ushort[] { 2, 3, 4 } })] - public class Foo<[typevar: AllInheritMultiple(null), AllInheritMultiple()] T> : IFoo + public class Goo<[typevar: AllInheritMultiple(null), AllInheritMultiple()] T> : IGoo { // named parameters [field: AllInheritMultiple(p2: System.Reflection.BindingFlags.DeclaredOnly | System.Reflection.BindingFlags.Public, p1: -123)] @@ -33,7 +33,7 @@ public class Foo<[typevar: AllInheritMultiple(null), AllInheritMultiple()] T> : public int ClassField; [property: BaseAttribute(-1)] - public Foo Prop + public Goo Prop { // return: NYI [AllInheritMultiple(1, 2, 3), AllInheritMultiple(4, 5, 1.1f)] @@ -44,9 +44,9 @@ public Foo Prop [AllInheritMultiple(+007, 256)] [AllInheritMultiple(-008, 255)] - [method: DerivedAttribute(typeof(IFoo), ObjectField = 1)] + [method: DerivedAttribute(typeof(IGoo), ObjectField = 1)] public ushort Method(T t) { return 0; } // Explicit NotImpl - // ushort IFoo.Method(T t) { return 0; } + // ushort IGoo.Method(T t) { return 0; } } } diff --git a/src/Compilers/Test/Resources/Core/SymbolsTests/Methods/CSMethods.cs b/src/Compilers/Test/Resources/Core/SymbolsTests/Methods/CSMethods.cs index a6bcbb73c5535..4cd14b02b2d13 100644 --- a/src/Compilers/Test/Resources/Core/SymbolsTests/Methods/CSMethods.cs +++ b/src/Compilers/Test/Resources/Core/SymbolsTests/Methods/CSMethods.cs @@ -78,5 +78,5 @@ public static void M( public class MultiDimArrays { - public static void Foo(int[,] x) { } + public static void Goo(int[,] x) { } } diff --git a/src/Compilers/Test/Resources/Core/SymbolsTests/MultiModule/MultiModule.vb b/src/Compilers/Test/Resources/Core/SymbolsTests/MultiModule/MultiModule.vb index 7b92392b59a81..634fb58e78a58 100644 --- a/src/Compilers/Test/Resources/Core/SymbolsTests/MultiModule/MultiModule.vb +++ b/src/Compilers/Test/Resources/Core/SymbolsTests/MultiModule/MultiModule.vb @@ -3,7 +3,7 @@ 'vbc /t:library /vbruntime- MultiModule.vb /addmodule:mod2.netmodule,mod3.netmodule Public Class Class1 -Sub Foo() +Sub Goo() Dim x = {1,2} Dim y = x.Count() End Sub diff --git a/src/Compilers/Test/Resources/Core/SymbolsTests/MultiModule/mod2.vb b/src/Compilers/Test/Resources/Core/SymbolsTests/MultiModule/mod2.vb index cd725ebcb6109..2a7ea00df3b6e 100644 --- a/src/Compilers/Test/Resources/Core/SymbolsTests/MultiModule/mod2.vb +++ b/src/Compilers/Test/Resources/Core/SymbolsTests/MultiModule/mod2.vb @@ -3,6 +3,6 @@ 'vbc /t:module /vbruntime- Mod2.vb Public Class Class2 -Sub Foo() +Sub Goo() End Sub End Class diff --git a/src/Compilers/Test/Resources/Core/SymbolsTests/MultiModule/mod3.vb b/src/Compilers/Test/Resources/Core/SymbolsTests/MultiModule/mod3.vb index 2fbf8957ab172..fc349aa8a9be1 100644 --- a/src/Compilers/Test/Resources/Core/SymbolsTests/MultiModule/mod3.vb +++ b/src/Compilers/Test/Resources/Core/SymbolsTests/MultiModule/mod3.vb @@ -3,7 +3,7 @@ 'vbc /t:module /vbruntime- Mod3.vb Public Class Class3 -Sub Foo() +Sub Goo() Dim x = {1,2} Dim y = x.Count() End Sub diff --git a/src/Compilers/Test/Resources/Core/SymbolsTests/MultiTargeting/Source1.vb b/src/Compilers/Test/Resources/Core/SymbolsTests/MultiTargeting/Source1.vb index 0ebe4b925aa97..6a1a571d50398 100644 --- a/src/Compilers/Test/Resources/Core/SymbolsTests/MultiTargeting/Source1.vb +++ b/src/Compilers/Test/Resources/Core/SymbolsTests/MultiTargeting/Source1.vb @@ -5,7 +5,7 @@ Public Class C1(Of T) Public Class C2(Of S) - Public Function Foo() As C1(Of T).C2(Of S) + Public Function Goo() As C1(Of T).C2(Of S) Return Nothing End Function End Class diff --git a/src/Compilers/Test/Resources/Core/SymbolsTests/MultiTargeting/Source3.vb b/src/Compilers/Test/Resources/Core/SymbolsTests/MultiTargeting/Source3.vb index 8ee5516b3518d..0d571b306e703 100644 --- a/src/Compilers/Test/Resources/Core/SymbolsTests/MultiTargeting/Source3.vb +++ b/src/Compilers/Test/Resources/Core/SymbolsTests/MultiTargeting/Source3.vb @@ -5,7 +5,7 @@ Public Class C3 - Public Function Foo() As C1(Of C3).C2(Of C4) + Public Function Goo() As C1(Of C3).C2(Of C4) Return Nothing End Function @@ -13,21 +13,21 @@ Public Class C3 Return Nothing End Function - Public Function Foo1() As C8(Of C7) + Public Function Goo1() As C8(Of C7) Return Nothing End Function - Public Sub Foo2(ByRef x1(,) As C300, + Public Sub Goo2(ByRef x1(,) As C300, ByRef x2 As C4, ByRef x3() As C7, Optional ByVal x4 As C4 = Nothing) End Sub - Friend Overridable Function Foo3(Of TFoo3 As C4)() As TFoo3 + Friend Overridable Function Goo3(Of TGoo3 As C4)() As TGoo3 Return Nothing End Function - Public Function Foo4() As C8(Of C4) + Public Function Goo4() As C8(Of C4) Return Nothing End Function diff --git a/src/Compilers/Test/Resources/Core/SymbolsTests/NoPia/GeneralPia.vb b/src/Compilers/Test/Resources/Core/SymbolsTests/NoPia/GeneralPia.vb index f30be9149abf9..bf2aa74086794 100644 --- a/src/Compilers/Test/Resources/Core/SymbolsTests/NoPia/GeneralPia.vb +++ b/src/Compilers/Test/Resources/Core/SymbolsTests/NoPia/GeneralPia.vb @@ -10,51 +10,51 @@ Imports System.Runtime.InteropServices Namespace SomeNamespace Public Structure NoAttributesStructure - Public Foo1 As Integer - Public Foo2 As Integer + Public Goo1 As Integer + Public Goo2 As Integer End Structure End Namespace Public Enum NoAttributesEnum - Foo1 - Foo2 + Goo1 + Goo2 End Enum Public Delegate Sub NoAttributesDelegate(ByVal x As String, ByVal y As Object) _ -Public Enum FooEnum - Foo1 +Public Enum GooEnum + Goo1 __ - Foo2 + Goo2 列挙識別子 [Enum] COM End Enum _ -Public Structure FooStruct +Public Structure GooStruct Public [Structure] As Integer Public NET As Decimal Public 構造メンバー As String - Public Foo3 As Object() + Public Goo3 As Object() - Public Foo4 As Double() + Public Goo4 As Double() End Structure -'Public Structure FooPrivateStruct -' Public Foo1 As Integer -' Private Foo2 As Long +'Public Structure GooPrivateStruct +' Public Goo1 As Integer +' Private Goo2 As Long 'End Structure -'Public Structure FooSharedStruct +'Public Structure GooSharedStruct ' Public Shared Field1 As Integer = 4 'End Structure -Public Structure FooConstStruct +Public Structure GooConstStruct Public Const Field1 As String = "2" End Structure @@ -62,7 +62,7 @@ End Structure _ _ Public Interface ISubFuncProp - Sub Foo(ByVal p As Integer) + Sub Goo(ByVal p As Integer) Function Bar() As String @@ -104,14 +104,14 @@ Namespace Parameters _ _ Public Interface IByRef - Function Foo(ByRef p1 As IA, ByRef p2 As IB, ByRef p3 As IC, ByRef p4 As Integer, ByRef p5 As Object) As ID + Function Goo(ByRef p1 As IA, ByRef p2 As IB, ByRef p3 As IC, ByRef p4 As Integer, ByRef p5 As Object) As ID Sub Bar(Optional ByRef p1 As IA = Nothing, Optional ByRef p2 As String() = Nothing, Optional ByRef p3 As Double() = Nothing) End Interface _ _ Public Interface IOptionalParam - Function Foo(Optional ByVal p1 As IA = Nothing, Optional ByVal p2 As IB = Nothing, Optional ByVal p3 As IC = Nothing, Optional ByVal p4 As Integer = 5, Optional ByVal p5 As Object = Nothing) As ID + Function Goo(Optional ByVal p1 As IA = Nothing, Optional ByVal p2 As IB = Nothing, Optional ByVal p3 As IC = Nothing, Optional ByVal p4 As Integer = 5, Optional ByVal p5 As Object = Nothing) As ID Sub Bar(ByVal p1 As IA, ByVal p2 As String(), ByVal p3 As Double()) End Interface End Namespace @@ -230,7 +230,7 @@ Namespace InheritanceConflict _ _ Public Interface IBase - Sub Foo() + Sub Goo() Function Bar() As Integer Sub ConflictMethod(ByVal x As Integer) @@ -244,7 +244,7 @@ Namespace InheritanceConflict Public Interface IDerived Inherits IBase ' IBase methods - Shadows Sub Foo() + Shadows Sub Goo() Shadows Function Bar() As Integer Shadows Sub ConflictMethod(ByVal x As Integer) @@ -267,7 +267,7 @@ Namespace LateBound _ _ Public Interface INoPIAInterface - Function Foo(ByVal x As INoPIAInterface) As String + Function Goo(ByVal x As INoPIAInterface) As String Function Bar(ByVal x As Integer, ByVal y As Integer) As String Function Moo() As Integer End Interface @@ -318,7 +318,7 @@ Namespace NoPIACopyAttributes End Interface - Public Delegate Sub Foo() + Public Delegate Sub Goo() _ _ @@ -331,7 +331,7 @@ Namespace NoPIACopyAttributes _ Public Interface IHasAllSupportedAttributes_Event - Event Scenario14 As Foo + Event Scenario14 As Goo End Interface @@ -425,7 +425,7 @@ Namespace [Overloads] _ _ Public Interface IBase - Sub Foo() + Sub Goo() Function Bar() As Integer End Interface @@ -433,10 +433,10 @@ Namespace [Overloads] _ Public Interface IDerived Inherits IBase - Shadows Sub Foo() + Shadows Sub Goo() Shadows Function Bar() As Integer - Shadows Function Foo(ByVal x As Integer) As String + Shadows Function Goo(ByVal x As Integer) As String End Interface _ @@ -614,7 +614,7 @@ Namespace VTableGap _ _ Public Interface IComplicatedVTable - Default Property Foo( ByVal index As Integer) As String + Default Property Goo( ByVal index As Integer) As String Sub M1( ByRef x As Integer) Function M2() As IScen1 Property P1() As IScen2 @@ -668,7 +668,7 @@ Namespace LackingAttributes End Interface Public Interface INoAttributes - Sub Foo(ByVal p As Integer) + Sub Goo(ByVal p As Integer) Function Bar() As String @@ -677,7 +677,7 @@ Namespace LackingAttributes _ Public Interface IComImportButNoGuid - Sub Foo(ByVal p As Integer) + Sub Goo(ByVal p As Integer) Function Bar() As String diff --git a/src/Compilers/Test/Resources/Core/SymbolsTests/NoPia/Library2.vb b/src/Compilers/Test/Resources/Core/SymbolsTests/NoPia/Library2.vb index e83d794cbd31f..41e8cfdc9f188 100644 --- a/src/Compilers/Test/Resources/Core/SymbolsTests/NoPia/Library2.vb +++ b/src/Compilers/Test/Resources/Core/SymbolsTests/NoPia/Library2.vb @@ -13,6 +13,6 @@ Imports System.Runtime.InteropServices _ Public Interface I7 - Function Foo() As List(Of I5) + Function Goo() As List(Of I5) Function Bar() As List(Of I1) End Interface diff --git a/src/Compilers/Test/Resources/Core/SymbolsTests/NoPia/Pia5.vb b/src/Compilers/Test/Resources/Core/SymbolsTests/NoPia/Pia5.vb index 6eff0d119fcf2..8de8907115d64 100644 --- a/src/Compilers/Test/Resources/Core/SymbolsTests/NoPia/Pia5.vb +++ b/src/Compilers/Test/Resources/Core/SymbolsTests/NoPia/Pia5.vb @@ -11,7 +11,7 @@ Imports System.Runtime.InteropServices _ Public Interface I5 - Function Foo() As List(Of I6) + Function Goo() As List(Of I6) End Interface _ diff --git a/src/Compilers/Test/Resources/Core/SymbolsTests/V1/MTTestLib2_V1.vb b/src/Compilers/Test/Resources/Core/SymbolsTests/V1/MTTestLib2_V1.vb index 5b6792bf47fbd..ac477f07457a2 100644 --- a/src/Compilers/Test/Resources/Core/SymbolsTests/V1/MTTestLib2_V1.vb +++ b/src/Compilers/Test/Resources/Core/SymbolsTests/V1/MTTestLib2_V1.vb @@ -4,7 +4,7 @@ ' vbc /t:module /out:MTTestModule2.netmodule MTTestLib2_V1.vb /r:MTTestLib1.Dll Public Class Class4 - Function Foo() As Class1 + Function Goo() As Class1 Return Nothing End Function diff --git a/src/Compilers/Test/Resources/Core/SymbolsTests/V2/MTTestLib3_V2.vb b/src/Compilers/Test/Resources/Core/SymbolsTests/V2/MTTestLib3_V2.vb index 9d496b27cd469..ea9ede67dc1df 100644 --- a/src/Compilers/Test/Resources/Core/SymbolsTests/V2/MTTestLib3_V2.vb +++ b/src/Compilers/Test/Resources/Core/SymbolsTests/V2/MTTestLib3_V2.vb @@ -4,15 +4,15 @@ ' vbc /t:module /out:MTTestModule3.netmodule MTTestLib3_V2.vb /r:MTTestLib1.Dll /r:..\V1\MTTestLib2.Dll Public Class Class5 - Function Foo1() As Class1 + Function Goo1() As Class1 Return Nothing End Function - Function Foo2() As Class2 + Function Goo2() As Class2 Return Nothing End Function - Function Foo3() As Class4 + Function Goo3() As Class4 Return Nothing End Function diff --git a/src/Compilers/Test/Resources/Core/SymbolsTests/V3/MTTestLib4_V3.vb b/src/Compilers/Test/Resources/Core/SymbolsTests/V3/MTTestLib4_V3.vb index cd5e55e2320f4..e06e9382b01fb 100644 --- a/src/Compilers/Test/Resources/Core/SymbolsTests/V3/MTTestLib4_V3.vb +++ b/src/Compilers/Test/Resources/Core/SymbolsTests/V3/MTTestLib4_V3.vb @@ -4,23 +4,23 @@ ' vbc /t:module /out:MTTestModule4.netmodule MTTestLib4_V3.vb /r:MTTestLib1.Dll /r:..\V1\MTTestLib2.Dll /r:..\V2\MTTestLib3.Dll Public Class Class6 - Function Foo1() As Class1 + Function Goo1() As Class1 Return Nothing End Function - Function Foo2() As Class2 + Function Goo2() As Class2 Return Nothing End Function - Function Foo3() As Class3 + Function Goo3() As Class3 Return Nothing End Function - Function Foo4() As Class4 + Function Goo4() As Class4 Return Nothing End Function - Function Foo5() As Class5 + Function Goo5() As Class5 Return Nothing End Function diff --git a/src/Compilers/Test/Resources/Core/SymbolsTests/WithEvents/SimpleWithEvents.vb b/src/Compilers/Test/Resources/Core/SymbolsTests/WithEvents/SimpleWithEvents.vb index 8606dfc977f3d..09e324edbe5ff 100644 --- a/src/Compilers/Test/Resources/Core/SymbolsTests/WithEvents/SimpleWithEvents.vb +++ b/src/Compilers/Test/Resources/Core/SymbolsTests/WithEvents/SimpleWithEvents.vb @@ -22,16 +22,16 @@ Public Class Class1 Public WithEvents WE2 As C1 - Public Sub foo() Handles WE1.I1 - Console.WriteLine("Class1.Foo") + Public Sub goo() Handles WE1.I1 + Console.WriteLine("Class1.Goo") End Sub End Class Public Class Derived Inherits Class1 - Public Sub foo1() Handles WE1.I1 - Console.WriteLine("Derived.Foo1") + Public Sub goo1() Handles WE1.I1 + Console.WriteLine("Derived.Goo1") End Sub End Class diff --git a/src/Compilers/Test/Utilities/VisualBasic/LocalVariableDeclaratorsCollector.vb b/src/Compilers/Test/Utilities/VisualBasic/LocalVariableDeclaratorsCollector.vb index c0aee0b0072ad..63ad2644cf89f 100644 --- a/src/Compilers/Test/Utilities/VisualBasic/LocalVariableDeclaratorsCollector.vb +++ b/src/Compilers/Test/Utilities/VisualBasic/LocalVariableDeclaratorsCollector.vb @@ -92,7 +92,7 @@ Friend NotInheritable Class LocalVariableDeclaratorsCollector Public Overrides Sub VisitSimpleArgument(node As SimpleArgumentSyntax) MyBase.Visit(node.Expression) - ' argument name in "foo(argName := expr)" does not declare locals + ' argument name in "goo(argName := expr)" does not declare locals Return End Sub End Class diff --git a/src/Compilers/VisualBasic/Portable/Binding/Binder_Conversions.vb b/src/Compilers/VisualBasic/Portable/Binding/Binder_Conversions.vb index 11cfafb259c3a..7f9c742ca2f1b 100644 --- a/src/Compilers/VisualBasic/Portable/Binding/Binder_Conversions.vb +++ b/src/Compilers/VisualBasic/Portable/Binding/Binder_Conversions.vb @@ -732,10 +732,10 @@ DoneWithDiagnostics: End If ' Variance scenario 1: | Variance scenario 3: - ' Dim x as IEnumerable(Of Tiger) = New List(Of Animal) | Dim x As IFoo(Of Animal) = New MyFoo - ' "List(Of Animal) cannot be converted to | "MyFoo cannot be converted to IFoo(Of Animal). + ' Dim x as IEnumerable(Of Tiger) = New List(Of Animal) | Dim x As IGoo(Of Animal) = New MyGoo + ' "List(Of Animal) cannot be converted to | "MyGoo cannot be converted to IGoo(Of Animal). ' IEnumerable(Of Tiger) because 'Animal' is not derived | Consider changing the 'T' in the definition - ' from 'Tiger', as required for the 'Out' generic | of interface IFoo(Of T) to an Out type + ' from 'Tiger', as required for the 'Out' generic | of interface IGoo(Of T) to an Out type ' parameter 'T' in 'IEnumerable(Of Out T)'" | parameter, Out T." ' | ' (1) If the user attempts a conversion to | (1) If the user attempts a conversion to some @@ -752,7 +752,7 @@ DoneWithDiagnostics: ' or Out variance | (5) Then pick the first difference Dj/Sj ' (5) Then pick on the one such difference Si/Di/Ti | (6) and report "SOURCE cannot be converted to ' (6) and report "SOURCE cannot be converted to DEST | DEST. Consider changing Tj in the definition - ' because Si is not derived from Di, as required | of interface/delegate IFoo(Of T) to an + ' because Si is not derived from Di, as required | of interface/delegate IGoo(Of T) to an ' for the 'In/Out' generic parameter 'T' in | In/Out type parameter, In/Out T". ' 'IEnumerable(Of Out T)'" | Dim matchingGenericInstantiation As NamedTypeSymbol diff --git a/src/Compilers/VisualBasic/Portable/Binding/Binder_Expressions.vb b/src/Compilers/VisualBasic/Portable/Binding/Binder_Expressions.vb index 512445f54ad97..2cb3e547d8749 100644 --- a/src/Compilers/VisualBasic/Portable/Binding/Binder_Expressions.vb +++ b/src/Compilers/VisualBasic/Portable/Binding/Binder_Expressions.vb @@ -1820,7 +1820,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic ' Dev10 comment: ' Note that this is needed so that we can determine whether the structure - ' is not an LValue (eg: RField.m_x = 20 where foo is a readonly field of a + ' is not an LValue (eg: RField.m_x = 20 where goo is a readonly field of a ' structure type). In such cases, the structure's field m_x cannot be modified. ' ' This does not apply to type params because for type params we do want to @@ -3572,7 +3572,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Dim arguments = typeArgumentsOpt.Arguments 'TODO: What should we do if count is 0? Can we get in a situation like this? - ' Perhaps for a missing type argument case [Foo(Of )]. + ' Perhaps for a missing type argument case [Goo(Of )]. Dim boundArguments(arguments.Count - 1) As TypeSymbol diff --git a/src/Compilers/VisualBasic/Portable/Binding/Binder_Initializers.vb b/src/Compilers/VisualBasic/Portable/Binding/Binder_Initializers.vb index 5ecd5b89082eb..9d0cdfdc3c463 100644 --- a/src/Compilers/VisualBasic/Portable/Binding/Binder_Initializers.vb +++ b/src/Compilers/VisualBasic/Portable/Binding/Binder_Initializers.vb @@ -543,7 +543,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic ' NOTE: a constant expression") and ERR_RequiredConstExpr ("Constant expression is required") in case ' NOTE: the type (if declared) is a valid type for const fields. This is different from Dev10 that sometimes ' NOTE: reported issues and sometimes not - ' NOTE: e.g. reports in "const foo as DelegateType = AddressOf methodName" (ERR_ConstAsNonConstant + ERR_RequiredConstExpr) + ' NOTE: e.g. reports in "const goo as DelegateType = AddressOf methodName" (ERR_ConstAsNonConstant + ERR_RequiredConstExpr) ' NOTE: only type diagnostics for "const s as StructureType = nothing" If boundInitValueHasErrorsOrConstTypeIsWrong Then @@ -554,7 +554,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic constValue = Me.GetExpressionConstantValueIfAny(boundInitValue, initValueDiagnostics, ConstantContext.Default) End If - ' e.g. the init value of "Public foo as Byte = 2.2" is still considered as constant and therefore a CByte(2) + ' e.g. the init value of "Public goo as Byte = 2.2" is still considered as constant and therefore a CByte(2) ' is being assigned as the constant value of this field/enum. However in case of Option Strict On there has ' been a diagnostics in the call to ApplyImplicitConversion. If constValue Is Nothing Then diff --git a/src/Compilers/VisualBasic/Portable/Binding/Binder_Invocation.vb b/src/Compilers/VisualBasic/Portable/Binding/Binder_Invocation.vb index c26dba07ad3cf..e97f91072941b 100644 --- a/src/Compilers/VisualBasic/Portable/Binding/Binder_Invocation.vb +++ b/src/Compilers/VisualBasic/Portable/Binding/Binder_Invocation.vb @@ -1770,14 +1770,14 @@ ProduceBoundNode: For i As Integer = 0 To bestSymbols.Length - 1 Step 1 ' in delegate context we just output for each candidates - ' BC30794: No accessible 'foo' is most specific: - ' Public Sub foo(p As Integer) - ' Public Sub foo(p As Integer) + ' BC30794: No accessible 'goo' is most specific: + ' Public Sub goo(p As Integer) + ' Public Sub goo(p As Integer) ' ' in other contexts we give more information, e.g. - ' BC30794: No accessible 'foo' is most specific: - ' Public Sub foo(p As Integer): - ' Public Sub foo(p As Integer): + ' BC30794: No accessible 'goo' is most specific: + ' Public Sub goo(p As Integer): + ' Public Sub goo(p As Integer): Dim bestSymbol As Symbol = bestSymbols(i) Dim bestSymbolIsExtension As Boolean = bestSymbol.IsReducedExtensionMethod @@ -1875,9 +1875,9 @@ ProduceBoundNode: ' When reporting errors for an AddressOf, Dev 10 shows different error messages depending on how many ' errors there are per candidate. ' One narrowing error will be shown like: - ' 'Public Sub foo6(p As Integer, p2 As Byte)': Option Strict On disallows implicit conversions from 'Integer' to 'Byte'. + ' 'Public Sub goo6(p As Integer, p2 As Byte)': Option Strict On disallows implicit conversions from 'Integer' to 'Byte'. ' More than one narrowing issues in the parameters are abbreviated with: - ' 'Public Sub foo6(p As Byte, p2 As Byte)': Method does not have a signature compatible with the delegate. + ' 'Public Sub goo6(p As Byte, p2 As Byte)': Method does not have a signature compatible with the delegate. If delegateSymbol Is Nothing OrElse Not sealedCandidateDiagnostics.Skip(1).Any() Then If isExtension Then diff --git a/src/Compilers/VisualBasic/Portable/Binding/Binder_Statements.vb b/src/Compilers/VisualBasic/Portable/Binding/Binder_Statements.vb index a2fd0632963ce..20b91da2ab4c1 100644 --- a/src/Compilers/VisualBasic/Portable/Binding/Binder_Statements.vb +++ b/src/Compilers/VisualBasic/Portable/Binding/Binder_Statements.vb @@ -2343,7 +2343,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic ByRef eventSymbol As EventSymbol) As BoundExpression ' event must be a simple name that could be qualified and perhaps parenthesized - ' Examples: foo , (foo) , (bar.foo) , baz.moo(of T).goo + ' Examples: goo , (goo) , (bar.goo) , baz.moo(of T).goo Dim notParenthesizedSyntax = node While notParenthesizedSyntax.Kind = SyntaxKind.ParenthesizedExpression notParenthesizedSyntax = DirectCast(notParenthesizedSyntax, ParenthesizedExpressionSyntax).Expression @@ -3032,7 +3032,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic If Not TypeOf currentBinder Is ForOrForEachBlockBinder Then ' this happens for broken code, e.g. ' for each a in arr1 - ' if foo() then + ' if goo() then ' for each b in arr2 ' next b, a ' end if diff --git a/src/Compilers/VisualBasic/Portable/Binding/ImportAliasesBinder.vb b/src/Compilers/VisualBasic/Portable/Binding/ImportAliasesBinder.vb index 5c9e109aab589..e4e25a22138a0 100644 --- a/src/Compilers/VisualBasic/Portable/Binding/ImportAliasesBinder.vb +++ b/src/Compilers/VisualBasic/Portable/Binding/ImportAliasesBinder.vb @@ -14,7 +14,7 @@ Imports TypeKind = Microsoft.CodeAnalysis.TypeKind Namespace Microsoft.CodeAnalysis.VisualBasic ''' - ''' A ImportAliasesBinder provides lookup for looking up import aliases (A = Foo.Bar), + ''' A ImportAliasesBinder provides lookup for looking up import aliases (A = Goo.Bar), ''' either at file level or project level. ''' Friend Class ImportAliasesBinder diff --git a/src/Compilers/VisualBasic/Portable/Binding/LookupOptions.vb b/src/Compilers/VisualBasic/Portable/Binding/LookupOptions.vb index 171a80ba2ca9d..39f83b722b475 100644 --- a/src/Compilers/VisualBasic/Portable/Binding/LookupOptions.vb +++ b/src/Compilers/VisualBasic/Portable/Binding/LookupOptions.vb @@ -117,18 +117,18 @@ Namespace Microsoft.CodeAnalysis.VisualBasic ''' the same name. This is not possible in the .NET world, but for backwards compatibility, especially with Office, ''' the compiler will ignore ambiguities when performing a lookup in a CoClass interface. Example: ''' - ''' Interface _Foo + ''' Interface _Goo ''' Sub Quit ''' - ''' Interface FooSource + ''' Interface GooSource ''' Event Quit ''' - ''' < System.Runtime.InteropServices.CoClass(GetType(FooClass)) > - ''' Interface Foo : Inherits _Foo, FooSource + ''' < System.Runtime.InteropServices.CoClass(GetType(GooClass)) > + ''' Interface Goo : Inherits _Goo, GooSource ''' - ''' Class FooClass : Implements Foo - ''' Event Quit Implements Foo.Quit - ''' Sub Quit Implements Foo.Quit + ''' Class GooClass : Implements Goo + ''' Event Quit Implements Goo.Quit + ''' Sub Quit Implements Goo.Quit ''' ''' EventsOnly = 1 << 15 diff --git a/src/Compilers/VisualBasic/Portable/Binding/LookupResult.vb b/src/Compilers/VisualBasic/Portable/Binding/LookupResult.vb index 690c9f911a373..ef28396a2c5a3 100644 --- a/src/Compilers/VisualBasic/Portable/Binding/LookupResult.vb +++ b/src/Compilers/VisualBasic/Portable/Binding/LookupResult.vb @@ -220,7 +220,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic ''' ''' Dim result = LookupResult.GetInstance() ''' - ''' scope.Lookup(result, "foo") + ''' scope.Lookup(result, "goo") ''' ... use result ... ''' ''' result.Clear() diff --git a/src/Compilers/VisualBasic/Portable/Binding/MemberSemanticModel.vb b/src/Compilers/VisualBasic/Portable/Binding/MemberSemanticModel.vb index ede0b5a38f133..d3d43e51b92a4 100644 --- a/src/Compilers/VisualBasic/Portable/Binding/MemberSemanticModel.vb +++ b/src/Compilers/VisualBasic/Portable/Binding/MemberSemanticModel.vb @@ -1947,7 +1947,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic ''' and returns it instead of rebinding it. ''' ''' FOr example, we might have: - ''' While x > foo() + ''' While x > goo() ''' y = y * x ''' z = z + y ''' End While diff --git a/src/Compilers/VisualBasic/Portable/CodeGen/EmitAddress.vb b/src/Compilers/VisualBasic/Portable/CodeGen/EmitAddress.vb index 1c73da6bb73a4..5fcfb90d51bfe 100644 --- a/src/Compilers/VisualBasic/Portable/CodeGen/EmitAddress.vb +++ b/src/Compilers/VisualBasic/Portable/CodeGen/EmitAddress.vb @@ -99,8 +99,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGen ' rewriter should take care of Parenthesized ' ' we do not know how to emit address of a parenthesized without context. - ' when it is an argument like foo((arg)), it must be cloned, - ' in other cases like (receiver).foo() it might not need to be... + ' when it is an argument like goo((arg)), it must be cloned, + ' in other cases like (receiver).goo() it might not need to be... ' Debug.Assert(False, "we should not see parenthesized in EmitAddress.") @@ -162,7 +162,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGen ' when a sequence Is happened to be a byref receiver ' we may need to extend the life time of the target until we are done accessing it - ' {.v ; v = Foo(); v}.Bar() // v should be released after Bar() Is over. + ' {.v ; v = Goo(); v}.Bar() // v should be released after Bar() Is over. Dim doNotRelease As LocalSymbol = Nothing If (tempOpt Is Nothing) Then Dim referencedLocal As BoundLocal = DigForLocal(sequence.ValueOpt) diff --git a/src/Compilers/VisualBasic/Portable/CodeGen/Optimizer/StackScheduler.Analyzer.vb b/src/Compilers/VisualBasic/Portable/CodeGen/Optimizer/StackScheduler.Analyzer.vb index 5c105da6a9254..1993987268d3d 100644 --- a/src/Compilers/VisualBasic/Portable/CodeGen/Optimizer/StackScheduler.Analyzer.vb +++ b/src/Compilers/VisualBasic/Portable/CodeGen/Optimizer/StackScheduler.Analyzer.vb @@ -16,7 +16,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGen ''' it will affect inference of stack behavior ''' it will also affect when expressions can be dup-reused ''' Example: - ''' Foo(x, ref x) x cannot be duped as it is used in different context + ''' Goo(x, ref x) x cannot be duped as it is used in different context ''' Private Enum ExprContext None diff --git a/src/Compilers/VisualBasic/Portable/Compilation/SemanticModel.vb b/src/Compilers/VisualBasic/Portable/Compilation/SemanticModel.vb index be0644181b57f..7cfcb5ae1d16d 100644 --- a/src/Compilers/VisualBasic/Portable/Compilation/SemanticModel.vb +++ b/src/Compilers/VisualBasic/Portable/Compilation/SemanticModel.vb @@ -2786,7 +2786,7 @@ _Default: ''' Event E3(bar As Integer) Implements I1.E ' "bar" means nothing here. Only type matters. ''' ''' Sub moo() - ''' RaiseEvent E3(qwer:=123) ' qwer binds to parameter on I1.EEventhandler.invoke(foo) + ''' RaiseEvent E3(qwer:=123) ' qwer binds to parameter on I1.EEventhandler.invoke(goo) ''' End Sub '''End Class ''' diff --git a/src/Compilers/VisualBasic/Portable/Declarations/DeclarationTreeBuilder.vb b/src/Compilers/VisualBasic/Portable/Declarations/DeclarationTreeBuilder.vb index 6e3e3158ff19b..cd0ecd03ef274 100644 --- a/src/Compilers/VisualBasic/Portable/Declarations/DeclarationTreeBuilder.vb +++ b/src/Compilers/VisualBasic/Portable/Declarations/DeclarationTreeBuilder.vb @@ -266,8 +266,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols Dim ns As SingleNamespaceDeclaration = Nothing ' The compilation node will count as a location for the innermost project level - ' namespace. i.e. if the project level namespace is "Foo.Bar", then each compilation unit - ' is a location for "Foo.Bar". "Foo" still has no syntax location though. + ' namespace. i.e. if the project level namespace is "Goo.Bar", then each compilation unit + ' is a location for "Goo.Bar". "Goo" still has no syntax location though. ' ' By doing this we ensure that top level type and namespace declarations will have ' symbols whose parent namespace symbol points to the parent container CompilationUnit. diff --git a/src/Compilers/VisualBasic/Portable/Declarations/MergedNamespaceDeclaration.vb b/src/Compilers/VisualBasic/Portable/Declarations/MergedNamespaceDeclaration.vb index 2713ee9fd8304..1c338eb1b5a04 100644 --- a/src/Compilers/VisualBasic/Portable/Declarations/MergedNamespaceDeclaration.vb +++ b/src/Compilers/VisualBasic/Portable/Declarations/MergedNamespaceDeclaration.vb @@ -10,7 +10,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols Inherits MergedNamespaceOrTypeDeclaration Private ReadOnly _declarations As ImmutableArray(Of SingleNamespaceDeclaration) - Private ReadOnly _multipleSpellings As Boolean ' true if the namespace is spelling with multiple different case-insensitive spellings ("Namespace FOO" and "Namespace foo") + Private ReadOnly _multipleSpellings As Boolean ' true if the namespace is spelling with multiple different case-insensitive spellings ("Namespace GOO" and "Namespace goo") Private _children As ImmutableArray(Of MergedNamespaceOrTypeDeclaration) Private Sub New(declarations As ImmutableArray(Of SingleNamespaceDeclaration)) @@ -157,7 +157,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols End Property ' Is this declaration merged from declarations with different case-sensitive spellings - ' (i.e., "Namespace FOO" and "Namespace foo". + ' (i.e., "Namespace GOO" and "Namespace goo". Public ReadOnly Property HasMultipleSpellings As Boolean Get Return _multipleSpellings diff --git a/src/Compilers/VisualBasic/Portable/Lowering/AsyncRewriter/AsyncRewriter.AsyncMethodToClassRewriter.Spilling.vb b/src/Compilers/VisualBasic/Portable/Lowering/AsyncRewriter/AsyncRewriter.AsyncMethodToClassRewriter.Spilling.vb index 0fcce223b6f54..bcc34fbba9f15 100644 --- a/src/Compilers/VisualBasic/Portable/Lowering/AsyncRewriter/AsyncRewriter.AsyncMethodToClassRewriter.Spilling.vb +++ b/src/Compilers/VisualBasic/Portable/Lowering/AsyncRewriter/AsyncRewriter.AsyncMethodToClassRewriter.Spilling.vb @@ -108,14 +108,14 @@ Namespace Microsoft.CodeAnalysis.VisualBasic ''' ''' Example: ''' - ''' (1 + 2, await t1, Foo(), await t2, 3 + 4) + ''' (1 + 2, await t1, Goo(), await t2, 3 + 4) ''' ''' becomes: ''' ''' Spill( ''' spill1 = 1 + 2, ''' spill2 = await t1, - ''' spill3 = Foo(), + ''' spill3 = Goo(), ''' (spill1, spill2, spill3, await t2, 3 + 4)) ''' ''' NOTE: Consider nested array initializers: diff --git a/src/Compilers/VisualBasic/Portable/Lowering/LocalRewriter/LocalRewriter_AssignmentOperator.vb b/src/Compilers/VisualBasic/Portable/Lowering/LocalRewriter/LocalRewriter_AssignmentOperator.vb index 06eca298ceba6..cf8c2b6ab19ea 100644 --- a/src/Compilers/VisualBasic/Portable/Lowering/LocalRewriter/LocalRewriter_AssignmentOperator.vb +++ b/src/Compilers/VisualBasic/Portable/Lowering/LocalRewriter/LocalRewriter_AssignmentOperator.vb @@ -279,7 +279,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Dim result As BoundExpression If assignmentTarget.Kind = BoundKind.LateMemberAccess Then - ' objExpr.foo = bar + ' objExpr.goo = bar result = LateSet(node.Syntax, DirectCast(MyBase.VisitLateMemberAccess(DirectCast(assignmentTarget, BoundLateMemberAccess)), BoundLateMemberAccess), value, @@ -290,7 +290,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Dim invocation = DirectCast(assignmentTarget, BoundLateInvocation) If invocation.Member.Kind = BoundKind.LateMemberAccess Then - ' objExpr.foo(args) = bar + ' objExpr.goo(args) = bar result = LateSet(node.Syntax, DirectCast(MyBase.VisitLateMemberAccess(DirectCast(invocation.Member, BoundLateMemberAccess)), BoundLateMemberAccess), value, diff --git a/src/Compilers/VisualBasic/Portable/Lowering/LocalRewriter/LocalRewriter_BinaryOperators.vb b/src/Compilers/VisualBasic/Portable/Lowering/LocalRewriter/LocalRewriter_BinaryOperators.vb index 755fbc4f0a784..06e432f615d85 100644 --- a/src/Compilers/VisualBasic/Portable/Lowering/LocalRewriter/LocalRewriter_BinaryOperators.vb +++ b/src/Compilers/VisualBasic/Portable/Lowering/LocalRewriter/LocalRewriter_BinaryOperators.vb @@ -141,9 +141,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic End If ' See Semantics::AlterForMyGroup - ' "foo.Form1 IS something" is translated to "foo.m_Form1 IS something" when + ' "goo.Form1 IS something" is translated to "goo.m_Form1 IS something" when ' Form1 is a property generated by MyGroupCollection - ' Otherwise 'foo.Form1 IS Nothing" would be always false because 'foo.Form1' + ' Otherwise 'goo.Form1 IS Nothing" would be always false because 'goo.Form1' ' property call creates an instance on the fly. Select Case operand.Kind diff --git a/src/Compilers/VisualBasic/Portable/Lowering/LocalRewriter/LocalRewriter_Call.vb b/src/Compilers/VisualBasic/Portable/Lowering/LocalRewriter/LocalRewriter_Call.vb index be3b6123f43c5..38d4f85d82231 100644 --- a/src/Compilers/VisualBasic/Portable/Lowering/LocalRewriter/LocalRewriter_Call.vb +++ b/src/Compilers/VisualBasic/Portable/Lowering/LocalRewriter/LocalRewriter_Call.vb @@ -338,7 +338,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic RemovePlaceholderReplacement(argument.OutPlaceholder) If secondUse.Kind = BoundKind.LateMemberAccess Then - ' Method(ref objExpr.foo) + ' Method(ref objExpr.goo) copyBack = LateSet(secondUse.Syntax, DirectCast(MyBase.VisitLateMemberAccess(DirectCast(secondUse, BoundLateMemberAccess)), BoundLateMemberAccess), @@ -350,7 +350,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Dim invocation = DirectCast(secondUse, BoundLateInvocation) If invocation.Member.Kind = BoundKind.LateMemberAccess Then - ' Method(ref objExpr.foo(args)) + ' Method(ref objExpr.goo(args)) copyBack = LateSet(invocation.Syntax, DirectCast(MyBase.VisitLateMemberAccess(DirectCast(invocation.Member, BoundLateMemberAccess)), BoundLateMemberAccess), copyBackValue, diff --git a/src/Compilers/VisualBasic/Portable/Lowering/LocalRewriter/LocalRewriter_LateBindingHelpers.vb b/src/Compilers/VisualBasic/Portable/Lowering/LocalRewriter/LocalRewriter_LateBindingHelpers.vb index 351b65d94404d..30d8190cddd26 100644 --- a/src/Compilers/VisualBasic/Portable/Lowering/LocalRewriter/LocalRewriter_LateBindingHelpers.vb +++ b/src/Compilers/VisualBasic/Portable/Lowering/LocalRewriter/LocalRewriter_LateBindingHelpers.vb @@ -412,7 +412,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic convertedValue As BoundExpression) As BoundExpression If assignmentTarget.Kind = BoundKind.LateMemberAccess Then - ' objExpr.foo = bar + ' objExpr.goo = bar Dim memberAccess = DirectCast(assignmentTarget, BoundLateMemberAccess) Return LateSet(syntax, memberAccess, @@ -426,7 +426,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic If invocation.Member.Kind = BoundKind.LateMemberAccess Then Dim memberAccess = DirectCast(invocation.Member, BoundLateMemberAccess) - ' objExpr.foo(args) = bar + ' objExpr.goo(args) = bar Return LateSet(syntax, memberAccess, convertedValue, @@ -468,7 +468,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Dim syntax = node.Syntax - ' expr = o.Foo + ' expr = o.Goo ' emit as: ' LateGet(invocation.Member, ' invocation.Arguments, diff --git a/src/Compilers/VisualBasic/Portable/Lowering/LocalRewriter/LocalRewriter_LateInvocation.vb b/src/Compilers/VisualBasic/Portable/Lowering/LocalRewriter/LocalRewriter_LateInvocation.vb index 21ccb9e9b0ad7..00ffcceddffbc 100644 --- a/src/Compilers/VisualBasic/Portable/Lowering/LocalRewriter/LocalRewriter_LateInvocation.vb +++ b/src/Compilers/VisualBasic/Portable/Lowering/LocalRewriter/LocalRewriter_LateInvocation.vb @@ -23,7 +23,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic End If If node.Member.Kind = BoundKind.LateMemberAccess Then - ' objReceiver.foo(args) + ' objReceiver.goo(args) Dim member = DirectCast(node.Member, BoundLateMemberAccess) ' NOTE: member is not the receiver of the call, it just represents the latebound access. diff --git a/src/Compilers/VisualBasic/Portable/Parser/ParseExpression.vb b/src/Compilers/VisualBasic/Portable/Parser/ParseExpression.vb index f11cdd397c7f8..97d81effec421 100644 --- a/src/Compilers/VisualBasic/Portable/Parser/ParseExpression.vb +++ b/src/Compilers/VisualBasic/Portable/Parser/ParseExpression.vb @@ -291,7 +291,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax ' 6. end element without begin , element missing name - ' /* Dev10_427764 : Allow an implicit line continuation for XML after '(', e.g. foo( + ' /* Dev10_427764 : Allow an implicit line continuation for XML after '(', e.g. goo( Dim tokenHasFullWidthChars As Boolean = TokenContainsFullWidthChars(start) diff --git a/src/Compilers/VisualBasic/Portable/Parser/ParseScan.vb b/src/Compilers/VisualBasic/Portable/Parser/ParseScan.vb index 26f0cb27bbd95..82c583ae61eda 100644 --- a/src/Compilers/VisualBasic/Portable/Parser/ParseScan.vb +++ b/src/Compilers/VisualBasic/Portable/Parser/ParseScan.vb @@ -139,8 +139,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax Return True ElseIf allowGenericsWithoutOf Then ' // To enable a better user experience in some common generics' - ' // error scenarios, we special case foo(Integer) and - ' // foo(Integer, garbage). + ' // error scenarios, we special case goo(Integer) and + ' // goo(Integer, garbage). ' // ' // "(Integer" indicates possibly type parameters with missing "of", ' // but not "(Integer." and "Integer!" because they could possibly diff --git a/src/Compilers/VisualBasic/Portable/Parser/ParseStatement.vb b/src/Compilers/VisualBasic/Portable/Parser/ParseStatement.vb index 7f5e36ca0be4e..5aaa97a726d3d 100644 --- a/src/Compilers/VisualBasic/Portable/Parser/ParseStatement.vb +++ b/src/Compilers/VisualBasic/Portable/Parser/ParseStatement.vb @@ -1746,7 +1746,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax If operand Is Nothing Then ' if we bailed because the first token was not a way to start an expression, we might - ' be in a situation like "foo(Sub() Return, 15)" where next token was a valid thing + ' be in a situation like "goo(Sub() Return, 15)" where next token was a valid thing ' to come after this return statement, in which case we proceed without trying ' to gobble up the return expression. Or we might be like "Return Select", where the next ' token cannot possibly come after the statement, so we'll report on it now: diff --git a/src/Compilers/VisualBasic/Portable/Parser/Parser.vb b/src/Compilers/VisualBasic/Portable/Parser/Parser.vb index a5560c25b5f0b..9de4aef245e26 100644 --- a/src/Compilers/VisualBasic/Portable/Parser/Parser.vb +++ b/src/Compilers/VisualBasic/Portable/Parser/Parser.vb @@ -4200,7 +4200,7 @@ checkNullable: End If End If - ' ===== Parse the property's type (e.g. Property Foo(params) AS type ) + ' ===== Parse the property's type (e.g. Property Goo(params) AS type ) Dim asClause As AsClauseSyntax = Nothing Dim initializer As EqualsValueSyntax = Nothing diff --git a/src/Compilers/VisualBasic/Portable/Semantics/AccessCheck.vb b/src/Compilers/VisualBasic/Portable/Semantics/AccessCheck.vb index 2fa7380fb2928..3a9967dae7e4f 100644 --- a/src/Compilers/VisualBasic/Portable/Semantics/AccessCheck.vb +++ b/src/Compilers/VisualBasic/Portable/Semantics/AccessCheck.vb @@ -347,7 +347,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic ' ' eg: ' Class Cls1 - ' Protected Sub foo() + ' Protected Sub goo() ' End Sub ' End Class ' @@ -356,10 +356,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic ' ' Sub Test() ' Dim obj1 as New Cls1 - ' Obj1.foo 'Not accessible + ' Obj1.goo 'Not accessible ' ' Dim obj2 as New Cls2 - ' Obj2.foo 'Accessible + ' Obj2.goo 'Accessible ' End Sub ' End Class If InheritsFromIgnoringConstruction(originalThroughTypeOpt, withinType, basesBeingResolved, useSiteDiagnostics) Then @@ -373,7 +373,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic ' ' eg: ' Class Cls1 - ' Protected Sub foo() + ' Protected Sub goo() ' End Sub ' End Class ' @@ -386,7 +386,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic ' Class Cls2_1 ' Sub Test() ' Dim obj2 as New Cls2 - ' Obj2.foo 'Accessible + ' Obj2.goo 'Accessible ' ' Obj2.goo 'Accessible ' End Sub @@ -466,7 +466,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic current = Nothing ' can't go up the base type chain. Else ' NOTE: The base type of an 'original' type may not be 'original'. i.e. - ' "class Foo : Inherits IBar(Of Integer)". We must map it back to the 'original' when as we walk up + ' "class Goo : Inherits IBar(Of Integer)". We must map it back to the 'original' when as we walk up ' the base type hierarchy. current = current.BaseTypeOriginalDefinition(useSiteDiagnostics) End If diff --git a/src/Compilers/VisualBasic/Portable/Semantics/OverloadResolution.vb b/src/Compilers/VisualBasic/Portable/Semantics/OverloadResolution.vb index 0640de7c0ae68..eedca0299cc2a 100644 --- a/src/Compilers/VisualBasic/Portable/Semantics/OverloadResolution.vb +++ b/src/Compilers/VisualBasic/Portable/Semantics/OverloadResolution.vb @@ -2657,7 +2657,7 @@ Done: ''' ''' Assumptions: ''' 1) This function is never called for a candidate that should be rejected due to parameter count. - ''' 2) Omitted arguments [ Call Foo(a, , b) ] are represented by OmittedArgumentExpression node in the arguments array. + ''' 2) Omitted arguments [ Call Goo(a, , b) ] are represented by OmittedArgumentExpression node in the arguments array. ''' 3) Omitted argument never has name. ''' 4) argumentNames contains Nothing for all positional arguments. ''' @@ -2821,7 +2821,7 @@ Bailout: ''' ''' Assumptions: ''' 1) This function is never called for a candidate that should be rejected due to parameter count. - ''' 2) Omitted arguments [ Call Foo(a, , b) ] are represented by OmittedArgumentExpression node in the arguments array. + ''' 2) Omitted arguments [ Call Goo(a, , b) ] are represented by OmittedArgumentExpression node in the arguments array. ''' 3) Omitted argument never has name. ''' 4) argumentNames contains Nothing for all positional arguments. ''' diff --git a/src/Compilers/VisualBasic/Portable/Semantics/TypeInference/TypeArgumentInference.vb b/src/Compilers/VisualBasic/Portable/Semantics/TypeInference/TypeArgumentInference.vb index 4d66e39485340..f1c7953952161 100644 --- a/src/Compilers/VisualBasic/Portable/Semantics/TypeInference/TypeArgumentInference.vb +++ b/src/Compilers/VisualBasic/Portable/Semantics/TypeInference/TypeArgumentInference.vb @@ -734,7 +734,7 @@ HandleAsAGeneralExpression: ' The process of populating the graph also seeds type hints for type parameters referenced by explicitly typed ' lambda parameters. Also, hints sometimes have restrictions placed on them that limit what conversions the dominant type ' algorithm can consider when it processes them. The restrictions are generally driven by the context in which type - ' parameters are used. For example if a type parameter is used as a type parameter of another type (something like IFoo(of T)), + ' parameters are used. For example if a type parameter is used as a type parameter of another type (something like IGoo(of T)), ' then the dominant type algorithm is not allowed to consider any conversions. There are similar restrictions for ' Array co-variance. @@ -1377,7 +1377,7 @@ HandleAsAGeneralExpression: If argumentType Is Nothing OrElse argumentType.IsVoidType() Then ' We should never be able to infer a value from something that doesn't provide a value, e.g: - ' Foo(Of T) can't be passed Sub bar(), as in Foo(Bar()) + ' Goo(Of T) can't be passed Sub bar(), as in Goo(Bar()) Return False End If @@ -1441,7 +1441,7 @@ HandleAsAGeneralExpression: Return True ElseIf parameterType.Kind = SymbolKind.NamedType Then - ' e.g. handle foo(of T)(x as Bar(Of T)) We need to dig into Bar(Of T) + ' e.g. handle goo(of T)(x as Bar(Of T)) We need to dig into Bar(Of T) Dim parameterTypeAsNamedType = DirectCast(parameterType, NamedTypeSymbol) diff --git a/src/Compilers/VisualBasic/Portable/Semantics/TypeInference/TypeInferenceCollection.vb b/src/Compilers/VisualBasic/Portable/Semantics/TypeInference/TypeInferenceCollection.vb index f0b569d92ea0c..703623ea24e08 100644 --- a/src/Compilers/VisualBasic/Portable/Semantics/TypeInference/TypeInferenceCollection.vb +++ b/src/Compilers/VisualBasic/Portable/Semantics/TypeInference/TypeInferenceCollection.vb @@ -456,9 +456,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic ' For hint satisfaction it should be demoted to Narrowing. This is required for the following case, otherwise, ' type of t is ambiguous. ' - ' Foo2Params({1, 2, 3}, {1L, 2L, 3L}) + ' Goo2Params({1, 2, 3}, {1L, 2L, 3L}) ' - ' Function Foo2Params(Of t)(x As t, y As t) As String + ' Function Goo2Params(Of t)(x As t, y As t) As String conversion = ConversionKind.Narrowing End If diff --git a/src/Compilers/VisualBasic/Portable/Symbols/MethodSignatureComparer.vb b/src/Compilers/VisualBasic/Portable/Symbols/MethodSignatureComparer.vb index 66f321ea176e7..482498037b7c7 100644 --- a/src/Compilers/VisualBasic/Portable/Symbols/MethodSignatureComparer.vb +++ b/src/Compilers/VisualBasic/Portable/Symbols/MethodSignatureComparer.vb @@ -785,8 +785,8 @@ Done: ' If this method is generic, get a TypeSubstitution that substitutes IndexedTypeParameterSymbols ' for each method type parameter. This allows correctly comparing parameter and return types ' between two signatures: - ' Function foo(Of T)(p As T) As IEnumerable(Of T) - ' Function foo(Of U)(p As U) As IEnumerable(Of U) + ' Function goo(Of T)(p As T) As IEnumerable(Of T) + ' Function goo(Of U)(p As U) As IEnumerable(Of U) ' ' The substitution returned is to be applied to the ORIGINAL definition of the method. Private Shared Function GetTypeSubstitution(method As MethodSymbol) As TypeSubstitution diff --git a/src/Compilers/VisualBasic/Portable/Symbols/Source/ImplementsHelper.vb b/src/Compilers/VisualBasic/Portable/Symbols/Source/ImplementsHelper.vb index f185ed19dd0bb..d59f74d19632e 100644 --- a/src/Compilers/VisualBasic/Portable/Symbols/Source/ImplementsHelper.vb +++ b/src/Compilers/VisualBasic/Portable/Symbols/Source/ImplementsHelper.vb @@ -554,15 +554,15 @@ DoneWithErrorReporting: ' (not a derived interface), since this is the metadata rule from Partition II, section 12.2. ' ' Consider: - ' Interface IFoo ' from metadata - ' Sub Foo() + ' Interface IGoo ' from metadata + ' Sub Goo() ' Class A ' from metadata - ' Public Sub Foo() - ' Class B: Inherits A: Implements IFoo ' from metadata + ' Public Sub Goo() + ' Class B: Inherits A: Implements IGoo ' from metadata ' Class C: Inherits B ' from metadata - ' Public Shadows Sub Foo() - ' Class D: Inherits C: Implements IFoo ' from source - ' In this case, A.Foo is the correct implementation of IFoo.Foo within D. + ' Public Shadows Sub Goo() + ' Class D: Inherits C: Implements IGoo ' from source + ' In this case, A.Goo is the correct implementation of IGoo.Goo within D. ' NOTE: Ideally, we'd like to distinguish between the "current" compilation and other assemblies ' (including other compilations), rather than source and metadata, but there are two reasons that diff --git a/src/Compilers/VisualBasic/Portable/Symbols/Source/QuickAttributeChecker.vb b/src/Compilers/VisualBasic/Portable/Symbols/Source/QuickAttributeChecker.vb index 89e60a54c4ef7..92f9c5451ec94 100644 --- a/src/Compilers/VisualBasic/Portable/Symbols/Source/QuickAttributeChecker.vb +++ b/src/Compilers/VisualBasic/Portable/Symbols/Source/QuickAttributeChecker.vb @@ -41,7 +41,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols _nameToAttributeMap(name) = newAttributes Or current - ' We allow "Foo" to bind to "FooAttribute". + ' We allow "Goo" to bind to "GooAttribute". If name.EndsWith("Attribute", StringComparison.OrdinalIgnoreCase) Then _nameToAttributeMap(name.Substring(0, name.Length - "Attribute".Length)) = newAttributes Or current End If diff --git a/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceMemberContainerTypeSymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceMemberContainerTypeSymbol.vb index f1d0a2bb1c66d..415a5098c9158 100644 --- a/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceMemberContainerTypeSymbol.vb +++ b/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceMemberContainerTypeSymbol.vb @@ -417,7 +417,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols ' * the interface is either invariant or it lacks nested classes and structs, and ' * every nested type is valid. ' - ' A property "Property Foo as T" is valid if and only if either + ' A property "Property Goo as T" is valid if and only if either ' * The property is read-only and T is valid covariantly, or ' * The property is write-only and T is valid invariantly, or ' * The property is readable and writable and T is invariant. @@ -519,12 +519,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols End If ' Variance spec $2 - ' A delegate "Delegate Function/Sub Foo(Of T1, ... Tn)Signature" is valid if and only if + ' A delegate "Delegate Function/Sub Goo(Of T1, ... Tn)Signature" is valid if and only if ' * the signature is valid. ' - ' That delegate becomes "Class Foo(Of T1, ... Tn) : Function Invoke(...) As ... : End Class + ' That delegate becomes "Class Goo(Of T1, ... Tn) : Function Invoke(...) As ... : End Class ' So we just need to pick up the "Invoke" method and check that it's valid. - ' NB. that delegates can have variance in their generic params, and hence so can e.g. "Class Foo(Of Out T1)" + ' NB. that delegates can have variance in their generic params, and hence so can e.g. "Class Goo(Of Out T1)" ' This is the only place in the CLI where a class can have variant generic params. ' ' Note: delegates that are synthesized from events are already dealt with in @@ -1343,16 +1343,16 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols ''' Although namespaces unify based on case-insensitive name, VB uses the casing the namespace ''' declaration surround the class definition for the name emitted to metadata. ''' - ''' Namespace FOO + ''' Namespace GOO ''' Class X ''' End Class ''' ENd Namespace - ''' Namespace foo + ''' Namespace goo ''' Class Y ''' End Class ''' ENd Namespace ''' - ''' In metadata, these are classes "FOO.X" and "foo.Y" (and thus appear in different namespaces + ''' In metadata, these are classes "GOO.X" and "goo.Y" (and thus appear in different namespaces ''' when imported into C#.) This function determines the casing of the namespace part of a class, if needed ''' to override the namespace name. ''' @@ -3103,7 +3103,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols Else ' the formatting of this error message is quite special and needs special treatment - ' e.g. 'foo' is already declared as 'Class Foo' in this class. + ' e.g. 'goo' is already declared as 'Class Goo' in this class. ' "'{0}' is already declared as '{1}' in this {2}." Binder.ReportDiagnostic( diff --git a/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceNamespaceSymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceNamespaceSymbol.vb index e5476abc95a69..88f1953e8d644 100644 --- a/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceNamespaceSymbol.vb +++ b/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceNamespaceSymbol.vb @@ -606,7 +606,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols ''' ''' Does this namespace have multiple different case-sensitive spellings - ''' (i.e., "Namespace FOO" and "Namespace foo". Includes parent namespace(s). + ''' (i.e., "Namespace GOO" and "Namespace goo". Includes parent namespace(s). ''' Friend ReadOnly Property HasMultipleSpellings As Boolean Get @@ -620,16 +620,16 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols ''' syntax tree and location. ''' I.e., if this namespace was declared with: ''' Namespace zAp - ''' Namespace FOO.bar + ''' Namespace GOO.bar ''' 'location ''' End Namespace ''' End Namespace ''' Namespace ZAP - ''' Namespace foo.bar + ''' Namespace goo.bar ''' End Namespace ''' End Namespace ''' - ''' It would return "ProjectNamespace.zAp.FOO.bar". + ''' It would return "ProjectNamespace.zAp.GOO.bar". ''' Friend Function GetDeclarationSpelling(tree As SyntaxTree, location As Integer) As String If Not HasMultipleSpellings Then diff --git a/src/Compilers/VisualBasic/Portable/Symbols/SymbolExtensions.vb b/src/Compilers/VisualBasic/Portable/Symbols/SymbolExtensions.vb index 414bfeb0277b8..cda2b5b4a77c4 100644 --- a/src/Compilers/VisualBasic/Portable/Symbols/SymbolExtensions.vb +++ b/src/Compilers/VisualBasic/Portable/Symbols/SymbolExtensions.vb @@ -41,7 +41,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols Case TypeKind.Module Return "module" Case TypeKind.Delegate - ' Dev10 error message format "... delegate Class foo ..." instead of "... delegate foo ..." + ' Dev10 error message format "... delegate Class goo ..." instead of "... delegate goo ..." Return "delegate Class" Case Else 'TODO: do we need string s for ByRef, Array, TypeParameter etc? diff --git a/src/Compilers/VisualBasic/Portable/Syntax/SyntaxNormalizer.vb b/src/Compilers/VisualBasic/Portable/Syntax/SyntaxNormalizer.vb index b40214b16f81a..6bc3452024276 100644 --- a/src/Compilers/VisualBasic/Portable/Syntax/SyntaxNormalizer.vb +++ b/src/Compilers/VisualBasic/Portable/Syntax/SyntaxNormalizer.vb @@ -499,14 +499,14 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Syntax End If ' handle closing attribute before XML tokens - ' sub foo( ByRef i as Integer) instead of sub foo(ByRef i as Integer) + ' sub goo( ByRef i as Integer) instead of sub goo(ByRef i as Integer) If (token.Kind = SyntaxKind.GreaterThanToken AndAlso token.Parent.Kind = SyntaxKind.AttributeList) Then Return True End If ' needs to be checked after binary operators - ' Imports instead of + ' instead of If token.Kind = SyntaxKind.BeginCDataToken OrElse nextToken.Kind = SyntaxKind.EndCDataToken Then Return False @@ -549,7 +549,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Syntax Return False End If - ' ''' We want to display type blocks (Modules, Classes, Structures and Interfaces) like follows - ''' Class Foo + ''' Class Goo ''' implements IBar1, IBar2 ''' implements IBar3 ''' inherits Bar1 @@ -814,7 +814,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Syntax ''' ''' or ''' - ''' Class Foo + ''' Class Goo ''' ''' Public Sub Boo() ''' End Sub diff --git a/src/Compilers/VisualBasic/Test/CommandLine/CommandLineArgumentsTests.vb b/src/Compilers/VisualBasic/Test/CommandLine/CommandLineArgumentsTests.vb index d1cb760943c31..23f2113819b2e 100644 --- a/src/Compilers/VisualBasic/Test/CommandLine/CommandLineArgumentsTests.vb +++ b/src/Compilers/VisualBasic/Test/CommandLine/CommandLineArgumentsTests.vb @@ -37,7 +37,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests Assert.Equal(True, dict("OnlyEqualsNoValue2")) Assert.Equal(GetType(Boolean), (dict("OnlyEqualsNoValue2")).GetType) - text = ",,,,,foo=bar,,,,,,,,,," + text = ",,,,,goo=bar,,,,,,,,,," dict = VisualBasicCommandLineParser.ParseConditionalCompilationSymbols(text, errors) Assert.Equal(1, dict.Count) @@ -47,20 +47,20 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests Assert.Equal(1, errors.Count) errors.Verify(Diagnostic(ERRID.ERR_ConditionalCompilationConstantNotValid).WithArguments("Identifier expected.", "= ^^ ^^ ")) - Dim previousSymbols As New Dictionary(Of String, Object)() From {{"Foo", 1}, {"Bar", "Foo"}} + Dim previousSymbols As New Dictionary(Of String, Object)() From {{"Goo", 1}, {"Bar", "Goo"}} text = ",,,=,,," dict = VisualBasicCommandLineParser.ParseConditionalCompilationSymbols(text, errors, previousSymbols) Assert.Equal(2, dict.Count) Assert.Equal(1, errors.Count) errors.Verify(Diagnostic(ERRID.ERR_ConditionalCompilationConstantNotValid).WithArguments("Identifier expected.", "= ^^ ^^ ")) - text = "OnlyEqualsNoValue1=, Bar=foo" + text = "OnlyEqualsNoValue1=, Bar=goo" dict = VisualBasicCommandLineParser.ParseConditionalCompilationSymbols(text, errors) Assert.Equal(0, dict.Count) Assert.Equal(1, errors.Count) errors.Verify(Diagnostic(ERRID.ERR_ConditionalCompilationConstantNotValid).WithArguments("Expression expected.", "OnlyEqualsNoValue1= ^^ ^^ ")) - text = "Bar=foo, OnlyEqualsNoValue1=" + text = "Bar=goo, OnlyEqualsNoValue1=" dict = VisualBasicCommandLineParser.ParseConditionalCompilationSymbols(text, errors) Assert.Equal(1, dict.Count) Assert.Equal(1, errors.Count) @@ -88,37 +88,37 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests Assert.Equal(1, errors.Count) errors.Verify(Diagnostic(ERRID.ERR_ConditionalCompilationConstantNotValid).WithArguments("Syntax error in conditional compilation expression.", "bar= ^^ ^^ then")) - text = "FOO:BAR" + text = "GOO:BAR" dict = VisualBasicCommandLineParser.ParseConditionalCompilationSymbols(text, errors) Assert.Equal(2, dict.Count) - Assert.Equal(True, dict("FOO")) - Assert.Equal(GetType(Boolean), (dict("FOO")).GetType) + Assert.Equal(True, dict("GOO")) + Assert.Equal(GetType(Boolean), (dict("GOO")).GetType) Assert.Equal(True, dict("BAR")) Assert.Equal(GetType(Boolean), (dict("BAR")).GetType) - text = "FOO::::::::BAR" + text = "GOO::::::::BAR" dict = VisualBasicCommandLineParser.ParseConditionalCompilationSymbols(text, errors) Assert.Equal(2, dict.Count) - Assert.Equal(True, dict("FOO")) - Assert.Equal(GetType(Boolean), (dict("FOO")).GetType) + Assert.Equal(True, dict("GOO")) + Assert.Equal(GetType(Boolean), (dict("GOO")).GetType) Assert.Equal(True, dict("BAR")) Assert.Equal(GetType(Boolean), (dict("BAR")).GetType) - text = "FOO=23::,,:::BAR" + text = "GOO=23::,,:::BAR" dict = VisualBasicCommandLineParser.ParseConditionalCompilationSymbols(text, errors) Assert.Equal(1, errors.Count) - errors.Verify(Diagnostic(ERRID.ERR_ConditionalCompilationConstantNotValid).WithArguments("Identifier expected.", "FOO=23:: ^^ , ^^ ,:::")) + errors.Verify(Diagnostic(ERRID.ERR_ConditionalCompilationConstantNotValid).WithArguments("Identifier expected.", "GOO=23:: ^^ , ^^ ,:::")) - text = "FOO=23,:BAR" + text = "GOO=23,:BAR" dict = VisualBasicCommandLineParser.ParseConditionalCompilationSymbols(text, errors) Assert.Equal(1, errors.Count) - errors.Verify(Diagnostic(ERRID.ERR_ConditionalCompilationConstantNotValid).WithArguments("Identifier expected.", "FOO=23, ^^ : ^^ BAR")) + errors.Verify(Diagnostic(ERRID.ERR_ConditionalCompilationConstantNotValid).WithArguments("Identifier expected.", "GOO=23, ^^ : ^^ BAR")) - text = "FOO::BAR,,BAZ" + text = "GOO::BAR,,BAZ" dict = VisualBasicCommandLineParser.ParseConditionalCompilationSymbols(text, errors) Assert.Equal(3, dict.Count) - Assert.Equal(True, dict("FOO")) - Assert.Equal(GetType(Boolean), (dict("FOO")).GetType) + Assert.Equal(True, dict("GOO")) + Assert.Equal(GetType(Boolean), (dict("GOO")).GetType) Assert.Equal(True, dict("BAR")) Assert.Equal(GetType(Boolean), (dict("BAR")).GetType) Assert.Equal(True, dict("BAZ")) @@ -141,15 +141,15 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests errors.Verify() Assert.Equal(2.2, dict("bar")) - text = "foo=1,bar=foo+2" + text = "goo=1,bar=goo+2" dict = VisualBasicCommandLineParser.ParseConditionalCompilationSymbols(text, errors) errors.Verify() Assert.Equal(3, dict("bar")) - text = "bar=foo+2,foo=1" + text = "bar=goo+2,goo=1" dict = VisualBasicCommandLineParser.ParseConditionalCompilationSymbols(text, errors) errors.Verify() - Assert.Equal(2, dict("bar")) ' foo is known, but not yet initialized + Assert.Equal(2, dict("bar")) ' goo is known, but not yet initialized ' dev 10 does not crash here, not sure what the value is text = "bar=1/0" diff --git a/src/Compilers/VisualBasic/Test/CommandLine/CommandLineTests.vb b/src/Compilers/VisualBasic/Test/CommandLine/CommandLineTests.vb index 00fea0ca2c0d8..3bf8031c535e1 100644 --- a/src/Compilers/VisualBasic/Test/CommandLine/CommandLineTests.vb +++ b/src/Compilers/VisualBasic/Test/CommandLine/CommandLineTests.vb @@ -547,19 +547,19 @@ a.vb Assert.Equal(DirectCast(ERRID.ERR_UnableToOpenResourceFile1, Integer), errors.First().Code) Assert.Equal(2, errors.First().Arguments.Count()) - args = {"/win32manifest:foo.win32data:bar.win32data2"} + args = {"/win32manifest:goo.win32data:bar.win32data2"} parsedArgs = DefaultParse(args, _baseDirectory) CommonCompiler.GetWin32ResourcesInternal(MessageProvider.Instance, parsedArgs, compilation, errors) Assert.Equal(1, errors.Count()) Assert.Equal(DirectCast(ERRID.ERR_UnableToReadUacManifest2, Integer), errors.First().Code) Assert.Equal(2, errors.First().Arguments.Count()) - args = {"/Win32icon:foo.win32data:bar.win32data2"} + args = {"/Win32icon:goo.win32data:bar.win32data2"} parsedArgs = DefaultParse(args, _baseDirectory) CommonCompiler.GetWin32ResourcesInternal(MessageProvider.Instance, parsedArgs, compilation, errors) Assert.Equal(1, errors.Count()) Assert.Equal(DirectCast(ERRID.ERR_UnableToOpenResourceFile1, Integer), errors.First().Code) Assert.Equal(2, errors.First().Arguments.Count()) - args = {"/Win32Resource:foo.win32data:bar.win32data2"} + args = {"/Win32Resource:goo.win32data:bar.win32data2"} parsedArgs = DefaultParse(args, _baseDirectory) CommonCompiler.GetWin32ResourcesInternal(MessageProvider.Instance, parsedArgs, compilation, errors) Assert.Equal(1, errors.Count()) @@ -747,74 +747,74 @@ End Module").Path Dim diags = New List(Of Diagnostic)() Dim desc As ResourceDescription - desc = VisualBasicCommandLineParser.ParseResourceDescription("resource", "\somepath\someFile.foo.bar", _baseDirectory, diags, embedded:=False) + desc = VisualBasicCommandLineParser.ParseResourceDescription("resource", "\somepath\someFile.goo.bar", _baseDirectory, diags, embedded:=False) diags.Verify() diags.Clear() - Assert.Equal("someFile.foo.bar", desc.FileName) - Assert.Equal("someFile.foo.bar", desc.ResourceName) + Assert.Equal("someFile.goo.bar", desc.FileName) + Assert.Equal("someFile.goo.bar", desc.ResourceName) Assert.True(desc.IsPublic) - desc = VisualBasicCommandLineParser.ParseResourceDescription("resource", "\somepath\someFile.foo.bar,someName", _baseDirectory, diags, embedded:=False) + desc = VisualBasicCommandLineParser.ParseResourceDescription("resource", "\somepath\someFile.goo.bar,someName", _baseDirectory, diags, embedded:=False) diags.Verify() diags.Clear() - Assert.Equal("someFile.foo.bar", desc.FileName) + Assert.Equal("someFile.goo.bar", desc.FileName) Assert.Equal("someName", desc.ResourceName) Assert.True(desc.IsPublic) - desc = VisualBasicCommandLineParser.ParseResourceDescription("resource", "\somepath\someFile.foo.bar,someName,public", _baseDirectory, diags, embedded:=False) + desc = VisualBasicCommandLineParser.ParseResourceDescription("resource", "\somepath\someFile.goo.bar,someName,public", _baseDirectory, diags, embedded:=False) diags.Verify() diags.Clear() - Assert.Equal("someFile.foo.bar", desc.FileName) + Assert.Equal("someFile.goo.bar", desc.FileName) Assert.Equal("someName", desc.ResourceName) Assert.True(desc.IsPublic) ' use file name in place of missing resource name - desc = VisualBasicCommandLineParser.ParseResourceDescription("resource", "\somepath\someFile.foo.bar,,private", _baseDirectory, diags, embedded:=False) + desc = VisualBasicCommandLineParser.ParseResourceDescription("resource", "\somepath\someFile.goo.bar,,private", _baseDirectory, diags, embedded:=False) diags.Verify() diags.Clear() - Assert.Equal("someFile.foo.bar", desc.FileName) - Assert.Equal("someFile.foo.bar", desc.ResourceName) + Assert.Equal("someFile.goo.bar", desc.FileName) + Assert.Equal("someFile.goo.bar", desc.ResourceName) Assert.False(desc.IsPublic) ' quoted accessibility is fine - desc = VisualBasicCommandLineParser.ParseResourceDescription("resource", "\somepath\someFile.foo.bar,,""private""", _baseDirectory, diags, embedded:=False) + desc = VisualBasicCommandLineParser.ParseResourceDescription("resource", "\somepath\someFile.goo.bar,,""private""", _baseDirectory, diags, embedded:=False) diags.Verify() diags.Clear() - Assert.Equal("someFile.foo.bar", desc.FileName) - Assert.Equal("someFile.foo.bar", desc.ResourceName) + Assert.Equal("someFile.goo.bar", desc.FileName) + Assert.Equal("someFile.goo.bar", desc.ResourceName) Assert.False(desc.IsPublic) ' leading commas are ignored... - desc = VisualBasicCommandLineParser.ParseResourceDescription("resource", ",,\somepath\someFile.foo.bar,,private", _baseDirectory, diags, embedded:=False) + desc = VisualBasicCommandLineParser.ParseResourceDescription("resource", ",,\somepath\someFile.goo.bar,,private", _baseDirectory, diags, embedded:=False) diags.Verify() diags.Clear() - Assert.Equal("someFile.foo.bar", desc.FileName) - Assert.Equal("someFile.foo.bar", desc.ResourceName) + Assert.Equal("someFile.goo.bar", desc.FileName) + Assert.Equal("someFile.goo.bar", desc.ResourceName) Assert.False(desc.IsPublic) ' ...as long as there's no whitespace between them - desc = VisualBasicCommandLineParser.ParseResourceDescription("resource", ", ,\somepath\someFile.foo.bar,,private", _baseDirectory, diags, embedded:=False) + desc = VisualBasicCommandLineParser.ParseResourceDescription("resource", ", ,\somepath\someFile.goo.bar,,private", _baseDirectory, diags, embedded:=False) diags.Verify(Diagnostic(ERRID.ERR_InvalidSwitchValue).WithArguments("resource", " ")) diags.Clear() Assert.Null(desc) ' trailing commas are ignored... - desc = VisualBasicCommandLineParser.ParseResourceDescription("resource", "\somepath\someFile.foo.bar,,private", _baseDirectory, diags, embedded:=False) + desc = VisualBasicCommandLineParser.ParseResourceDescription("resource", "\somepath\someFile.goo.bar,,private", _baseDirectory, diags, embedded:=False) diags.Verify() diags.Clear() - Assert.Equal("someFile.foo.bar", desc.FileName) - Assert.Equal("someFile.foo.bar", desc.ResourceName) + Assert.Equal("someFile.goo.bar", desc.FileName) + Assert.Equal("someFile.goo.bar", desc.ResourceName) Assert.False(desc.IsPublic) ' ...even if there's whitespace between them - desc = VisualBasicCommandLineParser.ParseResourceDescription("resource", "\somepath\someFile.foo.bar,,private, ,", _baseDirectory, diags, embedded:=False) + desc = VisualBasicCommandLineParser.ParseResourceDescription("resource", "\somepath\someFile.goo.bar,,private, ,", _baseDirectory, diags, embedded:=False) diags.Verify() diags.Clear() - Assert.Equal("someFile.foo.bar", desc.FileName) - Assert.Equal("someFile.foo.bar", desc.ResourceName) + Assert.Equal("someFile.goo.bar", desc.FileName) + Assert.Equal("someFile.goo.bar", desc.ResourceName) Assert.False(desc.IsPublic) - desc = VisualBasicCommandLineParser.ParseResourceDescription("resource", "\somepath\someFile.foo.bar,someName,publi", _baseDirectory, diags, embedded:=False) + desc = VisualBasicCommandLineParser.ParseResourceDescription("resource", "\somepath\someFile.goo.bar,someName,publi", _baseDirectory, diags, embedded:=False) diags.Verify(Diagnostic(ERRID.ERR_InvalidSwitchValue).WithArguments("resource", "publi")) diags.Clear() Assert.Null(desc) @@ -1849,16 +1849,16 @@ End Module").Path parsedArgs.Errors.Verify() Assert.Equal("[global]", parsedArgs.CompilationOptions.RootNamespace) - parsedArgs = DefaultParse({"/rootnamespace:foo.[global].bar", "a.vb"}, _baseDirectory) + parsedArgs = DefaultParse({"/rootnamespace:goo.[global].bar", "a.vb"}, _baseDirectory) parsedArgs.Errors.Verify() - Assert.Equal("foo.[global].bar", parsedArgs.CompilationOptions.RootNamespace) + Assert.Equal("goo.[global].bar", parsedArgs.CompilationOptions.RootNamespace) - parsedArgs = DefaultParse({"/rootnamespace:foo.[bar]", "a.vb"}, _baseDirectory) + parsedArgs = DefaultParse({"/rootnamespace:goo.[bar]", "a.vb"}, _baseDirectory) parsedArgs.Errors.Verify() - Assert.Equal("foo.[bar]", parsedArgs.CompilationOptions.RootNamespace) + Assert.Equal("goo.[bar]", parsedArgs.CompilationOptions.RootNamespace) - parsedArgs = DefaultParse({"/rootnamespace:foo$", "a.vb"}, _baseDirectory) - parsedArgs.Errors.Verify(Diagnostic(ERRID.ERR_BadNamespaceName1).WithArguments("foo$")) + parsedArgs = DefaultParse({"/rootnamespace:goo$", "a.vb"}, _baseDirectory) + parsedArgs.Errors.Verify(Diagnostic(ERRID.ERR_BadNamespaceName1).WithArguments("goo$")) parsedArgs = DefaultParse({"/rootnamespace:I(", "a.vb"}, _baseDirectory) parsedArgs.Errors.Verify(Diagnostic(ERRID.ERR_BadNamespaceName1).WithArguments("I(")) @@ -2063,25 +2063,25 @@ End Module").Path Public Sub ParseAnalyzers() - Dim parsedArgs = DefaultParse({"/a:foo.dll", "a.vb"}, _baseDirectory) + Dim parsedArgs = DefaultParse({"/a:goo.dll", "a.vb"}, _baseDirectory) parsedArgs.Errors.Verify() Assert.Equal(1, parsedArgs.AnalyzerReferences.Length) - Assert.Equal("foo.dll", parsedArgs.AnalyzerReferences(0).FilePath) + Assert.Equal("goo.dll", parsedArgs.AnalyzerReferences(0).FilePath) - parsedArgs = DefaultParse({"/analyzer:foo.dll", "a.vb"}, _baseDirectory) + parsedArgs = DefaultParse({"/analyzer:goo.dll", "a.vb"}, _baseDirectory) parsedArgs.Errors.Verify() Assert.Equal(1, parsedArgs.AnalyzerReferences.Length) - Assert.Equal("foo.dll", parsedArgs.AnalyzerReferences(0).FilePath) + Assert.Equal("goo.dll", parsedArgs.AnalyzerReferences(0).FilePath) - parsedArgs = DefaultParse({"/analyzer:""foo.dll""", "a.vb"}, _baseDirectory) + parsedArgs = DefaultParse({"/analyzer:""goo.dll""", "a.vb"}, _baseDirectory) parsedArgs.Errors.Verify() Assert.Equal(1, parsedArgs.AnalyzerReferences.Length) - Assert.Equal("foo.dll", parsedArgs.AnalyzerReferences(0).FilePath) + Assert.Equal("goo.dll", parsedArgs.AnalyzerReferences(0).FilePath) - parsedArgs = DefaultParse({"/a:foo.dll,bar.dll", "a.vb"}, _baseDirectory) + parsedArgs = DefaultParse({"/a:goo.dll,bar.dll", "a.vb"}, _baseDirectory) parsedArgs.Errors.Verify() Assert.Equal(2, parsedArgs.AnalyzerReferences.Length) - Assert.Equal("foo.dll", parsedArgs.AnalyzerReferences(0).FilePath) + Assert.Equal("goo.dll", parsedArgs.AnalyzerReferences(0).FilePath) Assert.Equal("bar.dll", parsedArgs.AnalyzerReferences(1).FilePath) parsedArgs = DefaultParse({"/a:", "a.vb"}, _baseDirectory) @@ -2282,7 +2282,7 @@ End Module").Path Public Sub Analyzers_WithRuleSetIncludeAll() - Dim source = "Imports System \r\n Public Class Tester \r\n Public Sub Foo() \r\n Dim x As Integer \r\n End Sub \r\n End Class" + Dim source = "Imports System \r\n Public Class Tester \r\n Public Sub Goo() \r\n Dim x As Integer \r\n End Sub \r\n End Class" Dim dir = Temp.CreateDirectory() @@ -3909,9 +3909,9 @@ End Class Assert.Null(parsedArgs.CompilationOptions.CryptoKeyContainer) ' KEYFILE - parsedArgs = DefaultParse({"/keyfile:\somepath\s""ome Fil""e.foo.bar", "a.cs"}, _baseDirectory) + parsedArgs = DefaultParse({"/keyfile:\somepath\s""ome Fil""e.goo.bar", "a.cs"}, _baseDirectory) parsedArgs.Errors.Verify() - Assert.Equal("\somepath\some File.foo.bar", parsedArgs.CompilationOptions.CryptoKeyFile) + Assert.Equal("\somepath\some File.goo.bar", parsedArgs.CompilationOptions.CryptoKeyFile) parsedArgs = DefaultParse({"/keyFile", "a.cs"}, _baseDirectory) parsedArgs.Errors.Verify(Diagnostic(ERRID.ERR_ArgumentRequired).WithArguments("keyfile", ":")) @@ -4615,9 +4615,9 @@ Class C Public Sub ResourceOnlyCompile() - Dim parsedArgs = DefaultParse({"/resource:foo.vb,ed", "/out:e.dll"}, _baseDirectory) + Dim parsedArgs = DefaultParse({"/resource:goo.vb,ed", "/out:e.dll"}, _baseDirectory) parsedArgs.Errors.Verify() - parsedArgs = DefaultParse({"/resource:foo.vb,ed"}, _baseDirectory) + parsedArgs = DefaultParse({"/resource:goo.vb,ed"}, _baseDirectory) parsedArgs.Errors.Verify(Diagnostic(ERRID.ERR_NoSourcesOut)) End Sub @@ -4776,8 +4776,8 @@ End Class CheckOutputFileName( source1, source2, inputName1:="p.cs", inputName2:="q.cs", - commandLineArguments:={"/target:library", "/out:foo"}, - expectedOutputName:="foo.dll") + commandLineArguments:={"/target:library", "/out:goo"}, + expectedOutputName:="goo.dll") End Sub @@ -4799,8 +4799,8 @@ End Class CheckOutputFileName( source1, source2, inputName1:="p.cs", inputName2:="q.cs", - commandLineArguments:={"/target:library", "/out:foo. "}, - expectedOutputName:="foo.dll") + commandLineArguments:={"/target:library", "/out:goo. "}, + expectedOutputName:="goo.dll") End Sub @@ -4822,8 +4822,8 @@ End Class CheckOutputFileName( source1, source2, inputName1:="p.cs", inputName2:="q.cs", - commandLineArguments:={"/target:library", "/out:foo.a"}, - expectedOutputName:="foo.a.dll") + commandLineArguments:={"/target:library", "/out:goo.a"}, + expectedOutputName:="goo.a.dll") End Sub @@ -4845,8 +4845,8 @@ End Class CheckOutputFileName( source1, source2, inputName1:="p.cs", inputName2:="q.cs", - commandLineArguments:={"/target:module", "/out:foo.a"}, - expectedOutputName:="foo.a") + commandLineArguments:={"/target:module", "/out:goo.a"}, + expectedOutputName:="goo.a") End Sub @@ -4868,8 +4868,8 @@ End Class CheckOutputFileName( source1, source2, inputName1:="p.cs", inputName2:="q.cs", - commandLineArguments:={"/target:module", "/out:foo.a . . . . "}, - expectedOutputName:="foo.a") + commandLineArguments:={"/target:module", "/out:goo.a . . . . "}, + expectedOutputName:="goo.a") End Sub @@ -4891,8 +4891,8 @@ End Class CheckOutputFileName( source1, source2, inputName1:="p.cs", inputName2:="q.cs", - commandLineArguments:={"/target:module", "/out:foo. . . . . "}, - expectedOutputName:="foo.netmodule") + commandLineArguments:={"/target:module", "/out:goo. . . . . "}, + expectedOutputName:="goo.netmodule") End Sub @@ -5108,7 +5108,7 @@ Module Program Const zzz As Long = 0 End Sub - Function foo() + Function goo() End Function End Module @@ -5130,7 +5130,7 @@ PATH(7) : warning BC42099: Unused local constant: 'zzz'. Const zzz As Long = 0 ~~~ -PATH(11) : warning BC42105: Function 'foo' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used. +PATH(11) : warning BC42105: Function 'goo' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used. End Function ~~~~~~~~~~~~ @@ -5167,11 +5167,11 @@ Module Module1 Sub main() Dim a As ArgIterator = Nothing - Dim d As delegateType = AddressOf a.Foo + Dim d As delegateType = AddressOf a.Goo End Sub _ - Public Function Foo(ByVal x As ArgIterator) as Integer + Public Function Goo(ByVal x As ArgIterator) as Integer Return 1 End Function End Module @@ -5185,7 +5185,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. PATH(9) : error BC36640: Instance of restricted type 'ArgIterator' cannot be used in a lambda expression. - Dim d As delegateType = AddressOf a.Foo + Dim d As delegateType = AddressOf a.Goo ~ @@ -6743,40 +6743,40 @@ src.vb(14) : error BC36716: Visual Basic 9.0 does not support implicit line cont Dim source = " Class C Sub Main() - Foo(0) + Goo(0) #ExternalSource(""c:\temp\a\1.vb"", 10) - Foo(1) + Goo(1) #End ExternalSource #ExternalSource(""C:\a\..\b.vb"", 20) - Foo(2) + Goo(2) #End ExternalSource #ExternalSource(""C:\a\../B.vb"", 30) - Foo(3) + Goo(3) #End ExternalSource #ExternalSource(""../b.vb"", 40) - Foo(4) + Goo(4) #End ExternalSource #ExternalSource(""..\b.vb"", 50) - Foo(5) + Goo(5) #End ExternalSource #ExternalSource(""C:\X.vb"", 60) - Foo(6) + Goo(6) #End ExternalSource #ExternalSource(""C:\x.vb"", 70) - Foo(7) + Goo(7) #End ExternalSource #ExternalSource("" "", 90) - Foo(9) + Goo(9) #End ExternalSource #ExternalSource(""C:\*.vb"", 100) - Foo(10) + Goo(10) #End ExternalSource #ExternalSource("""", 110) - Foo(11) + Goo(11) #End ExternalSource - Foo(12) + Goo(12) #ExternalSource(""***"", 140) - Foo(14) + Goo(14) #End ExternalSource End Sub End Class @@ -6791,44 +6791,44 @@ End Class ' with /fullpaths off Dim expected = - file.Path & "(4) : error BC30451: 'Foo' is not declared. It may be inaccessible due to its protection level. - Foo(0) + file.Path & "(4) : error BC30451: 'Goo' is not declared. It may be inaccessible due to its protection level. + Goo(0) ~~~ -c:\temp\a\1.vb(10) : error BC30451: 'Foo' is not declared. It may be inaccessible due to its protection level. - Foo(1) +c:\temp\a\1.vb(10) : error BC30451: 'Goo' is not declared. It may be inaccessible due to its protection level. + Goo(1) ~~~ -C:\b.vb(20) : error BC30451: 'Foo' is not declared. It may be inaccessible due to its protection level. - Foo(2) +C:\b.vb(20) : error BC30451: 'Goo' is not declared. It may be inaccessible due to its protection level. + Goo(2) ~~~ -C:\B.vb(30) : error BC30451: 'Foo' is not declared. It may be inaccessible due to its protection level. - Foo(3) +C:\B.vb(30) : error BC30451: 'Goo' is not declared. It may be inaccessible due to its protection level. + Goo(3) ~~~ -" & Path.GetFullPath(Path.Combine(dir.Path, "..\b.vb")) & "(40) : error BC30451: 'Foo' is not declared. It may be inaccessible due to its protection level. - Foo(4) +" & Path.GetFullPath(Path.Combine(dir.Path, "..\b.vb")) & "(40) : error BC30451: 'Goo' is not declared. It may be inaccessible due to its protection level. + Goo(4) ~~~ -" & Path.GetFullPath(Path.Combine(dir.Path, "..\b.vb")) & "(50) : error BC30451: 'Foo' is not declared. It may be inaccessible due to its protection level. - Foo(5) +" & Path.GetFullPath(Path.Combine(dir.Path, "..\b.vb")) & "(50) : error BC30451: 'Goo' is not declared. It may be inaccessible due to its protection level. + Goo(5) ~~~ -C:\X.vb(60) : error BC30451: 'Foo' is not declared. It may be inaccessible due to its protection level. - Foo(6) +C:\X.vb(60) : error BC30451: 'Goo' is not declared. It may be inaccessible due to its protection level. + Goo(6) ~~~ -C:\x.vb(70) : error BC30451: 'Foo' is not declared. It may be inaccessible due to its protection level. - Foo(7) +C:\x.vb(70) : error BC30451: 'Goo' is not declared. It may be inaccessible due to its protection level. + Goo(7) ~~~ - (90) : error BC30451: 'Foo' is not declared. It may be inaccessible due to its protection level. - Foo(9) + (90) : error BC30451: 'Goo' is not declared. It may be inaccessible due to its protection level. + Goo(9) ~~~ -C:\*.vb(100) : error BC30451: 'Foo' is not declared. It may be inaccessible due to its protection level. - Foo(10) +C:\*.vb(100) : error BC30451: 'Goo' is not declared. It may be inaccessible due to its protection level. + Goo(10) ~~~ -(110) : error BC30451: 'Foo' is not declared. It may be inaccessible due to its protection level. - Foo(11) +(110) : error BC30451: 'Goo' is not declared. It may be inaccessible due to its protection level. + Goo(11) ~~~ -" & file.Path & "(35) : error BC30451: 'Foo' is not declared. It may be inaccessible due to its protection level. - Foo(12) +" & file.Path & "(35) : error BC30451: 'Goo' is not declared. It may be inaccessible due to its protection level. + Goo(12) ~~~ -***(140) : error BC30451: 'Foo' is not declared. It may be inaccessible due to its protection level. - Foo(14) +***(140) : error BC30451: 'Goo' is not declared. It may be inaccessible due to its protection level. + Goo(14) ~~~ " AssertOutput(expected.Replace(vbCrLf, vbLf), outWriter.ToString()) @@ -8444,24 +8444,24 @@ a - 'Output with known but different extension - 'Output with known but different extension (different casing) - 'Output with known but different extension - 'Output with known but different extension (different casing) - 'Output with known but different extension - 'Output with known but different extension - 'Output with known but different extension - 'Output with unknown extension (.txt) - 'Output with unknown extension (.md) - 'Output without extension - 'Output without extension - 'Output without extension - 'Output without extension - 'Output with correct extension (.exe) - 'Output with correct extension (.dll) - 'Output with correct extension (.netmodule) - 'Output with correct extension (.netmodule) (different casing) - 'Output with correct extension (.winmdobj) + 'Output with known but different extension + 'Output with known but different extension (different casing) + 'Output with known but different extension + 'Output with known but different extension (different casing) + 'Output with known but different extension + 'Output with known but different extension + 'Output with known but different extension + 'Output with unknown extension (.txt) + 'Output with unknown extension (.md) + 'Output without extension + 'Output without extension + 'Output without extension + 'Output without extension + 'Output with correct extension (.exe) + 'Output with correct extension (.dll) + 'Output with correct extension (.netmodule) + 'Output with correct extension (.netmodule) (different casing) + 'Output with correct extension (.winmdobj) Public Sub OutputingFilesWithDifferentExtensions(targetArg As String, outArg As String, expectedFile As String, unexpectedFile As String) Dim source = diff --git a/src/Compilers/VisualBasic/Test/Emit/Attributes/AssemblyAttributes.vb b/src/Compilers/VisualBasic/Test/Emit/Attributes/AssemblyAttributes.vb index 680358b9b1247..ada9414522081 100644 --- a/src/Compilers/VisualBasic/Test/Emit/Attributes/AssemblyAttributes.vb +++ b/src/Compilers/VisualBasic/Test/Emit/Attributes/AssemblyAttributes.vb @@ -25,7 +25,7 @@ Public Class AssemblyAttributeTests Public Class C - Friend Sub Foo() + Friend Sub Goo() End Sub End Class ]]> @@ -124,7 +124,7 @@ End Class Public Class C - Friend Sub Foo() + Friend Sub Goo() End Sub End Class ]]> @@ -192,7 +192,7 @@ BC36976: The specified version string does not conform to the recommended format Public Class C - Friend Sub Foo() + Friend Sub Goo() End Sub End Class ]]> @@ -209,7 +209,7 @@ End Class Public Class C - Friend Sub Foo() + Friend Sub Goo() End Sub End Class ]]> @@ -226,7 +226,7 @@ End Class Public Class C - Friend Sub Foo() + Friend Sub Goo() End Sub End Class ]]> @@ -243,7 +243,7 @@ End Class Public Class C - Friend Sub Foo() + Friend Sub Goo() End Sub End Class ]]> @@ -264,7 +264,7 @@ BC42366: The specified version string does not conform to the recommended format Public Class C - Friend Sub Foo() + Friend Sub Goo() End Sub End Class ]]> @@ -285,7 +285,7 @@ BC42366: The specified version string does not conform to the recommended format Public Class C - Friend Sub Foo() + Friend Sub Goo() End Sub End Class ]]> @@ -303,7 +303,7 @@ End Class Public Class C - Friend Sub Foo() + Friend Sub Goo() End Sub End Class ]]> @@ -320,7 +320,7 @@ End Class Public Class C - Friend Sub Foo() + Friend Sub Goo() End Sub End Class ]]> @@ -656,7 +656,7 @@ BC42371: Referenced assembly 'en_UK, Version=0.0.0.0, Culture=en-UK, PublicKeyTo Public Class C - Friend Sub Foo() + Friend Sub Goo() End Sub End Class ]]> @@ -682,7 +682,7 @@ End Class Public Class C - Friend Sub Foo() + Friend Sub Goo() End Sub End Class ]]> @@ -714,7 +714,7 @@ End Structure -Interface IFoo +Interface IGoo End Interface ]]> @@ -731,7 +731,7 @@ End Interface Public Class C - Friend Sub Foo() + Friend Sub Goo() End Sub End Class ]]> diff --git a/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests.vb b/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests.vb index f392c0c3a65d1..2b876898c5822 100644 --- a/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests.vb @@ -292,8 +292,8 @@ Imports System.Runtime.CompilerServices Dim compilation = CreateCompilationWithMscorlib( - Class Foo + + Class Goo Friend Const p As Object = 2 + 2 End Class Friend Class AttrAttribute @@ -303,7 +303,7 @@ Imports System.Runtime.CompilerServices ) - Dim attrs = compilation.SourceModule.GlobalNamespace.GetMember("Foo").GetAttributes() + Dim attrs = compilation.SourceModule.GlobalNamespace.GetMember("Goo").GetAttributes() Assert.Equal(1, attrs.Length) attrs(0).VerifyValue(0, TypedConstantKind.Primitive, 4) End Sub @@ -684,7 +684,7 @@ Imports AN = CustomAttribute.AttrName Namespace AttributeTest - Public Interface IFoo + Public Interface IGoo Class NestedClass ' enum as object @@ -734,7 +734,7 @@ End Namespace End If Dim ns = DirectCast(m.GlobalNamespace.GetMember("AttributeTest"), NamespaceSymbol) - Dim top = DirectCast(ns.GetMember("IFoo"), NamedTypeSymbol) + Dim top = DirectCast(ns.GetMember("IGoo"), NamedTypeSymbol) Dim type = top.GetMember(Of NamedTypeSymbol)("NestedClass") Dim field = type.GetMember(Of FieldSymbol)("Field") @@ -780,7 +780,7 @@ Imports CustomAttribute Namespace AttributeTest - Public Interface IFoo + Public Interface IGoo Delegate Sub NestedSubDele( p As String) @@ -797,7 +797,7 @@ End Namespace Dim attributeValidator = Sub(m As ModuleSymbol) Dim ns = DirectCast(m.GlobalNamespace.GetMember("AttributeTest"), NamespaceSymbol) - Dim type = DirectCast(ns.GetMember("IFoo"), NamedTypeSymbol) + Dim type = DirectCast(ns.GetMember("IGoo"), NamedTypeSymbol) Dim dele = DirectCast(type.GetTypeMember("NestedSubDele"), NamedTypeSymbol) Dim attrs = dele.GetAttributes() @@ -833,7 +833,7 @@ Imports System Namespace AttributeTest - Public Interface IFoo + Public Interface IGoo Function F(p As Integer) As Integer @@ -850,7 +850,7 @@ End Namespace Dim attributeValidator = Sub(m As ModuleSymbol) Dim ns = DirectCast(m.GlobalNamespace.GetMember("AttributeTest"), NamespaceSymbol) - Dim type = DirectCast(ns.GetMember("IFoo"), NamedTypeSymbol) + Dim type = DirectCast(ns.GetMember("IGoo"), NamedTypeSymbol) Dim attrs = type.GetMember(Of MethodSymbol)("F").GetAttributes() Assert.Equal("CustomAttribute.DerivedAttribute", attrs(0).AttributeClass.ToDisplayString) @@ -874,7 +874,7 @@ Imports CustomAttribute Namespace AttributeTest - Public Interface IFoo + Public Interface IGoo End Interface End Namespace ]]> @@ -887,7 +887,7 @@ End Namespace Dim sourceAttributeValidator = Sub(m As ModuleSymbol) Dim ns = DirectCast(m.GlobalNamespace.GetMember("AttributeTest"), NamespaceSymbol) - Dim type = DirectCast(ns.GetMember("IFoo"), NamedTypeSymbol) + Dim type = DirectCast(ns.GetMember("IGoo"), NamedTypeSymbol) Dim attrs = type.GetAttributes() attrs(0).VerifyValue(Of Char())(0, TypedConstantKind.Array, New Char() {" "c, Nothing}) attrs(0).VerifyValue(Of String())(1, TypedConstantKind.Array, New String() {""}) @@ -898,7 +898,7 @@ End Namespace Dim mdAttributeValidator = Sub(m As ModuleSymbol) Dim ns = DirectCast(m.GlobalNamespace.GetMember("AttributeTest"), NamespaceSymbol) - Dim type = DirectCast(ns.GetMember("IFoo"), NamedTypeSymbol) + Dim type = DirectCast(ns.GetMember("IGoo"), NamedTypeSymbol) Dim attrs = type.GetAttributes() attrs(0).VerifyValue(Of Char())(0, TypedConstantKind.Array, New Char() {" "c, Nothing}) attrs(0).VerifyValue(Of String())(1, TypedConstantKind.Array, New String() {""}) @@ -927,7 +927,7 @@ Namespace AttributeTest End Sub End Class - Public Interface IFoo + Public Interface IGoo Function F1(i as integer) as string Property P1 as string @@ -957,13 +957,13 @@ End Namespace Dim attributeValidator = Sub(m As ModuleSymbol) Dim ns = DirectCast(m.GlobalNamespace.GetMember("AttributeTest"), NamespaceSymbol) - Dim iFoo = DirectCast(ns.GetMember("IFoo"), NamedTypeSymbol) + Dim iGoo = DirectCast(ns.GetMember("IGoo"), NamedTypeSymbol) - Dim f1 = DirectCast(iFoo.GetMember("F1"), MethodSymbol) + Dim f1 = DirectCast(iGoo.GetMember("F1"), MethodSymbol) Dim attrs = f1.GetReturnTypeAttributes() attrs(0).VerifyValue(Of Object)(0, TypedConstantKind.Primitive, "f1 return type") - Dim p1 = DirectCast(iFoo.GetMember("P1"), PropertySymbol) + Dim p1 = DirectCast(iGoo.GetMember("P1"), PropertySymbol) attrs = p1.GetMethod.GetReturnTypeAttributes() attrs(0).VerifyValue(Of Object)(0, TypedConstantKind.Primitive, "p1 return type") @@ -1067,7 +1067,7 @@ End Class Class scen1 End Class Module M1 - Sub foo() + Sub goo() _ Static x1 As Object End Sub @@ -1832,7 +1832,7 @@ End Class Dim ref1 = MetadataReference.CreateFromImage(metadata1) Dim metadata2 = VisualBasicCompilation.Create( - "foo.dll", + "goo.dll", references:={MscorlibRef, ref1}, syntaxTrees:={ VisualBasicSyntaxTree.ParseText( - Public Class Foo + Public Class Goo End Class]]>.Value)}).EmitToArray(options:=New EmitOptions(metadataOnly:=True)) Dim ref2 = MetadataReference.CreateFromImage(metadata2) Dim comp = VisualBasicCompilation.Create("moo.dll", references:={MscorlibRef, ref1, ref2}) - Dim foo = comp.GetTypeByMetadataName("Foo") - Dim ca = foo.GetAttributes().First().CommonConstructorArguments.First() + Dim goo = comp.GetTypeByMetadataName("Goo") + Dim ca = goo.GetAttributes().First().CommonConstructorArguments.First() Assert.Equal("Bar", ca.Type.Name) End Sub @@ -2047,7 +2047,7 @@ Class c1 end class - Sub Foo() + Sub Goo() End Sub End Class"]]>.Value) Dim expr = tree.GetRoot().DescendantNodes().OfType(Of BinaryExpressionSyntax).First() @@ -2369,14 +2369,14 @@ Class A End Sub End Class - + Class B Inherits Attribute Protected Sub New() End Sub End Class - + Class C Inherits Attribute Protected Sub New() @@ -2407,10 +2407,10 @@ BC30517: Overload resolution failed because no 'New' is accessible. ~~~ BC30517: Overload resolution failed because no 'New' is accessible. - + ~~~~~~~~ BC30517: Overload resolution failed because no 'New' is accessible. - + ~~~~~~~~ BC30517: Overload resolution failed because no 'New' is accessible. @@ -2439,7 +2439,7 @@ Module AttributeMod - Public Class Foo + Public Class Goo End Class @@ -2457,7 +2457,7 @@ End Module BC30663: Attribute 'BaseAttribute' cannot be applied multiple times. ~~~~~~~~~~~ -BC30662: Attribute 'DerivedAttribute' cannot be applied to 'Foo' because the attribute is not valid on this declaration type. +BC30662: Attribute 'DerivedAttribute' cannot be applied to 'Goo' because the attribute is not valid on this declaration type. ~~~~~~~ BC30663: Attribute 'DerivedAttribute' cannot be applied multiple times. @@ -2484,7 +2484,7 @@ Imports System ' C1 should not be visible without qualification - Public Class CFoo + Public Class CGoo Public Const C1 as Boolean = true @@ -2494,7 +2494,7 @@ Imports System ' C1 should not be visible without qualification - Public Structure SFoo + Public Structure SGoo Public Const C1 as Boolean = true @@ -2504,14 +2504,14 @@ Imports System ' s should not be visible without qualification - Public Interface IFoo + Public Interface IGoo Sub s() End Interface ' C1 should not be visible without qualification - Public Enum EFoo + Public Enum EGoo A = 1 End Enum @@ -2570,7 +2570,7 @@ End Class + Module Program Sub Main(args As String()) @@ -2582,11 +2582,11 @@ End Module Dim expectedErrors = +BC30002: Type 'goo' is not defined. + ~~~ BC30059: Constant expression is required. - + ~~~~~~~~~~~~~~~ ]]> @@ -2693,11 +2693,11 @@ End Class Partial Class C - Private Partial Sub Foo() + Private Partial Sub Goo() End Sub - Private Sub Foo() + Private Sub Goo() End Sub End Class ]]> @@ -2707,9 +2707,9 @@ End Class CompileAndVerify(compilation, sourceSymbolValidator:= Sub(moduleSymbol) Dim c = DirectCast(moduleSymbol.GlobalNamespace.GetMembers("C").Single(), NamedTypeSymbol) - Dim foo = DirectCast(c.GetMembers("Foo").Single(), MethodSymbol) + Dim goo = DirectCast(c.GetMembers("Goo").Single(), MethodSymbol) - Dim attrs = foo.GetAttributes() + Dim attrs = goo.GetAttributes() Assert.Equal(2, attrs.Length) Assert.Equal("A", attrs(0).AttributeClass.Name) Assert.Equal("B", attrs(1).AttributeClass.Name) @@ -2763,7 +2763,7 @@ Imports System Module M - Sub Foo(Of T) + Sub Goo(Of T) End Sub Class T : Inherits Attribute @@ -3744,7 +3744,7 @@ End Structure { } -.class public abstract auto ansi sealed Library1.Foo +.class public abstract auto ansi sealed Library1.Goo extends [mscorlib]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) @@ -3757,9 +3757,9 @@ End Structure IL_0002: ldc.i4.1 IL_0003: add IL_0004: ret - } // end of method Foo::inc + } // end of method Goo::inc -} // end of class Library1.Foo +} // end of class Library1.Goo ]]> @@ -3769,7 +3769,7 @@ End Structure , customIL.Value, appendDefaultHeader:=False) - Dim type = compilation.GetTypeByMetadataName("Library1.Foo") + Dim type = compilation.GetTypeByMetadataName("Library1.Goo") Assert.Equal(0, type.GetAttributes()(0).ConstructorArguments.Count) End Sub diff --git a/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests_Conditional.vb b/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests_Conditional.vb index 53bab71788b1d..cbdacd489730d 100644 --- a/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests_Conditional.vb +++ b/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests_Conditional.vb @@ -754,7 +754,7 @@ End Module Imports System Class TestClass - WriteOnly Property foo() As String + WriteOnly Property goo() As String <Diagnostics.Conditional("N")> Set(ByVal Value As String) Console.WriteLine("Property Called") @@ -765,7 +765,7 @@ End Class Module M1 Sub Main() Dim t As New TestClass() - t.foo = "abds" + t.goo = "abds" End Sub End Module diff --git a/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests_ObsoleteAttribute.vb b/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests_ObsoleteAttribute.vb index d28aecede4127..f0749a9de94a0 100644 --- a/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests_ObsoleteAttribute.vb +++ b/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests_ObsoleteAttribute.vb @@ -84,28 +84,28 @@ End Class Public Delegate Function Mydeleg(x As Integer) As Integer - + -Class FooAttribute +Class GooAttribute Inherits Attribute Class BazAttribute Inherits Attribute End Class Class BarAttribute - Inherits FooAttribute + Inherits GooAttribute End Class End Class -Interface IFoo(Of T) +Interface IGoo(Of T) End Interface Class SelfReferenceInBase - Implements IFoo(Of SelfReferenceInBase) + Implements IGoo(Of SelfReferenceInBase) End Class Class SelfReferenceInBase1 - Implements IFoo(Of SelfReferenceInBase) + Implements IGoo(Of SelfReferenceInBase) End Class ]]> @@ -472,13 +472,13 @@ End Class Module Mod1 Dim someField As SomeType = SomeType.Instance Public Property someProp As SomeType - Sub foo(x As SomeType) + Sub goo(x As SomeType) End Sub End Module @@ -630,7 +630,7 @@ Public Class Test Event someEvent As Action(Of SomeType) - Function foo(x As SomeType) As SomeType + Function goo(x As SomeType) As SomeType Dim y As SomeType = New SomeType() Return x End Function @@ -681,7 +681,7 @@ Public Class Test End Property - Custom Event foo As MyDeleg + Custom Event goo As MyDeleg AddHandler(value As MyDeleg) End AddHandler @@ -846,17 +846,17 @@ BC31142: 'Windows.Foundation.Metadata.DeprecatedAttribute' cannot be applied to Dim source = -Class Foo + +Class Goo Inherits Base End Class - + class Base Inherits System.Attribute Public Class Nested - Inherits Foo + Inherits Goo End Class End Class ]]> @@ -874,7 +874,7 @@ Imports System Public Class SomeType Public Shared Instance As SomeType - Public Const Message As String = "foo" + Public Const Message As String = "goo" End Class Public Class SomeAttr @@ -909,7 +909,7 @@ Imports System public Class C - public sub Foo() + public sub Goo() end sub end class ]]> @@ -923,7 +923,7 @@ end class @@ -932,7 +932,7 @@ End Class CreateCompilationWithMscorlibAndReferences(s, {New VisualBasicCompilationReference(other)}).VerifyDiagnostics( Diagnostic(ERRID.WRN_UseOfObsoleteSymbolNoMessage1, "C").WithArguments("C"), - Diagnostic(ERRID.WRN_UseOfObsoleteSymbolNoMessage1, "o.Foo()").WithArguments("Public Sub Foo()")) + Diagnostic(ERRID.WRN_UseOfObsoleteSymbolNoMessage1, "o.Goo()").WithArguments("Public Sub Goo()")) End Sub @@ -964,7 +964,7 @@ Class C1 Sub handler2() Handles p1.XEvent End Sub - Custom Event foo As MyDeleg + Custom Event goo As MyDeleg AddHandler(value As MyDeleg) End AddHandler @@ -985,7 +985,7 @@ Class C2 Sub bar(s As String) End Sub - Sub foo() + Sub goo() Dim s As New C1 s.p += "as" bar(s.p) @@ -1390,7 +1390,7 @@ namespace Windows.Foundation.Metadata public class Test { [Deprecated("hello", DeprecationType.Deprecate, 1, typeof(int))] - public static void Foo() + public static void Goo() { } @@ -1412,7 +1412,7 @@ public class Test - sub Foo() + sub Goo() end sub @@ -1448,7 +1448,7 @@ BC40000: 'Public Shared Overloads Sub Bar()' is obsolete: 'hi'. End sub Sub Main() - Foo() + Goo() Bar() end Sub end module @@ -1459,8 +1459,8 @@ BC40000: 'Public Shared Overloads Sub Bar()' is obsolete: 'hi'. Dim compilation3 = CreateCompilationWithMscorlibAndVBRuntimeAndReferences(source3, {ref}) Dim expected2 = - Sub Foo() +Public Interface IGoo1 + + Sub Goo() End Interface -Public NotInheritable Class ConcreteFoo1 - Implements IFoo1 - Public Sub Foo() Implements IFoo1.Foo +Public NotInheritable Class ConcreteGoo1 + Implements IGoo1 + Public Sub Goo() Implements IGoo1.Goo End Sub End Class -Public Interface IFoo2 - Sub Foo() +Public Interface IGoo2 + Sub Goo() End Interface -Public NotInheritable Class ConcreteFoo2 - Implements IFoo2 +Public NotInheritable Class ConcreteGoo2 + Implements IGoo2 - - Public Sub Foo() Implements IFoo2.Foo + + Public Sub Goo() Implements IGoo2.Goo End Sub End Class -Public Interface IFoo3 - - Sub Foo() +Public Interface IGoo3 + + Sub Goo() End Interface -Public NotInheritable Class ConcreteFoo3 - Implements IFoo3 +Public NotInheritable Class ConcreteGoo3 + Implements IGoo3 - - Public Sub Foo() Implements IFoo3.Foo + + Public Sub Goo() Implements IGoo3.Goo End Sub End Class @@ -1542,20 +1542,20 @@ End Class Dim compilation1 = CreateCompilationWithReferences(source1, WinRtRefs) Dim expected = compilation1.AssertTheseDiagnostics(expected) @@ -1594,7 +1594,7 @@ Imports System Class Test Public Sub F(i As IExceptionalInterface) - i.ExceptionalProp = "foo" + i.ExceptionalProp = "goo" Console.WriteLine(i.ExceptionalProp) End Sub End Class]]> @@ -1605,7 +1605,7 @@ End Class]]> Dim expected = Class C - Sub Foo() + Sub Goo() Dim x = New With { .X = 1, .Y = 2 } End Sub End Class @@ -417,7 +417,7 @@ End Class Public Class C - Public Sub Foo() + Public Sub Goo() Dim _1 = New With {.X0 = 1} Dim _2 = New With {.X0 = 1, .X1 = 1} Dim _3 = New With {.X0 = 1, .X1 = 1, .X2 = 1} diff --git a/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests_WellKnownAttributes.vb b/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests_WellKnownAttributes.vb index 8dea13d36ccef..3ebab4fa577bf 100644 --- a/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests_WellKnownAttributes.vb +++ b/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests_WellKnownAttributes.vb @@ -31,7 +31,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.Semantics - Public Interface IFoo + Public Interface IGoo Sub DoSomething() @@ -78,39 +78,39 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.Semantics Dim tLTypeSym = DirectCast(interopNS.GetTypeMember("TypeLibTypeAttribute"), NamedTypeSymbol) Dim bfmSym = DirectCast(interopNS.GetTypeMember("BestFitMappingAttribute"), NamedTypeSymbol) - ' IFoo - Dim ifoo = DirectCast(m.GlobalNamespace.GetTypeMember("IFoo"), NamedTypeSymbol) + ' IGoo + Dim igoo = DirectCast(m.GlobalNamespace.GetTypeMember("IGoo"), NamedTypeSymbol) - Assert.True(ifoo.IsComImport) + Assert.True(igoo.IsComImport) ' ComImportAttribute is a pseudo-custom attribute, which is not emitted. If Not isFromSource Then - Assert.Equal(5, ifoo.GetAttributes().Length) + Assert.Equal(5, igoo.GetAttributes().Length) Else - Assert.Equal(6, ifoo.GetAttributes().Length) + Assert.Equal(6, igoo.GetAttributes().Length) ' get attr by NamedTypeSymbol - attrSym = ifoo.GetAttribute(ciSym) + attrSym = igoo.GetAttribute(ciSym) Assert.Equal("ComImportAttribute", attrSym.AttributeClass.Name) Assert.Equal(0, attrSym.CommonConstructorArguments.Length) Assert.Equal(0, attrSym.CommonNamedArguments.Length) End If - attrSym = ifoo.GetAttribute(guidSym) + attrSym = igoo.GetAttribute(guidSym) Assert.Equal("String", attrSym.CommonConstructorArguments(0).Type.ToDisplayString) Assert.Equal("ABCDEF5D-2448-447A-B786-64682CBEF123", attrSym.CommonConstructorArguments(0).Value) ' get attr by ctor - attrSym = ifoo.GetAttribute(itCtor) + attrSym = igoo.GetAttribute(itCtor) Assert.Equal("System.Runtime.InteropServices.ComInterfaceType", attrSym.CommonConstructorArguments(0).Type.ToDisplayString()) Assert.Equal(ComInterfaceType.InterfaceIsIUnknown, CType(attrSym.CommonConstructorArguments(0).Value, ComInterfaceType)) - attrSym = ifoo.GetAttribute(tLibSym) + attrSym = igoo.GetAttribute(tLibSym) Assert.Equal("Object", CType(attrSym.CommonConstructorArguments(0).Value, Symbol).ToDisplayString()) - attrSym = ifoo.GetAttribute(tLTypeSym) + attrSym = igoo.GetAttribute(tLTypeSym) Assert.Equal(TypeLibTypeFlags.FAggregatable, CType(attrSym.CommonConstructorArguments(0).Value, TypeLibTypeFlags)) - attrSym = ifoo.GetAttribute(bfmSym) + attrSym = igoo.GetAttribute(bfmSym) Assert.Equal(False, attrSym.CommonConstructorArguments(0).Value) Assert.Equal(1, attrSym.CommonNamedArguments.Length) Assert.Equal("Boolean", attrSym.CommonNamedArguments(0).Value.Type.ToDisplayString) @@ -118,21 +118,21 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.Semantics Assert.Equal(True, attrSym.CommonNamedArguments(0).Value.Value) ' ============================= - Dim mem = DirectCast(ifoo.GetMembers("DoSomething").First(), MethodSymbol) + Dim mem = DirectCast(igoo.GetMembers("DoSomething").First(), MethodSymbol) Assert.Equal(1, mem.GetAttributes().Length) attrSym = mem.GetAttributes().First() Assert.Equal("AllowReversePInvokeCallsAttribute", attrSym.AttributeClass.Name) Assert.Equal(0, attrSym.CommonConstructorArguments.Length) - mem = DirectCast(ifoo.GetMembers("Register").First(), MethodSymbol) + mem = DirectCast(igoo.GetMembers("Register").First(), MethodSymbol) attrSym = mem.GetAttributes().First() Assert.Equal("ComRegisterFunctionAttribute", attrSym.AttributeClass.Name) Assert.Equal(0, attrSym.CommonConstructorArguments.Length) - mem = DirectCast(ifoo.GetMembers("UnRegister").First(), MethodSymbol) + mem = DirectCast(igoo.GetMembers("UnRegister").First(), MethodSymbol) Assert.Equal(1, mem.GetAttributes().Length) - mem = DirectCast(ifoo.GetMembers("LibFunc").First(), MethodSymbol) + mem = DirectCast(igoo.GetMembers("LibFunc").First(), MethodSymbol) attrSym = mem.GetAttributes().First() Assert.Equal(1, attrSym.CommonConstructorArguments.Length) Assert.Equal(TypeLibFuncFlags.FDefaultBind, CType(attrSym.CommonConstructorArguments(0).Value, TypeLibFuncFlags)) ' 32 @@ -156,18 +156,18 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.Semantics - Public Delegate Sub DFoo(p1 As Char, p2 As SByte) + Public Delegate Sub DGoo(p1 As Char, p2 As SByte) - Public Class CFoo + Public Class CGoo Sub Method(p1 As SByte, p2 As String) End Sub End Class - - Public Enum EFoo + + Public Enum EGoo One Two @@ -201,8 +201,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.Semantics Dim moduleGlobalNS = m.GlobalNamespace - ' delegate DFoo - Dim type1 = DirectCast(moduleGlobalNS.GetTypeMember("DFoo"), NamedTypeSymbol) + ' delegate DGoo + Dim type1 = DirectCast(moduleGlobalNS.GetTypeMember("DGoo"), NamedTypeSymbol) Assert.Equal(2, type1.GetAttributes().Length) Dim attrSym = type1.GetAttribute(comvSym) @@ -222,8 +222,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.Semantics Assert.Equal("ThrowOnUnmappableChar", attrSym.CommonNamedArguments(3).Key) Assert.Equal(True, attrSym.CommonNamedArguments(3).Value.Value) - ' class CFoo - Dim type2 = DirectCast(moduleGlobalNS.GetTypeMember("CFoo"), NamedTypeSymbol) + ' class CGoo + Dim type2 = DirectCast(moduleGlobalNS.GetTypeMember("CGoo"), NamedTypeSymbol) Assert.Equal(2, type2.GetAttributes().Length) attrSym = type2.GetAttribute(comdSym) @@ -241,10 +241,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.Semantics attrSym = method.GetAttribute(comcSym) Assert.Equal(0, attrSym.CommonConstructorArguments.Length) - '' enum EFoo + '' enum EGoo If compilation IsNot Nothing Then ' Because this is a nopia local type it is only visible from the source assembly. - Dim type3 = DirectCast(globalNS.GetTypeMember("EFoo"), NamedTypeSymbol) + Dim type3 = DirectCast(globalNS.GetTypeMember("EGoo"), NamedTypeSymbol) Assert.Equal(2, type3.GetAttributes().Length) attrSym = type3.GetAttribute(comvSym) @@ -252,7 +252,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.Semantics attrSym = type3.GetAttribute(tidSym) Assert.Equal(2, attrSym.CommonConstructorArguments.Length) - Assert.Equal("EFoo, InteropAttribute, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", attrSym.CommonConstructorArguments(1).Value) + Assert.Equal("EGoo, InteropAttribute, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", attrSym.CommonConstructorArguments(1).Value) Dim field = DirectCast(type3.GetMembers("one").First(), FieldSymbol) Assert.Equal(0, field.GetAttributes().Length) @@ -934,11 +934,11 @@ Class C Public Shared Sub F2() End Sub - + Public Shared Sub F3() End Sub - + Public Shared Sub F4() End Sub @@ -1211,8 +1211,8 @@ Imports System.Runtime.CompilerServices Imports System.Runtime.InteropServices Class C - Declare Unicode Sub M1 Lib "foo"() - Declare Unicode Sub M2 Lib "foo" Alias "bar"() + Declare Unicode Sub M1 Lib "goo"() + Declare Unicode Sub M2 Lib "goo" Alias "bar"() End Class ]]> @@ -1224,7 +1224,7 @@ End Class Dim c = [module].GlobalNamespace.GetMember(Of NamedTypeSymbol)("C") Dim info = c.GetMember(Of MethodSymbol)("M1").GetDllImportData() - Assert.Equal("foo", info.ModuleName) + Assert.Equal("goo", info.ModuleName) Assert.Equal(If(isFromSource, Nothing, "M1"), info.EntryPointName) Assert.Equal(CharSet.Unicode, info.CharacterSet) Assert.Equal(CallingConvention.Winapi, info.CallingConvention) @@ -1234,7 +1234,7 @@ End Class Assert.Equal(Nothing, info.ThrowOnUnmappableCharacter) info = c.GetMember(Of MethodSymbol)("M2").GetDllImportData() - Assert.Equal("foo", info.ModuleName) + Assert.Equal("goo", info.ModuleName) Assert.Equal("bar", info.EntryPointName) Assert.Equal(CharSet.Unicode, info.CharacterSet) Assert.Equal(CallingConvention.Winapi, info.CallingConvention) @@ -1256,7 +1256,7 @@ Imports System.Runtime.CompilerServices Imports System.Runtime.InteropServices Public Class C - + Public Shared Operator +(a As C, b As C) As Integer End Operator End Class @@ -1276,7 +1276,7 @@ End Class Dim entryPointName As String = reader.GetString(method.Name) Assert.Equal("op_Addition", entryPointName) - Assert.Equal("foo", moduleName) + Assert.Equal("goo", moduleName) End Sub) End Sub @@ -1289,7 +1289,7 @@ Imports System.Runtime.CompilerServices Imports System.Runtime.InteropServices Public Class C - + Public Shared Narrowing Operator CType(a As C) As Integer End Operator End Class @@ -1308,7 +1308,7 @@ End Class Dim entryPointName As String = peFileReader.GetString(method.Name) Assert.Equal("op_Explicit", entryPointName) - Assert.Equal("foo", moduleName) + Assert.Equal("goo", moduleName) End Sub) End Sub @@ -1322,10 +1322,10 @@ Imports System.Runtime.InteropServices Public Class C - Shared Partial Private Sub foo() + Shared Partial Private Sub goo() End Sub - Shared Private Sub foo() + Shared Private Sub goo() End Sub End Class ]]> @@ -1343,7 +1343,7 @@ End Class Dim entryPointName As String = reader.GetString(method.Name) Assert.Equal("module name", moduleName) - Assert.Equal("foo", entryPointName) + Assert.Equal("goo", entryPointName) End Sub) End Sub @@ -1356,10 +1356,10 @@ Imports System.Runtime.InteropServices Public Class C - Partial Private Sub foo() + Partial Private Sub goo() End Sub - Private Sub foo() + Private Sub goo() End Sub End Class ]]> @@ -1421,47 +1421,47 @@ Public Class C End Property Custom Event x As Action(Of Integer) - + AddHandler(value As Action(Of Integer)) End AddHandler - + RemoveHandler(value As Action(Of Integer)) End RemoveHandler - + RaiseEvent(obj As Integer) End RaiseEvent End Event - + Sub InstanceMethod End Sub - + Shared Sub NonEmptyBody System.Console.WriteLine() End Sub - + Shared Sub GenericMethod(Of T)() End Sub End Class Interface I - + Sub InterfaceMethod() End Interface Interface I(Of T) - + Sub InterfaceMethod() End Interface Class C(Of T) - Interface Foo + Interface Goo Class D - + Shared Sub MethodOnGenericType() End Sub End Class @@ -1790,7 +1790,7 @@ Imports System.Runtime.InteropServices Public Class C - Declare Ansi Sub Foo Lib "Foo" Alias "bar" () + Declare Ansi Sub Goo Lib "Goo" Alias "bar" () End Class ]]> @@ -1815,7 +1815,7 @@ Public Module M End Sub - + Sub DllImp(a As Integer) End Sub @@ -1856,69 +1856,69 @@ MustInherit Class C MustOverride Public Sub f1() - + Public Shared Sub f2() End Sub - + Public Shared Sub f3() End Sub - + Public Shared Sub f4() End Sub - + Public Shared Sub f5() End Sub - + Public Shared Sub f6() End Sub MustOverride Public Sub f7() - + Public Shared Sub f8() End Sub - + Public Shared Sub f9() End Sub ' false - + Public Shared Sub f10() End Sub - + Public Shared Sub f11() End Sub ' false - + Public Shared Sub f12() End Sub ' false - + Public Shared Sub f13() End Sub - + Public Shared Sub f14() End Sub - + Public Shared Sub f15() End Sub - + Public Shared Sub f16() End Sub - + Public Shared Sub f17() End Sub @@ -1926,7 +1926,7 @@ MustInherit Class C Public Shared Sub f18() End Sub - + Public Shared Sub f19() End Sub @@ -2119,7 +2119,7 @@ Imports System.Runtime.InteropServices MustInherit Class C - + Shared Sub f1() End Sub End Class @@ -2150,7 +2150,7 @@ Imports System.Runtime.InteropServices MustInherit Class C - + Shared Sub f1() End Sub End Class @@ -2221,7 +2221,7 @@ Class C Class D Dim arr As Integer() = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0} - Sub foo() + Sub goo() Dim a As Integer = 1 Dim b As Integer = 2 Dim q = New With {.f = 1, .g = 2} @@ -2229,7 +2229,7 @@ Class C End Sub End Class - Event Foo(a As Integer, b As String) + Event Goo(a As Integer, b As String) End Class @@ -2295,7 +2295,7 @@ Imports Microsoft.VisualBasic Friend Class C - Public Sub Foo(x As Integer) + Public Sub Goo(x As Integer) Console.WriteLine(ChrW(x)) End Sub End Class @@ -2336,7 +2336,7 @@ Imports System.Runtime.CompilerServices Imports System.Runtime.InteropServices Public Class C - Declare Sub Bar Lib "Foo" () + Declare Sub Bar Lib "Goo" () End Class ]]> @@ -2348,7 +2348,7 @@ End Class ' ModuleRef: Dim moduleRefName = reader.GetModuleReference(reader.GetModuleReferences().Single()).Name - Assert.Equal("Foo", reader.GetString(moduleRefName)) + Assert.Equal("Goo", reader.GetString(moduleRefName)) ' FileRef: ' Although the Metadata spec says there should be a File entry for each ModuleRef entry @@ -4195,7 +4195,7 @@ Public Class C Dim fNotExtensible2 As NotExtensibleInterface2 Dim fNotExtensible3 As NotExtensibleInterface3 - Public Sub Foo() + Public Sub Goo() fExtensible1.LateBound() fExtensible2.LateBound() fExtensible3.LateBound() @@ -4678,7 +4678,7 @@ End Class Imports System Module Module1 - Sub foo() + Sub goo() End Sub Sub Main() @@ -4692,8 +4692,8 @@ End Class Dim sourceValidator As Action(Of ModuleSymbol) = Sub(m As ModuleSymbol) Dim type = DirectCast(m.GlobalNamespace.GetMember("Module1"), SourceNamedTypeSymbol) - Dim fooMethod = DirectCast(type.GetMember("foo"), SourceMethodSymbol) - VerifySynthesizedSTAThreadAttribute(fooMethod, expected:=False) + Dim gooMethod = DirectCast(type.GetMember("goo"), SourceMethodSymbol) + VerifySynthesizedSTAThreadAttribute(gooMethod, expected:=False) Dim mainMethod = DirectCast(type.GetMember("Main"), SourceMethodSymbol) VerifySynthesizedSTAThreadAttribute(mainMethod, expected:=True) @@ -4709,7 +4709,7 @@ End Class Imports System Module Module1 - Sub foo() + Sub goo() End Sub Sub Main() @@ -4723,8 +4723,8 @@ End Class Dim sourceValidator As Action(Of ModuleSymbol) = Sub(m As ModuleSymbol) Dim type = DirectCast(m.GlobalNamespace.GetMember("Module1"), SourceNamedTypeSymbol) - Dim fooMethod = DirectCast(type.GetMember("foo"), SourceMethodSymbol) - VerifySynthesizedSTAThreadAttribute(fooMethod, expected:=False) + Dim gooMethod = DirectCast(type.GetMember("goo"), SourceMethodSymbol) + VerifySynthesizedSTAThreadAttribute(gooMethod, expected:=False) Dim mainMethod = DirectCast(type.GetMember("Main"), SourceMethodSymbol) VerifySynthesizedSTAThreadAttribute(mainMethod, expected:=False) @@ -4741,7 +4741,7 @@ End Class @@ -4757,8 +4757,8 @@ End Class Dim sourceValidator As Action(Of ModuleSymbol) = Sub(m As ModuleSymbol) Dim type = DirectCast(m.GlobalNamespace.GetMember("Module1"), SourceNamedTypeSymbol) - Dim fooMethod = DirectCast(type.GetMember("foo"), SourceMethodSymbol) - VerifySynthesizedSTAThreadAttribute(fooMethod, expected:=False) + Dim gooMethod = DirectCast(type.GetMember("goo"), SourceMethodSymbol) + VerifySynthesizedSTAThreadAttribute(gooMethod, expected:=False) Dim mainMethod = DirectCast(type.GetMember("Main"), SourceMethodSymbol) VerifySynthesizedSTAThreadAttribute(mainMethod, expected:=False) @@ -4775,7 +4775,7 @@ End Class @@ -4791,8 +4791,8 @@ End Class Dim sourceValidator As Action(Of ModuleSymbol) = Sub(m As ModuleSymbol) Dim type = DirectCast(m.GlobalNamespace.GetMember("Module1"), SourceNamedTypeSymbol) - Dim fooMethod = DirectCast(type.GetMember("foo"), SourceMethodSymbol) - VerifySynthesizedSTAThreadAttribute(fooMethod, expected:=False) + Dim gooMethod = DirectCast(type.GetMember("goo"), SourceMethodSymbol) + VerifySynthesizedSTAThreadAttribute(gooMethod, expected:=False) Dim mainMethod = DirectCast(type.GetMember("Main"), SourceMethodSymbol) VerifySynthesizedSTAThreadAttribute(mainMethod, expected:=False) diff --git a/src/Compilers/VisualBasic/Test/Emit/Attributes/InternalsVisibleToAndStrongNameTests.vb b/src/Compilers/VisualBasic/Test/Emit/Attributes/InternalsVisibleToAndStrongNameTests.vb index 5d7f399455578..879073144fe8a 100644 --- a/src/Compilers/VisualBasic/Test/Emit/Attributes/InternalsVisibleToAndStrongNameTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/Attributes/InternalsVisibleToAndStrongNameTests.vb @@ -127,7 +127,7 @@ Partial Public Class InternalsVisibleToAndStrongNameTests Public Class C - Friend Sub Foo() + Friend Sub Goo() End Sub End Class ]]> @@ -144,7 +144,7 @@ End Class @@ -163,7 +163,7 @@ End Class Dim source = @@ -199,7 +199,7 @@ End Class @@ -218,7 +218,7 @@ End Class Dim source = @@ -257,17 +257,17 @@ End Class , - options:=TestOptions.ReleaseExe.WithCryptoKeyFile("foo").WithStrongNameProvider(s_defaultProvider)) + options:=TestOptions.ReleaseExe.WithCryptoKeyFile("goo").WithStrongNameProvider(s_defaultProvider)) CompilationUtils.AssertTheseDeclarationDiagnostics(other, -BC36980: Error extracting public key from file 'foo': <%= CodeAnalysisResources.FileNotFound %> +BC36980: Error extracting public key from file 'goo': <%= CodeAnalysisResources.FileNotFound %> ) Assert.True(other.Assembly.Identity.PublicKey.IsEmpty) End Sub @@ -280,7 +280,7 @@ BC36980: Error extracting public key from file 'foo': <%= CodeAnalysisResources. Public Class C - Friend Sub Foo() + Friend Sub Goo() End Sub End Class ]]> @@ -298,7 +298,7 @@ End Class Public Class C - Friend Sub Foo() + Friend Sub Goo() End Sub End Class ]]> @@ -433,7 +433,7 @@ BC2046: Compilation options 'CryptoPublicKey' and 'CryptoKeyFile' can't both be @@ -453,22 +453,22 @@ End Class -, options:=TestOptions.ReleaseExe.WithCryptoKeyContainer("foo").WithStrongNameProvider(s_defaultProvider)) +, options:=TestOptions.ReleaseExe.WithCryptoKeyContainer("goo").WithStrongNameProvider(s_defaultProvider)) ' CompilationUtils.AssertTheseDeclarationDiagnostics(other, ' - 'BC36981: Error extracting public key from container 'foo': Keyset does not exist (Exception from HRESULT: 0x80090016) + 'BC36981: Error extracting public key from container 'goo': Keyset does not exist (Exception from HRESULT: 0x80090016) ' ) Dim err = other.GetDeclarationDiagnostics().Single() Assert.Equal(ERRID.ERR_PublicKeyContainerFailure, err.Code) Assert.Equal(2, err.Arguments.Count) - Assert.Equal("foo", DirectCast(err.Arguments(0), String)) + Assert.Equal("goo", DirectCast(err.Arguments(0), String)) Dim errorText = DirectCast(err.Arguments(1), String) Assert.True( errorText.Contains("HRESULT") AndAlso @@ -486,7 +486,7 @@ End Class Public Class C - Friend Sub Foo() + Friend Sub Goo() End Sub End Class ]]> @@ -501,7 +501,7 @@ End Class Public Class A Friend Class B Protected Sub New(o As C) - o.Foo() + o.Goo() End Sub End Class End Class @@ -513,8 +513,8 @@ End Class c.GetDiagnostics() CompilationUtils.AssertTheseDiagnostics(c, -BC30390: 'C.Friend Sub Foo()' is not accessible in this context because it is 'Friend'. - o.Foo() +BC30390: 'C.Friend Sub Goo()' is not accessible in this context because it is 'Friend'. + o.Goo() ~~~~~ ) @@ -524,7 +524,7 @@ BC30390: 'C.Friend Sub Foo()' is not accessible in this context because it is 'F Public Class A Friend Class B Protected Sub New(o As C) - o.Foo() + o.Goo() End Sub End Class End Class @@ -542,7 +542,7 @@ End Class Public Class C - Friend Sub Foo() + Friend Sub Goo() End Sub End Class ]]> @@ -557,7 +557,7 @@ End Class Public Class A Friend Class B Protected Sub New(o As C) - o.Foo() + o.Goo() End Sub End Class End Class @@ -571,8 +571,8 @@ End Class 'gives "is not a member" error because internals were not imported because no IVT was found 'on HasIVTToCompilation that referred to WantsIVTAccessButCantHave CompilationUtils.AssertTheseDiagnostics(c, -BC30456: 'Foo' is not a member of 'C'. - o.Foo() +BC30456: 'Goo' is not a member of 'C'. + o.Goo() ~~~~~ ) @@ -582,7 +582,7 @@ BC30456: 'Foo' is not a member of 'C'. Public Class A Friend Class B Protected Sub New(o As C) - o.Foo() + o.Goo() End Sub End Class End Class @@ -664,7 +664,7 @@ End Class Friend Class C - Friend Sub Foo() + Friend Sub Goo() End Sub End Class ]]> @@ -678,7 +678,7 @@ End Class @@ -697,7 +697,7 @@ End Class Friend Class C - Friend Sub Foo() + Friend Sub Goo() End Sub End Class ]]> @@ -711,7 +711,7 @@ End Class @@ -734,7 +734,7 @@ End Class Friend Class C - Friend Sub Foo() + Friend Sub Goo() End Sub End Class ]]> @@ -765,7 +765,7 @@ End Class Friend Class C - Friend Sub Foo() + Friend Sub Goo() End Sub End Class ]]> @@ -798,7 +798,7 @@ End Class 'key is wrong in the first digit Friend Class C - Friend Sub Foo() + Friend Sub Goo() End Sub End Class ]]> @@ -831,7 +831,7 @@ End Class Friend Class C - Friend Sub Foo() + Friend Sub Goo() End Sub End Class ]]> @@ -861,7 +861,7 @@ End Class Friend Class C - Friend Sub Foo() + Friend Sub Goo() End Sub End Class ]]> @@ -893,7 +893,7 @@ End Class Namespace ClassLibrary Friend Class FriendClass - Public Sub Foo() + Public Sub Goo() End Sub End Class end Namespace @@ -928,7 +928,7 @@ End Class Imports System.Runtime.CompilerServices Public Class C - Friend Sub Foo() + Friend Sub Goo() End Sub End Class ]]> @@ -951,7 +951,7 @@ BC31534: Friend assembly reference 'WantsIVTAccess, Culture=neutral' is invalid. Imports System.Runtime.CompilerServices Public Class C - Friend Sub Foo() + Friend Sub Goo() End Sub End Class ]]> @@ -1031,7 +1031,7 @@ options:=TestOptions.ReleaseExe.WithCryptoKeyFile(SigningTestHelpers.MaxSizeKeyF @@ -1049,7 +1049,7 @@ End Class @@ -1093,7 +1093,7 @@ BC36961: Key file '<%= s_publicKeyFile %>' is missing the private key needed for Public Class C - Friend Sub Foo() + Friend Sub Goo() End Sub End Class ]]> @@ -1111,7 +1111,7 @@ End Class Public Class C - Friend Sub Foo() + Friend Sub Goo() End Sub End Class ]]> @@ -1132,7 +1132,7 @@ End Class @@ -1203,7 +1203,7 @@ End Class Public Class C - Friend Sub Foo() + Friend Sub Goo() End Sub End Class ]]> @@ -1482,7 +1482,7 @@ End Class Public Class C - Friend Sub Foo() + Friend Sub Goo() End Sub End Class ]]> @@ -1573,7 +1573,7 @@ End Class "bc6402e37ad723580b576953f40475ceae4b784d3661b90c3c6f5a1f7283388a7880683e0821610bee977f70506bb75584080e01b2ec97483c4d601ce1c981752a07276b420d78594d0ef28f8ec016d0a5b6d56cfc22e9f25a2ed9545942ccbf2d6295b9528641d98776e06a3273ab233271a3c9f53099b4d4e029582a6d5819")> Public Class C - Friend Sub Foo() + Friend Sub Goo() End Sub End Class ]]> @@ -1604,7 +1604,7 @@ BC37209: Invalid signature public key specified in AssemblySignatureKeyAttribute "FFFFbc6402e37ad723580b576953f40475ceae4b784d3661b90c3c6f5a1f7283388a7880683e0821610bee977f70506bb75584080e01b2ec97483c4d601ce1c981752a07276b420d78594d0ef28f8ec016d0a5b6d56cfc22e9f25a2ed9545942ccbf2d6295b9528641d98776e06a3273ab233271a3c9f53099b4d4e029582a6d5819")> Public Class C - Friend Sub Foo() + Friend Sub Goo() End Sub End Class ]]> @@ -1642,7 +1642,7 @@ End Class "bc6402e37ad723580b576953f40475ceae4b784d3661b90c3c6f5a1f7283388a7880683e0821610bee977f70506bb75584080e01b2ec97483c4d601ce1c981752a07276b420d78594d0ef28f8ec016d0a5b6d56cfc22e9f25a2ed9545942ccbf2d6295b9528641d98776e06a3273ab233271a3c9f53099b4d4e029582a6d5819")> Public Class C - Friend Sub Foo() + Friend Sub Goo() End Sub End Class ]]> @@ -1673,7 +1673,7 @@ BC37209: Invalid signature public key specified in AssemblySignatureKeyAttribute "FFFFbc6402e37ad723580b576953f40475ceae4b784d3661b90c3c6f5a1f7283388a7880683e0821610bee977f70506bb75584080e01b2ec97483c4d601ce1c981752a07276b420d78594d0ef28f8ec016d0a5b6d56cfc22e9f25a2ed9545942ccbf2d6295b9528641d98776e06a3273ab233271a3c9f53099b4d4e029582a6d5819")> Public Class C - Friend Sub Foo() + Friend Sub Goo() End Sub End Class ]]> @@ -1694,7 +1694,7 @@ Nothing, "bc6402e37ad723580b576953f40475ceae4b784d3661b90c3c6f5a1f7283388a7880683e0821610bee977f70506bb75584080e01b2ec97483c4d601ce1c981752a07276b420d78594d0ef28f8ec016d0a5b6d56cfc22e9f25a2ed9545942ccbf2d6295b9528641d98776e06a3273ab233271a3c9f53099b4d4e029582a6d5819")> Public Class C - Friend Sub Foo() + Friend Sub Goo() End Sub End Class ]]> @@ -1725,7 +1725,7 @@ Nothing, Nothing)> Public Class C - Friend Sub Foo() + Friend Sub Goo() End Sub End Class ]]> diff --git a/src/Compilers/VisualBasic/Test/Emit/BreakingChanges.vb b/src/Compilers/VisualBasic/Test/Emit/BreakingChanges.vb index 8e76b11233181..b62782e625d21 100644 --- a/src/Compilers/VisualBasic/Test/Emit/BreakingChanges.vb +++ b/src/Compilers/VisualBasic/Test/Emit/BreakingChanges.vb @@ -75,8 +75,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests Imports System Class Test Const x = "" - - Shared Function Foo(ByVal x As Object) As Test + + Shared Function Goo(ByVal x As Object) As Test Return Nothing End Function End Class @@ -387,28 +387,28 @@ BC36969: 'Sub New' cannot be declared 'Partial'. , compilationOptions:=New VisualBasicCompilationOptions(OutputKind.ConsoleApplication)) @@ -429,14 +429,14 @@ End Module]]>, 'TODO: Add tests for the latebinder breaks (See Dev10 bug 850631,849009). Dim vbVerifier = CompileAndVerify(vbCompilation, - expectedOutput:=, expectedSignatures:= { - Signature("Class2", "Foo", ".method public hidebysig strict virtual instance System.Void Foo() cil managed") + Signature("Class2", "Goo", ".method public hidebysig strict virtual instance System.Void Goo() cil managed") }) vbVerifier.VerifyDiagnostics() @@ -451,16 +451,16 @@ public class Program public static void Main() { Class3 d = new Class3(); - d.Foo(); + d.Goo(); // The below line would fail to compile in Dev10 (with following error). - // error CS1501: No overload for method 'Foo' takes 1 arguments. + // error CS1501: No overload for method 'Goo' takes 1 arguments. // In Roslyn this works fine. - d.Foo(1); + d.Goo(1); Class1 b = d; - b.Foo(); - b.Foo(1); + b.Goo(); + b.Goo(1); } }]]>, compilationOptions:=New CSharp.CSharpCompilationOptions(OutputKind.ConsoleApplication), @@ -479,7 +479,7 @@ Module M Sub Main() Dim b As Boolean? = False Console.Write("F OrElse F=") - If b OrElse Foo(b) Then + If b OrElse Goo(b) Then Console.Write("True |") Else Console.Write("False |") @@ -495,8 +495,8 @@ Module M Dim bF As Boolean? = False Dim bT As Boolean? = True - Console.Write("F Or F={0} | ", bF Or Foo(bF)) - Console.Write("T Or F={0} | ", bT Or Foo(bT)) + Console.Write("F Or F={0} | ", bF Or Goo(bF)) + Console.Write("T Or F={0} | ", bT Or Goo(bT)) bF = False bT = True Console.Write("T And T={0} | ", bT And Bar(bT)) @@ -504,7 +504,7 @@ Module M End Sub - Function Foo(ByRef b As Boolean?) As Boolean? + Function Goo(ByRef b As Boolean?) As Boolean? b = Not b Return False End Function @@ -541,16 +541,16 @@ End Module Public Sub TestMissingSynchronizedFlagForEvents() Dim comp = CreateVisualBasicCompilation("TestMissingSynchronizedFlagForEvents", , compilationOptions:=New VisualBasicCompilationOptions(OutputKind.DynamicallyLinkedLibrary)) - ' In Dev11, we used to emit an additional 'synchronized' metadata flag in the signature of add_foo() and remove_foo() methods below. + ' In Dev11, we used to emit an additional 'synchronized' metadata flag in the signature of add_goo() and remove_goo() methods below. Dim verifier = CompileAndVerify(comp, expectedSignatures:= { - Signature("C1", "add_foo", ".method [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public specialname instance System.Void add_foo(C1+fooEventHandler obj) cil managed"), - Signature("C1", "remove_foo", ".method [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public specialname instance System.Void remove_foo(C1+fooEventHandler obj) cil managed") + Signature("C1", "add_goo", ".method [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public specialname instance System.Void add_goo(C1+gooEventHandler obj) cil managed"), + Signature("C1", "remove_goo", ".method [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public specialname instance System.Void remove_goo(C1+gooEventHandler obj) cil managed") }) verifier.VerifyDiagnostics() @@ -635,16 +635,16 @@ Base F]]>) , 'Breaking Change: Dev11 allows above repro to compile while Roslyn reports following errors. 'This was approved in VB LDB on 8/1/2012. See bug 13578 for more details. vbCompilation.VerifyDiagnostics( - Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Foo", "ev"), - Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Foo", "ev"), - Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Foo", "ev"), - Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Foo2", "ev"), - Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Foo2", "ev"), - Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Foo2", "ev")) + Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Goo", "ev"), + Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Goo", "ev"), + Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Goo", "ev"), + Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Goo2", "ev"), + Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Goo2", "ev"), + Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Goo2", "ev")) End Sub @@ -691,14 +691,14 @@ Module Module1 Return GetType(T) End Function - Public Function foo_exc() As Integer + Public Function goo_exc() As Integer Throw New ArgumentException - foo_exc = 1 + goo_exc = 1 End Function - Public Function foo_eval_check(ByRef arg As Integer) As Integer? + Public Function goo_eval_check(ByRef arg As Integer) As Integer? arg = arg + 1 - foo_eval_check = 1 + goo_eval_check = 1 End Function Dim eval @@ -706,7 +706,7 @@ Module Module1 Sub Main() eval = 19 Try - Dim x = CheckType(foo_eval_check(eval) / foo_exc()) + Dim x = CheckType(goo_eval_check(eval) / goo_exc()) Console.Write("Exception expected ") Catch ex As ArgumentException Console.Write("19:") diff --git a/src/Compilers/VisualBasic/Test/Emit/CodeGen/AnonymousTypesCodeGenTests.vb b/src/Compilers/VisualBasic/Test/Emit/CodeGen/AnonymousTypesCodeGenTests.vb index 9dacf7981e788..eb89c85e32248 100644 --- a/src/Compilers/VisualBasic/Test/Emit/CodeGen/AnonymousTypesCodeGenTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/CodeGen/AnonymousTypesCodeGenTests.vb @@ -791,14 +791,14 @@ Friend Module AnonTProp001mod Dim obj = New C Try - Dim scen1 = New With {.With = "aclass", ._p_ = "C"c, Foo, Key New C().extMethod} - Console.WriteLine("{0},{1},{2},{3}", scen1.With, scen1._p_, scen1.foo, scen1.Extmethod) + Dim scen1 = New With {.With = "aclass", ._p_ = "C"c, Goo, Key New C().extMethod} + Console.WriteLine("{0},{1},{2},{3}", scen1.With, scen1._p_, scen1.goo, scen1.Extmethod) Dim scen2 = New With {obj.Extmethod02, obj!_123, C.APROP} Console.WriteLine("{0},{1},{2}", scen2.ExtMethod02, scen2._123, scen2.aprop) Try - Dim scen4 = New With {.prop1 = FooEx("testing")} + Dim scen4 = New With {.prop1 = GooEx("testing")} Console.WriteLine("NO EX") Catch ex As Exception Console.WriteLine("Exp EX") @@ -808,11 +808,11 @@ Friend Module AnonTProp001mod End Try End Sub - Function Foo() As String + Function Goo() As String Return "Abc" End Function - Function FooEx(ByVal p1 As String) As String + Function GooEx(ByVal p1 As String) As String Throw New Exception("This exception is expected") End Function diff --git a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenAsyncTests.vb b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenAsyncTests.vb index 703c7faf5f7dc..09c2b41046a4b 100644 --- a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenAsyncTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenAsyncTests.vb @@ -24,10 +24,10 @@ Imports System.Threading.Tasks Module Module1 Sub Main() - Foo(123).Wait() + Goo(123).Wait() End Sub - Public Async Function Foo(a As Integer) As Task + Public Async Function Goo(a As Integer) As Task Await Task.Factory.StartNew(Sub() System.Console.WriteLine(a)) End Function @@ -44,7 +44,7 @@ End Module CompileAndVerify(compilation.WithOptions(options), expectedOutput:="123", symbolValidator:=Sub(m As ModuleSymbol) - Dim stateMachine = m.GlobalNamespace.GetMember(Of NamedTypeSymbol)("Module1").GetMember(Of NamedTypeSymbol)("VB$StateMachine_1_Foo") + Dim stateMachine = m.GlobalNamespace.GetMember(Of NamedTypeSymbol)("Module1").GetMember(Of NamedTypeSymbol)("VB$StateMachine_1_Goo") Assert.Equal(TypeKind.Structure, stateMachine.TypeKind) End Sub) @@ -54,7 +54,7 @@ End Module CompileAndVerify(compilation.WithOptions(options), expectedOutput:="123", symbolValidator:=Sub(m As ModuleSymbol) - Dim stateMachine = m.GlobalNamespace.GetMember(Of NamedTypeSymbol)("Module1").GetMember(Of NamedTypeSymbol)("VB$StateMachine_1_Foo") + Dim stateMachine = m.GlobalNamespace.GetMember(Of NamedTypeSymbol)("Module1").GetMember(Of NamedTypeSymbol)("VB$StateMachine_1_Goo") Assert.Equal(TypeKind.Class, stateMachine.TypeKind) End Sub) End Sub @@ -4379,7 +4379,7 @@ Imports System.Threading.Tasks Class TestCase Public Shared Count = 0 - Public Shared Function Foo(Of T)(tt As T) As T + Public Shared Function Goo(Of T)(tt As T) As T Return tt End Function @@ -4389,9 +4389,9 @@ Class TestCase End Function Public Shared Async Function Run() As Task - Dim x1 = Foo(Await Bar(4)) + Dim x1 = Goo(Await Bar(4)) Dim t = Bar(5) - Dim x2 = Foo(Await t) + Dim x2 = Goo(Await t) If x1 <> 4 Then Count += 1 End If @@ -4936,11 +4936,11 @@ End Structure Structure TestCase Public Async Function Run() As Task Dim ms As New MyStruct(Of Integer)() - Dim x = ms(index:=Await Foo()) + Dim x = ms(index:=Await Goo()) Console.Write(x + 100) End Function - Public Async Function Foo() As Task(Of Integer) + Public Async Function Goo() As Task(Of Integer) Await Task.Yield Return 10 End Function @@ -4991,10 +4991,10 @@ Imports System.Threading.Tasks Class TestCase Public Async Function Run() As Task(Of Integer) - Return Await Foo() + Return Await Goo() End Function - Public Async Function Foo() As Task(Of Integer) + Public Async Function Goo() As Task(Of Integer) Return Await Task.Factory.StartNew(Function() 42) End Function End Class @@ -5209,7 +5209,7 @@ Class TestCase Dim arr2()() As Integer = New Integer()() { New Integer() {Await GetVal(2), Await GetVal(3)}, - Await Foo() + Await Goo() } If arr2(0)(1) = 3 AndAlso arr2(1)(1) = 2 Then Count += 1 @@ -5218,7 +5218,7 @@ Class TestCase Result = Count - tests End Function - Public Async Function Foo() As Task(Of Integer()) + Public Async Function Goo() As Task(Of Integer()) Await Task.Yield Return {1, 2, 3} End Function @@ -5278,7 +5278,7 @@ Class TestCase Result = Count - tests End Function - Public Async Function Foo() As Task(Of Integer()) + Public Async Function Goo() As Task(Of Integer()) Await Task.Yield Return {1, 2, 3} End Function @@ -5335,7 +5335,7 @@ Class TestCase Dim arr2()() As Integer = New Integer()() { New Integer() {Await GetVal(2), 3}, - Await Foo() + Await Goo() } If arr2(0)(1) = 3 AndAlso arr2(1)(1) = 2 Then Count += 1 @@ -5344,7 +5344,7 @@ Class TestCase Result = Count - tests End Function - Public Async Function Foo() As Task(Of Integer()) + Public Async Function Goo() As Task(Of Integer()) Await Task.Yield Return {1, 2, 3} End Function @@ -5708,7 +5708,7 @@ Imports System.Threading Imports System.Threading.Tasks Class BaseTestCase - Public Sub FooRef(ByRef d As Decimal, x As Integer, ByRef od As Decimal) + Public Sub GooRef(ByRef d As Decimal, x As Integer, ByRef od As Decimal) od = d d += 1 End Sub @@ -5727,7 +5727,7 @@ Class TestCase : Inherits BaseTestCase Dim od As Decimal tests += 1 - MyBase.FooRef(d, Await MyBase.GetVal(4), od) + MyBase.GooRef(d, Await MyBase.GetVal(4), od) If d = 2 AndAlso od = 1 Then count += 1 End If @@ -6069,7 +6069,7 @@ Imports System.Threading Imports System.Threading.Tasks Structure Test - Public ReadOnly Property Foo As Task(Of String) + Public ReadOnly Property Goo As Task(Of String) Get Return Task.Run(Of String)(Async Function() Await Task.Yield @@ -6093,13 +6093,13 @@ Class TestCase(Of U) Dim t As New Test() Tests += 1 - Dim x1 = Await TestCase(Of String).GetVal(Await t.Foo) + Dim x1 = Await TestCase(Of String).GetVal(Await t.Goo) If x1 = "abc" Then Count += 1 End If Tests += 1 - Dim x2 = Await TestCase(Of String).GetVal1(t.Foo) + Dim x2 = Await TestCase(Of String).GetVal1(t.Goo) If x2 = "abc" Then Count += 1 End If @@ -6132,22 +6132,22 @@ Imports System.Threading Imports System.Threading.Tasks Class TestCase(Of U) - Public Async Function Foo1() As Task(Of Integer) + Public Async Function Goo1() As Task(Of Integer) Await Task.Yield Count += 1 Dim i = 42 Return i End Function - Public Async Function Foo2() As Task(Of Object) + Public Async Function Goo2() As Task(Of Object) Await Task.Yield Count += 1 Return "string" End Function Public Async Function Run() As Task - Dim x1 = TryCast(Await Foo1(), Object) - Dim x2 = TypeOf (Await Foo2()) Is String + Dim x1 = TryCast(Await Goo1(), Object) + Dim x2 = TypeOf (Await Goo2()) Is String If x1.Equals(42) Then Tests += 1 End If @@ -6379,7 +6379,7 @@ Imports System.Threading Imports System.Threading.Tasks Structure DynamicClass - Public Async Function Foo(Of T)(tt As T) As Task(Of Object) + Public Async Function Goo(Of T)(tt As T) As Task(Of Object) Await Task.Yield Return tt End Function @@ -6399,7 +6399,7 @@ Class TestCase Dim d As Object = 123 Tests += 1 - Dim x1 = Await dc.Foo("") + Dim x1 = Await dc.Goo("") If x1 = "" Then Count += 1 End If @@ -6411,7 +6411,7 @@ Class TestCase End If Tests += 1 - Dim x3 = Await Await dc.Bar(Await dc.Foo(234)) + Dim x3 = Await Await dc.Bar(Await dc.Goo(234)) If x3 = 234 Then Count += 1 End If @@ -6639,7 +6639,7 @@ Structure MyClazz(Of T As Task(Of Func(Of Integer))) End Structure Class TestCase - Public Shared Async Function Foo(d As Task(Of Func(Of Integer))) As Task(Of Task(Of Func(Of Integer))) + Public Shared Async Function Goo(d As Task(Of Func(Of Integer))) As Task(Of Task(Of Func(Of Integer))) Await Task.Yield Interlocked.Increment(Count) Return d @@ -6656,7 +6656,7 @@ Class TestCase End Function End Function) Tests += 1 - Dim x = Await ms(index:=Await Foo(Nothing)) + Dim x = Await ms(index:=Await Goo(Nothing)) If x IsNot Nothing AndAlso x() = 123 Then Tests += 1 End If @@ -6703,7 +6703,7 @@ Class MyClazz(Of T As Task(Of Func(Of Integer))) End Class Class TestCase - Public Shared Async Function Foo(d As Task(Of Func(Of Integer))) As Task(Of Task(Of Func(Of Integer))) + Public Shared Async Function Goo(d As Task(Of Func(Of Integer))) As Task(Of Task(Of Func(Of Integer))) Await Task.Yield Interlocked.Increment(Count) Return d @@ -6720,7 +6720,7 @@ Class TestCase End Function End Function) Tests += 1 - Dim x = Await ms(index:=Await Foo(Nothing)) + Dim x = Await ms(index:=Await Goo(Nothing)) If x IsNot Nothing AndAlso x() = 123 Then Tests += 1 End If @@ -6753,16 +6753,16 @@ Imports System.Threading Imports System.Threading.Tasks Public Class MyClazz(Of T) - Public Async Function Foo(Of V)(tt As T, vv As V) As Task(Of Object) + Public Async Function Goo(Of V)(tt As T, vv As V) As Task(Of Object) Await Task.Yield Return vv End Function End Class Class TestCase - Public Shared Async Function Foo() As Task(Of Integer) + Public Shared Async Function Goo() As Task(Of Integer) Dim mc As Object = New MyClazz(Of String)() - Dim rez = Await mc.Foo(Of String)(Nothing, Await (Async Function() As Task(Of String) + Dim rez = Await mc.Goo(Of String)(Nothing, Await (Async Function() As Task(Of String) Await Task.Yield Return "Test" End Function)()) @@ -6775,7 +6775,7 @@ End Class Module Form1 Sub Main() - Console.Write(TestCase.Foo().Result) + Console.Write(TestCase.Goo().Result) End Sub End Module @@ -7010,7 +7010,7 @@ Class MyClazz End Class Public Class MyTask - Public Shared Function Foo(ByRef x As Integer, y As Integer) As Integer + Public Shared Function Goo(ByRef x As Integer, y As Integer) As Integer Return x + y End Function @@ -7020,7 +7020,7 @@ Public Class MyTask End Function Public Shared Async Function Run() As Task(Of Integer) - Return Foo((New MyClazz() With {.Field = 21}.Field), Await Task.Factory.StartNew(Function() 21)) + Return Goo((New MyClazz() With {.Field = 21}.Field), Await Task.Factory.StartNew(Function() 21)) End Function End Class @@ -7168,11 +7168,11 @@ Imports System.Threading.Tasks Structure S1 Public X As Integer - Public Async Sub Foo1() + Public Async Sub Goo1() Bar(Me, Await Task(Of Integer).FromResult(42)) End Sub - Public Sub Foo2() + Public Sub Goo2() Bar(Me, 42) End Sub @@ -7184,11 +7184,11 @@ End Structure Class C1 Public X As Integer - Public Async Sub Foo1() + Public Async Sub Goo1() Bar(Me, Await Task(Of Integer).FromResult(42)) End Sub - Public Sub Foo2() + Public Sub Goo2() Bar(Me, 42) End Sub @@ -7206,14 +7206,14 @@ Module Form1 If True Then Dim s As S1 s.X = -1 - s.Foo1() + s.Goo1() Console.Write(s.X) Console.Write(" ") End If If True Then Dim s As S1 s.X = -1 - s.Foo2() + s.Goo2() Console.Write(s.X) Console.Write(" ") End If @@ -7227,14 +7227,14 @@ Module Form1 If True Then Dim s As New C1 s.X = -1 - s.Foo1() + s.Goo1() Console.Write(s.X) Console.Write(" ") End If If True Then Dim s As New C1 s.X = -1 - s.Foo2() + s.Goo2() Console.Write(s.X) Console.Write(" ") End If diff --git a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenClosureLambdaTests.vb b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenClosureLambdaTests.vb index 65ada1bba31d8..4aa5b85e37379 100644 --- a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenClosureLambdaTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenClosureLambdaTests.vb @@ -232,7 +232,7 @@ Imports System Module M1 Class C1 - public Sub Foo() + public Sub Goo() Dim X as integer = 3 Dim d1 As Action = Sub() @@ -247,12 +247,12 @@ Module M1 Public Sub Main() Dim x as C1 = New C1 - x.Foo() + x.Goo() End Sub End Module , expectedOutput:="36") - c.VerifyIL("M1.C1.Foo", , expectedOutput:="36"). - VerifyIL("M1.C1.Foo", + VerifyIL("M1.C1.Goo", , expectedOutput:="12 21"). - VerifyIL("M1.C1.Foo", + VerifyIL("M1.C1.Goo", 0 ' this one is valid Dim d2 As Action = Sub() @@ -569,7 +569,7 @@ label1: Public Sub Main() Dim x as C1 = New C1 - x.Foo(3) + x.Goo(3) End Sub End Module @@ -586,7 +586,7 @@ Imports System Module M1 Class C1 - public Sub Foo(x as integer) + public Sub Goo(x as integer) if x > 0 ' this one is valid goto label0 @@ -611,7 +611,7 @@ label1: Public Sub Main() Dim x as C1 = New C1 - x.Foo(3) + x.Goo(3) End Sub End Module @@ -628,7 +628,7 @@ Imports System Module M1 Class C1 - public Sub Foo(x as integer) + public Sub Goo(x as integer) if x > 0 ' this one is valid Dim d2 As Action = Sub() @@ -655,7 +655,7 @@ label1: Public Sub Main() Dim x as C1 = New C1 - x.Foo(3) + x.Goo(3) End Sub End Module @@ -671,7 +671,7 @@ Imports System Module M1 Class C1 - public Sub Foo(x as integer) + public Sub Goo(x as integer) if x < 0 ' this one is valid Dim d2 As Action = Sub() @@ -703,7 +703,7 @@ label1: Public Sub Main() Dim x as C1 = New C1 - x.Foo(3) + x.Goo(3) End Sub End Module @@ -721,7 +721,7 @@ Imports System Module M1 Class C1 - public Sub Foo(x as integer) + public Sub Goo(x as integer) if x < 0 ' this one is valid Dim d2 As Action = Sub() @@ -756,7 +756,7 @@ label1: Public Sub Main() Dim x as C1 = New C1 - x.Foo(3) + x.Goo(3) End Sub End Module @@ -774,7 +774,7 @@ Imports System Module M1 Class C1 - public Sub Foo(x as integer) + public Sub Goo(x as integer) While x < 0 ' this one is valid Dim d2 As Action = Sub() @@ -810,7 +810,7 @@ label1: Public Sub Main() Dim x as C1 = New C1 - x.Foo(3) + x.Goo(3) End Sub End Module @@ -828,7 +828,7 @@ Imports System Module M1 Class C1 - public Sub Foo(x as integer) + public Sub Goo(x as integer) if x < 0 ' this one is valid Dim d2 As Action = Sub() @@ -866,7 +866,7 @@ label1: Public Sub Main() Dim x as C1 = New C1 - x.Foo(3) + x.Goo(3) End Sub End Module @@ -884,7 +884,7 @@ Imports System Module M1 Class C1 - public Sub Foo(x as integer) + public Sub Goo(x as integer) if x < 0 ' this one is valid Dim d2 As Action = Sub() @@ -941,7 +941,7 @@ label2: Public Sub Main() Dim x as C1 = New C1 - x.Foo(3) + x.Goo(3) End Sub End Module @@ -960,7 +960,7 @@ Imports System Module M1 Class C1 - public Sub Foo(x as integer) + public Sub Goo(x as integer) if x < 0 ' this one is valid Dim d2 As Action = Sub() @@ -1014,7 +1014,7 @@ label2: Public Sub Main() Dim x as C1 = New C1 - x.Foo(3) + x.Goo(3) End Sub End Module @@ -1036,7 +1036,7 @@ Module M1 Class C1 Shared X as integer - public Sub Foo(of T)() + public Sub Goo(of T)() Dim d1 As Action = Sub() Console.Write(X) End Sub @@ -1048,12 +1048,12 @@ Module M1 Public Sub Main() Dim x as C1 = New C1 - x.Foo(of Integer)() + x.Goo(of Integer)() End Sub End Module , expectedOutput:="05"). - VerifyIL("M1.C1.Foo", + VerifyIL("M1.C1.Goo", , expectedOutput:="05"). - VerifyIL("M1.C1.Foo", + VerifyIL("M1.C1.Goo", , expectedOutput:="042"). - VerifyIL("M1.C1.Foo", + VerifyIL("M1.C1.Goo", , expectedOutput:="420"). - VerifyIL("M1.C1.Foo", + VerifyIL("M1.C1.Goo", @@ -1344,7 +1344,7 @@ Imports System Module M1 Class C1 - public shared Sub Foo(of T)(p as T) + public shared Sub Goo(of T)(p as T) Dim d1 As Action = Sub() Dim X as T = p @@ -1365,7 +1365,7 @@ Module M1 End Class Public Sub Main() - C1.Foo(of Integer)(42) + C1.Goo(of Integer)(42) End Sub End Module @@ -1405,7 +1405,7 @@ Imports System Module M1 Class C1 - public shared Sub Foo(of T, U)(p as T, p1 as U) + public shared Sub Goo(of T, U)(p as T, p1 as U) Dim d1 As Action = Sub() Dim X as T = p Dim d2 As Action = Sub() @@ -1429,12 +1429,12 @@ Module M1 End Class Public Sub Main() - C1.Foo(of Integer, String)(42, "#"c) + C1.Goo(of Integer, String)(42, "#"c) End Sub End Module , expectedOutput:="42#0#42#0#0#0#"). - VerifyIL("M1.C1.Foo", + VerifyIL("M1.C1.Goo", @@ -1552,7 +1552,7 @@ Module M1 Console.Write(y.ToString()) End Sub - Public Sub Foo(Of TFun1, TFun2)(p As TFun1, p1 As TFun2) + Public Sub Goo(Of TFun1, TFun2)(p As TFun1, p1 As TFun2) Dim d1 As Action = Sub() Dim d2 As Action(Of TFun1) = Sub(X As TFun1) Print(Of TFun1)(X) @@ -1576,7 +1576,7 @@ Module M1 Public Sub Main() Dim inst As New C1(Of Integer) - inst.Foo(Of Integer, Integer)(42, 333) + inst.Goo(Of Integer, Integer)(42, 333) End Sub End Module @@ -1842,7 +1842,7 @@ Imports System Module M1 Class C1 - public Sub Foo(ByRef x as integer) + public Sub Goo(ByRef x as integer) if x > 0 ' this one is valid Dim d2 As Action = Sub() @@ -1854,7 +1854,7 @@ Module M1 Public Sub Main() Dim x as C1 = New C1 - x.Foo(3) + x.Goo(3) End Sub End Module @@ -1872,7 +1872,7 @@ Imports System Module M1 Structure C1 - public Sub Foo(ByVal x as integer) + public Sub Goo(ByVal x as integer) if x > 0 ' this one is valid Dim d2 As Action = Sub() @@ -1884,7 +1884,7 @@ Module M1 Public Sub Main() Dim x as C1 = New C1 - x.Foo(3) + x.Goo(3) End Sub End Module @@ -1907,7 +1907,7 @@ Imports System Module M1 Class C1 - Public Sub Foo(ByVal p As Integer) + Public Sub Goo(ByVal p As Integer) Dim lifted As ArgIterator = Nothing If p > 0 Then ' this one is valid @@ -1920,7 +1920,7 @@ Module M1 Public Sub Main() Dim x As C1 = New C1 - x.Foo(3) + x.Goo(3) End Sub End Module @@ -2221,7 +2221,7 @@ Class C Shared Sub Main() End Sub - Sub foo(x As Integer) + Sub goo(x As Integer) Dim A As action = Sub() Console.WriteLine(x) A() @@ -2232,7 +2232,7 @@ Class C End Class , expectedOutput:=""). - VerifyIL("C.foo", + VerifyIL("C.goo", Imports System Class Program - Shared Function Foo(x As Action) As Boolean + Shared Function Goo(x As Action) As Boolean x() Return True End Function @@ -2275,7 +2275,7 @@ Class Program Try Throw New Exception("blah") - Catch ex When Foo(Sub() + Catch ex When Goo(Sub() Try Throw New Exception("pass") Catch ex @@ -2549,7 +2549,7 @@ End Class Imports System Class Program - Shared Function Foo(x As Action) As Boolean + Shared Function Goo(x As Action) As Boolean x() Return True End Function @@ -2560,7 +2560,7 @@ Class Program Try Throw New Exception("_try") - Catch ex As Exception When Foo(Sub() + Catch ex As Exception When Goo(Sub() ex = New Exception(ex.Message & "_filter") End Sub) @@ -2605,7 +2605,7 @@ End Class IL_002b: ldloc.1 IL_002c: ldftn "Sub Program._Closure$__2-0._Lambda$__0()" IL_0032: newobj "Sub System.Action..ctor(Object, System.IntPtr)" - IL_0037: call "Function Program.Foo(System.Action) As Boolean" + IL_0037: call "Function Program.Goo(System.Action) As Boolean" IL_003c: ldc.i4.0 IL_003d: cgt.un IL_003f: endfilter @@ -2701,7 +2701,7 @@ End Class Imports System Class Program - Shared Function Foo(x As Action) As Boolean + Shared Function Goo(x As Action) As Boolean x() Return True End Function @@ -2710,7 +2710,7 @@ Class Program Try Throw New Exception("blah") - Catch ex As Exception When Foo(Sub() + Catch ex As Exception When Goo(Sub() Try Throw New Exception("pass") Catch ex @@ -2756,7 +2756,7 @@ End Class IL_002b: ldloc.0 IL_002c: ldftn "Sub Program._Closure$__2-0._Lambda$__0()" IL_0032: newobj "Sub System.Action..ctor(Object, System.IntPtr)" - IL_0037: call "Function Program.Foo(System.Action) As Boolean" + IL_0037: call "Function Program.Goo(System.Action) As Boolean" IL_003c: ldc.i4.0 IL_003d: cgt.un IL_003f: endfilter @@ -3042,7 +3042,7 @@ Module Generics Sub Main() System.Console.WriteLine("======== Generic-12 ===========") - Test12_Helper("foo") + Test12_Helper("goo") End Sub Sub Test12_Helper(Of T)(ByVal value As T) @@ -3095,7 +3095,7 @@ Module Generics Sub Main() System.Console.WriteLine("======== Generic-14 ===========") - Test14_Helper(Of String)("foo") + Test14_Helper(Of String)("goo") End Sub @@ -3401,12 +3401,12 @@ Module Program End Sub Class cls1 - Public foo As Integer = 42 + Public goo As Integer = 42 Public Function bar() If T Dim a As Func(Of Integer, Boolean) = Function(s) - Return s = foo andalso (Function() s = foo).Invoke + Return s = goo andalso (Function() s = goo).Invoke End Function Return a.Invoke(42) @@ -3416,7 +3416,7 @@ Module Program if T Dim a As Func(Of Integer, Boolean) = Function(s) - Return aaa = foo + Return aaa = goo End Function Return a.Invoke(42) diff --git a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenCtorInitializers.vb b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenCtorInitializers.vb index 2367731607735..3cd3773d1de0e 100644 --- a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenCtorInitializers.vb +++ b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenCtorInitializers.vb @@ -324,11 +324,11 @@ Module Program Class c1 Public shared readonly Property p1 As Integer Shared Sub New() - p1 += Foo + p1 += Goo End Sub End Class - function Foo() as integer + function Goo() as integer System.Console.Write("hello") return 42 end function @@ -348,7 +348,7 @@ expectedOutput:= // Code size 17 (0x11) .maxstack 2 IL_0000: call "Function Program.c1.get_p1() As Integer" - IL_0005: call "Function Program.Foo() As Integer" + IL_0005: call "Function Program.Goo() As Integer" IL_000a: add.ovf IL_000b: stsfld "Program.c1._p1 As Integer" IL_0010: ret @@ -365,11 +365,11 @@ Module Program Class c1 Public readonly Property p1 As Integer Public Sub New() - foo(p1) + goo(p1) End Sub End Class - sub foo(byref x as integer) + sub goo(byref x as integer) x = 42 end sub @@ -394,7 +394,7 @@ expectedOutput:= IL_0007: call "Function Program.c1.get_p1() As Integer" IL_000c: stloc.0 IL_000d: ldloca.s V_0 - IL_000f: call "Sub Program.foo(ByRef Integer)" + IL_000f: call "Sub Program.goo(ByRef Integer)" IL_0014: ldarg.0 IL_0015: ldloc.0 IL_0016: stfld "Program.c1._p1 As Integer" @@ -411,10 +411,10 @@ expectedOutput:= Module Program class c1 Public readonly Property p1 As Integer - Public readonly Property p2 As Integer = foo(p1) + Public readonly Property p2 As Integer = goo(p1) End class - function foo(byref x as integer) + function goo(byref x as integer) x = 42 return 1 end function @@ -441,7 +441,7 @@ expectedOutput:= IL_0008: call "Function Program.c1.get_p1() As Integer" IL_000d: stloc.0 IL_000e: ldloca.s V_0 - IL_0010: call "Function Program.foo(ByRef Integer) As Object" + IL_0010: call "Function Program.goo(ByRef Integer) As Object" IL_0015: ldarg.0 IL_0016: ldloc.0 IL_0017: stfld "Program.c1._p1 As Integer" @@ -460,10 +460,10 @@ expectedOutput:= Module Program class c1 Public shared readonly Property p1 As Integer = 3 - Public shared readonly p2 As Integer = foo(p1) + Public shared readonly p2 As Integer = goo(p1) End class - function foo(byref x as integer) + function goo(byref x as integer) x = 42 return 1 end function @@ -487,7 +487,7 @@ expectedOutput:= IL_0006: call "Function Program.c1.get_p1() As Integer" IL_000b: stloc.0 IL_000c: ldloca.s V_0 - IL_000e: call "Function Program.foo(ByRef Integer) As Object" + IL_000e: call "Function Program.goo(ByRef Integer) As Object" IL_0013: ldloc.0 IL_0014: stsfld "Program.c1._p1 As Integer" IL_0019: call "Function Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(Object) As Integer" @@ -505,10 +505,10 @@ expectedOutput:= Module Program class c1 Public shared readonly Property p1 As Integer = 3 - Public readonly property p2 As Integer = foo(p1) + Public readonly property p2 As Integer = goo(p1) End class - function foo(byref x as integer) + function goo(byref x as integer) x = 42 return 1 end function @@ -534,7 +534,7 @@ expectedOutput:= IL_0007: call "Function Program.c1.get_p1() As Integer" IL_000c: stloc.0 IL_000d: ldloca.s V_0 - IL_000f: call "Function Program.foo(ByRef Integer) As Object" + IL_000f: call "Function Program.goo(ByRef Integer) As Object" IL_0014: call "Function Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(Object) As Integer" IL_0019: stfld "Program.c1._p2 As Integer" IL_001e: ret @@ -554,7 +554,7 @@ Module Program Public readonly Property p1 As Integer Public Sub New() Dim o as object = new Late - o.foo(p1) + o.goo(p1) End Sub End Class @@ -564,7 +564,7 @@ Module Program End Sub class Late - sub foo(byref x as integer) + sub goo(byref x as integer) x = 42 end sub end class @@ -585,7 +585,7 @@ expectedOutput:= IL_0001: call "Sub Object..ctor()" IL_0006: newobj "Sub Program.Late..ctor()" IL_000b: ldnull - IL_000c: ldstr "foo" + IL_000c: ldstr "goo" IL_0011: ldc.i4.1 IL_0012: newarr "Object" IL_0017: dup diff --git a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenDelegateCreation.vb b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenDelegateCreation.vb index ecaba0855bf9f..b253c346e02c7 100644 --- a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenDelegateCreation.vb +++ b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenDelegateCreation.vb @@ -551,12 +551,12 @@ Imports System Delegate Sub SubDel(p As String) Class C2 - Public Shared Sub foo(p as string) + Public Shared Sub goo(p as string) end sub Public Sub AssignDelegates() - Dim v1 As System.Delegate = AddressOf foo - Dim v2 As System.MulticastDelegate = AddressOf C2.foo + Dim v1 As System.Delegate = AddressOf goo + Dim v2 As System.MulticastDelegate = AddressOf C2.goo End Sub End Class @@ -567,10 +567,10 @@ End Class CompilationUtils.AssertTheseDiagnostics(c1, BC30939: 'AddressOf' expression cannot be converted to '[Delegate]' because type '[Delegate]' is declared 'MustInherit' and cannot be created. - Dim v1 As System.Delegate = AddressOf foo + Dim v1 As System.Delegate = AddressOf goo ~~~~~~~~~~~~~ BC30939: 'AddressOf' expression cannot be converted to 'MulticastDelegate' because type 'MulticastDelegate' is declared 'MustInherit' and cannot be created. - Dim v2 As System.MulticastDelegate = AddressOf C2.foo + Dim v2 As System.MulticastDelegate = AddressOf C2.goo ~~~~~~~~~~~~~~~~ ) End Sub @@ -592,11 +592,11 @@ BC30939: 'AddressOf' expression cannot be converted to 'MulticastDelegate' becau field = param end sub - public sub foo() + public sub goo() console.writeline("Hello " & Me.field) end sub - public shared sub foo2() + public shared sub goo2() console.writeline("... and again.") end sub @@ -609,10 +609,10 @@ BC30939: 'AddressOf' expression cannot be converted to 'MulticastDelegate' becau x Dim c as new C1("again.") - Dim y as new D(addressof c.foo) + Dim y as new D(addressof c.goo) y - Dim z as new D(addressof C1.foo2) + Dim z as new D(addressof C1.goo2) z End Sub Public Sub Method() @@ -1862,7 +1862,7 @@ Module M Console.WriteLine("ByRefParamArraySubOfBase returned: " & arr2(0).field & " " & arr2(1).field) ' testing Delegate Sub(ByRef x as Base()) with - ' Sub foo (ByRef ParamArray x as Base()) + ' Sub goo (ByRef ParamArray x as Base()) dim d5 as ByRefArrayOfBase = addressof DelegateByRefParamArray.ByRefParamArraySubOfBase Dim arr3(1) as DelegateByRefParamArray_Base arr3(0) = new DelegateByRefParamArray_Base(1) @@ -2026,12 +2026,12 @@ End Class Module Module1 Delegate Function MyDelegate() as Derived - Public Function foo() as Base + Public Function goo() as Base return new Derived() End Function Sub Main() - Dim x1 As new MyDelegate(AddressOf foo) + Dim x1 As new MyDelegate(AddressOf goo) Console.WriteLine(x1()) End Sub @@ -2047,7 +2047,7 @@ Derived CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.ReleaseExe.WithOptionStrict(OptionStrict.Custom)). AssertTheseDiagnostics( BC42016: Implicit conversion from 'Base' to 'Derived'. - Dim x1 As new MyDelegate(AddressOf foo) + Dim x1 As new MyDelegate(AddressOf goo) ~~~~~~~~~~~~~ ) End Sub @@ -2100,10 +2100,10 @@ Module M1 Console.WriteLine(x) End Sub - Delegate Sub Foo(p as Byte) + Delegate Sub Goo(p as Byte) Sub Main() - Dim x As new Foo(AddressOf Bar(Of String)) + Dim x As new Goo(AddressOf Bar(Of String)) x.Invoke(23) End Sub End Module @@ -2415,8 +2415,8 @@ P1 Imports System Module Test - Sub foo(x As Func(Of Exception, Exception), y As Func(Of Exception, ArgumentException), z As Func(Of Exception, ArgumentException), a As Func(Of Exception, Exception), b As Func(Of ArgumentException, Exception), c As Func(Of ArgumentException, Exception)) - Console.WriteLine("foo") + Sub goo(x As Func(Of Exception, Exception), y As Func(Of Exception, ArgumentException), z As Func(Of Exception, ArgumentException), a As Func(Of Exception, Exception), b As Func(Of ArgumentException, Exception), c As Func(Of ArgumentException, Exception)) + Console.WriteLine("goo") End Sub Sub Main() Dim f1 As Func(Of Exception, ArgumentException) = Function(a As Exception) New ArgumentException() @@ -2426,7 +2426,7 @@ Module Test f = f1 f1 = f2 f2 = f1 - foo(f1, f1, f1, f1, f2, f2) + goo(f1, f1, f1, f1, f2, f2) End Sub End Module @@ -2469,7 +2469,7 @@ Imports System.Collections.Generic ' VB has different behavior between whether the below class is generic ' or non-generic. The below code produces no errors. However, if I get ' rid of the "(Of T, U)" bit in the below line, the code suddenly -' starts reporting error BC30794 (No 'foo' is most specific). +' starts reporting error BC30794 (No 'goo' is most specific). Public Class Runner(Of T, U) Delegate Function Del1(Of TT, UU)( x As TT, @@ -2483,7 +2483,7 @@ Public Class Runner(Of T, U) 'Most specific overload in Dev10 VB 'In Dev10 C# this overload is less specific - but in Dev10 VB this is (strangely) more specific - Sub foo(Of TT, UU, VV)( + Sub goo(Of TT, UU, VV)( xx As TT, yy As UU, zz As VV) @@ -2492,7 +2492,7 @@ Public Class Runner(Of T, U) 'Can bind to this overload - but above overload is more specific in Dev10 VB 'In Dev10 C# this overload is more specific - but in Dev10 VB this is (strangely) less specific - Sub foo(Of TT, UU, VV)( + Sub goo(Of TT, UU, VV)( x As Func(Of TT, List(Of TT), UU, Dictionary(Of List(Of TT), UU)), y As Del1(Of UU, VV), z As Action(Of VV, List(Of VV), Dictionary(Of List(Of VV), TT))) @@ -2500,7 +2500,7 @@ Public Class Runner(Of T, U) End Sub 'Unrelated overload - Sub foo(Of TT, UU, VV)( + Sub goo(Of TT, UU, VV)( x As Func(Of TT, UU, VV), y As Func(Of UU, VV, TT), z As Func(Of VV, TT, UU)) @@ -2508,8 +2508,8 @@ Public Class Runner(Of T, U) End Sub Public Sub Run(Of AA, BB, CC)() - Dim d As Del2(Of AA, BB, CC) = AddressOf foo - Dim d2 As Del2(Of Long, Long, Long) = AddressOf foo + Dim d As Del2(Of AA, BB, CC) = AddressOf goo + Dim d2 As Del2(Of Long, Long, Long) = AddressOf goo d(Nothing, Nothing, Nothing) d2(Nothing, Nothing, Nothing) End Sub @@ -2552,7 +2552,7 @@ Class Runner(Of T, U) z As Action(Of VV, List(Of VV), Dictionary(Of List(Of VV), TT))) 'Should bind to this overload - Sub foo(Of TT, UU, VV)( + Sub goo(Of TT, UU, VV)( x As Func(Of TT, List(Of TT), UU, Dictionary(Of List(Of TT), UU)), y As Del1(Of UU, VV), z As Action(Of VV, List(Of VV), Dictionary(Of List(Of VV), TT))) @@ -2560,7 +2560,7 @@ Class Runner(Of T, U) End Sub 'Unrelated overload - Sub foo(Of TT, UU, VV)( + Sub goo(Of TT, UU, VV)( x As Func(Of TT, UU, VV), y As Func(Of UU, VV, TT), z As Func(Of VV, TT, UU)) @@ -2568,8 +2568,8 @@ Class Runner(Of T, U) End Sub Public Sub Run(Of AA, BB, CC)() - Dim d As Del2(Of AA, BB, CC) = AddressOf foo - Dim d2 As Del2(Of Long, Long, Long) = AddressOf foo + Dim d As Del2(Of AA, BB, CC) = AddressOf goo + Dim d2 As Del2(Of Long, Long, Long) = AddressOf goo d(Nothing, Nothing, Nothing) d2(Nothing, Nothing, Nothing) End Sub @@ -2612,7 +2612,7 @@ Class Runner(Of T, U) z As Action(Of VV, List(Of VV), Dictionary(Of List(Of VV), TT))) 'Should bind to this overload - Sub foo(Of TT, UU, VV)( + Sub goo(Of TT, UU, VV)( xx As TT, yy As UU, zz As VV) @@ -2620,7 +2620,7 @@ Class Runner(Of T, U) End Sub 'Unrelated overload - Sub foo(Of TT, UU, VV)( + Sub goo(Of TT, UU, VV)( x As Func(Of TT, UU, VV), y As Func(Of UU, VV, TT), z As Func(Of VV, TT, UU)) @@ -2628,8 +2628,8 @@ Class Runner(Of T, U) End Sub Public Sub Run(Of AA, BB, CC)() - Dim d As Del2(Of AA, BB, CC) = AddressOf foo - Dim d2 As Del2(Of Long, Long, Long) = AddressOf foo + Dim d As Del2(Of AA, BB, CC) = AddressOf goo + Dim d2 As Del2(Of Long, Long, Long) = AddressOf goo d(Nothing, Nothing, Nothing) d2(Nothing, Nothing, Nothing) End Sub @@ -2696,7 +2696,7 @@ Option Strict Off End Class Class C3 - Public Shared Sub foo(Optional ByVal y As C1 = Nothing) + Public Shared Sub goo(Optional ByVal y As C1 = Nothing) res1 = "Correct Method called" if y is nothing then @@ -2705,19 +2705,19 @@ Option Strict Off End Sub - Public shared sub foo(arg as integer) + Public shared sub goo(arg as integer) End Sub End Class - Delegate Sub foo6(ByVal arg As Long) + Delegate Sub goo6(ByVal arg As Long) Friend Module DelOverl0020mod Public res1 As String Sub Main() - Dim d6 As foo6 = AddressOf c3.foo + Dim d6 As goo6 = AddressOf c3.goo d6(5L) System.Console.WriteLine(res1) End Sub @@ -2732,15 +2732,15 @@ Option Strict Off { // Code size 32 (0x20) .maxstack 2 - .locals init (foo6 V_0) //d6 + .locals init (goo6 V_0) //d6 IL_0000: ldnull IL_0001: ldftn "Sub DelOverl0020mod._Lambda$__1(Long)" - IL_0007: newobj "Sub foo6..ctor(Object, System.IntPtr)" + IL_0007: newobj "Sub goo6..ctor(Object, System.IntPtr)" IL_000c: stloc.0 IL_000d: ldloc.0 IL_000e: ldc.i4.5 IL_000f: conv.i8 - IL_0010: callvirt "Sub foo6.Invoke(Long)" + IL_0010: callvirt "Sub goo6.Invoke(Long)" IL_0015: ldsfld "DelOverl0020mod.res1 As String" IL_001a: call "Sub System.Console.WriteLine(String)" IL_001f: ret @@ -2751,7 +2751,7 @@ Option Strict Off // Code size 7 (0x7) .maxstack 1 IL_0000: ldnull - IL_0001: call "Sub C3.foo(C1)" + IL_0001: call "Sub C3.goo(C1)" IL_0006: ret } ]]>) @@ -2761,10 +2761,10 @@ Option Strict Off AssertTheseDiagnostics(compilation, -BC30950: No accessible method 'foo' has a signature compatible with delegate 'Delegate Sub foo6(arg As Long)': - 'Public Shared Sub foo([y As C1 = Nothing])': Argument matching parameter 'y' narrows from 'Long' to 'C1'. - 'Public Shared Sub foo(arg As Integer)': Argument matching parameter 'arg' narrows from 'Long' to 'Integer'. - Dim d6 As foo6 = AddressOf c3.foo +BC30950: No accessible method 'goo' has a signature compatible with delegate 'Delegate Sub goo6(arg As Long)': + 'Public Shared Sub goo([y As C1 = Nothing])': Argument matching parameter 'y' narrows from 'Long' to 'C1'. + 'Public Shared Sub goo(arg As Integer)': Argument matching parameter 'arg' narrows from 'Long' to 'Integer'. + Dim d6 As goo6 = AddressOf c3.goo ~~~~~~ ) #End If @@ -2780,21 +2780,21 @@ Imports System Class C1 Event e As Action(Of Exception) - Sub Foo(ParamArray x() As Integer) Handles MyClass.e + Sub Goo(ParamArray x() As Integer) Handles MyClass.e End Sub Sub Test() - Dim e1 As Action(Of Exception) = AddressOf Foo + Dim e1 As Action(Of Exception) = AddressOf Goo End Sub End Class Class C2 Event e As Action(Of Exception) - Sub Foo(Optional x As Integer = 2) Handles MyClass.e + Sub Goo(Optional x As Integer = 2) Handles MyClass.e End Sub Sub Test() - Dim e1 As Action(Of Exception) = AddressOf Foo + Dim e1 As Action(Of Exception) = AddressOf Goo End Sub End Class @@ -2804,17 +2804,17 @@ End Class AssertTheseDiagnostics(compilation, -BC31029: Method 'Foo' cannot handle event 'e' because they do not have a compatible signature. - Sub Foo(ParamArray x() As Integer) Handles MyClass.e +BC31029: Method 'Goo' cannot handle event 'e' because they do not have a compatible signature. + Sub Goo(ParamArray x() As Integer) Handles MyClass.e ~ -BC31143: Method 'Public Sub Foo(ParamArray x As Integer())' does not have a signature compatible with delegate 'Delegate Sub Action(Of Exception)(obj As Exception)'. - Dim e1 As Action(Of Exception) = AddressOf Foo +BC31143: Method 'Public Sub Goo(ParamArray x As Integer())' does not have a signature compatible with delegate 'Delegate Sub Action(Of Exception)(obj As Exception)'. + Dim e1 As Action(Of Exception) = AddressOf Goo ~~~ -BC31029: Method 'Foo' cannot handle event 'e' because they do not have a compatible signature. - Sub Foo(Optional x As Integer = 2) Handles MyClass.e +BC31029: Method 'Goo' cannot handle event 'e' because they do not have a compatible signature. + Sub Goo(Optional x As Integer = 2) Handles MyClass.e ~ -BC31143: Method 'Public Sub Foo([x As Integer = 2])' does not have a signature compatible with delegate 'Delegate Sub Action(Of Exception)(obj As Exception)'. - Dim e1 As Action(Of Exception) = AddressOf Foo +BC31143: Method 'Public Sub Goo([x As Integer = 2])' does not have a signature compatible with delegate 'Delegate Sub Action(Of Exception)(obj As Exception)'. + Dim e1 As Action(Of Exception) = AddressOf Goo ~~~ ) End Sub diff --git a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenEvents.vb b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenEvents.vb index 0377f3b1f56d5..3cfce94a35fe2 100644 --- a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenEvents.vb +++ b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenEvents.vb @@ -979,13 +979,13 @@ Class cls End Class Module Program - Sub foo(ByVal x As String) + Sub goo(ByVal x As String) Console.WriteLine("{0}", x) End Sub Sub Main(args As String()) - AddHandler ev1, AddressOf foo - AddHandler ev1, AddressOf foo + AddHandler ev1, AddressOf goo + AddHandler ev1, AddressOf goo RaiseEv1() End Sub End Module @@ -1020,22 +1020,22 @@ option strict off Imports System Public Class VBClass : Inherits CSClass Public WithEvents w As CSClass = New CSClass - Function Foo(x As String) Handles w.ev, MyBase.ev, MyClass.ev + Function Goo(x As String) Handles w.ev, MyBase.ev, MyClass.ev Console.WriteLine(x) Console.WriteLine("PASS") Return 0 End Function - Function Foo(x As String, ParamArray y() As Integer) Handles w.ev, MyBase.ev, MyClass.ev + Function Goo(x As String, ParamArray y() As Integer) Handles w.ev, MyBase.ev, MyClass.ev Console.WriteLine(x) Console.WriteLine("PASS") Return 0 End Function - Function Foo2(Optional x As String = "") Handles w.ev, MyBase.ev, MyClass.ev + Function Goo2(Optional x As String = "") Handles w.ev, MyBase.ev, MyClass.ev Console.WriteLine(x) Console.WriteLine("PASS") Return 0 End Function - Function Foo2(x As String, y() As Integer) Handles w.ev, MyBase.ev, MyClass.ev + Function Goo2(x As String, y() As Integer) Handles w.ev, MyBase.ev, MyClass.ev Console.WriteLine(x) Console.WriteLine("PASS") Return 0 @@ -1053,23 +1053,23 @@ End Module]]>, ' WARNING: Roslyn compiler produced errors while Native compiler didn't. This is an intentional breaking change, see associated bug. vbCompilation.AssertTheseDiagnostics( -BC31029: Method 'Foo' cannot handle event 'ev' because they do not have a compatible signature. - Function Foo(x As String) Handles w.ev, MyBase.ev, MyClass.ev +BC31029: Method 'Goo' cannot handle event 'ev' because they do not have a compatible signature. + Function Goo(x As String) Handles w.ev, MyBase.ev, MyClass.ev ~~ -BC31029: Method 'Foo' cannot handle event 'ev' because they do not have a compatible signature. - Function Foo(x As String) Handles w.ev, MyBase.ev, MyClass.ev +BC31029: Method 'Goo' cannot handle event 'ev' because they do not have a compatible signature. + Function Goo(x As String) Handles w.ev, MyBase.ev, MyClass.ev ~~ -BC31029: Method 'Foo' cannot handle event 'ev' because they do not have a compatible signature. - Function Foo(x As String) Handles w.ev, MyBase.ev, MyClass.ev +BC31029: Method 'Goo' cannot handle event 'ev' because they do not have a compatible signature. + Function Goo(x As String) Handles w.ev, MyBase.ev, MyClass.ev ~~ -BC31029: Method 'Foo2' cannot handle event 'ev' because they do not have a compatible signature. - Function Foo2(Optional x As String = "") Handles w.ev, MyBase.ev, MyClass.ev +BC31029: Method 'Goo2' cannot handle event 'ev' because they do not have a compatible signature. + Function Goo2(Optional x As String = "") Handles w.ev, MyBase.ev, MyClass.ev ~~ -BC31029: Method 'Foo2' cannot handle event 'ev' because they do not have a compatible signature. - Function Foo2(Optional x As String = "") Handles w.ev, MyBase.ev, MyClass.ev +BC31029: Method 'Goo2' cannot handle event 'ev' because they do not have a compatible signature. + Function Goo2(Optional x As String = "") Handles w.ev, MyBase.ev, MyClass.ev ~~ -BC31029: Method 'Foo2' cannot handle event 'ev' because they do not have a compatible signature. - Function Foo2(Optional x As String = "") Handles w.ev, MyBase.ev, MyClass.ev +BC31029: Method 'Goo2' cannot handle event 'ev' because they do not have a compatible signature. + Function Goo2(Optional x As String = "") Handles w.ev, MyBase.ev, MyClass.ev ~~ ) End Sub @@ -1092,32 +1092,32 @@ BC31029: Method 'Foo2' cannot handle event 'ev' because they do not have a compa , compilationOptions:=New VisualBasicCompilationOptions(OutputKind.ConsoleApplication), referencedCompilations:={csCompilation}) vbCompilation.VerifyDiagnostics( - Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Foo2", "ev"), - Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Foo2", "ev"), - Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Foo2", "ev"), - Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Foo2", "ev"), - Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Foo2", "ev"), - Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Foo2", "ev")) + Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Goo2", "ev"), + Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Goo2", "ev"), + Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Goo2", "ev"), + Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Goo2", "ev"), + Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Goo2", "ev"), + Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Goo2", "ev")) End Sub @@ -1331,7 +1331,7 @@ Namespace Project1 Class Sink Public WithEvents x As OuterClass - Sub foo() Handles x.SomeProperty.MyEvent + Sub goo() Handles x.SomeProperty.MyEvent Console.Write("Handled Event On SubObject!") End Sub @@ -1357,7 +1357,7 @@ End Namespace .locals init (Project1.EventSource.MyEventEventHandler V_0, Project1.OuterClass V_1) IL_0000: ldarg.0 - IL_0001: ldftn "Sub Project1.Sink.foo()" + IL_0001: ldftn "Sub Project1.Sink.goo()" IL_0007: newobj "Sub Project1.EventSource.MyEventEventHandler..ctor(Object, System.IntPtr)" IL_000c: stloc.0 IL_000d: ldarg.0 @@ -1438,7 +1438,7 @@ Namespace Project1 Class Sink Public WithEvents x As OuterClass - Sub foo() Handles x.SomeProperty.MyEvent + Sub goo() Handles x.SomeProperty.MyEvent Console.Write("Handled Event On SubObject!") End Sub @@ -1463,7 +1463,7 @@ End Namespace .maxstack 2 .locals init (Project1.EventSource.MyEventEventHandler V_0) IL_0000: ldarg.0 - IL_0001: ldftn "Sub Project1.Sink.foo()" + IL_0001: ldftn "Sub Project1.Sink.goo()" IL_0007: newobj "Sub Project1.EventSource.MyEventEventHandler..ctor(Object, System.IntPtr)" IL_000c: stloc.0 IL_000d: ldarg.0 @@ -1536,7 +1536,7 @@ Namespace Project1 Class Sink Public WithEvents x As OuterClass - Sub foo() Handles x.SomeProperty.MyEvent + Sub goo() Handles x.SomeProperty.MyEvent Console.Write("Handled Event On SubObject!") End Sub @@ -1561,7 +1561,7 @@ End Namespace .maxstack 2 .locals init (Project1.EventSource.MyEventEventHandler V_0) IL_0000: ldarg.0 - IL_0001: ldftn "Sub Project1.Sink.foo()" + IL_0001: ldftn "Sub Project1.Sink.goo()" IL_0007: newobj "Sub Project1.EventSource.MyEventEventHandler..ctor(Object, System.IntPtr)" IL_000c: stloc.0 IL_000d: ldarg.0 @@ -1636,7 +1636,7 @@ Namespace Project1 Class Sink Public WithEvents x As OuterClass - Sub foo() Handles x.SomeProperty.MyEvent + Sub goo() Handles x.SomeProperty.MyEvent Console.Write("Handled Event On SubObject!") End Sub @@ -1661,7 +1661,7 @@ End Namespace .maxstack 2 .locals init (Project1.EventSource.MyEventEventHandler V_0) IL_0000: ldarg.0 - IL_0001: ldftn "Sub Project1.Sink.foo()" + IL_0001: ldftn "Sub Project1.Sink.goo()" IL_0007: newobj "Sub Project1.EventSource.MyEventEventHandler..ctor(Object, System.IntPtr)" IL_000c: stloc.0 IL_000d: ldarg.0 diff --git a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenFieldInitTests.vb b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenFieldInitTests.vb index 71667544a70dc..5ff6363fdd354 100644 --- a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenFieldInitTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenFieldInitTests.vb @@ -573,7 +573,7 @@ Class Class1(Of T) Return ff(x, p) End Function - Public Function Foo() As Integer + Public Function Goo() As Integer Return Nothing End Function diff --git a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenForLoops.vb b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenForLoops.vb index f0fabb2f0256f..e4aee6a4ccf9e 100644 --- a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenForLoops.vb +++ b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenForLoops.vb @@ -1253,13 +1253,13 @@ Public Class MyClass1 End Property Public Shared Sub Main() End Sub - Public Sub Foo() + Public Sub Goo() For i As Integer = P1(30 + i) To 30 Next End Sub End Class -, expectedOutput:="").VerifyIL("MyClass1.Foo", , expectedOutput:="").VerifyIL("MyClass1.Goo", -, expectedOutput:="").VerifyIL("MyClass1.Foo", , expectedOutput:="").VerifyIL("MyClass1.Goo", -, expectedOutput:="").VerifyIL("MyClass1.Foo1", , expectedOutput:="").VerifyIL("MyClass1.Goo1", 2, foo(X), foo(Y)) + Dim Z = If(1 > 2, goo(X), goo(Y)) End Sub - Private Function foo(ByRef p1 As String) + Private Function goo(ByRef p1 As String) p1 = "HELLO" End Function End Module @@ -680,7 +680,7 @@ End Module IL_0006: ldstr "456" IL_000b: stloc.1 IL_000c: ldloca.s V_1 - IL_000e: call "Function M1.foo(ByRef String) As Object" + IL_000e: call "Function M1.goo(ByRef String) As Object" IL_0013: call "Function System.Runtime.CompilerServices.RuntimeHelpers.GetObjectValue(Object) As Object" IL_0018: pop IL_0019: ret diff --git a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenInterfaceImplementation.vb b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenInterfaceImplementation.vb index 0bd42d33da441..64ad115dbfc65 100644 --- a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenInterfaceImplementation.vb +++ b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenInterfaceImplementation.vb @@ -71,10 +71,10 @@ Class Class1 Implements Class1.Interface1 Public Interface Interface1 - Sub Foo() + Sub Goo() End Interface - Public Sub Foo() Implements Interface1.Foo + Public Sub Goo() Implements Interface1.Goo End Sub End Class @@ -90,8 +90,8 @@ End Class Signature("Class2", "set_Bar", ".method public newslot strict specialname virtual final instance System.Void set_Bar(System.Int32 value) cil managed"), Signature("Class2", "AbcDef", ".method public newslot strict virtual final instance System.Void AbcDef() cil managed"), Signature("Class2", "Bar", ".property readwrite instance System.Int32 Bar"), - Signature("Class1+Interface1", "Foo", ".method public newslot strict abstract virtual instance System.Void Foo() cil managed"), - Signature("Class1", "Foo", ".method public newslot strict virtual final instance System.Void Foo() cil managed") + Signature("Class1+Interface1", "Goo", ".method public newslot strict abstract virtual instance System.Void Goo() cil managed"), + Signature("Class1", "Goo", ".method public newslot strict virtual final instance System.Void Goo() cil managed") }) verifier.VerifyDiagnostics() diff --git a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenIterators.vb b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenIterators.vb index 32f19141be333..8116923be788f 100644 --- a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenIterators.vb +++ b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenIterators.vb @@ -160,12 +160,12 @@ Imports System.Collections.Generic Module Module1 Sub Main() - For Each i In Foo + For Each i In Goo Console.WriteLine(i) Next End Sub - iterator function Foo as IEnumerable(of Integer) + iterator function Goo as IEnumerable(of Integer) Yield 42 End Function @@ -174,13 +174,13 @@ End Module - CompileAndVerify(source, expectedOutput:="42").VerifyIL("Module1.VB$StateMachine_1_Foo.MoveNext", ).VerifyIL("Module1.VB$StateMachine_1_Foo.IEnumerable.GetEnumerator", ).VerifyIL("Module1.VB$StateMachine_1_Goo.IEnumerable.GetEnumerator", ) @@ -235,12 +235,12 @@ Imports System.Collections.Generic Module Module1 Sub Main() - For Each i In Foo + For Each i In Goo Console.Write(i) Next End Sub - Iterator Function Foo() As IEnumerable(Of Integer) + Iterator Function Goo() As IEnumerable(Of Integer) Dim arr(1) As Integer arr(0) = 42 @@ -261,14 +261,14 @@ End Module - CompileAndVerify(source, expectedOutput:="424200979798989999").VerifyIL("Module1.VB$StateMachine_1_Foo.MoveNext", ).VerifyIL("Module1.VB$StateMachine_1_Foo.IEnumerable.GetEnumerator", ).VerifyIL("Module1.VB$StateMachine_1_Goo.IEnumerable.GetEnumerator", ) @@ -541,12 +541,12 @@ Imports System.Collections.Generic Module Module1 Sub Main() - For Each i In Foo(42) + For Each i In Goo(42) Console.WriteLine(i) Next End Sub - iterator function Foo(x as integer) as IEnumerable(of Integer) + iterator function Goo(x as integer) as IEnumerable(of Integer) Yield x End Function @@ -555,13 +555,13 @@ End Module - CompileAndVerify(source, expectedOutput:="42").VerifyIL("Module1.VB$StateMachine_1_Foo.MoveNext", - CompileAndVerify(source, expectedOutput:="12345").VerifyIL("Module1.VB$StateMachine_1_Foo.MoveNext", ).VerifyIL("Module1.VB$StateMachine_1_Foo.IEnumerable.GetEnumerator", ).VerifyIL("Module1.VB$StateMachine_1_Goo.IEnumerable.GetEnumerator", ) @@ -740,12 +740,12 @@ Imports System.Collections.Generic Module Module1 Sub Main() - For Each i In Foo() + For Each i In Goo() Console.Write(i) Next End Sub - iterator function Foo() as IEnumerable(of Integer) + iterator function Goo() as IEnumerable(of Integer) For i = 1 to 5 Yield i Next @@ -757,13 +757,13 @@ End Module - CompileAndVerify(source, expectedOutput:="12345").VerifyIL("Module1.VB$StateMachine_1_Foo.MoveNext", ).VerifyIL("Module1.VB$StateMachine_1_Foo.IEnumerable.GetEnumerator", ).VerifyIL("Module1.VB$StateMachine_1_Goo.IEnumerable.GetEnumerator", ) @@ -832,12 +832,12 @@ Imports System.Collections.Generic Module Module1 Sub Main() - For Each i In Foo() + For Each i In Goo() Console.Write(i) Next End Sub - iterator function Foo() as IEnumerable(of Integer) + iterator function Goo() as IEnumerable(of Integer) Dim x = 1 Try x += 1 @@ -857,7 +857,7 @@ End Module - CompileAndVerify(source, expectedOutput:="233").VerifyIL("Module1.VB$StateMachine_1_Foo.MoveNext", ).VerifyIL("Module1.VB$StateMachine_1_Foo.IEnumerable.GetEnumerator", ).VerifyIL("Module1.VB$StateMachine_1_Goo.IEnumerable.GetEnumerator", ) @@ -976,12 +976,12 @@ Imports System.Collections.Generic Module Module1 Sub Main() - For Each i In Foo() + For Each i In Goo() Console.Write(i.Message) Next End Sub - iterator function Foo() as IEnumerable(of Exception) + iterator function Goo() as IEnumerable(of Exception) Dim ex As exception = nothing @@ -1001,7 +1001,7 @@ End Module - CompileAndVerify(source, expectedOutput:="12").VerifyIL("Module1.VB$StateMachine_1_Foo.MoveNext", - CompileAndVerify(source, expectedOutput:="42").VerifyIL("Module1.VB$StateMachine_1_Foo.MoveNext", ).VerifyIL("Module1.Foo", ).VerifyIL("Module1.Goo", ) @@ -1494,14 +1494,14 @@ Imports System.Collections.Generic Module Module1 Sub Main() - Dim e = Foo(42) + Dim e = Goo(42) While e.MoveNext Console.WriteLine(e.Current) End While End Sub - iterator function Foo(of T)(x as T) as IEnumerator(of T) + iterator function Goo(of T)(x as T) as IEnumerator(of T) Yield x End Function @@ -1510,13 +1510,13 @@ End Module - CompileAndVerify(source, expectedOutput:="42").VerifyIL("Module1.VB$StateMachine_1_Foo(Of SM$T).MoveNext", ).VerifyIL("Module1.Foo", ).VerifyIL("Module1.Goo", ) @@ -1569,14 +1569,14 @@ End Module Dim comp = CreateCompilationWithReferences(source, {MscorlibRef_v4_0_30316_17626}, New VisualBasicCompilationOptions(OutputKind.DynamicallyLinkedLibrary)) Dim verifier = Me.CompileAndVerify(comp) - Dim il = verifier.VisualizeIL("Program.VB$StateMachine_1_Foo.GetEnumerator()") + Dim il = verifier.VisualizeIL("Program.VB$StateMachine_1_Goo.GetEnumerator()") Assert.Contains("System.Environment.get_CurrentManagedThreadId()", il, StringComparison.Ordinal) End Sub @@ -1599,12 +1599,12 @@ Module Module1 Public MyStructs As MyStruct() = New MyStruct() {Nothing} Sub Main() - For Each i In Foo() + For Each i In Goo() Console.Write(i) Next End Sub - Iterator Function Foo() As IEnumerable(Of Integer) + Iterator Function Goo() As IEnumerable(Of Integer) For k = 1 To 2 With MyStructs(0) Yield 42 diff --git a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenLateBound.vb b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenLateBound.vb index 688d7c0687b5a..b53bc6072f8f4 100644 --- a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenLateBound.vb +++ b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenLateBound.vb @@ -101,11 +101,11 @@ Imports System Module Program Sub Main() Dim obj As Object = New cls1 - foo(obj.p1) 'LateSetComplex + goo(obj.p1) 'LateSetComplex Console.WriteLine(obj.P1) End Sub - Sub foo(ByRef x As Object) + Sub goo(ByRef x As Object) x = 42 End Sub @@ -148,7 +148,7 @@ expectedOutput:=). IL_001c: call "Function System.Runtime.CompilerServices.RuntimeHelpers.GetObjectValue(Object) As Object" IL_0021: stloc.1 IL_0022: ldloca.s V_1 - IL_0024: call "Sub Program.foo(ByRef Object)" + IL_0024: call "Sub Program.goo(ByRef Object)" IL_0029: ldnull IL_002a: ldstr "p1" IL_002f: ldc.i4.1 @@ -188,15 +188,15 @@ Option Strict Off Module Program Sub Main() Dim obj As Object = "hi" - cls1.foo$(obj) + cls1.goo$(obj) End Sub Class cls1 - Shared Function foo$(x As Integer) + Shared Function goo$(x As Integer) System.Console.WriteLine("int") Return Nothing End Function - Shared Function foo$(x As String) + Shared Function goo$(x As String) System.Console.WriteLine("str") Return Nothing End Function @@ -219,7 +219,7 @@ expectedOutput:=). IL_0006: ldnull IL_0007: ldtoken "Program.cls1" IL_000c: call "Function System.Type.GetTypeFromHandle(System.RuntimeTypeHandle) As System.Type" - IL_0011: ldstr "foo" + IL_0011: ldstr "goo" IL_0016: ldc.i4.1 IL_0017: newarr "Object" IL_001c: dup @@ -267,12 +267,12 @@ Imports System Module Program Sub Main() Dim obj As Object = New cls1 - obj.Foo(Of String)() - Console.WriteLine(obj.Foo(Of Integer)()) + obj.Goo(Of String)() + Console.WriteLine(obj.Goo(Of Integer)()) End Sub Class cls1 - Public Function foo(Of T)() + Public Function goo(Of T)() Console.WriteLine(GetType(T)) Return 42 End Function @@ -425,7 +425,7 @@ Module Program Dim obj As Object = New cls1 Sub Main() - foo(EvalObj(x:=EvalArg)) 'LateIndexSetComplex + goo(EvalObj(x:=EvalArg)) 'LateIndexSetComplex Console.WriteLine(obj(1)) End Sub @@ -439,7 +439,7 @@ Module Program Return obj End Function - Sub foo(ByRef x As Object) + Sub goo(ByRef x As Object) x = 40 End Sub @@ -490,7 +490,7 @@ expectedOutput:=). IL_002f: call "Function System.Runtime.CompilerServices.RuntimeHelpers.GetObjectValue(Object) As Object" IL_0034: stloc.2 IL_0035: ldloca.s V_2 - IL_0037: call "Sub Program.foo(ByRef Object)" + IL_0037: call "Sub Program.goo(ByRef Object)" IL_003c: ldloc.0 IL_003d: ldc.i4.2 IL_003e: newarr "Object" @@ -966,13 +966,13 @@ Module Program Sub Main() Dim x As Object = New cls1 Dim c As New cls1 - x.foo(c.p) + x.goo(c.p) Console.WriteLine(c.p) End Sub Class cls1 - Public Sub foo(ByRef x As Integer) + Public Sub goo(ByRef x As Integer) x += 1 End Sub @@ -1009,7 +1009,7 @@ Get IL_0005: newobj "Sub Program.cls1..ctor()" IL_000a: stloc.0 IL_000b: ldnull - IL_000c: ldstr "foo" + IL_000c: ldstr "goo" IL_0011: ldc.i4.1 IL_0012: newarr "Object" IL_0017: dup @@ -1071,13 +1071,13 @@ Module Program Sub Main() Dim x As Object = New cls1 Dim c As New cls1 - x.foo(c.p) + x.goo(c.p) Console.WriteLine(c.p) End Sub Class cls1 - Public Sub foo(ByRef x As Integer) + Public Sub goo(ByRef x As Integer) x += 1 End Sub @@ -1106,7 +1106,7 @@ Get IL_0005: newobj "Sub Program.cls1..ctor()" IL_000a: stloc.0 IL_000b: ldnull - IL_000c: ldstr "foo" + IL_000c: ldstr "goo" IL_0011: ldc.i4.1 IL_0012: newarr "Object" IL_0017: dup @@ -1143,14 +1143,14 @@ Module Program Sub Main() Dim x As Object = New cls1 Dim c As Object = New cls1 - x.foo(c.p) + x.goo(c.p) Console.WriteLine(c.p) End Sub Class cls1 - Public Sub foo(ByRef x As Integer) + Public Sub goo(ByRef x As Integer) x += 1 End Sub @@ -1187,7 +1187,7 @@ Get IL_0005: newobj "Sub Program.cls1..ctor()" IL_000a: stloc.0 IL_000b: ldnull - IL_000c: ldstr "foo" + IL_000c: ldstr "goo" IL_0011: ldc.i4.1 IL_0012: newarr "Object" IL_0017: dup @@ -1269,14 +1269,14 @@ Module Program Sub Main() Dim x As Object = New cls1 Dim c As Object = New cls1 - x.foo(c.p) + x.goo(c.p) Console.WriteLine(c.p) End Sub Class cls1 - Public Sub foo(ByRef x As Integer) + Public Sub goo(ByRef x As Integer) x += 1 End Sub @@ -1308,7 +1308,7 @@ Get IL_0005: newobj "Sub Program.cls1..ctor()" IL_000a: stloc.0 IL_000b: ldnull - IL_000c: ldstr "foo" + IL_000c: ldstr "goo" IL_0011: ldc.i4.1 IL_0012: newarr "Object" IL_0017: dup @@ -1414,7 +1414,7 @@ Module Program Dim x As Object = New cls1 Dim c As Object = New cls1 Dim v As Object = 1 - x.foo(c.p(v)) + x.goo(c.p(v)) Console.WriteLine(c.p(1)) Console.WriteLine(v) @@ -1422,7 +1422,7 @@ Module Program Class cls1 - Public Sub foo(ByRef x As Integer) + Public Sub goo(ByRef x As Integer) x += 1 End Sub @@ -1464,7 +1464,7 @@ Module Program Dim x As Object = New cls1 Dim c As Object = New cls1 Dim v As Object = 1 - x.foo((c.p(v))) + x.goo((c.p(v))) Console.WriteLine(c.p(1)) Console.WriteLine(v) @@ -1472,7 +1472,7 @@ Module Program Class cls1 - Public Sub foo(ByRef x As Integer) + Public Sub goo(ByRef x As Integer) x += 1 End Sub @@ -1522,7 +1522,7 @@ Module Program Class cls1 - Public Sub foo(ByRef x As Integer) + Public Sub goo(ByRef x As Integer) x += 1 End Sub @@ -1576,7 +1576,7 @@ Module Program Class cls1 - Public Sub foo(ByRef x As Integer) + Public Sub goo(ByRef x As Integer) x += 1 End Sub @@ -1621,7 +1621,7 @@ Module Program Dim x As Object = New cls1 Dim c As Object = New cls1 Dim v As Object = 1 - x.foo(c.foo(v)) + x.goo(c.goo(v)) Console.WriteLine(c.p(1)) Console.WriteLine(v) @@ -1629,8 +1629,8 @@ Module Program Class cls1 - Public Sub foo(ByRef x As Integer) - Console.WriteLine("foo") + Public Sub goo(ByRef x As Integer) + Console.WriteLine("goo") x += 1 End Sub @@ -1650,8 +1650,8 @@ Module Program End Module , -expectedOutput:=) @@ -1674,8 +1674,8 @@ Module Program Dim v As Object = 1 Dim v1 As Object = 5 - x.foo(c.p(v), c.p(v)) - x.foo(v1, v1) + x.goo(c.p(v), c.p(v)) + x.goo(v1, v1) Console.WriteLine(c.p(1)) Console.WriteLine(v) @@ -1684,7 +1684,7 @@ Module Program Class cls1 - Public Sub foo(ByRef x As Integer, ByRef y As Integer) + Public Sub goo(ByRef x As Integer, ByRef y As Integer) x += 1 y += 1 End Sub @@ -1728,10 +1728,10 @@ imports system Module Program Sub Main() Dim obj As Object = New cls1 - foo(obj.moo) + goo(obj.moo) End Sub - Sub foo(byref x As Integer) + Sub goo(byref x As Integer) Console.WriteLine(x) End Sub @@ -1758,19 +1758,19 @@ Imports System Class Bug257437 Shared Result As Integer - Shared Sub foo(ByVal i As Integer, ByVal b As Byte) + Shared Sub goo(ByVal i As Integer, ByVal b As Byte) Result = 1 End Sub - Shared Sub foo(ByVal i As Integer, ByVal b As Int16) + Shared Sub goo(ByVal i As Integer, ByVal b As Int16) Result = 2 End Sub - Shared Sub foo(ByVal i As Integer, ByVal b As Int32) + Shared Sub goo(ByVal i As Integer, ByVal b As Int32) Result = 3 End Sub - Shared Sub foo(ByVal i As Integer, ByVal b As String, Optional ByVal x As Integer = 1) + Shared Sub goo(ByVal i As Integer, ByVal b As String, Optional ByVal x As Integer = 1) Result = 4 End Sub @@ -1780,19 +1780,19 @@ Class Bug257437 Dim fnum Console.Write(" 1) ") - foo(fnum, CByte(255)) + goo(fnum, CByte(255)) PassFail(Result = 1) Console.Write(" 2) ") - foo(fnum, -1S) + goo(fnum, -1S) PassFail(Result = 2) Console.Write(" 3) ") - foo(fnum, -1I) + goo(fnum, -1I) PassFail(Result = 3) Console.Write(" 4) ") - foo(fnum, "abc") + goo(fnum, "abc") PassFail(Result = 4) Catch ex As Exception Failed(ex) @@ -2013,13 +2013,13 @@ Module Bug302246 Private m_ArgString As Integer Public Class Class1 - Public Sub foo(ByVal Arg As Integer, ByVal Arg2 As Integer) ', Optional ByVal Arg2 As Long = 40) + Public Sub goo(ByVal Arg As Integer, ByVal Arg2 As Integer) ', Optional ByVal Arg2 As Long = 40) m_i = 1 m_ArgInteger = Arg m_Arg2 = Arg2 End Sub - Public Sub Foo(ByVal Arg2 As Integer, ByVal Arg As String) + Public Sub Goo(ByVal Arg2 As Integer, ByVal Arg As String) m_i = 2 m_ArgString = Arg m_Arg2 = Arg2 @@ -2037,11 +2037,11 @@ Module Bug302246 Dim o As Object = c m_i = -1 - c.foo(40, Arg:=50) + c.goo(40, Arg:=50) iEarly = m_i m_i = -1 - o.foo(40, Arg:=50) 'this late bound case throws an unexpected exception - BUG + o.goo(40, Arg:=50) 'this late bound case throws an unexpected exception - BUG PassFail(m_i = iEarly AndAlso m_ArgString = "50" AndAlso m_Arg2 = 40) Catch ex As Exception @@ -2095,8 +2095,8 @@ Imports System Module Bug231364 - Delegate Sub foo(ByRef x As Short, ByRef y As Long) - Sub foo1(ByRef x As Short, Optional ByRef y As Long = 0) + Delegate Sub goo(ByRef x As Short, ByRef y As Long) + Sub goo1(ByRef x As Short, Optional ByRef y As Long = 0) y = 8 / 2 End Sub @@ -2105,7 +2105,7 @@ Module Bug231364 Try Dim var As Object - var = New foo(AddressOf foo1) + var = New goo(AddressOf goo1) var2 = 8 var3 = 10 @@ -2195,8 +2195,8 @@ Imports System Module Program1 - Delegate Sub foo(ByRef x As Short, ByRef y As Long) - Sub foo1(ByRef x As Short, Optional ByRef y As Long = 0) + Delegate Sub goo(ByRef x As Short, ByRef y As Long) + Sub goo1(ByRef x As Short, Optional ByRef y As Long = 0) y = 8 / 2 x = -1 End Sub @@ -2206,7 +2206,7 @@ Module Program1 System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.InvariantCulture Try Dim var As Object - var = New foo(AddressOf foo1) + var = New goo(AddressOf goo1) Dim var2 = 8 Dim var3 As ULong = 10 @@ -2235,11 +2235,11 @@ Imports System Module Program Sub Main() Dim obj As Object = New cls1 - obj.foo(, y:=obj.foo(, )) + obj.goo(, y:=obj.goo(, )) End Sub Class cls1 - Shared Sub foo(Optional x As Integer = 1, Optional y As Integer = 2) + Shared Sub goo(Optional x As Integer = 1, Optional y As Integer = 2) Console.WriteLine(x + y) End Sub End Class @@ -2266,7 +2266,7 @@ expectedOutput:=). Boolean() V_1) IL_0000: newobj "Sub Module1.C2..ctor()" IL_0005: ldnull - IL_0006: ldstr "foo" + IL_0006: ldstr "goo" IL_000b: ldc.i4.1 IL_000c: newarr "Object" IL_0011: dup @@ -2851,11 +2851,11 @@ End Module Class C Sub New() - Me.New(Foo(CObj(42))) + Me.New(Goo(CObj(42))) End Sub Sub New(a As Integer) - Me.New(Sub(x) Foo(x)) + Me.New(Sub(x) Goo(x)) End Sub Sub New(x As Action(Of Object)) @@ -2865,10 +2865,10 @@ Class C Sub New(x As Object) End Sub - Sub Foo(x As String) + Sub Goo(x As String) End Sub - Shared Sub Foo(x As Integer) + Shared Sub Goo(x As Integer) Console.WriteLine(x) End Sub End Class diff --git a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenMultiDimensionalArray.vb b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenMultiDimensionalArray.vb index cfabf7f95fa58..5754ecc4cb21a 100644 --- a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenMultiDimensionalArray.vb +++ b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenMultiDimensionalArray.vb @@ -242,18 +242,18 @@ End Module public Module A Public Sub Main() - foo(Of String)() - c1(Of Long).foo() + goo(Of String)() + c1(Of Long).goo() End Sub Class c1(Of T) - Public Shared Sub foo() + Public Shared Sub goo() Dim arr As T(,) = New T(1, 2) {} System.Console.Write(arr.Length) End Sub End Class - Public Sub foo(Of T)() + Public Sub goo(Of T)() Dim arr As T(,) = New T(1, 2) {} System.Console.Write(arr.Length) End Sub @@ -261,7 +261,7 @@ End Module , expectedOutput:="66"). - VerifyIL("A.foo(Of T)()", + VerifyIL("A.goo(Of T)()", public Module A Public Sub Main() - foo(Of String)("hello") - c1(Of Long).foo(123) + goo(Of String)("hello") + c1(Of Long).goo(123) End Sub Class c1(Of T) - Public Shared Sub foo(e as T) + Public Shared Sub goo(e as T) Dim arr As T(,) = New T(2, 3) {} arr(1, 2) = e @@ -299,7 +299,7 @@ public Module A End Sub End Class - Public Sub foo(Of T)(e as T) + Public Sub goo(Of T)(e as T) Dim arr As T(,) = New T(2, 3) {} arr(1, 2) = e @@ -312,7 +312,7 @@ End Module , expectedOutput:="hellohello123123"). - VerifyIL("A.foo(Of T)(T)", + VerifyIL("A.goo(Of T)(T)", @@ -1440,7 +1440,7 @@ End Class Imports System <TypeAttribute(GetType(Program(Of [String])(,)))> _ -Public Class Foo +Public Class Goo End Class Class Program(Of T) End Class diff --git a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenNullable.vb b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenNullable.vb index d66f9a6480c05..44c4ca33dbc92 100644 --- a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenNullable.vb +++ b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenNullable.vb @@ -401,10 +401,10 @@ Module MyClass1 Sub Main(args As String()) Dim x As Integer? = 0 - Console.WriteLine(x + foo(x)) + Console.WriteLine(x + goo(x)) End Sub - Function foo(ByRef v As Integer?) As Integer + Function goo(ByRef v As Integer?) As Integer v = 0 Return 42 @@ -428,7 +428,7 @@ End Module IL_0008: ldloc.0 IL_0009: stloc.1 IL_000a: ldloca.s V_0 - IL_000c: call "Function MyClass1.foo(ByRef Integer?) As Integer" + IL_000c: call "Function MyClass1.goo(ByRef Integer?) As Integer" IL_0011: stloc.2 IL_0012: ldloca.s V_1 IL_0014: call "Function Integer?.get_HasValue() As Boolean" @@ -1696,10 +1696,10 @@ Imports System Module MyClass1 Sub Main(args As String()) - foo(42) + goo(42) End Sub - Sub foo(Of T As {Structure, IComparable(Of T)})(x As T?) + Sub goo(Of T As {Structure, IComparable(Of T)})(x As T?) Dim y As IComparable(Of T) = x Console.Write(y.CompareTo(x.Value)) End Sub @@ -1707,7 +1707,7 @@ End Module , expectedOutput:="0"). - VerifyIL("MyClass1.foo", + VerifyIL("MyClass1.goo", , compilationOptions:=New VisualBasicCompilationOptions(OutputKind.DynamicallyLinkedLibrary)) Dim vb1Verifier = CompileAndVerify(vb1Compilation) @@ -180,7 +180,7 @@ End Class]]>, , @@ -203,7 +203,7 @@ End Class]]>, 'Dev10 reports an error for the below compilation - Roslyn on the other hand allows this code to compile without errors. 'VB3.vb(2) : error BC30610: Class 'C4' must either be declared 'MustInherit' or override the following inherited 'MustOverride' member(s): - 'C1 : Public MustOverride Sub foo(). + 'C1 : Public MustOverride Sub goo(). 'Public Class C4 : Inherits C3 ' ~~ Dim vb3Compilation = CreateVisualBasicCompilation("VB3", @@ -214,7 +214,7 @@ Public Class C4 : Inherits C3 Public Class C5 : Inherits C2 ' Corresponding case in C# results in PEVerify errors - See test 'CrossLanguageCase1' in CodeGenOverridingAndHiding.cs - Public Overrides Sub foo() + Public Overrides Sub goo() Console.WriteLine("C5") End Sub End Class @@ -222,9 +222,9 @@ Public Class C4 : Inherits C3 Public Module Program Sub Main() Dim x As C1 = New C4 - x.foo() + x.goo() Dim y As C2 = New C5 - y.Foo() + y.Goo() End Sub End Module]]>, compilationOptions:=New VisualBasicCompilationOptions(OutputKind.ConsoleApplication), @@ -242,7 +242,7 @@ C5]]>) 'is a bug in Dev10 that we fixed in Roslyn - the change is non-breaking. Dim vb1Compilation = CreateVisualBasicCompilation("VB1", , compilationOptions:=New VisualBasicCompilationOptions(OutputKind.DynamicallyLinkedLibrary)) Dim vb1Verifier = CompileAndVerify(vb1Compilation) @@ -253,7 +253,7 @@ C5]]>) [assembly:System.Runtime.CompilerServices.InternalsVisibleTo("VB3")] public abstract class C2 : C1 { - new internal virtual void foo() + new internal virtual void goo() { Console.WriteLine("C2"); } @@ -265,7 +265,7 @@ C5]]>) Dim vb2Compilation = CreateVisualBasicCompilation("VB2", , @@ -276,13 +276,13 @@ C5]]>) 'Dev10 reports an error for the below compilation - Roslyn on the other hand allows this code to compile without errors. 'VB3.vb(2) : error BC30610: Class 'C4' must either be declared 'MustInherit' or override the following inherited 'MustOverride' member(s): - 'C1 : Public MustOverride Sub foo(). + 'C1 : Public MustOverride Sub goo(). 'Public Class C4 : Inherits C3 ' ~~ Dim vb3Compilation = CreateVisualBasicCompilation("VB3", ) Public Module Program Sub Main() Dim x As C1 = New C4 - x.foo + x.goo Dim y As C2 = New C4 - y.foo + y.goo End Sub End Module]]>, compilationOptions:=New VisualBasicCompilationOptions(OutputKind.ConsoleApplication), @@ -309,7 +309,7 @@ C2]]>) 'Note: Dev10 and Roslyn produce identical errors for this case. Dim vb1Compilation = CreateVisualBasicCompilation("VB1", , compilationOptions:=New VisualBasicCompilationOptions(OutputKind.DynamicallyLinkedLibrary)) Dim vb1Verifier = CompileAndVerify(vb1Compilation) @@ -319,7 +319,7 @@ C2]]>) , @@ -329,7 +329,7 @@ C2]]>) Dim vb2Compilation = CreateVisualBasicCompilation("VB2", , compilationOptions:=New VisualBasicCompilationOptions(OutputKind.DynamicallyLinkedLibrary), @@ -339,31 +339,31 @@ C2]]>) Dim vb3Compilation = CreateVisualBasicCompilation("VB3", , compilationOptions:=New VisualBasicCompilationOptions(OutputKind.DynamicallyLinkedLibrary), referencedCompilations:={vb1Compilation, cs1Compilation, vb2Compilation}) vb3Compilation.AssertTheseDiagnostics( BC30610: Class 'C5' must either be declared 'MustInherit' or override the following inherited 'MustOverride' member(s): - C1: Public MustOverride Sub foo(). + C1: Public MustOverride Sub goo(). Public Class C5 : Inherits C2 ~~ -BC30266: 'Public Overrides Sub foo()' cannot override 'Friend Overridable Overloads Sub foo()' because they have different access levels. - Public Overrides Sub foo() +BC30266: 'Public Overrides Sub goo()' cannot override 'Friend Overridable Overloads Sub goo()' because they have different access levels. + Public Overrides Sub goo() ~~~ BC30610: Class 'C6' must either be declared 'MustInherit' or override the following inherited 'MustOverride' member(s): - C1: Public MustOverride Sub foo(). + C1: Public MustOverride Sub goo(). Public Class C6 : Inherits C2 ~~ ) @@ -374,7 +374,7 @@ BC30610: Class 'C6' must either be declared 'MustInherit' or override the follow Public Sub CrossLanguageTest4() Dim vb1Compilation = CreateVisualBasicCompilation("VB1", , compilationOptions:=New VisualBasicCompilationOptions(OutputKind.DynamicallyLinkedLibrary)) Dim vb1Verifier = CompileAndVerify(vb1Compilation) @@ -384,7 +384,7 @@ BC30610: Class 'C6' must either be declared 'MustInherit' or override the follow , @@ -394,7 +394,7 @@ BC30610: Class 'C6' must either be declared 'MustInherit' or override the follow Dim vb2Compilation = CreateVisualBasicCompilation("VB2", , compilationOptions:=New VisualBasicCompilationOptions(OutputKind.DynamicallyLinkedLibrary), diff --git a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenScriptTests.vb b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenScriptTests.vb index 0a735088e177b..cce4ac63e723a 100644 --- a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenScriptTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenScriptTests.vb @@ -74,7 +74,7 @@ Return 1 Public Sub MeKeyword() Dim source = -Sub Foo +Sub Goo Me.Bar End Sub @@ -82,7 +82,7 @@ Sub Bar System.Console.WriteLine(1+1) End Sub -Me.Foo +Me.Goo .Value Dim tree = VisualBasicSyntaxTree.ParseText(source, options:=TestOptions.Script) @@ -95,7 +95,7 @@ Me.Foo Public Sub MyBaseAndMyClassKeyword() Dim source = -Sub Foo +Sub Goo MyClass.Bar End Sub @@ -103,7 +103,7 @@ Sub Bar System.Console.WriteLine(1+1) End Sub -MyBase.Foo +MyBase.Goo .Value Dim tree = VisualBasicSyntaxTree.ParseText(source, options:=TestOptions.Script) @@ -116,11 +116,11 @@ MyBase.Foo Public Sub SubStatement() Dim source = -Sub Foo +Sub Goo System.Console.WriteLine(1+1) End Sub -Foo +Goo .Value Dim tree = VisualBasicSyntaxTree.ParseText(source, options:=TestOptions.Script) @@ -134,23 +134,23 @@ Foo Dim source = -Sub Foo +Sub Goo System.Console.WriteLine(1+1) End Sub - CreateCompilationWithMscorlib(source).VerifyDiagnostics(Diagnostic(ERRID.ERR_InvalidInNamespace, "Sub Foo")) + CreateCompilationWithMscorlib(source).VerifyDiagnostics(Diagnostic(ERRID.ERR_InvalidInNamespace, "Sub Goo")) End Sub Public Sub FunctionStatement() Dim source = -Function Foo As Integer +Function Goo As Integer Return 3 End Function -System.Console.WriteLine(Foo) +System.Console.WriteLine(Goo) .Value Dim tree = VisualBasicSyntaxTree.ParseText(source, options:=TestOptions.Script) diff --git a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenSelectCase.vb b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenSelectCase.vb index 70a64b8c6f975..d931c4d5c874e 100644 --- a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenSelectCase.vb +++ b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenSelectCase.vb @@ -57,23 +57,23 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests , - expectedOutput:="Foo").VerifyIL("M1.Main", -, expectedOutput:="Foo,Foo,Success").VerifyIL("M1.Main", , expectedOutput:="Goo,Goo,Success").VerifyIL("M1.Main", -, expectedOutput:="Foo,Success").VerifyIL("M1.Main", , expectedOutput:="Goo,Success").VerifyIL("M1.Main", -, expectedOutput:="Foo,Success,Success,Foo,Success").VerifyIL("M1.Main", , expectedOutput:="Goo,Success,Success,Goo,Success").VerifyIL("M1.Main", -, expectedOutput:="Foo,Foo,Success").VerifyIL("M1.Main", , expectedOutput:="Goo,Goo,Success").VerifyIL("M1.Main", -, expectedOutput:="Foo,Success").VerifyIL("M1.Main", , expectedOutput:="Goo,Success").VerifyIL("M1.Main", -, expectedOutput:="Foo,Success").VerifyIL("M1.Main", , expectedOutput:="Goo,Success").VerifyIL("M1.Main", -, expectedOutput:="Foo,Success").VerifyIL("M1.Main", , expectedOutput:="Goo,Success").VerifyIL("M1.Main", -, expectedOutput:="Foo,Success").VerifyIL("M1.Main", , expectedOutput:="Goo,Success").VerifyIL("M1.Main", "bar" Then Exit Select End If @@ -4984,7 +4984,7 @@ End Module IL_0002: ldloc.1 IL_0003: ldc.i4.s 42 IL_0005: bne.un.s IL_001f - IL_0007: ldstr "foo" + IL_0007: ldstr "goo" IL_000c: stloc.2 IL_000d: ldloc.2 IL_000e: ldstr "bar" @@ -5018,7 +5018,7 @@ Module Module1 Function boo(i As Integer) As String Select Case i Case 42 - Dim x = "foo" + Dim x = "goo" If x <> "bar" Then Exit Select End If @@ -5041,7 +5041,7 @@ End Module IL_0002: ldloc.0 IL_0003: ldc.i4.s 42 IL_0005: bne.un.s IL_0018 - IL_0007: ldstr "foo" + IL_0007: ldstr "goo" IL_000c: ldstr "bar" IL_0011: ldc.i4.0 IL_0012: call "Function Microsoft.VisualBasic.CompilerServices.Operators.CompareString(String, String, Boolean) As Integer" diff --git a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenStaticLocals.vb b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenStaticLocals.vb index 756582497369b..c28f978671122 100644 --- a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenStaticLocals.vb +++ b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenStaticLocals.vb @@ -123,13 +123,13 @@ End Module Module Module1 Sub Main() - Foo() + Goo() Bar() - Foo() + Goo() Bar() End Sub - Sub Foo() + Sub Goo() Static SLItem1 = 1 Console.WriteLine("StaticLocalInSub") Console.WriteLine(SLItem1.GetType.ToString) 'Type Inferred @@ -148,7 +148,7 @@ End Module ). - VerifyIL("Module1.Foo", ). - VerifyIL("Module1.Foo", ). - VerifyIL("Module1.foo", Dim compilation = CreateCompilationWithMscorlibAndVBRuntime(Source, TestOptions.ReleaseExe) - Dim compilationVerifier = CompileAndVerify(compilation).VerifyIL("Module1.Foo", + Dim compilationVerifier = CompileAndVerify(compilation).VerifyIL("Module1.Goo", @@ -106,7 +106,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests .maxstack 1 IL_0000: ldstr "Start" IL_0005: call "Sub System.Console.WriteLine(String)" - IL_000a: call "Sub Module1.Foo()" + IL_000a: call "Sub Module1.Goo()" IL_000f: call "Sub System.Diagnostics.Debugger.Break()" IL_0014: ldstr "End" IL_0019: call "Sub System.Console.WriteLine(String)" @@ -126,21 +126,21 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests Public Module Module1 Public Sub Main() Console.Writeline("Start") - Foo() + Goo() Console.Writeline("End") End Sub - Sub Foo - Console.Writeline("Foo") + Sub Goo + Console.Writeline("Goo") Stop End Sub End Module - ).VerifyIL("Module1.Foo", + ).VerifyIL("Module1.Goo", - CompileAndVerify(source).VerifyIL("Program.foo", Class Program - Sub foo() + Sub goo() SyncLock Me End SyncLock End Sub @@ -577,7 +577,7 @@ End Class - CompileAndVerify(source).VerifyIL("Program.foo", Class Program - Sub foo() + Sub goo() SyncLock "abc" End SyncLock End Sub @@ -621,7 +621,7 @@ End Class - CompileAndVerify(source).VerifyIL("Program.foo", Public Class Program - Public Sub foo() + Public Sub goo() Dim syncroot As Object = New Object SyncLock syncroot SyncLock syncroot.ToString() @@ -668,7 +668,7 @@ End Class - CompileAndVerify(source).VerifyIL("Program.foo", Public Class Program - Public Sub foo() + Public Sub goo() Dim syncroot As Object = New Object SyncLock syncroot SyncLock syncroot @@ -742,7 +742,7 @@ End Class - CompileAndVerify(source).VerifyIL("Program.foo", - CompileAndVerify(source).VerifyIL("D.foo", @@ -1255,7 +1255,7 @@ End Class IL_0009: ldloca.s V_1 IL_000b: call "Sub System.Threading.Monitor.Enter(Object, ByRef Boolean)" IL_0010: ldsfld "Module1.x As T1" - IL_0015: callvirt "Sub T1.foo()" + IL_0015: callvirt "Sub T1.goo()" IL_001a: leave.s IL_0026 } finally diff --git a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenTests.vb b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenTests.vb index d537bf66c9503..eb0d9dc4fe63a 100644 --- a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenTests.vb @@ -3135,17 +3135,17 @@ expectedOutput:= 1, i, e) - System.Console.Write(i.Foo()) + System.Console.Write(i.Goo()) End Sub - Interface IFoo(Of T) : Function Foo() As T : End Interface + Interface IGoo(Of T) : Function Goo() As T : End Interface - Structure FooVal : Implements IFoo(Of String) - Public Function Foo() As String Implements IFoo(Of String).Foo + Structure GooVal : Implements IGoo(Of String) + Public Function Goo() As String Implements IGoo(Of String).Goo Return "Val " End Function End Structure @@ -3156,23 +3156,23 @@ End Module ) @@ -3185,22 +3185,22 @@ End Module Public Module Program Public Sub Main() - Dim i As IFoo(Of String) = Nothing - Dim e As New FooVal() - Dim n? As FooVal = e + Dim i As IGoo(Of String) = Nothing + Dim e As New GooVal() + Dim n? As GooVal = e i = If(i, e) - System.Console.Write(i.Foo()) + System.Console.Write(i.Goo()) i = Nothing i = If(n, i) - System.Console.Write(i.Foo()) + System.Console.Write(i.Goo()) End Sub - Interface IFoo(Of T) : Function Foo() As T : End Interface + Interface IGoo(Of T) : Function Goo() As T : End Interface - Structure FooVal : Implements IFoo(Of String) - Public Function Foo() As String Implements IFoo(Of String).Foo + Structure GooVal : Implements IGoo(Of String) + Public Function Goo() As String Implements IGoo(Of String).Goo Return "Val " End Function End Structure @@ -3212,41 +3212,41 @@ End Module { // Code size 90 (0x5a) .maxstack 2 - .locals init (Program.IFoo(Of String) V_0, //i - Program.FooVal V_1, //e - Program.FooVal? V_2) //n + .locals init (Program.IGoo(Of String) V_0, //i + Program.GooVal V_1, //e + Program.GooVal? V_2) //n IL_0000: ldnull IL_0001: stloc.0 IL_0002: ldloca.s V_1 - IL_0004: initobj "Program.FooVal" + IL_0004: initobj "Program.GooVal" IL_000a: ldloca.s V_2 IL_000c: ldloc.1 - IL_000d: call "Sub Program.FooVal?..ctor(Program.FooVal)" + IL_000d: call "Sub Program.GooVal?..ctor(Program.GooVal)" IL_0012: ldloc.0 IL_0013: dup IL_0014: brtrue.s IL_0022 IL_0016: pop IL_0017: ldloc.1 - IL_0018: box "Program.FooVal" - IL_001d: castclass "Program.IFoo(Of String)" + IL_0018: box "Program.GooVal" + IL_001d: castclass "Program.IGoo(Of String)" IL_0022: stloc.0 IL_0023: ldloc.0 - IL_0024: callvirt "Function Program.IFoo(Of String).Foo() As String" + IL_0024: callvirt "Function Program.IGoo(Of String).Goo() As String" IL_0029: call "Sub System.Console.Write(String)" IL_002e: ldnull IL_002f: stloc.0 IL_0030: ldloca.s V_2 - IL_0032: call "Function Program.FooVal?.get_HasValue() As Boolean" + IL_0032: call "Function Program.GooVal?.get_HasValue() As Boolean" IL_0037: brtrue.s IL_003c IL_0039: ldloc.0 IL_003a: br.s IL_004d IL_003c: ldloca.s V_2 - IL_003e: call "Function Program.FooVal?.GetValueOrDefault() As Program.FooVal" - IL_0043: box "Program.FooVal" - IL_0048: castclass "Program.IFoo(Of String)" + IL_003e: call "Function Program.GooVal?.GetValueOrDefault() As Program.GooVal" + IL_0043: box "Program.GooVal" + IL_0048: castclass "Program.IGoo(Of String)" IL_004d: stloc.0 IL_004e: ldloc.0 - IL_004f: callvirt "Function Program.IFoo(Of String).Foo() As String" + IL_004f: callvirt "Function Program.IGoo(Of String).Goo() As String" IL_0054: call "Sub System.Console.Write(String)" IL_0059: ret } @@ -3983,7 +3983,7 @@ Class C(Of V) Console.WriteLine("Success") End Sub - Public Sub Foo(ByVal z As V) + Public Sub Goo(ByVal z As V) Me.S(z) End Sub @@ -3992,7 +3992,7 @@ End Class Module M222 Sub Main(args As String()) Dim c As New C(Of Integer) - c.Foo(1) + c.Goo(1) End Sub End Module @@ -4016,7 +4016,7 @@ Class C(Of V) Console.WriteLine("Success") End Sub - Public Sub Foo(ByVal z As V) + Public Sub Goo(ByVal z As V) Me.S(z) End Sub @@ -4025,7 +4025,7 @@ End Class Module M222 Sub Main(args As String()) Dim c As New C(Of Integer) - c.Foo(1) + c.Goo(1) End Sub End Module @@ -4049,7 +4049,7 @@ Class C(Of V) Console.WriteLine("Success") End Sub - Public Sub Foo(ByVal z As V) + Public Sub Goo(ByVal z As V) Me.S(z) End Sub @@ -4058,7 +4058,7 @@ End Class Module M222 Sub Main(args As String()) Dim c As New C(Of Integer) - c.Foo(1) + c.Goo(1) End Sub End Module @@ -4082,7 +4082,7 @@ Structure C(Of V) Console.WriteLine("Success") End Sub - Public Sub Foo(ByVal z As Integer) + Public Sub Goo(ByVal z As Integer) Me.S(z) End Sub @@ -4091,7 +4091,7 @@ End Structure Module M222 Sub Main(args As String()) Dim c As New C(Of Integer) - c.Foo(1) + c.Goo(1) End Sub End Module @@ -4114,7 +4114,7 @@ Class C Console.WriteLine("Success") End Sub - Public Sub Foo(Of V)(ByVal z As V) + Public Sub Goo(Of V)(ByVal z As V) Me.S(z) End Sub End Class @@ -4122,7 +4122,7 @@ End Class Module MMM Sub Main(args As String()) Dim c As New C - c.Foo(1) + c.Goo(1) End Sub End Module @@ -4145,7 +4145,7 @@ Structure C Console.WriteLine("Success") End Sub - Public Sub Foo(ByVal z As Integer) + Public Sub Goo(ByVal z As Integer) Me.S(z) End Sub End Structure @@ -4153,7 +4153,7 @@ End Structure Module MMM Sub Main(args As String()) Dim c As New C - c.Foo(1) + c.Goo(1) End Sub End Module @@ -4176,7 +4176,7 @@ Class C Console.WriteLine("Success") End Sub - Public Sub Foo(Of V)(ByVal z As V) + Public Sub Goo(Of V)(ByVal z As V) Me.S(z) End Sub End Class @@ -4184,7 +4184,7 @@ End Class Module MMM Sub Main(args As String()) Dim c As New C - c.Foo(1) + c.Goo(1) End Sub End Module @@ -4206,7 +4206,7 @@ Structure C Console.WriteLine("Success") End Sub - Public Sub Foo(ByVal z As Integer) + Public Sub Goo(ByVal z As Integer) Me.S(z) End Sub End Structure @@ -4214,7 +4214,7 @@ End Structure Module MMM Sub Main(args As String()) Dim c As New C - c.Foo(1) + c.Goo(1) End Sub End Module @@ -4248,7 +4248,7 @@ Partial Class C1(Of T) : Implements C1(Of A).I(Of A) Interface I(Of J) End Interface Partial Class C2(Of K As T) - Partial Private Sub Foo(Of U As {A, T, I(Of K)}, V As {U, A})(x As A, y As T, z As C1(Of T), + Partial Private Sub Goo(Of U As {A, T, I(Of K)}, V As {U, A})(x As A, y As T, z As C1(Of T), aa As K, bb As I(Of K), cc As U, dd As V, ee As IDictionary(Of C1(Of U), I(Of V)), ff As Exception, yy As C1(Of ArgumentException)) @@ -4258,7 +4258,7 @@ Partial Class C1(Of T) : Implements C1(Of A).I(Of A) aa As K, bb As I(Of K), cc As U, dd As V, ee As IDictionary(Of C1(Of U), I(Of V)), ff As Exception, yy As C1(Of ArgumentException)) - Foo(x, y, z, aa, bb, cc, dd, ee, ff, yy) + Goo(x, y, z, aa, bb, cc, dd, ee, ff, yy) End Sub End Class End Class @@ -4268,7 +4268,7 @@ End Class Partial Class C1(Of T) Partial Class C2(Of K As T) - Private Sub Foo(Of U As {T, I(Of K), C1(Of Integer)}, V As {C1(Of Integer), U})(x As C1(Of Integer), y As T, z As C1(Of T), + Private Sub Goo(Of U As {T, I(Of K), C1(Of Integer)}, V As {C1(Of Integer), U})(x As C1(Of Integer), y As T, z As C1(Of T), aa As K, bb As I(Of K), cc As U, dd As V, ee As IDictionary(Of C1(Of U), I(Of V)), ff As Exception, yy As C1(Of ArgumentException)) @@ -4291,11 +4291,11 @@ End Class]]>, , compilationOptions:=New VisualBasicCompilationOptions(OutputKind.ConsoleApplication)) Dim vbVerifier = CompileAndVerify(vbCompilation, - expectedOutput:=) vbVerifier.VerifyDiagnostics() End Sub @@ -4405,7 +4405,7 @@ expectedOutput:=). Imports System Module M1 - Sub Foo(xParam as Integer, ByRef yParam As Long) + Sub Goo(xParam as Integer, ByRef yParam As Long) Console.WriteLine(xParam) Console.WriteLine(yParam) xParam = 17 @@ -4419,7 +4419,7 @@ Module M1 y = 16442 Console.WriteLine("x = {0}", x) Console.WriteLine("y = {0}", y) - Foo(x,y) + Goo(x,y) Console.WriteLine("x = {0}", x) Console.WriteLine("y = {0}", y) End Sub @@ -4434,7 +4434,7 @@ y = 16442 x = 143 y = 189 ]]>). - VerifyIL("M1.Foo", + VerifyIL("M1.Goo", @@ -4516,8 +4516,8 @@ Imports VBN Module Program Sub Main(args As String()) - Dim sss As VBN.SFoo, ccc As SBar = New SBar() - sss = New SFoo() + Dim sss As VBN.SGoo, ccc As SBar = New SBar() + sss = New SGoo() Dim val As Short = 9 sss.M1(val) ' () - ByRef @@ -4555,7 +4555,7 @@ Imports System Namespace VBN - Structure SFoo + Structure SGoo Public Sub M1(ByVal x As Object) console.write("O:{0}|", x) End Sub @@ -5427,23 +5427,23 @@ Imports VBN Module Program Sub Main(args As String()) - Dim x As VBN.IFoo(Of Char, Char) = Nothing, y As CFoo(Of Char, Char), z As SFoo = Nothing, local As Boolean = True - y = New CFoo(Of Char, Char)() + Dim x As VBN.IGoo(Of Char, Char) = Nothing, y As CGoo(Of Char, Char), z As SGoo = Nothing, local As Boolean = True + y = New CGoo(Of Char, Char)() Do If y IsNot Nothing OrElse x IsNot Nothing Then - 'x = DirectCast(y, IFoo(Of Char, Char)) + 'x = DirectCast(y, IGoo(Of Char, Char)) y.ImplF1("q"c, "c"c) Dim w As String = "If" y = Nothing ElseIf x Is Nothing AndAlso y Is Nothing AndAlso z.Field2 Is Nothing Then - z = New SFoo() - z.Field2 = New CFoo(Of SFoo, UShort) + z = New SGoo() + z.Field2 = New CGoo(Of SGoo, UShort) z.Field2.ImplF2("Aa", "Bb", "Cc") Dim w& = 11223344 Console.Write(w) Else - SFoo.Field1 = 9D - Console.Write(SFoo.Field1) + SGoo.Field1 = 9D + Console.Write(SGoo.Field1) Dim w As Boolean = False Console.Write(w) local = False @@ -5458,17 +5458,17 @@ Imports System Imports System.Collections.Generic Namespace VBN - Public Interface IFoo(Of T, V) + Public Interface IGoo(Of T, V) Sub F1(ByRef x As T, ByVal y As V) Function F2(ParamArray ary As String()) As String End Interface - Class CFoo(Of T, V) - 'Implements IFoo(Of T, V) - Public Sub ImplF1(ByRef x As T, ByVal y As V) 'Implements IFoo(Of T, V).F1 + Class CGoo(Of T, V) + 'Implements IGoo(Of T, V) + Public Sub ImplF1(ByRef x As T, ByVal y As V) 'Implements IGoo(Of T, V).F1 console.Write(String.Format("-ImpF1:{0},{1}-", x, y)) End Sub - Public Function ImplF2(ParamArray ary As String()) As String 'Implements IFoo(Of T, V).F2 + Public Function ImplF2(ParamArray ary As String()) As String 'Implements IGoo(Of T, V).F2 If (ary IsNot Nothing) Then Console.write("-ImpF2:{0}-", ary(0)) Else @@ -5478,9 +5478,9 @@ Namespace VBN End Function End Class - Friend Structure SFoo + Friend Structure SGoo Public Shared Field1 As Decimal - Public Field2 As CFoo(Of SFoo, UShort) + Public Field2 As CGoo(Of SGoo, UShort) End Structure End Namespace @@ -5533,10 +5533,10 @@ Imports System Module Program Sub Main(args As String()) Dim b = Function() Sub() Return - Foo(Of Func(Of Action(Of Integer)))(b)()(1) + Goo(Of Func(Of Action(Of Integer)))(b)()(1) End Sub - Function Foo(Of T)(x As T) As T + Function Goo(Of T)(x As T) As T Return x End Function End Module @@ -7146,10 +7146,10 @@ Imports System Module Program Sub Main() - Foo(Function(x) Function() x) + Goo(Function(x) Function() x) End Sub - Sub Foo(x As Func(Of String, Func(Of String))) + Sub Goo(x As Func(Of String, Func(Of String))) Console.WriteLine(x.Invoke("ABC").Invoke().ToLower()) End Sub End Module @@ -7454,10 +7454,10 @@ Class A Return Value.ToString() End Function - private sub foo(byref x as integer) + private sub goo(byref x as integer) end sub private sub moo() - foo(Value) + goo(Value) end sub End Class @@ -7504,7 +7504,7 @@ IL_0001: ldarg.0 IL_0002: ldfld "A.Value As Integer" IL_0007: stloc.0 IL_0008: ldloca.s V_0 -IL_000a: call "Sub A.foo(ByRef Integer)" +IL_000a: call "Sub A.goo(ByRef Integer)" IL_000f: ret } ]]>) @@ -7519,10 +7519,10 @@ Imports System Module M1 Dim i as integer = 42 Sub Main() - Foo(Integer.MaxValue) + Goo(Integer.MaxValue) End Sub - Sub Foo(ByRef x as integer) + Sub Goo(ByRef x as integer) x = 42 End Sub End Module @@ -7538,7 +7538,7 @@ End Module IL_0000: ldc.i4 0x7fffffff IL_0005: stloc.0 IL_0006: ldloca.s V_0 -IL_0008: call "Sub M1.Foo(ByRef Integer)" +IL_0008: call "Sub M1.Goo(ByRef Integer)" IL_000d: ret } ]]>) @@ -9706,12 +9706,12 @@ expectedOutput:= Imports System Module M1 - Sub foo() + Sub goo() apCompare(1.CompareTo(2)) Exit Sub End Sub Sub Main() - foo + goo End Sub End Module Public Module M2 @@ -9721,7 +9721,7 @@ End Module , expectedOutput:=""). - VerifyIL("M1.foo", + VerifyIL("M1.goo", , expectedOutput:=""). - VerifyIL("MyClass1.foo1", + VerifyIL("MyClass1.goo1", ) @@ -10133,33 +10133,33 @@ End Module Dim source = -Namespace Foo +Namespace Goo Class B End Class End Namespace -Namespace FOO +Namespace GOO Class C End Class End Namespace -Namespace FoO.Bar +Namespace GoO.Bar Partial Class D End Class End Namespace -Namespace foo.Baz +Namespace goo.Baz Class E End Class End Namespace -Namespace foO +Namespace goO Namespace Bar Class F End Class End Namespace End Namespace -Namespace FOo.Bar +Namespace GOo.Bar Partial Class D End Class End Namespace @@ -10182,11 +10182,11 @@ End Namespace Sub(a) AssertEx.SetEqual({"", "PROJEcT.Quuz.A", - "Project.FOO.C", - "Project.FoO.Bar.D", - "Project.Foo.B", - "Project.foO.Bar.F", - "Project.foo.Baz.E", + "Project.GOO.C", + "Project.GoO.Bar.D", + "Project.Goo.B", + "Project.goO.Bar.F", + "Project.goo.Baz.E", "SYStem.G"}, MetadataValidation.GetFullTypeNames(a.GetMetadataReader())) End Sub) End Sub @@ -10411,12 +10411,12 @@ Class Test End Structure - Shared Function Foo() As C1 + Shared Function Goo() As C1 Return New C1() End Function Shared Sub Main() - Console.Write(Foo().x.CompareTo(Decimal.One)) + Console.Write(Goo().x.CompareTo(Decimal.One)) End Sub End Class @@ -10428,7 +10428,7 @@ End Class // Code size 29 (0x1d) .maxstack 2 .locals init (Test.C1 V_0) - IL_0000: call "Function Test.Foo() As Test.C1" + IL_0000: call "Function Test.Goo() As Test.C1" IL_0005: stloc.0 IL_0006: ldloca.s V_0 IL_0008: ldflda "Test.C1.x As Decimal" @@ -11287,8 +11287,8 @@ End Class Assert.Equal(1, typeA.GetAttributes().Length) Dim ctorA = typeA.InstanceConstructors.First() Assert.Equal(expectedMethodImplAttributes, ctorA.ImplementationAttributes) - Dim methodFoo = DirectCast(typeA.GetMembers("Foo").First(), MethodSymbol) - Assert.Equal(expectedMethodImplAttributes, methodFoo.ImplementationAttributes) + Dim methodGoo = DirectCast(typeA.GetMembers("Goo").First(), MethodSymbol) + Assert.Equal(expectedMethodImplAttributes, methodGoo.ImplementationAttributes) Dim typeB = globalNamespace.GetMember(Of NamedTypeSymbol)("B") Assert.True(typeB.IsComImport()) @@ -11326,7 +11326,7 @@ Class A Console.WriteLine("FAIL") End Sub - Public Shared Function Foo() As Integer + Public Shared Function Goo() As Integer Console.WriteLine("FAIL") Return 0 End Function @@ -11345,7 +11345,7 @@ Module M1 End Try Try - A.Foo() + A.Goo() Catch ex As Exception Console.WriteLine("PASS2") End Try @@ -12314,11 +12314,11 @@ End Class Imports System Module Program - Function Foo() As AttributeTargets + Function Goo() As AttributeTargets Return AttributeTargets.All End Function Sub Main(args As String()) - Console.Write(Foo().value__) + Console.Write(Goo().value__) End Sub End Module @@ -12329,7 +12329,7 @@ End Module // Code size 19 (0x13) .maxstack 1 .locals init (System.AttributeTargets V_0) - IL_0000: call "Function Program.Foo() As System.AttributeTargets" + IL_0000: call "Function Program.Goo() As System.AttributeTargets" IL_0005: stloc.0 IL_0006: ldloca.s V_0 IL_0008: ldfld "System.AttributeTargets.value__ As Integer" @@ -12354,7 +12354,7 @@ Class B : Inherits A End Class Class Program - Shared Sub Foo(Of T As Class)(array As T()) + Shared Sub Goo(Of T As Class)(array As T()) array(0) = Nothing End Sub @@ -12368,7 +12368,7 @@ Class Program Shared Sub Main() Dim array = New B(5) {} - Foo(Of A)(array) + Goo(Of A)(array) Bar(Of A)(array) Dim array1 = New B(5)() {} @@ -12378,7 +12378,7 @@ End Class , expectedOutput:=""). - VerifyIL("Program.Foo(Of T)(T())", + VerifyIL("Program.Goo(Of T)(T())", -, expectedOutput:="FooFooFoo"). +, expectedOutput:="GooGooGoo"). VerifyIL("Module1.Test1(Of T)(T)", , expectedOutput:="Attempted to divide by zero."). - VerifyIL("EmitTest.foo", + VerifyIL("EmitTest.goo", (4, 5); @@ -8886,7 +8886,7 @@ namespace ClassLibrary1 public class Class2 { - public (int Alice, int q, int w, int e, int f, int g, int h, int j, int Bob) foo = SetBob(11); + public (int Alice, int q, int w, int e, int f, int g, int h, int j, int Bob) goo = SetBob(11); public (int Alice, int q, int w, int e, int f, int g, int h, int j, int Bob) Bar() => SetBob(12); @@ -8925,16 +8925,16 @@ Module Module1 Sub Main() Dim x As New ClassLibrary1.Class1 - System.Console.WriteLine(x.foo.Alice) - System.Console.WriteLine(x.foo.Bob) + System.Console.WriteLine(x.goo.Alice) + System.Console.WriteLine(x.goo.Bob) System.Console.WriteLine(x.Bar.Alice) System.Console.WriteLine(x.Bar.Bob) System.Console.WriteLine(x.Baz.Alice) System.Console.WriteLine(x.Baz.Bob) Dim y As New ClassLibrary1.Class2 - System.Console.WriteLine(y.foo.Alice) - System.Console.WriteLine(y.foo.Bob) + System.Console.WriteLine(y.goo.Alice) + System.Console.WriteLine(y.goo.Bob) System.Console.WriteLine(y.Bar.Alice) System.Console.WriteLine(y.Bar.Bob) System.Console.WriteLine(y.Baz.Alice) @@ -8990,7 +8990,7 @@ Imports System.Threading.Tasks Namespace ClassLibrary1 Public Class Class1 - Public foo As (Alice As Integer, Bob As Integer) = (2, 3) + Public goo As (Alice As Integer, Bob As Integer) = (2, 3) Public Function Bar() As (Alice As Integer, Bob As Integer) Return (4, 5) @@ -9004,7 +9004,7 @@ Namespace ClassLibrary1 End Class Public Class Class2 - Public foo As (Alice As Integer, q As Integer, w As Integer, e As Integer, f As Integer, g As Integer, h As Integer, j As Integer, Bob As Integer) = SetBob(11) + Public goo As (Alice As Integer, q As Integer, w As Integer, e As Integer, f As Integer, g As Integer, h As Integer, j As Integer, Bob As Integer) = SetBob(11) Public Function Bar() As (Alice As Integer, q As Integer, w As Integer, e As Integer, f As Integer, g As Integer, h As Integer, j As Integer, Bob As Integer) Return SetBob(12) @@ -9047,16 +9047,16 @@ Module Module1 Sub Main() Dim x As New ClassLibrary1.Class1 - System.Console.WriteLine(x.foo.Alice) - System.Console.WriteLine(x.foo.Bob) + System.Console.WriteLine(x.goo.Alice) + System.Console.WriteLine(x.goo.Bob) System.Console.WriteLine(x.Bar.Alice) System.Console.WriteLine(x.Bar.Bob) System.Console.WriteLine(x.Baz.Alice) System.Console.WriteLine(x.Baz.Bob) Dim y As New ClassLibrary1.Class2 - System.Console.WriteLine(y.foo.Alice) - System.Console.WriteLine(y.foo.Bob) + System.Console.WriteLine(y.goo.Alice) + System.Console.WriteLine(y.goo.Bob) System.Console.WriteLine(y.Bar.Alice) System.Console.WriteLine(y.Bar.Bob) System.Console.WriteLine(y.Baz.Alice) @@ -9174,17 +9174,17 @@ namespace ClassLibrary1 { public class Class1 { - public (int Alice, (int Alice, int Bob) Bob) foo = (2, (2, 3)); + public (int Alice, (int Alice, int Bob) Bob) goo = (2, (2, 3)); public ((int Alice, int Bob)[] Alice, int Bob) Bar() => (new(int, int)[] { (4, 5) }, 5); public (int Alice, List<(int Alice, int Bob)?> Bob) Baz => (6, new List<(int Alice, int Bob)?>() { (8, 9) }); - public static event Action<(int i0, int i1, int i2, int i3, int i4, int i5, int i6, int i7, (int Alice, int Bob) Bob)> foo1; + public static event Action<(int i0, int i1, int i2, int i3, int i4, int i5, int i6, int i7, (int Alice, int Bob) Bob)> goo1; public static void raise() { - foo1((0, 1, 2, 3, 4, 5, 6, 7, (8, 42))); + goo1((0, 1, 2, 3, 4, 5, 6, 7, (8, 42))); } } } @@ -9199,14 +9199,14 @@ Module Module1 Sub Main() Dim x As New ClassLibrary1.Class1 - System.Console.WriteLine(x.foo.Bob.Bob) - System.Console.WriteLine(x.foo.Item2.Item2) + System.Console.WriteLine(x.goo.Bob.Bob) + System.Console.WriteLine(x.goo.Item2.Item2) System.Console.WriteLine(x.Bar.Alice(0).Bob) System.Console.WriteLine(x.Bar.Item1(0).Item2) System.Console.WriteLine(x.Baz.Bob(0).Value) System.Console.WriteLine(x.Baz.Item2(0).Value) - AddHandler ClassLibrary1.Class1.foo1, Sub(p) + AddHandler ClassLibrary1.Class1.goo1, Sub(p) System.Console.WriteLine(p.Bob.Bob) System.Console.WriteLine(p.Rest.Item2.Bob) End Sub @@ -9251,7 +9251,7 @@ Imports System.Threading.Tasks Namespace ClassLibrary1 Public Class Class1 - Public foo As (Alice As Integer, Bob As (Alice As Integer, Bob As Integer)) = (2, (2, 3)) + Public goo As (Alice As Integer, Bob As (Alice As Integer, Bob As Integer)) = (2, (2, 3)) Public Function Bar() As (Alice As (Alice As Integer, Bob As Integer)(), Bob As Integer) Return (New(Integer, Integer)() {(4, 5)}, 5) @@ -9263,10 +9263,10 @@ Namespace ClassLibrary1 End Get End Property - Public Shared Event foo1 As Action(Of (i0 As Integer, i1 As Integer, i2 As Integer, i3 As Integer, i4 As Integer, i5 As Integer, i6 As Integer, i7 As Integer, Bob As (Alice As Integer, Bob As Integer))) + Public Shared Event goo1 As Action(Of (i0 As Integer, i1 As Integer, i2 As Integer, i3 As Integer, i4 As Integer, i5 As Integer, i6 As Integer, i7 As Integer, Bob As (Alice As Integer, Bob As Integer))) Public Shared Sub raise() - RaiseEvent foo1((0, 1, 2, 3, 4, 5, 6, 7, (8, 42))) + RaiseEvent goo1((0, 1, 2, 3, 4, 5, 6, 7, (8, 42))) End Sub End Class End Namespace @@ -9281,14 +9281,14 @@ Module Module1 Sub Main() Dim x As New ClassLibrary1.Class1 - System.Console.WriteLine(x.foo.Bob.Bob) - System.Console.WriteLine(x.foo.Item2.Item2) + System.Console.WriteLine(x.goo.Bob.Bob) + System.Console.WriteLine(x.goo.Item2.Item2) System.Console.WriteLine(x.Bar.Alice(0).Bob) System.Console.WriteLine(x.Bar.Item1(0).Item2) System.Console.WriteLine(x.Baz.Bob(0).Value) System.Console.WriteLine(x.Baz.Item2(0).Value) - AddHandler ClassLibrary1.Class1.foo1, Sub(p) + AddHandler ClassLibrary1.Class1.goo1, Sub(p) System.Console.WriteLine(p.Bob.Bob) System.Console.WriteLine(p.Rest.Item2.Bob) End Sub @@ -9335,7 +9335,7 @@ namespace ClassLibrary1 { public class Class1 { - public (int Alice, int alice) foo = (2, 3); + public (int Alice, int alice) goo = (2, 3); } } @@ -9349,12 +9349,12 @@ Module Module1 Sub Main() Dim x As New ClassLibrary1.Class1 - System.Console.WriteLine(x.foo.Item1) - System.Console.WriteLine(x.foo.Item2) - System.Console.WriteLine(x.foo.Alice) - System.Console.WriteLine(x.foo.alice) + System.Console.WriteLine(x.goo.Item1) + System.Console.WriteLine(x.goo.Item2) + System.Console.WriteLine(x.goo.Alice) + System.Console.WriteLine(x.goo.alice) - Dim f = x.foo + Dim f = x.goo System.Console.WriteLine(f.Item1) System.Console.WriteLine(f.Item2) System.Console.WriteLine(f.Alice) @@ -9371,8 +9371,8 @@ End Module referencedAssemblies:=s_valueTupleRefsAndDefault) vbCompilation.VerifyDiagnostics( - Diagnostic(ERRID.ERR_MetadataMembersAmbiguous3, "x.foo.Alice").WithArguments("Alice", "structure", "(Alice As Integer, alice As Integer)").WithLocation(8, 34), - Diagnostic(ERRID.ERR_MetadataMembersAmbiguous3, "x.foo.alice").WithArguments("Alice", "structure", "(Alice As Integer, alice As Integer)").WithLocation(9, 34), + Diagnostic(ERRID.ERR_MetadataMembersAmbiguous3, "x.goo.Alice").WithArguments("Alice", "structure", "(Alice As Integer, alice As Integer)").WithLocation(8, 34), + Diagnostic(ERRID.ERR_MetadataMembersAmbiguous3, "x.goo.alice").WithArguments("Alice", "structure", "(Alice As Integer, alice As Integer)").WithLocation(9, 34), Diagnostic(ERRID.ERR_MetadataMembersAmbiguous3, "f.Alice").WithArguments("Alice", "structure", "(Alice As Integer, alice As Integer)").WithLocation(14, 34), Diagnostic(ERRID.ERR_MetadataMembersAmbiguous3, "f.alice").WithArguments("Alice", "structure", "(Alice As Integer, alice As Integer)").WithLocation(15, 34) ) @@ -9394,7 +9394,7 @@ namespace ClassLibrary1 { public class Class1 { - public (int Alice, int alice, int) foo = (2, 3, 4); + public (int Alice, int alice, int) goo = (2, 3, 4); } } @@ -9408,13 +9408,13 @@ Module Module1 Sub Main() Dim x As New ClassLibrary1.Class1 - System.Console.WriteLine(x.foo.Item1) - System.Console.WriteLine(x.foo.Item2) - System.Console.WriteLine(x.foo.Item3) - System.Console.WriteLine(x.foo.Alice) - System.Console.WriteLine(x.foo.alice) + System.Console.WriteLine(x.goo.Item1) + System.Console.WriteLine(x.goo.Item2) + System.Console.WriteLine(x.goo.Item3) + System.Console.WriteLine(x.goo.Alice) + System.Console.WriteLine(x.goo.alice) - Dim f = x.foo + Dim f = x.goo System.Console.WriteLine(f.Item1) System.Console.WriteLine(f.Item2) System.Console.WriteLine(f.Item3) @@ -9432,8 +9432,8 @@ End Module referencedAssemblies:=s_valueTupleRefsAndDefault) vbCompilation.VerifyDiagnostics( - Diagnostic(ERRID.ERR_MetadataMembersAmbiguous3, "x.foo.Alice").WithArguments("Alice", "structure", "(Alice As Integer, alice As Integer, Integer)").WithLocation(9, 34), - Diagnostic(ERRID.ERR_MetadataMembersAmbiguous3, "x.foo.alice").WithArguments("Alice", "structure", "(Alice As Integer, alice As Integer, Integer)").WithLocation(10, 34), + Diagnostic(ERRID.ERR_MetadataMembersAmbiguous3, "x.goo.Alice").WithArguments("Alice", "structure", "(Alice As Integer, alice As Integer, Integer)").WithLocation(9, 34), + Diagnostic(ERRID.ERR_MetadataMembersAmbiguous3, "x.goo.alice").WithArguments("Alice", "structure", "(Alice As Integer, alice As Integer, Integer)").WithLocation(10, 34), Diagnostic(ERRID.ERR_MetadataMembersAmbiguous3, "f.Alice").WithArguments("Alice", "structure", "(Alice As Integer, alice As Integer, Integer)").WithLocation(16, 34), Diagnostic(ERRID.ERR_MetadataMembersAmbiguous3, "f.alice").WithArguments("Alice", "structure", "(Alice As Integer, alice As Integer, Integer)").WithLocation(17, 34) ) diff --git a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenUnstructuredErrorHandling.vb b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenUnstructuredErrorHandling.vb index eb348711ee604..cf3d16bb69c09 100644 --- a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenUnstructuredErrorHandling.vb +++ b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenUnstructuredErrorHandling.vb @@ -782,14 +782,14 @@ Imports Microsoft.VisualBasic Module Module1 Sub main - Dim i as ifoo = new c1 + Dim i as igoo = new c1 i.Testmethod End Sub End Module -Public Class C1 : Implements Ifoo - Sub T1 implements Ifoo.Testmethod +Public Class C1 : Implements Igoo + Sub T1 implements Igoo.Testmethod On error resume next 10: Err.Raise(3) @@ -804,7 +804,7 @@ Public Class C1 : Implements Ifoo End Sub End Class -Interface Ifoo +Interface Igoo Sub Testmethod() End Interface ]]> diff --git a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenVBCore.vb b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenVBCore.vb index 840b7366aeaa2..397885051e393 100644 --- a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenVBCore.vb +++ b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenVBCore.vb @@ -638,8 +638,8 @@ Imports Microsoft.VisualBasic Class Program Shared Sub Main(args As String()) - Dim x As String = "Foo" - Console.WriteLine(If(x = "Foo", "y", x)) + Dim x As String = "Goo" + Console.WriteLine(If(x = "Goo", "y", x)) End Sub End Class @@ -2896,11 +2896,11 @@ End Module Module Module1 Sub Main() - Foo() - Foo() + Goo() + Goo() End Sub - Sub Foo() + Sub Goo() Static x as integer = 1 x+=1 End Sub @@ -2922,11 +2922,11 @@ End Module Module Module1 Sub Main() - Foo() - Foo() + Goo() + Goo() End Sub - Sub Foo() + Sub Goo() Static x as integer = 1 x+=1 End Sub @@ -2952,11 +2952,11 @@ End Module Public Class Module1 Public shared Sub Main() - Foo() - Foo() + Goo() + Goo() End Sub - shared Sub Foo() + shared Sub Goo() Static x as integer = 1 x+=1 End Sub @@ -2992,11 +2992,11 @@ End Namespace Public Class Module1 Public shared Sub Main() - Foo() - Foo() + Goo() + Goo() End Sub - shared Sub Foo() + shared Sub Goo() Static x as integer = 1 x+=1 End Sub diff --git a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenWithBlock.vb b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenWithBlock.vb index 083e67628c0ad..db9e12aca468b 100644 --- a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenWithBlock.vb +++ b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenWithBlock.vb @@ -227,12 +227,12 @@ End Class Module Program Sub Main(args As String()) With New C1() - .Foo() + .Goo() End With End Sub <Extension()> - Public Sub Foo(ByRef x As C1) + Public Sub Goo(ByRef x As C1) End Sub End Module @@ -248,7 +248,7 @@ expectedOutput:=""). IL_0000: newobj "Sub C1..ctor()" IL_0005: stloc.0 IL_0006: ldloca.s V_0 - IL_0008: call "Sub Program.Foo(ByRef C1)" + IL_0008: call "Sub Program.Goo(ByRef C1)" IL_000d: ldnull IL_000e: pop IL_000f: ret @@ -529,7 +529,7 @@ Imports System.Runtime.CompilerServices Structure C1 Public field As Integer - Public Property FooProp As Integer + Public Property GooProp As Integer End Structure Class C2 @@ -581,7 +581,7 @@ Imports System.Runtime.CompilerServices Structure C1 Public field As Integer - Public Property FooProp As Integer + Public Property GooProp As Integer End Structure Class C2 @@ -635,7 +635,7 @@ Imports System.Runtime.CompilerServices Structure C1 Public field As Integer - Public Property FooProp As Integer + Public Property GooProp As Integer End Structure Class C2 @@ -868,12 +868,12 @@ Class Clazz Public Shared Sub Main(args() As String) Using s = New STRUCT() With s - Foo(.D) + Goo(.D) End With Console.Write(s.D) End Using End Sub - Public Shared Sub Foo(ByRef x As Integer) + Public Shared Sub Goo(ByRef x As Integer) x = 123 End Sub End Class @@ -897,7 +897,7 @@ expectedOutput:="0"). IL_0009: ldfld "STRUCT.D As Integer" IL_000e: stloc.1 IL_000f: ldloca.s V_1 - IL_0011: call "Sub Clazz.Foo(ByRef Integer)" + IL_0011: call "Sub Clazz.Goo(ByRef Integer)" IL_0016: ldloc.0 IL_0017: ldfld "STRUCT.D As Integer" IL_001c: call "Sub System.Console.Write(Integer)" @@ -2390,10 +2390,10 @@ Class Clazz Console.Write(FLD2.D) Console.Write(" ") With FLD1 - Foo(.D, 1) + Goo(.D, 1) End With With FLD2 - Foo(.D, 1) + Goo(.D, 1) End With Console.Write(FLD1.D) Console.Write(" ") @@ -2403,16 +2403,16 @@ Class Clazz Public Shared Sub Main(args() As String) With FLD1 - Foo(.D, 2) + Goo(.D, 2) End With With FLD2 - Foo(.D, 2) + Goo(.D, 2) End With Console.Write(FLD1.D) Console.Write(" ") Console.Write(FLD2.D) End Sub - Public Shared Sub Foo(ByRef x As Integer, val As Integer) + Public Shared Sub Goo(ByRef x As Integer, val As Integer) x = val End Sub End Class @@ -2928,14 +2928,14 @@ Class Clazz Dim result = From x In source Select DirectCast(Function() With x - Foo(.D) + Goo(.D) End With Return x End Function, Func(Of STRUCT))() Console.Write(result.FirstOrDefault.D) End Sub - Public Shared Sub Foo(ByRef x As Integer) + Public Shared Sub Goo(ByRef x As Integer) x = 123 End Sub End Class @@ -2953,7 +2953,7 @@ End Class IL_0006: ldfld "STRUCT.D As Integer" IL_000b: stloc.0 IL_000c: ldloca.s V_0 - IL_000e: call "Sub Clazz.Foo(ByRef Integer)" + IL_000e: call "Sub Clazz.Goo(ByRef Integer)" IL_0013: ldarg.0 IL_0014: ldfld "Clazz._Closure$__1-0.$VB$Local_x As STRUCT" IL_0019: ret @@ -3362,13 +3362,13 @@ Module Program Sub Main(args As String()) With New C1(23) Console.WriteLine(.Field) - .Foo() + .Goo() Console.WriteLine(.Field) End With End Sub <Extension()> - Public Sub Foo(ByRef x As C1) + Public Sub Goo(ByRef x As C1) x = New C1(42) Console.WriteLine(x.Field) End Sub diff --git a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenWithEvents.vb b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenWithEvents.vb index 716e78adbcd33..3476ca343e9de 100644 --- a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenWithEvents.vb +++ b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenWithEvents.vb @@ -76,7 +76,7 @@ Class Program RaiseEvent E1() End Sub - Shared Sub foo() Handles MyClass.E1 + Shared Sub goo() Handles MyClass.E1 Console.WriteLine("handled") End Sub End Class @@ -88,7 +88,7 @@ End Class // Code size 18 (0x12) .maxstack 2 IL_0000: ldnull - IL_0001: ldftn "Sub Program.foo()" + IL_0001: ldftn "Sub Program.goo()" IL_0007: newobj "Sub Program.E1EventHandler..ctor(Object, System.IntPtr)" IL_000c: call "Sub Program.add_E1(Program.E1EventHandler)" IL_0011: ret @@ -119,7 +119,7 @@ Class Program raiser End Sub - Shared Sub foo() Handles MyClass.E1 + Shared Sub goo() Handles MyClass.E1 Console.WriteLine("handled") End Sub End Class @@ -131,7 +131,7 @@ End Class // Code size 18 (0x12) .maxstack 2 IL_0000: ldnull - IL_0001: ldftn "Sub Program.foo()" + IL_0001: ldftn "Sub Program.goo()" IL_0007: newobj "Sub Base.E1EventHandler..ctor(Object, System.IntPtr)" IL_000c: call "Sub Base.add_E1(Base.E1EventHandler)" IL_0011: ret @@ -158,7 +158,7 @@ Class Program RaiseEvent E1() End Sub - Shared Sub foo() Handles MyClass.e1 + Shared Sub goo() Handles MyClass.e1 Console.WriteLine("handled") End Sub End Class @@ -173,7 +173,7 @@ End Class IL_0001: call "Sub Object..ctor()" IL_0006: ldarg.0 IL_0007: ldnull - IL_0008: ldftn "Sub Program.foo()" + IL_0008: ldftn "Sub Program.goo()" IL_000e: newobj "Sub Program.E1EventHandler..ctor(Object, System.IntPtr)" IL_0013: call "Sub Program.add_E1(Program.E1EventHandler)" IL_0018: ret @@ -212,7 +212,7 @@ Class Program RaiseEvent E1(123) End Sub - Shared Sub foo() Handles MyClass.e1 + Shared Sub goo() Handles MyClass.e1 Console.WriteLine("handled") End Sub End Class @@ -300,11 +300,11 @@ Class Program MyBase.Raiser() End Sub - Sub foo1() Handles MyClass.E1 + Sub goo1() Handles MyClass.E1 Console.WriteLine("handled1") End Sub - Shared Sub foo2() Handles MyClass.E2 + Shared Sub goo2() Handles MyClass.E2 Console.WriteLine("handled2") End Sub End Class @@ -369,11 +369,11 @@ Class Program MyBase.Raiser() End Sub - Sub foo1() Handles MyClass.E1 + Sub goo1() Handles MyClass.E1 Console.WriteLine("handled1") End Sub - Shared Function foo2(arg As Long) As Integer Handles MyClass.E1 + Shared Function goo2(arg As Long) As Integer Handles MyClass.E1 Console.WriteLine("handled2") Return 123 End Function @@ -892,7 +892,7 @@ End Class Class c3 Inherits c2 - Sub foo() Handles MyBase.e + Sub goo() Handles MyBase.e gstrexpectedresult = "working!!" End Sub End Class @@ -1142,17 +1142,17 @@ End Module]]>, Dim comp = CreateVisualBasicCompilation("TestNameOfWithEventsSetterParameter", , compilationOptions:=New VisualBasicCompilationOptions(OutputKind.DynamicallyLinkedLibrary)) Dim verifier = CompileAndVerify(comp, expectedSignatures:= { - Signature("c1", "foo", ".property readwrite instance c1 foo"), - Signature("c1", "set_foo", ".method [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public newslot strict specialname virtual instance System.Void set_foo(c1 WithEventsValue) cil managed synchronized"), - Signature("c1", "get_foo", ".method [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public newslot strict specialname virtual instance c1 get_foo() cil managed") + Signature("c1", "goo", ".property readwrite instance c1 goo"), + Signature("c1", "set_goo", ".method [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public newslot strict specialname virtual instance System.Void set_goo(c1 WithEventsValue) cil managed synchronized"), + Signature("c1", "get_goo", ".method [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public newslot strict specialname virtual instance c1 get_goo() cil managed") }) verifier.VerifyDiagnostics() @@ -1171,13 +1171,13 @@ End Interface Class C1(Of T As {Exception, I1(Of T)}) Dim WithEvents x As T - 'Native compiler used to report an incorrect error on the below line - "Method 'Public Sub foo(a As T)' cannot handle event 'Public Event E1(a As U)' because they do not have a compatible signature". + 'Native compiler used to report an incorrect error on the below line - "Method 'Public Sub goo(a As T)' cannot handle event 'Public Event E1(a As U)' because they do not have a compatible signature". 'This was a bug in the native compiler (see Bug: VSWhidbey/544224) that got fixed in Roslyn. 'See Vladimir's comments in bug 13489 for more details. - Sub foo(ByVal a As T) Handles x.E1 + Sub goo(ByVal a As T) Handles x.E1 End Sub Sub bar() - AddHandler x.E1, AddressOf foo 'AddHandler should also work + AddHandler x.E1, AddressOf goo 'AddHandler should also work End Sub End Class]]>, compilationOptions:=New VisualBasicCompilationOptions(OutputKind.DynamicallyLinkedLibrary)) @@ -1196,15 +1196,15 @@ Imports System Class Program Shared Sub Main() Dim c1 = GetType(C1) - Dim _Foo = c1.GetField("_Foo", Reflection.BindingFlags.NonPublic Or Reflection.BindingFlags.Static Or Reflection.BindingFlags.Instance) - Dim obsolete = _Foo.GetCustomAttributes(GetType(ObsoleteAttribute), False) + Dim _Goo = c1.GetField("_Goo", Reflection.BindingFlags.NonPublic Or Reflection.BindingFlags.Static Or Reflection.BindingFlags.Instance) + Dim obsolete = _Goo.GetCustomAttributes(GetType(ObsoleteAttribute), False) System.Console.WriteLine(obsolete.Length = 1) End Sub End Class Class C1 - WithEvents Foo as C1 + WithEvents Goo as C1 End Class ]]> , expectedOutput:="True") @@ -1506,12 +1506,12 @@ Public Class Base(Of T, Public Shadows WithEvents Base3 As Base(Of A, U, V, D, C, IList(Of IList(Of A))) = Me - Function Foo(x As HashSet(Of A), y As Dictionary(Of A, D)) As Integer Handles Base33.e + Function Goo(x As HashSet(Of A), y As Dictionary(Of A, D)) As Integer Handles Base33.e Console.WriteLine("1") Return 0 End Function - Function Foo(x As List(Of A)) As Dictionary(Of T, A) Handles Base3.e + Function Goo(x As List(Of A)) As Dictionary(Of T, A) Handles Base3.e Console.WriteLine("2") Return New Dictionary(Of T, A) End Function @@ -1539,16 +1539,16 @@ Public Class Derived(Of T As {Base(Of ArgumentException, String, S, ArgumentExce Dictionary(Of String, S), List(Of IList(Of ArgumentException))). Base2(Of ArgumentException, String, Dictionary(Of String, S), ArgumentNullException). Base3 - Shadows Sub Foo(x As HashSet(Of ArgumentException), y As Dictionary(Of ArgumentException, ArgumentNullException)) Handles Base2.e + Shadows Sub Goo(x As HashSet(Of ArgumentException), y As Dictionary(Of ArgumentException, ArgumentNullException)) Handles Base2.e Console.WriteLine("3") End Sub - Shadows Sub Foo() Handles Base3.e + Shadows Sub Goo() Handles Base3.e Console.WriteLine("4") End Sub - Shadows Sub Foo(x As List(Of ArgumentException)) Handles w.e, Me.e, MyClass.e + Shadows Sub Goo(x As List(Of ArgumentException)) Handles w.e, Me.e, MyClass.e Console.WriteLine("5") End Sub - Overloads Function foo2$(x As HashSet(Of ArgumentException), y As Dictionary(Of ArgumentException, ArgumentNullException)) Handles w2.e + Overloads Function goo2$(x As HashSet(Of ArgumentException), y As Dictionary(Of ArgumentException, ArgumentNullException)) Handles w2.e Console.WriteLine("6") Return 1.0 End Function @@ -1692,32 +1692,32 @@ Derived H2]]>) ) ) , referencedCompilations:={csCompilation}) vbCompilation.VerifyDiagnostics( - Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Foo2", "ev"), - Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Foo2", "ev"), - Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Foo2", "ev"), - Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Foo2", "ev"), - Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Foo2", "ev"), - Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Foo2", "ev")) + Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Goo2", "ev"), + Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Goo2", "ev"), + Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Goo2", "ev"), + Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Goo2", "ev"), + Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Goo2", "ev"), + Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Goo2", "ev")) End Sub @@ -1894,7 +1894,7 @@ End Module]]>, , compilationOptions:=New VisualBasicCompilationOptions(OutputKind.ConsoleApplication), referencedCompilations:={csCompilation}) vbCompilation.VerifyDiagnostics( - Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Foo", "ev"), - Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Foo", "ev"), - Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Foo", "ev")) + Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Goo", "ev"), + Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Goo", "ev"), + Diagnostic(ERRID.ERR_EventHandlerSignatureIncompatible2, "ev").WithArguments("Goo", "ev")) End Sub diff --git a/src/Compilers/VisualBasic/Test/Emit/Emit/CompilationEmitTests.vb b/src/Compilers/VisualBasic/Test/Emit/Emit/CompilationEmitTests.vb index 990035159ee7a..b2261af49dc43 100644 --- a/src/Compilers/VisualBasic/Test/Emit/Emit/CompilationEmitTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/Emit/CompilationEmitTests.vb @@ -89,7 +89,7 @@ End Module Class C1 - Public Sub Foo1(x as Blech) + Public Sub Goo1(x as Blech) End Sub Public Sub Bar1() NoSuchMethod("from C1") @@ -104,12 +104,12 @@ End Class Partial Class C2 - Public Sub Foo2(x as Blech) + Public Sub Goo2(x as Blech) End Sub End Class Class C3 - Public Sub Foo3(x as Blech) + Public Sub Goo3(x as Blech) End Sub Public Sub Bar3() NoSuchMethod("from C3") @@ -121,30 +121,30 @@ End Class CompilationUtils.AssertTheseDiagnostics(compilation.GetDeclarationDiagnostics(), BC30002: Type 'Blech' is not defined. - Public Sub Foo1(x as Blech) + Public Sub Goo1(x as Blech) ~~~~~ BC30002: Type 'Blech' is not defined. - Public Sub Foo2(x as Blech) + Public Sub Goo2(x as Blech) ~~~~~ BC30002: Type 'Blech' is not defined. - Public Sub Foo3(x as Blech) + Public Sub Goo3(x as Blech) ~~~~~ ) CompilationUtils.AssertTheseDiagnostics(compilation.GetSemanticModel(CompilationUtils.GetTree(compilation, "a.vb")).GetDeclarationDiagnostics(), BC30002: Type 'Blech' is not defined. - Public Sub Foo1(x as Blech) + Public Sub Goo1(x as Blech) ~~~~~ ) CompilationUtils.AssertTheseDiagnostics(compilation.GetSemanticModel(CompilationUtils.GetTree(compilation, "b.vb")).GetDeclarationDiagnostics(), BC30002: Type 'Blech' is not defined. - Public Sub Foo2(x as Blech) + Public Sub Goo2(x as Blech) ~~~~~ BC30002: Type 'Blech' is not defined. - Public Sub Foo3(x as Blech) + Public Sub Goo3(x as Blech) ~~~~~ ) End Sub @@ -156,7 +156,7 @@ BC30002: Type 'Blech' is not defined. Class C1 - Public Sub Foo1(x as Blech) + Public Sub Goo1(x as Blech) End Sub Public Sub Bar1() NoSuchMethod("from C1") @@ -171,12 +171,12 @@ End Class Partial Class C2 - Public Sub Foo2(x as Blech) + Public Sub Goo2(x as Blech) End Sub End Class Class C3 - Public Sub Foo3(x as Blech) + Public Sub Goo3(x as Blech) End Sub Public Sub Bar3() NoSuchMethod("from C3") @@ -188,7 +188,7 @@ End Class CompilationUtils.AssertTheseDiagnostics(compilation.GetDiagnostics(), BC30002: Type 'Blech' is not defined. - Public Sub Foo1(x as Blech) + Public Sub Goo1(x as Blech) ~~~~~ BC30451: 'NoSuchMethod' is not declared. It may be inaccessible due to its protection level. NoSuchMethod("from C1") @@ -197,10 +197,10 @@ BC30451: 'NoSuchMethod' is not declared. It may be inaccessible due to its prote NoSuchMethod("from C2") ~~~~~~~~~~~~ BC30002: Type 'Blech' is not defined. - Public Sub Foo2(x as Blech) + Public Sub Goo2(x as Blech) ~~~~~ BC30002: Type 'Blech' is not defined. - Public Sub Foo3(x as Blech) + Public Sub Goo3(x as Blech) ~~~~~ BC30451: 'NoSuchMethod' is not declared. It may be inaccessible due to its protection level. NoSuchMethod("from C3") @@ -210,7 +210,7 @@ BC30451: 'NoSuchMethod' is not declared. It may be inaccessible due to its prote CompilationUtils.AssertTheseDiagnostics(compilation.GetSemanticModel(CompilationUtils.GetTree(compilation, "a.vb")).GetDiagnostics(), BC30002: Type 'Blech' is not defined. - Public Sub Foo1(x as Blech) + Public Sub Goo1(x as Blech) ~~~~~ BC30451: 'NoSuchMethod' is not declared. It may be inaccessible due to its protection level. NoSuchMethod("from C1") @@ -223,10 +223,10 @@ BC30451: 'NoSuchMethod' is not declared. It may be inaccessible due to its prote CompilationUtils.AssertTheseDiagnostics(compilation.GetSemanticModel(CompilationUtils.GetTree(compilation, "b.vb")).GetDiagnostics(), BC30002: Type 'Blech' is not defined. - Public Sub Foo2(x as Blech) + Public Sub Goo2(x as Blech) ~~~~~ BC30002: Type 'Blech' is not defined. - Public Sub Foo3(x as Blech) + Public Sub Goo3(x as Blech) ~~~~~ BC30451: 'NoSuchMethod' is not declared. It may be inaccessible due to its protection level. NoSuchMethod("from C3") @@ -242,7 +242,7 @@ BC30451: 'NoSuchMethod' is not declared. It may be inaccessible due to its prote Imports System -Namespace Foo.Bar +Namespace Goo.Bar Public Class X Public x As Integer Private y As String @@ -252,7 +252,7 @@ Namespace Foo.Bar Public Sub New() x = 7 End Sub - Friend Function foo(arg as String) as Integer + Friend Function goo(arg as String) as Integer Return x End Function End Class @@ -276,7 +276,7 @@ End Namespace Imports System -Imports Foo.Bar +Imports Goo.Bar Class M1 Sub Main() X.SayHello() @@ -1355,19 +1355,19 @@ End Module Imports System MustInherit Class Base - Public MustOverride Sub Foo() + Public MustOverride Sub Goo() End Class Class Derived Inherits Base - Public Overrides Sub foO() + Public Overrides Sub goO() Console.WriteLine("Keep calm and carry on.") End Sub Shared Sub Main() Dim d as New Derived() - d.foo() + d.goo() End Sub End Class @@ -1384,25 +1384,25 @@ Keep calm and carry on.]]>) Imports System MustInherit Class Base - Public MustOverride Sub Foo() + Public MustOverride Sub Goo() End Class Class Derived Inherits Base - Public overrides Sub FOo() + Public overrides Sub GOo() End Sub End Class Class DerivedDerived Inherits Derived - Public Overrides Sub FOO() + Public Overrides Sub GOO() Console.WriteLine("Keep calm and carry on.") End Sub Shared Sub Main() Dim d As New DerivedDerived() - d.foo() + d.goo() End Sub End Class @@ -1426,42 +1426,42 @@ Keep calm and carry on.]]>) Imports System MustInherit Class Base - Public MustOverride Sub Foo() - Public MustOverride Sub foO(x as integer) + Public MustOverride Sub Goo() + Public MustOverride Sub goO(x as integer) End Class MustInherit Class Derived Inherits Base - Public Overrides Sub FOo() + Public Overrides Sub GOo() End Sub - Public Overloads MustOverride Sub FoO(z As String) + Public Overloads MustOverride Sub GoO(z As String) End Class Class DerivedDerived Inherits Derived - Public Overrides Sub FOO() + Public Overrides Sub GOO() Console.WriteLine("ABC.") End Sub - Public Overrides Sub fOO(x as Integer) + Public Overrides Sub gOO(x as Integer) Console.WriteLine("Life is {0}.", x) End Sub - Public Overrides Sub fOo(y as String) + Public Overrides Sub gOo(y as String) Console.WriteLine("This is a {0}.", y) End Sub - Public Overloads Sub foo(x as integer, y as String) + Public Overloads Sub goo(x as integer, y as String) Console.WriteLine("All done.") End Sub Shared Sub Main() Dim d As Base = New DerivedDerived() - d.Foo() - d.foO(42) - DirectCast(d, Derived).FoO("elderberries") - DirectCast(d, DerivedDerived).foo(42, "elderberries") + d.Goo() + d.goO(42) + DirectCast(d, Derived).GoO("elderberries") + DirectCast(d, DerivedDerived).goo(42, "elderberries") End Sub End Class @@ -2225,7 +2225,7 @@ Imports System.Security.Permissions public class C <PrincipalPermission(SecurityAction.Demand, Role:="User1")> - public sub foo() + public sub goo() end sub end class @@ -2243,7 +2243,7 @@ End Module New DeclSecurityEntry() With { .ActionFlags = DeclarativeSecurityAction.Demand, .ParentKind = SymbolKind.Method, - .ParentNameOpt = "foo", + .ParentNameOpt = "goo", .PermissionSet = "." & ChrW(1) & @@ -2326,7 +2326,7 @@ Imports System.Security.Permissions public class C <PrincipalPermission(SecurityAction.Demand, Role:="User1")> <PrincipalPermission(SecurityAction.Demand, Role:="User1")> - public sub foo() + public sub goo() end sub end class @@ -2344,7 +2344,7 @@ End Module New DeclSecurityEntry() With { .ActionFlags = DeclarativeSecurityAction.Demand, .ParentKind = SymbolKind.Method, - .ParentNameOpt = "foo", + .ParentNameOpt = "goo", .PermissionSet = "." & ChrW(2) & @@ -2445,7 +2445,7 @@ Imports System.Security.Permissions public class C <PrincipalPermission(SecurityAction.Demand, Role:="User1")> <PrincipalPermission(SecurityAction.Assert, Role:="User2")> - public sub foo() + public sub goo() end sub end class @@ -2463,7 +2463,7 @@ End Module New DeclSecurityEntry() With { .ActionFlags = DeclarativeSecurityAction.Demand, .ParentKind = SymbolKind.Method, - .ParentNameOpt = "foo", + .ParentNameOpt = "goo", .PermissionSet = "." & ChrW(1) & @@ -2481,7 +2481,7 @@ End Module New DeclSecurityEntry() With { .ActionFlags = DeclarativeSecurityAction.Assert, .ParentKind = SymbolKind.Method, - .ParentNameOpt = "foo", + .ParentNameOpt = "goo", .PermissionSet = "." & ChrW(1) & @@ -2507,14 +2507,14 @@ Imports System.Security.Permissions public class C1 <PrincipalPermission(SecurityAction.Demand, Role:="User1")> - public sub foo1() + public sub goo1() end sub end class public class C2 <PrincipalPermission(SecurityAction.Demand, Role:="User1")> - public sub foo2() + public sub goo2() end sub end class @@ -2532,7 +2532,7 @@ End Module New DeclSecurityEntry() With { .ActionFlags = DeclarativeSecurityAction.Demand, .ParentKind = SymbolKind.Method, - .ParentNameOpt = "foo1", + .ParentNameOpt = "goo1", .PermissionSet = "." & ChrW(1) & @@ -2550,7 +2550,7 @@ End Module New DeclSecurityEntry() With { .ActionFlags = DeclarativeSecurityAction.Demand, .ParentKind = SymbolKind.Method, - .ParentNameOpt = "foo2", + .ParentNameOpt = "goo2", .PermissionSet = "." & ChrW(1) & @@ -2644,7 +2644,7 @@ Imports System.Security.Permissions <PrincipalPermission(SecurityAction.Demand, Role:="User1")> public class C1 <PrincipalPermission(SecurityAction.Assert, Role:="User2")> - public sub foo1() + public sub goo1() end sub end class @@ -2714,7 +2714,7 @@ End Module New DeclSecurityEntry() With { .ActionFlags = DeclarativeSecurityAction.Assert, .ParentKind = SymbolKind.Method, - .ParentNameOpt = "foo1", + .ParentNameOpt = "goo1", .PermissionSet = "." & ChrW(1) & @@ -2749,7 +2749,7 @@ namespace n public class C1 <PrincipalPermission(SecurityAction.Demand, Role:="User3")> <PrincipalPermission(SecurityAction.Assert, Role:="User4")> - public sub foo1() + public sub goo1() end sub end class @@ -2767,7 +2767,7 @@ end namespace Dim ns = DirectCast([module].GlobalNamespace.GetMembers("N").Single, NamespaceSymbol) Dim namedType = DirectCast(ns.GetMembers("C1").Single, NamedTypeSymbol) Dim type = DirectCast(namedType, Microsoft.Cci.ITypeDefinition) - Dim method = DirectCast(namedType.GetMembers("foo1").Single, Microsoft.Cci.IMethodDefinition) + Dim method = DirectCast(namedType.GetMembers("goo1").Single, Microsoft.Cci.IMethodDefinition) Dim sourceAssembly = DirectCast(assembly, SourceAssemblySymbol) Dim compilation = sourceAssembly.DeclaringCompilation diff --git a/src/Compilers/VisualBasic/Test/Emit/Emit/DynamicAnalysis/DynamicInstrumentationTests.vb b/src/Compilers/VisualBasic/Test/Emit/Emit/DynamicAnalysis/DynamicInstrumentationTests.vb index 2ec7eb93febab..c7fa4db4edaf0 100644 --- a/src/Compilers/VisualBasic/Test/Emit/Emit/DynamicAnalysis/DynamicInstrumentationTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/Emit/DynamicAnalysis/DynamicInstrumentationTests.vb @@ -470,15 +470,15 @@ Module Program End Sub Sub TestMain() ' Method 2 - For Each number In Foo() + For Each number In Goo() System.Console.WriteLine(number) Next - For Each number In Foo() + For Each number In Goo() System.Console.WriteLine(number) Next End Sub - Public Iterator Function Foo() As System.Collections.Generic.IEnumerable(Of Integer) ' Method 3 + Public Iterator Function Goo() As System.Collections.Generic.IEnumerable(Of Integer) ' Method 3 For counter = 1 To 5 Yield counter Next @@ -538,7 +538,7 @@ True Dim verifier As CompilationVerifier = CompileAndVerify(source, expectedOutput) verifier.VerifyIL( - "Program.VB$StateMachine_2_Foo.MoveNext()", + "Program.VB$StateMachine_2_Goo.MoveNext()", .PayloadRoot0" - IL_001e: ldtoken "Function Program.Foo() As System.Collections.Generic.IEnumerable(Of Integer)" + IL_001e: ldtoken "Function Program.Goo() As System.Collections.Generic.IEnumerable(Of Integer)" IL_0023: ldelem.ref IL_0024: stloc.1 IL_0025: ldloc.1 IL_0026: brtrue.s IL_004d IL_0028: ldsfld "System.Guid .MVID" - IL_002d: ldtoken "Function Program.Foo() As System.Collections.Generic.IEnumerable(Of Integer)" + IL_002d: ldtoken "Function Program.Goo() As System.Collections.Generic.IEnumerable(Of Integer)" IL_0032: ldtoken Source Document 0 IL_0037: ldsfld "Boolean()() .PayloadRoot0" - IL_003c: ldtoken "Function Program.Foo() As System.Collections.Generic.IEnumerable(Of Integer)" + IL_003c: ldtoken "Function Program.Goo() As System.Collections.Generic.IEnumerable(Of Integer)" IL_0041: ldelema "Boolean()" IL_0046: ldc.i4.2 IL_0047: call "Function Microsoft.CodeAnalysis.Runtime.Instrumentation.CreatePayload(System.Guid, Integer, Integer, ByRef Boolean(), Integer) As Boolean()" @@ -585,31 +585,31 @@ True IL_0054: stelem.i1 IL_0055: ldarg.0 IL_0056: ldc.i4.1 - IL_0057: stfld "Program.VB$StateMachine_2_Foo.$VB$ResumableLocal_counter$0 As Integer" + IL_0057: stfld "Program.VB$StateMachine_2_Goo.$VB$ResumableLocal_counter$0 As Integer" IL_005c: ldarg.0 IL_005d: ldarg.0 - IL_005e: ldfld "Program.VB$StateMachine_2_Foo.$VB$ResumableLocal_counter$0 As Integer" - IL_0063: stfld "Program.VB$StateMachine_2_Foo.$Current As Integer" + IL_005e: ldfld "Program.VB$StateMachine_2_Goo.$VB$ResumableLocal_counter$0 As Integer" + IL_0063: stfld "Program.VB$StateMachine_2_Goo.$Current As Integer" IL_0068: ldarg.0 IL_0069: ldc.i4.1 IL_006a: dup IL_006b: stloc.0 - IL_006c: stfld "Program.VB$StateMachine_2_Foo.$State As Integer" + IL_006c: stfld "Program.VB$StateMachine_2_Goo.$State As Integer" IL_0071: ldc.i4.1 IL_0072: ret IL_0073: ldarg.0 IL_0074: ldc.i4.m1 IL_0075: dup IL_0076: stloc.0 - IL_0077: stfld "Program.VB$StateMachine_2_Foo.$State As Integer" + IL_0077: stfld "Program.VB$StateMachine_2_Goo.$State As Integer" IL_007c: ldarg.0 IL_007d: ldarg.0 - IL_007e: ldfld "Program.VB$StateMachine_2_Foo.$VB$ResumableLocal_counter$0 As Integer" + IL_007e: ldfld "Program.VB$StateMachine_2_Goo.$VB$ResumableLocal_counter$0 As Integer" IL_0083: ldc.i4.1 IL_0084: add.ovf - IL_0085: stfld "Program.VB$StateMachine_2_Foo.$VB$ResumableLocal_counter$0 As Integer" + IL_0085: stfld "Program.VB$StateMachine_2_Goo.$VB$ResumableLocal_counter$0 As Integer" IL_008a: ldarg.0 - IL_008b: ldfld "Program.VB$StateMachine_2_Foo.$VB$ResumableLocal_counter$0 As Integer" + IL_008b: ldfld "Program.VB$StateMachine_2_Goo.$VB$ResumableLocal_counter$0 As Integer" IL_0090: ldc.i4.5 IL_0091: ble.s IL_005c IL_0093: ldc.i4.0 diff --git a/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.vb b/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.vb index e0e48718611ad..01f3b098b18ba 100644 --- a/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.vb @@ -2961,13 +2961,13 @@ Class C Return Nothing End Function Shared Sub M(o As object) - for i as double = foo() to foo() step foo() - for j as double = foo() to foo() step foo() + for i as double = goo() to goo() step goo() + for j as double = goo() to goo() step goo() next next End Sub - shared function foo() as double + shared function goo() as double return 1 end function End Class @@ -2995,11 +2995,11 @@ End Class Boolean V_8, Double V_9) //j IL_0000: nop - IL_0001: call ""Function C.foo() As Double"" + IL_0001: call ""Function C.goo() As Double"" IL_0006: stloc.0 - IL_0007: call ""Function C.foo() As Double"" + IL_0007: call ""Function C.goo() As Double"" IL_000c: stloc.1 - IL_000d: call ""Function C.foo() As Double"" + IL_000d: call ""Function C.goo() As Double"" IL_0012: stloc.2 IL_0013: ldloc.2 IL_0014: ldc.r8 0 @@ -3010,11 +3010,11 @@ End Class IL_0023: ldloc.0 IL_0024: stloc.s V_4 IL_0026: br.s IL_007c - IL_0028: call ""Function C.foo() As Double"" + IL_0028: call ""Function C.goo() As Double"" IL_002d: stloc.s V_5 - IL_002f: call ""Function C.foo() As Double"" + IL_002f: call ""Function C.goo() As Double"" IL_0034: stloc.s V_6 - IL_0036: call ""Function C.foo() As Double"" + IL_0036: call ""Function C.goo() As Double"" IL_003b: stloc.s V_7 IL_003d: ldloc.s V_7 IL_003f: ldc.r8 0 @@ -3088,11 +3088,11 @@ End Class Boolean V_8, Double V_9) //j IL_0000: nop - IL_0001: call ""Function C.foo() As Double"" + IL_0001: call ""Function C.goo() As Double"" IL_0006: stloc.0 - IL_0007: call ""Function C.foo() As Double"" + IL_0007: call ""Function C.goo() As Double"" IL_000c: stloc.1 - IL_000d: call ""Function C.foo() As Double"" + IL_000d: call ""Function C.goo() As Double"" IL_0012: stloc.2 IL_0013: ldloc.2 IL_0014: ldc.r8 0 @@ -3103,11 +3103,11 @@ End Class IL_0023: ldloc.0 IL_0024: stloc.s V_4 IL_0026: br.s IL_007c - IL_0028: call ""Function C.foo() As Double"" + IL_0028: call ""Function C.goo() As Double"" IL_002d: stloc.s V_5 - IL_002f: call ""Function C.foo() As Double"" + IL_002f: call ""Function C.goo() As Double"" IL_0034: stloc.s V_6 - IL_0036: call ""Function C.foo() As Double"" + IL_0036: call ""Function C.goo() As Double"" IL_003b: stloc.s V_7 IL_003d: ldloc.s V_7 IL_003f: ldc.r8 0 diff --git a/src/Compilers/VisualBasic/Test/Emit/Emit/EmitErrorTests.vb b/src/Compilers/VisualBasic/Test/Emit/Emit/EmitErrorTests.vb index 42f729c18b62f..c81de1ad76de5 100644 --- a/src/Compilers/VisualBasic/Test/Emit/Emit/EmitErrorTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/Emit/EmitErrorTests.vb @@ -232,12 +232,12 @@ End Module Imports System MustInherit Class cls1 - MustOverride Sub Foo() + MustOverride Sub Goo() End Class Class cls2 Inherits cls1 - Overrides Sub foo() + Overrides Sub goo() End Sub Shared Sub Main() End Sub @@ -292,9 +292,9 @@ Module M1 Sub Main() Exit Sub End Sub - Overloads Sub foo(ByVal arg As Byte) + Overloads Sub goo(ByVal arg As Byte) End Sub - Overloads Sub foo(ByVal arg As System.Byte) + Overloads Sub goo(ByVal arg As System.Byte) End Sub End Module @@ -361,18 +361,18 @@ Hello Bug 7002 Imports System Module M1 - Sub Foo(Of T)(ByVal x As T, ByVal y As T) + Sub Goo(Of T)(ByVal x As T, ByVal y As T) End Sub Function Bar(Of T)(ByVal x As T) As T End Function Event ev(ByVal x As Integer, ByVal y As Integer) Sub Main() - Dim x = New Func(Of String, String)(AddressOf Foo) + Dim x = New Func(Of String, String)(AddressOf Goo) Dim x1 = New Func(Of String, String)(AddressOf Bar) - Dim x2 = Function() AddressOf Foo - Dim x21 = Sub() Call Function() Sub() AddressOf Foo - Dim x22 = Sub() Call Function() Sub() AddHandler ev, AddressOf Foo - Dim x3 As Func(Of Func(Of String, String)) = Function() AddressOf Foo + Dim x2 = Function() AddressOf Goo + Dim x21 = Sub() Call Function() Sub() AddressOf Goo + Dim x22 = Sub() Call Function() Sub() AddHandler ev, AddressOf Goo + Dim x3 As Func(Of Func(Of String, String)) = Function() AddressOf Goo Dim x31 As Func(Of Func(Of String, String)) = Function() AddressOf Bar End Sub End Module @@ -380,17 +380,17 @@ End Module ) AssertTheseDiagnostics(comp1, -BC31143: Method 'Public Sub Foo(Of T)(x As T, y As T)' does not have a signature compatible with delegate 'Delegate Function Func(Of String, String)(arg As String) As String'. - Dim x = New Func(Of String, String)(AddressOf Foo) +BC31143: Method 'Public Sub Goo(Of T)(x As T, y As T)' does not have a signature compatible with delegate 'Delegate Function Func(Of String, String)(arg As String) As String'. + Dim x = New Func(Of String, String)(AddressOf Goo) ~~~ BC30581: 'AddressOf' expression cannot be converted to 'Object' because 'Object' is not a delegate type. - Dim x2 = Function() AddressOf Foo + Dim x2 = Function() AddressOf Goo ~~~~~~~~~~~~~ BC30035: Syntax error. - Dim x21 = Sub() Call Function() Sub() AddressOf Foo + Dim x21 = Sub() Call Function() Sub() AddressOf Goo ~~~~~~~~~ -BC31143: Method 'Public Sub Foo(Of T)(x As T, y As T)' does not have a signature compatible with delegate 'Delegate Function Func(Of String, String)(arg As String) As String'. - Dim x3 As Func(Of Func(Of String, String)) = Function() AddressOf Foo +BC31143: Method 'Public Sub Goo(Of T)(x As T, y As T)' does not have a signature compatible with delegate 'Delegate Function Func(Of String, String)(arg As String) As String'. + Dim x3 As Func(Of Func(Of String, String)) = Function() AddressOf Goo ~~~ ) @@ -450,10 +450,10 @@ BC36673: Multiline lambda expression is missing 'End Sub'. Imports System Module M1 - Sub Foo(ByVal x) + Sub Goo(ByVal x) End Sub Class C1 - Public Shared y As Action(Of Integer) = Sub(c) Call (Sub(b) M1.Foo(b))(c) + Public Shared y As Action(Of Integer) = Sub(c) Call (Sub(b) M1.Goo(b))(c) End Class Sub Main() End Sub @@ -498,7 +498,7 @@ End Module Module M1 Const Curr1 = 5@ - Sub FOO() + Sub GOO() If Curr1 <> 5 Then End If End Sub diff --git a/src/Compilers/VisualBasic/Test/Emit/Emit/EmitMetadata.vb b/src/Compilers/VisualBasic/Test/Emit/Emit/EmitMetadata.vb index 066eb4019df71..f89380852939f 100644 --- a/src/Compilers/VisualBasic/Test/Emit/Emit/EmitMetadata.vb +++ b/src/Compilers/VisualBasic/Test/Emit/Emit/EmitMetadata.vb @@ -18,7 +18,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.Emit Public Sub IncorrectCustomAssemblyTableSize_TooManyMethodSpecs() Dim source = TestResources.MetadataTests.Invalid.ManyMethodSpecs - CompileAndVerify(VisualBasicCompilation.Create("Foo", syntaxTrees:={Parse(source)}, references:={MscorlibRef, SystemCoreRef, MsvbRef})) + CompileAndVerify(VisualBasicCompilation.Create("Goo", syntaxTrees:={Parse(source)}, references:={MscorlibRef, SystemCoreRef, MsvbRef})) End Sub diff --git a/src/Compilers/VisualBasic/Test/Emit/Emit/FieldInitializerTests.vb b/src/Compilers/VisualBasic/Test/Emit/Emit/FieldInitializerTests.vb index db91885c3a963..402f7cd243b18 100644 --- a/src/Compilers/VisualBasic/Test/Emit/Emit/FieldInitializerTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/Emit/FieldInitializerTests.vb @@ -35,11 +35,11 @@ Class C1 Public Shared field2 as integer = 23 Public field3 as new C2(12) Public field4, field5 as new C2(42) - Public field6 as integer = C1.Foo() - Public field7 as integer = Foo + Public field6 as integer = C1.Goo() + Public field7 as integer = Goo Public field8 as C2 = New C2(20120421) - Public Shared Function Foo() as Integer + Public Shared Function Goo() as Integer return 2 End Function @@ -92,11 +92,11 @@ imports system Class C1 Public Delegate Sub SubDel(p as integer) - Public Shared Sub foo(p as Integer) + Public Shared Sub goo(p as Integer) Console.WriteLine("DelegateField works :) " + p.ToString()) End Sub - Public delfield1 as SubDel = AddressOf C1.foo + Public delfield1 as SubDel = AddressOf C1.goo Public sub DumpFields() delfield1(23) @@ -164,7 +164,7 @@ Class C1 private f1 as integer = 21 private f2 as integer = Me.f1 + 1 private f3, f4 as new C2(Me.f1) - private f5, f6 as new C2(foo) + private f5, f6 as new C2(goo) private f7, f8 as new C2(prop) Public ReadOnly Property prop As Integer @@ -175,7 +175,7 @@ Class C1 End Property - public function foo() as Integer + public function goo() as Integer return 12 end function @@ -232,7 +232,7 @@ Option Infer On imports system Class C1 - private const c1s = "foo" + private const c1s = "goo" Private const c2 as object = 1 Private const c3 = c2 private shared c4 as integer = 1 + cint(c2) + cint(c3) @@ -240,12 +240,12 @@ Class C1 Public Delegate Sub SubDel(p as integer) - Public Shared Sub foo(p as Integer) + Public Shared Sub goo(p as Integer) Console.writeline(c1s) Console.WriteLine("DelegateField works :) " + c1s + p.ToString() + " " + c4.ToString()) End Sub - Public delfield1 as SubDel = AddressOf C1.foo + Public delfield1 as SubDel = AddressOf C1.goo Public sub DumpFields() delfield1(23) @@ -261,8 +261,8 @@ End Class CompileAndVerify(source, expectedOutput:=) End Sub @@ -520,8 +520,8 @@ option infer <%= infer %> imports system Class C1 - Public Const f1 = "foo" - Public Const f2 As Object = "foo" + Public Const f1 = "goo" + Public Const f2 As Object = "goo" Public Const f3 = 23 Public Const f4 As Object = 42 public const f5 as integer = nothing @@ -540,8 +540,8 @@ imports system CompileAndVerify(source, expectedOutput:= BC30424: Constants must be of an intrinsic or enumerated type, not a class, structure, type parameter, or array type. - Public Const foo as New C1() + Public Const goo as New C1() ~~ BC30424: Constants must be of an intrinsic or enumerated type, not a class, structure, type parameter, or array type. - Public Const foo2 as New C1(23,23) + Public Const goo2 as New C1(23,23) ~~ ) End Sub @@ -804,7 +804,7 @@ End Structure Option strict on Class C1 Public f1 As New With { .Name = "John Smith", .Age = 34 } - Public Property foo As New With { .Name2 = "John Smith", .Age2 = 34 } + Public Property goo As New With { .Name2 = "John Smith", .Age2 = 34 } public shared sub main() end sub @@ -820,7 +820,7 @@ BC30180: Keyword does not name a type. Public f1 As New With { .Name = "John Smith", .Age = 34 } ~~~~ BC30180: Keyword does not name a type. - Public Property foo As New With { .Name2 = "John Smith", .Age2 = 34 } + Public Property goo As New With { .Name2 = "John Smith", .Age2 = 34 } ~~~~ ) End Sub @@ -834,7 +834,7 @@ BC30180: Keyword does not name a type. Option strict on Class C1 Public f1 As New - Public Property foo As New + Public Property goo As New public shared sub main() end sub @@ -850,7 +850,7 @@ BC30182: Type expected. Public f1 As New ~ BC30182: Type expected. - Public Property foo As New + Public Property goo As New ~ ) End Sub diff --git a/src/Compilers/VisualBasic/Test/Emit/Emit/ResourceTests.vb b/src/Compilers/VisualBasic/Test/Emit/Emit/ResourceTests.vb index 9ccffcb37d831..f1655ba61113f 100644 --- a/src/Compilers/VisualBasic/Test/Emit/Emit/ResourceTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/Emit/ResourceTests.vb @@ -182,7 +182,7 @@ End Class Public Sub FaultyResourceDataProvider() - Dim c1 = VisualBasicCompilation.Create("foo", references:={MscorlibRef}, options:=TestOptions.ReleaseDll) + Dim c1 = VisualBasicCompilation.Create("goo", references:={MscorlibRef}, options:=TestOptions.ReleaseDll) Dim result = c1.Emit(New MemoryStream(), manifestResources:={New ResourceDescription("r2", "file", Function() Throw New Exception("bad stuff") @@ -209,7 +209,7 @@ End Module ) Dim output As New IO.MemoryStream - Dim resourceFileName = "RoslynResourceFile.foo" + Dim resourceFileName = "RoslynResourceFile.goo" Dim r1Name As String = "some.dotted.NAME" Dim r2Name As String = "another.DoTtEd.NAME" @@ -385,8 +385,8 @@ End Module Dim result As EmitResult = c1.Emit(output, manifestResources:=New ResourceDescription(1) _ { - New ResourceDescription("A", "x.foo", dataProvider, True), - New ResourceDescription("A", "y.foo", dataProvider, True) + New ResourceDescription("A", "x.goo", dataProvider, True), + New ResourceDescription("A", "y.goo", dataProvider, True) }) ' error BC31502: Resource name 'A' cannot be used more than once. @@ -412,7 +412,7 @@ End Module Dim result As EmitResult = c1.Emit(output, manifestResources:= { New ResourceDescription(r1Name, Function() New IO.MemoryStream(arrayOfEmbeddedData), True), - New ResourceDescription("A", "y.foo", dataProvider, True) + New ResourceDescription("A", "y.goo", dataProvider, True) }) Assert.False(result.Success) @@ -420,7 +420,7 @@ End Module result = c1.Emit(output, manifestResources:= { - New ResourceDescription("A", "y.foo", dataProvider, True), + New ResourceDescription("A", "y.goo", dataProvider, True), New ResourceDescription(r1Name, Function() New IO.MemoryStream(arrayOfEmbeddedData), True) }) @@ -429,7 +429,7 @@ End Module result = c1.Emit(output, manifestResources:= { - New ResourceDescription("A", "y.foo", dataProvider, True) + New ResourceDescription("A", "y.goo", dataProvider, True) }) Assert.False(result.Success) @@ -680,8 +680,8 @@ End Module ' file name ignored for embedded manifest resources result = c1.Emit(output, manifestResources:=New ResourceDescription(1) _ { - New ResourceDescription("A", "x.foo", dataProvider, True, isEmbedded:=True, checkArgs:=True), - New ResourceDescription("A", "x.foo", dataProvider, True, isEmbedded:=False, checkArgs:=True) + New ResourceDescription("A", "x.goo", dataProvider, True, isEmbedded:=True, checkArgs:=True), + New ResourceDescription("A", "x.goo", dataProvider, True, isEmbedded:=False, checkArgs:=True) }) ' error BC31502: Resource name 'A' cannot be used more than once. @@ -707,12 +707,12 @@ End Module Dim result = c1.Emit(output, manifestResources:=New ResourceDescription(1) _ { - New ResourceDescription("A", "x.foo", dataProvider, True), - New ResourceDescription("B", "x.foo", dataProvider, True) + New ResourceDescription("A", "x.goo", dataProvider, True), + New ResourceDescription("B", "x.goo", dataProvider, True) }) - ' error BC35003: Each linked resource and module must have a unique filename. Filename 'x.foo' is specified more than once in this assembly. - result.Diagnostics.Verify(Diagnostic(ERRID.ERR_DuplicateResourceFileName1).WithArguments("x.foo")) + ' error BC35003: Each linked resource and module must have a unique filename. Filename 'x.goo' is specified more than once in this assembly. + result.Diagnostics.Verify(Diagnostic(ERRID.ERR_DuplicateResourceFileName1).WithArguments("x.goo")) result = c1.Emit(output, manifestResources:=New ResourceDescription(0) _ { @@ -723,7 +723,7 @@ End Module Dim netModule1 = TestReferences.SymbolsTests.netModule.netModule1 - c1 = VisualBasicCompilation.Create("foo", references:={MscorlibRef, netModule1}, options:=TestOptions.ReleaseDll) + c1 = VisualBasicCompilation.Create("goo", references:={MscorlibRef, netModule1}, options:=TestOptions.ReleaseDll) result = c1.Emit(output, manifestResources:=New ResourceDescription(0) _ { @@ -762,8 +762,8 @@ End Module ' file name ignored for embedded manifest resources result = c1.Emit(output, manifestResources:=New ResourceDescription(1) _ { - New ResourceDescription("A", "x.foo", dataProvider, True, isEmbedded:=True, checkArgs:=True), - New ResourceDescription("B", "x.foo", dataProvider, True, isEmbedded:=False, checkArgs:=True) + New ResourceDescription("A", "x.goo", dataProvider, True, isEmbedded:=True, checkArgs:=True), + New ResourceDescription("B", "x.goo", dataProvider, True, isEmbedded:=False, checkArgs:=True) }) result.Diagnostics.Verify() @@ -786,27 +786,27 @@ End Module Dim result As EmitResult = c1.Emit(output, manifestResources:=New ResourceDescription(1) _ { - New ResourceDescription("A", "x.foo", dataProvider, True), - New ResourceDescription("A", "x.foo", dataProvider, True) + New ResourceDescription("A", "x.goo", dataProvider, True), + New ResourceDescription("A", "x.goo", dataProvider, True) }) ' error BC31502: Resource name 'A' cannot be used more than once. - ' error BC35003: Each linked resource and module must have a unique filename. Filename 'x.foo' is specified more than once in this assembly. + ' error BC35003: Each linked resource and module must have a unique filename. Filename 'x.goo' is specified more than once in this assembly. result.Diagnostics.Verify( Diagnostic(ERRID.ERR_DuplicateResourceName1).WithArguments("A"), - Diagnostic(ERRID.ERR_DuplicateResourceFileName1).WithArguments("x.foo")) + Diagnostic(ERRID.ERR_DuplicateResourceFileName1).WithArguments("x.goo")) result = c1.Emit(output, manifestResources:=New ResourceDescription(2) _ { - New ResourceDescription("A", "x.foo", dataProvider, True), - New ResourceDescription("B", "x.foo", dataProvider, True), - New ResourceDescription("B", "y.foo", dataProvider, True) + New ResourceDescription("A", "x.goo", dataProvider, True), + New ResourceDescription("B", "x.goo", dataProvider, True), + New ResourceDescription("B", "y.goo", dataProvider, True) }) - ' error BC35003: Each linked resource andmust have a unique filename. Filename 'x.foo' is specified more than once in this assembly. + ' error BC35003: Each linked resource andmust have a unique filename. Filename 'x.goo' is specified more than once in this assembly. ' error BC31502: Resource name 'B' cannot be used more than once. result.Diagnostics.Verify( - Diagnostic(ERRID.ERR_DuplicateResourceFileName1).WithArguments("x.foo"), + Diagnostic(ERRID.ERR_DuplicateResourceFileName1).WithArguments("x.goo"), Diagnostic(ERRID.ERR_DuplicateResourceName1).WithArguments("B")) End Sub End Class diff --git a/src/Compilers/VisualBasic/Test/Emit/ErrorHandling.vb b/src/Compilers/VisualBasic/Test/Emit/ErrorHandling.vb index ab10e84c6069b..41ef7c12cf335 100644 --- a/src/Compilers/VisualBasic/Test/Emit/ErrorHandling.vb +++ b/src/Compilers/VisualBasic/Test/Emit/ErrorHandling.vb @@ -24,12 +24,12 @@ Module Module1 Sub Main() Dim sPath As String = "" sPath = "Test1" - On Error GoTo foo + On Error GoTo goo Error 5 Console.WriteLine(sPath) Exit Sub -foo: - sPath &= "foo" +goo: + sPath &= "goo" Console.WriteLine(sPath) End Sub End Module @@ -52,7 +52,7 @@ Module Module1 On Error GoTo -1 Error 5 exit sub -foo: +goo: Resume End Sub End Module @@ -75,7 +75,7 @@ Module Module1 On Error GoTo 0 Error 5 exit sub -Foo: +Goo: Resume End Sub End Module @@ -366,7 +366,7 @@ End Module Sub Goto_MissingLabel() 'Error - label is not present - On Error GoTo foo + On Error GoTo goo End Sub @@ -393,7 +393,7 @@ End Module Diagnostic(ERRID.ERR_ExpectedDeclaration, "sing"), Diagnostic(ERRID.ERR_ExpectedEOS, "."), Diagnostic(ERRID.ERR_DuplicateProcDef1, "GotoLabelInDifferentMethod").WithArguments("Public Sub GotoLabelInDifferentMethod()"), - Diagnostic(ERRID.ERR_LabelNotDefined1, "foo").WithArguments("foo"), + Diagnostic(ERRID.ERR_LabelNotDefined1, "goo").WithArguments("goo"), Diagnostic(ERRID.ERR_LabelNotDefined1, "diffMethodLabel").WithArguments("diffMethodLabel"), Diagnostic(ERRID.ERR_LabelNotDefined1, "DifferentMethod").WithArguments("DifferentMethod")) End Sub @@ -416,16 +416,16 @@ End Module Sub TryAndOnErrorInSameMethod() 'Nested Try - On Error GoTo foo - foo: + On Error GoTo goo + goo: Catch ex As Exception End Try End Sub Sub OnErrorAndTryInSameMethod() 'Sequential - On Error GoTo foo - foo: + On Error GoTo goo + goo: Try Catch ex As Exception End Try @@ -437,8 +437,8 @@ End Module Dim compilation = CreateCompilationWithMscorlibAndVBRuntime(compilationDef, TestOptions.ReleaseExe) Dim ExpectedOutput = @@ -447,8 +447,8 @@ End Module End Try]]> compilation.VerifyDiagnostics(Diagnostic(ERRID.ERR_TryAndOnErrorDoNotMix, ExpectedOutput), - Diagnostic(ERRID.ERR_TryAndOnErrorDoNotMix, "On Error GoTo foo"), - Diagnostic(ERRID.ERR_TryAndOnErrorDoNotMix, "On Error GoTo foo"), + Diagnostic(ERRID.ERR_TryAndOnErrorDoNotMix, "On Error GoTo goo"), + Diagnostic(ERRID.ERR_TryAndOnErrorDoNotMix, "On Error GoTo goo"), Diagnostic(ERRID.ERR_TryAndOnErrorDoNotMix, ExpectedOutput2) ) End Sub @@ -461,8 +461,8 @@ End Module Module Module1 Public Sub Main - On Error GoTo foo - foo: + On Error GoTo goo + goo: End Sub End Module @@ -473,8 +473,8 @@ End Module options:=TestOptions.ReleaseDll.WithEmbedVbCoreRuntime(True)) Dim ExpectedOutput = @@ -616,16 +616,16 @@ End Module End Sub 'Error Outside of Method Body - On Error Goto foo + On Error Goto goo - Sub Foo + Sub Goo End Sub End Module Dim compilation = CreateCompilationWithMscorlibAndVBRuntime(compilationDef, TestOptions.ReleaseExe) - compilation.VerifyDiagnostics(Diagnostic(ERRID.ERR_ExecutableAsDeclaration, "On Error Goto foo")) + compilation.VerifyDiagnostics(Diagnostic(ERRID.ERR_ExecutableAsDeclaration, "On Error Goto goo")) End Sub @@ -641,7 +641,7 @@ End Module Sub Main End Sub - Class Foo + Class Goo Sub Method() On Error GoTo CLassMethodLabel @@ -662,7 +662,7 @@ End Module End Class - Structure Foo_Struct + Structure Goo_Struct Sub Method() On Error GoTo StructMethodLabel @@ -682,7 +682,7 @@ End Module End Property End Structure - Class GenericFoo(Of t) + Class GenericGoo(Of t) Sub Method() 'Normal Method In Generic Class On Error GoTo CLassMethodLabel @@ -857,9 +857,9 @@ End Module On Error GoTo handler SyncLock lock - On Error GoTo foo + On Error GoTo goo - foo: + goo: Resume Next End SyncLock Exit Sub @@ -870,7 +870,7 @@ End Module Dim compilation = CreateCompilationWithMscorlibAndVBRuntime(compilationDef, TestOptions.ReleaseExe) compilation.VerifyDiagnostics(Diagnostic(ERRID.ERR_LabelNotDefined1, "handler").WithArguments("handler"), - Diagnostic(ERRID.ERR_OnErrorInSyncLock, "On Error GoTo foo")) + Diagnostic(ERRID.ERR_OnErrorInSyncLock, "On Error GoTo goo")) End Sub diff --git a/src/Compilers/VisualBasic/Test/Emit/ExpressionTrees/CodeGenExprLambda.vb b/src/Compilers/VisualBasic/Test/Emit/ExpressionTrees/CodeGenExprLambda.vb index 80f57c6c9c1b5..0532a81b76f73 100644 --- a/src/Compilers/VisualBasic/Test/Emit/ExpressionTrees/CodeGenExprLambda.vb +++ b/src/Compilers/VisualBasic/Test/Emit/ExpressionTrees/CodeGenExprLambda.vb @@ -2194,12 +2194,12 @@ Imports System Imports System.Linq.Expressions Module Form1 - Private Function Foo(p As Expression(Of Func(Of Object, Object))) As Expression(Of Func(Of Object, Object)) + Private Function Goo(p As Expression(Of Func(Of Object, Object))) As Expression(Of Func(Of Object, Object)) Return p End Function Public Sub Main() - Dim ret As Expression(Of Func(Of Object, Object, Object, Object)) = Function(x, y, z) Foo(Function() Function(w) w) + Dim ret As Expression(Of Func(Of Object, Object, Object, Object)) = Function(x, y, z) Goo(Function() Function(w) w) Console.WriteLine(ret.Dump) End Sub End Module @@ -2224,7 +2224,7 @@ Lambda( Convert( Call( - method: System.Linq.Expressions.Expression`1[System.Func`2[System.Object,System.Object]] Foo(System.Linq.Expressions.Expression`1[System.Func`2[System.Object,System.Object]]) in Form1 ( + method: System.Linq.Expressions.Expression`1[System.Func`2[System.Object,System.Object]] Goo(System.Linq.Expressions.Expression`1[System.Func`2[System.Object,System.Object]]) in Form1 ( Quote( Lambda( Parameter( @@ -2286,12 +2286,12 @@ Imports System Imports System.Linq.Expressions Module Form1 - Private Function Foo(p As Expression(Of Func(Of Object, Object))) As Expression(Of Func(Of Object, Object)) + Private Function Goo(p As Expression(Of Func(Of Object, Object))) As Expression(Of Func(Of Object, Object)) Return p End Function Public Sub Main() - Dim ret As Expression(Of Func(Of Object, Object, Object, Object)) = Function(x, y, z) Foo(Function(w) w) + Dim ret As Expression(Of Func(Of Object, Object, Object, Object)) = Function(x, y, z) Goo(Function(w) w) Console.WriteLine(ret.Dump) End Sub End Module @@ -2316,7 +2316,7 @@ Lambda( Convert( Call( - method: System.Linq.Expressions.Expression`1[System.Func`2[System.Object,System.Object]] Foo(System.Linq.Expressions.Expression`1[System.Func`2[System.Object,System.Object]]) in Form1 ( + method: System.Linq.Expressions.Expression`1[System.Func`2[System.Object,System.Object]] Goo(System.Linq.Expressions.Expression`1[System.Func`2[System.Object,System.Object]]) in Form1 ( Quote( Lambda( Parameter( @@ -2354,7 +2354,7 @@ Imports System Imports System.Linq.Expressions Module Form1 - Private Function Foo(p As Expression(Of Func(Of Object, Func(Of Object, Object)))) As Func(Of Object, Object) + Private Function Goo(p As Expression(Of Func(Of Object, Func(Of Object, Object)))) As Func(Of Object, Object) Return p.Compile.Invoke(Nothing) End Function @@ -2363,7 +2363,7 @@ Module Form1 End Function Public Sub Main() - Dim ret As Expression(Of Func(Of Object, Object, Object, Object)) = Function(x, y, z) Foo(Function() AddressOf Bar) + Dim ret As Expression(Of Func(Of Object, Object, Object, Object)) = Function(x, y, z) Goo(Function() AddressOf Bar) Console.WriteLine(ret.Dump) End Sub End Module @@ -2389,7 +2389,7 @@ Lambda( Convert( Call( - method: System.Func`2[System.Object,System.Object] Foo(System.Linq.Expressions.Expression`1[System.Func`2[System.Object,System.Func`2[System.Object,System.Object]]]) in Form1 ( + method: System.Func`2[System.Object,System.Object] Goo(System.Linq.Expressions.Expression`1[System.Func`2[System.Object,System.Func`2[System.Object,System.Object]]]) in Form1 ( Quote( Lambda( Parameter( @@ -2459,7 +2459,7 @@ Imports System Imports System.Linq.Expressions Module Form1 - Private Function Foo(p As Expression(Of Func(Of Object, Func(Of Object, Object)))) As Func(Of Object, Object) + Private Function Goo(p As Expression(Of Func(Of Object, Func(Of Object, Object)))) As Func(Of Object, Object) Return p.Compile.Invoke(Nothing) End Function @@ -2468,7 +2468,7 @@ Module Form1 End Function Public Sub Main() - Dim ret As Expression(Of Func(Of Object, Object, Object, Object)) = Function(x, y, z) Foo(Function() AddressOf Bar) + Dim ret As Expression(Of Func(Of Object, Object, Object, Object)) = Function(x, y, z) Goo(Function() AddressOf Bar) Console.WriteLine(ret.Dump) End Sub End Module @@ -2494,7 +2494,7 @@ Lambda( Convert( Call( - method: System.Func`2[System.Object,System.Object] Foo(System.Linq.Expressions.Expression`1[System.Func`2[System.Object,System.Func`2[System.Object,System.Object]]]) in Form1 ( + method: System.Func`2[System.Object,System.Object] Goo(System.Linq.Expressions.Expression`1[System.Func`2[System.Object,System.Func`2[System.Object,System.Object]]]) in Form1 ( Quote( Lambda( Parameter( @@ -2559,14 +2559,14 @@ Imports System Imports System.Linq.Expressions Module Form1 - Private Function Foo(p As Expression(Of Func(Of Object, Func(Of Object, Object)))) As Func(Of Object, Object) + Private Function Goo(p As Expression(Of Func(Of Object, Func(Of Object, Object)))) As Func(Of Object, Object) Return p.Compile.Invoke(Nothing) End Function Public Sub Main() - Dim ret1 = DirectCast(Function(x, y, z) Foo(Function() Function(w) w), Expression(Of Func(Of Object, Object, Object, Object))) + Dim ret1 = DirectCast(Function(x, y, z) Goo(Function() Function(w) w), Expression(Of Func(Of Object, Object, Object, Object))) Console.WriteLine(ret1.Dump) - Dim ret2 = TryCast(Function(x, y, z) Foo(Function() Function(w) w), Expression(Of Func(Of Object, Object, Object, Object))) + Dim ret2 = TryCast(Function(x, y, z) Goo(Function() Function(w) w), Expression(Of Func(Of Object, Object, Object, Object))) Console.WriteLine(ret2.Dump) End Sub End Module @@ -2591,7 +2591,7 @@ Lambda( Convert( Call( - method: System.Func`2[System.Object,System.Object] Foo(System.Linq.Expressions.Expression`1[System.Func`2[System.Object,System.Func`2[System.Object,System.Object]]]) in Form1 ( + method: System.Func`2[System.Object,System.Object] Goo(System.Linq.Expressions.Expression`1[System.Func`2[System.Object,System.Func`2[System.Object,System.Object]]]) in Form1 ( Quote( Lambda( Parameter( @@ -2657,7 +2657,7 @@ Lambda( Convert( Call( - method: System.Func`2[System.Object,System.Object] Foo(System.Linq.Expressions.Expression`1[System.Func`2[System.Object,System.Func`2[System.Object,System.Object]]]) in Form1 ( + method: System.Func`2[System.Object,System.Object] Goo(System.Linq.Expressions.Expression`1[System.Func`2[System.Object,System.Func`2[System.Object,System.Object]]]) in Form1 ( Quote( Lambda( Parameter( @@ -2716,14 +2716,14 @@ Imports System Imports System.Linq.Expressions Module Form1 - Private Function Foo(p As Expression(Of Func(Of Object, Object))) As Expression(Of Func(Of Object, Object)) + Private Function Goo(p As Expression(Of Func(Of Object, Object))) As Expression(Of Func(Of Object, Object)) Return p End Function Public Sub Main() Dim a As Integer = 1 Dim b As Double = 2 - Dim ret As Expression(Of Func(Of Object, Object, Object, Object)) = Function(x, y, z) Foo(Function(w) a + b + w) + Dim ret As Expression(Of Func(Of Object, Object, Object, Object)) = Function(x, y, z) Goo(Function(w) a + b + w) Console.WriteLine(ret.Dump) End Sub End Module @@ -2748,7 +2748,7 @@ Lambda( Convert( Call( - method: System.Linq.Expressions.Expression`1[System.Func`2[System.Object,System.Object]] Foo(System.Linq.Expressions.Expression`1[System.Func`2[System.Object,System.Object]]) in Form1 ( + method: System.Linq.Expressions.Expression`1[System.Func`2[System.Object,System.Object]] Goo(System.Linq.Expressions.Expression`1[System.Func`2[System.Object,System.Object]]) in Form1 ( Quote( Lambda( Parameter( @@ -3524,7 +3524,7 @@ Module Form1 Function Func3(Optional ByVal x As Integer = 42) As Long Return Nothing End Function - Function Foo(ByVal ds As DeleSub1) As Boolean + Function Goo(ByVal ds As DeleSub1) As Boolean Return Nothing End Function @@ -3533,7 +3533,7 @@ Module Form1 Console.WriteLine(l1.Dump) Dim l2 As Expression(Of Func(Of DeleFunc1)) = Function() New DeleFunc1(AddressOf Func1) Console.WriteLine(l2.Dump) - Dim l3 As Expression(Of Func(Of Boolean)) = Function() Foo(AddressOf Func2) + Dim l3 As Expression(Of Func(Of Boolean)) = Function() Goo(AddressOf Func2) Console.WriteLine(l3.Dump) Dim l4 As Expression(Of Func(Of DeleFunc2)) = Function() CType(AddressOf Func3, DeleFunc2) Console.WriteLine(l4.Dump) @@ -3608,7 +3608,7 @@ Lambda( body { Call( - method: Boolean Foo(DeleSub1) in Form1 ( + method: Boolean Goo(DeleSub1) in Form1 ( Lambda( Parameter( a0 @@ -3765,22 +3765,22 @@ Module Form1 Function GetY() As Object Return From s In queryObj Where y Select s End Function - Function FooToTheX() As Object - Return From s In queryObj Where Foo(x) Select s + Function GooToTheX() As Object + Return From s In queryObj Where Goo(x) Select s End Function - Function FooToTheY() As Object - Return From s In queryObj Where Foo(y) Select s + Function GooToTheY() As Object + Return From s In queryObj Where Goo(y) Select s End Function - Function FooToTheLocal() As Object + Function GooToTheLocal() As Object Dim t As Integer = 1 - Return From s In queryObj Where Foo(t) Select s + Return From s In queryObj Where Goo(t) Select s End Function - Function FooToTheLocalAndCopyBack() As Object + Function GooToTheLocalAndCopyBack() As Object Dim t As String = "1" - Return From s In queryObj Where Foo(t) Select s + Return From s In queryObj Where Goo(t) Select s End Function End Class - Function Foo(ByRef x As Integer) As Boolean + Function Goo(ByRef x As Integer) As Boolean x = 42 Return Nothing End Function @@ -3789,10 +3789,10 @@ Module Form1 Dim c1 As New Class1 c1.GetX() c1.GetY() - c1.FooToTheX() - c1.FooToTheY() - c1.FooToTheLocal() - c1.FooToTheLocalAndCopyBack() + c1.GooToTheX() + c1.GooToTheY() + c1.GooToTheLocal() + c1.GooToTheLocalAndCopyBack() End Sub End Module ]]> @@ -3873,7 +3873,7 @@ Lambda( body { Call( - method: Boolean Foo(Int32 ByRef) in Form1 ( + method: Boolean Goo(Int32 ByRef) in Form1 ( Constant( -3 type: System.Int32 @@ -3909,7 +3909,7 @@ Lambda( body { Call( - method: Boolean Foo(Int32 ByRef) in Form1 ( + method: Boolean Goo(Int32 ByRef) in Form1 ( ConvertChecked( MemberAccess( Constant( @@ -3952,7 +3952,7 @@ Lambda( body { Call( - method: Boolean Foo(Int32 ByRef) in Form1 ( + method: Boolean Goo(Int32 ByRef) in Form1 ( MemberAccess( Constant( Form1+Class1+_Closure$__7-0 @@ -3992,7 +3992,7 @@ Lambda( body { Call( - method: Boolean Foo(Int32 ByRef) in Form1 ( + method: Boolean Goo(Int32 ByRef) in Form1 ( ConvertChecked( MemberAccess( Constant( @@ -4869,11 +4869,11 @@ Option Explicit Off Module Form1 Dim queryObj As New QueryHelper(Of String) - Function Foo(ByVal x As Integer) As String + Function Goo(ByVal x As Integer) As String Return Nothing End Function Sub Main() - Dim scenario3 = From var1 In queryObj, var2 In queryObj From var3 In queryObj Select expr3 = Foo(var1) & var3 + Dim scenario3 = From var1 In queryObj, var2 In queryObj From var3 In queryObj Select expr3 = Goo(var1) & var3 End Sub End Module ]]> @@ -4925,7 +4925,7 @@ Lambda( method: System.String Concat(System.String, System.String) in System.String ( Call( - method: System.String Foo(Int32) in Form1 ( + method: System.String Goo(Int32) in Form1 ( ConvertChecked( MemberAccess( Parameter( @@ -4967,11 +4967,11 @@ Imports System.Collections.Generic Module Form1 Dim queryObj As New QueryHelper(Of String) - Function Foo(ByVal x As Integer) As String + Function Goo(ByVal x As Integer) As String Return Nothing End Function Sub Main() - Dim scenario3 = From var1 In queryObj, var2 In queryObj From var3 In queryObj Select expr3 = Foo(var1) & var3 + Dim scenario3 = From var1 In queryObj, var2 In queryObj From var3 In queryObj Select expr3 = Goo(var1) & var3 End Sub End Module ]]> @@ -5093,7 +5093,7 @@ End Module IL_0168: dup IL_0169: ldc.i4.0 IL_016a: ldnull - IL_016b: ldtoken "Function Form1.Foo(Integer) As String" + IL_016b: ldtoken "Function Form1.Goo(Integer) As String" IL_0170: call "Function System.Reflection.MethodBase.GetMethodFromHandle(System.RuntimeMethodHandle) As System.Reflection.MethodBase" IL_0175: castclass "System.Reflection.MethodInfo" IL_017a: ldc.i4.1 @@ -5343,8 +5343,8 @@ Module Form1 Dim i2 As SByte = -2 Dim d3? As Decimal = 3.3 - Delegate Sub Foo() - Function Bar(ByVal s As Foo) As Boolean + Delegate Sub Goo() + Function Bar(ByVal s As Goo) As Boolean Return Nothing End Function Sub SubRoutine() @@ -5366,7 +5366,7 @@ Module Form1 Dim scenario1 = From s In queryObj Where c1.Prop Select s Dim scenario2 = From s In queryObj Where c1.Prop And c1.field2 Select s - Dim scenario3 = From s In queryObj Where c1!Foo Select s + Dim scenario3 = From s In queryObj Where c1!Goo Select s Dim scenario4 = From s In queryObj Where c2!Day = c2.datetime2 Select s Dim scenario5 = From s In queryObj Where RefParam(c2.MyProperty3) Select s Dim scenario6 = From s In queryObj Where RefParam((c2.MyProperty3)) Select s @@ -5377,7 +5377,7 @@ Module Form1 Dim q2 = From i In col Where i > 2 Select i Group Join j In col1 On i Equals j Into Count(), Sum(j) Dim q3 = From i In col Where i > 2 Select i Group Join j In col1 On i Equals j Into Count() From k In col Where k > 2 Select k - Dim d As Foo = Nothing + Dim d As Goo = Nothing Dim scenario7 = From s In queryObj Where Bar(AddressOf SubRoutine) Select s Dim scenario8 = From s In queryObj Where Bar(d) Select s End Sub @@ -5410,11 +5410,11 @@ Module Form1 Class Class2 : Inherits Class1 End Class - Sub Foo1(Of T As Structure)(ByVal x As T?) + Sub Goo1(Of T As Structure)(ByVal x As T?) F(Function() If(x, Nothing)) F(Function() x is Nothing) End Sub - 'Sub Foo2(Of T As Structure)(ByVal x As T?) + 'Sub Goo2(Of T As Structure)(ByVal x As T?) ' F(Function() If(x, CObj(3.3))) 'End Sub @@ -5439,10 +5439,10 @@ Module Form1 Dim x? As Struct1 = New Struct1() Dim c2 As Class2 = New Class2() - Foo1(Of Struct1)(Nothing) - Foo1(x) - 'Foo2(Of Struct1)(Nothing) - 'Foo2(x) + Goo1(Of Struct1)(Nothing) + Goo1(x) + 'Goo2(Of Struct1)(Nothing) + 'Goo2(x) Bar(Of Class2)(Nothing) Bar(c2) Moo(Of Class2, Class2)(Nothing) @@ -5473,7 +5473,7 @@ Module Form1 End Operator End Structure - Sub Foo2(Of T As Structure)(ByVal x As T?) + Sub Goo2(Of T As Structure)(ByVal x As T?) F(Function() If(x, CObj(3.3))) End Sub @@ -5484,8 +5484,8 @@ Module Form1 Sub Main() Dim x? As Struct1 = New Struct1() - Foo2(Of Struct1)(Nothing) - Foo2(x) + Goo2(Of Struct1)(Nothing) + Goo2(x) End Sub End Module ]]> @@ -5604,18 +5604,18 @@ Module Form1 Structure Struct1 Public a As Integer End Structure - Public Function Foo(Of T As Structure)(ByVal x As T?) As Integer + Public Function Goo(Of T As Structure)(ByVal x As T?) As Integer Return Nothing End Function - Sub Foo(ByVal x As Integer) - Console.WriteLine("Printed From 'Sub Foo(ByVal x As Integer)'") + Sub Goo(ByVal x As Integer) + Console.WriteLine("Printed From 'Sub Goo(ByVal x As Integer)'") Console.WriteLine() End Sub Sub Main() - Dim q0 As Expression(Of Func(Of Integer)) = Function() Foo(Of Struct1)(Nothing) + Dim q0 As Expression(Of Func(Of Integer)) = Function() Goo(Of Struct1)(Nothing) Console.WriteLine(q0.Dump) Console.WriteLine("Result: " + q0.Compile()().ToString()) @@ -5635,7 +5635,7 @@ Module Form1 Console.WriteLine(q4.Dump) Call q4.Compile()()("11") - Dim q5 As Expression(Of Func(Of Action)) = Function() AddressOf 0.Foo + Dim q5 As Expression(Of Func(Of Action)) = Function() AddressOf 0.Goo Console.WriteLine(q5.Dump) Call q5.Compile()()() End Sub @@ -6748,14 +6748,14 @@ Imports System.Linq.Expressions Module Module1 - Sub Foo(Of A, B, C)(q As Expression(Of Func(Of A, B, C))) + Sub Goo(Of A, B, C)(q As Expression(Of Func(Of A, B, C))) Console.WriteLine("Infer A={0}", GetType(A)) Console.WriteLine("Infer B={0}", GetType(B)) Console.WriteLine("Infer C={0}", GetType(C)) End Sub Sub Main() - Foo(Function(x As Decimal, y As String) 4) + Goo(Function(x As Decimal, y As String) 4) End Sub End Module ]]> @@ -7657,22 +7657,22 @@ Module Program Delegate Function MyFuncV(Of T)(ByVal x As T, ByVal y As T) As T Delegate Function MyFunc2V(Of T)(ByVal x As T) As T - Sub Foo(Of T)(ByVal x As Expression(Of MyFunc(Of T))) + Sub Goo(Of T)(ByVal x As Expression(Of MyFunc(Of T))) End Sub - Sub Foo2(Of T)(ByVal x As Expression(Of MyFunc2(Of T))) + Sub Goo2(Of T)(ByVal x As Expression(Of MyFunc2(Of T))) End Sub - Sub Foo3(Of T)(ByVal x As Expression(Of MyFuncV(Of T))) + Sub Goo3(Of T)(ByVal x As Expression(Of MyFuncV(Of T))) End Sub - Sub Foo4(Of T)(ByVal x As Expression(Of MyFunc2V(Of T))) + Sub Goo4(Of T)(ByVal x As Expression(Of MyFunc2V(Of T))) End Sub Sub Main(args As String()) 'COMPILEERROR: BC36538, "Function(ByRef x As Double, y As Integer) 1.1" - Foo(Function(ByRef x As Double, y As Integer) 1.1) 'Causes compile time error + Goo(Function(ByRef x As Double, y As Integer) 1.1) 'Causes compile time error 'COMPILEERROR: BC36538, "Function(ByRef x As Double) 1.1" - Foo2(Function(ByRef x As Double) 1.1) 'Regression Scenario - Previously No compile time error + Goo2(Function(ByRef x As Double) 1.1) 'Regression Scenario - Previously No compile time error 'COMPILEERROR: BC36538, "Function() 1.1" - Foo(Function() 1.1) + Goo(Function() 1.1) End Sub End Module ]]> @@ -7680,13 +7680,13 @@ End Module VerifyExpressionTreesDiagnostics(file, BC36538: References to 'ByRef' parameters cannot be converted to an expression tree. - Foo(Function(ByRef x As Double, y As Integer) 1.1) 'Causes compile time error + Goo(Function(ByRef x As Double, y As Integer) 1.1) 'Causes compile time error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ BC36538: References to 'ByRef' parameters cannot be converted to an expression tree. - Foo2(Function(ByRef x As Double) 1.1) 'Regression Scenario - Previously No compile time error + Goo2(Function(ByRef x As Double) 1.1) 'Regression Scenario - Previously No compile time error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ BC36538: References to 'ByRef' parameters cannot be converted to an expression tree. - Foo(Function() 1.1) + Goo(Function() 1.1) ~~~~~~~~~~~~~~ ) End Sub @@ -7946,17 +7946,17 @@ Module Form1 Dim queryObj As New QueryHelper(Of String) Public x - Function Foo(ByVal x As Long) + Function Goo(ByVal x As Long) Return Nothing End Function - Function Foo(ByVal x As Short) + Function Goo(ByVal x As Short) Return Nothing End Function Sub Main() - Dim scenario1 = From s In queryObj Where x.Foo() Select s - Dim scenario2 = From s In queryObj Where Foo(x) Select s - Dim scenario3 = From s In queryObj Where CBool(Foo(x)) Select s + Dim scenario1 = From s In queryObj Where x.Goo() Select s + Dim scenario2 = From s In queryObj Where Goo(x) Select s + Dim scenario3 = From s In queryObj Where CBool(Goo(x)) Select s End Sub End Module ]]> @@ -7964,13 +7964,13 @@ End Module VerifyExpressionTreesDiagnostics(file, BC36604: Late binding operations cannot be converted to an expression tree. - Dim scenario1 = From s In queryObj Where x.Foo() Select s + Dim scenario1 = From s In queryObj Where x.Goo() Select s ~~~~~~~ BC36604: Late binding operations cannot be converted to an expression tree. - Dim scenario2 = From s In queryObj Where Foo(x) Select s + Dim scenario2 = From s In queryObj Where Goo(x) Select s ~~~~~~ BC36604: Late binding operations cannot be converted to an expression tree. - Dim scenario3 = From s In queryObj Where CBool(Foo(x)) Select s + Dim scenario3 = From s In queryObj Where CBool(Goo(x)) Select s ~~~~~~ ) End Sub @@ -8248,19 +8248,19 @@ Friend Module M End Structure Sub Main() - Foo1(Of X)(Nothing) - Foo1(New X()) - Foo2(Of X)() + Goo1(Of X)(Nothing) + Goo1(New X()) + Goo2(Of X)() End Sub - Sub Foo1(Of T As Structure)(ByVal x As T?) + Sub Goo1(Of T As Structure)(ByVal x As T?) ExprTest(Function() x Is Nothing) ExprTest(Function() x IsNot Nothing) ExprTest(Function() Nothing Is x) ExprTest(Function() Nothing IsNot x) End Sub - Sub Foo2(Of T As Structure)() + Sub Goo2(Of T As Structure)() ExprTest(Function() CType(Nothing, X?)) ExprTest(Function() CType(Nothing, X)) ExprTest(Function() CType(Nothing, T?)) @@ -8307,19 +8307,19 @@ Friend Module M End Structure Sub Main() - Foo1(Of X)(Nothing) - Foo1(New X()) - Foo2(Of X)() + Goo1(Of X)(Nothing) + Goo1(New X()) + Goo2(Of X)() End Sub - Sub Foo1(Of T As Structure)(ByVal x As T?) + Sub Goo1(Of T As Structure)(ByVal x As T?) ExprTest(Function() x Is Nothing) ExprTest(Function() x IsNot Nothing) ExprTest(Function() Nothing Is x) ExprTest(Function() Nothing IsNot x) End Sub - Sub Foo2(Of T As Structure)() + Sub Goo2(Of T As Structure)() ExprTest(Function() CType(Nothing, X?)) ExprTest(Function() CType(Nothing, X)) ExprTest(Function() CType(Nothing, T?)) diff --git a/src/Compilers/VisualBasic/Test/Emit/ExpressionTrees/ExpTreeTestResources.Designer.vb b/src/Compilers/VisualBasic/Test/Emit/ExpressionTrees/ExpTreeTestResources.Designer.vb index ec195a5cf934c..3d413f8f29f4f 100644 --- a/src/Compilers/VisualBasic/Test/Emit/ExpressionTrees/ExpTreeTestResources.Designer.vb +++ b/src/Compilers/VisualBasic/Test/Emit/ExpressionTrees/ExpTreeTestResources.Designer.vb @@ -1235,7 +1235,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests ''' body { ''' Call( ''' <NULL> - ''' method: Int32 Foo[Struct1](System.Nullable`1[Form1+Struct1]) in Form1 ( + ''' method: Int32 Goo[Struct1](System.Nullable`1[Form1+Struct1]) in Form1 ( ''' Constant( ''' null ''' type: System.Nullable`1[Form1+Struct1] diff --git a/src/Compilers/VisualBasic/Test/Emit/ExpressionTrees/Results/ExprTree_LegacyTests08_Result.txt b/src/Compilers/VisualBasic/Test/Emit/ExpressionTrees/Results/ExprTree_LegacyTests08_Result.txt index f46147673d0de..5ce0c76bda81c 100644 --- a/src/Compilers/VisualBasic/Test/Emit/ExpressionTrees/Results/ExprTree_LegacyTests08_Result.txt +++ b/src/Compilers/VisualBasic/Test/Emit/ExpressionTrees/Results/ExprTree_LegacyTests08_Result.txt @@ -1,4 +1,4 @@ -Lambda( +Lambda( body { SubtractChecked( MemberAccess( @@ -280,7 +280,7 @@ Lambda( ) method: Boolean get_MyProperty(System.String) in Form1+Class1 ( Constant( - Foo + Goo type: System.String ) ) @@ -848,13 +848,13 @@ Lambda( body { Call( - method: Boolean Bar(Foo) in Form1 ( + method: Boolean Bar(Goo) in Form1 ( Convert( Call( method: System.Delegate CreateDelegate(System.Type, System.Object, System.Reflection.MethodInfo, Boolean) in System.Delegate ( Constant( - Form1+Foo + Form1+Goo type: System.Type ) Constant( @@ -872,7 +872,7 @@ Lambda( ) type: System.Delegate ) - type: Form1+Foo + type: Form1+Goo ) ) type: System.Boolean @@ -905,14 +905,14 @@ Lambda( body { Call( - method: Boolean Bar(Foo) in Form1 ( + method: Boolean Bar(Goo) in Form1 ( MemberAccess( Constant( Form1+_Closure$__18-0 type: Form1+_Closure$__18-0 ) -> $VB$Local_d - type: Form1+Foo + type: Form1+Goo ) ) type: System.Boolean diff --git a/src/Compilers/VisualBasic/Test/Emit/ExpressionTrees/Results/ExprTree_LegacyTests10_Result.txt b/src/Compilers/VisualBasic/Test/Emit/ExpressionTrees/Results/ExprTree_LegacyTests10_Result.txt index 2ea4bfb5f14fd..99590ef84637b 100644 --- a/src/Compilers/VisualBasic/Test/Emit/ExpressionTrees/Results/ExprTree_LegacyTests10_Result.txt +++ b/src/Compilers/VisualBasic/Test/Emit/ExpressionTrees/Results/ExprTree_LegacyTests10_Result.txt @@ -1,8 +1,8 @@ -Lambda( +Lambda( body { Call( - method: Int32 Foo[Struct1](System.Nullable`1[Form1+Struct1]) in Form1 ( + method: Int32 Goo[Struct1](System.Nullable`1[Form1+Struct1]) in Form1 ( Constant( null type: System.Nullable`1[Form1+Struct1] @@ -271,7 +271,7 @@ Lambda( body { Call( - method: Void Foo(Int32) in Form1 ( + method: Void Goo(Int32) in Form1 ( Constant( 0 type: System.Int32 @@ -288,4 +288,4 @@ Lambda( type: System.Func`1[System.Action] ) -Printed From 'Sub Foo(ByVal x As Integer)' \ No newline at end of file +Printed From 'Sub Goo(ByVal x As Integer)' \ No newline at end of file diff --git a/src/Compilers/VisualBasic/Test/Emit/PDB/ChecksumTests.vb b/src/Compilers/VisualBasic/Test/Emit/PDB/ChecksumTests.vb index a293415f66947..4ee84c09109d6 100644 --- a/src/Compilers/VisualBasic/Test/Emit/PDB/ChecksumTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/PDB/ChecksumTests.vb @@ -36,7 +36,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.PDB - + @@ -457,13 +457,13 @@ Imports System.Diagnostics Module Module1 Sub Main() - For Each i In Foo + For Each i In Goo Console.Write(i) Next End Sub <DebuggerHidden> - Iterator Function Foo() As IEnumerable(Of Integer) + Iterator Function Goo() As IEnumerable(Of Integer) Yield 1 Yield 2 End Function @@ -473,11 +473,11 @@ End Module Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.DebugExe) - compilation.VerifyPdb("Module1+VB$StateMachine_1_Foo.MoveNext", + compilation.VerifyPdb("Module1+VB$StateMachine_1_Goo.MoveNext", - + diff --git a/src/Compilers/VisualBasic/Test/Emit/PDB/PDBLambdaTests.vb b/src/Compilers/VisualBasic/Test/Emit/PDB/PDBLambdaTests.vb index d137b1ace81a7..f9a515d75e30b 100644 --- a/src/Compilers/VisualBasic/Test/Emit/PDB/PDBLambdaTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/PDB/PDBLambdaTests.vb @@ -91,7 +91,7 @@ Module M1 Console.Write(y.ToString()) End Sub - Public Sub Foo(Of TFun1, TFun2)(p As TFun1, p1 As TFun2, p3 As Integer) + Public Sub Goo(Of TFun1, TFun2)(p As TFun1, p1 As TFun2, p3 As Integer) Dim d1 As Action(Of Integer, Integer) = Sub(lifted As Integer, notLifted As Integer) Dim iii As Integer = lifted + notlifted @@ -111,7 +111,7 @@ Module M1 Public Sub Main() Dim inst As New C1(Of Integer) - inst.Foo(Of Integer, Integer)(42, 333, 432) + inst.Goo(Of Integer, Integer)(42, 333, 432) End Sub End Module ]]> diff --git a/src/Compilers/VisualBasic/Test/Emit/PDB/PDBNamespaceScopes.vb b/src/Compilers/VisualBasic/Test/Emit/PDB/PDBNamespaceScopes.vb index ea2f5e213e2ff..34078d89d11f3 100644 --- a/src/Compilers/VisualBasic/Test/Emit/PDB/PDBNamespaceScopes.vb +++ b/src/Compilers/VisualBasic/Test/Emit/PDB/PDBNamespaceScopes.vb @@ -397,7 +397,7 @@ Imports System.Reflection Imports System.Runtime.InteropServices - + Namespace N diff --git a/src/Compilers/VisualBasic/Test/Emit/PDB/PDBTests.vb b/src/Compilers/VisualBasic/Test/Emit/PDB/PDBTests.vb index 6ca957ff17fbe..a3aeda516dc24 100644 --- a/src/Compilers/VisualBasic/Test/Emit/PDB/PDBTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/PDB/PDBTests.vb @@ -20,7 +20,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.PDB Public Sub EmitDebugInfoForSourceTextWithoutEncoding1() - Dim tree1 = SyntaxFactory.ParseSyntaxTree("Class A : End Class", path:="Foo.vb", encoding:=Nothing) + Dim tree1 = SyntaxFactory.ParseSyntaxTree("Class A : End Class", path:="Goo.vb", encoding:=Nothing) Dim tree2 = SyntaxFactory.ParseSyntaxTree("Class B : End Class", path:="", encoding:=Nothing) Dim tree3 = SyntaxFactory.ParseSyntaxTree(SourceText.From("Class C : End Class", encoding:=Nothing), path:="Bar.vb") Dim tree4 = SyntaxFactory.ParseSyntaxTree("Class D : End Class", path:="Baz.vb", encoding:=Encoding.UTF8) @@ -37,7 +37,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.PDB Public Sub EmitDebugInfoForSourceTextWithoutEncoding2() - Dim tree1 = SyntaxFactory.ParseSyntaxTree("Class A" & vbCrLf & "Sub F() : End Sub : End Class", path:="Foo.vb", encoding:=Encoding.Unicode) + Dim tree1 = SyntaxFactory.ParseSyntaxTree("Class A" & vbCrLf & "Sub F() : End Sub : End Class", path:="Goo.vb", encoding:=Encoding.Unicode) Dim tree2 = SyntaxFactory.ParseSyntaxTree("Class B" & vbCrLf & "Sub F() : End Sub : End Class", path:="", encoding:=Nothing) Dim tree3 = SyntaxFactory.ParseSyntaxTree("Class C" & vbCrLf & "Sub F() : End Sub : End Class", path:="Bar.vb", encoding:=New UTF8Encoding(True, False)) Dim tree4 = SyntaxFactory.ParseSyntaxTree(SourceText.From("Class D" & vbCrLf & "Sub F() : End Sub : End Class", New UTF8Encoding(False, False)), path:="Baz.vb") @@ -59,7 +59,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.PDB comp.VerifyPdb( - /> + /> /> /> @@ -3220,7 +3220,7 @@ Option Strict Off Option Explicit Off Imports System -Class FooDerived +Class GooDerived Public Sub ComputeMatrix(ByVal rank As Integer) Dim I As Integer Dim J As Long @@ -3245,7 +3245,7 @@ End Class Module Variety Sub Main() - Dim a As New FooDerived() + Dim a As New GooDerived() a.ComputeMatrix(2) End Sub End Module @@ -3257,11 +3257,11 @@ End Module source, TestOptions.DebugExe) - compilation.VerifyPdb("FooDerived.ComputeMatrix", + compilation.VerifyPdb("GooDerived.ComputeMatrix", - + @@ -3544,10 +3544,10 @@ Imports System Module Module1 Sub Main() - Const foo as String = "<%= longStringValue %>" + Const goo as String = "<%= longStringValue %>" Console.WriteLine("Hello Word.") - Console.WriteLine(foo) + Console.WriteLine(goo) End Sub End Module @@ -3562,7 +3562,7 @@ End Module 'this new warning was abandoned - 'result.Diagnostics.Verify(Diagnostic(ERRID.WRN_PDBConstantStringValueTooLong).WithArguments("foo", longStringValue.Substring(0, 20) & "...")) + 'result.Diagnostics.Verify(Diagnostic(ERRID.WRN_PDBConstantStringValueTooLong).WithArguments("goo", longStringValue.Substring(0, 20) & "...")) ''ensure that the warning is suppressable 'compilation = CreateCompilationWithMscorlibAndVBRuntime(source, OptionsExe.WithDebugInformationKind(Common.DebugInformationKind.Full).WithOptimizations(False). @@ -3575,8 +3575,8 @@ End Module ' WithSpecificDiagnosticOptions(New Dictionary(Of Integer, ReportWarning) From {{CInt(ERRID.WRN_PDBConstantStringValueTooLong), ReportWarning.Error}})) 'result = compilation.Emit(exebits, Nothing, "DontCare", pdbbits, Nothing) 'Assert.False(result.Success) - 'result.Diagnostics.Verify(Diagnostic(ERRID.WRN_PDBConstantStringValueTooLong).WithArguments("foo", longStringValue.Substring(0, 20) & "...").WithWarningAsError(True), - ' Diagnostic(ERRID.ERR_WarningTreatedAsError).WithArguments("The value assigned to the constant string 'foo' is too long to be used in a PDB file. Consider shortening the value, otherwise the string's value will not be visible in the debugger. Only the debug experience is affected.")) + 'result.Diagnostics.Verify(Diagnostic(ERRID.WRN_PDBConstantStringValueTooLong).WithArguments("goo", longStringValue.Substring(0, 20) & "...").WithWarningAsError(True), + ' Diagnostic(ERRID.ERR_WarningTreatedAsError).WithArguments("The value assigned to the constant string 'goo' is too long to be used in a PDB file. Consider shortening the value, otherwise the string's value will not be visible in the debugger. Only the debug experience is affected.")) End Sub diff --git a/src/Compilers/VisualBasic/Test/Emit/PDB/PDBUsingTests.vb b/src/Compilers/VisualBasic/Test/Emit/PDB/PDBUsingTests.vb index 2e17b54368750..0470b75cd5087 100644 --- a/src/Compilers/VisualBasic/Test/Emit/PDB/PDBUsingTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/PDB/PDBUsingTests.vb @@ -30,7 +30,7 @@ End Class Class C1 Public Shared Sub Main() - Using foo1 As New MyDisposable(), foo2 As New MyDisposable(), foo3 As MyDisposable = Nothing + Using goo1 As New MyDisposable(), goo2 As New MyDisposable(), goo3 As MyDisposable = Nothing Console.WriteLine("Inside Using.") End Using End Sub @@ -69,9 +69,9 @@ End Class - - - + + + diff --git a/src/Compilers/VisualBasic/Test/Emit/PDB/PortablePdbTests.vb b/src/Compilers/VisualBasic/Test/Emit/PDB/PortablePdbTests.vb index 0424998c5be87..3579cf8798875 100644 --- a/src/Compilers/VisualBasic/Test/Emit/PDB/PortablePdbTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/PDB/PortablePdbTests.vb @@ -71,7 +71,7 @@ Class C End Sub End Class " - Dim c = CreateCompilationWithMscorlib(Parse(source, "foo.vb"), options:=TestOptions.DebugDll) + Dim c = CreateCompilationWithMscorlib(Parse(source, "goo.vb"), options:=TestOptions.DebugDll) Dim peBlob = c.EmitToArray(EmitOptions.Default.WithDebugInformationFormat(DebugInformationFormat.Embedded).WithPdbFilePath("a/b/c/d.pdb")) Using peReader = New PEReader(peBlob) @@ -90,7 +90,7 @@ End Class Dim pdbId As BlobContentId Using embeddedMetadataProvider = peReader.ReadEmbeddedPortablePdbDebugDirectoryData(embedded) Dim mdReader = embeddedMetadataProvider.GetMetadataReader() - AssertEx.Equal({"foo.vb"}, mdReader.Documents.Select(Function(doc) mdReader.GetString(mdReader.GetDocument(doc).Name))) + AssertEx.Equal({"goo.vb"}, mdReader.Documents.Select(Function(doc) mdReader.GetString(mdReader.GetDocument(doc).Name))) pdbId = New BlobContentId(mdReader.DebugMetadataHeader.Id) End Using @@ -115,7 +115,7 @@ Class C End Sub End Class " - Dim c = CreateCompilationWithMscorlib(Parse(source, "foo.vb"), options:=TestOptions.DebugDll.WithDeterministic(True)) + Dim c = CreateCompilationWithMscorlib(Parse(source, "goo.vb"), options:=TestOptions.DebugDll.WithDeterministic(True)) Dim peBlob = c.EmitToArray(EmitOptions.Default.WithDebugInformationFormat(DebugInformationFormat.Embedded).WithPdbFilePath("a/b/c/d.pdb")) Using peReader = New PEReader(peBlob) @@ -135,7 +135,7 @@ End Class Dim pdbId As BlobContentId Using embeddedMetadataProvider = peReader.ReadEmbeddedPortablePdbDebugDirectoryData(embedded) Dim mdReader = embeddedMetadataProvider.GetMetadataReader() - AssertEx.Equal({"foo.vb"}, mdReader.Documents.Select(Function(doc) mdReader.GetString(mdReader.GetDocument(doc).Name))) + AssertEx.Equal({"goo.vb"}, mdReader.Documents.Select(Function(doc) mdReader.GetString(mdReader.GetDocument(doc).Name))) pdbId = New BlobContentId(mdReader.DebugMetadataHeader.Id) End Using @@ -173,7 +173,7 @@ End Class } } ") - Dim c = CreateCompilationWithMscorlib(Parse(source, "f:/build/foo.vb"), options:=TestOptions.DebugDll) + Dim c = CreateCompilationWithMscorlib(Parse(source, "f:/build/goo.vb"), options:=TestOptions.DebugDll) Dim pdbStream = New MemoryStream() c.EmitToArray(EmitOptions.Default.WithDebugInformationFormat(DebugInformationFormat.PortablePdb), pdbStream:=pdbStream, sourceLinkStream:=New MemoryStream(sourceLinkBlob)) @@ -209,7 +209,7 @@ End Class } } ") - Dim c = CreateCompilationWithMscorlib(Parse(source, "f:/build/foo.vb"), options:=TestOptions.DebugDll) + Dim c = CreateCompilationWithMscorlib(Parse(source, "f:/build/goo.vb"), options:=TestOptions.DebugDll) Dim peBlob = c.EmitToArray(EmitOptions.Default.WithDebugInformationFormat(DebugInformationFormat.Embedded), sourceLinkStream:=New MemoryStream(sourceLinkBlob)) Using peReader = New PEReader(peBlob) @@ -244,7 +244,7 @@ End Class Throw New Exception("Error!") End Function) - Dim c = CreateCompilationWithMscorlib(Parse(source, "f:/build/foo.vb"), options:=TestOptions.DebugDll) + Dim c = CreateCompilationWithMscorlib(Parse(source, "f:/build/goo.vb"), options:=TestOptions.DebugDll) Dim result = c.Emit(New MemoryStream(), New MemoryStream(), options:=EmitOptions.Default.WithDebugInformationFormat(DebugInformationFormat.PortablePdb), sourceLinkStream:=sourceLinkStream) result.Diagnostics.Verify( @@ -262,7 +262,7 @@ Class C End Sub End Class " - Dim tree = Parse(source, "f:/build/foo.cs") + Dim tree = Parse(source, "f:/build/goo.cs") Dim c = CreateCompilationWithMscorlib(tree, options:=TestOptions.DebugDll) Dim pdbStream = New MemoryStream() @@ -284,7 +284,7 @@ End Class .Text = pdbReader.GetEmbeddedSource(documentHandle) }).Single() - Assert.Equal(embeddedSource.FilePath, "f:/build/foo.cs") + Assert.Equal(embeddedSource.FilePath, "f:/build/goo.cs") Assert.Equal(source, embeddedSource.Text.ToString()) End Using End Sub @@ -300,7 +300,7 @@ Class C End Sub End Class " - Dim tree = Parse(source, "f:/build/foo.cs") + Dim tree = Parse(source, "f:/build/goo.cs") Dim c = CreateCompilationWithMscorlib(tree, options:=TestOptions.DebugDll) Dim pdbStream = New MemoryStream() @@ -324,7 +324,7 @@ End Class .Text = pdbReader.GetEmbeddedSource(documentHandle) }).Single() - Assert.Equal(embeddedSource.FilePath, "f:/build/foo.cs") + Assert.Equal(embeddedSource.FilePath, "f:/build/goo.cs") Assert.Equal(source, embeddedSource.Text.ToString()) End Using End Using diff --git a/src/Compilers/VisualBasic/Test/Emit/Semantics/StaticLocalsSemanticTests.vb b/src/Compilers/VisualBasic/Test/Emit/Semantics/StaticLocalsSemanticTests.vb index 96ea610e21232..7e75a1da3b0ce 100644 --- a/src/Compilers/VisualBasic/Test/Emit/Semantics/StaticLocalsSemanticTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/Semantics/StaticLocalsSemanticTests.vb @@ -216,14 +216,14 @@ Imports System Public Module Module1 Public Sub Main() Dim x As New UDTest(Of Integer) - x.Foo() - x.Foo() - x.Foo() + x.Goo() + x.Goo() + x.Goo() End Sub End Module Public Class UDTest(Of t) - Public Sub Foo() + Public Sub Goo() Static SLItem As Integer = 1 Console.WriteLine(SLItem.ToString) SLItem += 1 @@ -578,12 +578,12 @@ End Module Public Module Module1 Public Sub Main() - Foo() - Foo() - Foo() + Goo() + Goo() + Goo() End Sub - Sub Foo() + Sub Goo() Static a1 As Integer = 1 a1 += 1 Console.WriteLine(a1.ToString) @@ -1042,20 +1042,20 @@ Imports System Public Module Module1 Public Sub Main() Dim Obj As New Base - Obj.Foo() - Obj.Foo() - Obj.Foo() + Obj.Goo() + Obj.Goo() + Obj.Goo() Dim ObjD As New Derived - ObjD.foo() - ObjD.foo() - ObjD.foo() + ObjD.goo() + ObjD.goo() + ObjD.goo() End Sub End Module Class Base - Overridable Sub Foo() + Overridable Sub Goo() Static sl As Integer = 1 Console.WriteLine(sl.ToString) sl += 1 @@ -1063,7 +1063,7 @@ Class Base End Class Class Derived - Sub foo() + Sub goo() Static sl As Integer = 10 Console.WriteLine(sl.ToString) sl += 1 @@ -1312,18 +1312,18 @@ Public Module Module1 Public Sub Main() 'Each time I set property sl should increment - Dim obj1 As New Foo + Dim obj1 As New Goo obj1.sl = 1 obj1.sl = 2 obj1.sl = 3 'Different Object - Dim Obj2 As New Foo With {.sl = 1} + Dim Obj2 As New Goo With {.sl = 1} Obj2.sl = 2 End Sub - Class Foo + Class Goo Public _field As Integer = 0 Public Property sl As Integer Set(value As Integer) @@ -1361,13 +1361,13 @@ Imports System Public Module Module1 Public Sub Main() - Dim obj1 As New Foo - Dim obj2 As New Foo - Dim obj3 As New Foo + Dim obj1 As New Goo + Dim obj2 As New Goo + Dim obj3 As New Goo End Sub - Class Foo + Class Goo Sub New() Static sl As Integer = 1 Console.WriteLine(sl.ToString) @@ -1394,12 +1394,12 @@ Imports System Public Module Module1 Public Sub Main() - Dim obj1 As New Foo - Dim obj2 As New Foo - Dim obj3 As New Foo + Dim obj1 As New Goo + Dim obj2 As New Goo + Dim obj3 As New Goo End Sub - Class Foo + Class Goo Shared Sub New() Static sl As Integer = 1 Console.WriteLine(sl.ToString) @@ -1504,15 +1504,15 @@ End Module Partial Class P1 Public Sub Caller() - Foo() + Goo() End Sub - Partial Private Sub Foo() + Partial Private Sub Goo() End Sub End Class Partial Class P1 - Private Sub Foo() + Private Sub Goo() Static i As Integer = 1 Console.WriteLine(i.ToString) i += 1 @@ -1536,11 +1536,11 @@ End Class Imports System Public Module Module1 Public Sub Main() - Foo() - Foo() + Goo() + Goo() End Sub - Sub Foo() + Sub Goo() Static x As Long = 2 Console.WriteLine(x.ToString) x += 1 'BIND:"x" @@ -1572,11 +1572,11 @@ End Module Imports System Public Module Module1 Public Sub Main() - Foo() - Foo() + Goo() + Goo() End Sub - Sub Foo() + Sub Goo() Static Dim x As Long = 2 Console.WriteLine(x.ToString) x += 1 'BIND:"x" @@ -1604,11 +1604,11 @@ End Module Imports System Public Module Module1 Public Sub Main() - Foo() - Foo() + Goo() + Goo() End Sub - Sub Foo() + Sub Goo() Dim Static x As Long = 2 Console.WriteLine(x.ToString) x += 1 'BIND:"x" @@ -1640,11 +1640,11 @@ End Module Imports System Public Module Module1 Public Sub Main() - Foo() - Foo() + Goo() + Goo() End Sub - Sub Foo() + Sub Goo() Dim x As Long = 2 Console.WriteLine(x.ToString) x += 1 'BIND:"x" diff --git a/src/Compilers/VisualBasic/Test/Emit/XmlLiteralTests.vb b/src/Compilers/VisualBasic/Test/Emit/XmlLiteralTests.vb index 6be482b32de0e..f4984ec5f3fce 100644 --- a/src/Compilers/VisualBasic/Test/Emit/XmlLiteralTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/XmlLiteralTests.vb @@ -4228,7 +4228,7 @@ Imports System.Xml.Linq Module Module1 Dim stuff As XElement = - + 1 @@ -4260,7 +4260,7 @@ End Module]]> CompileAndVerify(comp, expectedOutput:="1" & Environment.NewLine & "2" & Environment.NewLine & "1" & Environment.NewLine & "2" & Environment.NewLine & "1" & Environment.NewLine & "2" & Environment.NewLine & - "foo1") + "goo1") End Sub @@ -4302,13 +4302,13 @@ End Module Imports System.Xml.Linq Class scen1(Of T As XElement) - Sub foo(ByVal o As T) + Sub goo(ByVal o As T) Dim res = o. End Sub End Class ]]> , additionalRefs:=XmlReferences, options:=TestOptions.ReleaseDll). - VerifyIL("scen1(Of T).foo(T)", + VerifyIL("scen1(Of T).goo(T)", .ToString() = "") + Console.Write(.ToString() = "") End Sub End Module ]]> diff --git a/src/Compilers/VisualBasic/Test/Semantic/Binding/Binder_Expressions_Tests.vb b/src/Compilers/VisualBasic/Test/Semantic/Binding/Binder_Expressions_Tests.vb index eab84d019ca17..2157eb2bb4113 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/Binding/Binder_Expressions_Tests.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/Binding/Binder_Expressions_Tests.vb @@ -24,7 +24,7 @@ Imports System Module M1 Sub Main() Dim x as Integer - x = .foo + x = .goo End Sub End Module @@ -33,7 +33,7 @@ End Module AssertTheseDiagnostics(compilation, BC30157: Leading '.' or '!' can only appear inside a 'With' statement. - x = .foo + x = .goo ~~~~ ) End Sub @@ -118,7 +118,7 @@ Module M1 x = System.Collections(Of Decimal) End Sub - Sub foo(y as string) + Sub goo(y as string) dim z as string z = y(of Boolean) End Sub @@ -262,7 +262,7 @@ BC30512: Option Strict On disallows implicit conversions from 'UInteger' to 'Int Imports System Module M1 - Sub Foo(xParam as Integer, ByRef yParam As Long) + Sub Goo(xParam as Integer, ByRef yParam As Long) Console.WriteLine("xParam = {0}", xParam) Console.WriteLine("yParam = {0}", yParam) xParam = 17 @@ -278,7 +278,7 @@ Module M1 y = 16442 Console.WriteLine("x = {0}", x) Console.WriteLine("y = {0}", y) - Foo(x,y) + Goo(x,y) Console.WriteLine("x = {0}", x) Console.WriteLine("y = {0}", y) End Sub @@ -309,8 +309,8 @@ Class C1 Public Sub New() End Sub - Sub Foo() - Console.WriteLine("Called C1.Foo") + Sub Goo() + Console.WriteLine("Called C1.Goo") End Sub End Class @@ -318,12 +318,12 @@ Module M1 Sub Main() dim c as C1 c = new C1() - c.Foo() + c.Goo() End Sub End Module , - expectedOutput:="Called C1.Foo") + expectedOutput:="Called C1.Goo") End Sub ' Test object creation expression @@ -365,7 +365,7 @@ Imports System Module M1 Sub Main() Dim x as Integer - x = foo + x = goo End Sub End Module @@ -373,8 +373,8 @@ End Module AssertTheseDiagnostics(compilation, -BC30451: 'foo' is not declared. It may be inaccessible due to its protection level. - x = foo +BC30451: 'goo' is not declared. It may be inaccessible due to its protection level. + x = goo ~~~ ) End Sub @@ -430,10 +430,10 @@ Module M1 Dim x as Integer Dim cInstance as C cInstance = Nothing - x = N.foo - x = C.foo - x = cInstance.foo - x = M1.foo + x = N.goo + x = C.goo + x = cInstance.goo + x = M1.goo End Sub End Module @@ -441,17 +441,17 @@ End Module AssertTheseDiagnostics(compilation, -BC30456: 'foo' is not a member of 'N'. - x = N.foo +BC30456: 'goo' is not a member of 'N'. + x = N.goo ~~~~~ -BC30456: 'foo' is not a member of 'C'. - x = C.foo +BC30456: 'goo' is not a member of 'C'. + x = C.goo ~~~~~ -BC30456: 'foo' is not a member of 'C'. - x = cInstance.foo +BC30456: 'goo' is not a member of 'C'. + x = cInstance.goo ~~~~~~~~~~~~~ -BC30456: 'foo' is not a member of 'M1'. - x = M1.foo +BC30456: 'goo' is not a member of 'M1'. + x = M1.goo ~~~~~~ ) End Sub @@ -467,7 +467,7 @@ Imports System Class C(Of T) Public Sub f() dim x as Integer - x = T.foo + x = T.goo End Sub End Class @@ -477,7 +477,7 @@ End Class AssertTheseDiagnostics(compilation, BC32098: Type parameters cannot be used as qualifiers. - x = T.foo + x = T.goo ~~~~~ ) End Sub @@ -490,14 +490,14 @@ BC32098: Type parameters cannot be used as qualifiers. Imports System -Class Foo(Of T) +Class Goo(Of T) Shared Public x As Integer End Class Module Module1 Sub Main() Dim y As Integer - y = Foo.x + y = Goo.x End Sub End Module @@ -505,8 +505,8 @@ End Module AssertTheseDiagnostics(compilation, -BC32042: Too few type arguments to 'Foo(Of T)'. - y = Foo.x +BC32042: Too few type arguments to 'Goo(Of T)'. + y = Goo.x ~~~ ) End Sub @@ -519,13 +519,13 @@ BC32042: Too few type arguments to 'Foo(Of T)'. Imports System Namespace N - Class Foo(Of T) + Class Goo(Of T) Shared Public x As Integer End Class End Namespace Class C - Class Foo(Of T) + Class Goo(Of T) Shared Public x As Integer End Class End Class @@ -535,10 +535,10 @@ Module Module1 Dim y As Integer Dim cInstance as C cInstance = Nothing - y = N.Foo.x - y = C.Foo.x - y = cInstance.Foo.x - y = cInstance.Foo(Of Integer).x + y = N.Goo.x + y = C.Goo.x + y = cInstance.Goo.x + y = cInstance.Goo(Of Integer).x End Sub End Module @@ -547,17 +547,17 @@ End Module ' Note that we produce different (but I think better) error messages than Dev10. AssertTheseDiagnostics(compilation, -BC32042: Too few type arguments to 'Foo(Of T)'. - y = N.Foo.x +BC32042: Too few type arguments to 'Goo(Of T)'. + y = N.Goo.x ~~~~~ -BC32042: Too few type arguments to 'C.Foo(Of T)'. - y = C.Foo.x +BC32042: Too few type arguments to 'C.Goo(Of T)'. + y = C.Goo.x ~~~~~ -BC32042: Too few type arguments to 'C.Foo(Of T)'. - y = cInstance.Foo.x +BC32042: Too few type arguments to 'C.Goo(Of T)'. + y = cInstance.Goo.x ~~~~~~~~~~~~~ BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated. - y = cInstance.Foo(Of Integer).x + y = cInstance.Goo(Of Integer).x ~~~~~~~~~~~~~~~~~~~~~~~~~ ) End Sub @@ -578,7 +578,7 @@ Class K End Sub Public xx As Integer - Public Shared Sub foo() + Public Shared Sub goo() Dim v As Integer Dim zInstance As Z zInstance = Nothing @@ -639,7 +639,7 @@ Class K End Sub Public Shared xx As Integer - Public Sub foo() + Public Sub goo() Dim v As Integer Dim zInstance As Z zInstance = Nothing @@ -778,7 +778,7 @@ Imports System Module M1 Sub Main() Dim x as boolean - x = Integer?.Equals("foo", "f" + "oo") + x = Integer?.Equals("goo", "g" + "oo") Console.WriteLine(x) End Sub End Module @@ -796,8 +796,8 @@ End Module Option Strict On Module M - Function Foo(x As Integer) As Integer() - Foo(1) = Nothing + Function Goo(x As Integer) As Integer() + Goo(1) = Nothing End Function End Module @@ -808,9 +808,9 @@ End Module AssertTheseDiagnostics(compilation, BC30068: Expression is a value and therefore cannot be the target of an assignment. - Foo(1) = Nothing + Goo(1) = Nothing ~~~~~~ -BC42105: Function 'Foo' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used. +BC42105: Function 'Goo' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used. End Function ~~~~~~~~~~~~ ) @@ -821,12 +821,12 @@ BC42105: Function 'Foo' doesn't return a value on all code paths. A null referen Module Module1 Sub Main() - Foo() + Goo() End Sub Private val As TestClass - Function Foo() As TestClass + Function Goo() As TestClass If val Is Nothing Then System.Console.WriteLine("Nothing") val = New TestClass() @@ -839,14 +839,14 @@ Module Module1 Dim x As TestClass = New TestClass() x.Field = 1 - Foo = x - System.Console.WriteLine(Foo.Field) - System.Console.WriteLine(Foo.GetField()) - System.Console.WriteLine(Foo().Field) - System.Console.WriteLine(Foo(3)) + Goo = x + System.Console.WriteLine(Goo.Field) + System.Console.WriteLine(Goo.GetField()) + System.Console.WriteLine(Goo().Field) + System.Console.WriteLine(Goo(3)) End Function - Function Foo(x As Integer) As Integer + Function Goo(x As Integer) As Integer Return x End Function End Module @@ -879,16 +879,16 @@ val Option Strict On Module M - Function Foo(x As Integer) As Integer() - Dim y As Integer() = Foo(1) + Function Goo(x As Integer) As Integer() + Dim y As Integer() = Goo(1) End Function End Module Module M1 - Function Foo(x As Object) As Integer - Return Foo(1) + Function Goo(x As Object) As Integer + Return Goo(1) End Function - Function Foo(x As Integer) As Integer + Function Goo(x As Integer) As Integer Return 1 End Function End Module @@ -899,7 +899,7 @@ End Module AssertTheseDiagnostics(compilation, -BC42105: Function 'Foo' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used. +BC42105: Function 'Goo' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used. End Function ~~~~~~~~~~~~ ) @@ -915,10 +915,10 @@ BC42105: Function 'Foo' doesn't return a value on all code paths. A null referen Imports System Public Class C1 - Private Shared Sub foo(x as String) + Private Shared Sub goo(x as String) Console.Writeline("Private") End Sub - Public Shared Sub foo(x as Object) + Public Shared Sub goo(x as Object) Console.Writeline("Public") End Sub End class @@ -926,7 +926,7 @@ End class Module Program Sub Main() 'Below call should bind to public overload that takes object - c1.foo("") + c1.goo("") End Sub End Module @@ -967,11 +967,11 @@ BC30491: Expression does not produce a value. Module Program Sub Main() - System.Console.WriteLine(Foo.ToString) + System.Console.WriteLine(Goo.ToString) System.Console.WriteLine(Bar(Of Integer).ToString) End Sub - Function Foo() as Integer + Function Goo() as Integer return 123 End Function @@ -994,10 +994,10 @@ End Module Module Program Sub Main() - System.Console.WriteLine(Foo.ToString) + System.Console.WriteLine(Goo.ToString) End Sub - Function Foo(x as Integer) as Integer + Function Goo(x as Integer) as Integer return 321 End Function End Module @@ -1008,8 +1008,8 @@ End Module AssertTheseDiagnostics(compilation, -BC30455: Argument not specified for parameter 'x' of 'Public Function Foo(x As Integer) As Integer'. - System.Console.WriteLine(Foo.ToString) +BC30455: Argument not specified for parameter 'x' of 'Public Function Goo(x As Integer) As Integer'. + System.Console.WriteLine(Goo.ToString) ~~~ ) @@ -1036,7 +1036,7 @@ End Class Class A(Of T) Inherits B - Sub Foo() + Sub Goo() T() End Sub End Class @@ -1047,7 +1047,7 @@ Class C End Sub Class A(Of S) - Sub Foo() + Sub Goo() S() End Sub End Class @@ -1132,12 +1132,12 @@ BC32059: Array lower bounds can be only '0'. Class Y Sub f() - Dim foo As Integer + Dim goo As Integer - foo(Of Integer)() + goo(Of Integer)() End Sub - Public Sub foo(Of T)() + Public Sub goo(Of T)() End Sub End Class @@ -1148,11 +1148,11 @@ End Class AssertTheseDiagnostics(compilation, -BC42024: Unused local variable: 'foo'. - Dim foo As Integer +BC42024: Unused local variable: 'goo'. + Dim goo As Integer ~~~ -BC32045: 'foo' has no type parameters and so cannot have type arguments. - foo(Of Integer)() +BC32045: 'goo' has no type parameters and so cannot have type arguments. + goo(Of Integer)() ~~~~~~~~~~~~ ) @@ -1918,7 +1918,7 @@ Imports Bar = NS1.Bar Module Module1 Public Sub Main() - Dim o as Foo = New Foo() + Dim o as Goo = New Goo() Console.WriteLine(o.M()) End Sub End Module @@ -1929,7 +1929,7 @@ Namespace NS1 End Class End Namespace -Class Foo +Class Goo ReadOnly Property Bar As Bar Get Console.WriteLine("property called") @@ -1951,7 +1951,7 @@ End Class AssertNoDiagnostics(compilation) CompileAndVerify(compilationDef, expectedOutput:="48"). - VerifyIL("Foo.M", + VerifyIL("Goo.M", BC30251: Type 'Object()' has no constructors. - Foo(Sub(x) x.New()) + Goo(Sub(x) x.New()) ~~~~~ AssertTheseDiagnostics(compilation1, expectedErrors1) @@ -2185,13 +2185,13 @@ Imports System Module M Sub Main() - Foo(Sub(x) x.New()) + Goo(Sub(x) x.New()) End Sub Class TC1 End Class - Sub Foo(x As Action(Of TC1)) + Sub Goo(x As Action(Of TC1)) End Sub <Extension()> @@ -2213,7 +2213,7 @@ End Namespace Dim expectedErrors1 = BC30282: Constructor call is valid only as the first statement in an instance constructor. - Foo(Sub(x) x.New()) + Goo(Sub(x) x.New()) ~~~~~ AssertTheseDiagnostics(compilation1, expectedErrors1) @@ -2230,15 +2230,15 @@ Imports System Module M Sub Main() - Foo(Sub(x) x.New()) + Goo(Sub(x) x.New()) End Sub - Sub Foo(x As Action(Of IEnumerable)) + Sub Goo(x As Action(Of IEnumerable)) System.Console.WriteLine("Action(Of IEnumerable)") x(New Object() {}) End Sub - Sub Foo(x As Action(Of Object())) + Sub Goo(x As Action(Of Object())) System.Console.WriteLine("Action(Of Object())") x(New Object() {}) End Sub @@ -2403,7 +2403,7 @@ Class Frame Return Nothing End Get End Property - Function Foo() As Integer + Function Goo() As Integer Return TypeSubstitution.Create() End Function End Class @@ -2434,7 +2434,7 @@ Class InstanceTypeSymbol End Class Class Frame Inherits InstanceTypeSymbol - Function Foo() As Integer + Function Goo() As Integer Return TypeSubstitution.Create() End Function End Class @@ -2474,7 +2474,7 @@ Class InstanceTypeSymbol End Class Class Frame Inherits InstanceTypeSymbol - Function Foo() As Integer + Function Goo() As Integer Return TypeSubstitution.Create() End Function End Class diff --git a/src/Compilers/VisualBasic/Test/Semantic/Binding/Binder_Statements_Tests.vb b/src/Compilers/VisualBasic/Test/Semantic/Binding/Binder_Statements_Tests.vb index 9a11f24dd5c66..aaf7abf42ad42 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/Binding/Binder_Statements_Tests.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/Binding/Binder_Statements_Tests.vb @@ -234,13 +234,13 @@ End Module Imports System Module M1 - Sub Foo() + Sub Goo() Console.WriteLine("Hello, world") Console.WriteLine() Console.WriteLine("Goodbye, world") End Sub Sub Main() - Foo + Goo End Sub End Module @@ -260,11 +260,11 @@ Goodbye, world Imports System Module M1 - Sub Foo() + Sub Goo() Console.WriteLine("Call without parameters") End Sub - Sub Foo(s as string) + Sub Goo(s as string) Console.WriteLine(s) End Sub @@ -277,10 +277,10 @@ Module M1 End Function Sub Main() - Foo(SayHi) - foo - call foo - call foo("call with parameters") + Goo(SayHi) + goo + call goo + call goo("call with parameters") dim i = One + One Console.WriteLine(i) i = One @@ -307,7 +307,7 @@ call with parameters Imports System Module M1 Sub Main() - call foo + call goo End Sub End Module @@ -315,8 +315,8 @@ End Module CompilationUtils.AssertTheseDiagnostics(compilation, -BC30451: 'foo' is not declared. It may be inaccessible due to its protection level. - call foo +BC30451: 'goo' is not declared. It may be inaccessible due to its protection level. + call goo ~~~ ) End Sub @@ -326,7 +326,7 @@ BC30451: 'foo' is not declared. It may be inaccessible due to its protection lev Public Sub CallStatementNothingAsInvocationExpression_Bug_4247() Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( - + Module M1 Sub Main() Dim myLocalArr as Integer() @@ -371,7 +371,7 @@ BC30454: Expression is not a method. Public Sub CallStatementNamespaceAsInvocationExpression() Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( - + Namespace N1.N2 Module M1 Sub Main() @@ -403,7 +403,7 @@ BC30112: 'N1.N2' is a namespace and cannot be used as an expression. Public Sub CallStatementTypeAsInvocationExpression() Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( - + Class Class1 End Class @@ -1085,7 +1085,7 @@ BC30647: 'Return' statement in a Sub or a Set cannot return a value. Imports System Module M1 - Function foo() As Boolean + Function goo() As Boolean While True End While End Function @@ -1095,7 +1095,7 @@ End Module CompilationUtils.AssertTheseDiagnostics(compilation, -BC42353: Function 'foo' doesn't return a value on all code paths. Are you missing a 'Return' statement? +BC42353: Function 'goo' doesn't return a value on all code paths. Are you missing a 'Return' statement? End Function ~~~~~~~~~~~~ ) @@ -1585,7 +1585,7 @@ BC30393: 'Exit Try' can only appear inside a 'Try' statement. Public Sub CatchNotLocal() Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( - + Module M1 Private ex as System.Exception @@ -1611,7 +1611,7 @@ BC31082: 'ex' is not a local variable or parameter, and so cannot be used as a ' Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( - + Module Module1 Sub Main() Try @@ -1635,7 +1635,7 @@ BC31082: 'Main' is not a local variable or parameter, and so cannot be used as a Public Sub CatchStatic() Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( - + Imports System Module M1 @@ -1662,7 +1662,7 @@ BC31082: 'ex' is not a local variable or parameter, and so cannot be used as a ' Public Sub CatchUndeclared() Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( - + Option Explicit Off Module M1 @@ -1689,7 +1689,7 @@ BC30451: 'ex' is not declared. It may be inaccessible due to its protection leve Public Sub CatchNotException() Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( - + Option Explicit Off Module M1 @@ -1722,16 +1722,16 @@ BC30392: 'Catch' cannot catch type 'String' because it is not 'System.Exception' Public Sub CatchNotVariableOrParameter() Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( - + Option Explicit Off Module M1 - Sub Foo + Sub Goo End Sub Sub Main() Try - Catch Foo + Catch Goo End Try End Sub End Module @@ -1740,8 +1740,8 @@ BC30392: 'Catch' cannot catch type 'String' because it is not 'System.Exception' CompilationUtils.AssertTheseDiagnostics(compilation, -BC31082: 'Foo' is not a local variable or parameter, and so cannot be used as a 'Catch' variable. - Catch Foo +BC31082: 'Goo' is not a local variable or parameter, and so cannot be used as a 'Catch' variable. + Catch Goo ~~~ ) End Sub @@ -1751,7 +1751,7 @@ BC31082: 'Foo' is not a local variable or parameter, and so cannot be used as a Public Sub CatchDuplicate() Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( - + Imports System Module M1 @@ -1784,7 +1784,7 @@ BC42031: 'Catch' block never reached; 'Exception' handled above in the same Try Public Sub CatchDuplicate1() Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( - + Imports System Module M1 @@ -1817,7 +1817,7 @@ BC42031: 'Catch' block never reached; 'Exception' handled above in the same Try Public Sub CatchDuplicate2() Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( - + Imports System Module M1 @@ -1861,7 +1861,7 @@ BC42031: 'Catch' block never reached; 'Exception' handled above in the same Try Public Sub CatchOverlapped() Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( - + Imports System Module M1 @@ -1902,20 +1902,20 @@ BC42029: 'Catch' block never reached, because 'ArgumentException' inherits from Public Sub CatchShadowing() Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( - + Imports System Module M1 Dim field As String - Function Foo(Of T)(ex As Exception) As Exception + Function Goo(Of T)(ex As Exception) As Exception Dim ex1 As SystemException = Nothing Try Dim ex2 As Exception = nothing Catch ex As Exception Catch ex1 As Exception - Catch Foo As ArgumentException When True + Catch Goo As ArgumentException When True ' this is ok Catch ex2 As exception @@ -1950,10 +1950,10 @@ BC30616: Variable 'ex1' hides a variable in an enclosing block. Catch ex1 As Exception ~~~ BC42029: 'Catch' block never reached, because 'ArgumentException' inherits from 'Exception'. - Catch Foo As ArgumentException When True + Catch Goo As ArgumentException When True ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ BC30290: Local variable cannot have the same name as the function containing it. - Catch Foo As ArgumentException When True + Catch Goo As ArgumentException When True ~~~ BC42031: 'Catch' block never reached; 'Exception' handled above in the same Try statement. Catch ex2 As exception @@ -1972,7 +1972,7 @@ BC42031: 'Catch' block never reached; 'Exception' handled above in the same Try Public Sub CatchShadowingGeneric() Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( - + Imports System Module M1 @@ -2010,7 +2010,7 @@ End Module Public Sub GotoOutOfFinally() Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( - + Imports System Module M1 @@ -2040,7 +2040,7 @@ BC30101: Branching out of a 'Finally' is not valid. Public Sub BranchOutOfFinally1() Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( - + Imports System Module M1 @@ -2053,7 +2053,7 @@ BC30101: Branching out of a 'Finally' is not valid. Next End Sub - Function Foo() as integer + Function Goo() as integer l1: Try Finally @@ -2087,7 +2087,7 @@ BC30101: Branching out of a 'Finally' is not valid. Public Sub GotoFromCatchToTry() Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( - + Imports System Module M1 @@ -2120,7 +2120,7 @@ End Module Public Sub GotoFromCatchToTry1() Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( - + Imports System Module M1 @@ -2152,7 +2152,7 @@ End Module Public Sub UnassignedVariableInLateAddressOf() Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( - + Option Strict Off Imports System @@ -2163,7 +2163,7 @@ Module Program Sub Main() Dim obj As Object '= New cls1 - Dim o As d1 = AddressOf obj.foo + Dim o As d1 = AddressOf obj.goo Dim l As Integer = 0 o(l, 2) @@ -2172,7 +2172,7 @@ Module Program End Sub Class cls1 - Shared Sub foo(ByRef x As Integer, y As Integer) + Shared Sub goo(ByRef x As Integer, y As Integer) x = 42 Console.WriteLine(x + y) End Sub @@ -2185,7 +2185,7 @@ End Module CompilationUtils.AssertTheseDiagnostics(compilation, BC42104: Variable 'obj' is used before it has been assigned a value. A null reference exception could result at runtime. - Dim o As d1 = AddressOf obj.foo + Dim o As d1 = AddressOf obj.goo ~~~ ) End Sub @@ -2195,7 +2195,7 @@ BC42104: Variable 'obj' is used before it has been assigned a value. A null refe Public Sub UnassignedVariableInCatchFinallyFilter() Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( - + Imports System Module M1 @@ -2244,7 +2244,7 @@ BC42104: Variable 'C' is used before it has been assigned a value. A null refere Public Sub UnassignedVariableInCatchFinallyFilter1() Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( - + Imports System Module M1 @@ -2283,7 +2283,7 @@ BC42104: Variable 'A' is used before it has been assigned a value. A null refere Public Sub UnassignedVariableInCatchFinallyFilter2() Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( - + Imports System Module M1 @@ -2317,7 +2317,7 @@ BC42104: Variable 'A' is used before it has been assigned a value. A null refere Public Sub UnassignedVariableInCatchFinallyFilter3() Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( - + Imports System Module M1 @@ -2351,7 +2351,7 @@ End Module Public Sub UnassignedVariableInCatchFinallyFilter4() Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( - + Imports System Module M1 @@ -2388,7 +2388,7 @@ BC42104: Variable 'A' is used before it has been assigned a value. A null refere Public Sub ThrowNotValue() Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( - + Imports System Module M1 ReadOnly Property Moo As Exception @@ -2423,7 +2423,7 @@ BC30524: Property 'Boo' is 'WriteOnly'. Public Sub ThrowNotException() Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( - + Imports System Module M1 ReadOnly e as new Exception @@ -2449,7 +2449,7 @@ BC30665: 'Throw' operand must derive from 'System.Exception'. Public Sub RethrowNotInCatch() Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( - + Imports System Module M1 Sub Main() @@ -2504,7 +2504,7 @@ BC30666: 'Throw' statement cannot omit operand outside a 'Catch' statement or in Public Sub ForNotValue() Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( - + Imports System Module M1 ReadOnly Property Moo As Integer @@ -2551,7 +2551,7 @@ BC30524: Property 'Boo' is 'WriteOnly'. Public Sub CustomDatatypeForLoop() Dim source = - - + Imports System Module M1 Sub Main() @@ -3002,7 +3002,7 @@ BC30201: Expression expected. Public Sub AddHandlerUninitialized() Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( - + Imports System Module M1 Sub Main() @@ -3031,7 +3031,7 @@ BC42104: Variable 'del' is used before it has been assigned a value. A null refe Public Sub AddHandlerNotSimple() Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( - + Imports System Module M1 Sub Main() @@ -3066,7 +3066,7 @@ BC30677: 'AddHandler' or 'RemoveHandler' statement event operand must be a dot-q Public Sub RemoveHandlerLambda() Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( - + Imports System Module MyClass1 @@ -3095,7 +3095,7 @@ End Module Public Sub RemoveHandlerNotEvent() Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( - + Imports System Module M1 Sub Main() @@ -3130,7 +3130,7 @@ BC30456: 'GetTyp' is not a member of 'AppDomain'. Public Sub AddHandlerNoConversion() Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( - + Imports System Module M1 Sub Main() @@ -4770,13 +4770,13 @@ Module M Sub Test1() Console.WriteLine(">1") - Dim x = .@xml:foo + Dim x = .@xml:goo Console.WriteLine("<1") End Sub Sub Test2() Console.WriteLine(">2") - Dim x = .@xml:foo:foo + Dim x = .@xml:goo:goo Console.WriteLine("<2") End Sub @@ -4794,7 +4794,7 @@ Module M Sub Test5() Console.WriteLine(">5") - Dim x = .@xml~foo + Dim x = .@xml~goo Console.WriteLine("<5") End Sub @@ -4806,7 +4806,7 @@ Module M Sub Test7() Console.WriteLine(">7") - Dim x = .@xml~foo~return + Dim x = .@xml~goo~return Console.WriteLine("<7") End Sub @@ -4816,8 +4816,8 @@ Module M Console.WriteLine("<8") End Sub - Sub foo - Console.WriteLine("foo") + Sub goo + Console.WriteLine("goo") End Sub Sub [return] @@ -4840,17 +4840,17 @@ End Module]]>.Value.Replace("~"c, SyntaxFacts.FULLWIDTH_COLON) >1 <1 >2 -foo +goo <2 >3 <3 >4 >5 -foo +goo <5 >6 >7 -foo +goo >8 <8]]>.Value.Replace(vbLf, vbCrLf)) End Sub diff --git a/src/Compilers/VisualBasic/Test/Semantic/Binding/BindingCollectionInitializerTests.vb b/src/Compilers/VisualBasic/Test/Semantic/Binding/BindingCollectionInitializerTests.vb index b8d079a091e96..6a2a028fa8a7f 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/Binding/BindingCollectionInitializerTests.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/Binding/BindingCollectionInitializerTests.vb @@ -279,10 +279,10 @@ Class C1 public a as string Public Shared Sub Main() - Dim a As New C2() with {.a = "foo"} From {"Hello World!"} - Dim b As New C2() From {"Hello World!"} with {.a = "foo"} - Dim c As C2 = New C2() From {"Hello World!"} with {.a = "foo"} - Dim d As C2 = New C2() with {.a = "foo"} From {"Hello World!"} + Dim a As New C2() with {.a = "goo"} From {"Hello World!"} + Dim b As New C2() From {"Hello World!"} with {.a = "goo"} + Dim c As C2 = New C2() From {"Hello World!"} with {.a = "goo"} + Dim d As C2 = New C2() with {.a = "goo"} From {"Hello World!"} End Sub End Class @@ -291,16 +291,16 @@ End Class Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) AssertTheseDiagnostics(compilation, BC36720: An Object Initializer and a Collection Initializer cannot be combined in the same initialization. - Dim a As New C2() with {.a = "foo"} From {"Hello World!"} + Dim a As New C2() with {.a = "goo"} From {"Hello World!"} ~~~~ BC36720: An Object Initializer and a Collection Initializer cannot be combined in the same initialization. - Dim b As New C2() From {"Hello World!"} with {.a = "foo"} + Dim b As New C2() From {"Hello World!"} with {.a = "goo"} ~~~~ BC36720: An Object Initializer and a Collection Initializer cannot be combined in the same initialization. - Dim c As C2 = New C2() From {"Hello World!"} with {.a = "foo"} + Dim c As C2 = New C2() From {"Hello World!"} with {.a = "goo"} ~~~~~~~~~~~~~~~~~~~~~ BC36720: An Object Initializer and a Collection Initializer cannot be combined in the same initialization. - Dim d As C2 = New C2() with {.a = "foo"} From {"Hello World!"} + Dim d As C2 = New C2() with {.a = "goo"} From {"Hello World!"} ~~~~~~~~~~~~~~~~~ ) End Sub diff --git a/src/Compilers/VisualBasic/Test/Semantic/Binding/BindingDelegateCreationTests.vb b/src/Compilers/VisualBasic/Test/Semantic/Binding/BindingDelegateCreationTests.vb index 1cb027193421b..193b3263272f4 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/Binding/BindingDelegateCreationTests.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/Binding/BindingDelegateCreationTests.vb @@ -19,18 +19,18 @@ Delegate function FuncDel2(p As String) as UnknownErrorType Class C2 - Public Shared Sub foo(p as string) + Public Shared Sub goo(p as string) end sub - Public Shared Sub foo2(p as string, p2 as integer) + Public Shared Sub goo2(p as string, p2 as integer) end sub Public Sub AssignDelegates() Dim v5 as subdel = addressof Dim v6 as subdel = addressof nothing Dim v7 as subdel = addressof C2 - Dim v8 as subdel = addressof C2.foo2 - Dim v9 as FuncDel = addressof C2.foo + Dim v8 as subdel = addressof C2.goo2 + Dim v9 as FuncDel = addressof C2.goo End Sub End Class @@ -55,11 +55,11 @@ BC30577: 'AddressOf' operand must be the name of a method (without parentheses). BC30577: 'AddressOf' operand must be the name of a method (without parentheses). Dim v7 as subdel = addressof C2 ~~ -BC31143: Method 'Public Shared Sub foo2(p As String, p2 As Integer)' does not have a signature compatible with delegate 'Delegate Sub SubDel(p As String)'. - Dim v8 as subdel = addressof C2.foo2 +BC31143: Method 'Public Shared Sub goo2(p As String, p2 As Integer)' does not have a signature compatible with delegate 'Delegate Sub SubDel(p As String)'. + Dim v8 as subdel = addressof C2.goo2 ~~~~~~~ -BC31143: Method 'Public Shared Sub foo(p As String)' does not have a signature compatible with delegate 'Delegate Function FuncDel(p As String) As Integer'. - Dim v9 as FuncDel = addressof C2.foo +BC31143: Method 'Public Shared Sub goo(p As String)' does not have a signature compatible with delegate 'Delegate Function FuncDel(p As String) As Integer'. + Dim v9 as FuncDel = addressof C2.goo ~~~~~~ ) @@ -130,15 +130,15 @@ Delegate function FuncDel(p As String) as Integer Class C2 - Public Shared Sub foo(p as string) + Public Shared Sub goo(p as string) end sub - Public Shared Sub foo2(p as string, p2 as integer) + Public Shared Sub goo2(p as string, p2 as integer) end sub Public Sub AssignDelegates() - Dim v1 As C2 = AddressOf C2.foo - Dim v2 As Object = AddressOf C2.foo + Dim v1 As C2 = AddressOf C2.goo + Dim v2 As Object = AddressOf C2.goo End Sub End Class @@ -149,10 +149,10 @@ End Class CompilationUtils.AssertTheseDiagnostics(c1, BC30581: 'AddressOf' expression cannot be converted to 'C2' because 'C2' is not a delegate type. - Dim v1 As C2 = AddressOf C2.foo + Dim v1 As C2 = AddressOf C2.goo ~~~~~~~~~~~~~~~~ BC30581: 'AddressOf' expression cannot be converted to 'Object' because 'Object' is not a delegate type. - Dim v2 As Object = AddressOf C2.foo + Dim v2 As Object = AddressOf C2.goo ~~~~~~~~~~~~~~~~ ) End Sub @@ -177,10 +177,10 @@ Module Program Sub Main(args As String()) Dim metaSubDel as DelegateWithoutInvoke.DelegateSubWithoutInvoke = addressof C1.ds3 - metaSubDel("foo") + metaSubDel("goo") Dim metaFuncDel as DelegateWithoutInvoke.DelegateFunctionWithoutInvoke = addressof C1.df3 - Console.WriteLine(metaFuncDel("foo")) + Console.WriteLine(metaFuncDel("goo")) End Sub End Module @@ -194,13 +194,13 @@ BC30657: 'DelegateWithoutInvoke.DelegateSubWithoutInvoke' has a return type that Dim metaSubDel as DelegateWithoutInvoke.DelegateSubWithoutInvoke = addressof C1.ds3 ~~~~~~~~~~~~~~~~ BC30220: Delegate class 'DelegateWithoutInvoke.DelegateSubWithoutInvoke' has no Invoke method, so an expression of this type cannot be the target of a method call. - metaSubDel("foo") + metaSubDel("goo") ~~~~~~~~~~ BC30657: 'DelegateWithoutInvoke.DelegateFunctionWithoutInvoke' has a return type that is not supported or parameter types that are not supported. Dim metaFuncDel as DelegateWithoutInvoke.DelegateFunctionWithoutInvoke = addressof C1.df3 ~~~~~~~~~~~~~~~~ BC30220: Delegate class 'DelegateWithoutInvoke.DelegateFunctionWithoutInvoke' has no Invoke method, so an expression of this type cannot be the target of a method call. - Console.WriteLine(metaFuncDel("foo")) + Console.WriteLine(metaFuncDel("goo")) ~~~~~~~~~~~ ) End Sub @@ -220,26 +220,26 @@ End Class Class C2 ' no match because of too many args / one candidate - Public Shared sub foo1(p as integer, p2 as string) + Public Shared sub goo1(p as integer, p2 as string) end sub ' no match because of too few args / one candidate - Public Shared sub foo2() + Public Shared sub goo2() end sub ' no match because of no conversion - Public Shared sub foo3(p as C1) + Public Shared sub goo3(p as C1) end sub ' no match because of no conversion - Public Shared sub foo4(byref p as C1) + Public Shared sub goo4(byref p as C1) end sub Public Sub AssignDelegates() - Dim v1 As SubDel = AddressOf C2.foo1 - Dim v2 As SubDel = AddressOf C2.foo2 - Dim v3 As SubDel = AddressOf C2.foo3 - Dim v4 As SubDel = AddressOf C2.foo4 + Dim v1 As SubDel = AddressOf C2.goo1 + Dim v2 As SubDel = AddressOf C2.goo2 + Dim v3 As SubDel = AddressOf C2.goo3 + Dim v4 As SubDel = AddressOf C2.goo4 end sub End Class @@ -249,17 +249,17 @@ End Class CompilationUtils.AssertTheseDiagnostics(c1, -BC31143: Method 'Public Shared Sub foo1(p As Integer, p2 As String)' does not have a signature compatible with delegate 'Delegate Sub SubDel(p As Integer)'. - Dim v1 As SubDel = AddressOf C2.foo1 +BC31143: Method 'Public Shared Sub goo1(p As Integer, p2 As String)' does not have a signature compatible with delegate 'Delegate Sub SubDel(p As Integer)'. + Dim v1 As SubDel = AddressOf C2.goo1 ~~~~~~~ -BC36663: Option Strict On does not allow narrowing in implicit type conversions between method 'Public Shared Sub foo2()' and delegate 'Delegate Sub SubDel(p As Integer)'. - Dim v2 As SubDel = AddressOf C2.foo2 +BC36663: Option Strict On does not allow narrowing in implicit type conversions between method 'Public Shared Sub goo2()' and delegate 'Delegate Sub SubDel(p As Integer)'. + Dim v2 As SubDel = AddressOf C2.goo2 ~~~~~~~ -BC31143: Method 'Public Shared Sub foo3(p As C1)' does not have a signature compatible with delegate 'Delegate Sub SubDel(p As Integer)'. - Dim v3 As SubDel = AddressOf C2.foo3 +BC31143: Method 'Public Shared Sub goo3(p As C1)' does not have a signature compatible with delegate 'Delegate Sub SubDel(p As Integer)'. + Dim v3 As SubDel = AddressOf C2.goo3 ~~~~~~~ -BC31143: Method 'Public Shared Sub foo4(ByRef p As C1)' does not have a signature compatible with delegate 'Delegate Sub SubDel(p As Integer)'. - Dim v4 As SubDel = AddressOf C2.foo4 +BC31143: Method 'Public Shared Sub goo4(ByRef p As C1)' does not have a signature compatible with delegate 'Delegate Sub SubDel(p As Integer)'. + Dim v4 As SubDel = AddressOf C2.goo4 ~~~~~~~ ) End Sub @@ -277,43 +277,43 @@ Delegate sub SubDel2(p As Integer, p as Integer, p as Integer) Class C2 ' no match because of too many args / multiple candidates - Public Shared sub foo1(p as integer, p2 as string) + Public Shared sub goo1(p as integer, p2 as string) end sub ' no match because of too many args / multiple candidates - Public Shared sub foo1(p as integer, p2 as integer) + Public Shared sub goo1(p as integer, p2 as integer) end sub ' no match because of too few many args / multiple candidates - Public Shared sub foo2(p as integer, p2 as integer) + Public Shared sub goo2(p as integer, p2 as integer) end sub ' no match because of too few args / multiple candidates - Public Shared sub foo2(p as integer) + Public Shared sub goo2(p as integer) end sub ' no match because of too many args / multiple candidates - Public Shared sub foo3(p as integer, byref p2 as string) + Public Shared sub goo3(p as integer, byref p2 as string) end sub ' no match because of too many args / multiple candidates - Public Shared sub foo3(p as integer, byref p2 as integer) + Public Shared sub goo3(p as integer, byref p2 as integer) end sub ' no match because of too few many args / multiple candidates - Public Shared sub foo4(p as integer, byref p2 as integer) + Public Shared sub goo4(p as integer, byref p2 as integer) end sub ' no match because of too few args / multiple candidates - Public Shared sub foo4(byref p as integer) + Public Shared sub goo4(byref p as integer) end sub Public Sub AssignDelegates() - Dim v1 As SubDel = AddressOf C2.foo1 - Dim v2 As SubDel2 = AddressOf C2.foo2 - Dim v3 As SubDel = AddressOf C2.foo3 - Dim v4 As SubDel2 = AddressOf C2.foo4 + Dim v1 As SubDel = AddressOf C2.goo1 + Dim v2 As SubDel2 = AddressOf C2.goo2 + Dim v3 As SubDel = AddressOf C2.goo3 + Dim v4 As SubDel2 = AddressOf C2.goo4 end sub End Class @@ -323,17 +323,17 @@ End Class CompilationUtils.AssertTheseDiagnostics(c1, -BC30516: Overload resolution failed because no accessible 'foo1' accepts this number of arguments. - Dim v1 As SubDel = AddressOf C2.foo1 +BC30516: Overload resolution failed because no accessible 'goo1' accepts this number of arguments. + Dim v1 As SubDel = AddressOf C2.goo1 ~~~~~~~ -BC30516: Overload resolution failed because no accessible 'foo2' accepts this number of arguments. - Dim v2 As SubDel2 = AddressOf C2.foo2 +BC30516: Overload resolution failed because no accessible 'goo2' accepts this number of arguments. + Dim v2 As SubDel2 = AddressOf C2.goo2 ~~~~~~~ -BC30516: Overload resolution failed because no accessible 'foo3' accepts this number of arguments. - Dim v3 As SubDel = AddressOf C2.foo3 +BC30516: Overload resolution failed because no accessible 'goo3' accepts this number of arguments. + Dim v3 As SubDel = AddressOf C2.goo3 ~~~~~~~ -BC30516: Overload resolution failed because no accessible 'foo4' accepts this number of arguments. - Dim v4 As SubDel2 = AddressOf C2.foo4 +BC30516: Overload resolution failed because no accessible 'goo4' accepts this number of arguments. + Dim v4 As SubDel2 = AddressOf C2.goo4 ~~~~~~~ ) End Sub @@ -349,14 +349,14 @@ Imports System Delegate Sub SubDel(p As Byte) Class C2(of T, S) - Public Shared Sub foo(p as T) + Public Shared Sub goo(p as T) end sub - Public Shared Sub foo(p as S) + Public Shared Sub goo(p as S) end sub Public Sub AssignDelegates() - Dim v1 As SubDel = AddressOf C2(of integer, integer).foo + Dim v1 As SubDel = AddressOf C2(of integer, integer).goo End Sub End Class @@ -366,10 +366,10 @@ End Class CompilationUtils.AssertTheseDiagnostics(c1, -BC30794: No accessible 'foo' is most specific: - Public Shared Sub foo(p As Integer) - Public Shared Sub foo(p As Integer) - Dim v1 As SubDel = AddressOf C2(of integer, integer).foo +BC30794: No accessible 'goo' is most specific: + Public Shared Sub goo(p As Integer) + Public Shared Sub goo(p As Integer) + Dim v1 As SubDel = AddressOf C2(of integer, integer).goo ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ) End Sub @@ -385,14 +385,14 @@ Imports System Delegate Sub SubDel(p As Byte) Class C2(of T, S) - Public Shared Sub foo(byref p as T) + Public Shared Sub goo(byref p as T) end sub - Public Shared Sub foo(byref p as S) + Public Shared Sub goo(byref p as S) end sub Public Sub AssignDelegates() - Dim v1 As SubDel = AddressOf C2(of integer, integer).foo + Dim v1 As SubDel = AddressOf C2(of integer, integer).goo End Sub End Class @@ -402,10 +402,10 @@ End Class CompilationUtils.AssertTheseDiagnostics(c1, -BC30794: No accessible 'foo' is most specific: - Public Shared Sub foo(ByRef p As Integer) - Public Shared Sub foo(ByRef p As Integer) - Dim v1 As SubDel = AddressOf C2(of integer, integer).foo +BC30794: No accessible 'goo' is most specific: + Public Shared Sub goo(ByRef p As Integer) + Public Shared Sub goo(ByRef p As Integer) + Dim v1 As SubDel = AddressOf C2(of integer, integer).goo ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ) End Sub @@ -421,14 +421,14 @@ Imports System Delegate Sub SubDel(p As Byte) Class C2(of T, S) - Public Shared Sub foo(byref p as T) + Public Shared Sub goo(byref p as T) end sub - Public Shared Sub foo(byref p as S) + Public Shared Sub goo(byref p as S) end sub Public Sub AssignDelegates() - Dim v1 As SubDel = AddressOf C2(of integer, integer).foo + Dim v1 As SubDel = AddressOf C2(of integer, integer).goo End Sub End Class @@ -438,10 +438,10 @@ End Class CompilationUtils.AssertTheseDiagnostics(c1, -BC30794: No accessible 'foo' is most specific: - Public Shared Sub foo(ByRef p As Integer) - Public Shared Sub foo(ByRef p As Integer) - Dim v1 As SubDel = AddressOf C2(of integer, integer).foo +BC30794: No accessible 'goo' is most specific: + Public Shared Sub goo(ByRef p As Integer) + Public Shared Sub goo(ByRef p As Integer) + Dim v1 As SubDel = AddressOf C2(of integer, integer).goo ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ) End Sub @@ -459,50 +459,50 @@ Delegate Sub SubDel2(p As Integer, p As Integer) Delegate Function FuncDel() as Byte Class C2 - Public Shared Sub foo(p as string) + Public Shared Sub goo(p as string) end sub - Public Shared Sub foo2(p as string) + Public Shared Sub goo2(p as string) end sub - Public Shared Sub foo2(p as Byte) + Public Shared Sub goo2(p as Byte) end sub - Public Shared Sub foo3(p as string, p2 as string) + Public Shared Sub goo3(p as string, p2 as string) end sub - Public Shared Sub foo3(p as Byte, p2 as byte) + Public Shared Sub goo3(p as Byte, p2 as byte) end sub - Public Shared Sub foo3(p as integer, p2 as byte) + Public Shared Sub goo3(p as integer, p2 as byte) end sub - Public Shared Sub foo4(p as string) + Public Shared Sub goo4(p as string) end sub - Public Shared Sub foo5(p as string) + Public Shared Sub goo5(p as string) end sub - Public Shared Sub foo5(p as Byte) + Public Shared Sub goo5(p as Byte) end sub - Public Shared Sub foo6(p as string, p2 as string) + Public Shared Sub goo6(p as string, p2 as string) end sub - Public Shared Sub foo6(p as Byte, p2 as byte) + Public Shared Sub goo6(p as Byte, p2 as byte) end sub - Public Shared Sub foo6(p as integer, p2 as byte) + Public Shared Sub goo6(p as integer, p2 as byte) end sub - Public Shared Function foo7() as Integer + Public Shared Function goo7() as Integer return 23 end function Public shared Sub Main() - Dim v1 As SubDel = AddressOf C2.foo - Dim v2 As SubDel = AddressOf C2.foo2 - Dim v3 As SubDel2 = AddressOf C2.foo3 + Dim v1 As SubDel = AddressOf C2.goo + Dim v2 As SubDel = AddressOf C2.goo2 + Dim v3 As SubDel2 = AddressOf C2.goo3 - Dim v4 As SubDel = AddressOf C2.foo4 - Dim v5 As SubDel = AddressOf C2.foo5 - Dim v6 As SubDel2 = AddressOf C2.foo6 + Dim v4 As SubDel = AddressOf C2.goo4 + Dim v5 As SubDel = AddressOf C2.goo5 + Dim v6 As SubDel2 = AddressOf C2.goo6 - Dim v7 as FuncDel = AddressOf C2.foo7 + Dim v7 as FuncDel = AddressOf C2.goo7 End Sub End Class @@ -512,36 +512,36 @@ End Class CompilationUtils.AssertTheseDiagnostics(c1, -BC36663: Option Strict On does not allow narrowing in implicit type conversions between method 'Public Shared Sub foo(p As String)' and delegate 'Delegate Sub SubDel(p As Integer)'. - Dim v1 As SubDel = AddressOf C2.foo +BC36663: Option Strict On does not allow narrowing in implicit type conversions between method 'Public Shared Sub goo(p As String)' and delegate 'Delegate Sub SubDel(p As Integer)'. + Dim v1 As SubDel = AddressOf C2.goo ~~~~~~ -BC30950: No accessible method 'foo2' has a signature compatible with delegate 'Delegate Sub SubDel(p As Integer)': - 'Public Shared Sub foo2(p As String)': Argument matching parameter 'p' narrows from 'Integer' to 'String'. - 'Public Shared Sub foo2(p As Byte)': Argument matching parameter 'p' narrows from 'Integer' to 'Byte'. - Dim v2 As SubDel = AddressOf C2.foo2 +BC30950: No accessible method 'goo2' has a signature compatible with delegate 'Delegate Sub SubDel(p As Integer)': + 'Public Shared Sub goo2(p As String)': Argument matching parameter 'p' narrows from 'Integer' to 'String'. + 'Public Shared Sub goo2(p As Byte)': Argument matching parameter 'p' narrows from 'Integer' to 'Byte'. + Dim v2 As SubDel = AddressOf C2.goo2 ~~~~~~~ -BC30950: No accessible method 'foo3' has a signature compatible with delegate 'Delegate Sub SubDel2(p As Integer, p As Integer)': - 'Public Shared Sub foo3(p As String, p2 As String)': Method does not have a signature compatible with the delegate. - 'Public Shared Sub foo3(p As Byte, p2 As Byte)': Method does not have a signature compatible with the delegate. - 'Public Shared Sub foo3(p As Integer, p2 As Byte)': Argument matching parameter 'p2' narrows from 'Integer' to 'Byte'. - Dim v3 As SubDel2 = AddressOf C2.foo3 +BC30950: No accessible method 'goo3' has a signature compatible with delegate 'Delegate Sub SubDel2(p As Integer, p As Integer)': + 'Public Shared Sub goo3(p As String, p2 As String)': Method does not have a signature compatible with the delegate. + 'Public Shared Sub goo3(p As Byte, p2 As Byte)': Method does not have a signature compatible with the delegate. + 'Public Shared Sub goo3(p As Integer, p2 As Byte)': Argument matching parameter 'p2' narrows from 'Integer' to 'Byte'. + Dim v3 As SubDel2 = AddressOf C2.goo3 ~~~~~~~ -BC36663: Option Strict On does not allow narrowing in implicit type conversions between method 'Public Shared Sub foo4(p As String)' and delegate 'Delegate Sub SubDel(p As Integer)'. - Dim v4 As SubDel = AddressOf C2.foo4 +BC36663: Option Strict On does not allow narrowing in implicit type conversions between method 'Public Shared Sub goo4(p As String)' and delegate 'Delegate Sub SubDel(p As Integer)'. + Dim v4 As SubDel = AddressOf C2.goo4 ~~~~~~~ -BC30950: No accessible method 'foo5' has a signature compatible with delegate 'Delegate Sub SubDel(p As Integer)': - 'Public Shared Sub foo5(p As String)': Argument matching parameter 'p' narrows from 'Integer' to 'String'. - 'Public Shared Sub foo5(p As Byte)': Argument matching parameter 'p' narrows from 'Integer' to 'Byte'. - Dim v5 As SubDel = AddressOf C2.foo5 +BC30950: No accessible method 'goo5' has a signature compatible with delegate 'Delegate Sub SubDel(p As Integer)': + 'Public Shared Sub goo5(p As String)': Argument matching parameter 'p' narrows from 'Integer' to 'String'. + 'Public Shared Sub goo5(p As Byte)': Argument matching parameter 'p' narrows from 'Integer' to 'Byte'. + Dim v5 As SubDel = AddressOf C2.goo5 ~~~~~~~ -BC30950: No accessible method 'foo6' has a signature compatible with delegate 'Delegate Sub SubDel2(p As Integer, p As Integer)': - 'Public Shared Sub foo6(p As String, p2 As String)': Method does not have a signature compatible with the delegate. - 'Public Shared Sub foo6(p As Byte, p2 As Byte)': Method does not have a signature compatible with the delegate. - 'Public Shared Sub foo6(p As Integer, p2 As Byte)': Argument matching parameter 'p2' narrows from 'Integer' to 'Byte'. - Dim v6 As SubDel2 = AddressOf C2.foo6 +BC30950: No accessible method 'goo6' has a signature compatible with delegate 'Delegate Sub SubDel2(p As Integer, p As Integer)': + 'Public Shared Sub goo6(p As String, p2 As String)': Method does not have a signature compatible with the delegate. + 'Public Shared Sub goo6(p As Byte, p2 As Byte)': Method does not have a signature compatible with the delegate. + 'Public Shared Sub goo6(p As Integer, p2 As Byte)': Argument matching parameter 'p2' narrows from 'Integer' to 'Byte'. + Dim v6 As SubDel2 = AddressOf C2.goo6 ~~~~~~~ -BC36663: Option Strict On does not allow narrowing in implicit type conversions between method 'Public Shared Function foo7() As Integer' and delegate 'Delegate Function FuncDel() As Byte'. - Dim v7 as FuncDel = AddressOf C2.foo7 +BC36663: Option Strict On does not allow narrowing in implicit type conversions between method 'Public Shared Function goo7() As Integer' and delegate 'Delegate Function FuncDel() As Byte'. + Dim v7 as FuncDel = AddressOf C2.goo7 ~~~~~~~ ) End Sub @@ -828,7 +828,7 @@ Module M d1(23) End Sub - Public Sub SubWithNoParams(foo as integer) + Public Sub SubWithNoParams(goo as integer) Console.WriteLine("Called SubWithNoParams.") End Sub @@ -841,7 +841,7 @@ End Module Dim c1 = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, {ref}, TestOptions.ReleaseExe) AssertTheseDiagnostics(c1, -BC31143: Method 'Public Sub SubWithNoParams(foo As Integer)' does not have a signature compatible with delegate 'Delegate Sub DelegateByRefParamArray.DelegateSubWithParamAndParamArrayOfReferenceTypes(A_0 As Integer, ParamArray A_1 As DelegateByRefParamArray_Base())'. +BC31143: Method 'Public Sub SubWithNoParams(goo As Integer)' does not have a signature compatible with delegate 'Delegate Sub DelegateByRefParamArray.DelegateSubWithParamAndParamArrayOfReferenceTypes(A_0 As Integer, ParamArray A_1 As DelegateByRefParamArray_Base())'. Dim d1 as DelegateByRefParamArray.DelegateSubWithParamAndParamArrayOfReferenceTypes = AddressOf SubWithNoParams ~~~~~~~~~~~~~~~ ) @@ -916,21 +916,21 @@ BC36663: Option Strict On does not allow narrowing in implicit type conversions Module Program - sub foo1(byval p as integer) + sub goo1(byval p as integer) end sub - sub foo2(byref p as integer) + sub goo2(byref p as integer) end sub Sub Main(args As String()) ' don't work - Dim d1 as MyDelegate1 = addressof foo1 - Dim d2 as MyDelegate2 = addressof foo2 + Dim d1 as MyDelegate1 = addressof goo1 + Dim d2 as MyDelegate2 = addressof goo2 ' work - 'Dim d3 as MyDelegate1 = addressof foo2 - 'Dim d4 as MyDelegate2 = addressof foo1 + 'Dim d3 as MyDelegate1 = addressof goo2 + 'Dim d4 as MyDelegate2 = addressof goo1 End Sub End Module @@ -940,11 +940,11 @@ BC36663: Option Strict On does not allow narrowing in implicit type conversions Dim c1 = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) AssertTheseDiagnostics(c1, -BC31143: Method 'Public Sub foo1(p As Integer)' does not have a signature compatible with delegate 'Delegate Sub MyDelegate1(ByRef p As Integer)'. - Dim d1 as MyDelegate1 = addressof foo1 +BC31143: Method 'Public Sub goo1(p As Integer)' does not have a signature compatible with delegate 'Delegate Sub MyDelegate1(ByRef p As Integer)'. + Dim d1 as MyDelegate1 = addressof goo1 ~~~~ -BC31143: Method 'Public Sub foo2(ByRef p As Integer)' does not have a signature compatible with delegate 'Delegate Sub MyDelegate2(p As Integer)'. - Dim d2 as MyDelegate2 = addressof foo2 +BC31143: Method 'Public Sub goo2(ByRef p As Integer)' does not have a signature compatible with delegate 'Delegate Sub MyDelegate2(p As Integer)'. + Dim d2 as MyDelegate2 = addressof goo2 ~~~~ ) Next @@ -999,22 +999,22 @@ Option Strict On Imports System Imports System.Collections.Generic Module Test - Sub foo(Of TT, UU, VV)(x As Func(Of TT, UU, VV), y As Func(Of UU, VV, TT), z As Func(Of VV, TT, UU)) + Sub goo(Of TT, UU, VV)(x As Func(Of TT, UU, VV), y As Func(Of UU, VV, TT), z As Func(Of VV, TT, UU)) End Sub - Sub foo(Of TT, UU, VV)(xx As TT, yy As UU, zz As VV) + Sub goo(Of TT, UU, VV)(xx As TT, yy As UU, zz As VV) End Sub - Sub foo(Of TT, UU, VV)(x As Func(Of TT, List(Of TT), UU, Dictionary(Of List(Of TT), UU)), y As Func(Of UU, VV), z As Action(Of VV, List(Of VV), Dictionary(Of List(Of VV), TT))) + Sub goo(Of TT, UU, VV)(x As Func(Of TT, List(Of TT), UU, Dictionary(Of List(Of TT), UU)), y As Func(Of UU, VV), z As Action(Of VV, List(Of VV), Dictionary(Of List(Of VV), TT))) End Sub - Sub foo(Of TT, UU, VV)(x As Func(Of TT, UU), y As Func(Of TT, VV), z As Func(Of UU, VV), a As Func(Of UU, TT), b As Func(Of VV, TT), c As Func(Of VV, UU)) + Sub goo(Of TT, UU, VV)(x As Func(Of TT, UU), y As Func(Of TT, VV), z As Func(Of UU, VV), a As Func(Of UU, TT), b As Func(Of VV, TT), c As Func(Of VV, UU)) Console.WriteLine(GetType(TT)) Console.WriteLine(GetType(UU)) Console.WriteLine(GetType(VV)) - Console.WriteLine("foo") + Console.WriteLine("goo") End Sub Sub Main() Dim f1 As Func(Of Exception, ArgumentException) = Function(a As Exception) New ArgumentException() Dim f2 As Func(Of ArgumentException, Exception) = Function(a As ArgumentException) New ArgumentException() - foo(f1, f1, f1, f1, f2, f2) + goo(f1, f1, f1, f1, f2, f2) End Sub End Module @@ -1027,7 +1027,7 @@ End Module System.Exception System.Exception System.ArgumentException -foo +goo ]]>) End Sub @@ -1053,21 +1053,21 @@ Public Class Runner y As Del1(Of UU, VV), z As Action(Of VV, List(Of VV), Dictionary(Of List(Of VV), TT))) - Sub foo(Of TT, UU, VV)( + Sub goo(Of TT, UU, VV)( xx As TT, yy As UU, zz As VV) Console.Write("pass") End Sub - Sub foo(Of TT, UU, VV)( + Sub goo(Of TT, UU, VV)( x As Func(Of TT, List(Of TT), UU, Dictionary(Of List(Of TT), UU)), y As Del1(Of UU, VV), z As Action(Of VV, List(Of VV), Dictionary(Of List(Of VV), TT))) Console.Write("fail") End Sub - Sub foo(Of TT, UU, VV)( + Sub goo(Of TT, UU, VV)( x As Func(Of TT, UU, VV), y As Func(Of UU, VV, TT), z As Func(Of VV, TT, UU)) @@ -1075,8 +1075,8 @@ Public Class Runner End Sub Public Sub Run(Of AA, BB, CC)() - Dim d As Del2(Of AA, BB, CC) = AddressOf foo - Dim d2 As Del2(Of Long, Long, Long) = AddressOf foo + Dim d As Del2(Of AA, BB, CC) = AddressOf goo + Dim d2 As Del2(Of Long, Long, Long) = AddressOf goo d(Nothing, Nothing, Nothing) d2(Nothing, Nothing, Nothing) End Sub @@ -1107,10 +1107,10 @@ Option Strict On Imports System Module Test - Function Fooo(p As Double) As Integer + Function Gooo(p As Double) As Integer Dim f As Func(Of Double, Integer) - f = AddressOf Fooo - Dim g As new Func(Of Double, Integer)(AddressOf Fooo) + f = AddressOf Gooo + Dim g As new Func(Of Double, Integer)(AddressOf Gooo) Return 0 End Function @@ -1253,14 +1253,14 @@ Imports System Module M Sub Main() - Foo(AddressOf Object.Equals) + Goo(AddressOf Object.Equals) End Sub - Sub Foo(x As Func(Of Object, Boolean)) + Sub Goo(x As Func(Of Object, Boolean)) Console.WriteLine(1) End Sub - Sub Foo(x As Func(Of Object, Object, Boolean)) + Sub Goo(x As Func(Of Object, Object, Boolean)) Console.WriteLine(2) End Sub End Module @@ -1282,14 +1282,14 @@ Imports System Module M Sub Main() - Foo(AddressOf C1.Boo) + Goo(AddressOf C1.Boo) End Sub - Sub Foo(x As Func(Of Object, Boolean)) + Sub Goo(x As Func(Of Object, Boolean)) Console.WriteLine(1) End Sub - Sub Foo(x As Func(Of Object, Object, Boolean)) + Sub Goo(x As Func(Of Object, Object, Boolean)) Console.WriteLine(2) End Sub @@ -1306,10 +1306,10 @@ End Module Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(compilationDef, New VisualBasicCompilationOptions(OutputKind.ConsoleApplication)) AssertTheseDiagnostics(compilation, -BC30518: Overload resolution failed because no accessible 'Foo' can be called with these arguments: - 'Public Sub Foo(x As Func(Of Object, Boolean))': Method 'Public Function Boo(a As Object, b As Object) As Boolean' does not have a signature compatible with delegate 'Delegate Function Func(Of Object, Boolean)(arg As Object) As Boolean'. - 'Public Sub Foo(x As Func(Of Object, Object, Boolean))': Reference to a non-shared member requires an object reference. - Foo(AddressOf C1.Boo) +BC30518: Overload resolution failed because no accessible 'Goo' can be called with these arguments: + 'Public Sub Goo(x As Func(Of Object, Boolean))': Method 'Public Function Boo(a As Object, b As Object) As Boolean' does not have a signature compatible with delegate 'Delegate Function Func(Of Object, Boolean)(arg As Object) As Boolean'. + 'Public Sub Goo(x As Func(Of Object, Object, Boolean))': Reference to a non-shared member requires an object reference. + Goo(AddressOf C1.Boo) ~~~ ) End Sub @@ -1341,15 +1341,15 @@ Module M Return False End Function - Function Foo(x As Func(Of Derived, Derived, Boolean)) As Integer + Function Goo(x As Func(Of Derived, Derived, Boolean)) As Integer Return 1 End Function - Function Foo(x As Func(Of Derived, Boolean)) As Integer + Function Goo(x As Func(Of Derived, Boolean)) As Integer Return 2 End Function - Public FLD As Integer = Foo(AddressOf MyClass.F1) + Public FLD As Integer = Goo(AddressOf MyClass.F1) End Class Public Class C2 diff --git a/src/Compilers/VisualBasic/Test/Semantic/Binding/BindingObjectInitializerTests.vb b/src/Compilers/VisualBasic/Test/Semantic/Binding/BindingObjectInitializerTests.vb index 311ca6b92b011..b7c69fd89f17d 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/Binding/BindingObjectInitializerTests.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/Binding/BindingObjectInitializerTests.vb @@ -428,11 +428,11 @@ Option Strict On Imports System Class C1 - Public Sub Foo() + Public Sub Goo() End Sub Public Shared Sub Main() - Dim c1 as New C1() With {.Foo = "Hello World!"} + Dim c1 as New C1() With {.Goo = "Hello World!"} End Sub End Class @@ -441,8 +441,8 @@ End Class Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) AssertTheseDiagnostics(compilation, -BC30990: Member 'Foo' cannot be initialized in an object initializer expression because it is not a field or property. - Dim c1 as New C1() With {.Foo = "Hello World!"} +BC30990: Member 'Goo' cannot be initialized in an object initializer expression because it is not a field or property. + Dim c1 as New C1() With {.Goo = "Hello World!"} ~~~ ) End Sub @@ -459,7 +459,7 @@ Imports System Class C1 Public ReadOnly Property X As String Get - Return "foo" + Return "goo" End Get End Property @@ -513,7 +513,7 @@ BC30064: 'ReadOnly' variable cannot be the target of an assignment. Class C1 Public Property X As String Get - Return "foo" + Return "goo" End Get private set End set @@ -523,7 +523,7 @@ End Class Module Module1 Sub Main() - Dim x As New C1() With {.X = "foo"} + Dim x As New C1() With {.X = "goo"} End Sub End Module @@ -534,7 +534,7 @@ End Module Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) AssertTheseDiagnostics(compilation, BC31102: 'Set' accessor of property 'X' is not accessible. - Dim x As New C1() With {.X = "foo"} + Dim x As New C1() With {.X = "goo"} ~~~~~~~~~~ ) End Sub @@ -553,7 +553,7 @@ End Class Module Module1 Sub Main() - Dim x As New C3() With {.X = "foo"} + Dim x As New C3() With {.X = "goo"} x = New C3() With {.X = Unknown()} End Sub @@ -565,10 +565,10 @@ End Module Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) AssertTheseDiagnostics(compilation, BC30517: Overload resolution failed because no 'New' is accessible. - Dim x As New C3() With {.X = "foo"} + Dim x As New C3() With {.X = "goo"} ~~ BC30456: 'X' is not a member of 'C3'. - Dim x As New C3() With {.X = "foo"} + Dim x As New C3() With {.X = "goo"} ~ BC30517: Overload resolution failed because no 'New' is accessible. x = New C3() With {.X = Unknown()} @@ -589,14 +589,14 @@ BC30451: 'Unknown' is not declared. It may be inaccessible due to its protection Imports System -Interface IFoo +Interface IGoo Property Bar As Integer End Interface Class C2 - Implements IFoo + Implements IGoo - Public Property Bar As Integer Implements IFoo.Bar + Public Property Bar As Integer Implements IGoo.Bar End Class Class C1 @@ -604,7 +604,7 @@ Class C1 DoStuff(OF C2)() End Sub - Public shared Sub DoStuff(Of T As {IFoo, New})() + Public shared Sub DoStuff(Of T As {IGoo, New})() Dim x As New T() With {.Bar = 23} x = New T() With {.Bar = 23} @@ -637,10 +637,10 @@ Class C2 Public Shared Sub Main() Dim x As New C1(Of Integer) With {.Field = 23} - Foo(Of C1) + Goo(Of C1) End Sub - Public Shared Sub Foo(Of T As New)() + Public Shared Sub Goo(Of T As New)() Dim x As New C1(Of T) With {.Field = New T} End Sub @@ -974,8 +974,8 @@ Imports System Class C1 Public Shared Sub Main() - dim foo as new s1() - foo.x = 23 + dim goo as new s1() + goo.x = 23 Dim s1 As New s1 With {.x = s1.x} End Sub @@ -1043,7 +1043,7 @@ Imports System Class C1 Public Shared Sub Main() - dim a as string = "foo" + dim a as string = "goo" Dim c As New cust With {.x = !a} End Sub End Class @@ -1154,77 +1154,77 @@ End Class Structure NonEmptyStructure Public RefField1 As String Public ValField1 As Integer - Public Property Foo As String + Public Property Goo As String End Structure Structure EmptyStructure - Public Property Foo1 As Integer - Public Property Foo2 As String + Public Property Goo1 As Integer + Public Property Goo2 As String End Structure Class RefClass Public RefField1 As String Public ValField1 As Integer - Public Property Foo As String - Public Property Foo1 As Integer - Public Property Foo2 As String + Public Property Goo As String + Public Property Goo1 As Integer + Public Property Goo2 As String End Class Interface IMissingStuff2 - Property Foo1 As Integer - Property Foo2 As String + Property Goo1 As Integer + Property Goo2 As String End Interface Class ObjectInitializerClass Public Sub TypeParameterNotDefined(Of T As {IMissingStuff2, New})() - Dim var20 As New T() With {.Foo1 = .Foo2.Length} ' Receiver type unknown, no warning - Dim var21 As New T() With {.Foo1 = var21.Foo2.Length} ' Receiver type unknown, no warning - Dim var22 As T = New T() With {.Foo1 = .Foo2.Length} ' Receiver type unknown, no warning - Dim var23 As T = New T() With {.Foo1 = var23.Foo2.Length} ' Receiver type unknown, no warning + Dim var20 As New T() With {.Goo1 = .Goo2.Length} ' Receiver type unknown, no warning + Dim var21 As New T() With {.Goo1 = var21.Goo2.Length} ' Receiver type unknown, no warning + Dim var22 As T = New T() With {.Goo1 = .Goo2.Length} ' Receiver type unknown, no warning + Dim var23 As T = New T() With {.Goo1 = var23.Goo2.Length} ' Receiver type unknown, no warning End Sub Public Sub TypeParameterAsStructure(Of T As {Structure, IMissingStuff2})() - Dim var24 As New T() With {.Foo1 = .Foo2.Length} ' no local referenced, no warning - Dim var25 As New T() With {.Foo1 = var25.Foo2.Length} ' inplace initialized, no warning - Dim var26 As T = New T() With {.Foo1 = .Foo2.Length} ' no local referenced, no warning - Dim var27 As T = New T() With {.Foo1 = var27.Foo2.Length} ' temporary used, warning + Dim var24 As New T() With {.Goo1 = .Goo2.Length} ' no local referenced, no warning + Dim var25 As New T() With {.Goo1 = var25.Goo2.Length} ' inplace initialized, no warning + Dim var26 As T = New T() With {.Goo1 = .Goo2.Length} ' no local referenced, no warning + Dim var27 As T = New T() With {.Goo1 = var27.Goo2.Length} ' temporary used, warning - Dim var28, var29 As New T() With {.Foo1 = var28.Foo2.Length} ' no local referenced, no warning - Dim var30, var31 As New T() With {.Foo1 = var31.Foo2.Length} ' Receiver type unknown, no warning + Dim var28, var29 As New T() With {.Goo1 = var28.Goo2.Length} ' no local referenced, no warning + Dim var30, var31 As New T() With {.Goo1 = var31.Goo2.Length} ' Receiver type unknown, no warning End Sub Public Sub DoStuff_3(Of T As {RefClass, New})() - Dim var32 As New T() With {.Foo1 = .Foo2.Length} ' no local referenced, no warning - Dim var33 As New T() With {.Foo1 = var33.Foo2.Length} ' not yet initialized, warning - Dim var34 As T = New T() With {.Foo1 = .Foo2.Length} ' no local referenced, no warning - Dim var35 As T = New T() With {.Foo1 = var35.Foo2.Length} ' not yet initialized, warning - Dim var36, var37 As New T() With {.Foo1 = var36.Foo2.Length} ' not yet initialized, warning - Dim var38, var39 As New T() With {.Foo1 = var39.Foo2.Length} ' not yet initialized, warning + Dim var32 As New T() With {.Goo1 = .Goo2.Length} ' no local referenced, no warning + Dim var33 As New T() With {.Goo1 = var33.Goo2.Length} ' not yet initialized, warning + Dim var34 As T = New T() With {.Goo1 = .Goo2.Length} ' no local referenced, no warning + Dim var35 As T = New T() With {.Goo1 = var35.Goo2.Length} ' not yet initialized, warning + Dim var36, var37 As New T() With {.Goo1 = var36.Goo2.Length} ' not yet initialized, warning + Dim var38, var39 As New T() With {.Goo1 = var39.Goo2.Length} ' not yet initialized, warning End Sub Public Shared Sub Main() - Dim var01 As New NonEmptyStructure() With {.ValField1 = var01.RefField1.Length, .RefField1 = var01.Foo} ' no warnings - Dim var02, var03 As New NonEmptyStructure() With {.ValField1 = var03.RefField1.Length, .RefField1 = var03.Foo} ' warnings - Dim var04, var05 As New NonEmptyStructure() With {.RefField1 = var04.Foo} ' no warnings + Dim var01 As New NonEmptyStructure() With {.ValField1 = var01.RefField1.Length, .RefField1 = var01.Goo} ' no warnings + Dim var02, var03 As New NonEmptyStructure() With {.ValField1 = var03.RefField1.Length, .RefField1 = var03.Goo} ' warnings + Dim var04, var05 As New NonEmptyStructure() With {.RefField1 = var04.Goo} ' no warnings - Dim var06 As NonEmptyStructure = New NonEmptyStructure() With {.ValField1 = var06.RefField1.Length, .RefField1 = var06.Foo} ' warnings + Dim var06 As NonEmptyStructure = New NonEmptyStructure() With {.ValField1 = var06.RefField1.Length, .RefField1 = var06.Goo} ' warnings - Dim var07 As New EmptyStructure() With {.Foo1 = var07.Foo2.Length} ' no warnings - Dim var08, var09 As New EmptyStructure() With {.Foo1 = var09.Foo2.Length} ' warnings - Dim var10, var11 As New EmptyStructure() With {.Foo1 = var10.Foo2.Length} ' no warnings + Dim var07 As New EmptyStructure() With {.Goo1 = var07.Goo2.Length} ' no warnings + Dim var08, var09 As New EmptyStructure() With {.Goo1 = var09.Goo2.Length} ' warnings + Dim var10, var11 As New EmptyStructure() With {.Goo1 = var10.Goo2.Length} ' no warnings - Dim var12 As EmptyStructure = New EmptyStructure() With {.Foo1 = var12.Foo2.Length} ' warnings + Dim var12 As EmptyStructure = New EmptyStructure() With {.Goo1 = var12.Goo2.Length} ' warnings - Dim var13 As New RefClass() With {.ValField1 = var13.RefField1.Length, .RefField1 = var13.Foo} ' no warnings - Dim var14, var15 As New RefClass() With {.ValField1 = var15.RefField1.Length, .RefField1 = var15.Foo} ' warnings - Dim var16, var17 As New RefClass() With {.ValField1 = var16.RefField1.Length, .RefField1 = var16.Foo} ' no warnings + Dim var13 As New RefClass() With {.ValField1 = var13.RefField1.Length, .RefField1 = var13.Goo} ' no warnings + Dim var14, var15 As New RefClass() With {.ValField1 = var15.RefField1.Length, .RefField1 = var15.Goo} ' warnings + Dim var16, var17 As New RefClass() With {.ValField1 = var16.RefField1.Length, .RefField1 = var16.Goo} ' no warnings - Dim var18 As RefClass = New RefClass() With {.ValField1 = var18.RefField1.Length, .RefField1 = var18.Foo} ' warnings + Dim var18 As RefClass = New RefClass() With {.ValField1 = var18.RefField1.Length, .RefField1 = var18.Goo} ' warnings - Dim var19 = New RefClass() With {.ValField1 = var18.RefField1.Length, .RefField1 = var18.Foo} ' warnings + Dim var19 = New RefClass() With {.ValField1 = var18.RefField1.Length, .RefField1 = var18.Goo} ' warnings End Sub End Class @@ -1237,8 +1237,8 @@ Class CObjInitDerived Inherits CObjInitBase(Of NonEmptyStructure) Public Overrides Sub TypeParameterValueTypeAsClassConstraint(Of U As {NonEmptyStructure, IMissingStuff2})() - Dim uinst1 As New U() With {.Foo1 = uinst1.Foo2.Length} - Dim uinst2 As U = New U() With {.Foo1 = uinst2.Foo2.Length} + Dim uinst1 As New U() With {.Goo1 = uinst1.Goo2.Length} + Dim uinst2 As U = New U() With {.Goo1 = uinst2.Goo2.Length} End Sub End Class @@ -1247,55 +1247,55 @@ End Class Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) AssertTheseDiagnostics(compilation, BC42109: Variable 'var27' is used before it has been assigned a value. A null reference exception could result at runtime. Make sure the structure or all the reference members are initialized before use - Dim var27 As T = New T() With {.Foo1 = var27.Foo2.Length} ' temporary used, warning + Dim var27 As T = New T() With {.Goo1 = var27.Goo2.Length} ' temporary used, warning ~~~~~ BC42109: Variable 'var31' is used before it has been assigned a value. A null reference exception could result at runtime. Make sure the structure or all the reference members are initialized before use - Dim var30, var31 As New T() With {.Foo1 = var31.Foo2.Length} ' Receiver type unknown, no warning + Dim var30, var31 As New T() With {.Goo1 = var31.Goo2.Length} ' Receiver type unknown, no warning ~~~~~ BC42104: Variable 'var33' is used before it has been assigned a value. A null reference exception could result at runtime. - Dim var33 As New T() With {.Foo1 = var33.Foo2.Length} ' not yet initialized, warning + Dim var33 As New T() With {.Goo1 = var33.Goo2.Length} ' not yet initialized, warning ~~~~~ BC42104: Variable 'var35' is used before it has been assigned a value. A null reference exception could result at runtime. - Dim var35 As T = New T() With {.Foo1 = var35.Foo2.Length} ' not yet initialized, warning + Dim var35 As T = New T() With {.Goo1 = var35.Goo2.Length} ' not yet initialized, warning ~~~~~ BC42104: Variable 'var36' is used before it has been assigned a value. A null reference exception could result at runtime. - Dim var36, var37 As New T() With {.Foo1 = var36.Foo2.Length} ' not yet initialized, warning + Dim var36, var37 As New T() With {.Goo1 = var36.Goo2.Length} ' not yet initialized, warning ~~~~~ BC42104: Variable 'var39' is used before it has been assigned a value. A null reference exception could result at runtime. - Dim var38, var39 As New T() With {.Foo1 = var39.Foo2.Length} ' not yet initialized, warning + Dim var38, var39 As New T() With {.Goo1 = var39.Goo2.Length} ' not yet initialized, warning ~~~~~ BC42104: Variable 'RefField1' is used before it has been assigned a value. A null reference exception could result at runtime. - Dim var02, var03 As New NonEmptyStructure() With {.ValField1 = var03.RefField1.Length, .RefField1 = var03.Foo} ' warnings + Dim var02, var03 As New NonEmptyStructure() With {.ValField1 = var03.RefField1.Length, .RefField1 = var03.Goo} ' warnings ~~~~~~~~~~~~~~~ BC42109: Variable 'var03' is used before it has been assigned a value. A null reference exception could result at runtime. Make sure the structure or all the reference members are initialized before use - Dim var02, var03 As New NonEmptyStructure() With {.ValField1 = var03.RefField1.Length, .RefField1 = var03.Foo} ' warnings + Dim var02, var03 As New NonEmptyStructure() With {.ValField1 = var03.RefField1.Length, .RefField1 = var03.Goo} ' warnings ~~~~~ BC42104: Variable 'RefField1' is used before it has been assigned a value. A null reference exception could result at runtime. - Dim var06 As NonEmptyStructure = New NonEmptyStructure() With {.ValField1 = var06.RefField1.Length, .RefField1 = var06.Foo} ' warnings + Dim var06 As NonEmptyStructure = New NonEmptyStructure() With {.ValField1 = var06.RefField1.Length, .RefField1 = var06.Goo} ' warnings ~~~~~~~~~~~~~~~ BC42109: Variable 'var06' is used before it has been assigned a value. A null reference exception could result at runtime. Make sure the structure or all the reference members are initialized before use - Dim var06 As NonEmptyStructure = New NonEmptyStructure() With {.ValField1 = var06.RefField1.Length, .RefField1 = var06.Foo} ' warnings + Dim var06 As NonEmptyStructure = New NonEmptyStructure() With {.ValField1 = var06.RefField1.Length, .RefField1 = var06.Goo} ' warnings ~~~~~ BC42109: Variable 'var09' is used before it has been assigned a value. A null reference exception could result at runtime. Make sure the structure or all the reference members are initialized before use - Dim var08, var09 As New EmptyStructure() With {.Foo1 = var09.Foo2.Length} ' warnings + Dim var08, var09 As New EmptyStructure() With {.Goo1 = var09.Goo2.Length} ' warnings ~~~~~ BC42109: Variable 'var12' is used before it has been assigned a value. A null reference exception could result at runtime. Make sure the structure or all the reference members are initialized before use - Dim var12 As EmptyStructure = New EmptyStructure() With {.Foo1 = var12.Foo2.Length} ' warnings + Dim var12 As EmptyStructure = New EmptyStructure() With {.Goo1 = var12.Goo2.Length} ' warnings ~~~~~ BC42104: Variable 'var13' is used before it has been assigned a value. A null reference exception could result at runtime. - Dim var13 As New RefClass() With {.ValField1 = var13.RefField1.Length, .RefField1 = var13.Foo} ' no warnings + Dim var13 As New RefClass() With {.ValField1 = var13.RefField1.Length, .RefField1 = var13.Goo} ' no warnings ~~~~~ BC42104: Variable 'var15' is used before it has been assigned a value. A null reference exception could result at runtime. - Dim var14, var15 As New RefClass() With {.ValField1 = var15.RefField1.Length, .RefField1 = var15.Foo} ' warnings + Dim var14, var15 As New RefClass() With {.ValField1 = var15.RefField1.Length, .RefField1 = var15.Goo} ' warnings ~~~~~ BC42104: Variable 'var16' is used before it has been assigned a value. A null reference exception could result at runtime. - Dim var16, var17 As New RefClass() With {.ValField1 = var16.RefField1.Length, .RefField1 = var16.Foo} ' no warnings + Dim var16, var17 As New RefClass() With {.ValField1 = var16.RefField1.Length, .RefField1 = var16.Goo} ' no warnings ~~~~~ BC42104: Variable 'var18' is used before it has been assigned a value. A null reference exception could result at runtime. - Dim var18 As RefClass = New RefClass() With {.ValField1 = var18.RefField1.Length, .RefField1 = var18.Foo} ' warnings + Dim var18 As RefClass = New RefClass() With {.ValField1 = var18.RefField1.Length, .RefField1 = var18.Goo} ' warnings ~~~~~ BC42109: Variable 'uinst2' is used before it has been assigned a value. A null reference exception could result at runtime. Make sure the structure or all the reference members are initialized before use - Dim uinst2 As U = New U() With {.Foo1 = uinst2.Foo2.Length} + Dim uinst2 As U = New U() With {.Goo1 = uinst2.Goo2.Length} ~~~~~~ ) End Sub diff --git a/src/Compilers/VisualBasic/Test/Semantic/Binding/BindingScopeTests.vb b/src/Compilers/VisualBasic/Test/Semantic/Binding/BindingScopeTests.vb index cfc8dfd92bd12..5f90e022086af 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/Binding/BindingScopeTests.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/Binding/BindingScopeTests.vb @@ -46,7 +46,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests Imports System Imports System.Collections - Namespace Foo.Bar + Namespace Goo.Bar ' ClassA Public Class Apple(Of TBravo) Public alpha As Integer 'alpha @@ -139,7 +139,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests Imports System Imports System.Collections - Namespace Foo.Bar + Namespace Goo.Bar ' ClassA Public Class Apple(Of TBravo) ' this is before mango diff --git a/src/Compilers/VisualBasic/Test/Semantic/Binding/ForEachTests.vb b/src/Compilers/VisualBasic/Test/Semantic/Binding/ForEachTests.vb index 1d7ad619dcf68..144bc97937e57 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/Binding/ForEachTests.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/Binding/ForEachTests.vb @@ -573,7 +573,7 @@ Class C1 arr(1) = 42 For Each C1 In arr - Console.WriteLine("foo") + Console.WriteLine("goo") Next End Sub End Class @@ -606,7 +606,7 @@ Class C1 arr(1) = 42 For Each C1 In arr - Console.WriteLine("foo") + Console.WriteLine("goo") Next C1 End Sub End Class @@ -644,7 +644,7 @@ Class C1 arr(1) = 42 For Each element In arr - Console.WriteLine("foo") + Console.WriteLine("goo") Next element End Sub End Class @@ -684,7 +684,7 @@ Class C1 arr(1) = 42 For Each element In arr - Console.WriteLine("foo") + Console.WriteLine("goo") Next element End Sub End Class @@ -1224,7 +1224,7 @@ Class C1 Dim threeDimJaggedArray()()() As Integer = New Integer(2)()() {} For Each twoDimJaggedArray(1)() as Integer In threeDimJaggedArray - Console.WriteLine("foo") + Console.WriteLine("goo") Next twoDimJaggedArray End Sub End Class @@ -1614,7 +1614,7 @@ Class C1 Dim myCustomCollection As Custom = nothing For Each element as Custom In myCustomCollection - Console.WriteLine("foo") + Console.WriteLine("goo") Next End Sub End Class @@ -1636,12 +1636,12 @@ Imports System Imports System.Collections Class Custom - Public Function GetEnumerator(Optional foo as integer = 1) As CustomEnumerator + Public Function GetEnumerator(Optional goo as integer = 1) As CustomEnumerator Return Nothing End Function Public Class CustomEnumerator - Public Function MoveNext(Optional foo as boolean = false) As Boolean + Public Function MoveNext(Optional goo as boolean = false) As Boolean Return False End Function @@ -1658,7 +1658,7 @@ Class C1 Dim myCustomCollection As Custom = nothing For Each element as Custom In myCustomCollection - Console.WriteLine("foo") + Console.WriteLine("goo") Next End Sub End Class @@ -1702,7 +1702,7 @@ Class C1 Dim myCustomCollection As Custom = nothing For Each element as Custom In myCustomCollection - Console.WriteLine("foo") + Console.WriteLine("goo") Next End Sub End Class @@ -1751,7 +1751,7 @@ Class C1 Dim myCustomCollection As Custom = nothing For Each element as Custom In myCustomCollection - Console.WriteLine("foo") + Console.WriteLine("goo") Next End Sub End Class @@ -1798,7 +1798,7 @@ Public Class CustomEnumerator Dim myCustomCollection As Custom = nothing For Each element as Custom In myCustomCollection - Console.WriteLine("foo") + Console.WriteLine("goo") Next End Sub End Class @@ -1846,7 +1846,7 @@ Class C1 Dim myCustomCollection As Custom = nothing For Each element as Custom In myCustomCollection - Console.WriteLine("foo") + Console.WriteLine("goo") Next End Sub End Class @@ -1879,7 +1879,7 @@ Imports System.Collections Imports System.Runtime.CompilerServices Class Custom - Public Function GetEnumerator(ByVal foo as Integer) As Double + Public Function GetEnumerator(ByVal goo as Integer) As Double Return Nothing End Function @@ -1908,7 +1908,7 @@ Class C1 Dim myCustomCollection As Custom = nothing For Each element as Custom In myCustomCollection - Console.WriteLine("foo") + Console.WriteLine("goo") Next End Sub End Class @@ -1955,17 +1955,17 @@ Class C1 Public Shared Sub Main() Dim myCollection1 As IEnumerable = nothing For Each element as IEnumerable In myCollection1 - Console.WriteLine("foo") + Console.WriteLine("goo") Next Dim myCollection2 As IBetterEnumerable = nothing For Each element as IBetterEnumerable In myCollection2 - Console.WriteLine("foo") + Console.WriteLine("goo") Next Dim myCollection3 As SomethingEnumerable = nothing For Each element as SomethingEnumerable In myCollection3 - Console.WriteLine("foo") + Console.WriteLine("goo") Next End Sub End Class @@ -2006,17 +2006,17 @@ Class C1 Public Shared Sub Main() Dim myCollection1 As IEnumerable(Of String) = nothing For Each element as String In myCollection1 - Console.WriteLine("foo") + Console.WriteLine("goo") Next Dim myCollection2 As IBetterEnumerable(Of String) = nothing For Each element as String In myCollection2 - Console.WriteLine("foo") + Console.WriteLine("goo") Next Dim myCollection3 As SomethingEnumerable(Of String) = nothing For Each element as String In myCollection3 - Console.WriteLine("foo") + Console.WriteLine("goo") Next End Sub End Class @@ -2517,7 +2517,7 @@ Class C1 Dim myCustomCollection As Custom = nothing For Each element as Custom In myCustomCollection - Console.WriteLine("foo") + Console.WriteLine("goo") Next End Sub End Class @@ -2561,7 +2561,7 @@ Class C1 Dim myCustomCollection As Custom(Of CustomEnumerator) = Nothing For Each element As Integer In myCustomCollection - Console.WriteLine("foo") + Console.WriteLine("goo") Next End Sub End Class @@ -2591,7 +2591,7 @@ Class C1 Dim myCustomCollection As T = Nothing For Each element As Integer In myCustomCollection - Console.WriteLine("foo") + Console.WriteLine("goo") Next End Sub End Class @@ -2960,7 +2960,7 @@ End Module Option Infer On Class C1 - public function foo() as Integer() + public function goo() as Integer() return new Integer() {1,2,3} end function End Class @@ -2970,11 +2970,11 @@ Module M Dim unassignedRef1, unassignedRef2, unassignedRef3, unassignedRef4 as C1 - For Each unassignedRef1.foo()(0) In unassignedRef2.foo() + For Each unassignedRef1.goo()(0) In unassignedRef2.goo() if unassignedRef3 is nothing then End if - Next unassignedRef1.foo()(unassignedRef4.foo()(0)) + Next unassignedRef1.goo()(unassignedRef4.goo()(0)) For each unassignedRef8 as C1 in New C1() {unassignedRef8} System.Console.WriteLine(unassignedRef8) @@ -2991,10 +2991,10 @@ BC42024: Unused local variable: 'unassignedRef4'. Dim unassignedRef1, unassignedRef2, unassignedRef3, unassignedRef4 as C1 ~~~~~~~~~~~~~~ BC42104: Variable 'unassignedRef1' is used before it has been assigned a value. A null reference exception could result at runtime. - For Each unassignedRef1.foo()(0) In unassignedRef2.foo() + For Each unassignedRef1.goo()(0) In unassignedRef2.goo() ~~~~~~~~~~~~~~ BC42104: Variable 'unassignedRef2' is used before it has been assigned a value. A null reference exception could result at runtime. - For Each unassignedRef1.foo()(0) In unassignedRef2.foo() + For Each unassignedRef1.goo()(0) In unassignedRef2.goo() ~~~~~~~~~~~~~~ BC42104: Variable 'unassignedRef3' is used before it has been assigned a value. A null reference exception could result at runtime. if unassignedRef3 is nothing then @@ -3013,7 +3013,7 @@ BC42104: Variable 'unassignedRef8' is used before it has been assigned a value. Option Infer On Class C1 - public shared function foo() as Integer() + public shared function goo() as Integer() return new Integer() {1,2,3} end function End Class @@ -3023,11 +3023,11 @@ Module M Dim unassignedRef1, unassignedRef2, unassignedRef3, unassignedRef4 as C1 - For Each unassignedRef1.foo()(0) In unassignedRef2.foo() + For Each unassignedRef1.goo()(0) In unassignedRef2.goo() if unassignedRef3 is nothing then End if - Next unassignedRef1.foo()(unassignedRef4.foo()(0)) + Next unassignedRef1.goo()(unassignedRef4.goo()(0)) For each unassignedRef5 as C1 in New C1() {unassignedRef5} Next @@ -3052,19 +3052,19 @@ BC42024: Unused local variable: 'unassignedRef4'. Dim unassignedRef1, unassignedRef2, unassignedRef3, unassignedRef4 as C1 ~~~~~~~~~~~~~~ BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated. - For Each unassignedRef1.foo()(0) In unassignedRef2.foo() + For Each unassignedRef1.goo()(0) In unassignedRef2.goo() ~~~~~~~~~~~~~~~~~~ BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated. - For Each unassignedRef1.foo()(0) In unassignedRef2.foo() + For Each unassignedRef1.goo()(0) In unassignedRef2.goo() ~~~~~~~~~~~~~~~~~~ BC42104: Variable 'unassignedRef3' is used before it has been assigned a value. A null reference exception could result at runtime. if unassignedRef3 is nothing then ~~~~~~~~~~~~~~ BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated. - Next unassignedRef1.foo()(unassignedRef4.foo()(0)) + Next unassignedRef1.goo()(unassignedRef4.goo()(0)) ~~~~~~~~~~~~~~~~~~ BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated. - Next unassignedRef1.foo()(unassignedRef4.foo()(0)) + Next unassignedRef1.goo()(unassignedRef4.goo()(0)) ~~~~~~~~~~~~~~~~~~ BC42104: Variable 'unassignedRef5' is used before it has been assigned a value. A null reference exception could result at runtime. For each unassignedRef5 as C1 in New C1() {unassignedRef5} @@ -3120,7 +3120,7 @@ BC42104: Variable 'x' is used before it has been assigned a value. A null refere Option Infer On Class C1 - public function foo() as Integer() + public function goo() as Integer() return new Integer() {1,2,3} end function End Class @@ -3130,7 +3130,7 @@ Module M Dim used1, used2 as integer - For Each used1 In new C1().foo() + For Each used1 In new C1().goo() used2 = 23 Next used1 End Sub @@ -3593,17 +3593,17 @@ Class C1 Public Shared Sub Main() Dim myCollection1 As IEnumerable = nothing For Each element as IEnumerable In myCollection1 - Console.WriteLine("foo") + Console.WriteLine("goo") Next Dim myCollection2 As IBetterEnumerable = nothing For Each element as IBetterEnumerable In myCollection2 - Console.WriteLine("foo") + Console.WriteLine("goo") Next Dim myCollection3 As SomethingEnumerable = nothing For Each element as SomethingEnumerable In myCollection3 - Console.WriteLine("foo") + Console.WriteLine("goo") Next End Sub End Class @@ -3663,7 +3663,7 @@ Class C1 Dim myCustomCollection As Custom = nothing For Each element as Custom In myCustomCollection - Console.WriteLine("foo") + Console.WriteLine("goo") Next End Sub End Class @@ -3724,7 +3724,7 @@ Class C1 Dim myCustomCollection As Custom = nothing For Each element as Custom In myCustomCollection - Console.WriteLine("foo") + Console.WriteLine("goo") Next End Sub End Class @@ -3742,7 +3742,7 @@ End Class IL_000a: ldc.i4.s 23 IL_000c: callvirt "Function Custom.CustomEnumerator.get_Current(Integer) As Custom" IL_0011: pop - IL_0012: ldstr "foo" + IL_0012: ldstr "goo" IL_0017: call "Sub System.Console.WriteLine(String)" IL_001c: ldloc.0 IL_001d: callvirt "Function Custom.CustomEnumerator.MoveNext() As Boolean" @@ -3766,7 +3766,7 @@ Module Program Sub Main() End Sub - Sub Foo(Of T, S, R) + Sub Goo(Of T, S, R) For Each t In "" Next @@ -3808,7 +3808,7 @@ Module Program Sub Main() End Sub - Sub Foo(Of T, S, R) + Sub Goo(Of T, S, R) For Each t In "" Next @@ -4130,7 +4130,7 @@ module module1 next console.writeline("Collection Test") - for each i in foo() + for each i in goo() x(i) = sub() console.writeline(i.toString) next for i = 1 to 3 @@ -4139,7 +4139,7 @@ module module1 console.writeline("NonLocal Test") dim jj as integer - for each jj in foo() + for each jj in goo() x(jj) = sub() console.writeline(jj.toString) next for i = 1 to 3 @@ -4148,11 +4148,11 @@ module module1 end sub - function foo() as IEnumerable(of Integer) + function goo() as IEnumerable(of Integer) return new list(of integer) from {1, 2, 3} end function - function foo2(kk as integer ) as IEnumerable(of Integer) + function goo2(kk as integer ) as IEnumerable(of Integer) return new list(of integer) from {1, 2, 3} end function @@ -4180,7 +4180,7 @@ module module1 next console.writeline("Header Test: Collection Test") - for each i in (function() foo())() + for each i in (function() goo())() x(i) = sub() console.writeline(i.toString) next for i = 1 to 3 @@ -4189,7 +4189,7 @@ module module1 console.writeline("Header Test: NonLocal Test") dim jj as integer - for each jj in (function() foo())() + for each jj in (function() goo())() x(jj) = sub() console.writeline(jj.toString) next for i = 1 to 3 @@ -4222,7 +4222,7 @@ module module1 next console.writeline("Header Test: Collection Test") - for each i as integer in (function(a) foo())(i) + for each i as integer in (function(a) goo())(i) x(i) = sub() console.writeline(i.toString) next for i = 1 to 3 @@ -4231,7 +4231,7 @@ module module1 console.writeline("Header Test: NonLocal Test") dim jj as integer - for each jj in (function(a) foo())(jj) + for each jj in (function(a) goo())(jj) x(jj) = sub() console.writeline(jj.toString) next for i = 1 to 3 @@ -4240,7 +4240,7 @@ module module1 console.writeline("Header Test: NonLocal Test2") dim kk as integer - for each kk in (function(a) foo2(kk))(kk) + for each kk in (function(a) goo2(kk))(kk) x(kk) = sub() console.writeline(kk.toString) next diff --git a/src/Compilers/VisualBasic/Test/Semantic/Binding/GenericsTests.vb b/src/Compilers/VisualBasic/Test/Semantic/Binding/GenericsTests.vb index d940508a7a0f8..6868d22ee7be4 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/Binding/GenericsTests.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/Binding/GenericsTests.vb @@ -55,7 +55,7 @@ BC32042: Too few type arguments to 'vbCls5(Of UInteger()()).vbStrA(Of X, Y)'. Dim vbCompilation = CreateVisualBasicCompilation("TestNestedGenericTypeInference", , compilationOptions:=New VisualBasicCompilationOptions(OutputKind.ConsoleApplication)) @@ -232,7 +232,7 @@ End Namespace Imports System Module Program - Sub foo(ByRef x As RuntimeArgumentHandle()) + Sub goo(ByRef x As RuntimeArgumentHandle()) ReDim x(100) End Sub End Module diff --git a/src/Compilers/VisualBasic/Test/Semantic/Binding/GotoTests.vb b/src/Compilers/VisualBasic/Test/Semantic/Binding/GotoTests.vb index 6d3f39f7eed4d..35dd1229a5611 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/Binding/GotoTests.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/Binding/GotoTests.vb @@ -23,7 +23,7 @@ Imports System.Collections.Generic Imports System.Linq Class C1 shared Sub MAIN() - Dim lists = foo() + Dim lists = goo() lists.Where(Function(ByVal item) lab1: Try @@ -35,7 +35,7 @@ lab1: Return item.ToString() = String.Empty End Function).ToList() End Sub - Shared Function foo() As List(Of Integer) + Shared Function goo() As List(Of Integer) Return Nothing End Function End Class @@ -278,7 +278,7 @@ Module M Public Sub Main() GoTo label1 End Sub - Public Sub foo() + Public Sub goo() label1: End Sub End Module diff --git a/src/Compilers/VisualBasic/Test/Semantic/Binding/ImplicitVariableTests.vb b/src/Compilers/VisualBasic/Test/Semantic/Binding/ImplicitVariableTests.vb index 61649682b8aaa..5ad33a99ef238 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/Binding/ImplicitVariableTests.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/Binding/ImplicitVariableTests.vb @@ -140,14 +140,14 @@ Option Strict On Imports System Module Module1 - Function Foo(q As Integer) As Integer - Foo = 10 - bar = Foo + q - Foo = CInt(bar) + 7 + Function Goo(q As Integer) As Integer + Goo = 10 + bar = Goo + q + Goo = CInt(bar) + 7 End Function Sub Main() - i% = Foo(3) + i% = Goo(3) While i > 0 Console.Write("{0} ", i) i = i% - 1 @@ -183,7 +183,7 @@ Module Module1 Return CInt(lam(7) + lam(11)) End Function - Function Foo(p As Integer) As Integer + Function Goo(p As Integer) As Integer Return Z(Function(z) q% = q% + 1 Return z + q% @@ -191,7 +191,7 @@ Module Module1 End Function Sub Main() - Console.WriteLine(Foo(4)) + Console.WriteLine(Goo(4)) End Sub End Module @@ -214,7 +214,7 @@ Imports System Module Module1 Sub Main() - Console.WriteLine(New C2().foo("hello")) + Console.WriteLine(New C2().goo("hello")) End Sub End Module @@ -224,7 +224,7 @@ End Class Class C2 Inherits C1 - Public Function foo(x As String) As Object + Public Function goo(x As String) As Object var = x Return var End Function @@ -247,15 +247,15 @@ Option Strict On Imports System Class C1 - Private var As Integer = foo + Private var As Integer = goo End Class ) CompilationUtils.AssertTheseDiagnostics(compilation, -BC30451: 'foo' is not declared. It may be inaccessible due to its protection level. - Private var As Integer = foo +BC30451: 'goo' is not declared. It may be inaccessible due to its protection level. + Private var As Integer = goo ~~~ ) @@ -462,7 +462,7 @@ Option Strict On Imports System Class C1 - Sub Foo() + Sub Goo() Dim x As String = y.ToString() End Sub End Class @@ -491,7 +491,7 @@ Option Strict On Imports System Class C1 - Sub Foo() + Sub Goo() Dim x As String = y() End Sub End Class @@ -521,7 +521,7 @@ Option Infer On Imports System Class C1 - Sub Foo() + Sub Goo() For x = 1 To 10 x.GetTypeCode() Next diff --git a/src/Compilers/VisualBasic/Test/Semantic/Binding/LookupTests.vb b/src/Compilers/VisualBasic/Test/Semantic/Binding/LookupTests.vb index b678069d99401..a9fc8075abef2 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/Binding/LookupTests.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/Binding/LookupTests.vb @@ -32,7 +32,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests Dim sym3 = New MockAssemblySymbol("world") ' just a symbol to put in results Dim sym4 = New MockAssemblySymbol("banana") ' just a symbol to put in results Dim sym5 = New MockAssemblySymbol("apple") ' just a symbol to put in results - Dim meth1 = New MockMethodSymbol("foo") ' just a symbol to put in results + Dim meth1 = New MockMethodSymbol("goo") ' just a symbol to put in results Dim meth2 = New MockMethodSymbol("bag") ' just a symbol to put in results Dim meth3 = New MockMethodSymbol("baz") ' just a symbol to put in results @@ -1414,8 +1414,8 @@ Imports A Imports B Class A - Shared Sub Foo() - System.Console.WriteLine("A.Foo()") + Shared Sub Goo() + System.Console.WriteLine("A.Goo()") End Sub End Class @@ -1425,7 +1425,7 @@ End Class Module C Sub Main() - Foo() + Goo() End Sub End Module @@ -1433,7 +1433,7 @@ End Module CompileAndVerify(compilation, ) compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( @@ -1443,22 +1443,22 @@ Imports A Imports B Class A - Shared Sub Foo() - System.Console.WriteLine("A.Foo()") + Shared Sub Goo() + System.Console.WriteLine("A.Goo()") End Sub End Class Class B Inherits A - Overloads Shared Sub Foo(x As Integer) - System.Console.WriteLine("B.Foo()") + Overloads Shared Sub Goo(x As Integer) + System.Console.WriteLine("B.Goo()") End Sub End Class Module C Sub Main() - Foo() + Goo() End Sub End Module @@ -1466,8 +1466,8 @@ End Module CompilationUtils.AssertTheseDiagnostics(compilation, -BC30561: 'Foo' is ambiguous, imported from the namespaces or types 'A, B, A'. - Foo() +BC30561: 'Goo' is ambiguous, imported from the namespaces or types 'A, B, A'. + Goo() ~~~ ) End Sub @@ -1481,14 +1481,14 @@ Option Strict On Option Explicit On Interface I - Sub FooInstance() + Sub GooInstance() End Interface Class A - Public Shared Sub FooShared() + Public Shared Sub GooShared() End Sub - Public Sub FooInstance() + Public Sub GooInstance() End Sub End Class @@ -1504,40 +1504,40 @@ End Module Dim classA = DirectCast(globalNS.GetMembers("A").Single(), NamedTypeSymbol) - Dim fooShared = DirectCast(classA.GetMembers("FooShared").Single(), MethodSymbol) - Dim fooInstance = DirectCast(classA.GetMembers("FooInstance").Single(), MethodSymbol) + Dim gooShared = DirectCast(classA.GetMembers("GooShared").Single(), MethodSymbol) + Dim gooInstance = DirectCast(classA.GetMembers("GooInstance").Single(), MethodSymbol) Dim lr As LookupResult ' Find Shared member lr = New LookupResult() - context.LookupMember(lr, classA, "FooShared", 0, LookupOptions.MustNotBeInstance, Nothing) + context.LookupMember(lr, classA, "GooShared", 0, LookupOptions.MustNotBeInstance, Nothing) Assert.Equal(1, lr.Symbols.Count) - Assert.Equal(fooShared, lr.Symbols.Single()) + Assert.Equal(gooShared, lr.Symbols.Single()) Assert.False(lr.HasDiagnostic) lr = New LookupResult() - context.LookupMember(lr, classA, "FooInstance", 0, LookupOptions.MustNotBeInstance, Nothing) + context.LookupMember(lr, classA, "GooInstance", 0, LookupOptions.MustNotBeInstance, Nothing) Assert.Equal(LookupResultKind.MustNotBeInstance, lr.Kind) Assert.True(lr.HasDiagnostic) 'error BC30469: Reference to a non-shared member requires an object reference. lr = New LookupResult() - context.LookupMember(lr, classA, "FooInstance", 0, LookupOptions.MustBeInstance, Nothing) + context.LookupMember(lr, classA, "GooInstance", 0, LookupOptions.MustBeInstance, Nothing) Assert.Equal(1, lr.Symbols.Count) - Assert.Equal(fooInstance, lr.Symbols.Single()) + Assert.Equal(gooInstance, lr.Symbols.Single()) Assert.False(lr.HasDiagnostic) lr = New LookupResult() - context.LookupMember(lr, classA, "FooShared", 0, LookupOptions.MustBeInstance, Nothing) + context.LookupMember(lr, classA, "GooShared", 0, LookupOptions.MustBeInstance, Nothing) Assert.Equal(LookupResultKind.MustBeInstance, lr.Kind) Assert.False(lr.HasDiagnostic) Dim interfaceI = DirectCast(globalNS.GetMembers("I").Single(), NamedTypeSymbol) - Dim ifooInstance = DirectCast(interfaceI.GetMembers("FooInstance").Single(), MethodSymbol) + Dim ifooInstance = DirectCast(interfaceI.GetMembers("GooInstance").Single(), MethodSymbol) lr = New LookupResult() - context.LookupMember(lr, interfaceI, "FooInstance", 0, LookupOptions.MustBeInstance, Nothing) + context.LookupMember(lr, interfaceI, "GooInstance", 0, LookupOptions.MustBeInstance, Nothing) Assert.Equal(1, lr.Symbols.Count) Assert.Equal(ifooInstance, lr.Symbols.Single()) Assert.False(lr.HasDiagnostic) @@ -1554,21 +1554,21 @@ End Module Option Strict On Interface I - Class Foo + Class Goo Shared Sub Boo() End Sub End Class End Interface Class D - Sub Foo() + Sub Goo() End Sub Interface I2 Inherits I - Shadows Class Foo(Of T) + Shadows Class Goo(Of T) End Class Class C Sub Bar() - Foo.Boo() + Goo.Boo() End Sub End Class End Interface diff --git a/src/Compilers/VisualBasic/Test/Semantic/Binding/MethodBodyBindingTests.vb b/src/Compilers/VisualBasic/Test/Semantic/Binding/MethodBodyBindingTests.vb index b43e05e1ec7dd..8df03312e7bd8 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/Binding/MethodBodyBindingTests.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/Binding/MethodBodyBindingTests.vb @@ -45,7 +45,7 @@ Namespace N dim a as double end while else - Dim y As String = "foo" + Dim y As String = "goo" end if Return Nothing End Function @@ -149,13 +149,13 @@ End Namespace Module M Sub Main() - Foo() + Goo() End Sub - Sub Foo() - Dim foo as Integer - Foo = 4273 - System.Console.WriteLine(Foo) + Sub Goo() + Dim goo as Integer + Goo = 4273 + System.Console.WriteLine(Goo) End Sub End Module diff --git a/src/Compilers/VisualBasic/Test/Semantic/Binding/SyncLockTests.vb b/src/Compilers/VisualBasic/Test/Semantic/Binding/SyncLockTests.vb index abad7bbd5c4fc..29ff20cd3f622 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/Binding/SyncLockTests.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/Binding/SyncLockTests.vb @@ -50,7 +50,7 @@ Class Program SyncLock x End SyncLock End Sub - Private Shared Sub Foo(Of T As D)(x As T) + Private Shared Sub Goo(Of T As D)(x As T) SyncLock x End SyncLock End Sub @@ -212,7 +212,7 @@ End Module Structure S1 - Sub FOO() + Sub GOO() SyncLock Me End SyncLock End Sub @@ -243,7 +243,7 @@ End Class Public Class D - Public Sub foo() + Public Sub goo() Dim x1, x2 As New Object SyncLock x1,x2 End SyncLock @@ -268,7 +268,7 @@ End Class Public Class D - Public Sub foo() + Public Sub goo() SyncLock End SyncLock SyncLock SyncLock diff --git a/src/Compilers/VisualBasic/Test/Semantic/Binding/UsingTests.vb b/src/Compilers/VisualBasic/Test/Semantic/Binding/UsingTests.vb index 6df1fe8a9cac2..36c98c68812de 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/Binding/UsingTests.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/Binding/UsingTests.vb @@ -31,7 +31,7 @@ End Class Class C1 Public Shared Sub Main() - Using foo As New MyDisposable() + Using goo As New MyDisposable() Console.WriteLine("Inside Using.") End Using End Sub @@ -46,7 +46,7 @@ Inside Using. { // Code size 29 (0x1d) .maxstack 1 - .locals init (MyDisposable V_0) //foo + .locals init (MyDisposable V_0) //goo IL_0000: newobj "Sub MyDisposable..ctor()" IL_0005: stloc.0 .try @@ -88,7 +88,7 @@ End Class Class C1 Public Shared Sub Main() - Using foo As New MyDisposable(), foo2 as New MyDisposable() + Using goo As New MyDisposable(), goo2 as New MyDisposable() Console.WriteLine("Inside Using.") End Using End Sub @@ -103,8 +103,8 @@ Inside Using. { // Code size 45 (0x2d) .maxstack 1 - .locals init (MyDisposable V_0, //foo - MyDisposable V_1) //foo2 + .locals init (MyDisposable V_0, //goo + MyDisposable V_1) //goo2 IL_0000: newobj "Sub MyDisposable..ctor()" IL_0005: stloc.0 .try @@ -159,7 +159,7 @@ End Class Class C1 Public Shared Sub Main() - Using foo, foo2 As New MyDisposable(), foo3, foo4 As New MyDisposable() + Using goo, goo2 As New MyDisposable(), goo3, goo4 As New MyDisposable() Console.WriteLine("Inside Using.") End Using End Sub @@ -174,10 +174,10 @@ Inside Using. { // Code size 77 (0x4d) .maxstack 1 - .locals init (MyDisposable V_0, //foo - MyDisposable V_1, //foo2 - MyDisposable V_2, //foo3 - MyDisposable V_3) //foo4 + .locals init (MyDisposable V_0, //goo + MyDisposable V_1, //goo2 + MyDisposable V_2, //goo3 + MyDisposable V_3) //goo4 IL_0000: newobj "Sub MyDisposable..ctor()" IL_0005: stloc.0 .try @@ -258,7 +258,7 @@ End Class Class C1 Public Shared Sub Main() - Using foo As MyDisposable = new MyDisposable(), foo2 as MyDisposable = New MyDisposable() + Using goo As MyDisposable = new MyDisposable(), goo2 as MyDisposable = New MyDisposable() Console.WriteLine("Inside Using.") End Using End Sub @@ -273,8 +273,8 @@ Inside Using. { // Code size 45 (0x2d) .maxstack 1 - .locals init (MyDisposable V_0, //foo - MyDisposable V_1) //foo2 + .locals init (MyDisposable V_0, //goo + MyDisposable V_1) //goo2 IL_0000: newobj "Sub MyDisposable..ctor()" IL_0005: stloc.0 .try @@ -494,7 +494,7 @@ Class C1 End Property Public Sub DoStuff() - Using foo As IDisposable = ADisposable + Using goo As IDisposable = ADisposable Console.WriteLine("Inside Using.") End Using End Sub @@ -636,11 +636,11 @@ End Class Class C1 Public Shared Sub Main() - Using foo = New MyDisposable() + Using goo = New MyDisposable() Console.WriteLine("Inside Using.") End Using - Using foo2 = New Integer() + Using goo2 = New Integer() Console.WriteLine("Inside Using.") End Using End Sub @@ -651,7 +651,7 @@ End Class Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) AssertTheseDiagnostics(compilation, BC36010: 'Using' operand of type 'Integer' must implement 'System.IDisposable'. - Using foo2 = New Integer() + Using goo2 = New Integer() ~~~~~~~~~~~~~~~~~~~~ ) End Sub @@ -676,8 +676,8 @@ End Class Class C1 Public Shared Sub Main() - foo = New MyDisposable() ' not type inference means this is an object - Using foo + goo = New MyDisposable() ' not type inference means this is an object + Using goo Console.WriteLine("Inside Using.") End Using End Sub @@ -688,7 +688,7 @@ End Class Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) AssertTheseDiagnostics(compilation, BC36010: 'Using' operand of type 'Object' must implement 'System.IDisposable'. - Using foo + Using goo ~~~ ) End Sub @@ -752,7 +752,7 @@ Imports System Structure MyDisposable Implements IDisposable - Public Foo As Integer + Public Goo As Integer Public Sub Dispose() Implements IDisposable.Dispose End Sub @@ -838,7 +838,7 @@ End Class Class C1 Public Shared Sub Main() - Using foo = New MyDisposable("foo"), foo2 = foo.Other + Using goo = New MyDisposable("goo"), goo2 = goo.Other Console.WriteLine("Inside Using.") End Using End Sub @@ -850,7 +850,7 @@ End Class expectedOutput:=) End Sub @@ -889,7 +889,7 @@ End Class Class C1 Public Shared Sub Main() - Using beforefoo = foo, foo = New MyDisposable("foo"), foo2 = foo.Other + Using beforefoo = goo, goo = New MyDisposable("goo"), goo2 = goo.Other Console.WriteLine("Inside Using.") End Using End Sub @@ -899,8 +899,8 @@ End Class Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) AssertTheseDiagnostics(compilation, -BC32000: Local variable 'foo' cannot be referred to before it is declared. - Using beforefoo = foo, foo = New MyDisposable("foo"), foo2 = foo.Other +BC32000: Local variable 'goo' cannot be referred to before it is declared. + Using beforefoo = goo, goo = New MyDisposable("goo"), goo2 = goo.Other ~~~ ) End Sub @@ -918,7 +918,7 @@ Imports System Class C1 Public Shared Sub Main() - Using foo As IDisposable = nothing + Using goo As IDisposable = nothing Console.WriteLine("Inside Using.") End Using End Sub @@ -933,7 +933,7 @@ Inside Using. { // Code size 25 (0x19) .maxstack 1 - .locals init (System.IDisposable V_0) //foo + .locals init (System.IDisposable V_0) //goo IL_0000: ldnull IL_0001: stloc.0 .try @@ -1099,7 +1099,7 @@ Structure cls1 Sub New(ByRef x As cls1) x = Me End Sub - Sub foo() + Sub goo() Do Dim x As New cls1 Using x @@ -1120,7 +1120,7 @@ Structure cls1 End Sub Shared Sub Main() Dim x = New cls1() - x.foo() + x.goo() End Sub End Structure @@ -1152,9 +1152,9 @@ Class C1 Using o1.GetBoxedInstance End Using Dim o2 As Object = New cls1 - foo(o2) + goo(o2) End Sub - Sub foo(ByVal o As Object) + Sub goo(ByVal o As Object) Using o.GetBoxedInstance End Using End Sub @@ -1203,7 +1203,7 @@ End Structure Imports System Module Program Dim mnObj As MyManagedClass - Sub FOO() + Sub GOO() Dim obj1 As New MyManagedClass Dim obj1a As New MyManagedClass Dim obj1b As MyManagedClass = obj1 @@ -1317,7 +1317,7 @@ Imports System.Collections.Generic Class Program Shared Sub Main() Dim objs = GetList() - Using x As MyManagedClass = (From y In objs Select y).First, foo3, foo4 = x + Using x As MyManagedClass = (From y In objs Select y).First, goo3, goo4 = x End Using End Sub Shared Function GetList() As List(Of MyManagedClass) @@ -1335,10 +1335,10 @@ End Class ) VerifyDiagnostics(compilation1, Diagnostic(ERRID.ERR_ExpectedQueryableSource, "objs").WithArguments("System.Collections.Generic.List(Of MyManagedClass)"), - Diagnostic(ERRID.ERR_InitWithMultipleDeclarators, "foo3, foo4 = x"), - Diagnostic(ERRID.ERR_StrictDisallowImplicitObject, "foo3"), - Diagnostic(ERRID.ERR_UsingResourceVarNeedsInitializer, "foo3"), - Diagnostic(ERRID.ERR_UsingRequiresDisposePattern, "foo3").WithArguments("Object")) + Diagnostic(ERRID.ERR_InitWithMultipleDeclarators, "goo3, goo4 = x"), + Diagnostic(ERRID.ERR_StrictDisallowImplicitObject, "goo3"), + Diagnostic(ERRID.ERR_UsingResourceVarNeedsInitializer, "goo3"), + Diagnostic(ERRID.ERR_UsingRequiresDisposePattern, "goo3").WithArguments("Object")) End Sub @@ -1355,7 +1355,7 @@ Imports System.Collections.Generic Class Program Shared Sub Main() Dim objs = GetList() - Using foo As MyManagedClass = New MyManagedClass(), foo3, foo4 As New MyManagedClass() + Using goo As MyManagedClass = New MyManagedClass(), goo3, goo4 As New MyManagedClass() Console.WriteLine("Inside Using.") End Using End Sub @@ -1481,7 +1481,7 @@ Option Strict On Imports System Delegate Function D1(Of T)(t As T) As T Class A1 - Private Shared Sub Foo(Of T As IDisposable)(x As T) + Private Shared Sub Goo(Of T As IDisposable)(x As T) Dim local As T = x Using t1 As T = DirectCast(Function(tt As T) x, D1(Of T))(x) ' warning End Using @@ -1552,7 +1552,7 @@ Imports System Class Program Shared Sub Main() Dim x = 1 - Using foo, foo2 As New MyManagedClass(x), foo3, foo4 As New MyManagedClass(x) + Using goo, goo2 As New MyManagedClass(x), goo3, goo4 As New MyManagedClass(x) Console.WriteLine("Inside Using.") End Using End Sub @@ -1619,7 +1619,7 @@ Imports System.Collections.Generic Class Program Shared Sub Main() Dim objs = GetList() - Using x As MyManagedClass = (From y In objs Select y).First, foo3, foo4 = x + Using x As MyManagedClass = (From y In objs Select y).First, goo3, goo4 = x End Using End Sub Shared Function GetList() As List(Of MyManagedClass) @@ -1637,10 +1637,10 @@ End Class ) VerifyDiagnostics(compilation1, Diagnostic(ERRID.ERR_ExpectedQueryableSource, "objs").WithArguments("System.Collections.Generic.List(Of MyManagedClass)"), - Diagnostic(ERRID.ERR_InitWithMultipleDeclarators, "foo3, foo4 = x"), - Diagnostic(ERRID.ERR_StrictDisallowImplicitObject, "foo3"), - Diagnostic(ERRID.ERR_UsingResourceVarNeedsInitializer, "foo3"), - Diagnostic(ERRID.ERR_UsingRequiresDisposePattern, "foo3").WithArguments("Object")) + Diagnostic(ERRID.ERR_InitWithMultipleDeclarators, "goo3, goo4 = x"), + Diagnostic(ERRID.ERR_StrictDisallowImplicitObject, "goo3"), + Diagnostic(ERRID.ERR_UsingResourceVarNeedsInitializer, "goo3"), + Diagnostic(ERRID.ERR_UsingRequiresDisposePattern, "goo3").WithArguments("Object")) End Sub diff --git a/src/Compilers/VisualBasic/Test/Semantic/Compilation/CompilationAPITests.vb b/src/Compilers/VisualBasic/Test/Semantic/Compilation/CompilationAPITests.vb index 5c25c3217506c..634f297731321 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/Compilation/CompilationAPITests.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/Compilation/CompilationAPITests.vb @@ -48,16 +48,16 @@ BC37257: Option 'CryptoKeyFile' must be an absolute path. Public Sub CompilationName() ' report an error, rather then silently ignoring the directory ' (see cli partition II 22.30) - VisualBasicCompilation.Create("C:/foo/Test.exe").AssertTheseEmitDiagnostics( + VisualBasicCompilation.Create("C:/goo/Test.exe").AssertTheseEmitDiagnostics( -BC30420: 'Sub Main' was not found in 'C:/foo/Test.exe'. +BC30420: 'Sub Main' was not found in 'C:/goo/Test.exe'. BC37283: Invalid assembly name: Name contains invalid characters. ) - VisualBasicCompilation.Create("C:\foo\Test.exe", options:=TestOptions.ReleaseDll).AssertTheseDeclarationDiagnostics( + VisualBasicCompilation.Create("C:\goo\Test.exe", options:=TestOptions.ReleaseDll).AssertTheseDeclarationDiagnostics( BC37283: Invalid assembly name: Name contains invalid characters. ) - VisualBasicCompilation.Create("\foo/Test.exe", options:=TestOptions.ReleaseDll).AssertTheseEmitDiagnostics( + VisualBasicCompilation.Create("\goo/Test.exe", options:=TestOptions.ReleaseDll).AssertTheseEmitDiagnostics( BC37283: Invalid assembly name: Name contains invalid characters. ) @@ -92,9 +92,9 @@ BC37283: Invalid assembly name: Name contains invalid characters. ' other characters than directory separators are ok: VisualBasicCompilation.Create(";,*?<>#!@&", options:=TestOptions.ReleaseDll).AssertTheseEmitDiagnostics() - VisualBasicCompilation.Create("foo", options:=TestOptions.ReleaseDll).AssertTheseEmitDiagnostics() - VisualBasicCompilation.Create(".foo", options:=TestOptions.ReleaseDll).AssertTheseEmitDiagnostics() - VisualBasicCompilation.Create("foo ", options:=TestOptions.ReleaseDll).AssertTheseEmitDiagnostics() ' can end with whitespace + VisualBasicCompilation.Create("goo", options:=TestOptions.ReleaseDll).AssertTheseEmitDiagnostics() + VisualBasicCompilation.Create(".goo", options:=TestOptions.ReleaseDll).AssertTheseEmitDiagnostics() + VisualBasicCompilation.Create("goo ", options:=TestOptions.ReleaseDll).AssertTheseEmitDiagnostics() ' can end with whitespace VisualBasicCompilation.Create("....", options:=TestOptions.ReleaseDll).AssertTheseEmitDiagnostics() VisualBasicCompilation.Create(Nothing, options:=TestOptions.ReleaseDll).AssertTheseEmitDiagnostics() End Sub @@ -104,7 +104,7 @@ BC37283: Invalid assembly name: Name contains invalid characters. Dim listSyntaxTree = New List(Of SyntaxTree) Dim listRef = New List(Of MetadataReference) - Dim s1 = "using Foo" + Dim s1 = "using Goo" Dim t1 As SyntaxTree = VisualBasicSyntaxTree.ParseText(s1) listSyntaxTree.Add(t1) @@ -438,7 +438,7 @@ End Namespace Public Sub SyntreeAPITest() Dim s1 = "using System.Linq;" - Dim s2 = Module Module1 - Sub Foo() + Sub Goo() for i = 0 to 100 next end sub @@ -1199,7 +1199,7 @@ BC37224: Module 'a1.netmodule' is already defined in this assembly. Each module Dim t3 = t2 Dim csComp = CS.CSharpCompilation.Create("CompilationVB") - csComp = csComp.AddSyntaxTrees(t1, CS.SyntaxFactory.ParseSyntaxTree("Imports Foo")) + csComp = csComp.AddSyntaxTrees(t1, CS.SyntaxFactory.ParseSyntaxTree("Imports Goo")) ' Throw exception when cast SyntaxTree For Each item In csComp.SyntaxTrees t3 = item @@ -1226,9 +1226,9 @@ BC2014: the value 'From()' is invalid for option 'RootNamespace' BC2014: the value 'x$' is invalid for option 'RootNamespace' ) - AssertTheseDiagnostics(TestOptions.ReleaseExe.WithRootNamespace("Foo.").Errors, + AssertTheseDiagnostics(TestOptions.ReleaseExe.WithRootNamespace("Goo.").Errors, -BC2014: the value 'Foo.' is invalid for option 'RootNamespace' +BC2014: the value 'Goo.' is invalid for option 'RootNamespace' ) AssertTheseDiagnostics(TestOptions.ReleaseExe.WithRootNamespace("_").Errors, @@ -1783,7 +1783,7 @@ End Class Dim ta = Parse("Imports System") Dim tb = Parse("Imports System", options:=TestOptions.Script) Dim tc = Parse("#r ""bar"" ' error: #r in regular code") - Dim tr = Parse("#r ""foo""", options:=TestOptions.Script) + Dim tr = Parse("#r ""goo""", options:=TestOptions.Script) Dim ts = Parse("#r ""bar""", options:=TestOptions.Script) Dim a = VisualBasicCompilation.Create("c", syntaxTrees:={ta}) @@ -1892,7 +1892,7 @@ End Class Dim pinnedPEImage = GCHandle.Alloc(moduleBytes.ToArray(), GCHandleType.Pinned) Try Using mdModule = ModuleMetadata.CreateFromMetadata(pinnedPEImage.AddrOfPinnedObject() + headers.MetadataStartOffset, headers.MetadataSize) - Dim c = VisualBasicCompilation.Create("Foo", references:={MscorlibRef, mdModule.GetReference(display:="ModuleCS00")}, options:=TestOptions.ReleaseDll) + Dim c = VisualBasicCompilation.Create("Goo", references:={MscorlibRef, mdModule.GetReference(display:="ModuleCS00")}, options:=TestOptions.ReleaseDll) c.VerifyDiagnostics(Diagnostic(ERRID.ERR_LinkedNetmoduleMetadataMustProvideFullPEImage).WithArguments("ModuleCS00").WithLocation(1, 1)) End Using Finally @@ -2036,8 +2036,8 @@ End Namespace Assert.Throws(Of ArgumentException)(Function() VisualBasicCompilation.CreateScriptCompilation("a", options:=TestOptions.ReleaseDll.WithOutputKind(OutputKind.WindowsRuntimeMetadata))) Assert.Throws(Of ArgumentException)(Function() VisualBasicCompilation.CreateScriptCompilation("a", options:=TestOptions.ReleaseDll.WithOutputKind(OutputKind.WindowsRuntimeApplication))) Assert.Throws(Of ArgumentException)(Function() VisualBasicCompilation.CreateScriptCompilation("a", options:=TestOptions.ReleaseDll.WithOutputKind(OutputKind.WindowsApplication))) - Assert.Throws(Of ArgumentException)(Function() VisualBasicCompilation.CreateScriptCompilation("a", options:=TestOptions.ReleaseDll.WithCryptoKeyContainer("foo"))) - Assert.Throws(Of ArgumentException)(Function() VisualBasicCompilation.CreateScriptCompilation("a", options:=TestOptions.ReleaseDll.WithCryptoKeyFile("foo.snk"))) + Assert.Throws(Of ArgumentException)(Function() VisualBasicCompilation.CreateScriptCompilation("a", options:=TestOptions.ReleaseDll.WithCryptoKeyContainer("goo"))) + Assert.Throws(Of ArgumentException)(Function() VisualBasicCompilation.CreateScriptCompilation("a", options:=TestOptions.ReleaseDll.WithCryptoKeyFile("goo.snk"))) Assert.Throws(Of ArgumentException)(Function() VisualBasicCompilation.CreateScriptCompilation("a", options:=TestOptions.ReleaseDll.WithDelaySign(True))) Assert.Throws(Of ArgumentException)(Function() VisualBasicCompilation.CreateScriptCompilation("a", options:=TestOptions.ReleaseDll.WithDelaySign(False))) End Sub @@ -2056,7 +2056,7 @@ End Namespace ' TestSubmissionResult(CreateSubmission("?1", parseOptions:=TestOptions.Interactive, returnType:=GetType(Double)), expectedType:=SpecialType.System_Double, expectedHasValue:=True) Assert.False(CreateSubmission(" -Sub Foo() +Sub Goo() End Sub ").HasSubmissionResult()) diff --git a/src/Compilers/VisualBasic/Test/Semantic/Compilation/MyTemplateTests.vb b/src/Compilers/VisualBasic/Test/Semantic/Compilation/MyTemplateTests.vb index 722dd6914d361..2f78181a2c4fa 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/Compilation/MyTemplateTests.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/Compilation/MyTemplateTests.vb @@ -277,13 +277,13 @@ Imports System.Collections.Generic Module Module1 Sub Main() - My.Application.Foo()'BIND:"Foo" + My.Application.Goo()'BIND:"Goo" End Sub End Module Namespace My Partial Class MyApplication - Public Function Foo() As Integer + Public Function Goo() As Integer Return 1 End Function End Class @@ -309,7 +309,7 @@ End Namespace Assert.Null(semanticSummary.ConvertedType) Assert.Equal(ConversionKind.Identity, semanticSummary.ImplicitConversion.Kind) - Assert.Equal("Function My.MyApplication.Foo() As System.Int32", semanticSummary.Symbol.ToTestDisplayString()) + Assert.Equal("Function My.MyApplication.Goo() As System.Int32", semanticSummary.Symbol.ToTestDisplayString()) Assert.Equal(SymbolKind.Method, semanticSummary.Symbol.Kind) Assert.Equal(0, semanticSummary.CandidateSymbols.Length) @@ -317,14 +317,14 @@ End Namespace Assert.Equal(1, semanticSummary.MemberGroup.Length) Dim sortedMethodGroup = semanticSummary.MemberGroup.AsEnumerable().OrderBy(Function(s) s.ToTestDisplayString()).ToArray() - Assert.Equal("Function My.MyApplication.Foo() As System.Int32", sortedMethodGroup(0).ToTestDisplayString()) + Assert.Equal("Function My.MyApplication.Goo() As System.Int32", sortedMethodGroup(0).ToTestDisplayString()) Assert.False(semanticSummary.ConstantValue.HasValue) Dim sym = semanticSummary.Symbol Assert.IsType(Of SourceLocation)(sym.Locations(0)) - Assert.Equal("Public Function Foo() As Integer", sym.DeclaringSyntaxReferences(0).GetSyntax().ToString()) + Assert.Equal("Public Function Goo() As Integer", sym.DeclaringSyntaxReferences(0).GetSyntax().ToString()) Dim parent = sym.ContainingType Assert.Equal(1, parent.Locations.OfType(Of SourceLocation).Count) diff --git a/src/Compilers/VisualBasic/Test/Semantic/Compilation/ReferenceManagerTests.vb b/src/Compilers/VisualBasic/Test/Semantic/Compilation/ReferenceManagerTests.vb index 375f0fa4d3adf..67bd247426024 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/Compilation/ReferenceManagerTests.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/Compilation/ReferenceManagerTests.vb @@ -459,7 +459,7 @@ Imports System.Collections.Generic Public Class R Public Dictionary(Of A, B) Dict = New Dictionary(Of A, B)() - Public Sub Foo(a As A, b As B) + Public Sub Goo(a As A, b As B) End Sub End Class ]]> @@ -478,7 +478,7 @@ Public Class M Public Sub F() Dim r = New R() System.Console.WriteLine(r.Dict) ' 2 errors - r.Foo(Nothing, Nothing) ' 2 errors + r.Goo(Nothing, Nothing) ' 2 errors End Sub End Class ]]> @@ -489,7 +489,7 @@ End Class main.VerifyDiagnostics( Diagnostic(ERRID.ERR_NameNotMember2, "r.Dict").WithArguments("Dict", "R"), - Diagnostic(ERRID.ERR_SxSIndirectRefHigherThanDirectRef3, "r.Foo(Nothing, Nothing)").WithArguments("B", "2.0.0.0", "1.0.0.0")) + Diagnostic(ERRID.ERR_SxSIndirectRefHigherThanDirectRef3, "r.Goo(Nothing, Nothing)").WithArguments("B", "2.0.0.0", "1.0.0.0")) End Sub @@ -1024,7 +1024,7 @@ Public Class B Inherits A End Class -Public Class Foo +Public Class Goo End Class @@ -1038,7 +1038,7 @@ End Class Public Class A - Public x As Foo = New Foo() + Public x As Goo = New Goo() End Class @@ -1067,7 +1067,7 @@ End Class GC.KeepAlive(symbolA2) - ' Recompile "B" and remove int Foo. The assembly manager should not reuse symbols for A since they are referring to old version of B. + ' Recompile "B" and remove int Goo. The assembly manager should not reuse symbols for A since they are referring to old version of B. Dim sourceB2 = @@ -1084,11 +1084,11 @@ End Class Dim b2 = CreateCompilationWithMscorlibAndReferences(sourceB2, {refA2}) ' TODO (tomat): Dev11 reports error: - ' error BC30652: Reference required to assembly 'b, Version=1.0.0.0, Culture=neutral, PublicKeyToken = null' containing the type 'Foo'. Add one to your project. + ' error BC30652: Reference required to assembly 'b, Version=1.0.0.0, Culture=neutral, PublicKeyToken = null' containing the type 'Goo'. Add one to your project. AssertTheseDiagnostics(b2, -BC31091: Import of type 'Foo' from assembly or module 'B.dll' failed. +BC31091: Import of type 'Goo' from assembly or module 'B.dll' failed. Dim objX As Object = Me.x ~~~~ ) @@ -1590,7 +1590,7 @@ Public Class B Inherits A End Class -Public Class Foo +Public Class Goo End Class diff --git a/src/Compilers/VisualBasic/Test/Semantic/Compilation/SemanticModelAPITests.vb b/src/Compilers/VisualBasic/Test/Semantic/Compilation/SemanticModelAPITests.vb index 6baeec82b3bdd..20b56b8312bd1 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/Compilation/SemanticModelAPITests.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/Compilation/SemanticModelAPITests.vb @@ -295,7 +295,7 @@ Imports System Class B Public f1 as Integer - Public Sub foo(x as Object) + Public Sub goo(x as Object) End Sub End Class @@ -397,7 +397,7 @@ Class C Class E End Class - Sub Foo(Of O)() + Sub Goo(Of O)() End Sub <Serializable> Private i As Integer @@ -446,7 +446,7 @@ End Class Assert.Equal(0, symbolInfo.CandidateSymbols.Length) Assert.Equal("Sub C.DAttribute..ctor()", symbolInfo.Symbol.ToTestDisplayString()) - Dim position3 = CompilationUtils.FindPositionFromText(tree, "Sub Foo") + Dim position3 = CompilationUtils.FindPositionFromText(tree, "Sub Goo") Dim attr6 = ParseAttributeSyntax("") symbolInfo = semanticModel.GetSpeculativeSymbolInfo(position2, attr6) Assert.NotNull(symbolInfo.Symbol) @@ -1194,7 +1194,7 @@ Class C Class E End Class - Sub Foo(Of O)() + Sub Goo(Of O)() End Sub <Serializable> Private i As Integer @@ -1284,7 +1284,7 @@ End Class Assert.Equal(0, symbolInfo.CandidateSymbols.Length) Assert.Equal("Sub C.DAttribute..ctor()", symbolInfo.Symbol.ToTestDisplayString()) - Dim position3 = CompilationUtils.FindPositionFromText(tree, "Sub Foo") + Dim position3 = CompilationUtils.FindPositionFromText(tree, "Sub Goo") Dim attr6 = ParseAttributeSyntax("") success = parentModel.TryGetSpeculativeSemanticModel(position2, attr6, speculativeModel) @@ -1355,14 +1355,14 @@ Imports System.Collections.Generic Imports System.Linq Class A - Public Function Foo() As String - Return "Foo" + Public Function Goo() As String + Return "Goo" End Function End Class Module Program Public Sub Main(a As A) - Dim x = a.Foo() + Dim x = a.Goo() End Sub End Module ]]> @@ -1370,9 +1370,9 @@ End Module Dim tree As SyntaxTree = (From t In compilation.SyntaxTrees Where t.FilePath = "a.vb").Single() Dim semanticModel = compilation.GetSemanticModel(tree) - Dim position As Integer = CompilationUtils.FindPositionFromText(tree, "x = a.Foo()") + Dim position As Integer = CompilationUtils.FindPositionFromText(tree, "x = a.Goo()") Dim localDecl = tree.GetRoot().DescendantNodes().OfType(Of LocalDeclarationStatementSyntax)().Single() - Dim parsedInvocation = SyntaxFactory.ParseExpression("a.Foo()") + Dim parsedInvocation = SyntaxFactory.ParseExpression("a.Goo()") Dim newLocalDecl = DirectCast(localDecl.ReplaceNode(localDecl.Declarators(0).Initializer.Value, parsedInvocation), LocalDeclarationStatementSyntax) Dim newInitializer = DirectCast(newLocalDecl.Declarators(0).Initializer.Value, InvocationExpressionSyntax) @@ -1384,7 +1384,7 @@ End Module Dim memberAccess = DirectCast(newInitializer.Expression, MemberAccessExpressionSyntax) Dim symbolInfo = speculativeModel.GetSymbolInfo(memberAccess.Name) Assert.NotNull(symbolInfo.Symbol) - Assert.Equal("Foo", symbolInfo.Symbol.Name) + Assert.Equal("Goo", symbolInfo.Symbol.Name) End Sub @@ -1947,7 +1947,7 @@ Module M Namespace A Class B Function S() - Dim c = Me.foo + Dim c = Me.goo ) @@ -1958,11 +1958,11 @@ Module M Dim typeBlockSyntax = DirectCast(namespaceBlock.Members(0), TypeBlockSyntax) Dim methodBlockSyntax = DirectCast(typeBlockSyntax.Members(0), MethodBlockSyntax) Dim statementSyntax = DirectCast(methodBlockSyntax.Statements(0), LocalDeclarationStatementSyntax) - Dim initializer = statementSyntax.DescendantNodes().Single(Function(n) n.ToString() = "Me.foo") + Dim initializer = statementSyntax.DescendantNodes().Single(Function(n) n.ToString() = "Me.goo") Dim position = statementSyntax.SpanStart Dim model = compilation.GetSemanticModel(tree) - Dim speculatedExpression = DirectCast(SyntaxFactory.ParseExpression("foo"), ExpressionSyntax) + Dim speculatedExpression = DirectCast(SyntaxFactory.ParseExpression("goo"), ExpressionSyntax) Dim speculatedStatement = statementSyntax.ReplaceNode(initializer, speculatedExpression) Dim speculativeModel As SemanticModel = Nothing @@ -1982,7 +1982,7 @@ Module M Namespace A Class B Function S() - Dim c = Me.foo + Dim c = Me.goo ) @@ -1993,11 +1993,11 @@ Module M Dim typeBlockSyntax = DirectCast(namespaceBlock.Members(0), TypeBlockSyntax) Dim methodBlockSyntax = DirectCast(typeBlockSyntax.Members(0), MethodBlockSyntax) Dim statementSyntax = DirectCast(methodBlockSyntax.Statements(0), LocalDeclarationStatementSyntax) - Dim initializer = statementSyntax.DescendantNodes().Single(Function(n) n.ToString() = "Me.foo") + Dim initializer = statementSyntax.DescendantNodes().Single(Function(n) n.ToString() = "Me.goo") Dim position = statementSyntax.SpanStart Dim model = compilation.GetSemanticModel(tree) - Dim speculatedExpression = DirectCast(SyntaxFactory.ParseExpression("foo"), ExpressionSyntax) + Dim speculatedExpression = DirectCast(SyntaxFactory.ParseExpression("goo"), ExpressionSyntax) Dim speculatedStatement = statementSyntax.ReplaceNode(initializer, speculatedExpression) Dim speculativeModel As SemanticModel = Nothing @@ -2251,7 +2251,7 @@ Module M End Enum Class AAA - Public Sub Foo() + Public Sub Goo() anInt = 0 anInt = 14 anObj = Nothing @@ -2851,7 +2851,7 @@ End Module ) @@ -3744,16 +3744,16 @@ Public Module M End Select End Sub - Sub Foo1(Of t)(x As t) + Sub Goo1(Of t)(x As t) End Sub - Sub Foo2(Of t)(x As t) + Sub Goo2(Of t)(x As t) End Sub - Sub Foo3(Of t As New)(x As t) + Sub Goo3(Of t As New)(x As t) End Sub - Sub Foo4(Of t As New)(x As t) + Sub Goo4(Of t As New)(x As t) End Sub Function A(Of t)() As Integer @@ -3764,16 +3764,16 @@ Public Module M End Module Class C1 - Sub Foo1(Of t)(x As t) + Sub Goo1(Of t)(x As t) End Sub - Sub Foo2(Of t)(x As t) + Sub Goo2(Of t)(x As t) End Sub - Sub Foo3(Of t As New)(x As t) + Sub Goo3(Of t As New)(x As t) End Sub - Sub Foo4(Of t As Structure)(x As t) + Sub Goo4(Of t As Structure)(x As t) End Sub Function A(Of t)() As t @@ -3784,10 +3784,10 @@ Class C1 End Class Class C2 - Sub Foo1(Of t)(x As t) + Sub Goo1(Of t)(x As t) End Sub - Sub Foo3(Of t As New)(x As t) + Sub Goo3(Of t As New)(x As t) End Sub Function A(Of t)() As Integer @@ -3814,26 +3814,26 @@ End Class Symbol.HaveSameSignatureAndConstraintsAndReturnType(methodMember1, methodMember2) Dim globalNS = compilation.GlobalNamespace - methodMember1 = CType(DirectCast(globalNS.GetMembers("M").Single(), NamedTypeSymbol).GetMember("Foo1"), MethodSymbol) - methodMember2 = CType(DirectCast(globalNS.GetMembers("M").Single(), NamedTypeSymbol).GetMember("Foo2"), MethodSymbol) - methodMember3 = CType(DirectCast(globalNS.GetMembers("C1").Single(), NamedTypeSymbol).GetMember("Foo1"), MethodSymbol) + methodMember1 = CType(DirectCast(globalNS.GetMembers("M").Single(), NamedTypeSymbol).GetMember("Goo1"), MethodSymbol) + methodMember2 = CType(DirectCast(globalNS.GetMembers("M").Single(), NamedTypeSymbol).GetMember("Goo2"), MethodSymbol) + methodMember3 = CType(DirectCast(globalNS.GetMembers("C1").Single(), NamedTypeSymbol).GetMember("Goo1"), MethodSymbol) Assert.False(Symbol.HaveSameSignature(methodMember1, methodMember2)) Assert.True(Symbol.HaveSameSignature(methodMember1, methodMember1)) Assert.True(Symbol.HaveSameSignature(methodMember1, methodMember3)) - Assert.True(Symbol.HaveSameSignature(CType(DirectCast(globalNS.GetMembers("C2").Single(), NamedTypeSymbol).GetMember("Foo1"), MethodSymbol), methodMember3)) + Assert.True(Symbol.HaveSameSignature(CType(DirectCast(globalNS.GetMembers("C2").Single(), NamedTypeSymbol).GetMember("Goo1"), MethodSymbol), methodMember3)) - methodMember2 = CType(DirectCast(globalNS.GetMembers("C1").Single(), NamedTypeSymbol).GetMember("Foo3"), MethodSymbol) - methodMember3 = CType(DirectCast(globalNS.GetMembers("C2").Single(), NamedTypeSymbol).GetMember("Foo3"), MethodSymbol) + methodMember2 = CType(DirectCast(globalNS.GetMembers("C1").Single(), NamedTypeSymbol).GetMember("Goo3"), MethodSymbol) + methodMember3 = CType(DirectCast(globalNS.GetMembers("C2").Single(), NamedTypeSymbol).GetMember("Goo3"), MethodSymbol) Assert.False(Symbol.HaveSameSignatureAndConstraintsAndReturnType(methodMember1, methodMember2)) Assert.True(Symbol.HaveSameSignatureAndConstraintsAndReturnType(methodMember2, methodMember2)) Assert.True(Symbol.HaveSameSignatureAndConstraintsAndReturnType(methodMember2, methodMember3)) - methodMember1 = CType(DirectCast(globalNS.GetMembers("C1").Single(), NamedTypeSymbol).GetMember("Foo3"), MethodSymbol) - methodMember2 = CType(DirectCast(globalNS.GetMembers("C2").Single(), NamedTypeSymbol).GetMember("Foo3"), MethodSymbol) + methodMember1 = CType(DirectCast(globalNS.GetMembers("C1").Single(), NamedTypeSymbol).GetMember("Goo3"), MethodSymbol) + methodMember2 = CType(DirectCast(globalNS.GetMembers("C2").Single(), NamedTypeSymbol).GetMember("Goo3"), MethodSymbol) Assert.True(Symbol.HaveSameSignatureAndConstraintsAndReturnType(methodMember1, methodMember2)) - methodMember1 = CType(DirectCast(globalNS.GetMembers("M").Single(), NamedTypeSymbol).GetMember("Foo4"), MethodSymbol) - methodMember3 = CType(DirectCast(globalNS.GetMembers("C1").Single(), NamedTypeSymbol).GetMember("Foo4"), MethodSymbol) + methodMember1 = CType(DirectCast(globalNS.GetMembers("M").Single(), NamedTypeSymbol).GetMember("Goo4"), MethodSymbol) + methodMember3 = CType(DirectCast(globalNS.GetMembers("C1").Single(), NamedTypeSymbol).GetMember("Goo4"), MethodSymbol) Assert.False(Symbol.HaveSameSignatureAndConstraintsAndReturnType(methodMember1, methodMember3)) methodMember1 = CType(DirectCast(globalNS.GetMembers("M").Single(), NamedTypeSymbol).GetMember("A"), MethodSymbol) @@ -4183,7 +4183,7 @@ BC30002: Type 'A' is not defined. 'Global namespace as part of namespace specified but no match on root namespace Dim sourceWithGlobalAsStartOfNamespace = Namespace MyNS2 End Namespace -Sub foo() +Sub goo() End Sub @@ -69,7 +69,7 @@ End Sub Dim memberSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType(Of MethodStatementSyntax)().First() Dim symbol1 = model1.GetDeclaredSymbol(memberSyntax) Assert.NotNull(symbol1) - Assert.Equal("foo", symbol1.Name) + Assert.Equal("goo", symbol1.Name) End Sub @@ -79,7 +79,7 @@ End Sub Namespace MyNS2 -Sub foo() +Sub goo() End Sub End Namespace @@ -91,7 +91,7 @@ End Namespace Dim memberSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType(Of MethodStatementSyntax)().First() Dim symbol1 = model1.GetDeclaredSymbol(memberSyntax) - Assert.Equal("foo", symbol1.Name) + Assert.Equal("goo", symbol1.Name) End Sub @@ -101,7 +101,7 @@ End Namespace Namespace MyNS2 -Sub foo() +Sub goo() End Sub End Namespace @@ -113,7 +113,7 @@ End Namespace Dim memberSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType(Of MethodStatementSyntax)().First() Dim symbol1 = model1.GetDeclaredSymbol(memberSyntax) - Assert.Equal("foo", symbol1.Name) + Assert.Equal("goo", symbol1.Name) End Sub @@ -568,7 +568,7 @@ End Class Public Sub TestGetDeclaredSymbolFromTypeDeclaration() - Dim options = TestOptions.ReleaseDll.WithRootNamespace("Foo.Bar") + Dim options = TestOptions.ReleaseDll.WithRootNamespace("Goo.Bar") Dim compilation = CompilationUtils.CreateCompilationWithMscorlib( @@ -629,22 +629,22 @@ End Class , options) Dim expectedErrors = -BC30179: class 'Q' and structure 'Q' conflict in namespace 'Foo.Bar.N1.N2'. +BC30179: class 'Q' and structure 'Q' conflict in namespace 'Goo.Bar.N1.N2'. public partial class Q'first ~ -BC30179: class 'Q' and structure 'Q' conflict in namespace 'Foo.Bar.N1.N2'. +BC30179: class 'Q' and structure 'Q' conflict in namespace 'Goo.Bar.N1.N2'. public class Q'second ~ -BC30179: structure 'Q' and class 'Q' conflict in namespace 'Foo.Bar.N1.N2'. +BC30179: structure 'Q' and class 'Q' conflict in namespace 'Goo.Bar.N1.N2'. public structure Q'third ~ -BC30179: interface 'Q' and class 'Q' conflict in namespace 'Foo.Bar.N1.N2'. +BC30179: interface 'Q' and class 'Q' conflict in namespace 'Goo.Bar.N1.N2'. Public Interface Q ~ BC30481: 'Class' statement must end with a matching 'End Class'. Class N1'class ~~~~~~~~ -BC30179: class 'N1' and namespace 'N1' conflict in namespace 'Foo.Bar'. +BC30179: class 'N1' and namespace 'N1' conflict in namespace 'Goo.Bar'. Class N1'class ~~ BC30618: 'Namespace' statements can occur only at file or namespace level. @@ -668,33 +668,33 @@ BC30460: 'End Class' must be preceded by a matching 'Class'. typeSymbol = CompilationUtils.GetTypeSymbol(compilation, bindingsA, "a.vb", "C1") Assert.NotNull(typeSymbol) - Assert.Equal("Foo.Bar.N1.C1", typeSymbol.ToTestDisplayString()) + Assert.Equal("Goo.Bar.N1.C1", typeSymbol.ToTestDisplayString()) typeSymbol = CompilationUtils.GetTypeSymbol(compilation, bindingsA, "a.vb", "C2") Assert.NotNull(typeSymbol) - Assert.Equal("Foo.Bar.N1.N2.C2", typeSymbol.ToTestDisplayString()) + Assert.Equal("Goo.Bar.N1.N2.C2", typeSymbol.ToTestDisplayString()) typeSymbol2 = CompilationUtils.GetTypeSymbol(compilation, bindingsB, "b.vb", "C2") Assert.NotNull(typeSymbol2) - Assert.Equal("Foo.Bar.N1.N2.C2", typeSymbol2.ToTestDisplayString()) + Assert.Equal("Goo.Bar.N1.N2.C2", typeSymbol2.ToTestDisplayString()) Assert.Equal(typeSymbol, typeSymbol2) typeSymbol = CompilationUtils.GetTypeSymbol(compilation, bindingsA, "a.vb", "Q'first") Assert.NotNull(typeSymbol) - Assert.Equal("Foo.Bar.N1.N2.Q", typeSymbol.ToTestDisplayString()) + Assert.Equal("Goo.Bar.N1.N2.Q", typeSymbol.ToTestDisplayString()) Assert.Equal(0, typeSymbol.Arity) Assert.Equal(TypeKind.Class, typeSymbol.TypeKind) typeSymbol2 = CompilationUtils.GetTypeSymbol(compilation, bindingsA, "a.vb", "Q'second") Assert.NotNull(typeSymbol2) - Assert.Equal("Foo.Bar.N1.N2.Q", typeSymbol2.ToTestDisplayString()) + Assert.Equal("Goo.Bar.N1.N2.Q", typeSymbol2.ToTestDisplayString()) Assert.Equal(TypeKind.Class, typeSymbol2.TypeKind) Assert.Equal(0, typeSymbol2.Arity) Assert.Equal(typeSymbol, typeSymbol2) typeSymbol3 = CompilationUtils.GetTypeSymbol(compilation, bindingsA, "a.vb", "Q'third") Assert.NotNull(typeSymbol3) - Assert.Equal("Foo.Bar.N1.N2.Q", typeSymbol3.ToTestDisplayString()) + Assert.Equal("Goo.Bar.N1.N2.Q", typeSymbol3.ToTestDisplayString()) Assert.Equal(TypeKind.Structure, typeSymbol3.TypeKind) Assert.Equal(0, typeSymbol3.Arity) Assert.NotEqual(typeSymbol, typeSymbol3) @@ -702,7 +702,7 @@ BC30460: 'End Class' must be preceded by a matching 'Class'. typeSymbol4 = CompilationUtils.GetTypeSymbol(compilation, bindingsB, "b.vb", "Q") Assert.NotNull(typeSymbol4) - Assert.Equal("Foo.Bar.N1.N2.Q", typeSymbol4.ToTestDisplayString()) + Assert.Equal("Goo.Bar.N1.N2.Q", typeSymbol4.ToTestDisplayString()) Assert.Equal(TypeKind.Interface, typeSymbol4.TypeKind) Assert.Equal(0, typeSymbol4.Arity) Assert.NotEqual(typeSymbol4, typeSymbol3) @@ -711,7 +711,7 @@ BC30460: 'End Class' must be preceded by a matching 'Class'. typeSymbol5 = CompilationUtils.GetTypeSymbol(compilation, bindingsA, "a.vb", "Q(Of T)") Assert.NotNull(typeSymbol5) - Assert.Equal("Foo.Bar.N1.N2.Q(Of T)", typeSymbol5.ToTestDisplayString()) + Assert.Equal("Goo.Bar.N1.N2.Q(Of T)", typeSymbol5.ToTestDisplayString()) Assert.Equal(TypeKind.Class, typeSymbol5.TypeKind) Assert.Equal(1, typeSymbol5.Arity) Assert.NotEqual(typeSymbol5, typeSymbol4) @@ -727,22 +727,22 @@ BC30460: 'End Class' must be preceded by a matching 'Class'. Dim typeSymbol7 = CompilationUtils.GetTypeSymbol(compilation, bindingsB, "b.vb", "N1'class") Assert.NotNull(typeSymbol7) - Assert.Equal("Foo.Bar.N1", typeSymbol7.ToTestDisplayString()) + Assert.Equal("Goo.Bar.N1", typeSymbol7.ToTestDisplayString()) Assert.Equal(TypeKind.Class, typeSymbol7.TypeKind) Dim typeSymbol8 = CompilationUtils.GetTypeSymbol(compilation, bindingsB, "b.vb", "Wack") Assert.NotNull(typeSymbol8) - Assert.Equal("Foo.Bar.N2.Wack", typeSymbol8.ToTestDisplayString()) + Assert.Equal("Goo.Bar.N2.Wack", typeSymbol8.ToTestDisplayString()) Assert.Equal(TypeKind.Class, typeSymbol8.TypeKind) Dim typeSymbol9 = CompilationUtils.GetEnumSymbol(compilation, bindingsB, "b.vb", "Wack2") Assert.NotNull(typeSymbol9) - Assert.Equal("Foo.Bar.N2.Wack2", typeSymbol9.ToTestDisplayString()) + Assert.Equal("Goo.Bar.N2.Wack2", typeSymbol9.ToTestDisplayString()) Assert.Equal(TypeKind.Enum, typeSymbol9.TypeKind) Dim typeSymbol10 = CompilationUtils.GetDelegateSymbol(compilation, bindingsB, "b.vb", "Wack3") Assert.NotNull(typeSymbol10) - Assert.Equal("Foo.Bar.N2.Wack3", typeSymbol10.ToTestDisplayString()) + Assert.Equal("Goo.Bar.N2.Wack3", typeSymbol10.ToTestDisplayString()) Assert.Equal(TypeKind.Delegate, typeSymbol10.TypeKind) CompilationUtils.AssertTheseDiagnostics(compilation, expectedErrors) @@ -764,7 +764,7 @@ BC30460: 'End Class' must be preceded by a matching 'Class'. Public Sub TestGetDeclaredSymbolFromNamespaceDeclaration() - Dim options = TestOptions.ReleaseDll.WithRootNamespace("Foo.Bar") + Dim options = TestOptions.ReleaseDll.WithRootNamespace("Goo.Bar") Dim compilation = CompilationUtils.CreateCompilationWithMscorlib( @@ -816,7 +816,7 @@ BC30460: 'End Class' must be preceded by a matching 'Class'. , options) Dim expectedErrors = -BC30179: class 'N4' and namespace 'N4' conflict in namespace 'Foo.Bar'. +BC30179: class 'N4' and namespace 'N4' conflict in namespace 'Goo.Bar'. Class N4 ~~ BC30481: 'Class' statement must end with a matching 'End Class'. @@ -838,38 +838,38 @@ BC30460: 'End Class' must be preceded by a matching 'Class'. Dim nsSymbol0 = GetNamespaceSymbol(compilation, bindingsA, "a.vb", "N1") Assert.NotNull(nsSymbol0) - Assert.Equal("Foo.Bar.N1", nsSymbol0.ToTestDisplayString()) + Assert.Equal("Goo.Bar.N1", nsSymbol0.ToTestDisplayString()) Dim nsSymbol1 = GetNamespaceSymbol(compilation, bindingsA, "a.vb", "N2.N3") Assert.NotNull(nsSymbol1) - Assert.Equal("Foo.Bar.N1.N2.N3", nsSymbol1.ToTestDisplayString()) + Assert.Equal("Goo.Bar.N1.N2.N3", nsSymbol1.ToTestDisplayString()) Dim nsSymbol2 = GetNamespaceSymbol(compilation, bindingsA, "a.vb", "N4'first") Assert.NotNull(nsSymbol2) - Assert.Equal("Foo.Bar.N4", nsSymbol2.ToTestDisplayString()) + Assert.Equal("Goo.Bar.N4", nsSymbol2.ToTestDisplayString()) Dim nsSymbol3 = GetNamespaceSymbol(compilation, bindingsA, "a.vb", "N4'second") Assert.NotNull(nsSymbol3) - Assert.Equal("Foo.Bar.N4", nsSymbol3.ToTestDisplayString()) + Assert.Equal("Goo.Bar.N4", nsSymbol3.ToTestDisplayString()) Assert.Equal(nsSymbol2, nsSymbol3) Dim nsSymbol4 = GetNamespaceSymbol(compilation, bindingsB, "b.vb", "N1.N2") Assert.NotNull(nsSymbol4) - Assert.Equal("Foo.Bar.N1.N2", nsSymbol4.ToTestDisplayString()) + Assert.Equal("Goo.Bar.N1.N2", nsSymbol4.ToTestDisplayString()) Dim nsSymbol5 = GetNamespaceSymbol(compilation, bindingsB, "b.vb", "N3") Assert.NotNull(nsSymbol5) - Assert.Equal("Foo.Bar.N1.N2.N3", nsSymbol5.ToTestDisplayString()) + Assert.Equal("Goo.Bar.N1.N2.N3", nsSymbol5.ToTestDisplayString()) Assert.Equal(nsSymbol1, nsSymbol5) Dim nsSymbol6 = GetNamespaceSymbol(compilation, bindingsB, "b.vb", "N4") Assert.NotNull(nsSymbol6) - Assert.Equal("Foo.Bar.N4", nsSymbol6.ToTestDisplayString()) + Assert.Equal("Goo.Bar.N4", nsSymbol6.ToTestDisplayString()) Assert.Equal(nsSymbol2, nsSymbol6) Dim nsSymbol7 = GetNamespaceSymbol(compilation, bindingsB, "b.vb", "N1'bad") Assert.NotNull(nsSymbol7) - Assert.Equal("Foo.Bar.N1", nsSymbol7.ToTestDisplayString()) + Assert.Equal("Goo.Bar.N1", nsSymbol7.ToTestDisplayString()) Dim nsSymbol8 = GetNamespaceSymbol(compilation, bindingsB, "b.vb", "Global.N1") Assert.NotNull(nsSymbol8) @@ -921,7 +921,7 @@ BC30460: 'End Class' must be preceded by a matching 'Class'. Public Sub TestGetDeclaredSymbolFromMethodDeclaration() - Dim options = TestOptions.ReleaseDll.WithRootNamespace("Foo.Bar") + Dim options = TestOptions.ReleaseDll.WithRootNamespace("Goo.Bar") Dim compilation = CompilationUtils.CreateCompilationWithMscorlib( @@ -933,12 +933,12 @@ BC30460: 'End Class' must be preceded by a matching 'Class'. Namespace N1 Namespace N2.N3 Partial Class C1 - Public Sub Foo(x as Integer) + Public Sub Goo(x as Integer) End Sub - Public MustOverride Function Foo() As String + Public MustOverride Function Goo() As String - Private Function Foo(a as Integer, y As String) As Long + Private Function Goo(a as Integer, y As String) As Long End Function Public Sub New() @@ -956,7 +956,7 @@ BC30460: 'End Class' must be preceded by a matching 'Class'. Shared Sub New() End Sub - Private Function Foo(b as Integer, y As String) As Long + Private Function Goo(b as Integer, y As String) As Long End Function End Class @@ -982,8 +982,8 @@ BC30460: 'End Class' must be preceded by a matching 'Class'. BC31411: 'C1' must be declared 'MustInherit' because it contains methods declared 'MustOverride'. Partial Class C1 ~~ -BC30269: 'Private Function Foo(a As Integer, y As String) As Long' has multiple definitions with identical signatures. - Private Function Foo(a as Integer, y As String) As Long +BC30269: 'Private Function Goo(a As Integer, y As String) As Long' has multiple definitions with identical signatures. + Private Function Goo(a as Integer, y As String) As Long ~~~ BC30001: Statement is not valid in a namespace. Public Sub Bar() @@ -1011,39 +1011,39 @@ BC30460: 'End Class' must be preceded by a matching 'Class'. Dim syntax As MethodBaseSyntax = Nothing - Dim methSymbol1 = GetMethodSymbol(compilation, bindingsA, "a.vb", "Sub Foo(x as Integer)", syntax) + Dim methSymbol1 = GetMethodSymbol(compilation, bindingsA, "a.vb", "Sub Goo(x as Integer)", syntax) Assert.NotNull(methSymbol1) - Assert.Equal("Sub Foo.Bar.N1.N2.N3.C1.Foo(x As System.Int32)", methSymbol1.ToTestDisplayString()) + Assert.Equal("Sub Goo.Bar.N1.N2.N3.C1.Goo(x As System.Int32)", methSymbol1.ToTestDisplayString()) Assert.Equal(treeA.GetLineSpan(syntax.Span).StartLinePosition.Line, methSymbol1.Locations.Single().GetLineSpan().StartLinePosition.Line) - Dim methSymbol2 = GetMethodSymbol(compilation, bindingsA, "a.vb", "Function Foo() As String", syntax) + Dim methSymbol2 = GetMethodSymbol(compilation, bindingsA, "a.vb", "Function Goo() As String", syntax) Assert.NotNull(methSymbol2) - Assert.Equal("Function Foo.Bar.N1.N2.N3.C1.Foo() As System.String", methSymbol2.ToTestDisplayString()) + Assert.Equal("Function Goo.Bar.N1.N2.N3.C1.Goo() As System.String", methSymbol2.ToTestDisplayString()) Assert.Equal(treeA.GetLineSpan(syntax.Span).StartLinePosition.Line, methSymbol2.Locations.Single().GetLineSpan().StartLinePosition.Line) - Dim methSymbol3 = GetMethodSymbol(compilation, bindingsA, "a.vb", "Foo(a as Integer, y As String)", syntax) + Dim methSymbol3 = GetMethodSymbol(compilation, bindingsA, "a.vb", "Goo(a as Integer, y As String)", syntax) Assert.NotNull(methSymbol3) - Assert.Equal("Function Foo.Bar.N1.N2.N3.C1.Foo(a As System.Int32, y As System.String) As System.Int64", methSymbol3.ToTestDisplayString()) + Assert.Equal("Function Goo.Bar.N1.N2.N3.C1.Goo(a As System.Int32, y As System.String) As System.Int64", methSymbol3.ToTestDisplayString()) Assert.Equal(treeA.GetLineSpan(syntax.Span).StartLinePosition.Line, methSymbol3.Locations.Single().GetLineSpan().StartLinePosition.Line) Dim methSymbol4 = GetMethodSymbol(compilation, bindingsA, "a.vb", "Sub New", syntax) Assert.NotNull(methSymbol4) - Assert.Equal("Sub Foo.Bar.N1.N2.N3.C1..ctor()", methSymbol4.ToTestDisplayString()) + Assert.Equal("Sub Goo.Bar.N1.N2.N3.C1..ctor()", methSymbol4.ToTestDisplayString()) Assert.Equal(treeA.GetLineSpan(syntax.Span).StartLinePosition.Line, methSymbol4.Locations.Single().GetLineSpan().StartLinePosition.Line) Dim methSymbol5 = GetMethodSymbol(compilation, bindingsB, "b.vb", "Sub New", syntax) Assert.NotNull(methSymbol5) - Assert.Equal("Sub Foo.Bar.N1.N2.N3.C1..cctor()", methSymbol5.ToTestDisplayString()) + Assert.Equal("Sub Goo.Bar.N1.N2.N3.C1..cctor()", methSymbol5.ToTestDisplayString()) Assert.Equal(treeB.GetLineSpan(syntax.Span).StartLinePosition.Line, methSymbol5.Locations.Single().GetLineSpan().StartLinePosition.Line) - Dim methSymbol6 = GetMethodSymbol(compilation, bindingsB, "b.vb", "Foo(b as Integer, y As String)", syntax) + Dim methSymbol6 = GetMethodSymbol(compilation, bindingsB, "b.vb", "Goo(b as Integer, y As String)", syntax) Assert.NotNull(methSymbol6) - Assert.Equal("Function Foo.Bar.N1.N2.N3.C1.Foo(b As System.Int32, y As System.String) As System.Int64", methSymbol6.ToTestDisplayString()) + Assert.Equal("Function Goo.Bar.N1.N2.N3.C1.Goo(b As System.Int32, y As System.String) As System.Int64", methSymbol6.ToTestDisplayString()) Assert.Equal(treeB.GetLineSpan(syntax.Span).StartLinePosition.Line, methSymbol6.Locations.Single().GetLineSpan().StartLinePosition.Line) @@ -1052,7 +1052,7 @@ BC30460: 'End Class' must be preceded by a matching 'Class'. Dim methSymbol8 = GetMethodSymbol(compilation, bindingsB, "b.vb", "Wackadoodle()", syntax) Assert.NotNull(methSymbol8) - Assert.Equal("Sub Foo.Bar.N1.Wack.Wackadoodle()", methSymbol8.ToTestDisplayString()) + Assert.Equal("Sub Goo.Bar.N1.Wack.Wackadoodle()", methSymbol8.ToTestDisplayString()) Assert.Equal(treeB.GetLineSpan(syntax.Span).StartLinePosition.Line, methSymbol8.Locations.Single().GetLineSpan().StartLinePosition.Line) @@ -1062,7 +1062,7 @@ BC30460: 'End Class' must be preceded by a matching 'Class'. Public Sub TestGetDeclaredSymbolFromPropertyDeclaration() - Dim options = TestOptions.ReleaseDll.WithRootNamespace("Foo.Bar") + Dim options = TestOptions.ReleaseDll.WithRootNamespace("Goo.Bar") Dim compilation = CompilationUtils.CreateCompilationWithMscorlib( @@ -1194,7 +1194,7 @@ End Class Public Sub TestGetDeclaredSymbolFromParameter() - Dim options = TestOptions.ReleaseDll.WithRootNamespace("Foo.Bar") + Dim options = TestOptions.ReleaseDll.WithRootNamespace("Goo.Bar") Dim compilation = CompilationUtils.CreateCompilationWithMscorlib( @@ -1205,10 +1205,10 @@ End Class Namespace N1 Partial Class C1 - Public Sub Foo(x as Integer, Optional yopt as String = "hi") + Public Sub Goo(x as Integer, Optional yopt as String = "hi") End Sub - Public MustOverride Function Foo(a as Long, a as integer) As String + Public MustOverride Function Goo(a as Long, a as integer) As String Public Sub New(c as string, d as string) End Sub @@ -1239,7 +1239,7 @@ BC31411: 'C1' must be declared 'MustInherit' because it contains methods declare Partial Class C1 ~~ BC30237: Parameter already declared with name 'a'. - Public MustOverride Function Foo(a as Long, a as integer) As String + Public MustOverride Function Goo(a as Long, a as integer) As String ~ BC30001: Statement is not valid in a namespace. Public Sub Bar(aaa as integer) @@ -1258,7 +1258,7 @@ BC30001: Statement is not valid in a namespace. Assert.NotNull(paramSymbol1) Assert.Equal("x", paramSymbol1.Name) Assert.Equal("System.Int32", paramSymbol1.Type.ToTestDisplayString()) - Assert.Equal("Sub Foo.Bar.N1.C1.Foo(x As System.Int32, [yopt As System.String = ""hi""])", paramSymbol1.ContainingSymbol.ToTestDisplayString()) + Assert.Equal("Sub Goo.Bar.N1.C1.Goo(x As System.Int32, [yopt As System.String = ""hi""])", paramSymbol1.ContainingSymbol.ToTestDisplayString()) Assert.Equal(syntax.SpanStart, paramSymbol1.Locations.Single().SourceSpan.Start) @@ -1266,7 +1266,7 @@ BC30001: Statement is not valid in a namespace. Assert.NotNull(paramSymbol2) Assert.Equal("yopt", paramSymbol2.Name) Assert.Equal("System.String", paramSymbol2.Type.ToTestDisplayString()) - Assert.Equal("Sub Foo.Bar.N1.C1.Foo(x As System.Int32, [yopt As System.String = ""hi""])", paramSymbol2.ContainingSymbol.ToTestDisplayString()) + Assert.Equal("Sub Goo.Bar.N1.C1.Goo(x As System.Int32, [yopt As System.String = ""hi""])", paramSymbol2.ContainingSymbol.ToTestDisplayString()) Assert.Equal(syntax.SpanStart, paramSymbol2.Locations.Single().SourceSpan.Start - "Optional ".Length) @@ -1274,7 +1274,7 @@ BC30001: Statement is not valid in a namespace. Assert.NotNull(paramSymbol3) Assert.Equal("a", paramSymbol3.Name) Assert.Equal("System.Int64", paramSymbol3.Type.ToTestDisplayString()) - Assert.Equal("Function Foo.Bar.N1.C1.Foo(a As System.Int64, a As System.Int32) As System.String", paramSymbol3.ContainingSymbol.ToTestDisplayString()) + Assert.Equal("Function Goo.Bar.N1.C1.Goo(a As System.Int64, a As System.Int32) As System.String", paramSymbol3.ContainingSymbol.ToTestDisplayString()) Assert.Equal(syntax.SpanStart, paramSymbol3.Locations.Single().SourceSpan.Start) @@ -1282,7 +1282,7 @@ BC30001: Statement is not valid in a namespace. Assert.NotNull(paramSymbol4) Assert.Equal("a", paramSymbol4.Name) Assert.Equal("System.Int32", paramSymbol4.Type.ToTestDisplayString()) - Assert.Equal("Function Foo.Bar.N1.C1.Foo(a As System.Int64, a As System.Int32) As System.String", paramSymbol4.ContainingSymbol.ToTestDisplayString()) + Assert.Equal("Function Goo.Bar.N1.C1.Goo(a As System.Int64, a As System.Int32) As System.String", paramSymbol4.ContainingSymbol.ToTestDisplayString()) Assert.Equal(syntax.SpanStart, paramSymbol4.Locations.Single().SourceSpan.Start) @@ -1290,7 +1290,7 @@ BC30001: Statement is not valid in a namespace. Assert.NotNull(paramSymbol5) Assert.Equal("d", paramSymbol5.Name) Assert.Equal("System.String", paramSymbol5.Type.ToTestDisplayString()) - Assert.Equal("Sub Foo.Bar.N1.C1..ctor(c As System.String, d As System.String)", paramSymbol5.ContainingSymbol.ToTestDisplayString()) + Assert.Equal("Sub Goo.Bar.N1.C1..ctor(c As System.String, d As System.String)", paramSymbol5.ContainingSymbol.ToTestDisplayString()) Assert.Equal(syntax.SpanStart, paramSymbol5.Locations.Single().SourceSpan.Start) @@ -1404,7 +1404,7 @@ End Namespace Public Sub TestGetDeclaredSymbolLambdaParam() - Dim options = TestOptions.ReleaseDll.WithRootNamespace("Foo.Bar") + Dim options = TestOptions.ReleaseDll.WithRootNamespace("Goo.Bar") Dim compilation = CompilationUtils.CreateCompilationWithMscorlib( @@ -1566,17 +1566,17 @@ Import System Class Program Shared Sub Main() -On Error Goto Foo +On Error Goto Goo Exit Sub -Foo: +Goo: Resume next End Sub Shared Sub ResumeNext() On Error Resume Next Exit Sub -Foo: +Goo: Resume next End Sub @@ -1601,7 +1601,7 @@ End Class Dim LabelSymbol = DirectCast(model.GetDeclaredSymbol(Labels), LabelSymbol) Assert.NotNull(LabelSymbol) - Assert.Equal("Foo", LabelSymbol.Name) + Assert.Equal("Goo", LabelSymbol.Name) Dim OnErrorGoto = DirectCast(tree.FindNodeOrTokenByKind(SyntaxKind.OnErrorGoToLabelStatement, 1).AsNode(), OnErrorGoToStatementSyntax) Assert.NotNull(OnErrorGoto) @@ -1620,7 +1620,7 @@ End Class Public Sub TestGetDeclaredSymbolFromAliasDecl() - Dim options = TestOptions.ReleaseDll.WithRootNamespace("Foo.Bar") + Dim options = TestOptions.ReleaseDll.WithRootNamespace("Goo.Bar") Dim compilation = CompilationUtils.CreateCompilationWithMscorlib( @@ -1801,7 +1801,7 @@ End Namespace Public Sub TestGetDeclaredSymbolFromTypeParameter() - Dim options = TestOptions.ReleaseDll.WithRootNamespace("Foo.Bar") + Dim options = TestOptions.ReleaseDll.WithRootNamespace("Goo.Bar") Dim compilation = CompilationUtils.CreateCompilationWithMscorlib( @@ -1851,7 +1851,7 @@ BC30001: Statement is not valid in a namespace. Dim tpSymbol1 = GetTypeParameterSymbol(compilation, bindingsA, "a.vb", "TTT", syntax) Assert.NotNull(tpSymbol1) Assert.Equal("TTT", tpSymbol1.Name) - Assert.Equal("Foo.Bar.N1.C1(Of TTT, UUU)", tpSymbol1.ContainingSymbol.ToTestDisplayString()) + Assert.Equal("Goo.Bar.N1.C1(Of TTT, UUU)", tpSymbol1.ContainingSymbol.ToTestDisplayString()) Assert.Equal(2, tpSymbol1.Locations.Length()) Assert.True(syntax.SpanStart = tpSymbol1.Locations.Item(0).SourceSpan.Start OrElse syntax.SpanStart = tpSymbol1.Locations.Item(1).SourceSpan.Start, @@ -1860,7 +1860,7 @@ BC30001: Statement is not valid in a namespace. Dim tpSymbol2 = GetTypeParameterSymbol(compilation, bindingsA, "a.vb", "UUU", syntax) Assert.NotNull(tpSymbol2) Assert.Equal("UUU", tpSymbol2.Name) - Assert.Equal("Foo.Bar.N1.C1(Of TTT, UUU)", tpSymbol2.ContainingSymbol.ToTestDisplayString()) + Assert.Equal("Goo.Bar.N1.C1(Of TTT, UUU)", tpSymbol2.ContainingSymbol.ToTestDisplayString()) Assert.Equal(2, tpSymbol2.Locations.Length()) Assert.True(syntax.SpanStart = tpSymbol2.Locations.Item(0).SourceSpan.Start OrElse syntax.SpanStart = tpSymbol2.Locations.Item(1).SourceSpan.Start, @@ -1869,7 +1869,7 @@ BC30001: Statement is not valid in a namespace. Dim tpSymbol3 = GetTypeParameterSymbol(compilation, bindingsB, "b.vb", "TTT", syntax) Assert.NotNull(tpSymbol3) Assert.Equal("TTT", tpSymbol3.Name) - Assert.Equal("Foo.Bar.N1.C1(Of TTT, UUU)", tpSymbol3.ContainingSymbol.ToTestDisplayString()) + Assert.Equal("Goo.Bar.N1.C1(Of TTT, UUU)", tpSymbol3.ContainingSymbol.ToTestDisplayString()) Assert.Equal(2, tpSymbol3.Locations.Length()) Assert.True(syntax.SpanStart = tpSymbol3.Locations.Item(0).SourceSpan.Start OrElse syntax.SpanStart = tpSymbol3.Locations.Item(1).SourceSpan.Start, @@ -1878,7 +1878,7 @@ BC30001: Statement is not valid in a namespace. Dim tpSymbol4 = GetTypeParameterSymbol(compilation, bindingsB, "b.vb", "UUU", syntax) Assert.NotNull(tpSymbol4) Assert.Equal("UUU", tpSymbol4.Name) - Assert.Equal("Foo.Bar.N1.C1(Of TTT, UUU)", tpSymbol4.ContainingSymbol.ToTestDisplayString()) + Assert.Equal("Goo.Bar.N1.C1(Of TTT, UUU)", tpSymbol4.ContainingSymbol.ToTestDisplayString()) Assert.Equal(2, tpSymbol4.Locations.Length()) Assert.True(syntax.SpanStart = tpSymbol4.Locations.Item(0).SourceSpan.Start OrElse syntax.SpanStart = tpSymbol4.Locations.Item(1).SourceSpan.Start, @@ -1887,7 +1887,7 @@ BC30001: Statement is not valid in a namespace. Dim tpSymbol5 = GetTypeParameterSymbol(compilation, bindingsA, "a.vb", "VVV", syntax) Assert.NotNull(tpSymbol5) Assert.Equal("VVV", tpSymbol5.Name) - Assert.Equal("Sub Foo.Bar.N1.C1(Of TTT, UUU).K(Of VVV)(a As VVV)", tpSymbol5.ContainingSymbol.ToTestDisplayString()) + Assert.Equal("Sub Goo.Bar.N1.C1(Of TTT, UUU).K(Of VVV)(a As VVV)", tpSymbol5.ContainingSymbol.ToTestDisplayString()) Assert.Equal(1, tpSymbol5.Locations.Length()) Assert.Equal(syntax.SpanStart, tpSymbol5.Locations.Single().SourceSpan.Start) @@ -1915,7 +1915,7 @@ BC30001: Statement is not valid in a namespace. Public Sub TestGetDeclaredFromLabel() - Dim options = TestOptions.ReleaseDll.WithRootNamespace("Foo.Bar") + Dim options = TestOptions.ReleaseDll.WithRootNamespace("Goo.Bar") Dim compilation = CompilationUtils.CreateCompilationWithMscorlib( @@ -1955,7 +1955,7 @@ End Module Public Sub TestGetDeclaredSymbolFromVariableName() - Dim options = TestOptions.ReleaseDll.WithRootNamespace("Foo.Bar") + Dim options = TestOptions.ReleaseDll.WithRootNamespace("Goo.Bar") Dim compilation = CompilationUtils.CreateCompilationWithMscorlib( @@ -2483,7 +2483,7 @@ End Namespace Public Sub GetDeclaredSymbolDelegateStatementSyntax() - Dim options = TestOptions.ReleaseDll.WithRootNamespace("Foo.Bar") + Dim options = TestOptions.ReleaseDll.WithRootNamespace("Goo.Bar") Dim compilation = CompilationUtils.CreateCompilationWithMscorlib( @@ -2504,28 +2504,28 @@ End Namespace Dim node = treeA.GetCompilationUnitRoot().FindToken(treeA.GetCompilationUnitRoot().ToFullString().IndexOf("Delegate", StringComparison.Ordinal)).Parent Assert.Equal(SyntaxKind.DelegateFunctionStatement, node.Kind) Dim symbol = bindingsA.GetDeclaredSymbol(node) - Assert.Equal("Foo.Bar.Server.FD", symbol.ToString()) + Assert.Equal("Goo.Bar.Server.FD", symbol.ToString()) node = treeA.GetCompilationUnitRoot().FindToken(treeA.GetCompilationUnitRoot().ToFullString().IndexOf("Delegate", 30, StringComparison.Ordinal)).Parent Assert.Equal(SyntaxKind.DelegateSubStatement, node.Kind) symbol = bindingsA.GetDeclaredSymbol(node) - Assert.Equal("Foo.Bar.Server.FD2", symbol.ToString()) + Assert.Equal("Goo.Bar.Server.FD2", symbol.ToString()) node = treeA.GetCompilationUnitRoot().FindToken(treeA.GetCompilationUnitRoot().ToFullString().IndexOf("Delegate", 140, StringComparison.Ordinal)).Parent Assert.Equal(SyntaxKind.DelegateFunctionStatement, node.Kind) symbol = bindingsA.GetDeclaredSymbol(node) - Assert.Equal("Foo.Bar.Server.C1.FD3", symbol.ToString()) + Assert.Equal("Goo.Bar.Server.C1.FD3", symbol.ToString()) node = treeA.GetCompilationUnitRoot().FindToken(treeA.GetCompilationUnitRoot().ToFullString().IndexOf("Delegate", 160, StringComparison.Ordinal)).Parent Assert.Equal(SyntaxKind.DelegateSubStatement, node.Kind) symbol = bindingsA.GetDeclaredSymbol(node) - Assert.Equal("Foo.Bar.Server.C1.FD4", symbol.ToString()) + Assert.Equal("Goo.Bar.Server.C1.FD4", symbol.ToString()) End Sub Public Sub GetDeclaredSymbolLambdaParamError() - Dim options = TestOptions.ReleaseDll.WithRootNamespace("Foo.Bar") + Dim options = TestOptions.ReleaseDll.WithRootNamespace("Goo.Bar") Dim compilation = CompilationUtils.CreateCompilationWithMscorlib( diff --git a/src/Compilers/VisualBasic/Test/Semantic/Compilation/SemanticModelLookupSymbolsAPITests.vb b/src/Compilers/VisualBasic/Test/Semantic/Compilation/SemanticModelLookupSymbolsAPITests.vb index 2c32a99133366..37ea122addc55 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/Compilation/SemanticModelLookupSymbolsAPITests.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/Compilation/SemanticModelLookupSymbolsAPITests.vb @@ -28,7 +28,7 @@ End Class Class D Inherits B - Public Sub foo() + Public Sub goo() Console.WriteLine() 'BIND:"WriteLine" End Sub End Class diff --git a/src/Compilers/VisualBasic/Test/Semantic/Compilation/VisualBasicCompilationOptionsTests.vb b/src/Compilers/VisualBasic/Test/Semantic/Compilation/VisualBasicCompilationOptionsTests.vb index 81dc02b699a8a..683d476cb8c70 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/Compilation/VisualBasicCompilationOptionsTests.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/Compilation/VisualBasicCompilationOptionsTests.vb @@ -22,14 +22,14 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests Public Sub ShadowInvariants() TestHiddenProperty(Function(old, value) old.WithOutputKind(value), Function(opt) opt.OutputKind, OutputKind.DynamicallyLinkedLibrary) - TestHiddenProperty(Function(old, value) old.WithModuleName(value), Function(opt) opt.ModuleName, "foo.dll") - TestHiddenProperty(Function(old, value) old.WithMainTypeName(value), Function(opt) opt.MainTypeName, "Foo.Bar") + TestHiddenProperty(Function(old, value) old.WithModuleName(value), Function(opt) opt.ModuleName, "goo.dll") + TestHiddenProperty(Function(old, value) old.WithMainTypeName(value), Function(opt) opt.MainTypeName, "Goo.Bar") TestHiddenProperty(Function(old, value) old.WithScriptClassName(value), Function(opt) opt.ScriptClassName, "