mirror of https://github.com/icsharpcode/ILSpy.git
Browse Source
* Parenthesize interpolations containing global:: * Improvements: * Cleaner output * More unit testing * More efficient tree search * Implement revisions * Update Lambda1 to be invariant * Visit descendents before deciding whether or not to parenthesize an interpolation expression * Rename local function * Remove branch for conditional expressions * Handle Lambda expressions without a block body * Check for parenthesized expressions * `NET60` instead of `!NET40`master
4 changed files with 71 additions and 0 deletions
@ -0,0 +1,25 @@
@@ -0,0 +1,25 @@
|
||||
namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty |
||||
{ |
||||
public static class GloballyQualifiedTypeInStringInterpolation |
||||
{ |
||||
public static string Root => $"Prefix {(global::System.DateTime.Now)} suffix"; |
||||
public static string Cast => $"Prefix {((int)global::System.DateTime.Now.Ticks)} suffix"; |
||||
#if CS100 && NET60
|
||||
public static string Lambda1 => $"Prefix {(() => global::System.DateTime.Now)} suffix"; |
||||
#else
|
||||
public static string Lambda1 => $"Prefix {(global::System.Func<global::System.DateTime>)(() => global::System.DateTime.Now)} suffix"; |
||||
#endif
|
||||
public static string Lambda2 => $"Prefix {((global::System.Func<global::System.DateTime>)(() => global::System.DateTime.Now))()} suffix"; |
||||
public static string Method1 => $"Prefix {M(global::System.DateTime.Now)} suffix"; |
||||
public static string Method2 => $"Prefix {(global::System.DateTime.Now.Ticks)} suffix"; |
||||
public static string Method3 => $"Prefix {(global::System.DateTime.Equals(global::System.DateTime.Now, global::System.DateTime.Now))} suffix"; |
||||
public static string ConditionalExpression1 => $"Prefix {(Boolean ? global::System.DateTime.Now : global::System.DateTime.UtcNow)} suffix"; |
||||
public static string ConditionalExpression2 => $"Prefix {(Boolean ? global::System.DateTime.Now : global::System.DateTime.UtcNow).Ticks} suffix"; |
||||
|
||||
private static bool Boolean => false; |
||||
private static long M(global::System.DateTime time) |
||||
{ |
||||
return time.Ticks; |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue