diff --git a/BuildAndTest.proj b/BuildAndTest.proj index 955e30f8bee24d5f53f7d69d55216addd1338edb..7f533783186158e218da6ade59d22402658e8280 100644 --- a/BuildAndTest.proj +++ b/BuildAndTest.proj @@ -2,7 +2,7 @@ - + @@ -18,7 +18,6 @@ *.UnitTests.dll *.IntegrationTests.dll Binaries\$(Configuration) - $(UserProfile)\.nuget\packages $(OutputDirectory)\CoreClrTest RestorePackages=false; diff --git a/Compilers.sln b/Compilers.sln index ff6a9353049e557e9973e1fdf0bcccb1bb2972ef..af725779f65e8456626837d22ce2930d43584253 100644 --- a/Compilers.sln +++ b/Compilers.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26014.0 +VisualStudioVersion = 15.0.26020.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeAnalysisTest", "src\Compilers\Core\CodeAnalysisTest\CodeAnalysisTest.csproj", "{A4C99B85-765C-4C65-9C2A-BB609AAB09E6}" EndProject @@ -284,14 +284,14 @@ Global {E58EE9D7-1239-4961-A0C1-F9EC3952C4C1}.Debug|Any CPU.Build.0 = Debug|Any CPU {E58EE9D7-1239-4961-A0C1-F9EC3952C4C1}.Release|Any CPU.ActiveCfg = Release|Any CPU {E58EE9D7-1239-4961-A0C1-F9EC3952C4C1}.Release|Any CPU.Build.0 = Release|Any CPU - {E3CD2895-76A8-4D11-A316-EA67CB5EA42C}.Debug|Any CPU.ActiveCfg = Debug|x64 - {E3CD2895-76A8-4D11-A316-EA67CB5EA42C}.Debug|Any CPU.Build.0 = Debug|x64 - {E3CD2895-76A8-4D11-A316-EA67CB5EA42C}.Release|Any CPU.ActiveCfg = Release|x64 - {E3CD2895-76A8-4D11-A316-EA67CB5EA42C}.Release|Any CPU.Build.0 = Release|x64 - {8CE3A581-2969-4864-A803-013E9D977C3A}.Debug|Any CPU.ActiveCfg = Debug|x64 - {8CE3A581-2969-4864-A803-013E9D977C3A}.Debug|Any CPU.Build.0 = Debug|x64 - {8CE3A581-2969-4864-A803-013E9D977C3A}.Release|Any CPU.ActiveCfg = Release|x64 - {8CE3A581-2969-4864-A803-013E9D977C3A}.Release|Any CPU.Build.0 = Release|x64 + {E3CD2895-76A8-4D11-A316-EA67CB5EA42C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E3CD2895-76A8-4D11-A316-EA67CB5EA42C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E3CD2895-76A8-4D11-A316-EA67CB5EA42C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E3CD2895-76A8-4D11-A316-EA67CB5EA42C}.Release|Any CPU.Build.0 = Release|Any CPU + {8CE3A581-2969-4864-A803-013E9D977C3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8CE3A581-2969-4864-A803-013E9D977C3A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8CE3A581-2969-4864-A803-013E9D977C3A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8CE3A581-2969-4864-A803-013E9D977C3A}.Release|Any CPU.Build.0 = Release|Any CPU {1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Debug|Any CPU.Build.0 = Debug|Any CPU {1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/Roslyn.sln b/Roslyn.sln index 24ade3f7e1f654e9d3a50f4a6a328986831508cc..a545303ff11210efd196eda63a2b6049f2209a65 100644 --- a/Roslyn.sln +++ b/Roslyn.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26109.2 +VisualStudioVersion = 15.0.26020.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeAnalysisTest", "src\Compilers\Core\CodeAnalysisTest\CodeAnalysisTest.csproj", "{A4C99B85-765C-4C65-9C2A-BB609AAB09E6}" EndProject @@ -804,14 +804,14 @@ Global {CF450DCE-D12B-4A11-8D2D-A7A125372C48}.Debug|Any CPU.Build.0 = Debug|Any CPU {CF450DCE-D12B-4A11-8D2D-A7A125372C48}.Release|Any CPU.ActiveCfg = Release|Any CPU {CF450DCE-D12B-4A11-8D2D-A7A125372C48}.Release|Any CPU.Build.0 = Release|Any CPU - {E3CD2895-76A8-4D11-A316-EA67CB5EA42C}.Debug|Any CPU.ActiveCfg = Debug|x64 - {E3CD2895-76A8-4D11-A316-EA67CB5EA42C}.Debug|Any CPU.Build.0 = Debug|x64 - {E3CD2895-76A8-4D11-A316-EA67CB5EA42C}.Release|Any CPU.ActiveCfg = Release|x64 - {E3CD2895-76A8-4D11-A316-EA67CB5EA42C}.Release|Any CPU.Build.0 = Release|x64 - {8CE3A581-2969-4864-A803-013E9D977C3A}.Debug|Any CPU.ActiveCfg = Debug|x64 - {8CE3A581-2969-4864-A803-013E9D977C3A}.Debug|Any CPU.Build.0 = Debug|x64 - {8CE3A581-2969-4864-A803-013E9D977C3A}.Release|Any CPU.ActiveCfg = Release|x64 - {8CE3A581-2969-4864-A803-013E9D977C3A}.Release|Any CPU.Build.0 = Release|x64 + {E3CD2895-76A8-4D11-A316-EA67CB5EA42C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E3CD2895-76A8-4D11-A316-EA67CB5EA42C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E3CD2895-76A8-4D11-A316-EA67CB5EA42C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E3CD2895-76A8-4D11-A316-EA67CB5EA42C}.Release|Any CPU.Build.0 = Release|Any CPU + {8CE3A581-2969-4864-A803-013E9D977C3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8CE3A581-2969-4864-A803-013E9D977C3A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8CE3A581-2969-4864-A803-013E9D977C3A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8CE3A581-2969-4864-A803-013E9D977C3A}.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 diff --git a/cibuild.cmd b/cibuild.cmd index 3cd0450fd056b4e8d012322103af52188bb3e740..25c9306967972b2a678f6038c4126e7148477d5b 100644 --- a/cibuild.cmd +++ b/cibuild.cmd @@ -9,6 +9,7 @@ REM Because override the C#/VB toolset to build against our LKG package, it is i REM that we do not reuse MSBuild nodes from other jobs/builds on the machine. Otherwise, REM we'll run into issues such as https://github.com/dotnet/roslyn/issues/6211. set MSBuildAdditionalCommandLineArgs=/nologo /m /nodeReuse:false /consoleloggerparameters:Verbosity=minimal /filelogger /fileloggerparameters:Verbosity=normal +set BuildAndTestBuildTarget=BuildAndTest :ParseArguments if "%1" == "" goto :DoneParsing @@ -22,6 +23,8 @@ if /I "%1" == "/testBuildCorrectness" set TestBuildCorrectness=true&&shift&& got if /I "%1" == "/testPerfCorrectness" set TestPerfCorrectness=true&&shift&& goto :ParseArguments if /I "%1" == "/testPerfRun" set TestPerfRun=true&&shift&& goto :ParseArguments if /I "%1" == "/testVsi" set TestVsi=true&&shift&& goto :ParseArguments +if /I "%1" == "/skipTest" set BuildAndTestBuildTarget=Build&&shift&&goto :ParseArguments +if /I "%1" == "/skipCommitPrinting" set SkipCommitPrinting=1&&shift&&goto :ParseArguments REM /buildTimeLimit is the time limit, measured in minutes, for the Jenkins job that runs REM the build. The Jenkins script netci.groovy passes the time limit to this script. @@ -61,8 +64,10 @@ if defined testBuildCorrectness ( ) REM Output the commit that we're building, for reference in Jenkins logs -echo Building this commit: -git show --no-patch --pretty=raw HEAD +if not "%SkipCommitPrinting" == "1" ( + echo Building this commit: + git show --no-patch --pretty=raw HEAD +) REM Build with the real assembly version, since that's what's contained in the bootstrap compiler redirects msbuild %MSBuildAdditionalCommandLineArgs% /p:UseShippingAssemblyVersion=true /p:InitialDefineConstants=BOOTSTRAP "%RoslynRoot%build\Toolset\Toolset.csproj" /p:NuGetRestorePackages=false /p:Configuration=%BuildConfiguration% /fileloggerparameters:LogFile="%bindir%\Bootstrap.log" || goto :BuildFailed @@ -115,7 +120,7 @@ if defined TestPerfRun ( exit /b 0 ) -msbuild %MSBuildAdditionalCommandLineArgs% /p:BootstrapBuildPath="%bindir%\Bootstrap" BuildAndTest.proj /p:Configuration=%BuildConfiguration% /p:Test64=%Test64% /p:TestVsi=%TestVsi% /p:RunProcessWatchdog=%RunProcessWatchdog% /p:BuildStartTime=%BuildStartTime% /p:"ProcDumpExe=%ProcDumpExe%" /p:BuildTimeLimit=%BuildTimeLimit% /p:PathMap="%RoslynRoot%=q:\roslyn" /p:Feature=pdb-path-determinism /fileloggerparameters:LogFile="%bindir%\Build.log";verbosity=diagnostic /p:DeployExtension=false || goto :BuildFailed +msbuild %MSBuildAdditionalCommandLineArgs% /p:BootstrapBuildPath="%bindir%\Bootstrap" BuildAndTest.proj /t:%BuildAndTestBuildTarget% /p:Configuration=%BuildConfiguration% /p:Test64=%Test64% /p:TestVsi=%TestVsi% /p:RunProcessWatchdog=%RunProcessWatchdog% /p:BuildStartTime=%BuildStartTime% /p:"ProcDumpExe=%ProcDumpExe%" /p:BuildTimeLimit=%BuildTimeLimit% /p:PathMap="%RoslynRoot%=q:\roslyn" /p:Feature=pdb-path-determinism /fileloggerparameters:LogFile="%bindir%\Build.log";verbosity=diagnostic /p:DeployExtension=false || goto :BuildFailed powershell -noprofile -executionPolicy RemoteSigned -file "%RoslynRoot%\build\scripts\check-msbuild.ps1" "%bindir%\Build.log" || goto :BuildFailed call :TerminateBuildProcesses || goto :BuildFailed @@ -145,10 +150,16 @@ exit /b 1 @REM An error-level of 1 means that the process was found, but could not be killed. echo Killing all build-related processes -taskkill /F /IM msbuild.exe > nul -if %ERRORLEVEL% == 1 exit /b 1 +taskkill /F /IM msbuild.exe > nul 2>&1 +if %ERRORLEVEL% == 1 ( + echo ERROR: taskkill for msbuild.exe failed + exit /b 1 +) -taskkill /F /IM vbcscompiler.exe > nul -if %ERRORLEVEL% == 1 exit /b 1 +taskkill /F /IM vbcscompiler.exe > nul 2>&1 +if %ERRORLEVEL% == 1 ( + echo ERROR: taskkill for vbcscompiler.exe failed + exit /b 1 +) exit /b 0 diff --git a/cibuild.sh b/cibuild.sh index 8b4282dade774716c1c1ae8ac26fca93a2883c7a..e2a6b19b3a8bd9d33963ab5e1ab1f26c11c5f93b 100755 --- a/cibuild.sh +++ b/cibuild.sh @@ -9,7 +9,7 @@ usage() echo "Options" echo " --debug Build Debug (default)" echo " --release Build Release" - echo " --skiptests Do not run tests" + 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" diff --git a/src/Compilers/CSharp/CscCore/CscCore.csproj b/src/Compilers/CSharp/CscCore/CscCore.csproj index 2e422bae1b280a26bfb9e30c9b31c2b9098ddc43..ad34c1715441de1e73b51fce25e4d86cc2aed00e 100644 --- a/src/Compilers/CSharp/CscCore/CscCore.csproj +++ b/src/Compilers/CSharp/CscCore/CscCore.csproj @@ -3,8 +3,8 @@ - x64 - x64 + AnyCPU + AnyCPU x64 $(BaseNuGetRuntimeIdentifier)-$(RuntimeIndentifier) @@ -36,8 +36,8 @@ CSharpCodeAnalysis - - + + BuildClient.cs diff --git a/src/Compilers/CSharp/Portable/Binder/SubsumptionDiagnosticBuilder.cs b/src/Compilers/CSharp/Portable/Binder/SubsumptionDiagnosticBuilder.cs index 9ffcf8dfca94c668523db0f7fc1147a0354799e3..aad3af5655f3dbadc397ece1d0ccf0bbe44dea9e 100644 --- a/src/Compilers/CSharp/Portable/Binder/SubsumptionDiagnosticBuilder.cs +++ b/src/Compilers/CSharp/Portable/Binder/SubsumptionDiagnosticBuilder.cs @@ -241,9 +241,13 @@ private ErrorCode CheckSubsumed(BoundPattern pattern, DecisionTree decisionTree, { var type = td.Key; var decision = td.Value; + // if the pattern's type is already handled by the previous pattern + // or the previous pattern handles all of the (non-null) input data... if (ExpressionOfTypeMatchesPatternType( - declarationPattern.DeclaredType.Type.TupleUnderlyingTypeOrSelf(), type, ref _useSiteDiagnostics) == true) + declarationPattern.DeclaredType.Type.TupleUnderlyingTypeOrSelf(), type, ref _useSiteDiagnostics) == true || + ExpressionOfTypeMatchesPatternType(byType.Type, type, ref _useSiteDiagnostics) == true) { + // then we check if the pattern is subsumed by the previous decision var error = CheckSubsumed(pattern, decision, inputCouldBeNull); if (error != 0) { diff --git a/src/Compilers/CSharp/Portable/Binder/SwitchBinder.cs b/src/Compilers/CSharp/Portable/Binder/SwitchBinder.cs index 838b3e81909649e69416b9b0126d9b05128c4076..02291c40386ed03ce28336f635af87289e9ed382 100644 --- a/src/Compilers/CSharp/Portable/Binder/SwitchBinder.cs +++ b/src/Compilers/CSharp/Portable/Binder/SwitchBinder.cs @@ -223,6 +223,13 @@ private void BuildSwitchLabels(SyntaxList labelsSyntax, Binde boundLabelExpression = ConvertCaseExpression(labelSyntax, boundLabelExpression, sectionBinder, ref boundLabelConstantOpt, tempDiagnosticBag); break; + case SyntaxKind.CasePatternSwitchLabel: + // bind the pattern, to cause its pattern variables to be inferred if necessary + var matchLabel = (CasePatternSwitchLabelSyntax)labelSyntax; + var pattern = sectionBinder.BindPattern( + matchLabel.Pattern, SwitchGoverningExpression, SwitchGoverningType, labelSyntax.HasErrors, tempDiagnosticBag, wasSwitchCase: true); + break; + default: // No constant value break; diff --git a/src/Compilers/CSharp/Portable/BoundTree/DecisionTree.cs b/src/Compilers/CSharp/Portable/BoundTree/DecisionTree.cs index 8ee751de088f07e4da07c47c6334995093847177..cde7571e79607cc5cc9def291c13c9afc72d1368 100644 --- a/src/Compilers/CSharp/Portable/BoundTree/DecisionTree.cs +++ b/src/Compilers/CSharp/Portable/BoundTree/DecisionTree.cs @@ -53,7 +53,7 @@ public static DecisionTree Create(BoundExpression expression, TypeSymbol type, S expression = new BoundLocal(expression.Syntax, temp, null, type); } - if (expression.Type.CanBeAssignedNull()) + if (expression.Type.CanContainNull()) { // We need the ByType decision tree to separate null from non-null values. // Note that, for the purpose of the decision tree (and subsumption), we diff --git a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_PatternSwitchStatement.cs b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_PatternSwitchStatement.cs index c5bbae04f391d30c4837ed213f36c950c3551708..34bd87f7a83aed6fe9707c6524b0f9a1e6e11e5b 100644 --- a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_PatternSwitchStatement.cs +++ b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_PatternSwitchStatement.cs @@ -286,15 +286,16 @@ private void LowerDecisionTree(DecisionTree.ByType byType) var defaultLabel = _factory.GenerateLabel("byTypeDefault"); // input is not a constant - if (byType.Type.CanBeAssignedNull()) + if (byType.Type.CanContainNull()) { // first test for null var notNullLabel = _factory.GenerateLabel("notNull"); var inputExpression = byType.Expression; - var nullValue = _factory.Null(byType.Type); + var objectType = _factory.SpecialType(SpecialType.System_Object); + var nullValue = _factory.Null(objectType); BoundExpression notNull = byType.Type.IsNullableType() ? _localRewriter.RewriteNullableNullEquality(_factory.Syntax, BinaryOperatorKind.NullableNullNotEqual, byType.Expression, nullValue, _factory.SpecialType(SpecialType.System_Boolean)) - : _factory.ObjectNotEqual(byType.Expression, nullValue); + : _factory.ObjectNotEqual(nullValue, _factory.Convert(objectType, byType.Expression)); _loweredDecisionTree.Add(_factory.ConditionalGoto(notNull, notNullLabel, true)); LowerDecisionTree(byType.Expression, byType.WhenNull); if (byType.WhenNull?.MatchIsComplete != true) diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/LocalFunctionSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Source/LocalFunctionSymbol.cs index 7c653f50ebde4ba293cd07b1d53239f50418fc7d..3735e3a7dfaf47a0977a572a960532db460d9ded 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Source/LocalFunctionSymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Source/LocalFunctionSymbol.cs @@ -119,6 +119,15 @@ internal void GetDeclarationDiagnostics(DiagnosticBag addTo) // force lazy init ComputeParameters(); + + foreach (var p in _syntax.ParameterList.Parameters) + { + if (p.IsArgList) + { + addTo.Add(ErrorCode.ERR_IllegalVarArgs, p.Location); + } + } + ComputeReturnType(); var diags = ImmutableInterlocked.InterlockedExchange(ref _diagnostics, default(ImmutableArray)); diff --git a/src/Compilers/CSharp/Portable/Symbols/TypeSymbolExtensions.cs b/src/Compilers/CSharp/Portable/Symbols/TypeSymbolExtensions.cs index 552b1ae4fbfefd93f454dceeffbc1edc17ef66e4..8741b49294134bc602433dedae487afa0d0c02bd 100644 --- a/src/Compilers/CSharp/Portable/Symbols/TypeSymbolExtensions.cs +++ b/src/Compilers/CSharp/Portable/Symbols/TypeSymbolExtensions.cs @@ -27,6 +27,12 @@ public static bool CanBeAssignedNull(this TypeSymbol type) return type.IsReferenceType || type.IsPointerType() || type.IsNullableType(); } + public static bool CanContainNull(this TypeSymbol type) + { + // unbound type parameters might contain null, even though they cannot be *assigned* null. + return !type.IsValueType || type.IsNullableType(); + } + public static bool CanBeConst(this TypeSymbol typeSymbol) { Debug.Assert((object)typeSymbol != null); diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/LocalFunctionTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/LocalFunctionTests.cs index e65ed300016072890fd1c02a826bf590d3d97d77..5398e3210338dafaf1a25a61506da86eb6d22b42 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/LocalFunctionTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/LocalFunctionTests.cs @@ -1615,18 +1615,24 @@ static void Main() } "; VerifyDiagnostics(source, - // (10,31): error CS0190: The __arglist construct is valid only within a variable argument method - // Console.WriteLine(__arglist); - Diagnostic(ErrorCode.ERR_ArgsInvalid, "__arglist").WithLocation(10, 31), - // (18,31): error CS4013: Instance of type 'RuntimeArgumentHandle' cannot be used inside an anonymous function, query expression, iterator block or async method - // Console.WriteLine(__arglist); - Diagnostic(ErrorCode.ERR_SpecialByRefInLambda, "__arglist").WithArguments("System.RuntimeArgumentHandle").WithLocation(18, 31), - // (26,31): error CS0190: The __arglist construct is valid only within a variable argument method - // Console.WriteLine(__arglist); - Diagnostic(ErrorCode.ERR_ArgsInvalid, "__arglist").WithLocation(26, 31), - // (34,31): error CS4013: Instance of type 'RuntimeArgumentHandle' cannot be used inside an anonymous function, query expression, iterator block or async method - // Console.WriteLine(__arglist); - Diagnostic(ErrorCode.ERR_SpecialByRefInLambda, "__arglist").WithArguments("System.RuntimeArgumentHandle").WithLocation(34, 31) + // (10,31): error CS0190: The __arglist construct is valid only within a variable argument method + // Console.WriteLine(__arglist); + Diagnostic(ErrorCode.ERR_ArgsInvalid, "__arglist").WithLocation(10, 31), + // (18,31): error CS4013: Instance of type 'RuntimeArgumentHandle' cannot be used inside an anonymous function, query expression, iterator block or async method + // Console.WriteLine(__arglist); + Diagnostic(ErrorCode.ERR_SpecialByRefInLambda, "__arglist").WithArguments("System.RuntimeArgumentHandle").WithLocation(18, 31), + // (24,20): error CS1669: __arglist is not valid in this context + // void Local(__arglist) + Diagnostic(ErrorCode.ERR_IllegalVarArgs, "__arglist").WithLocation(24, 20), + // (26,31): error CS0190: The __arglist construct is valid only within a variable argument method + // Console.WriteLine(__arglist); + Diagnostic(ErrorCode.ERR_ArgsInvalid, "__arglist").WithLocation(26, 31), + // (32,20): error CS1669: __arglist is not valid in this context + // void Local(__arglist) + Diagnostic(ErrorCode.ERR_IllegalVarArgs, "__arglist").WithLocation(32, 20), + // (34,31): error CS4013: Instance of type 'RuntimeArgumentHandle' cannot be used inside an anonymous function, query expression, iterator block or async method + // Console.WriteLine(__arglist); + Diagnostic(ErrorCode.ERR_SpecialByRefInLambda, "__arglist").WithArguments("System.RuntimeArgumentHandle").WithLocation(34, 31) ); } @@ -1800,10 +1806,12 @@ IEnumerable Local(__arglist) } "; VerifyDiagnostics(source, - // (9,26): error CS1636: __arglist is not allowed in the parameter list of iterators - // IEnumerable Local(__arglist) - Diagnostic(ErrorCode.ERR_VarargsIterator, "Local").WithLocation(9, 26) - ); + // (9,26): error CS1636: __arglist is not allowed in the parameter list of iterators + // IEnumerable Local(__arglist) + Diagnostic(ErrorCode.ERR_VarargsIterator, "Local").WithLocation(9, 26), + // (9,32): error CS1669: __arglist is not valid in this context + // IEnumerable Local(__arglist) + Diagnostic(ErrorCode.ERR_IllegalVarArgs, "__arglist").WithLocation(9, 32)); } [Fact] diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTests.cs index 77650bf5ba4d3f1edd0e6c09b37a12ba57bc2927..817b81240533e33ed757f7fa25fffef5ea7d5fb1 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTests.cs @@ -4618,7 +4618,49 @@ public static void Main(string[] args) ); } - [Fact(Skip = "https://github.com/dotnet/roslyn/issues/16559")] + [Fact, WorkItem(16559, "https://github.com/dotnet/roslyn/issues/16559")] + public void CasePatternVariableUsedInCaseExpression() + { + var program = @" +public class Program5815 +{ + public static void Main(object o) + { + switch (o) + { + case Color Color: + case Color? Color2: + break; + } + } + private static object M() => null; +}"; + var compilation = CreateCompilationWithMscorlib45(program).VerifyDiagnostics( + // (9,32): error CS1525: Invalid expression term 'break' + // case Color? Color2: + Diagnostic(ErrorCode.ERR_InvalidExprTerm, "").WithArguments("break").WithLocation(9, 32), + // (9,32): error CS1003: Syntax error, ':' expected + // case Color? Color2: + Diagnostic(ErrorCode.ERR_SyntaxError, "").WithArguments(":", "break").WithLocation(9, 32), + // (8,18): error CS0118: 'Color' is a variable but is used like a type + // case Color Color: + Diagnostic(ErrorCode.ERR_BadSKknown, "Color").WithArguments("Color", "variable", "type").WithLocation(8, 18), + // (9,25): error CS0103: The name 'Color2' does not exist in the current context + // case Color? Color2: + Diagnostic(ErrorCode.ERR_NameNotInContext, "Color2").WithArguments("Color2").WithLocation(9, 25) + ); + var tree = compilation.SyntaxTrees.Single(); + var model = compilation.GetSemanticModel(tree); + + var colorDecl = GetPatternDeclarations(tree, "Color").ToArray(); + var colorRef = GetReferences(tree, "Color").ToArray(); + Assert.Equal(1, colorDecl.Length); + Assert.Equal(2, colorRef.Length); + Assert.Null(model.GetSymbolInfo(colorRef[0]).Symbol); + VerifyModelForDeclarationPattern(model, colorDecl[0], colorRef[1]); + } + + [Fact, WorkItem(16559, "https://github.com/dotnet/roslyn/issues/16559")] public void Fuzz5815() { var program = @" @@ -4635,21 +4677,33 @@ public static void Main(string[] args) } private static object M() => null; }"; - CreateCompilationWithMscorlib45(program).VerifyDiagnostics( + var compilation = CreateCompilationWithMscorlib45(program).VerifyDiagnostics( + // (9,18): error CS0150: A constant value is expected + // case true ? x3 : 4: + Diagnostic(ErrorCode.ERR_ConstantExpected, "true ? x3 : 4").WithLocation(9, 18) ); + var tree = compilation.SyntaxTrees.Single(); + var model = compilation.GetSemanticModel(tree); + + var x3Decl = GetPatternDeclarations(tree, "x3").ToArray(); + var x3Ref = GetReferences(tree, "x3").ToArray(); + Assert.Equal(1, x3Decl.Length); + Assert.Equal(1, x3Ref.Length); + VerifyModelForDeclarationPattern(model, x3Decl[0], x3Ref); } - [Fact(Skip = "This test generator is capable of producing crashes that are not yet fixed; see, for example, Fuzz5815")] + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/16721")] public void Fuzz() { - int dt = Math.Abs(new DateTime().Ticks.GetHashCode() % 10000000); - for (int i = 1; i < 100000; i++) + const int numTests = 1000000; + int dt = (int)Math.Abs(DateTime.Now.Ticks % 1000000000); + for (int i = 1; i < numTests; i++) { PatternMatchingFuzz(i + dt); } } - public void PatternMatchingFuzz(int dt) + private static void PatternMatchingFuzz(int dt) { Random r = new Random(dt); @@ -4735,5 +4789,187 @@ public static void Main(string[] args) var program = string.Format(body, dt, statement); CreateCompilationWithMscorlib45(program).GetDiagnostics(); } + + [Fact, WorkItem(16671, "https://github.com/dotnet/roslyn/issues/16671")] + public void TypeParameterSubsumption01() + { + var program = @" +using System; +public class Program +{ + public static void Main(string[] args) + { + PatternMatching(new Base()); + PatternMatching(new Derived()); + PatternMatching(null); + PatternMatching(new object()); + PatternMatching(2); + PatternMatching(null); + PatternMatching(new object()); + PatternMatching(2); + PatternMatching(null); + } + static void PatternMatching(TBase o) where TDerived : TBase + { + switch (o) + { + case TDerived td: + Console.WriteLine(nameof(TDerived)); + break; + case TBase tb: + Console.WriteLine(nameof(TBase)); + break; + default: + Console.WriteLine(""Neither""); + break; + } + } +} +class Base +{ +} +class Derived : Base +{ +} +"; + var compilation = CreateCompilationWithMscorlib45(program, options: TestOptions.DebugExe).VerifyDiagnostics( + ); + var comp = CompileAndVerify(compilation, expectedOutput: @"TBase +TDerived +Neither +TBase +TDerived +Neither +TBase +TDerived +Neither"); + } + + [Fact, WorkItem(16671, "https://github.com/dotnet/roslyn/issues/16671")] + public void TypeParameterSubsumption02() + { + var program = @" +using System; +public class Program +{ + static void PatternMatching(TBase o) where TDerived : TBase + { + switch (o) + { + case TBase tb: + Console.WriteLine(nameof(TBase)); + break; + case TDerived td: + Console.WriteLine(nameof(TDerived)); + break; + default: + Console.WriteLine(""Neither""); + break; + } + } +} +class Base +{ +} +class Derived : Base +{ +} +"; + var compilation = CreateCompilationWithMscorlib45(program).VerifyDiagnostics( + // (12,18): error CS8120: The switch case has already been handled by a previous case. + // case TDerived td: + Diagnostic(ErrorCode.ERR_PatternIsSubsumed, "TDerived td").WithLocation(12, 18), + // (13,17): warning CS0162: Unreachable code detected + // Console.WriteLine(nameof(TDerived)); + Diagnostic(ErrorCode.WRN_UnreachableCode, "Console").WithLocation(13, 17) + ); + } + + [Fact, WorkItem(16688, "https://github.com/dotnet/roslyn/issues/16688")] + public void TypeParameterSubsumption03() + { + var program = @" +using System.Collections.Generic; +public class Program +{ + private static void Pattern(T thing) where T : class + { + switch (thing) + { + case T tThing: + break; + case IEnumerable s: + break; + } + } +} +"; + var compilation = CreateCompilationWithMscorlib45(program).VerifyDiagnostics( + // (11,18): error CS8120: The switch case has already been handled by a previous case. + // case IEnumerable s: + Diagnostic(ErrorCode.ERR_PatternIsSubsumed, "IEnumerable s").WithLocation(11, 18), + // (12,17): warning CS0162: Unreachable code detected + // break; + Diagnostic(ErrorCode.WRN_UnreachableCode, "break").WithLocation(12, 17) + ); + } + + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/16696")] + public void TypeParameterSubsumption04() + { + var program = @" +using System.Collections.Generic; +public class Program +{ + private static void Pattern(object thing) where TBase : class where TDerived : TBase + { + switch (thing) + { + case IEnumerable sequence: + break; + case IEnumerable derivedSequence: + break; + } + } +} +"; + var compilation = CreateCompilationWithMscorlib45(program).VerifyDiagnostics( + // (11,18): error CS8120: The switch case has already been handled by a previous case. + // case IEnumerable derivedSequence: + Diagnostic(ErrorCode.ERR_PatternIsSubsumed, "IEnumerable derivedSequence").WithLocation(11, 18), + // (12,17): warning CS0162: Unreachable code detected + // break; + Diagnostic(ErrorCode.WRN_UnreachableCode, "break").WithLocation(12, 17) + ); + } + + [Fact(Skip = "https://github.com/dotnet/roslyn/issues/16696")] + public void TypeParameterSubsumption05() + { + var program = @" +using System.Collections.Generic; +public class Program +{ + private static void Pattern(object thing) where TBase : class where TDerived : TBase + { + switch (thing) + { + case IEnumerable s: + break; + case IEnumerable derivedSequence: + break; + } + } +} +"; + var compilation = CreateCompilationWithMscorlib45(program).VerifyDiagnostics( + // (11,18): error CS8120: The switch case has already been handled by a previous case. + // case IEnumerable derivedSequence: + Diagnostic(ErrorCode.ERR_PatternIsSubsumed, "IEnumerable derivedSequence").WithLocation(11, 18), + // (12,17): warning CS0162: Unreachable code detected + // break; + Diagnostic(ErrorCode.WRN_UnreachableCode, "break").WithLocation(12, 17) + ); + } } } diff --git a/src/Compilers/VisualBasic/VbcCore/VbcCore.csproj b/src/Compilers/VisualBasic/VbcCore/VbcCore.csproj index 5e9fe217ea286380d76541689b6ac689415dfe32..0e1c3074be26394c63b5c2a45210f27343b2bb6e 100644 --- a/src/Compilers/VisualBasic/VbcCore/VbcCore.csproj +++ b/src/Compilers/VisualBasic/VbcCore/VbcCore.csproj @@ -3,8 +3,8 @@ - x64 - x64 + AnyCPU + AnyCPU x64 $(BaseNuGetRuntimeIdentifier)-$(RuntimeIndentifier) @@ -36,8 +36,8 @@ BasicCodeAnalysis - - + + BuildClient.cs diff --git a/src/EditorFeatures/CSharpTest/CSharpEditorServicesTest.csproj b/src/EditorFeatures/CSharpTest/CSharpEditorServicesTest.csproj index cf3115ae7adebea1521009c52ae097def7507c82..a3a37fcbd34268769317b6efb94a06ab1ad40da7 100644 --- a/src/EditorFeatures/CSharpTest/CSharpEditorServicesTest.csproj +++ b/src/EditorFeatures/CSharpTest/CSharpEditorServicesTest.csproj @@ -196,6 +196,7 @@ + diff --git a/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/OverrideCompletionProviderTests_ExpressionBody.cs b/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/OverrideCompletionProviderTests_ExpressionBody.cs new file mode 100644 index 0000000000000000000000000000000000000000..78a1b6282eb6249dd668e274a01ed2b6776a47a2 --- /dev/null +++ b/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/OverrideCompletionProviderTests_ExpressionBody.cs @@ -0,0 +1,113 @@ +using System.Linq; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.CodeStyle; +using Microsoft.CodeAnalysis.Completion; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.CodeStyle; +using Microsoft.CodeAnalysis.CSharp.Completion.Providers; +using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; +using Microsoft.CodeAnalysis.Options; +using Microsoft.CodeAnalysis.Text; +using Roslyn.Test.Utilities; +using Roslyn.Utilities; +using Xunit; + +namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Completion.CompletionProviders +{ + // OverrideCompletionProviderTests overrides SetWorkspaceOptions to disable + // expression-body members. This class does the opposite. + public class OverrideCompletionProviderTests_ExpressionBody : AbstractCSharpCompletionProviderTests + { + public OverrideCompletionProviderTests_ExpressionBody(CSharpTestWorkspaceFixture workspaceFixture) : base(workspaceFixture) + { + } + + internal override CompletionProvider CreateCompletionProvider() + { + return new OverrideCompletionProvider(); + } + + protected override void SetWorkspaceOptions(TestWorkspace workspace) + { + workspace.Options = workspace.Options.WithChangedOption(CSharpCodeStyleOptions.PreferExpressionBodiedAccessors, CodeStyleOptions.TrueWithSuggestionEnforcement) + .WithChangedOption(CSharpCodeStyleOptions.PreferExpressionBodiedProperties, CodeStyleOptions.TrueWithSuggestionEnforcement) + .WithChangedOption(CSharpCodeStyleOptions.PreferExpressionBodiedMethods, CodeStyleOptions.TrueWithSuggestionEnforcement); + } + + [WorkItem(16331, "https://github.com/dotnet/roslyn/issues/16334")] + [WpfFact, Trait(Traits.Feature, Traits.Features.Completion)] + public async Task CommitProducesExpressionBodyProperties() + { + var markupBeforeCommit = @"class B +{ + public virtual int A { get; set; } + class C : B + { + override A$$ + } +}"; + + var expectedCodeAfterCommit = @"class B +{ + public virtual int A { get; set; } + class C : B + { + public override int A { get => base.A$$; set => base.A = value; } + } +}"; + + await VerifyCustomCommitProviderAsync(markupBeforeCommit, "A", expectedCodeAfterCommit); + } + + [WorkItem(16331, "https://github.com/dotnet/roslyn/issues/16334")] + [WpfFact, Trait(Traits.Feature, Traits.Features.Completion)] + public async Task CommitProducesExpressionBodyGetterOnlyProperty() + { + var markupBeforeCommit = @"class B +{ + public virtual int A { get; } + class C : B + { + override A$$ + } +}"; + + var expectedCodeAfterCommit = @"class B +{ + public virtual int A { get; } + class C : B + { + public override int A => base.A;$$ + } +}"; + + await VerifyCustomCommitProviderAsync(markupBeforeCommit, "A", expectedCodeAfterCommit); + } + + + [WorkItem(16331, "https://github.com/dotnet/roslyn/issues/16334")] + [WpfFact, Trait(Traits.Feature, Traits.Features.Completion)] + public async Task CommitProducesExpressionBodyMethod() + { + var markupBeforeCommit = @"class B +{ + public virtual int A() => 2; + class C : B + { + override A$$ + } +}"; + + var expectedCodeAfterCommit = @"class B +{ + public virtual int A() => 2; + class C : B + { + public override int A() => base.A();$$ + } +}"; + + await VerifyCustomCommitProviderAsync(markupBeforeCommit, "A()", expectedCodeAfterCommit); + } + } +} \ No newline at end of file diff --git a/src/EditorFeatures/Core/Implementation/RenameTracking/RenameTrackingTaggerProvider.TrackingSession.cs b/src/EditorFeatures/Core/Implementation/RenameTracking/RenameTrackingTaggerProvider.TrackingSession.cs index c9ee008168b17c73f008db9e07323ced8f7591e7..b8bdc40f5dca530a5bf49711a0134e24e5f926c6 100644 --- a/src/EditorFeatures/Core/Implementation/RenameTracking/RenameTrackingTaggerProvider.TrackingSession.cs +++ b/src/EditorFeatures/Core/Implementation/RenameTracking/RenameTrackingTaggerProvider.TrackingSession.cs @@ -179,6 +179,13 @@ private async Task DetermineIfRenamableIdentifierAsync(Sn } else { + // We do not yet support renaming (inline rename or rename tracking) on + // named tuple elements. + if (renameSymbolInfo.Symbols.Single().ContainingType?.IsTupleType() == true) + { + return TriggerIdentifierKind.NotRenamable; + } + return await DetermineIfRenamableSymbolAsync(renameSymbolInfo.Symbols.Single(), document, token).ConfigureAwait(false); } } diff --git a/src/EditorFeatures/Test/RenameTracking/RenameTrackingTaggerProviderTests.cs b/src/EditorFeatures/Test/RenameTracking/RenameTrackingTaggerProviderTests.cs index 69a199c22a757f5e9c31e377762b943c945bd106..4197436ef516210dd22b06358b98cba01961b89c 100644 --- a/src/EditorFeatures/Test/RenameTracking/RenameTrackingTaggerProviderTests.cs +++ b/src/EditorFeatures/Test/RenameTracking/RenameTrackingTaggerProviderTests.cs @@ -1284,15 +1284,16 @@ End Class [WpfFact] [Trait(Traits.Feature, Traits.Features.RenameTracking)] - public async Task RenameExplicitTupleField() + [WorkItem(371205, "https://devdiv.visualstudio.com/DevDiv/_workitems?_a=edit&id=371205")] + public async Task RenameTrackingNotOnExplicitTupleReturnDeclaration_CSharp() { var code = @" class C { void M() { - (int Item1, int) x = (1, 2); - var y = x.Item1$$; + (int abc$$, int) x = (1, 2); + var y = x.abc; } }"; using (var state = await RenameTrackingTestState.CreateAsync(code, LanguageNames.CSharp)) @@ -1300,32 +1301,20 @@ void M() state.EditorOperations.Backspace(); state.EditorOperations.Backspace(); - await state.AssertTag("Item1", "Ite", invokeAction: true); - - // Make sure the rename completed - var expectedCode = @" -class C -{ - void M() - { - (int Ite, int) x = (1, 2); - var y = x.Ite; - } -}"; - Assert.Equal(expectedCode, state.HostDocument.TextBuffer.CurrentSnapshot.GetText()); await state.AssertNoTag(); } } [WpfFact] [Trait(Traits.Feature, Traits.Features.RenameTracking)] - public async Task RenameExplicitTupleFieldVB() + [WorkItem(371205, "https://devdiv.visualstudio.com/DevDiv/_workitems?_a=edit&id=371205")] + public async Task RenameTrackingNotOnExplicitTupleReturnDeclaration_VB() { var code = @" class C Sub M() - Dim x as (Item1 as integer, int Item2 as integer) = (1, 2) - Dim y = x.Item1$$ + Dim x as (abc$$ as integer, int Item2 as integer) = (1, 2) + Dim y = x.abc End Sub End Class"; using (var state = await RenameTrackingTestState.CreateAsync(code, LanguageNames.VisualBasic)) @@ -1333,148 +1322,88 @@ End Sub state.EditorOperations.Backspace(); state.EditorOperations.Backspace(); - await state.AssertTag("Item1", "Ite", invokeAction: true); - - // Make sure the rename completed - var expectedCode = @" -class C - Sub M() - Dim x as (Ite as integer, int Item2 as integer) = (1, 2) - Dim y = x.Ite - End Sub -End Class"; - Assert.Equal(expectedCode, state.HostDocument.TextBuffer.CurrentSnapshot.GetText()); await state.AssertNoTag(); } } - [WpfFact] [Trait(Traits.Feature, Traits.Features.RenameTracking)] - public async Task RenameExplicitTupleField01() + [WorkItem(371205, "https://devdiv.visualstudio.com/DevDiv/_workitems?_a=edit&id=371205")] + public async Task RenameTrackingNotOnExplicitTupleFieldReference_CSharp() { var code = @" class C { void M() { - (int Ite, int) x = (1, 2); - var y = x.Ite$$; + (int abc, int) x = (1, 2); + var y = x.abc$$; } }"; using (var state = await RenameTrackingTestState.CreateAsync(code, LanguageNames.CSharp)) { - state.EditorOperations.InsertText("m1"); - - await state.AssertTag("Ite", "Item1", invokeAction: true); + state.EditorOperations.Backspace(); + state.EditorOperations.Backspace(); - // Make sure the rename completed - var expectedCode = @" -class C -{ - void M() - { - (int Item1, int) x = (1, 2); - var y = x.Item1; - } -}"; - Assert.Equal(expectedCode, state.HostDocument.TextBuffer.CurrentSnapshot.GetText()); await state.AssertNoTag(); } } [WpfFact] [Trait(Traits.Feature, Traits.Features.RenameTracking)] - public async Task RenameExplicitTupleField01VB() + [WorkItem(371205, "https://devdiv.visualstudio.com/DevDiv/_workitems?_a=edit&id=371205")] + public async Task RenameTrackingNotOnExplicitTupleFieldReference_VB() { var code = @" class C Sub M() - Dim x as (Ite as Integer, Item2 as Integer) = (1, 2) - var y = x.Ite$$ + Dim x as (abc as integer, int Item2 as integer) = (1, 2) + Dim y = x.abc$$ End Sub End Class"; using (var state = await RenameTrackingTestState.CreateAsync(code, LanguageNames.VisualBasic)) { - state.EditorOperations.InsertText("m1"); - - await state.AssertTag("Ite", "Item1", invokeAction: true); + state.EditorOperations.Backspace(); + state.EditorOperations.Backspace(); - // Make sure the rename completed - var expectedCode = @" -class C - Sub M() - Dim x as (Item1 as Integer, Item2 as Integer) = (1, 2) - var y = x.Item1 - End Sub -End Class"; - Assert.Equal(expectedCode, state.HostDocument.TextBuffer.CurrentSnapshot.GetText()); await state.AssertNoTag(); } } [WpfFact] [Trait(Traits.Feature, Traits.Features.RenameTracking)] - public async Task RenameExplicitTupleFieldExtended() + [WorkItem(371205, "https://devdiv.visualstudio.com/DevDiv/_workitems?_a=edit&id=371205")] + public async Task RenameTrackingNotOnExplicitTupleElementsInDeclarations_CSharp() { var code = @" class C { void M() { - (int, int, int, int, int, int, int, int, int Item9, int) x = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - var y = x.Item9$$; + var t = (x$$: 1, y: 2); } }"; using (var state = await RenameTrackingTestState.CreateAsync(code, LanguageNames.CSharp)) { - state.EditorOperations.Backspace(); - state.EditorOperations.Backspace(); - - await state.AssertTag("Item9", "Ite", invokeAction: true); - - // Make sure the rename completed - var expectedCode = @" -class C -{ - void M() - { - (int, int, int, int, int, int, int, int, int Ite, int) x = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - var y = x.Ite; - } -}"; - Assert.Equal(expectedCode, state.HostDocument.TextBuffer.CurrentSnapshot.GetText()); + state.EditorOperations.InsertText("2"); await state.AssertNoTag(); } } [WpfFact] [Trait(Traits.Feature, Traits.Features.RenameTracking)] - public async Task RenameExplicitTupleFieldExtendedVB() + [WorkItem(371205, "https://devdiv.visualstudio.com/DevDiv/_workitems?_a=edit&id=371205")] + public async Task RenameTrackingNotOnExplicitTupleElementsInDeclarations_VB() { var code = @" -class C +Class C Sub M() - Dim x as (Integer, Integer, Integer, Integer, Integer, Integer, Integer, Integer, Item9 As Integer, Integer) = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - var y = x.Item9$$; + Dim t = (x$$:=1, y:=2) End Sub End Class"; using (var state = await RenameTrackingTestState.CreateAsync(code, LanguageNames.VisualBasic)) { - state.EditorOperations.Backspace(); - state.EditorOperations.Backspace(); - - await state.AssertTag("Item9", "Ite", invokeAction: true); - - // Make sure the rename completed - var expectedCode = @" -class C - Sub M() - Dim x as (Integer, Integer, Integer, Integer, Integer, Integer, Integer, Integer, Ite As Integer, Integer) = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - var y = x.Ite; - End Sub -End Class"; - Assert.Equal(expectedCode, state.HostDocument.TextBuffer.CurrentSnapshot.GetText()); + state.EditorOperations.InsertText("2"); await state.AssertNoTag(); } } diff --git a/src/EditorFeatures/TestUtilities/project.json b/src/EditorFeatures/TestUtilities/project.json index 4bfe279ec04bf6c248ab1208a6fe8963aebabfa2..323ed7416b586bb9b3ad4cdcfdcd25d23420ff31 100644 --- a/src/EditorFeatures/TestUtilities/project.json +++ b/src/EditorFeatures/TestUtilities/project.json @@ -7,6 +7,7 @@ "Newtonsoft.Json": "8.0.3", "Nerdbank.FullDuplexStream": "1.0.1", "BasicUndo": "0.9.3", + "Microsoft.ServiceHub.Client": "1.0.177-rc-g56d40a8a02", "Microsoft.VisualStudio.Platform.VSEditor": "15.0.26014-alpha", "Microsoft.VisualStudio.Platform.VSEditor.Interop": "15.0.26014-alpha", "Microsoft.VisualStudio.Composition": "15.0.66-rc", @@ -16,7 +17,7 @@ "Microsoft.VisualStudio.Language.CallHierarchy": "15.0.26014-alpha", "Microsoft.VisualStudio.Language.NavigateTo.Interfaces": "15.0.26014-alpha", "Microsoft.VisualStudio.Text.UI": "15.0.26014-alpha", - "Microsoft.VisualStudio.Text.UI.Wpf": "15.0.26014-alpha", + "Microsoft.VisualStudio.Text.UI.Wpf": "15.0.26014-alpha" }, "frameworks": { "net46": { } diff --git a/src/Features/CSharp/Portable/Completion/CompletionProviders/OverrideCompletionProvider.cs b/src/Features/CSharp/Portable/Completion/CompletionProviders/OverrideCompletionProvider.cs index 5744d043b78f621fabf4d513f977a5d940ccf868..8885e51783b91fa7df9ed502480350a92fa4d86b 100644 --- a/src/Features/CSharp/Portable/Completion/CompletionProviders/OverrideCompletionProvider.cs +++ b/src/Features/CSharp/Portable/Completion/CompletionProviders/OverrideCompletionProvider.cs @@ -205,7 +205,9 @@ protected override int GetTargetCaretPosition(SyntaxNode caretTarget) if (propertyDeclaration.AccessorList != null && propertyDeclaration.AccessorList.Accessors.Any()) { // move to the end of the last statement of the first accessor - var firstAccessorStatement = propertyDeclaration.AccessorList.Accessors.First().Body.Statements.Last(); + var firstAccessor = propertyDeclaration.AccessorList.Accessors[0]; + var firstAccessorStatement = (SyntaxNode)firstAccessor.Body?.Statements.LastOrDefault() ?? + firstAccessor.ExpressionBody.Expression; return firstAccessorStatement.GetLocation().SourceSpan.End; } else diff --git a/src/Interactive/HostTest/project.json b/src/Interactive/HostTest/project.json index b400c8f96507a9f285790c8d694f951e70f0454e..8bca406a1af5758e02a35f7b052054cc16bc3440 100644 --- a/src/Interactive/HostTest/project.json +++ b/src/Interactive/HostTest/project.json @@ -1,5 +1,7 @@ { - "dependencies": { }, + "dependencies": { + "Microsoft.ServiceHub.Client": "1.0.177-rc-g56d40a8a02" + }, "frameworks": { "net46": { } }, diff --git a/src/NuGet/BuildNuGets.csx b/src/NuGet/BuildNuGets.csx index 16f8391e8e42944cc5eee7da9bf11898f3294563..7d1b6688b3736d0897268d7e1fc67c96cac4d34a 100644 --- a/src/NuGet/BuildNuGets.csx +++ b/src/NuGet/BuildNuGets.csx @@ -147,6 +147,7 @@ var PackagesNotBuiltOnCore = new HashSet "Microsoft.CodeAnalysis.VisualBasic.Features", "Microsoft.CodeAnalysis.Workspaces.Common", "Microsoft.Net.Compilers", + "Microsoft.VisualStudio.IntegrationTest.Utilities", "Microsoft.VisualStudio.LanguageServices", "Microsoft.VisualStudio.LanguageServices.Next", "Microsoft.VisualStudio.LanguageServices.Razor.RemoteClient", diff --git a/src/Tools/Source/RunTests/Cache/AssemblyUtil.cs b/src/Tools/Source/RunTests/Cache/AssemblyUtil.cs index 001097abb076c6ecdb4802ac79ef23d18ff1d9c4..3f59f6a5512b584d04aee33327736510b7a5a8be 100644 --- a/src/Tools/Source/RunTests/Cache/AssemblyUtil.cs +++ b/src/Tools/Source/RunTests/Cache/AssemblyUtil.cs @@ -27,28 +27,32 @@ internal AssemblyUtil(string binariesPath) /// /// There are some DLLs whose abscence is expected and should not be considered an error. These - /// are assemblies which are used as light up functionality. + /// are assemblies which are either light up components or are a part of the VS reference graph + /// which are never deployed for our tests. + /// + /// The key here though is to be very explicit about DLLs which are okay to be absent. In the past + /// we had build issues which failed to properly deploy important binaries like MS.CA and hence + /// produced bad content cache keys. /// - internal bool IsKnownLightUpAssembly(AssemblyName name) + internal bool IsKnownMissingAssembly(AssemblyName name) { switch (name.Name) { - // This light up probing is done by the scripting layer. case "System.Runtime.Loader": + // This light up probing is done by the scripting layer. return true; - case "Microsoft.VisualStudio.GraphModel": - // This dependency needs to be better rationalized in our model. - // https://github.com/dotnet/roslyn/issues/16201 - return true; + case "Microsoft.VisualStudio.CodeAnalysis": + case "Microsoft.VisualStudio.CodeAnalysis.Sdk": case "Microsoft.VisualStudio.TeamSystem.Common": - // The MS.VS.CA.Sdk.UI dependency needs to properly list this as a reference and it - // needs to be included in our model. - // https://github.com/dotnet/roslyn/issues/16202 - return true; case "Microsoft.VisualStudio.Repository": - // This is not represented in our compile graph nor is it properly a part of our - // build output in Dev15 builds. - // https://github.com/dotnet/roslyn/issues/16206 + case "Microsoft.VisualStudio.DeveloperTools": + case "Microsoft.VisualStudio.Diagnostics.Assert": + case "Microsoft.VisualStudio.Diagrams.View.Interfaces": + case "Microsoft.VisualStudio.Shell.ViewManager": + case "Microsoft.VisualStudio.VCProjectEngine": + case "Microsoft.VisualStudio.VirtualTreeGrid": + // These are assemblies which are a part of the tranisitive build graph but are known to + // not be a part of our testing code. return true; default: return false; diff --git a/src/Tools/Source/RunTests/Cache/ContentUtil.cs b/src/Tools/Source/RunTests/Cache/ContentUtil.cs index 0a458535dab01798f82af231db8ffb9ffb91fcef..68716fa9d11e5569b4c95d7d54adb20cb184d269 100644 --- a/src/Tools/Source/RunTests/Cache/ContentUtil.cs +++ b/src/Tools/Source/RunTests/Cache/ContentUtil.cs @@ -86,7 +86,7 @@ private void AppendReferences(StringBuilder builder, string assemblyPath) var currentHash = GetFileChecksum(currentPath); references.Add(Tuple.Create(current.Name, currentHash)); } - else if (assemblyUtil.IsKnownLightUpAssembly(current)) + else if (assemblyUtil.IsKnownMissingAssembly(current)) { references.Add(Tuple.Create(current.Name, "")); }