Skip to content

Instantly share code, notes, and snippets.

@migueldeicaza
migueldeicaza / gist:43b28ef3ceb8db59ffc00b70eb37f309
Created April 25, 2017 01:54
Dictionary-literal improvement to allow literals to be assigned to other Dictionary-shaped objects
--- /dev/null 2017-04-24 21:53:22.000000000 -0400
+++ README.md 2017-04-24 21:53:03.000000000 -0400
@@ -0,0 +1,67 @@
+Current work:
+
+Trying to allow the existing patch for dictionary literals that allows:
+
+ var a = ["key":"value"];
+
+Which creates an inferred Dictionary<string,string> above into
mono$ mono /usr/local//share/dotnet/sdk/1.0.0-preview3-004056/csc.exe
Could not load signature of Microsoft.CodeAnalysis.CommonCompiler:ResolveAnalyzersFromArguments due to: Could not load file or assembly 'System.Collections.Immutable, Version=1.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. assembly:System.Collections.Immutable, Version=1.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a type:<unknown type> member:<none>
Unhandled Exception:
System.TypeLoadException: Could not load type of field 'Microsoft.CodeAnalysis.CoreClrAnalyzerAssemblyLoader:_loadContext' (0) due to: Could not load file or assembly 'System.Runtime.Loader, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. assembly:System.Runtime.Loader, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a type:<unknown type> member:<none>
at Microsoft.CodeAnalysis.CommandLine.BuildClient.RunCompilation (System.Collections.Generic.IEnumerable`1[T] o
@migueldeicaza
migueldeicaza / gist:96c2bc52bfc30aa47a3ba34ce135e6f1
Last active September 12, 2016 14:00
Implicit string constant to byte[]/byte* conversions for C#
diff --git a/mcs/mcs/constant.cs b/mcs/mcs/constant.cs
old mode 100644
new mode 100755
index a0ae78c..0f45e74
--- a/mcs/mcs/constant.cs
+++ b/mcs/mcs/constant.cs
@@ -12,6 +12,7 @@
using System;
using System.Globalization;
@migueldeicaza
migueldeicaza / gist:630331ecb44dcec3aa815a7dca6eaeee
Created September 6, 2016 02:52
mcs tuple grammer changes
diff --git a/mcs/mcs/cs-parser.jay b/mcs/mcs/cs-parser.jay
index bb2bd6e..a41ae23 100644
--- a/mcs/mcs/cs-parser.jay
+++ b/mcs/mcs/cs-parser.jay
@@ -3222,6 +3222,20 @@ type_expression
$$ = new ComposedCast ((ATypeNameExpression) $1, (ComposedTypeSpecifier) $2);
}
| builtin_type_expression
+ | tuple_type
+ ;
using Mono.CSharp;
class X {
static void Main ()
{
var a = new
Evaluator (new CompilerContext (new CompilerSettings (), new ConsoleReportPrinter ()));
a.Run ("System.Console.WriteLine (true);");
}
}
@migueldeicaza
migueldeicaza / gist:7594491
Last active December 29, 2015 01:39
For David Fowler
These instructions will get you Mono compiled from source.
Requirements:
Xcode installed
Command Line Tools installed (part of Xcode)
Then, create a text file with the contents of everything after "=====", save it as "build.sh" in your home directory
Open a terminal window, and type this in your shell:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{B5035C41-148D-4376-87D0-48DB7E61A991}</ProjectGuid>
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType>
Microsoft (R) Build Engine version 4.0.30319.17929
[Microsoft .NET Framework, version 4.0.30319.18051]
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe /v:diag .\AndroidApplication3.sln
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 10/29/2013 6:01:37 PM.
Environment at start of build:
ALLUSERSPROFILE = C:\ProgramData
ANDROID_NDK_PATH = C:\Program Files\Android\ndk\android-ndk-r8d
using System.Threading.Tasks;
using System.Threading;
using System;
class X {
static void Main ()
{
var x = new X ();
x.Run ();
Thread.Sleep (6000);
2013-02-19 16:26:25.740 EntryElementBug[43498:c07] MonoTouch.UIKit.UITableViewCell with {X=0,Y=692,Width=320,Height=45} <nt>
2013-02-19 16:26:25.740 EntryElementBug[43498:c07] MonoTouch.UIKit.UIView with {X=9,Y=0,Width=302,Height=45} <nt>
2013-02-19 16:26:25.741 EntryElementBug[43498:c07] MonoTouch.UIKit.UIView with {X=1,Y=44,Width=300,Height=1} <nt>
2013-02-19 16:26:25.741 EntryElementBug[43498:c07] MonoTouch.UIKit.UIView with {X=10,Y=1,Width=300,Height=43} <nt>[[[[[ CONTENT VIEW ]]]]
2013-02-19 16:26:25.741 EntryElementBug[43498:c07] MonoTouch.UIKit.UITextField with {X=10,Y=10.5,Width=290,Height=21} >>> 7
2013-02-19 16:26:25.741 EntryElementBug[43498:c07] MonoTouch.UIKit.UILabel with {X=0,Y=0,Width=290,Height=21} <nt>LABEL: 7
2013-02-19 16:26:25.742 EntryElementBug[43498:c07] MonoTouch.UIKit.UITextField with {X=70,Y=10,Width=230,Height=21} >>> 16
2013-02-19 16:26:25.742 EntryElementBug[43498:c07] MonoTouch.UIKit.UILabel