C# 14 Preview 3 massive errors for nested functional extensions #9308
-
C# 14 Preview 3 massive errors for nested functional extensions: Playing around with extensions, I get tons of errors for: Program: var sb =
new StringBuilder("Info: ")
.Snip ( 1 )
.Inspect ( c => Console.Write(c) ); Extension: namespace Extensions;
#nullable enable
public static class Test
{
extension (StringBuilder sb)
{
//-------------------------------------------------------------------------
public StringBuilder Snip (int n = 1)
{
var pos = sb.Length - int.Abs (n);
if ( n > 0 )
sb.Remove (pos, n);
return sb;
}
//-------------------------------------------------------------------------
public StringBuilder Call (Action onCall)
{
onCall?.Invoke();
return sb;
}
//-------------------------------------------------------------------------
public StringBuilder Inspect (Action<char> onChar)
=>
sb.Call ( () =>
{
// foreach (char c in sb.ToString())
// onChar(c);
});
//-------------------------------------------------------------------------
}
}
#nullable restore
|
Beta Was this translation helpful? Give feedback.
Answered by
colejohnson66
Apr 13, 2025
Replies: 1 comment 2 replies
-
Compiler bugs go in @dotnet/roslyn |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
svick
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compiler bugs go in @dotnet/roslyn