Skip to content

Instantly share code, notes, and snippets.

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

Julien Couvreur jcouv

💭
Working on C# 13
View GitHub Profile
@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
{
public void DynamicLocalCapturedByLambda()
{
var mslib = @"
namespace System
{
public class Object { }
public struct Int32 { }
public class ValueType { }
public class Attribute { }
public struct Void { }
@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

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 / 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
[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 .....

Screenshot?

@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

1>------ Build started: Project: CodeAnalysis, Configuration: Debug Any CPU ------ 1>Operations\Operation.cs(72,29,72,33): warning CS8612: Nullability of reference types in type doesn't match implicitly implemented member 'ITypeSymbol IOperation.Type'. 1>Syntax\InternalSyntax\SyntaxList.WithManyChildren.cs(79,41,79,48): warning CS8609: Nullability of reference types in return type doesn't match overridden member. 1>Syntax\InternalSyntax\SyntaxList.WithManyChildren.cs(89,42,89,51): warning CS8610: Nullability of reference types in type of parameter 'parent' doesn't match overridden member. 1>Syntax\InternalSyntax\SyntaxList.WithThreeChildren.cs(86,42,86,51): warning CS8610: Nullability of reference types in type of parameter 'parent' doesn't match overridden member. 1>Syntax\InternalSyntax\SyntaxList.WithTwoChildren.cs(76,42,76,51): warning CS8610: Nullability of reference types in type of parameter 'parent' doesn't match overridden member. 1>PEWriter\TypeNameSerializer.cs(24,43,24,79): warning CS8600: Convert

1>------ Build started: Project: CodeAnalysis, Configuration: Debug Any CPU ------ 1>CommandLine\CommonCompiler.ExistingReferencesResolver.cs(42,73,42,89): warning CS8610: Nullability of reference types in type of parameter 'baseFilePath' doesn't match overridden member. 1>CommandLine\CommonCompiler.LoggingMetadataFileReferenceResolver.cs(27,73,27,89): warning CS8610: Nullability of reference types in type of parameter 'baseFilePath' doesn't match overridden member. 1>Diagnostic\SourceLocation.cs(68,36,68,46): warning CS8608: Nullability of reference types in type doesn't match overridden member. 1>Emit\CommonPEModuleBuilder.cs(235,40,235,61): warning CS8613: Nullability of reference types in return type doesn't match implicitly implemented member 'IAssemblyReference IModuleReference.GetContainingAssembly(EmitContext context)'. 1>CodeGen\MethodBody.cs(124,42,124,53): warning CS8615: Nullability of reference types in type doesn't match implemented member 'IImportScope? IMethodBody.ImportScope'. 1>CodeGen\Metho