PageRenderTime 70ms CodeModel.GetById 2ms app.highlight 59ms RepoModel.GetById 1ms app.codeStats 0ms

/IronPython_Main/Languages/IronPython/IronPythonTest/BindTest.cs

#
C# | 1224 lines | 944 code | 255 blank | 25 comment | 16 complexity | 624456cb5468107c7a19f017d837c966 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1/* ****************************************************************************
   2 *
   3 * Copyright (c) Microsoft Corporation. 
   4 *
   5 * This source code is subject to terms and conditions of the Apache License, Version 2.0. A 
   6 * copy of the license can be found in the License.html file at the root of this distribution. If 
   7 * you cannot locate the  Apache License, Version 2.0, please send an email to 
   8 * ironpy@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 
   9 * by the terms of the Apache License, Version 2.0.
  10 *
  11 * You must not remove this notice, or any other, from this software.
  12 *
  13 *
  14 * ***************************************************************************/
  15
  16using System;
  17using System.Collections;
  18using System.Collections.Generic;
  19using System.Runtime.InteropServices;
  20
  21using Microsoft.Scripting.Runtime;
  22using Microsoft.Scripting.Utils;
  23
  24using IronPython.Runtime;
  25using IronPython.Runtime.Types;
  26
  27namespace IronPythonTest {
  28    [Flags]
  29    public enum BindResult {
  30        None = 0,
  31
  32        Bool = 1,
  33        Byte = 2,
  34        Char = 3,
  35        Decimal = 4,
  36        Double = 5,
  37        Float = 6,
  38        Int = 7,
  39        Long = 8,
  40        Object = 9,
  41        SByte = 10,
  42        Short = 11,
  43        String = 12,
  44        UInt = 13,
  45        ULong = 14,
  46        UShort = 15,
  47
  48        Array = 0x1000,
  49        Out = 0x2000,
  50        Ref = 0x4000,
  51    }
  52
  53    public class BindTest {
  54        public static object BoolValue = (bool)true;
  55        public static object ByteValue = (byte)0;
  56        public static object CharValue = (char)'\0';
  57        public static object DecimalValue = (decimal)0;
  58        public static object DoubleValue = (double)0;
  59        public static object FloatValue = (float)0;
  60        public static object IntValue = (int)0;
  61        public static object LongValue = (long)0;
  62#if !SILVERLIGHT
  63        public static object ObjectValue = (object)new System.Collections.Hashtable();
  64#else
  65        public static object ObjectValue = (object)new Dictionary<object, object>();
  66#endif
  67        public static object SByteValue = (sbyte)0;
  68        public static object ShortValue = (short)0;
  69        public static object StringValue = (string)String.Empty;
  70        public static object UIntValue = (uint)0;
  71        public static object ULongValue = (ulong)0;
  72        public static object UShortValue = (ushort)0;
  73
  74        public static BindResult Bind() { return BindResult.None; }
  75
  76        public static BindResult Bind(bool value) { return BindResult.Bool; }
  77        public static BindResult Bind(byte value) { return BindResult.Byte; }
  78        public static BindResult Bind(char value) { return BindResult.Char; }
  79        public static BindResult Bind(decimal value) { return BindResult.Decimal; }
  80        public static BindResult Bind(double value) { return BindResult.Double; }
  81        public static BindResult Bind(float value) { return BindResult.Float; }
  82        public static BindResult Bind(int value) { return BindResult.Int; }
  83        public static BindResult Bind(long value) { return BindResult.Long; }
  84        public static BindResult Bind(object value) { return BindResult.Object; }
  85        public static BindResult Bind(sbyte value) { return BindResult.SByte; }
  86        public static BindResult Bind(short value) { return BindResult.Short; }
  87        public static BindResult Bind(string value) { return BindResult.String; }
  88        public static BindResult Bind(uint value) { return BindResult.UInt; }
  89        public static BindResult Bind(ulong value) { return BindResult.ULong; }
  90        public static BindResult Bind(ushort value) { return BindResult.UShort; }
  91
  92        public static BindResult Bind(bool[] value) { return BindResult.Bool | BindResult.Array; }
  93        public static BindResult Bind(byte[] value) { return BindResult.Byte | BindResult.Array; }
  94        public static BindResult Bind(char[] value) { return BindResult.Char | BindResult.Array; }
  95        public static BindResult Bind(decimal[] value) { return BindResult.Decimal | BindResult.Array; }
  96        public static BindResult Bind(double[] value) { return BindResult.Double | BindResult.Array; }
  97        public static BindResult Bind(float[] value) { return BindResult.Float | BindResult.Array; }
  98        public static BindResult Bind(int[] value) { return BindResult.Int | BindResult.Array; }
  99        public static BindResult Bind(long[] value) { return BindResult.Long | BindResult.Array; }
 100        public static BindResult Bind(object[] value) { return BindResult.Object | BindResult.Array; }
 101        public static BindResult Bind(sbyte[] value) { return BindResult.SByte | BindResult.Array; }
 102        public static BindResult Bind(short[] value) { return BindResult.Short | BindResult.Array; }
 103        public static BindResult Bind(string[] value) { return BindResult.String | BindResult.Array; }
 104        public static BindResult Bind(uint[] value) { return BindResult.UInt | BindResult.Array; }
 105        public static BindResult Bind(ulong[] value) { return BindResult.ULong | BindResult.Array; }
 106        public static BindResult Bind(ushort[] value) { return BindResult.UShort | BindResult.Array; }
 107
 108        public static BindResult Bind(out bool value) { value = false; return BindResult.Bool | BindResult.Out; }
 109        public static BindResult Bind(out byte value) { value = 0; return BindResult.Byte | BindResult.Out; }
 110        public static BindResult Bind(out char value) { value = '\0'; return BindResult.Char | BindResult.Out; }
 111        public static BindResult Bind(out decimal value) { value = 0; return BindResult.Decimal | BindResult.Out; }
 112        public static BindResult Bind(out double value) { value = 0; return BindResult.Double | BindResult.Out; }
 113        public static BindResult Bind(out float value) { value = 0; return BindResult.Float | BindResult.Out; }
 114        public static BindResult Bind(out int value) { value = 0; return BindResult.Int | BindResult.Out; }
 115        public static BindResult Bind(out long value) { value = 0; return BindResult.Long | BindResult.Out; }
 116        public static BindResult Bind(out object value) { value = null; return BindResult.Object | BindResult.Out; }
 117        public static BindResult Bind(out sbyte value) { value = 0; return BindResult.SByte | BindResult.Out; }
 118        public static BindResult Bind(out short value) { value = 0; return BindResult.Short | BindResult.Out; }
 119        public static BindResult Bind(out string value) { value = null; return BindResult.String | BindResult.Out; }
 120        public static BindResult Bind(out uint value) { value = 0; return BindResult.UInt | BindResult.Out; }
 121        public static BindResult Bind(out ulong value) { value = 0; return BindResult.ULong | BindResult.Out; }
 122        public static BindResult Bind(out ushort value) { value = 0; return BindResult.UShort | BindResult.Out; }
 123
 124        public static BindResult BindRef(ref bool value) { value = false; return BindResult.Bool | BindResult.Ref; }
 125        public static BindResult BindRef(ref byte value) { value = 0; return BindResult.Byte | BindResult.Ref; }
 126        public static BindResult BindRef(ref char value) { value = '\0'; return BindResult.Char | BindResult.Ref; }
 127        public static BindResult BindRef(ref decimal value) { value = 0; return BindResult.Decimal | BindResult.Ref; }
 128        public static BindResult BindRef(ref double value) { value = 0; return BindResult.Double | BindResult.Ref; }
 129        public static BindResult BindRef(ref float value) { value = 0; return BindResult.Float | BindResult.Ref; }
 130        public static BindResult BindRef(ref int value) { value = 0; return BindResult.Int | BindResult.Ref; }
 131        public static BindResult BindRef(ref long value) { value = 0; return BindResult.Long | BindResult.Ref; }
 132        public static BindResult BindRef(ref object value) { value = null; return BindResult.Object | BindResult.Ref; }
 133        public static BindResult BindRef(ref sbyte value) { value = 0; return BindResult.SByte | BindResult.Ref; }
 134        public static BindResult BindRef(ref short value) { value = 0; return BindResult.Short | BindResult.Ref; }
 135        public static BindResult BindRef(ref string value) { value = null; return BindResult.String | BindResult.Ref; }
 136        public static BindResult BindRef(ref uint value) { value = 0; return BindResult.UInt | BindResult.Ref; }
 137        public static BindResult BindRef(ref ulong value) { value = 0; return BindResult.ULong | BindResult.Ref; }
 138        public static BindResult BindRef(ref ushort value) { value = 0; return BindResult.UShort | BindResult.Ref; }
 139
 140        public static object ReturnTest(string type) {
 141            switch (type) {
 142                case "char": return 'a';
 143                case "object": return new object();
 144                case "null": return null;
 145#if !SILVERLIGHT
 146                case "com":
 147                    Type t = Type.GetTypeFromProgID("JScript");
 148                    return Activator.CreateInstance(t);
 149#endif
 150            }
 151            throw new NotImplementedException("unknown type");
 152        }
 153    }
 154
 155    namespace DispatchHelpers {
 156        public class B { }
 157        public class D : B { }
 158
 159        public interface I { }
 160        public class C1 : I { }
 161        public class C2 : I { }
 162
 163        public enum Color { Red, Blue }
 164    }
 165
 166    public class Dispatch {
 167        public static int Flag = 0;
 168
 169        public void M1(int arg) { Flag = 101; }
 170        public void M1(DispatchHelpers.Color arg) { Flag = 201; }
 171
 172        public void M2(int arg) { Flag = 102; }
 173        public void M2(int arg, params int[] arg2) { Flag = 202; }
 174
 175        public void M3(int arg) { Flag = 103; }
 176        public void M3(int arg, int arg2) { Flag = 203; }
 177
 178        public void M4(int arg) { Flag = 104; }
 179        public void M4(int arg, __arglist) { Flag = 204; }
 180
 181        public void M5(float arg) { Flag = 105; }
 182        public void M5(double arg) { Flag = 205; }
 183
 184        public void M6(char arg) { Flag = 106; }
 185        public void M6(string arg) { Flag = 206; }
 186
 187        public void M7(int arg) { Flag = 107; }
 188        public void M7(params int[] args) { Flag = 207; }
 189
 190        public void M8(int arg) { Flag = 108; }
 191        public void M8(ref int arg) { Flag = 208; arg = 999; }
 192
 193        public void M10(ref int arg) { Flag = 210; arg = 999; }
 194
 195        public void M11(int arg, int arg2) { Flag = 111; }
 196        public void M11(DispatchHelpers.Color arg, int arg2) { Flag = 211; }
 197
 198        public void M12(int arg, DispatchHelpers.Color arg2) { Flag = 112; }
 199        public void M12(DispatchHelpers.Color arg, int arg2) { Flag = 212; }
 200
 201        public void M20(DispatchHelpers.B arg) { Flag = 120; }
 202
 203        public void M22(DispatchHelpers.B arg) { Flag = 122; }
 204        public void M22(DispatchHelpers.D arg) { Flag = 222; }
 205
 206        public void M23(DispatchHelpers.I arg) { Flag = 123; }
 207        public void M23(DispatchHelpers.C2 arg) { Flag = 223; }
 208
 209        public void M50(params DispatchHelpers.B[] args) { Flag = 150; }
 210
 211        public void M51(params DispatchHelpers.B[] args) { Flag = 151; }
 212        public void M51(params DispatchHelpers.D[] args) { Flag = 251; }
 213
 214        public void M60(int? arg) { Flag = 160; }
 215
 216        public void M70(Dispatch arg) { Flag = 170; }
 217        public static void M71(Dispatch arg) { Flag = 171; }
 218
 219        public static void M81(Dispatch arg, int arg2) { Flag = 181; }
 220        public void M81(int arg) { Flag = 281; }
 221
 222        public static void M82(bool arg) { Flag = 182; }
 223        public static void M82(string arg) { Flag = 282; }
 224
 225        public void M83(bool arg) { Flag = 183; }
 226        public void M83(string arg) { Flag = 283; }
 227
 228        public void M90<T>(int arg) { Flag = 190; }
 229
 230        public void M91(int arg) { Flag = 191; }
 231        public void M91<T>(int arg) { Flag = 291; }
 232
 233        public static int M92(out int i, out int j, out int k, bool boolIn) {
 234            i = 1;
 235            j = 2;
 236            k = 3;
 237            Flag = 192;
 238            return boolIn ? 4 : 5;
 239        }
 240
 241        public int M93(out int i, out int j, out int k, bool boolIn) {
 242            i = 1;
 243            j = 2;
 244            k = 3;
 245            Flag = 193;
 246            return boolIn ? 4 : 5;
 247        }
 248
 249        public int M94(out int i, out int j, bool boolIn, out int k) {
 250            i = 1;
 251            j = 2;
 252            k = 3;
 253            Flag = 194;
 254            return boolIn ? 4 : 5;
 255        }
 256
 257        public static int M95(out int i, out int j, bool boolIn, out int k) {
 258            i = 1;
 259            j = 2;
 260            k = 3;
 261            Flag = 195;
 262            return boolIn ? 4 : 5;
 263        }
 264
 265        public static int M96(out int x, out int j, params int[] extras) {
 266            x = 1;
 267            j = 2;
 268            int res = 0;
 269            for (int i = 0; i < extras.Length; i++) res += extras[i];
 270            Flag = 196;
 271            return res;
 272        }
 273
 274        public int M97(out int x, out int j, params int[] extras) {
 275            x = 1;
 276            j = 2;
 277            int res = 0;
 278            for (int i = 0; i < extras.Length; i++) res += extras[i];
 279            Flag = 197;
 280            return res;
 281        }
 282
 283        public void M98(string a, string b, string c, string d, out int x, ref Dispatch di) {
 284            x = Convert.ToInt32(a) + Convert.ToInt32(b) + Convert.ToInt32(c) + Convert.ToInt32(d);
 285
 286            di = this;
 287
 288            Flag = 198;
 289        }
 290        
 291        public Single P01 {
 292            get; set;
 293        }
 294    }
 295
 296    public class DispatchBase {
 297        public virtual void M1(int arg) { Dispatch.Flag = 101; }
 298        public virtual void M2(int arg) { Dispatch.Flag = 102; }
 299        public virtual void M3(int arg) { Dispatch.Flag = 103; }
 300        public void M4(int arg) { Dispatch.Flag = 104; }
 301        public virtual void M5(int arg) { Dispatch.Flag = 105; }
 302        public virtual void M6(int arg) { Dispatch.Flag = 106; }
 303    }
 304
 305    public class DispatchDerived : DispatchBase {
 306        public override void M1(int arg) { Dispatch.Flag = 201; }
 307        public virtual void M2(DispatchHelpers.Color arg) { Dispatch.Flag = 202; }
 308        public virtual void M3(string arg) { Dispatch.Flag = 203; }
 309        public void M4(string arg) { Dispatch.Flag = 204; }
 310        public new virtual void M5(int arg) { Dispatch.Flag = 205; }
 311    }
 312
 313    public class ConversionDispatch {
 314        public object Array(object[] arr) {
 315            return arr;
 316        }
 317
 318        public object IntArray(int[] arr) {
 319            return arr;
 320        }
 321
 322        public object StringArray(string[] arr) {
 323            return arr;
 324        }
 325
 326        public object Enumerable(IEnumerable<object> enm) {
 327            return enm;
 328        }
 329
 330        public object StringEnumerable(IEnumerable<string> enm) {
 331            return enm;
 332        }
 333
 334        public object StringEnumerator(IEnumerator<string> enm) {
 335            return enm;
 336        }
 337
 338        public object ObjectEnumerator(IEnumerator<object> enm) {
 339            return enm;
 340        }
 341
 342        public object NonGenericEnumerator(IEnumerator enm) {
 343            return enm;
 344        }
 345
 346        public object IntEnumerable(IEnumerable<int> enm) {
 347            return enm;
 348        }
 349
 350        public object ObjIList(IList<object> list) {
 351            return list;
 352        }
 353
 354        public object IntIList(IList<int> list) {
 355            return list;
 356        }
 357
 358        public object StringIList(IList<string> list) {
 359            return list;
 360        }
 361
 362        public object ObjList(List<object> list) {
 363            return list;
 364        }
 365
 366        public object IntList(List<int> list) {
 367            return list;
 368        }
 369
 370        public object StringList(List<string> list) {
 371            return list;
 372        }
 373
 374        public object DictTest(IDictionary<object, object> dict) {
 375            return dict;
 376        }
 377
 378        public object IntDictTest(IDictionary<int, int> dict) {
 379            return dict;
 380        }
 381
 382        public object StringDictTest(IDictionary<string, string> dict) {
 383            return dict;
 384        }
 385
 386        public object MixedDictTest(IDictionary<string, int> dict) {
 387            return dict;
 388        }
 389
 390#if !SILVERLIGHT
 391        public object ArrayList(System.Collections.ArrayList list) {
 392            return list;
 393        }
 394
 395        public object HashtableTest(Hashtable dict) {
 396            return dict;
 397        }
 398#endif
 399    }
 400
 401    public class MixedDispatch {
 402        public string instance_name;
 403        public string called;
 404
 405        public MixedDispatch(string name) {
 406            instance_name = name;
 407        }
 408
 409        public static object Combine(MixedDispatch md1, MixedDispatch md2) {
 410            MixedDispatch md_res = new MixedDispatch(md1.instance_name + md2.instance_name);
 411            md_res.called = "static";
 412            return md_res;
 413        }
 414
 415        public object Combine(MixedDispatch other) {
 416            MixedDispatch md_res = new MixedDispatch(other.instance_name + instance_name);
 417            md_res.called = "instance";
 418            return md_res;
 419        }
 420
 421
 422        public object Combine2(MixedDispatch other) {
 423            MixedDispatch md_res = new MixedDispatch(other.instance_name + instance_name);
 424            md_res.called = "instance";
 425            return md_res;
 426        }
 427
 428        public static object Combine2(MixedDispatch md1, MixedDispatch md2) {
 429            MixedDispatch md_res = new MixedDispatch(md1.instance_name + md2.instance_name);
 430            md_res.called = "static";
 431            return md_res;
 432        }
 433
 434        public object Combine2(MixedDispatch other, MixedDispatch other2, MixedDispatch other3) {
 435            MixedDispatch md_res = new MixedDispatch(other.instance_name + instance_name + other2.instance_name + other3.instance_name);
 436            md_res.called = "instance_three";
 437            return md_res;
 438        }
 439    }
 440
 441    public class FieldTest {
 442        public IList<Type> Field;
 443    }
 444
 445    public class ComparisonTest {
 446        public delegate void Reporter(string name);
 447        public double value;
 448        public static Reporter report;
 449        public ComparisonTest(double value) {
 450            this.value = value;
 451        }
 452        public override string ToString() {
 453            return string.Format(System.Globalization.CultureInfo.InvariantCulture, "ct<{0}>", value);
 454        }
 455        public static bool operator <(ComparisonTest x, ComparisonTest y) {
 456            Report("<", x, y);
 457            return x.value < y.value;
 458        }
 459        public static bool operator >(ComparisonTest x, ComparisonTest y) {
 460            Report(">", x, y);
 461            return x.value > y.value;
 462        }
 463        public static bool operator <=(ComparisonTest x, ComparisonTest y) {
 464            Report("<=", x, y);
 465            return x.value <= y.value;
 466        }
 467        public static bool operator >=(ComparisonTest x, ComparisonTest y) {
 468            Report(">=", x, y);
 469            return x.value >= y.value;
 470        }
 471        private static void Report(string op, ComparisonTest x, ComparisonTest y) {
 472            if (report != null) {
 473                report(string.Format("{0} on [{1}, {2}]", op, x, y));
 474            }
 475        }
 476    }
 477
 478    public enum BigEnum : long {
 479        None,
 480        BigValue = UInt32.MaxValue,
 481    }
 482
 483    public class DefaultValueTest {
 484        public BindResult Test_Enum([DefaultParameterValue(BindResult.Bool)] BindResult param) {
 485            return param;
 486        }
 487
 488        public BigEnum Test_BigEnum([DefaultParameterValue(BigEnum.BigValue)] BigEnum param) {
 489            return param;
 490        }
 491
 492        public string Test_String([DefaultParameterValue("Hello World")] string param) {
 493            return param;
 494        }
 495
 496        public int Test_Int([DefaultParameterValue(5)] int param) {
 497            return param;
 498        }
 499
 500        public uint Test_UInt([DefaultParameterValue(uint.MaxValue)] uint param) {
 501            return param;
 502        }
 503
 504        public bool Test_Bool([DefaultParameterValue(true)] bool param) {
 505            return param;
 506        }
 507
 508        public char Test_Char([DefaultParameterValue('A')] char param) {
 509            return param;
 510        }
 511
 512        public byte Test_Byte([DefaultParameterValue((byte)2)] byte param) {
 513            return param;
 514        }
 515
 516        public sbyte Test_SByte([DefaultParameterValue((sbyte)2)] sbyte param) {
 517            return param;
 518        }
 519
 520        public short Test_Short([DefaultParameterValue((short)2)] short param) {
 521            return param;
 522        }
 523
 524        public ushort Test_UShort([DefaultParameterValue((ushort)2)] ushort param) {
 525            return param;
 526        }
 527
 528        public long Test_Long([DefaultParameterValue(long.MaxValue)] long param) {
 529            return param;
 530        }
 531
 532        public ulong Test_ULong([DefaultParameterValue(ulong.MaxValue)] ulong param) {
 533            return param;
 534        }
 535
 536        public string Test_ByRef_Object([In, Optional] ref object o1, [In, Optional] ref object o2, [In, Optional] ref object o3) {
 537            return (o1 == null ? "(null)" : o1.ToString()) + "; " +
 538                   (o2 == null ? "(null)" : o2.ToString()) + "; " +
 539                   (o3 == null ? "(null)" : o3.ToString());
 540        }
 541
 542        public string Test_Default_ValueType([DefaultParameterValue(1)] object o) {
 543            return o == null ? "(null)" : o.ToString();
 544        }
 545
 546        public string Test_Default_Cast([Optional, DefaultParameterValue(1)]ref object o) {
 547            return o == null ? "(null)" : o.ToString();
 548        }
 549    }
 550
 551    public struct Structure {
 552        public int a;
 553        public float b;
 554        public double c;
 555        public decimal d;
 556        public string e;
 557#if !SILVERLIGHT
 558        public Hashtable f;
 559#else
 560        public Dictionary<object, object> f;
 561#endif
 562    }
 563
 564    public class MissingValueTest {
 565        public static string Test_1([In, Optional] bool o) { return "(bool)" + o.ToString(); }
 566        public static string Test_2([In, Optional] ref bool o) { return "(bool)" + o.ToString(); }
 567
 568        public static string Test_3([In, Optional] sbyte o) { return "(sbyte)" + o.ToString(); }
 569        public static string Test_4([In, Optional] ref sbyte o) { return "(sbyte)" + o.ToString(); }
 570
 571        public static string Test_5([In, Optional] byte o) { return "(byte)" + o.ToString(); }
 572        public static string Test_6([In, Optional] ref byte o) { return "(byte)" + o.ToString(); }
 573
 574        public static string Test_7([In, Optional] short o) { return "(short)" + o.ToString(); }
 575        public static string Test_8([In, Optional] ref short o) { return "(short)" + o.ToString(); }
 576
 577        public static string Test_9([In, Optional] ushort o) { return "(ushort)" + o.ToString(); }
 578        public static string Test_10([In, Optional] ref ushort o) { return "(ushort)" + o.ToString(); }
 579
 580        public static string Test_11([In, Optional] int o) { return "(int)" + o.ToString(); }
 581        public static string Test_12([In, Optional] ref int o) { return "(int)" + o.ToString(); }
 582
 583        public static string Test_13([In, Optional] uint o) { return "(uint)" + o.ToString(); }
 584        public static string Test_14([In, Optional] ref uint o) { return "(uint)" + o.ToString(); }
 585
 586        public static string Test_15([In, Optional] long o) { return "(long)" + o.ToString(); }
 587        public static string Test_16([In, Optional] ref long o) { return "(long)" + o.ToString(); }
 588
 589        public static string Test_17([In, Optional] ulong o) { return "(ulong)" + o.ToString(); }
 590        public static string Test_18([In, Optional] ref ulong o) { return "(ulong)" + o.ToString(); }
 591
 592        public static string Test_19([In, Optional] decimal o) { return "(decimal)" + o.ToString(); }
 593        public static string Test_20([In, Optional] ref decimal o) { return "(decimal)" + o.ToString(); }
 594
 595        public static string Test_21([In, Optional] float o) { return "(float)" + o.ToString(); }
 596        public static string Test_22([In, Optional] ref float o) { return "(float)" + o.ToString(); }
 597
 598        public static string Test_23([In, Optional] double o) { return "(double)" + o.ToString(); }
 599        public static string Test_24([In, Optional] ref double o) { return "(double)" + o.ToString(); }
 600
 601        public static string Test_25([In, Optional] DaysByte o) { return "(DaysByte)" + o.ToString(); }
 602        public static string Test_26([In, Optional] ref DaysByte o) { return "(DaysByte)" + o.ToString(); }
 603
 604        public static string Test_27([In, Optional] DaysSByte o) { return "(DaysSByte)" + o.ToString(); }
 605        public static string Test_28([In, Optional] ref DaysSByte o) { return "(DaysSByte)" + o.ToString(); }
 606
 607        public static string Test_29([In, Optional] DaysShort o) { return "(DaysShort)" + o.ToString(); }
 608        public static string Test_30([In, Optional] ref DaysShort o) { return "(DaysShort)" + o.ToString(); }
 609
 610        public static string Test_31([In, Optional] DaysUShort o) { return "(DaysUShort)" + o.ToString(); }
 611        public static string Test_32([In, Optional] ref DaysUShort o) { return "(DaysUShort)" + o.ToString(); }
 612
 613        public static string Test_33([In, Optional] DaysInt o) { return "(DaysInt)" + o.ToString(); }
 614        public static string Test_34([In, Optional] ref DaysInt o) { return "(DaysInt)" + o.ToString(); }
 615
 616        public static string Test_35([In, Optional] DaysUInt o) { return "(DaysUInt)" + o.ToString(); }
 617        public static string Test_36([In, Optional] ref DaysUInt o) { return "(DaysUInt)" + o.ToString(); }
 618
 619        public static string Test_37([In, Optional] DaysLong o) { return "(DaysLong)" + o.ToString(); }
 620        public static string Test_38([In, Optional] ref DaysLong o) { return "(DaysLong)" + o.ToString(); }
 621
 622        public static string Test_39([In, Optional] DaysULong o) { return "(DaysULong)" + o.ToString(); }
 623        public static string Test_40([In, Optional] ref DaysULong o) { return "(DaysULong)" + o.ToString(); }
 624
 625        public static string Test_41([In, Optional] char o) { return "(char)" + o.ToString(); }
 626        public static string Test_42([In, Optional] ref char o) { return "(char)" + o.ToString(); }
 627
 628        public static string Test_43([In, Optional] Structure o) { return "(Structure)" + o.ToString(); }
 629        public static string Test_44([In, Optional] ref Structure o) { return "(Structure)" + o.ToString(); }
 630
 631        public static string Test_45([In, Optional] EnumSByte o) { return "(EnumSByte)" + o.ToString(); }
 632        public static string Test_46([In, Optional] ref EnumSByte o) { return "(EnumSByte)" + o.ToString(); }
 633
 634        public static string Test_47([In, Optional] EnumByte o) { return "(EnumByte)" + o.ToString(); }
 635        public static string Test_48([In, Optional] ref EnumByte o) { return "(EnumByte)" + o.ToString(); }
 636
 637        public static string Test_49([In, Optional] EnumShort o) { return "(EnumShort)" + o.ToString(); }
 638        public static string Test_50([In, Optional] ref EnumShort o) { return "(EnumShort)" + o.ToString(); }
 639
 640        public static string Test_51([In, Optional] EnumUShort o) { return "(EnumUShort)" + o.ToString(); }
 641        public static string Test_52([In, Optional] ref EnumUShort o) { return "(EnumUShort)" + o.ToString(); }
 642
 643        public static string Test_53([In, Optional] EnumInt o) { return "(EnumInt)" + o.ToString(); }
 644        public static string Test_54([In, Optional] ref EnumInt o) { return "(EnumInt)" + o.ToString(); }
 645
 646        public static string Test_55([In, Optional] EnumUInt o) { return "(EnumUInt)" + o.ToString(); }
 647        public static string Test_56([In, Optional] ref EnumUInt o) { return "(EnumUInt)" + o.ToString(); }
 648
 649        public static string Test_57([In, Optional] EnumLong o) { return "(EnumLong)" + o.ToString(); }
 650        public static string Test_58([In, Optional] ref EnumLong o) { return "(EnumLong)" + o.ToString(); }
 651
 652        public static string Test_59([In, Optional] EnumULong o) { return "(EnumULong)" + o.ToString(); }
 653        public static string Test_60([In, Optional] ref EnumULong o) { return "(EnumULong)" + o.ToString(); }
 654
 655        public static string Test_61([In, Optional] string o) { return "(string)" + (o == null ? "(null)" : o); }
 656        public static string Test_62([In, Optional] ref string o) { return "(string)" + (o == null ? "(null)" : o); }
 657
 658        public static string Test_63([In, Optional] object o) { return "(object)" + (o == null ? "(null)" : o.ToString()); }
 659        public static string Test_64([In, Optional] ref object o) { return "(object)" + (o == null ? "(null)" : o.ToString()); }
 660
 661        public static string Test_65([In, Optional] MissingValueTest o) { return "(MissingValueTest)" + (o == null ? "(null)" : o.ToString()); }
 662        public static string Test_66([In, Optional] ref MissingValueTest o) { return "(MissingValueTest)" + (o == null ? "(null)" : o.ToString()); }
 663    }
 664
 665    public class DispatchAgain {
 666        // ***************** OptimizedFunctionX *****************
 667        public string IM0() { return "IM0"; }
 668        public string IM1(int arg1) { return "IM1"; }
 669        public string IM2(int arg1, int arg2) { return "IM2"; }
 670        public string IM3(int arg1, int arg2, int arg3) { return "IM3"; }
 671        public string IM4(int arg1, int arg2, int arg3, int arg4) { return "IM4"; }
 672        public string IM5(int arg1, int arg2, int arg3, int arg4, int arg5) { return "IM5"; }
 673        public string IM6(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6) { return "IM6"; }
 674
 675        public static string SM0() { return "SM0"; }
 676        public static string SM1(int arg1) { return "SM1"; }
 677        public static string SM2(int arg1, int arg2) { return "SM2"; }
 678        public static string SM3(int arg1, int arg2, int arg3) { return "SM3"; }
 679        public static string SM4(int arg1, int arg2, int arg3, int arg4) { return "SM4"; }
 680        public static string SM5(int arg1, int arg2, int arg3, int arg4, int arg5) { return "SM5"; }
 681        public static string SM6(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6) { return "SM6"; }
 682
 683        // ***************** OptimizedFunctionN *****************
 684        public string IPM0(params int[] args) { return "IPM0-" + args.Length; }
 685        public static string SPM0(params int[] args) { return "SPM0-" + args.Length; }
 686
 687        // suppose to be optimized?
 688        public string IPM1(int arg1, params int[] args) { return "IPM1-" + args.Length; }
 689        public static string SPM1(int arg1, params int[] args) { return "SPM1-" + args.Length; }
 690
 691        // ***************** OptimizedFunctionAny *****************
 692        // 1. miss 1, 2 arguments, and no params
 693        public string IDM0() { return "IDM0-0"; }
 694        public string IDM0(int arg1, int arg2, int arg3) { return "IDM0-3"; }
 695        public string IDM0(int arg1, int arg2, int arg3, int arg4) { return "IDM0-4"; }
 696
 697        public static string SDM0() { return "SDM0-0"; }
 698        public static string SDM0(int arg1, int arg2, int arg3) { return "SDM0-3"; }
 699
 700        // 2. miss 0, 3, 4 arguments, but have params
 701        public string IDM1(int arg1) { return "IDM1-1"; }
 702        public string IDM1(params int[] args) { return "IDM1-x"; }
 703
 704        public static string SDM1(int arg1) { return "SDM1-1"; }
 705        public static string SDM1(params int[] args) { return "SDM1-x"; }
 706
 707        public string IDM4(int arg1, int arg2) { return "IDM4-2"; }
 708        public string IDM4(params int[] args) { return "IDM4-x"; }
 709
 710        public static string SDM4(int arg1, int arg2) { return "SDM4-2"; }
 711        public static string SDM4(params int[] args) { return "SDM4-x"; }
 712
 713        // 3. this is optimizated, and have all cases without params
 714        public string IDM2() { return "IDM2-0"; }
 715        public string IDM2(int arg1) { return "IDM2-1"; }
 716        public string IDM2(int arg1, int arg2) { return "IDM2-2"; }
 717        public string IDM2(int arg1, int arg2, int arg3) { return "IDM2-3"; }
 718        public string IDM2(int arg1, int arg2, int arg3, int arg4) { return "IDM2-4"; }
 719
 720        public static string SDM2() { return "SDM2-0"; }
 721        public static string SDM2(int arg1) { return "SDM2-1"; }
 722        public static string SDM2(int arg1, int arg2) { return "SDM2-2"; }
 723        public static string SDM2(int arg1, int arg2, int arg3) { return "SDM2-3"; }
 724        public static string SDM2(int arg1, int arg2, int arg3, int arg4) { return "SDM2-4"; }
 725        public static string SDM2(int arg1, int arg2, int arg3, int arg4, int arg5) { return "SDM2-5"; }
 726
 727        // 4. this is not optimized
 728        public string IDM5() { return "IDM5-0"; }
 729        public string IDM5(int arg1, int arg2, int arg3, int arg4, int arg5) { return "IDM5-5"; }
 730
 731        public static string SDM5() { return "SDM5-0"; }
 732        public static string SDM5(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6) { return "SDM5-6"; }
 733
 734        // 5. this is optimizated, and have all cases, with params
 735        public string IDM3() { return "IDM3-0"; }
 736        public string IDM3(int arg1) { return "IDM3-1"; }
 737        public string IDM3(int arg1, int arg2) { return "IDM3-2"; }
 738        public string IDM3(int arg1, int arg2, int arg3) { return "IDM3-3"; }
 739        public string IDM3(int arg1, int arg2, int arg3, int arg4) { return "IDM3-4"; }
 740        public string IDM3(params int[] args) { return "IDM3-x"; }
 741
 742        public static string SDM3() { return "SDM3-0"; }
 743        public static string SDM3(int arg1) { return "SDM3-1"; }
 744        public static string SDM3(int arg1, int arg2) { return "SDM3-2"; }
 745        public static string SDM3(int arg1, int arg2, int arg3) { return "SDM3-3"; }
 746        public static string SDM3(int arg1, int arg2, int arg3, int arg4) { return "SDM3-4"; }
 747        public static string SDM3(int arg1, int arg2, int arg3, int arg4, int arg5) { return "SDM3-5"; }
 748        public static string SDM3(params int[] args) { return "SDM3-x"; }
 749    }
 750
 751    public class MultiCall {
 752        public int M0(int arg) { return 1; }
 753        public int M0(long arg) { return 2; }
 754
 755        public int M1(int arg) { return 1; }
 756        public int M1(long arg) { return 2; }
 757        public int M1(object arg) { return 3; }
 758
 759        public int M2(int arg1, int arg2) { return 1; }
 760        public int M2(long arg1, int arg2) { return 2; }
 761        public int M2(int arg1, long arg2) { return 3; }
 762        public int M2(long arg1, long arg2) { return 4; }
 763        public int M2(object arg1, object arg2) { return 5; }
 764
 765        public int M4(int arg1, int arg2, int arg3, int arg4) { return 1; }
 766        public int M4(object arg1, object arg2, object arg3, object arg4) { return 2; }
 767
 768        public int M5(DispatchHelpers.B arg1, DispatchHelpers.B args) { return 1; }
 769        public int M5(DispatchHelpers.D arg1, DispatchHelpers.B args) { return 2; }
 770        public int M5(object arg1, object args) { return 3; }
 771
 772        public int M6(DispatchHelpers.B arg1, DispatchHelpers.B args) { return 1; }
 773        public int M6(DispatchHelpers.B arg1, DispatchHelpers.D args) { return 2; }
 774        public int M6(object arg1, DispatchHelpers.D args) { return 3; }
 775
 776        public int M7(DispatchHelpers.B arg1, DispatchHelpers.B args) { return 1; }
 777        public int M7(DispatchHelpers.B arg1, DispatchHelpers.D args) { return 2; }
 778        public int M7(DispatchHelpers.D arg1, DispatchHelpers.B args) { return 3; }
 779        public int M7(DispatchHelpers.D arg1, DispatchHelpers.D args) { return 4; }
 780
 781        public int M8(int arg1, int arg2) { return 1; }
 782        public int M8(DispatchHelpers.B arg1, DispatchHelpers.B args) { return 2; }
 783        public int M8(object arg1, object arg2) { return 3; }
 784    }
 785
 786    public class GenericTypeInference {
 787        public static PythonType M0<T>(T x) {
 788            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
 789        }
 790
 791        public static PythonType M0CC<T>(CodeContext context, T x) {
 792            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
 793        }
 794
 795        public static PythonType M1<T>(T x, T y) {
 796            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
 797        }
 798
 799        public static PythonType M2<T>(T x, T y, T z) {
 800            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
 801        }
 802
 803        public static PythonType M3<T>(params T[] x) {
 804            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
 805        }
 806
 807        public static PythonType M4<T>(T x, params T[] args) {
 808            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
 809        }
 810
 811        public static PythonType M5<T>(T x) where T : class {
 812            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
 813        }
 814
 815        public static PythonType M6<T>(T x) where T : struct {
 816            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
 817        }
 818
 819        public static PythonType M7<T>(T x) where T : IList {
 820            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
 821        }
 822
 823        public static PythonTuple M8<T0, T1>(T0 x, T1 y) where T0 : T1 {
 824            return PythonTuple.MakeTuple(DynamicHelpers.GetPythonTypeFromType(typeof(T0)), DynamicHelpers.GetPythonTypeFromType(typeof(T1)));
 825        }
 826
 827        public static PythonTuple M9<T0, T1>(object x, T1 y) where T0 : T1 {
 828            return PythonTuple.MakeTuple(DynamicHelpers.GetPythonTypeFromType(typeof(T0)), DynamicHelpers.GetPythonTypeFromType(typeof(T1)));
 829        }
 830
 831        public static PythonTuple M9b<T0, T1>(T0 x, object y) where T0 : T1 {
 832            return PythonTuple.MakeTuple(DynamicHelpers.GetPythonTypeFromType(typeof(T0)), DynamicHelpers.GetPythonTypeFromType(typeof(T1)));
 833        }
 834
 835        public static PythonTuple M10<T0, T1, T2>(T0 x, T1 y, T2 z)
 836            where T0 : T1
 837            where T1 : T2 {
 838            return PythonTuple.MakeTuple(
 839                DynamicHelpers.GetPythonTypeFromType(typeof(T0)),
 840                DynamicHelpers.GetPythonTypeFromType(typeof(T1)),
 841                DynamicHelpers.GetPythonTypeFromType(typeof(T2))
 842            );
 843        }
 844
 845        public static PythonTuple M10c<T0, T1, T2>(T0 x, T1 y, T2 z)
 846            where T0 : T1
 847            where T1 : class {
 848            return PythonTuple.MakeTuple(
 849                DynamicHelpers.GetPythonTypeFromType(typeof(T0)),
 850                DynamicHelpers.GetPythonTypeFromType(typeof(T1)),
 851                DynamicHelpers.GetPythonTypeFromType(typeof(T2))
 852            );
 853        }
 854
 855        public static PythonTuple M10IList<T0, T1, T2>(T0 x, T1 y, T2 z)
 856            where T0 : T1
 857            where T1 : IList {
 858            return PythonTuple.MakeTuple(
 859                DynamicHelpers.GetPythonTypeFromType(typeof(T0)),
 860                DynamicHelpers.GetPythonTypeFromType(typeof(T1)),
 861                DynamicHelpers.GetPythonTypeFromType(typeof(T2))
 862            );
 863        }
 864
 865        public static PythonTuple M10PythonTuple<T0, T1, T2>(T0 x, T1 y, T2 z)
 866            where T0 : T1
 867            where T1 : PythonTuple {
 868            return PythonTuple.MakeTuple(
 869                DynamicHelpers.GetPythonTypeFromType(typeof(T0)),
 870                DynamicHelpers.GetPythonTypeFromType(typeof(T1)),
 871                DynamicHelpers.GetPythonTypeFromType(typeof(T2))
 872            );
 873        }
 874
 875        public static PythonType M11<T>(object x) {
 876            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
 877        }
 878
 879        public static PythonType M12<T0, T1>(T0 x, object y) {
 880            return DynamicHelpers.GetPythonTypeFromType(typeof(T0));
 881        }
 882
 883        public static PythonTuple M13<T>(T x, Func<T> y) {
 884            return PythonTuple.MakeTuple(DynamicHelpers.GetPythonTypeFromType(typeof(T)), y());
 885        }
 886
 887        public static PythonType M14<T>(T x, Action<T> y) {
 888            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
 889        }
 890
 891        public static PythonTuple M15<T>(T x, IList<T> y) {
 892            PythonTuple res = PythonTuple.MakeTuple(DynamicHelpers.GetPythonTypeFromType(typeof(T)));
 893            res += PythonTuple.Make(y);
 894            return res;
 895        }
 896
 897        public static PythonTuple M16<T>(T x, Dictionary<T, IList<T>> y) {
 898            PythonTuple res = PythonTuple.MakeTuple(DynamicHelpers.GetPythonTypeFromType(typeof(T)));
 899            res += PythonTuple.Make(y);
 900            return res;
 901        }
 902
 903        public static PythonType M17<T>(T x, IEnumerable<T> y) {
 904            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
 905        }
 906
 907        
 908        public static PythonType M18<T>(T x) where T : IEnumerable<T> {
 909            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
 910        }
 911
 912        public static PythonTuple M19<T0, T1>(T0 x, T1 y) where T0 : IList<T1> {
 913            return PythonTuple.MakeTuple(DynamicHelpers.GetPythonTypeFromType(typeof(T0)), DynamicHelpers.GetPythonTypeFromType(typeof(T1)));
 914        }
 915
 916        public static PythonTuple M20<T0, T1>(T0 x, T1 y) {
 917            return PythonTuple.MakeTuple(DynamicHelpers.GetPythonTypeFromType(typeof(T0)), DynamicHelpers.GetPythonTypeFromType(typeof(T1)));
 918        }
 919
 920        public static PythonType M21<T>(IEnumerable<T> x) {
 921            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
 922        }
 923
 924        // overloads like Enumerable.Where<T>(...)
 925        public static PythonTuple M22<T>(IEnumerable<T> x, Func<T, bool> y) {
 926            return PythonTuple.MakeTuple(DynamicHelpers.GetPythonTypeFromType(typeof(T)), ScriptingRuntimeHelpers.True);
 927        }
 928
 929        public static PythonTuple M22<T>(IEnumerable<T> x, Func<T, int, bool> y) {
 930            M23(new List<int>());
 931            return PythonTuple.MakeTuple(DynamicHelpers.GetPythonTypeFromType(typeof(T)), ScriptingRuntimeHelpers.False);
 932        }
 933
 934        public static PythonType M23<T>(List<T> x) {
 935            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
 936        }
 937
 938        public static PythonType M24<T>(List<List<T>> x) {
 939            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
 940        }
 941
 942        public static PythonType M25<T>(Dictionary<T, T> x) {
 943            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
 944        }
 945
 946        public static PythonType M26<T>(List<T> x) where T : class {
 947            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
 948        }
 949
 950        public static PythonType M27<T>(List<T> x) where T : struct {
 951            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
 952        }
 953
 954        public static PythonType M28<T>(List<T> x) where T : new() {
 955            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
 956        }
 957
 958        public static PythonType M29<T>(Dictionary<Dictionary<T, T>, Dictionary<T, T>> x) {
 959            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
 960        }
 961
 962        public static PythonType M30<T>(Func<T, bool> x) where T : struct {
 963            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
 964        }
 965
 966        public static PythonType M31<T>(Func<T, bool> x) where T : IList {
 967            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
 968        }
 969
 970        public static PythonType M32<T>(List<T> x) where T : new() {
 971            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
 972        }
 973
 974        public static PythonType M33<T>(List<T> x) where T : class {
 975            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
 976        }
 977
 978        public static PythonType M34<T>(IList<T> x, IList<T> y) {
 979            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
 980        }
 981
 982        public static PythonType M35<T>(IList<T> x) {
 983            return DynamicHelpers.GetPythonTypeFromType(typeof(IList<T>));
 984        }
 985
 986        public static PythonType M35<T>(T[] x) {
 987            return DynamicHelpers.GetPythonTypeFromType(typeof(T[]));
 988        }
 989    }
 990
 991    public class SelfEnumerable : IEnumerable<SelfEnumerable> {
 992        #region IEnumerable<Test> Members
 993
 994        IEnumerator<SelfEnumerable> IEnumerable<SelfEnumerable>.GetEnumerator() {
 995            throw new NotImplementedException();
 996        }
 997
 998        #endregion
 999
1000        #region IEnumerable Members
1001
1002        IEnumerator IEnumerable.GetEnumerator() {
1003            throw new NotImplementedException();
1004        }
1005
1006        #endregion
1007    }
1008
1009
1010    public class GenericTypeInferenceInstance {
1011        public PythonType MInst<T>(T x) {
1012            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
1013        }
1014
1015        public PythonType M0<T>(T x) {
1016            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
1017        }
1018
1019        public PythonType M0CC<T>(CodeContext context, T x) {
1020            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
1021        }
1022
1023        public PythonType M1<T>(T x, T y) {
1024            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
1025        }
1026
1027        public PythonType M2<T>(T x, T y, T z) {
1028            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
1029        }
1030
1031        public PythonType M3<T>(params T[] x) {
1032            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
1033        }
1034
1035        public PythonType M4<T>(T x, params T[] args) {
1036            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
1037        }
1038
1039        public PythonType M5<T>(T x) where T : class {
1040            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
1041        }
1042
1043        public PythonType M6<T>(T x) where T : struct {
1044            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
1045        }
1046
1047        public PythonType M7<T>(T x) where T : IList {
1048            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
1049        }
1050
1051        public PythonTuple M8<T0, T1>(T0 x, T1 y) where T0 : T1 {
1052            return PythonTuple.MakeTuple(DynamicHelpers.GetPythonTypeFromType(typeof(T0)), DynamicHelpers.GetPythonTypeFromType(typeof(T1)));
1053        }
1054
1055        public PythonTuple M9<T0, T1>(object x, T1 y) where T0 : T1 {
1056            return PythonTuple.MakeTuple(DynamicHelpers.GetPythonTypeFromType(typeof(T0)), DynamicHelpers.GetPythonTypeFromType(typeof(T1)));
1057        }
1058
1059        public PythonTuple M9b<T0, T1>(T0 x, object y) where T0 : T1 {
1060            return PythonTuple.MakeTuple(DynamicHelpers.GetPythonTypeFromType(typeof(T0)), DynamicHelpers.GetPythonTypeFromType(typeof(T1)));
1061        }
1062
1063        public PythonTuple M10<T0, T1, T2>(T0 x, T1 y, T2 z)
1064            where T0 : T1
1065            where T1 : T2 {
1066            return PythonTuple.MakeTuple(
1067                DynamicHelpers.GetPythonTypeFromType(typeof(T0)),
1068                DynamicHelpers.GetPythonTypeFromType(typeof(T1)),
1069                DynamicHelpers.GetPythonTypeFromType(typeof(T2))
1070            );
1071        }
1072
1073        public PythonTuple M10c<T0, T1, T2>(T0 x, T1 y, T2 z)
1074            where T0 : T1
1075            where T1 : class {
1076            return PythonTuple.MakeTuple(
1077                DynamicHelpers.GetPythonTypeFromType(typeof(T0)),
1078                DynamicHelpers.GetPythonTypeFromType(typeof(T1)),
1079                DynamicHelpers.GetPythonTypeFromType(typeof(T2))
1080            );
1081        }
1082
1083        public PythonTuple M10IList<T0, T1, T2>(T0 x, T1 y, T2 z)
1084            where T0 : T1
1085            where T1 : IList {
1086            return PythonTuple.MakeTuple(
1087                DynamicHelpers.GetPythonTypeFromType(typeof(T0)),
1088                DynamicHelpers.GetPythonTypeFromType(typeof(T1)),
1089                DynamicHelpers.GetPythonTypeFromType(typeof(T2))
1090            );
1091        }
1092
1093        public PythonTuple M10PythonTuple<T0, T1, T2>(T0 x, T1 y, T2 z)
1094            where T0 : T1
1095            where T1 : PythonTuple {
1096            return PythonTuple.MakeTuple(
1097                DynamicHelpers.GetPythonTypeFromType(typeof(T0)),
1098                DynamicHelpers.GetPythonTypeFromType(typeof(T1)),
1099                DynamicHelpers.GetPythonTypeFromType(typeof(T2))
1100            );
1101        }
1102
1103        public PythonType M11<T>(object x) {
1104            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
1105        }
1106
1107        public PythonType M12<T0, T1>(T0 x, object y) {
1108            return DynamicHelpers.GetPythonTypeFromType(typeof(T0));
1109        }
1110
1111        public PythonTuple M13<T>(T x, Func<T> y) {
1112            return PythonTuple.MakeTuple(DynamicHelpers.GetPythonTypeFromType(typeof(T)), y());
1113        }
1114
1115        public PythonType M14<T>(T x, Action<T> y) {
1116            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
1117        }
1118
1119        public PythonTuple M15<T>(T x, IList<T> y) {
1120            PythonTuple res = PythonTuple.MakeTuple(DynamicHelpers.GetPythonTypeFromType(typeof(T)));
1121            res += PythonTuple.Make(y);
1122            return res;
1123        }
1124
1125        public PythonTuple M16<T>(T x, Dictionary<T, IList<T>> y) {
1126            PythonTuple res = PythonTuple.MakeTuple(DynamicHelpers.GetPythonTypeFromType(typeof(T)));
1127            res += PythonTuple.Make(y);
1128            return res;
1129        }
1130
1131        public PythonType M17<T>(T x, IEnumerable<T> y) {
1132            return DynamicHelpers.GetPythonTypeFromType(typeof(T));
1133        }
1134
1135
1136        public PythonType M18<T>(T x) where T : IEnumerable<T> {
1137            return DynamicHelpers.GetPyth

Large files files are truncated, but you can click here to view the full file