Skip to content

Instantly share code, notes, and snippets.

@oSumAtrIX
Last active September 30, 2023 22:29
Show Gist options
  • Save oSumAtrIX/3eafb53a34e4fe5bccc4b545f8a2f057 to your computer and use it in GitHub Desktop.
Save oSumAtrIX/3eafb53a34e4fe5bccc4b545f8a2f057 to your computer and use it in GitHub Desktop.
Shenanigans with Roslyn and the C# type checker
int a = 1, b = 2, c = 3;
System.Console.WriteLine(
"{0} {1}",
a < b,
c > (1 + 2)
);
using System;
class Program {
static void Main() =>
F(a =>
F(b =>
F(c =>
F(d =>
F(e =>
F(f =>
F(g =>
F(h =>
F(i =>
F(j =>
F(k =>
F(l =>
F(m =>
F(n =>
F(o =>
F(p =>
F(q =>
F(r =>
F(s =>
F(t =>
F(u =>
F(v =>
F(w =>
F(x => null)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
);
static object F(Func<True, object> f) => null;
static object F(Func<False, object> f) => null;
}
class True {}
class False {}
class Program
{
static void Main() {
}
}
class C<a, b, c, d, e, f>
{
class I : C<I, I, I, I, I, I> {
I.I.I.I.I.I.I.I.I i;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment