Skip to content

Commit 642c050

Browse files
authored
Add global:: prefix to System.Action (#9626)
* Add `global::` prefix to `System.Action` * Update baselines
1 parent 7b4b012 commit 642c050

File tree

6 files changed

+22
-5
lines changed

6 files changed

+22
-5
lines changed

src/Compiler/Microsoft.AspNetCore.Razor.Language/src/Intermediate/ReferenceCaptureIntermediateNode.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public ReferenceCaptureIntermediateNode(IntermediateToken identifierToken, strin
3939

4040
public string FieldTypeName => IsComponentCapture ? ComponentCaptureTypeName : $"global::{ComponentsApi.ElementReference.FullTypeName}";
4141

42-
public string TypeName => $"System.Action<{FieldTypeName}>";
42+
public string TypeName => $"global::System.Action<{FieldTypeName}>";
4343

4444
public override void Accept(IntermediateNodeVisitor visitor)
4545
{

src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8339,6 +8339,23 @@ public void Element_WithRef_AttributeNameIsCaseSensitive()
83398339
CompileToAssembly(generated);
83408340
}
83418341

8342+
[IntegrationTestFact, WorkItem("https://github.com/dotnet/razor/issues/9625")]
8343+
public void Component_WithRef_Generic_SystemInNamespace()
8344+
{
8345+
var generated = CompileToCSharp("""
8346+
@namespace X.Y.System.Z
8347+
@typeparam T
8348+
8349+
<TestComponent Param="Param" @ref="comp" />
8350+
8351+
@code {
8352+
private TestComponent<T?>? comp;
8353+
[Parameter] public T? Param { get; set; }
8354+
}
8355+
""", nullableEnable: true);
8356+
CompileToAssembly(generated);
8357+
}
8358+
83428359
#endregion
83438360

83448361
#region Templates

src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/Component_WithRef_Nullable_Generic/TestComponent.codegen.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ namespace __Blazor.Test.TestComponent
7474
#line hidden
7575
internal static class TypeInference
7676
{
77-
public static global::Test.MyComponent<T> CreateMyComponent_0<T>(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, T __arg0, int __seq1, System.Action<global::Test.MyComponent<T>> __arg1)
77+
public static global::Test.MyComponent<T> CreateMyComponent_0<T>(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, T __arg0, int __seq1, global::System.Action<global::Test.MyComponent<T>> __arg1)
7878
{
7979
__builder.OpenComponent<global::Test.MyComponent<T>>(seq);
8080
__builder.AddAttribute(__seq0, "MyParameter", (object)__arg0);

src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponent_WithComponentRef_TypeInference_CreatesDiagnostic/TestComponent.codegen.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ namespace __Blazor.Test.TestComponent
7474
#line hidden
7575
internal static class TypeInference
7676
{
77-
public static global::Test.MyComponent<TItem> CreateMyComponent_0<TItem>(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, TItem __arg0, int __seq1, System.Action<global::Test.MyComponent<TItem>> __arg1)
77+
public static global::Test.MyComponent<TItem> CreateMyComponent_0<TItem>(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, TItem __arg0, int __seq1, global::System.Action<global::Test.MyComponent<TItem>> __arg1)
7878
{
7979
__builder.OpenComponent<global::Test.MyComponent<TItem>>(seq);
8080
__builder.AddAttribute(__seq0, "Item", (object)__arg0);

src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Component_WithRef_Nullable_Generic/TestComponent.codegen.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ namespace __Blazor.Test.TestComponent
4949
#line hidden
5050
internal static class TypeInference
5151
{
52-
public static void CreateMyComponent_0<T>(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, T __arg0, int __seq1, System.Action<global::Test.MyComponent<T>> __arg1)
52+
public static void CreateMyComponent_0<T>(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, T __arg0, int __seq1, global::System.Action<global::Test.MyComponent<T>> __arg1)
5353
{
5454
__builder.OpenComponent<global::Test.MyComponent<T>>(seq);
5555
__builder.AddComponentParameter(__seq0, "MyParameter", __arg0);

src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponent_WithComponentRef_TypeInference_CreatesDiagnostic/TestComponent.codegen.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ namespace __Blazor.Test.TestComponent
4949
#line hidden
5050
internal static class TypeInference
5151
{
52-
public static void CreateMyComponent_0<TItem>(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, TItem __arg0, int __seq1, System.Action<global::Test.MyComponent<TItem>> __arg1)
52+
public static void CreateMyComponent_0<TItem>(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, TItem __arg0, int __seq1, global::System.Action<global::Test.MyComponent<TItem>> __arg1)
5353
{
5454
__builder.OpenComponent<global::Test.MyComponent<TItem>>(seq);
5555
__builder.AddComponentParameter(__seq0, "Item", __arg0);

0 commit comments

Comments
 (0)