Skip to content

Instantly share code, notes, and snippets.

View jcouv's full-sized avatar
💭
Working on C# 14

Julien Couvreur jcouv

💭
Working on C# 14
View GitHub Profile
@jcouv
jcouv / async-iterator.cs
Last active April 23, 2018 17:29
A manual implementation of state machine for async iterator method
Moved to https://github.com/jcouv/async-iterators/blob/master/src/Program.cs

Screenshot?

[12/20/2017 6:58:22 PM Diagnostic] Waiting for the package initialization...
[12/20/2017 6:58:22 PM Diagnostic] Package initialization finished !
[12/20/2017 6:58:22 PM Diagnostic] On real test window Open...
[12/20/2017 6:58:22 PM Diagnostic] About to Enqueue operation 'OpenOperation', hashcode:53129614
[12/20/2017 6:58:22 PM Diagnostic] Enqueue operation 'OpenOperation', hashcode:53129614
[12/20/2017 6:58:22 PM Diagnostic] Operation left in the the queue: 1
[12/20/2017 6:58:22 PM Diagnostic] 'OpenOperation', hashcode:53129614
[12/20/2017 6:58:22 PM Diagnostic]
[12/20/2017 6:58:22 PM Diagnostic] Processing Queue .....
@jcouv
jcouv / non-null.md
Last active August 3, 2017 22:20
Notes on non-null

Discussion started off from Chuck's PR following recent LDM discussion, and continued with Neal.

The way we initially tried to formalize this was with two or maybe three states (?, !, oblivious), two warning scenarios (dotting and assignment), and three contexts (C# 7.0, C# 8.0, C# 8.0 + non-null flag for additional warnings).

We started with two warnings:

  • assigning a ? type to a ! type is a warning in 8.0
  • dotting into a ? type is a warning in 8.0

Test plan for "Infer tuple names" aka "tuple projection initializers"

This is a checklist for testing the implementation of dotnet/csharplang#415. I (@gafter) will check items off as I see they are handled in the implementation (currently in dotnet/roslyn#18374).

  • We need a specish proposal that clearly describes the decision for key decision points. Once that is done I'll add additional bullets to this test plan.

There should be a positive test for each of the "golden" C# scenarios in dotnet/csharplang#370:

  • (int, int) t = (x, y); // (int, int)
  • (int a, int b) t = (x, y); // (int a, int b)
@jcouv
jcouv / unittest.cs
Created March 9, 2016 18:56
Repro for #8625
public void SyntaxNodeContains()
{
var text = "a + (b - (c * (d / e)))";
var expression = SyntaxFactory.ParseExpression(text);
var a = expression.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a");
var e = expression.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "e");
var firstParens = e.FirstAncestorOrSelf<ExpressionSyntax>(n => n.Kind() == SyntaxKind.ParenthesizedExpression);
Assert.False(firstParens.Contains(a)); // fixing #8625 allows this to return quicker
public void DynamicLocalCapturedByLambda()
{
var mslib = @"
namespace System
{
public class Object { }
public struct Int32 { }
public class ValueType { }
public class Attribute { }
public struct Void { }
@jcouv
jcouv / repro.cs
Last active February 16, 2016 23:38
Repro for stack overflow issue: https://github.com/dotnet/roslyn/issues/6536
[Fact]
public void TestStackOverflow()
{
var longCode = "";
for (var i = 0; i<3000; i++)
{
longCode += @"""asdf"" + ";
}
var code = @"class Foo
{