Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -2242,9 +2242,9 @@ public class MyComponent : ComponentBase
AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
CompileToAssembly(generated, designTime ? [] : [
// (29,55): error CS0120: An object reference is required for the non-static field, method, or property 'MyComponent.Value'
// (21,55): error CS0120: An object reference is required for the non-static field, method, or property 'MyComponent.Value'
// __builder.AddComponentParameter(1, nameof(global::Test.MyComponent.
Diagnostic(ErrorCode.ERR_ObjectRequired, "global::Test.MyComponent.\r\n#nullable restore\r\n#line (1,14)-(1,19) \"x:\\dir\\subdir\\Test\\TestComponent.cshtml\"\r\nValue").WithArguments("Test.MyComponent.Value").WithLocation(29, 55)
Diagnostic(ErrorCode.ERR_ObjectRequired, "global::Test.MyComponent.\r\n#nullable restore\r\n#line (1,14)-(1,19) \"x:\\dir\\subdir\\Test\\TestComponent.cshtml\"\r\nValue").WithArguments("Test.MyComponent.Value").WithLocation(21, 55)
]);
}

Expand Down Expand Up @@ -2462,12 +2462,12 @@ public class MyComponent : ComponentBase
AssertDocumentNodeMatchesBaseline(generated.CodeDocument);
AssertCSharpDocumentMatchesBaseline(generated.CodeDocument);
CompileToAssembly(generated, designTime ? [] : [
// (29,55): error CS0120: An object reference is required for the non-static field, method, or property 'MyComponent.Value'
// (21,55): error CS0120: An object reference is required for the non-static field, method, or property 'MyComponent.Value'
// __builder.AddComponentParameter(1, nameof(global::Test.MyComponent.
Diagnostic(ErrorCode.ERR_ObjectRequired, "global::Test.MyComponent.\r\n#nullable restore\r\n#line (1,20)-(1,25) \"x:\\dir\\subdir\\Test\\TestComponent.cshtml\"\r\nValue").WithArguments("Test.MyComponent.Value").WithLocation(29, 55),
// (46,55): error CS0120: An object reference is required for the non-static field, method, or property 'MyComponent.ValueChanged'
Diagnostic(ErrorCode.ERR_ObjectRequired, "global::Test.MyComponent.\r\n#nullable restore\r\n#line (1,20)-(1,25) \"x:\\dir\\subdir\\Test\\TestComponent.cshtml\"\r\nValue").WithArguments("Test.MyComponent.Value").WithLocation(21, 55),
// (38,55): error CS0120: An object reference is required for the non-static field, method, or property 'MyComponent.ValueChanged'
// __builder.AddComponentParameter(2, nameof(global::Test.MyComponent.ValueChanged), (global::System.Action<System.Int32>)(__value => ParentValue = __value));
Diagnostic(ErrorCode.ERR_ObjectRequired, "global::Test.MyComponent.ValueChanged").WithArguments("Test.MyComponent.ValueChanged").WithLocation(46, 55)
Diagnostic(ErrorCode.ERR_ObjectRequired, "global::Test.MyComponent.ValueChanged").WithArguments("Test.MyComponent.ValueChanged").WithLocation(38, 55)
]);
}

Expand Down Expand Up @@ -2625,9 +2625,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),
// (46,166): error CS0029: Cannot implicitly convert type 'int' to 'string'
// (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(46, 166)]);
Diagnostic(ErrorCode.ERR_NoImplicitConv, "__value").WithArguments("int", "string").WithLocation(38, 166)]);
}

[IntegrationTestFact]
Expand Down Expand Up @@ -2704,9 +2704,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),
// (46,351): error CS1503: Argument 2: cannot convert from 'Microsoft.AspNetCore.Components.EventCallback<string>' to 'Microsoft.AspNetCore.Components.EventCallback'
// (38,351): error CS1503: Argument 2: cannot convert from 'Microsoft.AspNetCore.Components.EventCallback<string>' to 'Microsoft.AspNetCore.Components.EventCallback'
// global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => ParentValue = __value, ParentValue)));
Diagnostic(ErrorCode.ERR_BadArgType, "global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => ParentValue = __value, ParentValue)").WithArguments("2", "Microsoft.AspNetCore.Components.EventCallback<string>", "Microsoft.AspNetCore.Components.EventCallback").WithLocation(46, 351)
Diagnostic(ErrorCode.ERR_BadArgType, "global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => ParentValue = __value, ParentValue)").WithArguments("2", "Microsoft.AspNetCore.Components.EventCallback<string>", "Microsoft.AspNetCore.Components.EventCallback").WithLocation(38, 351)
]
);
}
Expand Down Expand Up @@ -2911,12 +2911,12 @@ public class MyComponent : ComponentBase
// (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)]
: [// (47,274): error CS0029: Cannot implicitly convert type 'int' to 'string'
: [// (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(47, 274),
// (47,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
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(47, 274)
Diagnostic(ErrorCode.ERR_CantConvAnonMethReturns, "ParentValue").WithArguments("lambda expression").WithLocation(39, 274)
]);
}

Expand Down Expand Up @@ -10909,7 +10909,7 @@ public class Counter : ComponentBase
// Assert
CompileToAssembly(generated);
Assert.DoesNotContain("<Counter", generated.Code);
Assert.Contains("global::MyComponents.", generated.Code);
Assert.Contains("global::MyComponents.Counter", generated.Code);
}

[IntegrationTestFact]
Expand Down Expand Up @@ -11811,9 +11811,9 @@ public class MyComponent : ComponentBase
: [// x:\dir\subdir\Test\TestComponent.cshtml(1,32): error CS1003: Syntax error, ',' expected
// x
Diagnostic(ErrorCode.ERR_SyntaxError, "").WithArguments(",").WithLocation(1, 32),
// (37,88): error CS1501: No overload for method 'TypeCheck' takes 2 arguments
// (29,88): error CS1501: No overload for method 'TypeCheck' takes 2 arguments
// __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::System.String>(
Diagnostic(ErrorCode.ERR_BadArgCount, "TypeCheck<global::System.String>").WithArguments("TypeCheck", "2").WithLocation(37, 88)]
Diagnostic(ErrorCode.ERR_BadArgCount, "TypeCheck<global::System.String>").WithArguments("TypeCheck", "2").WithLocation(29, 88)]
);
Assert.NotEmpty(generated.RazorDiagnostics);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,7 @@ internal static class TypeInference
{
public static void CreateMyComponent_0<T>(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, global::Test.MyClass<T> __arg0, int __seq1, global::System.Boolean __arg1)
{
__builder.OpenComponent<global::Test.
#nullable restore
#line (1,2)-(1,13) "x:\dir\subdir\Test\TestComponent.cshtml"
MyComponent

#line default
#line hidden
#nullable disable
<T>>(seq);
__builder.OpenComponent<global::Test.MyComponent<T>>(seq);
__builder.AddAttribute(__seq0, nameof(global::Test.MyComponent<T>.
#nullable restore
#line (1,14)-(1,25) "x:\dir\subdir\Test\TestComponent.cshtml"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,13 @@ Generated Location: (1189:40,0 [42] )
private MyClass<string> c = new();
|

Source Location: (1:0,1 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|MyComponent|
Generated Location: (1766:59,0 [11] )
|MyComponent|

Source Location: (13:0,13 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|MyParameter|
Generated Location: (2007:68,0 [11] )
Generated Location: (1864:60,0 [11] )
|MyParameter|

Source Location: (29:0,29 [13] x:\dir\subdir\Test\TestComponent.cshtml)
|BoolParameter|
Generated Location: (2257:77,0 [13] )
Generated Location: (2114:69,0 [13] )
|BoolParameter|

Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,7 @@ internal static class TypeInference
{
public static void CreateMyComponent_0<T>(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, global::System.Boolean __arg0, int __seq1, global::System.String __arg1, int __seq2, global::System.Delegate __arg2, int __seq3, global::System.Object __arg3, int __seq4, global::Test.MyClass<T> __arg4, int __seq5, global::Microsoft.AspNetCore.Components.EventCallback<global::Test.MyClass<T>> __arg5)
{
__builder.OpenComponent<global::Test.
#nullable restore
#line (1,2)-(1,13) "x:\dir\subdir\Test\TestComponent.cshtml"
MyComponent

#line default
#line hidden
#nullable disable
<T>>(seq);
__builder.OpenComponent<global::Test.MyComponent<T>>(seq);
__builder.AddAttribute(__seq0, nameof(global::Test.MyComponent<T>.
#nullable restore
#line (2,5)-(2,18) "x:\dir\subdir\Test\TestComponent.cshtml"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,33 +27,28 @@ Generated Location: (1731:56,0 [42] )
private MyClass<string> c = new();
|

Source Location: (1:0,1 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|MyComponent|
Generated Location: (2535:75,0 [11] )
|MyComponent|

Source Location: (40:1,4 [13] x:\dir\subdir\Test\TestComponent.cshtml)
|BoolParameter|
Generated Location: (2775:84,0 [13] )
Generated Location: (2632:76,0 [13] )
|BoolParameter|

Source Location: (66:2,4 [15] x:\dir\subdir\Test\TestComponent.cshtml)
|StringParameter|
Generated Location: (3026:93,0 [15] )
Generated Location: (2883:85,0 [15] )
|StringParameter|

Source Location: (93:3,4 [17] x:\dir\subdir\Test\TestComponent.cshtml)
|DelegateParameter|
Generated Location: (3279:102,0 [17] )
Generated Location: (3136:94,0 [17] )
|DelegateParameter|

Source Location: (128:4,4 [15] x:\dir\subdir\Test\TestComponent.cshtml)
|ObjectParameter|
Generated Location: (3534:111,0 [15] )
Generated Location: (3391:103,0 [15] )
|ObjectParameter|

Source Location: (19:0,19 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|MyParameter|
Generated Location: (3788:120,0 [11] )
Generated Location: (3645:112,0 [11] )
|MyParameter|

Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,7 @@ public partial class TestComponent : global::Microsoft.AspNetCore.Components.Com
#pragma warning disable 1998
protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
{
__builder.OpenComponent<global::Test.
#nullable restore
#line (1,2)-(1,13) "x:\dir\subdir\Test\TestComponent.cshtml"
MyComponent

#line default
#line hidden
#nullable disable
>(0);
__builder.OpenComponent<global::Test.MyComponent>(0);
__builder.AddAttribute(1, "Value", (object)(
#nullable restore
#line (1,27)-(1,28) "x:\dir\subdir\Test\TestComponent.cshtml"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
Source Location: (1:0,1 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|MyComponent|
Generated Location: (786:22,0 [11] )
|MyComponent|

Source Location: (26:0,26 [1] x:\dir\subdir\Test\TestComponent.cshtml)
Source Location: (26:0,26 [1] x:\dir\subdir\Test\TestComponent.cshtml)
|c|
Generated Location: (1008:31,0 [1] )
Generated Location: (861:23,0 [1] )
|c|

Source Location: (42:2,7 [34] x:\dir\subdir\Test\TestComponent.cshtml)
|
private MyClass c = new();
|
Generated Location: (1448:43,0 [34] )
Generated Location: (1301:35,0 [34] )
|
private MyClass c = new();
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,7 @@ public partial class TestComponent : global::Microsoft.AspNetCore.Components.Com
#pragma warning disable 1998
protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
{
__builder.OpenComponent<global::Test.
#nullable restore
#line (1,2)-(1,13) "x:\dir\subdir\Test\TestComponent.cshtml"
MyComponent

#line default
#line hidden
#nullable disable
>(0);
__builder.OpenComponent<global::Test.MyComponent>(0);
__builder.AddAttribute(1, "Value", (object)(
#nullable restore
#line (1,27)-(1,34) "x:\dir\subdir\Test\TestComponent.cshtml"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
Source Location: (1:0,1 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|MyComponent|
Generated Location: (786:22,0 [11] )
|MyComponent|

Source Location: (26:0,26 [7] x:\dir\subdir\Test\TestComponent.cshtml)
Source Location: (26:0,26 [7] x:\dir\subdir\Test\TestComponent.cshtml)
|c1 = c2|
Generated Location: (1008:31,0 [7] )
Generated Location: (861:23,0 [7] )
|c1 = c2|

Source Location: (48:2,7 [68] x:\dir\subdir\Test\TestComponent.cshtml)
|
private MyClass c1 = new();
private MyClass c2 = new();
|
Generated Location: (1466:43,0 [68] )
Generated Location: (1319:35,0 [68] )
|
private MyClass c1 = new();
private MyClass c2 = new();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,7 @@ internal static class TypeInference
{
public static void CreateMyComponent_0<T>(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, global::Test.MyClass<T> __arg0, int __seq1, global::Microsoft.AspNetCore.Components.EventCallback __arg1, int __seq2, global::System.Boolean __arg2, int __seq3, global::System.String __arg3, int __seq4, global::System.Delegate __arg4, int __seq5, global::System.Object __arg5)
{
__builder.OpenComponent<global::Test.
#nullable restore
#line (1,2)-(1,13) "x:\dir\subdir\Test\TestComponent.cshtml"
MyComponent

#line default
#line hidden
#nullable disable
<T>>(seq);
__builder.OpenComponent<global::Test.MyComponent<T>>(seq);
__builder.AddAttribute(__seq0, nameof(global::Test.MyComponent<T>.
#nullable restore
#line (1,14)-(1,25) "x:\dir\subdir\Test\TestComponent.cshtml"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,38 +32,33 @@ Generated Location: (1757:64,0 [42] )
private MyClass<string> c = new();
|

Source Location: (1:0,1 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|MyComponent|
Generated Location: (2536:83,0 [11] )
|MyComponent|

Source Location: (13:0,13 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|MyParameter|
Generated Location: (2777:92,0 [11] )
Generated Location: (2634:84,0 [11] )
|MyParameter|

Source Location: (34:1,4 [7] x:\dir\subdir\Test\TestComponent.cshtml)
|MyEvent|
Generated Location: (3026:101,0 [7] )
Generated Location: (2883:93,0 [7] )
|MyEvent|

Source Location: (59:2,4 [13] x:\dir\subdir\Test\TestComponent.cshtml)
|BoolParameter|
Generated Location: (3271:110,0 [13] )
Generated Location: (3128:102,0 [13] )
|BoolParameter|

Source Location: (85:3,4 [15] x:\dir\subdir\Test\TestComponent.cshtml)
|StringParameter|
Generated Location: (3522:119,0 [15] )
Generated Location: (3379:111,0 [15] )
|StringParameter|

Source Location: (112:4,4 [17] x:\dir\subdir\Test\TestComponent.cshtml)
|DelegateParameter|
Generated Location: (3775:128,0 [17] )
Generated Location: (3632:120,0 [17] )
|DelegateParameter|

Source Location: (147:5,4 [15] x:\dir\subdir\Test\TestComponent.cshtml)
|ObjectParameter|
Generated Location: (4030:137,0 [15] )
Generated Location: (3887:129,0 [15] )
|ObjectParameter|

Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,7 @@ internal static class TypeInference
{
public static void CreateMyComponent_0<T>(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, global::Test.MyClass<T> __arg0, int __seq1, global::System.Boolean __arg1, int __seq2, global::System.String __arg2, int __seq3, global::System.Delegate __arg3, int __seq4, global::System.Object __arg4)
{
__builder.OpenComponent<global::Test.
#nullable restore
#line (1,2)-(1,13) "x:\dir\subdir\Test\TestComponent.cshtml"
MyComponent

#line default
#line hidden
#nullable disable
<T>>(seq);
__builder.OpenComponent<global::Test.MyComponent<T>>(seq);
__builder.AddAttribute(__seq0, nameof(global::Test.MyComponent<T>.
#nullable restore
#line (1,14)-(1,25) "x:\dir\subdir\Test\TestComponent.cshtml"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,33 +27,28 @@ Generated Location: (1518:56,0 [51] )
private readonly MyClass<string> c = new();
|

Source Location: (1:0,1 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|MyComponent|
Generated Location: (2232:75,0 [11] )
|MyComponent|

Source Location: (13:0,13 [11] x:\dir\subdir\Test\TestComponent.cshtml)
|MyParameter|
Generated Location: (2473:84,0 [11] )
Generated Location: (2330:76,0 [11] )
|MyParameter|

Source Location: (34:1,4 [13] x:\dir\subdir\Test\TestComponent.cshtml)
|BoolParameter|
Generated Location: (2722:93,0 [13] )
Generated Location: (2579:85,0 [13] )
|BoolParameter|

Source Location: (60:2,4 [15] x:\dir\subdir\Test\TestComponent.cshtml)
|StringParameter|
Generated Location: (2973:102,0 [15] )
Generated Location: (2830:94,0 [15] )
|StringParameter|

Source Location: (87:3,4 [17] x:\dir\subdir\Test\TestComponent.cshtml)
|DelegateParameter|
Generated Location: (3226:111,0 [17] )
Generated Location: (3083:103,0 [17] )
|DelegateParameter|

Source Location: (122:4,4 [15] x:\dir\subdir\Test\TestComponent.cshtml)
|ObjectParameter|
Generated Location: (3481:120,0 [15] )
Generated Location: (3338:112,0 [15] )
|ObjectParameter|

Loading