diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs index 3f328189d33..1362c42c0dd 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs @@ -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) ]); } @@ -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)(__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) ]); } @@ -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)(__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] @@ -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' to 'Microsoft.AspNetCore.Components.EventCallback' + // (38,351): error CS1503: Argument 2: cannot convert from 'Microsoft.AspNetCore.Components.EventCallback' 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", "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", "Microsoft.AspNetCore.Components.EventCallback").WithLocation(38, 351) ] ); } @@ -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>>(() => 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>>(() => 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>>(() => ParentValue)); - Diagnostic(ErrorCode.ERR_CantConvAnonMethReturns, "ParentValue").WithArguments("lambda expression").WithLocation(47, 274) + Diagnostic(ErrorCode.ERR_CantConvAnonMethReturns, "ParentValue").WithArguments("lambda expression").WithLocation(39, 274) ]); } @@ -10909,7 +10909,7 @@ public class Counter : ComponentBase // Assert CompileToAssembly(generated); Assert.DoesNotContain("( - Diagnostic(ErrorCode.ERR_BadArgCount, "TypeCheck").WithArguments("TypeCheck", "2").WithLocation(37, 88)] + Diagnostic(ErrorCode.ERR_BadArgCount, "TypeCheck").WithArguments("TypeCheck", "2").WithLocation(29, 88)] ); Assert.NotEmpty(generated.RazorDiagnostics); } diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/AddAttribute_ImplicitBooleanConversion/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/AddAttribute_ImplicitBooleanConversion/TestComponent.codegen.cs index 7d04368430e..243edfeb727 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/AddAttribute_ImplicitBooleanConversion/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/AddAttribute_ImplicitBooleanConversion/TestComponent.codegen.cs @@ -54,15 +54,7 @@ internal static class TypeInference { public static void CreateMyComponent_0(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, global::Test.MyClass __arg0, int __seq1, global::System.Boolean __arg1) { - __builder.OpenComponent