Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into CohostSpellCheck
Browse files Browse the repository at this point in the history
# Conflicts:
#	eng/targets/Services.props
#	src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/RazorServices.cs
  • Loading branch information
davidwengier committed Sep 6, 2024
2 parents b69b08c + 49e727b commit a3ee54d
Show file tree
Hide file tree
Showing 188 changed files with 2,419 additions and 510 deletions.
2 changes: 2 additions & 0 deletions eng/targets/Services.props
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
<ServiceHubService Include="Microsoft.VisualStudio.Razor.GoToDefinition" ClassName="Microsoft.CodeAnalysis.Remote.Razor.RemoteGoToDefinitionService+Factory" />
<ServiceHubService Include="Microsoft.VisualStudio.Razor.Rename" ClassName="Microsoft.CodeAnalysis.Remote.Razor.RemoteRenameService+Factory" />
<ServiceHubService Include="Microsoft.VisualStudio.Razor.AutoInsert" ClassName="Microsoft.CodeAnalysis.Remote.Razor.RemoteAutoInsertService+Factory" />
<ServiceHubService Include="Microsoft.VisualStudio.Razor.Formatting" ClassName="Microsoft.CodeAnalysis.Remote.Razor.RemoteFormattingService+Factory" />
<ServiceHubService Include="Microsoft.VisualStudio.Razor.GoToImplementation" ClassName="Microsoft.CodeAnalysis.Remote.Razor.RemoteGoToImplementationService+Factory" />
<ServiceHubService Include="Microsoft.VisualStudio.Razor.SpellCheck" ClassName="Microsoft.CodeAnalysis.Remote.Razor.RemoteSpellCheckService+Factory" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2336,9 +2336,9 @@ public class MyComponent : ComponentBase
: [// x:\dir\subdir\Test\TestComponent.cshtml(1,27): error CS1503: Argument 1: cannot convert from 'string' to 'int'
// ParentValue
Diagnostic(ErrorCode.ERR_BadArgType, "ParentValue").WithArguments("1", "string", "int").WithLocation(1, 27),
// (38,158): error CS0029: Cannot implicitly convert type 'int' to 'string'
// __builder.AddComponentParameter(2, "ValueChanged", (global::System.Action<System.Int32>)(__value => ParentValue = __value));
Diagnostic(ErrorCode.ERR_NoImplicitConv, "__value").WithArguments("int", "string").WithLocation(38, 158)]);
// (38,166): error CS0029: Cannot implicitly convert type 'int' to 'string'
// __builder.AddComponentParameter(2, nameof(global::Test.MyComponent.ValueChanged), (global::System.Action<global::System.Int32>)(__value => ParentValue = __value));
Diagnostic(ErrorCode.ERR_NoImplicitConv, "__value").WithArguments("int", "string").WithLocation(38, 166)]);
}

[IntegrationTestFact]
Expand Down Expand Up @@ -2616,18 +2616,18 @@ public class MyComponent : ComponentBase


CompileToAssembly(generated, DesignTime
? [// (31,179): error CS0029: Cannot implicitly convert type 'int' to 'string'
// __builder.AddComponentParameter(3, "ValueExpression", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::System.Linq.Expressions.Expression<System.Func<System.String>>>(() => ParentValue));
Diagnostic(ErrorCode.ERR_NoImplicitConv, "ParentValue").WithArguments("int", "string").WithLocation(38, 179),
// (31,179): error CS1662: Cannot convert lambda expression to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type
// __builder.AddComponentParameter(3, "ValueExpression", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::System.Linq.Expressions.Expression<System.Func<System.String>>>(() => ParentValue));
Diagnostic(ErrorCode.ERR_CantConvAnonMethReturns, "ParentValue").WithArguments("lambda expression").WithLocation(38, 179)]
: [// (39,258): error CS0029: Cannot implicitly convert type 'int' to 'string'
// __builder.AddComponentParameter(3, "ValueExpression", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::System.Linq.Expressions.Expression<System.Func<System.String>>>(() => ParentValue));
Diagnostic(ErrorCode.ERR_NoImplicitConv, "ParentValue").WithArguments("int", "string").WithLocation(39, 258),
// (39,258): error CS1662: Cannot convert lambda expression to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type
// __builder.AddComponentParameter(3, "ValueExpression", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::System.Linq.Expressions.Expression<System.Func<System.String>>>(() => ParentValue));
Diagnostic(ErrorCode.ERR_CantConvAnonMethReturns, "ParentValue").WithArguments("lambda expression").WithLocation(39, 258)
? [// (38,195): error CS0029: Cannot implicitly convert type 'int' to 'string'
// __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::System.Linq.Expressions.Expression<global::System.Func<global::System.String>>>(() => ParentValue);
Diagnostic(ErrorCode.ERR_NoImplicitConv, "ParentValue").WithArguments("int", "string").WithLocation(38, 195),
// (38,195): error CS1662: Cannot convert lambda expression to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type
// __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::System.Linq.Expressions.Expression<global::System.Func<global::System.String>>>(() => ParentValue);
Diagnostic(ErrorCode.ERR_CantConvAnonMethReturns, "ParentValue").WithArguments("lambda expression").WithLocation(38, 195)]
: [// (39,274): error CS0029: Cannot implicitly convert type 'int' to 'string'
// __builder.AddComponentParameter(3, nameof(global::Test.MyComponent.ValueExpression), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::System.Linq.Expressions.Expression<global::System.Func<global::System.String>>>(() => ParentValue));
Diagnostic(ErrorCode.ERR_NoImplicitConv, "ParentValue").WithArguments("int", "string").WithLocation(39, 274),
// (39,274): error CS1662: Cannot convert lambda expression to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type
// __builder.AddComponentParameter(3, nameof(global::Test.MyComponent.ValueExpression), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::System.Linq.Expressions.Expression<global::System.Func<global::System.String>>>(() => ParentValue));
Diagnostic(ErrorCode.ERR_CantConvAnonMethReturns, "ParentValue").WithArguments("lambda expression").WithLocation(39, 274)
]);
}

Expand Down Expand Up @@ -8743,6 +8743,31 @@ public class MyComponent<TService, TKey> : ComponentBase
CompileToAssembly(generated);
}

[IntegrationTestFact, WorkItem("https://github.com/dotnet/razor/issues/10827")]
public void GenericTypeCheck()
{
var generated = CompileToCSharp("""
<TestComponent Data="null" />
@code {
private class System
{
private class String
{
}
}
[Parameter]
public List<global::System.String> Data { get; set; }
}
""");

// Assert
AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
CompileToAssembly(generated);
}

#endregion

#region Key
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.
);
__o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::Microsoft.AspNetCore.Components.EventCallback<global::System.Int32>>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create<global::System.Int32>(this,
global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => ParentValue = __value, ParentValue)));
__o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::System.Linq.Expressions.Expression<System.Func<System.Int32>>>(() => ParentValue);
__o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::System.Linq.Expressions.Expression<global::System.Func<global::System.Int32>>>(() => ParentValue);
__builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => {
}
));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ Generated Location: (1135:29,26 [11] )

Source Location: (19:0,19 [5] x:\dir\subdir\Test\TestComponent.cshtml)
|Value|
Generated Location: (2197:45,19 [5] )
Generated Location: (2213:45,19 [5] )
|Value|

Source Location: (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml)
|
public int ParentValue { get; set; } = 42;
|
Generated Location: (2610:63,7 [50] )
Generated Location: (2626:63,7 [50] )
|
public int ParentValue { get; set; } = 42;
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.
#line hidden
#nullable disable
);
__o = new global::System.Action<System.Int32>(
__o = new global::System.Action<global::System.Int32>(
__value => ParentValue = __value);
__builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ Generated Location: (1135:29,26 [11] )

Source Location: (19:0,19 [5] x:\dir\subdir\Test\TestComponent.cshtml)
|Value|
Generated Location: (1668:44,19 [5] )
Generated Location: (1676:44,19 [5] )
|Value|

Source Location: (45:0,45 [5] x:\dir\subdir\Test\TestComponent.cshtml)
|Value|
Generated Location: (1915:53,45 [5] )
Generated Location: (1923:53,45 [5] )
|Value|

Source Location: (80:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml)
|
public int ParentValue { get; set; } = 42;
|
Generated Location: (2328:71,7 [50] )
Generated Location: (2336:71,7 [50] )
|
public int ParentValue { get; set; } = 42;
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.
#line hidden
#nullable disable
);
__o = new global::System.Action<System.Int32>(
__o = new global::System.Action<global::System.Int32>(
__value => ParentValue = __value);
__o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::System.Linq.Expressions.Expression<System.Func<System.Int32>>>(() => ParentValue);
__o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::System.Linq.Expressions.Expression<global::System.Func<global::System.Int32>>>(() => ParentValue);
__builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => {
}
));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ Generated Location: (1135:29,26 [11] )

Source Location: (19:0,19 [5] x:\dir\subdir\Test\TestComponent.cshtml)
|Value|
Generated Location: (1860:45,19 [5] )
Generated Location: (1884:45,19 [5] )
|Value|

Source Location: (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml)
|
public int ParentValue { get; set; } = 42;
|
Generated Location: (2273:63,7 [50] )
Generated Location: (2297:63,7 [50] )
|
public int ParentValue { get; set; } = 42;
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.
#line hidden
#nullable disable
);
__o = new global::System.Action<System.Int32>(
__o = new global::System.Action<global::System.Int32>(
__value => ParentValue = __value);
__builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ Generated Location: (1135:29,26 [11] )

Source Location: (19:0,19 [5] x:\dir\subdir\Test\TestComponent.cshtml)
|Value|
Generated Location: (1668:44,19 [5] )
Generated Location: (1676:44,19 [5] )
|Value|

Source Location: (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml)
|
public int ParentValue { get; set; } = 42;
|
Generated Location: (2081:62,7 [50] )
Generated Location: (2089:62,7 [50] )
|
public int ParentValue { get; set; } = 42;
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.
#line hidden
#nullable disable
);
__o = new global::System.Action<System.Int32>(
__o = new global::System.Action<global::System.Int32>(
__value => ParentValue = __value);
__builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ Generated Location: (1131:29,22 [11] )

Source Location: (15:0,15 [5] x:\dir\subdir\Test\TestComponent.cshtml)
|Value|
Generated Location: (1656:44,15 [5] )
Generated Location: (1664:44,15 [5] )
|Value|

Source Location: (46:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml)
|
public int ParentValue { get; set; } = 42;
|
Generated Location: (2065:62,7 [50] )
Generated Location: (2073:62,7 [50] )
|
public int ParentValue { get; set; } = 42;
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.
#line hidden
#nullable disable
);
__o = new global::System.Action<System.Int32>(
__o = new global::System.Action<global::System.Int32>(
__value => ParentValue = __value);
__builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ Generated Location: (1127:29,18 [11] )

Source Location: (11:0,11 [5] x:\dir\subdir\Test\TestComponent.cshtml)
|Value|
Generated Location: (1645:44,11 [5] )
Generated Location: (1653:44,11 [5] )
|Value|

Source Location: (42:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml)
|
public int ParentValue { get; set; } = 42;
|
Generated Location: (2051:62,7 [50] )
Generated Location: (2059:62,7 [50] )
|
public int ParentValue { get; set; } = 42;
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.
#line hidden
#nullable disable
);
__o = new global::System.Action<System.Int32>(
__o = new global::System.Action<global::System.Int32>(
__value => ParentValue = __value);
__builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ Generated Location: (1135:29,26 [11] )

Source Location: (19:0,19 [5] x:\dir\subdir\Test\TestComponent.cshtml)
|Value|
Generated Location: (1663:44,19 [5] )
Generated Location: (1671:44,19 [5] )
|Value|

Source Location: (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml)
|
public int ParentValue { get; set; } = 42;
|
Generated Location: (2071:62,7 [50] )
Generated Location: (2079:62,7 [50] )
|
public int ParentValue { get; set; } = 42;
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.
#line hidden
#nullable disable
);
__o = new global::System.Action<System.Int32>(
__o = new global::System.Action<global::System.Int32>(
__value => ParentValue = __value);
__builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Generated Location: (1135:29,26 [11] )

Source Location: (19:0,19 [5] x:\dir\subdir\Test\TestComponent.cshtml)
|Value|
Generated Location: (1668:44,19 [5] )
Generated Location: (1676:44,19 [5] )
|Value|

Source Location: (50:1,7 [105] x:\dir\subdir\Test\TestComponent.cshtml)
Expand All @@ -14,7 +14,7 @@ Source Location: (50:1,7 [105] x:\dir\subdir\Test\TestComponent.cshtml)

public string nameof(string s) => string.Empty;
|
Generated Location: (2081:62,7 [105] )
Generated Location: (2089:62,7 [105] )
|
public int ParentValue { get; set; } = 42;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.
#line hidden
#nullable disable
);
__o = new global::System.Action<System.Int32>(
__o = new global::System.Action<global::System.Int32>(
__value => ParentValue = __value);
__builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ Generated Location: (1135:29,26 [11] )

Source Location: (19:0,19 [5] x:\dir\subdir\Test\TestComponent.cshtml)
|Value|
Generated Location: (1668:44,19 [5] )
Generated Location: (1676:44,19 [5] )
|Value|

Source Location: (50:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml)
|
public string ParentValue { get; set; } = "42";
|
Generated Location: (2081:62,7 [55] )
Generated Location: (2089:62,7 [55] )
|
public string ParentValue { get; set; } = "42";
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.
#line hidden
#nullable disable
);
__o = new global::System.Action<System.Int32>(
__o = new global::System.Action<global::System.Int32>(
__value => { ParentValue = __value; global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeSynchronousDelegate(
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ Generated Location: (1139:29,30 [11] )

Source Location: (62:0,62 [6] x:\dir\subdir\Test\TestComponent.cshtml)
|Update|
Generated Location: (1559:39,62 [6] )
Generated Location: (1567:39,62 [6] )
|Update|

Source Location: (19:0,19 [5] x:\dir\subdir\Test\TestComponent.cshtml)
|Value|
Generated Location: (1983:52,19 [5] )
Generated Location: (1991:52,19 [5] )
|Value|

Source Location: (49:0,49 [5] x:\dir\subdir\Test\TestComponent.cshtml)
|Value|
Generated Location: (2234:61,49 [5] )
Generated Location: (2242:61,49 [5] )
|Value|

Source Location: (81:1,7 [82] x:\dir\subdir\Test\TestComponent.cshtml)
Expand All @@ -24,7 +24,7 @@ Source Location: (81:1,7 [82] x:\dir\subdir\Test\TestComponent.cshtml)

public void Update() { }
|
Generated Location: (2647:79,7 [82] )
Generated Location: (2655:79,7 [82] )
|
public int ParentValue { get; set; } = 42;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.
#line hidden
#nullable disable
);
__o = new global::System.Action<System.Int32>(
__o = new global::System.Action<global::System.Int32>(
__value => { ParentValue = __value; global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeSynchronousDelegate(
#nullable restore
#line 1 "x:\dir\subdir\Test\TestComponent.cshtml"
Expand Down
Loading

0 comments on commit a3ee54d

Please sign in to comment.