-
Notifications
You must be signed in to change notification settings - Fork 230
Add global:: to default usings
#8314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
0d1faff
af335c3
4f09abc
7e90f94
386a4d6
68c475c
d22826a
7dc27bf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,10 +54,7 @@ private void WriteDesignTimeDirectiveToken(CodeRenderingContext context, DesignT | |
| } | ||
|
|
||
| // Wrap the directive token in a lambda to isolate variable names. | ||
| context.CodeWriter | ||
| .Write("((") | ||
| .Write(typeof(Action).FullName) | ||
| .Write(")("); | ||
|
Comment on lines
-57
to
-60
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💭 I think I might prefer the form on the left, and just change |
||
| context.CodeWriter.Write("((global::System.Action)("); | ||
| using (context.CodeWriter.BuildLambda()) | ||
| { | ||
| var originalIndent = context.CodeWriter.CurrentIndent; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1335,8 +1335,10 @@ @using static SomeProject.SomeOtherFolder.Foo | |
| [InlineData("", "", true)] | ||
| [InlineData("Foo", "Project", true)] | ||
| [InlineData("Project.Foo", "Project", true)] | ||
| [InlineData("Project.Foo", "global::Project", true)] | ||
| [InlineData("Project.Bar.Foo", "Project.Bar", true)] | ||
| [InlineData("Project.Foo", "Project.Bar", false)] | ||
| [InlineData("Project.Foo", "global::Project.Bar", false)] | ||
| [InlineData("Project.Bar.Foo", "Project", false)] | ||
| [InlineData("Bar.Foo", "Project", false)] | ||
| public void IsTypeInNamespace_WorksAsExpected(string typeName, string @namespace, bool expected) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why would that be better? It would need duplicating the test data.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The parameters to a test are part of the test identity. When expected outcomes are part of the parameter list, it is impossible to update code in a manner that changes the expected outcome of a test without deleting the entire test history. This improves both CI behavior and local iterations as the test is initially developed.
Yes, and for this type of situation it's completely acceptable. Duplication is not as much a maintenance problem when coupled (both copies are highly likely to appear on the same screen at the same time).
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's interesting. I wouldn't think expected outcomes of unit tests change, that's what snapshot tests are for. Although I guess the line between the two is not that clear. |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| // <auto-generated/> | ||
| #pragma warning disable 1591 | ||
| namespace X.System.Y | ||
| { | ||
| #line hidden | ||
| using global::System; | ||
| using global::System.Collections.Generic; | ||
| using global::System.Linq; | ||
| using global::System.Threading.Tasks; | ||
| using global::Microsoft.AspNetCore.Components; | ||
| public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase | ||
| { | ||
| #pragma warning disable 219 | ||
| private void __RazorDirectiveTokenHelpers__() { | ||
| ((global::System.Action)(() => { | ||
| #nullable restore | ||
| #line 1 "x:\dir\subdir\Test\TestComponent.cshtml" | ||
| global::System.Object __typeHelper = nameof(X.System.Y); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📝 I'm expecting this to be just
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't plan to update everything to
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| #line default | ||
| #line hidden | ||
| #nullable disable | ||
| } | ||
| ))(); | ||
| } | ||
| #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) | ||
| { | ||
| } | ||
| #pragma warning restore 1998 | ||
| } | ||
| } | ||
| #pragma warning restore 1591 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| Document - | ||
| NamespaceDeclaration - - X.System.Y | ||
| 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 - | ||
| DirectiveToken - (11:0,11 [10] x:\dir\subdir\Test\TestComponent.cshtml) - X.System.Y | ||
| 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 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| Source Location: (11:0,11 [10] x:\dir\subdir\Test\TestComponent.cshtml) | ||
| |X.System.Y| | ||
| Generated Location: (649:17,44 [10] ) | ||
| |X.System.Y| | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| // <auto-generated/> | ||
| #pragma warning disable 1591 | ||
| namespace X.System.Y | ||
| { | ||
| #line hidden | ||
| using global::System; | ||
| using global::System.Collections.Generic; | ||
| using global::System.Linq; | ||
| using global::System.Threading.Tasks; | ||
| using global::Microsoft.AspNetCore.Components; | ||
| public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase | ||
| { | ||
| #pragma warning disable 1998 | ||
| protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) | ||
| { | ||
| } | ||
| #pragma warning restore 1998 | ||
| } | ||
| } | ||
| #pragma warning restore 1591 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| Document - | ||
| NamespaceDeclaration - - X.System.Y | ||
| 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 It's difficult to review the impact of this change in isolation because baselines weren't updated with each change
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's because this change caused failures - there was a new warning about duplicate usings in the new tests. I don't think anything changed in the old tests. But I could verify that.