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 84f21cea83b..2f7df193acd 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs @@ -1141,6 +1141,25 @@ public class ComponentWithEditorRequiredParameters : ComponentBase Assert.Empty(generated.RazorDiagnostics); } + [IntegrationTestFact] + public void Component_WithEditorRequiredParameter_ValueSpecified_DifferentCasing() + { + AdditionalSyntaxTrees.Add(Parse(""" + using Microsoft.AspNetCore.Components; + namespace Test; + public class ComponentWithEditorRequiredParameters : ComponentBase + { + [Parameter, EditorRequired] public string Property1 { get; set; } + } + """)); + var generated = CompileToCSharp(""" + + """); + generated.RazorDiagnostics.Verify( + // x:\dir\subdir\Test\TestComponent.cshtml(1,1): warning RZ2012: Component 'ComponentWithEditorRequiredParameters' expects a value for the parameter 'Property1', but a value may not have been provided. + Diagnostic("RZ2012").WithLocation(1, 1)); + } + [IntegrationTestFact] public void Component_WithEditorRequiredParameter_ValuesSpecifiedUsingSplatting() { @@ -1198,6 +1217,25 @@ public class ComponentWithEditorRequiredParameters : ComponentBase Assert.Empty(generated.RazorDiagnostics); } + [IntegrationTestFact] + public void Component_WithEditorRequiredParameter_ValueSpecifiedUsingBind_DifferentCasing() + { + AdditionalSyntaxTrees.Add(Parse(""" + using Microsoft.AspNetCore.Components; + namespace Test; + public class ComponentWithEditorRequiredParameters : ComponentBase + { + [Parameter, EditorRequired] public string Property1 { get; set; } + } + """)); + var generated = CompileToCSharp(""" + + """); + generated.RazorDiagnostics.Verify( + // x:\dir\subdir\Test\TestComponent.cshtml(1,1): warning RZ2012: Component 'ComponentWithEditorRequiredParameters' expects a value for the parameter 'Property1', but a value may not have been provided. + Diagnostic("RZ2012").WithLocation(1, 1)); + } + [IntegrationTestFact, WorkItem("https://github.com/dotnet/razor/issues/10553")] public void Component_WithEditorRequiredParameter_ValueSpecifiedUsingBindGetSet() { @@ -1257,6 +1295,28 @@ public class ComponentWithEditorRequiredParameters : ComponentBase Assert.Empty(generated.RazorDiagnostics); } + [IntegrationTestFact] + public void Component_WithEditorRequiredParameter_ValueSpecifiedUsingBindGet_DifferentCasing() + { + AdditionalSyntaxTrees.Add(Parse(""" + using Microsoft.AspNetCore.Components; + namespace Test; + public class ComponentWithEditorRequiredParameters : ComponentBase + { + [Parameter, EditorRequired] public string Property1 { get; set; } + } + """)); + var generated = CompileToCSharp(""" + + @code { + private string myField = "Some Value"; + } + """); + generated.RazorDiagnostics.Verify( + // x:\dir\subdir\Test\TestComponent.cshtml(1,1): warning RZ2012: Component 'ComponentWithEditorRequiredParameters' expects a value for the parameter 'Property1', but a value may not have been provided. + Diagnostic("RZ2012").WithLocation(1, 1)); + } + [IntegrationTestFact, WorkItem("https://github.com/dotnet/razor/issues/10553")] public void Component_WithEditorRequiredParameter_ValueSpecifiedUsingBindSet() { @@ -1733,6 +1793,178 @@ public class MyComponent : ComponentBase CompileToAssembly(generated); } + [IntegrationTestFact, WorkItem("https://github.com/dotnet/aspnetcore/issues/48778")] + public void ImplicitStringConversion_ParameterCasing_AddAttribute() + { + _configuration = base.Configuration with { LanguageVersion = RazorLanguageVersion.Version_7_0 }; + + AdditionalSyntaxTrees.Add(Parse(""" + using Microsoft.AspNetCore.Components; + + namespace Test; + + public class MyClass + { + public static implicit operator string(MyClass c) => ""; + } + + public class MyComponent : ComponentBase + { + [Parameter] public string Placeholder { get; set; } = ""; + } + """)); + + var generated = CompileToCSharp(""" + + """); + + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + + [IntegrationTestFact, WorkItem("https://github.com/dotnet/aspnetcore/issues/48778")] + public void ImplicitStringConversion_ParameterCasing_AddComponentParameter() + { + AdditionalSyntaxTrees.Add(Parse(""" + using Microsoft.AspNetCore.Components; + + namespace Test; + + public class MyClass + { + public static implicit operator string(MyClass c) => ""; + } + + public class MyComponent : ComponentBase + { + [Parameter] public string Placeholder { get; set; } = ""; + } + """)); + + var generated = CompileToCSharp(""" + + """); + + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + + [IntegrationTestFact, WorkItem("https://github.com/dotnet/aspnetcore/issues/48778")] + public void ImplicitStringConversion_ParameterCasing_Multiple() + { + AdditionalSyntaxTrees.Add(Parse(""" + using Microsoft.AspNetCore.Components; + + namespace Test; + + public class MyClass + { + public static implicit operator string(MyClass c) => ""; + } + + public class MyComponent : ComponentBase + { + [Parameter] public string Placeholder { get; set; } = ""; + [Parameter] public string PlaceHolder { get; set; } = ""; + } + """)); + + var generated = CompileToCSharp(""" + + """); + + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + + [IntegrationTestFact, WorkItem("https://github.com/dotnet/aspnetcore/issues/48778")] + public void ImplicitStringConversion_ParameterCasing_Bind() + { + AdditionalSyntaxTrees.Add(Parse(""" + using Microsoft.AspNetCore.Components; + + namespace Test; + + public class MyComponent : ComponentBase + { + [Parameter] public string Placeholder { get; set; } = ""; + [Parameter] public EventCallback PlaceholderChanged { get; set; } + } + """)); + + var generated = CompileToCSharp(""" + + + @code { + private string s = "abc"; + } + """); + + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + + [IntegrationTestFact, WorkItem("https://github.com/dotnet/aspnetcore/issues/48778")] + public void ImplicitStringConversion_ParameterCasing_Bind_02() + { + AdditionalSyntaxTrees.Add(Parse(""" + using Microsoft.AspNetCore.Components; + + namespace Test; + + public class MyComponent : ComponentBase + { + [Parameter] public string Placeholder { get; set; } = ""; + [Parameter] public EventCallback PlaceholderChanged { get; set; } + } + """)); + + var generated = CompileToCSharp(""" + + + @code { + private string s = "abc"; + } + """); + + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + + [IntegrationTestFact, WorkItem("https://github.com/dotnet/aspnetcore/issues/48778")] + public void ImplicitStringConversion_ParameterCasing_Bind_03() + { + AdditionalSyntaxTrees.Add(Parse(""" + using Microsoft.AspNetCore.Components; + + namespace Test; + + public class MyComponent : ComponentBase + { + [Parameter] public string Placeholder { get; set; } = ""; + [Parameter] public EventCallback PlaceholderChanged { get; set; } + } + """)); + + var generated = CompileToCSharp(""" + + + @code { + private string s = "abc"; + private void Changed(string s) { } + } + """); + + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + [IntegrationTestFact, WorkItem("https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1869483")] public void AddComponentParameter() { diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Component_MatchingIsCaseSensitive/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Component_MatchingIsCaseSensitive/TestComponent.codegen.cs index 33c03ac0e13..174e2f08716 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Component_MatchingIsCaseSensitive/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Component_MatchingIsCaseSensitive/TestComponent.codegen.cs @@ -34,7 +34,15 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line default #line hidden #nullable disable - __o = ""; + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + 1 + +#line default +#line hidden +#nullable disable + ); __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( #nullable restore #line 3 "x:\dir\subdir\Test\TestComponent.cshtml" diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Component_MatchingIsCaseSensitive/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Component_MatchingIsCaseSensitive/TestComponent.ir.txt index 98bb70c721f..782dc2b27df 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Component_MatchingIsCaseSensitive/TestComponent.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Component_MatchingIsCaseSensitive/TestComponent.ir.txt @@ -21,8 +21,7 @@ HtmlContent - (32:1,15 [2] x:\dir\subdir\Test\TestComponent.cshtml) LazyIntermediateToken - (32:1,15 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n Component - (34:2,0 [51] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - ComponentAttribute - - intproperty - - AttributeStructure.SingleQuotes - HtmlContent - (60:2,26 [1] x:\dir\subdir\Test\TestComponent.cshtml) - LazyIntermediateToken - (60:2,26 [1] x:\dir\subdir\Test\TestComponent.cshtml) - Html - 1 + ComponentAttribute - (60:2,26 [1] x:\dir\subdir\Test\TestComponent.cshtml) - intproperty - IntProperty - AttributeStructure.SingleQuotes + LazyIntermediateToken - (60:2,26 [1] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - 1 ComponentAttribute - (77:2,43 [4] x:\dir\subdir\Test\TestComponent.cshtml) - BoolProperty - BoolProperty - AttributeStructure.SingleQuotes LazyIntermediateToken - (77:2,43 [4] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - true diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Component_MatchingIsCaseSensitive/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Component_MatchingIsCaseSensitive/TestComponent.mappings.txt index ee9075d4c77..80ef4dbe241 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Component_MatchingIsCaseSensitive/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Component_MatchingIsCaseSensitive/TestComponent.mappings.txt @@ -1,10 +1,15 @@ -Source Location: (77:2,43 [4] x:\dir\subdir\Test\TestComponent.cshtml) +Source Location: (60:2,26 [1] x:\dir\subdir\Test\TestComponent.cshtml) +|1| +Generated Location: (1459:39,26 [1] ) +|1| + +Source Location: (77:2,43 [4] x:\dir\subdir\Test\TestComponent.cshtml) |true| -Generated Location: (1501:40,43 [4] ) +Generated Location: (1767:48,43 [4] ) |true| Source Location: (63:2,29 [12] x:\dir\subdir\Test\TestComponent.cshtml) |BoolProperty| -Generated Location: (1929:53,29 [12] ) +Generated Location: (2195:61,29 [12] ) |BoolProperty| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_AddAttribute/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_AddAttribute/TestComponent.codegen.cs new file mode 100644 index 00000000000..266d3fc2716 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_AddAttribute/TestComponent.codegen.cs @@ -0,0 +1,50 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line default + using global::System; + using global::System.Collections.Generic; + using global::System.Linq; + using global::System.Threading.Tasks; + using global::Microsoft.AspNetCore.Components; + #line default + #line hidden + #nullable restore + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + #nullable disable + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + new MyClass() + +#line default +#line hidden +#nullable disable + ); + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { + } + )); +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 + } +} +#pragma warning restore 1591 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_AddAttribute/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_AddAttribute/TestComponent.ir.txt new file mode 100644 index 00000000000..1439019c433 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_AddAttribute/TestComponent.ir.txt @@ -0,0 +1,20 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [20] ) - global::System + UsingDirective - (26:2,1 [40] ) - global::System.Collections.Generic + UsingDirective - (69:3,1 [25] ) - global::System.Linq + UsingDirective - (97:4,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (136:5,1 [45] ) - global::Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + DesignTimeDirective - + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [46] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (26:0,26 [16] x:\dir\subdir\Test\TestComponent.cshtml) - PlaceHolder - Placeholder - AttributeStructure.DoubleQuotes + CSharpExpression - (28:0,28 [13] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (28:0,28 [13] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - new MyClass() diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_AddAttribute/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_AddAttribute/TestComponent.mappings.txt new file mode 100644 index 00000000000..5dfb130c665 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_AddAttribute/TestComponent.mappings.txt @@ -0,0 +1,5 @@ +Source Location: (28:0,28 [13] x:\dir\subdir\Test\TestComponent.cshtml) +|new MyClass()| +Generated Location: (1138:29,28 [13] ) +|new MyClass()| + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_AddComponentParameter/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_AddComponentParameter/TestComponent.codegen.cs new file mode 100644 index 00000000000..266d3fc2716 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_AddComponentParameter/TestComponent.codegen.cs @@ -0,0 +1,50 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line default + using global::System; + using global::System.Collections.Generic; + using global::System.Linq; + using global::System.Threading.Tasks; + using global::Microsoft.AspNetCore.Components; + #line default + #line hidden + #nullable restore + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + #nullable disable + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + new MyClass() + +#line default +#line hidden +#nullable disable + ); + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { + } + )); +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 + } +} +#pragma warning restore 1591 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_AddComponentParameter/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_AddComponentParameter/TestComponent.ir.txt new file mode 100644 index 00000000000..1439019c433 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_AddComponentParameter/TestComponent.ir.txt @@ -0,0 +1,20 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [20] ) - global::System + UsingDirective - (26:2,1 [40] ) - global::System.Collections.Generic + UsingDirective - (69:3,1 [25] ) - global::System.Linq + UsingDirective - (97:4,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (136:5,1 [45] ) - global::Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + DesignTimeDirective - + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [46] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (26:0,26 [16] x:\dir\subdir\Test\TestComponent.cshtml) - PlaceHolder - Placeholder - AttributeStructure.DoubleQuotes + CSharpExpression - (28:0,28 [13] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (28:0,28 [13] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - new MyClass() diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_AddComponentParameter/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_AddComponentParameter/TestComponent.mappings.txt new file mode 100644 index 00000000000..5dfb130c665 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_AddComponentParameter/TestComponent.mappings.txt @@ -0,0 +1,5 @@ +Source Location: (28:0,28 [13] x:\dir\subdir\Test\TestComponent.cshtml) +|new MyClass()| +Generated Location: (1138:29,28 [13] ) +|new MyClass()| + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind/TestComponent.codegen.cs new file mode 100644 index 00000000000..a1a98292df5 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind/TestComponent.codegen.cs @@ -0,0 +1,60 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line default + using global::System; + using global::System.Collections.Generic; + using global::System.Linq; + using global::System.Threading.Tasks; + using global::Microsoft.AspNetCore.Components; + #line default + #line hidden + #nullable restore + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + #nullable disable + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + s + +#line default +#line hidden +#nullable disable + ); + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, + global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => s = __value, s))); + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { + } + )); +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + + private string s = "abc"; + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind/TestComponent.ir.txt new file mode 100644 index 00000000000..d8f2902a0b7 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind/TestComponent.ir.txt @@ -0,0 +1,29 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [20] ) - global::System + UsingDirective - (26:2,1 [40] ) - global::System.Collections.Generic + UsingDirective - (69:3,1 [25] ) - global::System.Linq + UsingDirective - (97:4,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (136:5,1 [45] ) - global::Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + DesignTimeDirective - + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [37] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (32:0,32 [1] x:\dir\subdir\Test\TestComponent.cshtml) - PlaceHolder - Placeholder - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (32:0,32 [1] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - s + ComponentAttribute - (32:0,32 [1] x:\dir\subdir\Test\TestComponent.cshtml) - PlaceHolderChanged - PlaceholderChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - __value => s = __value + IntermediateToken - - CSharp - , s) + HtmlContent - (37:0,37 [4] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (37:0,37 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n + CSharpCode - (48:2,7 [33] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (48:2,7 [33] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private string s = "abc";\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind/TestComponent.mappings.txt new file mode 100644 index 00000000000..00a86297a89 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind/TestComponent.mappings.txt @@ -0,0 +1,14 @@ +Source Location: (32:0,32 [1] x:\dir\subdir\Test\TestComponent.cshtml) +|s| +Generated Location: (1142:29,32 [1] ) +|s| + +Source Location: (48:2,7 [33] x:\dir\subdir\Test\TestComponent.cshtml) +| + private string s = "abc"; +| +Generated Location: (2088:51,7 [33] ) +| + private string s = "abc"; +| + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_02/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_02/TestComponent.codegen.cs new file mode 100644 index 00000000000..d5f40bfc401 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_02/TestComponent.codegen.cs @@ -0,0 +1,58 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line default + using global::System; + using global::System.Collections.Generic; + using global::System.Linq; + using global::System.Threading.Tasks; + using global::Microsoft.AspNetCore.Components; + #line default + #line hidden + #nullable restore + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + #nullable disable + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + s + +#line default +#line hidden +#nullable disable + ; + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { + } + )); +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + + private string s = "abc"; + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_02/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_02/TestComponent.ir.txt new file mode 100644 index 00000000000..1e6c71ab412 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_02/TestComponent.ir.txt @@ -0,0 +1,24 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [20] ) - global::System + UsingDirective - (26:2,1 [40] ) - global::System.Collections.Generic + UsingDirective - (69:3,1 [25] ) - global::System.Linq + UsingDirective - (97:4,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (136:5,1 [45] ) - global::Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + DesignTimeDirective - + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [38] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - - @Bind-Placeholder - - AttributeStructure.DoubleQuotes + CSharpExpression - (32:0,32 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (33:0,33 [1] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - s + HtmlContent - (38:0,38 [4] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (38:0,38 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n + CSharpCode - (49:2,7 [33] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (49:2,7 [33] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private string s = "abc";\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_02/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_02/TestComponent.mappings.txt new file mode 100644 index 00000000000..47657f51246 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_02/TestComponent.mappings.txt @@ -0,0 +1,14 @@ +Source Location: (33:0,33 [1] x:\dir\subdir\Test\TestComponent.cshtml) +|s| +Generated Location: (1038:29,33 [1] ) +|s| + +Source Location: (49:2,7 [33] x:\dir\subdir\Test\TestComponent.cshtml) +| + private string s = "abc"; +| +Generated Location: (1556:49,7 [33] ) +| + private string s = "abc"; +| + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_03/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_03/TestComponent.codegen.cs new file mode 100644 index 00000000000..09aa2dbeda4 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_03/TestComponent.codegen.cs @@ -0,0 +1,60 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line default + using global::System; + using global::System.Collections.Generic; + using global::System.Linq; + using global::System.Threading.Tasks; + using global::Microsoft.AspNetCore.Components; + #line default + #line hidden + #nullable restore + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + #nullable disable + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + s + +#line default +#line hidden +#nullable disable + ; + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => s = __value, s); + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { + } + )); +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + + private string s = "abc"; + private void Changed(string s) { } + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_03/TestComponent.diagnostics.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_03/TestComponent.diagnostics.txt new file mode 100644 index 00000000000..817d6e387c8 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_03/TestComponent.diagnostics.txt @@ -0,0 +1 @@ +x:\dir\subdir\Test\TestComponent.cshtml(1,63): Error RZ10016: Attribute 'bind-Placeholder:set' was used but no attribute 'bind-Placeholder:get' was found. diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_03/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_03/TestComponent.ir.txt new file mode 100644 index 00000000000..ed2adadf302 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_03/TestComponent.ir.txt @@ -0,0 +1,29 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [20] ) - global::System + UsingDirective - (26:2,1 [40] ) - global::System.Collections.Generic + UsingDirective - (69:3,1 [25] ) - global::System.Linq + UsingDirective - (97:4,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (136:5,1 [45] ) - global::Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + DesignTimeDirective - + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [73] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (36:0,36 [1] x:\dir\subdir\Test\TestComponent.cshtml) - Placeholder:Get - - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (36:0,36 [1] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - s + ComponentAttribute - (36:0,36 [1] x:\dir\subdir\Test\TestComponent.cshtml) - Placeholder:GetChanged - - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - __value => s = __value + IntermediateToken - - CSharp - , s) + HtmlContent - (73:0,73 [4] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (73:0,73 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n + CSharpCode - (84:2,7 [73] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (84:2,7 [73] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private string s = "abc";\n private void Changed(string s) { }\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_03/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_03/TestComponent.mappings.txt new file mode 100644 index 00000000000..0f956ee67a7 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_03/TestComponent.mappings.txt @@ -0,0 +1,16 @@ +Source Location: (36:0,36 [1] x:\dir\subdir\Test\TestComponent.cshtml) +|s| +Generated Location: (1041:29,36 [1] ) +|s| + +Source Location: (84:2,7 [73] x:\dir\subdir\Test\TestComponent.cshtml) +| + private string s = "abc"; + private void Changed(string s) { } +| +Generated Location: (1712:50,7 [73] ) +| + private string s = "abc"; + private void Changed(string s) { } +| + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Multiple/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Multiple/TestComponent.codegen.cs new file mode 100644 index 00000000000..266d3fc2716 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Multiple/TestComponent.codegen.cs @@ -0,0 +1,50 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line default + using global::System; + using global::System.Collections.Generic; + using global::System.Linq; + using global::System.Threading.Tasks; + using global::Microsoft.AspNetCore.Components; + #line default + #line hidden + #nullable restore + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + #nullable disable + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + new MyClass() + +#line default +#line hidden +#nullable disable + ); + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { + } + )); +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 + } +} +#pragma warning restore 1591 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Multiple/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Multiple/TestComponent.ir.txt new file mode 100644 index 00000000000..1439019c433 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Multiple/TestComponent.ir.txt @@ -0,0 +1,20 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [20] ) - global::System + UsingDirective - (26:2,1 [40] ) - global::System.Collections.Generic + UsingDirective - (69:3,1 [25] ) - global::System.Linq + UsingDirective - (97:4,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (136:5,1 [45] ) - global::Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + DesignTimeDirective - + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [46] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (26:0,26 [16] x:\dir\subdir\Test\TestComponent.cshtml) - PlaceHolder - Placeholder - AttributeStructure.DoubleQuotes + CSharpExpression - (28:0,28 [13] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (28:0,28 [13] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - new MyClass() diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Multiple/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Multiple/TestComponent.mappings.txt new file mode 100644 index 00000000000..5dfb130c665 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Multiple/TestComponent.mappings.txt @@ -0,0 +1,5 @@ +Source Location: (28:0,28 [13] x:\dir\subdir\Test\TestComponent.cshtml) +|new MyClass()| +Generated Location: (1138:29,28 [13] ) +|new MyClass()| + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_MatchingIsCaseSensitive/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_MatchingIsCaseSensitive/TestComponent.codegen.cs index 5a0c90c147e..ad0df196a80 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_MatchingIsCaseSensitive/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_MatchingIsCaseSensitive/TestComponent.codegen.cs @@ -21,7 +21,23 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. __builder.CloseComponent(); __builder.AddMarkupContent(1, "\r\n\r\n"); __builder.OpenComponent(2); - __builder.AddComponentParameter(3, "intproperty", "1"); + __builder.AddComponentParameter(3, nameof(global::Test.MyComponent. +#nullable restore +#line (3,14)-(3,25) "x:\dir\subdir\Test\TestComponent.cshtml" +IntProperty + +#line default +#line hidden +#nullable disable + ), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line (3,27)-(3,28) "x:\dir\subdir\Test\TestComponent.cshtml" +1 + +#line default +#line hidden +#nullable disable + )); __builder.AddComponentParameter(4, nameof(global::Test.MyComponent. #nullable restore #line (3,30)-(3,42) "x:\dir\subdir\Test\TestComponent.cshtml" diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_MatchingIsCaseSensitive/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_MatchingIsCaseSensitive/TestComponent.ir.txt index 73801308916..0ae2e9d028c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_MatchingIsCaseSensitive/TestComponent.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_MatchingIsCaseSensitive/TestComponent.ir.txt @@ -10,8 +10,7 @@ Component - (0:0,0 [15] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent MarkupBlock - - \n\n Component - (34:2,0 [51] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent - ComponentAttribute - - intproperty - - AttributeStructure.SingleQuotes - HtmlContent - (60:2,26 [1] x:\dir\subdir\Test\TestComponent.cshtml) - LazyIntermediateToken - (60:2,26 [1] x:\dir\subdir\Test\TestComponent.cshtml) - Html - 1 + ComponentAttribute - (60:2,26 [1] x:\dir\subdir\Test\TestComponent.cshtml) - intproperty - IntProperty - AttributeStructure.SingleQuotes + LazyIntermediateToken - (60:2,26 [1] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - 1 ComponentAttribute - (77:2,43 [4] x:\dir\subdir\Test\TestComponent.cshtml) - BoolProperty - BoolProperty - AttributeStructure.SingleQuotes LazyIntermediateToken - (77:2,43 [4] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - true diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_MatchingIsCaseSensitive/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_MatchingIsCaseSensitive/TestComponent.mappings.txt index 1ea450a69b9..5b4cb92abc6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_MatchingIsCaseSensitive/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_MatchingIsCaseSensitive/TestComponent.mappings.txt @@ -1,10 +1,20 @@ -Source Location: (63:2,29 [12] x:\dir\subdir\Test\TestComponent.cshtml) +Source Location: (47:2,13 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|intproperty| +Generated Location: (1075:26,0 [11] ) +|IntProperty| + +Source Location: (60:2,26 [1] x:\dir\subdir\Test\TestComponent.cshtml) +|1| +Generated Location: (1341:34,0 [1] ) +|1| + +Source Location: (63:2,29 [12] x:\dir\subdir\Test\TestComponent.cshtml) |BoolProperty| -Generated Location: (1144:27,0 [12] ) +Generated Location: (1574:43,0 [12] ) |BoolProperty| Source Location: (77:2,43 [4] x:\dir\subdir\Test\TestComponent.cshtml) |true| -Generated Location: (1413:35,0 [4] ) +Generated Location: (1843:51,0 [4] ) |true| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_AddAttribute/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_AddAttribute/TestComponent.codegen.cs new file mode 100644 index 00000000000..04335dd0de6 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_AddAttribute/TestComponent.codegen.cs @@ -0,0 +1,43 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line default + using global::System; + using global::System.Collections.Generic; + using global::System.Linq; + using global::System.Threading.Tasks; + using global::Microsoft.AspNetCore.Components; + #line default + #line hidden + #nullable restore + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + #nullable disable + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenComponent(0); + __builder.AddAttribute(1, nameof(global::Test.MyComponent. +#nullable restore +#line (1,14)-(1,25) "x:\dir\subdir\Test\TestComponent.cshtml" +Placeholder + +#line default +#line hidden +#nullable disable + ), (object)(global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line (1,29)-(1,42) "x:\dir\subdir\Test\TestComponent.cshtml" +new MyClass() + +#line default +#line hidden +#nullable disable + ))); + __builder.CloseComponent(); + } + #pragma warning restore 1998 + } +} +#pragma warning restore 1591 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_AddAttribute/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_AddAttribute/TestComponent.ir.txt new file mode 100644 index 00000000000..0a447d92579 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_AddAttribute/TestComponent.ir.txt @@ -0,0 +1,13 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [22] ) - global::System + UsingDirective - (26:2,1 [42] ) - global::System.Collections.Generic + UsingDirective - (69:3,1 [27] ) - global::System.Linq + UsingDirective - (97:4,1 [38] ) - global::System.Threading.Tasks + UsingDirective - (136:5,1 [47] ) - global::Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [46] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (26:0,26 [16] x:\dir\subdir\Test\TestComponent.cshtml) - PlaceHolder - Placeholder - AttributeStructure.DoubleQuotes + CSharpExpression - (28:0,28 [13] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (28:0,28 [13] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - new MyClass() diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_AddAttribute/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_AddAttribute/TestComponent.mappings.txt new file mode 100644 index 00000000000..b01cda0ae12 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_AddAttribute/TestComponent.mappings.txt @@ -0,0 +1,10 @@ +Source Location: (13:0,13 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|PlaceHolder| +Generated Location: (875:23,0 [11] ) +|Placeholder| + +Source Location: (28:0,28 [13] x:\dir\subdir\Test\TestComponent.cshtml) +|new MyClass()| +Generated Location: (1151:31,0 [13] ) +|new MyClass()| + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_AddComponentParameter/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_AddComponentParameter/TestComponent.codegen.cs new file mode 100644 index 00000000000..8a15e19fa41 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_AddComponentParameter/TestComponent.codegen.cs @@ -0,0 +1,43 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line default + using global::System; + using global::System.Collections.Generic; + using global::System.Linq; + using global::System.Threading.Tasks; + using global::Microsoft.AspNetCore.Components; + #line default + #line hidden + #nullable restore + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + #nullable disable + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenComponent(0); + __builder.AddComponentParameter(1, nameof(global::Test.MyComponent. +#nullable restore +#line (1,14)-(1,25) "x:\dir\subdir\Test\TestComponent.cshtml" +Placeholder + +#line default +#line hidden +#nullable disable + ), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line (1,29)-(1,42) "x:\dir\subdir\Test\TestComponent.cshtml" +new MyClass() + +#line default +#line hidden +#nullable disable + )); + __builder.CloseComponent(); + } + #pragma warning restore 1998 + } +} +#pragma warning restore 1591 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_AddComponentParameter/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_AddComponentParameter/TestComponent.ir.txt new file mode 100644 index 00000000000..0a447d92579 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_AddComponentParameter/TestComponent.ir.txt @@ -0,0 +1,13 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [22] ) - global::System + UsingDirective - (26:2,1 [42] ) - global::System.Collections.Generic + UsingDirective - (69:3,1 [27] ) - global::System.Linq + UsingDirective - (97:4,1 [38] ) - global::System.Threading.Tasks + UsingDirective - (136:5,1 [47] ) - global::Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [46] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (26:0,26 [16] x:\dir\subdir\Test\TestComponent.cshtml) - PlaceHolder - Placeholder - AttributeStructure.DoubleQuotes + CSharpExpression - (28:0,28 [13] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (28:0,28 [13] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - new MyClass() diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_AddComponentParameter/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_AddComponentParameter/TestComponent.mappings.txt new file mode 100644 index 00000000000..70756d5b4e6 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_AddComponentParameter/TestComponent.mappings.txt @@ -0,0 +1,10 @@ +Source Location: (13:0,13 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|PlaceHolder| +Generated Location: (884:23,0 [11] ) +|Placeholder| + +Source Location: (28:0,28 [13] x:\dir\subdir\Test\TestComponent.cshtml) +|new MyClass()| +Generated Location: (1151:31,0 [13] ) +|new MyClass()| + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind/TestComponent.codegen.cs new file mode 100644 index 00000000000..f3b38663347 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind/TestComponent.codegen.cs @@ -0,0 +1,53 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line default + using global::System; + using global::System.Collections.Generic; + using global::System.Linq; + using global::System.Threading.Tasks; + using global::Microsoft.AspNetCore.Components; + #line default + #line hidden + #nullable restore + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + #nullable disable + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenComponent(0); + __builder.AddComponentParameter(1, nameof(global::Test.MyComponent. +#nullable restore +#line (1,20)-(1,31) "x:\dir\subdir\Test\TestComponent.cshtml" +Placeholder + +#line default +#line hidden +#nullable disable + ), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line (1,33)-(1,34) "x:\dir\subdir\Test\TestComponent.cshtml" +s + +#line default +#line hidden +#nullable disable + )); + __builder.AddComponentParameter(2, nameof(global::Test.MyComponent.PlaceholderChanged), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => s = __value, s)))); + __builder.CloseComponent(); + } + #pragma warning restore 1998 +#nullable restore +#line (3,8)-(5,1) "x:\dir\subdir\Test\TestComponent.cshtml" + + private string s = "abc"; + +#line default +#line hidden +#nullable disable + + } +} +#pragma warning restore 1591 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind/TestComponent.ir.txt new file mode 100644 index 00000000000..ff6ad5db165 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind/TestComponent.ir.txt @@ -0,0 +1,20 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [22] ) - global::System + UsingDirective - (26:2,1 [42] ) - global::System.Collections.Generic + UsingDirective - (69:3,1 [27] ) - global::System.Linq + UsingDirective - (97:4,1 [38] ) - global::System.Threading.Tasks + UsingDirective - (136:5,1 [47] ) - global::Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [37] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (32:0,32 [1] x:\dir\subdir\Test\TestComponent.cshtml) - PlaceHolder - Placeholder - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (32:0,32 [1] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - s + ComponentAttribute - (32:0,32 [1] x:\dir\subdir\Test\TestComponent.cshtml) - PlaceHolderChanged - PlaceholderChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - __value => s = __value + IntermediateToken - - CSharp - , s) + CSharpCode - (48:2,7 [33] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (48:2,7 [33] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private string s = "abc";\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind/TestComponent.mappings.txt new file mode 100644 index 00000000000..376104183be --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind/TestComponent.mappings.txt @@ -0,0 +1,19 @@ +Source Location: (19:0,19 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|PlaceHolder| +Generated Location: (884:23,0 [11] ) +|Placeholder| + +Source Location: (32:0,32 [1] x:\dir\subdir\Test\TestComponent.cshtml) +|s| +Generated Location: (1151:31,0 [1] ) +|s| + +Source Location: (48:2,7 [33] x:\dir\subdir\Test\TestComponent.cshtml) +| + private string s = "abc"; +| +Generated Location: (1887:43,0 [33] ) +| + private string s = "abc"; +| + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_02/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_02/TestComponent.codegen.cs new file mode 100644 index 00000000000..88e989c97f3 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_02/TestComponent.codegen.cs @@ -0,0 +1,44 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line default + using global::System; + using global::System.Collections.Generic; + using global::System.Linq; + using global::System.Threading.Tasks; + using global::Microsoft.AspNetCore.Components; + #line default + #line hidden + #nullable restore + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + #nullable disable + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenComponent(0); + __builder.AddComponentParameter(1, "@Bind-Placeholder", +#nullable restore +#line (1,34)-(1,35) "x:\dir\subdir\Test\TestComponent.cshtml" +s + +#line default +#line hidden +#nullable disable + ); + __builder.CloseComponent(); + } + #pragma warning restore 1998 +#nullable restore +#line (3,8)-(5,1) "x:\dir\subdir\Test\TestComponent.cshtml" + + private string s = "abc"; + +#line default +#line hidden +#nullable disable + + } +} +#pragma warning restore 1591 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_02/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_02/TestComponent.ir.txt new file mode 100644 index 00000000000..d28e317d119 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_02/TestComponent.ir.txt @@ -0,0 +1,15 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [22] ) - global::System + UsingDirective - (26:2,1 [42] ) - global::System.Collections.Generic + UsingDirective - (69:3,1 [27] ) - global::System.Linq + UsingDirective - (97:4,1 [38] ) - global::System.Threading.Tasks + UsingDirective - (136:5,1 [47] ) - global::Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [38] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - - @Bind-Placeholder - - AttributeStructure.DoubleQuotes + CSharpExpression - (32:0,32 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (33:0,33 [1] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - s + CSharpCode - (49:2,7 [33] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (49:2,7 [33] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private string s = "abc";\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_02/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_02/TestComponent.mappings.txt new file mode 100644 index 00000000000..1ed51a1dc34 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_02/TestComponent.mappings.txt @@ -0,0 +1,14 @@ +Source Location: (33:0,33 [1] x:\dir\subdir\Test\TestComponent.cshtml) +|s| +Generated Location: (873:23,0 [1] ) +|s| + +Source Location: (49:2,7 [33] x:\dir\subdir\Test\TestComponent.cshtml) +| + private string s = "abc"; +| +Generated Location: (1112:34,0 [33] ) +| + private string s = "abc"; +| + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_03/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_03/TestComponent.codegen.cs new file mode 100644 index 00000000000..46a6ee4796a --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_03/TestComponent.codegen.cs @@ -0,0 +1,46 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line default + using global::System; + using global::System.Collections.Generic; + using global::System.Linq; + using global::System.Threading.Tasks; + using global::Microsoft.AspNetCore.Components; + #line default + #line hidden + #nullable restore + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + #nullable disable + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenComponent(0); + __builder.AddComponentParameter(1, "Placeholder:Get", +#nullable restore +#line (1,37)-(1,38) "x:\dir\subdir\Test\TestComponent.cshtml" +s + +#line default +#line hidden +#nullable disable + ); + __builder.AddComponentParameter(2, "Placeholder:GetChanged", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => s = __value, s)); + __builder.CloseComponent(); + } + #pragma warning restore 1998 +#nullable restore +#line (3,8)-(6,1) "x:\dir\subdir\Test\TestComponent.cshtml" + + private string s = "abc"; + private void Changed(string s) { } + +#line default +#line hidden +#nullable disable + + } +} +#pragma warning restore 1591 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_03/TestComponent.diagnostics.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_03/TestComponent.diagnostics.txt new file mode 100644 index 00000000000..817d6e387c8 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_03/TestComponent.diagnostics.txt @@ -0,0 +1 @@ +x:\dir\subdir\Test\TestComponent.cshtml(1,63): Error RZ10016: Attribute 'bind-Placeholder:set' was used but no attribute 'bind-Placeholder:get' was found. diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_03/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_03/TestComponent.ir.txt new file mode 100644 index 00000000000..d06ffd425a3 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_03/TestComponent.ir.txt @@ -0,0 +1,20 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [22] ) - global::System + UsingDirective - (26:2,1 [42] ) - global::System.Collections.Generic + UsingDirective - (69:3,1 [27] ) - global::System.Linq + UsingDirective - (97:4,1 [38] ) - global::System.Threading.Tasks + UsingDirective - (136:5,1 [47] ) - global::Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [73] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (36:0,36 [1] x:\dir\subdir\Test\TestComponent.cshtml) - Placeholder:Get - - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (36:0,36 [1] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - s + ComponentAttribute - (36:0,36 [1] x:\dir\subdir\Test\TestComponent.cshtml) - Placeholder:GetChanged - - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - __value => s = __value + IntermediateToken - - CSharp - , s) + CSharpCode - (84:2,7 [73] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (84:2,7 [73] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private string s = "abc";\n private void Changed(string s) { }\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_03/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_03/TestComponent.mappings.txt new file mode 100644 index 00000000000..05e5eedb366 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Bind_03/TestComponent.mappings.txt @@ -0,0 +1,16 @@ +Source Location: (36:0,36 [1] x:\dir\subdir\Test\TestComponent.cshtml) +|s| +Generated Location: (871:23,0 [1] ) +|s| + +Source Location: (84:2,7 [73] x:\dir\subdir\Test\TestComponent.cshtml) +| + private string s = "abc"; + private void Changed(string s) { } +| +Generated Location: (1319:35,0 [73] ) +| + private string s = "abc"; + private void Changed(string s) { } +| + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Multiple/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Multiple/TestComponent.codegen.cs new file mode 100644 index 00000000000..8a15e19fa41 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Multiple/TestComponent.codegen.cs @@ -0,0 +1,43 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line default + using global::System; + using global::System.Collections.Generic; + using global::System.Linq; + using global::System.Threading.Tasks; + using global::Microsoft.AspNetCore.Components; + #line default + #line hidden + #nullable restore + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + #nullable disable + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenComponent(0); + __builder.AddComponentParameter(1, nameof(global::Test.MyComponent. +#nullable restore +#line (1,14)-(1,25) "x:\dir\subdir\Test\TestComponent.cshtml" +Placeholder + +#line default +#line hidden +#nullable disable + ), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line (1,29)-(1,42) "x:\dir\subdir\Test\TestComponent.cshtml" +new MyClass() + +#line default +#line hidden +#nullable disable + )); + __builder.CloseComponent(); + } + #pragma warning restore 1998 + } +} +#pragma warning restore 1591 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Multiple/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Multiple/TestComponent.ir.txt new file mode 100644 index 00000000000..0a447d92579 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Multiple/TestComponent.ir.txt @@ -0,0 +1,13 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [22] ) - global::System + UsingDirective - (26:2,1 [42] ) - global::System.Collections.Generic + UsingDirective - (69:3,1 [27] ) - global::System.Linq + UsingDirective - (97:4,1 [38] ) - global::System.Threading.Tasks + UsingDirective - (136:5,1 [47] ) - global::Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [46] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (26:0,26 [16] x:\dir\subdir\Test\TestComponent.cshtml) - PlaceHolder - Placeholder - AttributeStructure.DoubleQuotes + CSharpExpression - (28:0,28 [13] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (28:0,28 [13] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - new MyClass() diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Multiple/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Multiple/TestComponent.mappings.txt new file mode 100644 index 00000000000..70756d5b4e6 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ImplicitStringConversion_ParameterCasing_Multiple/TestComponent.mappings.txt @@ -0,0 +1,10 @@ +Source Location: (13:0,13 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|PlaceHolder| +Generated Location: (884:23,0 [11] ) +|Placeholder| + +Source Location: (28:0,28 [13] x:\dir\subdir\Test\TestComponent.cshtml) +|new MyClass()| +Generated Location: (1151:31,0 [13] ) +|new MyClass()| + diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/CSharp/ComponentTagHelperDescriptorProvider.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/CSharp/ComponentTagHelperDescriptorProvider.cs index 26e350f2aea..55c244c0500 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/CSharp/ComponentTagHelperDescriptorProvider.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/CSharp/ComponentTagHelperDescriptorProvider.cs @@ -207,6 +207,8 @@ private static void CreateProperty(TagHelperDescriptorBuilder builder, INamedTyp pb.IsEditorRequired = property.GetAttributes().Any( static a => a.AttributeClass.HasFullName("Microsoft.AspNetCore.Components.EditorRequiredAttribute")); + pb.CaseSensitive = false; + metadata.Add(PropertyName(property.Name)); metadata.Add(GloballyQualifiedTypeName(property.Type.ToDisplayString(GloballyQualifiedFullNameTypeDisplayFormat))); diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/BoundAttributeDescriptorBuilder.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/BoundAttributeDescriptorBuilder.cs index 77c347e9808..071c20535fe 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/BoundAttributeDescriptorBuilder.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/BoundAttributeDescriptorBuilder.cs @@ -39,6 +39,7 @@ public sealed partial class BoundAttributeDescriptorBuilder : TagHelperObjectBui private string _kind; private DocumentationObject _documentationObject; private MetadataHolder _metadata; + private bool? _caseSensitive; private BoundAttributeDescriptorBuilder() { @@ -76,7 +77,11 @@ public string? Documentation public bool TryGetMetadataValue(string key, [NotNullWhen(true)] out string? value) => _metadata.TryGetMetadataValue(key, out value); - internal bool CaseSensitive => _parent.CaseSensitive; + internal bool CaseSensitive + { + get => _caseSensitive ?? _parent.CaseSensitive; + set => _caseSensitive = value; + } private TagHelperObjectBuilderCollection Parameters { get; } = new(BoundAttributeParameterDescriptorBuilder.Pool); diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/BoundAttributeDescriptorBuilder_Pooling.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/BoundAttributeDescriptorBuilder_Pooling.cs index 24ca4757aa6..28d66b2ab4a 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/BoundAttributeDescriptorBuilder_Pooling.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/BoundAttributeDescriptorBuilder_Pooling.cs @@ -25,6 +25,7 @@ private protected override void Reset() _parent = null; _kind = null; _documentationObject = default; + _caseSensitive = null; Name = null; TypeName = null; diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentBindLoweringPass.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentBindLoweringPass.cs index 5a13ea30750..5c67866a287 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentBindLoweringPass.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentBindLoweringPass.cs @@ -726,21 +726,27 @@ private bool TryComputeAttributeNames( expressionAttributeName = valueAttributeName + "Expression"; } - foreach (var attribute in componentTagHelper.BoundAttributes) + for (int i = componentTagHelper.BoundAttributes.Length - 1, set = 0; i >= 0 && set != 3; i--) { - if (string.Equals(valueAttributeName, attribute.Name)) + var attribute = componentTagHelper.BoundAttributes[i]; + var comparison = attribute.GetComparison(); + + if (valueAttribute is null && string.Equals(valueAttributeName, attribute.Name, comparison)) { valueAttribute = attribute; + set++; } - if (string.Equals(changeAttributeName, attribute.Name)) + if (changeAttribute is null && string.Equals(changeAttributeName, attribute.Name, comparison)) { changeAttribute = attribute; + set++; } - if (string.Equals(expressionAttributeName, attribute.Name)) + if (expressionAttribute is null && string.Equals(expressionAttributeName, attribute.Name, comparison)) { expressionAttribute = attribute; + set++; } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/TagHelperMatchingConventions.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/TagHelperMatchingConventions.cs index d0fc772becf..6ec4dfc6391 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/TagHelperMatchingConventions.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/TagHelperMatchingConventions.cs @@ -271,7 +271,7 @@ internal static bool SatisfiesRequiredAttribute( } } - private static StringComparison GetComparison(this BoundAttributeDescriptor descriptor) + internal static StringComparison GetComparison(this BoundAttributeDescriptor descriptor) => descriptor.CaseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase; private static StringComparison GetComparison(this BoundAttributeParameterDescriptor descriptor) diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/RazorSourceGeneratorComponentTests.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/RazorSourceGeneratorComponentTests.cs index bc4e6e80a1e..03dfe7f65a8 100644 --- a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/RazorSourceGeneratorComponentTests.cs +++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/RazorSourceGeneratorComponentTests.cs @@ -897,4 +897,87 @@ public async Task UnrecognizedComponentName() Diagnostic("RZ10023").WithLocation(7, 18)); // Attribute '@rendermode' is only valid when used on a component. Assert.Single(result.GeneratedSources); } + + [Theory, CombinatorialData, WorkItem("https://github.com/dotnet/aspnetcore/issues/48778")] + public async Task ImplicitStringConversion_ParameterCasing( + [CombinatorialValues("StringParameter", "stringParameter")] string paramName, + [CombinatorialValues("7.0", "8.0", "Latest")] string langVersion) + { + // Arrange + var project = CreateTestProject(new() + { + ["Views/Home/Index.cshtml"] = """ + @(await Html.RenderComponentAsync(RenderMode.Static)) + """, + ["Shared/Component1.razor"] = $$""" + @{ var c = new MyClass(); } + + """, + ["Shared/MyComponent.razor"] = """ + MyComponent: @StringParameter + @code { + [Parameter] + public string StringParameter { get; set; } = ""; + } + """, + }, new() + { + ["Shared/MyClass.cs"] = """ + namespace MyApp.Shared; + public class MyClass + { + public static implicit operator string(MyClass c) => "c converted to string"; + } + """, + }); + var compilation = await project.GetCompilationAsync(); + var driver = await GetDriverAsync(project, options => + { + options.TestGlobalOptions["build_property.RazorLangVersion"] = langVersion; + }); + + // Act + var result = RunGenerator(compilation!, ref driver, out compilation); + + // Assert + Assert.Empty(result.Diagnostics); + await VerifyRazorPageMatchesBaselineAsync(compilation, "Views_Home_Index"); + } + + [Theory, CombinatorialData, WorkItem("https://github.com/dotnet/aspnetcore/issues/48778")] + public async Task ImplicitStringConversion_ParameterCasing_Bind( + [CombinatorialValues("StringParameter", "stringParameter")] string paramName, + [CombinatorialValues("7.0", "8.0", "Latest")] string langVersion) + { + // Arrange + var project = CreateTestProject(new() + { + ["Views/Home/Index.cshtml"] = """ + @(await Html.RenderComponentAsync(RenderMode.Static)) + """, + ["Shared/Component1.razor"] = $$""" + @{ var s = "abc"; } + + """, + ["Shared/MyComponent.razor"] = """ + MyComponent: @StringParameter + @code { + [Parameter] public string StringParameter { get; set; } = ""; + [Parameter] public EventCallback StringParameterChanged { get; set; } + } + """, + }); + var compilation = await project.GetCompilationAsync(); + var driver = await GetDriverAsync(project, options => + { + options.TestGlobalOptions["build_property.RazorLangVersion"] = langVersion; + }); + + // Act + var result = RunGenerator(compilation!, ref driver, out compilation); + + // Assert + Assert.Empty(result.Diagnostics); + await VerifyRazorPageMatchesBaselineAsync(compilation, "Views_Home_Index"); + } } diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorComponentTests/ImplicitStringConversion_ParameterCasing/Views_Home_Index.html b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorComponentTests/ImplicitStringConversion_ParameterCasing/Views_Home_Index.html new file mode 100644 index 00000000000..7fa12d70777 --- /dev/null +++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorComponentTests/ImplicitStringConversion_ParameterCasing/Views_Home_Index.html @@ -0,0 +1 @@ +MyComponent: c converted to string \ No newline at end of file diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorComponentTests/ImplicitStringConversion_ParameterCasing_Bind/Views_Home_Index.html b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorComponentTests/ImplicitStringConversion_ParameterCasing_Bind/Views_Home_Index.html new file mode 100644 index 00000000000..983712db036 --- /dev/null +++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/TestFiles/RazorSourceGeneratorComponentTests/ImplicitStringConversion_ParameterCasing_Bind/Views_Home_Index.html @@ -0,0 +1 @@ +MyComponent: abc \ No newline at end of file diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/SourceMappingsSerializer.cs b/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/SourceMappingsSerializer.cs index df77ac1f32a..b1b1fd6188e 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/SourceMappingsSerializer.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/SourceMappingsSerializer.cs @@ -26,7 +26,7 @@ internal static string Serialize(IRazorGeneratedDocument csharpDocument, RazorSo var generatedCode = GetCodeForSpan(sourceMapping.GeneratedSpan, csharpDocument.GeneratedCode); AppendMappingLocation(builder, sourceMapping.GeneratedSpan, generatedCode); - Assert.Equal(sourceCode, generatedCode); + Assert.Equal(sourceCode, generatedCode, ignoreCase: true); builder.AppendLine(); }