Permalink
Browse files

Syncing to head of TFS for 0.9.2

  • Loading branch information...
1 parent abdb256 commit 6b6e2981a9037d8232663bd83063c5e68f6e0b9f @jredville jredville committed Oct 29, 2009
Showing with 938 additions and 894 deletions.
  1. +2 −0 Merlin/Main/Languages/IronPython/IronPythonConsole/IronPythonConsole.csproj
  2. +2 −0 Merlin/Main/Languages/IronPython/IronPythonConsoleAny/IronPythonConsoleAny.csproj
  3. +2 −0 Merlin/Main/Languages/IronPython/IronPythonWindow/IronPythonWindow.csproj
  4. +2 −0 Merlin/Main/Languages/IronPython/IronPythonWindowAny/IronPythonWindowAny.csproj
  5. +2 −0 Merlin/Main/Languages/Ruby/Console/Ruby.Console.csproj
  6. +2 −0 Merlin/Main/Languages/Ruby/Console/Ruby.ConsoleAny.csproj
  7. +2 −0 Merlin/Main/Languages/Ruby/IronRuby.Tests/IronRuby.Tests.csproj
  8. +4 −1 Merlin/Main/Languages/Ruby/IronRuby.Tests/RubyTests.cs
  9. +194 −2 Merlin/Main/Languages/Ruby/IronRuby.Tests/Runtime/ClrTests.cs
  10. +13 −3 Merlin/Main/Languages/Ruby/IronRuby.Tests/Runtime/DlrInteropTests.cs
  11. +11 −0 Merlin/Main/Languages/Ruby/IronRuby.Tests/Runtime/HostingTests.cs
  12. +3 −10 Merlin/Main/Languages/Ruby/IronRuby.Tests/Runtime/LoaderTests.cs
  13. +1 −1 Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/ModuleOps.cs
  14. +15 −3 Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/MutableStringOps.cs
  15. +1 −1 Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/ObjectOps.cs
  16. +2 −2 Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Extensions/IronRubyOps.cs
  17. +4 −2 Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Initializers.Generated.cs
  18. +1 −1 Merlin/Main/Languages/Ruby/Ruby/Builtins/LibraryInitializer.cs
  19. +11 −11 Merlin/Main/Languages/Ruby/Ruby/Builtins/RubyClass.cs
  20. +32 −0 Merlin/Main/Languages/Ruby/Ruby/Builtins/RubyMethod.cs
  21. +34 −31 Merlin/Main/Languages/Ruby/Ruby/Builtins/RubyModule.cs
  22. +36 −220 Merlin/Main/Languages/Ruby/Ruby/Compiler/Generation/ClsTypeEmitter.cs
  23. +29 −0 Merlin/Main/Languages/Ruby/Ruby/Compiler/Generation/IRubyType.cs
  24. +16 −4 Merlin/Main/Languages/Ruby/Ruby/Compiler/Generation/InterfacesBuilder.cs
  25. +0 −190 Merlin/Main/Languages/Ruby/Ruby/Compiler/Generation/OverriddenMembers.cs
  26. +97 −85 Merlin/Main/Languages/Ruby/Ruby/Compiler/Generation/RubyTypeBuilder.cs
  27. +6 −4 Merlin/Main/Languages/Ruby/Ruby/Compiler/Generation/RubyTypeDispenser.cs
  28. +15 −27 Merlin/Main/Languages/Ruby/Ruby/Compiler/Generation/RubyTypeEmitter.cs
  29. +4 −2 Merlin/Main/Languages/Ruby/Ruby/Compiler/ReflectionCache.Generated.cs
  30. BIN Merlin/Main/Languages/Ruby/Ruby/Ruby.Build.csproj
  31. +1 −1 Merlin/Main/Languages/Ruby/Ruby/Ruby.csproj
  32. +14 −1 Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/InteropBinder.cs
  33. +19 −4 Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/RubyBinder.cs
  34. +88 −11 Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/RubyMethodGroupBase.cs
  35. +1 −170 Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/RubyMethodGroupInfo.cs
  36. +16 −5 Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/RubyOverloadResolver.cs
  37. +13 −3 Merlin/Main/Languages/Ruby/Ruby/Runtime/Loader.cs
  38. +1 −1 Merlin/Main/Languages/Ruby/Ruby/Runtime/Protocols.cs
  39. +36 −39 Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyContext.cs
  40. +18 −9 Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyGlobalScope.cs
  41. +8 −0 Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyOps.cs
  42. +3 −1 Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyScope.cs
  43. +9 −3 Merlin/Main/Languages/Ruby/Tests/Interop/net/class/mapping_spec.rb
  44. +1 −1 Merlin/Main/Languages/Ruby/Tests/Interop/net/class/shared/uninstantiable.rb
  45. +5 −0 Merlin/Main/Runtime/Microsoft.Dynamic/Actions/Calls/BindingResult.cs
  46. +4 −0 Merlin/Main/Runtime/Microsoft.Dynamic/Actions/Calls/CallFailureReason.cs
  47. +12 −1 Merlin/Main/Runtime/Microsoft.Dynamic/Actions/Calls/OverloadResolver.cs
  48. +1 −1 Merlin/Main/Runtime/Microsoft.Dynamic/Hosting/Shell/CommandLine.cs
  49. +23 −3 Merlin/Main/Runtime/Microsoft.Scripting/Hosting/Providers/HostingHelpers.cs
  50. +20 −4 Merlin/Main/Runtime/Microsoft.Scripting/Hosting/ScriptEngine.cs
  51. +13 −2 Merlin/Main/Runtime/Microsoft.Scripting/Hosting/ScriptRuntime.cs
  52. +11 −14 Merlin/Main/Runtime/Microsoft.Scripting/Hosting/ScriptScope.cs
  53. BIN Merlin/Main/Runtime/Microsoft.Scripting/Microsoft.Scripting.Build.csproj
  54. +1 −1 Merlin/Main/Runtime/Microsoft.Scripting/Microsoft.Scripting.csproj
  55. +3 −3 Merlin/Main/Runtime/Microsoft.Scripting/Runtime/DynamicOperations.cs
  56. +25 −6 Merlin/Main/Runtime/Microsoft.Scripting/Runtime/Scope.cs
  57. +19 −10 Merlin/Main/Runtime/Microsoft.Scripting/Runtime/ScopeStorage.cs
  58. +30 −0 Merlin/Main/Runtime/Microsoft.Scripting/Utils/ExpressionUtils.cs
@@ -66,6 +66,7 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<UseVSHostingProcess>true</UseVSHostingProcess>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'V4 Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -77,6 +78,7 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<DelaySigned>true</DelaySigned>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
@@ -65,6 +65,7 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<UseVSHostingProcess>true</UseVSHostingProcess>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'V4 Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -76,6 +77,7 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<DelaySigned>true</DelaySigned>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\IronPythonConsole\AssemblyInfo.cs" />
@@ -74,6 +74,7 @@
<DefineConstants>TRACE;DEBUG;IRONPYTHON_WINDOW;CLR4;$(SignedSym)</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'V4 Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -82,6 +83,7 @@
<DefineConstants>TRACE;IRONPYTHON_WINDOW;CLR4;$(SignedSym)</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
@@ -72,6 +72,7 @@
<DefineConstants>TRACE;DEBUG;IRONPYTHON_WINDOW;CLR4;$(SignedSym)</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'V4 Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -80,6 +81,7 @@
<DefineConstants>TRACE;IRONPYTHON_WINDOW;CLR4;$(SignedSym)</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\IronPythonWindow\IronPythonWindow.cs" />
@@ -52,6 +52,7 @@
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'V4 Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -61,6 +62,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<ItemGroup>
<Compile Include="Program.cs" />
@@ -50,6 +50,7 @@
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'V4 Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -59,6 +60,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<ItemGroup>
<Compile Include="Program.cs" />
@@ -47,6 +47,7 @@
<DefineConstants>TRACE;CLR4;$(SignedSym)</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'V4 Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -56,6 +57,7 @@
<DefineConstants>TRACE;DEBUG;CLR4;$(SignedSym)</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<ItemGroup>
<Compile Include="Driver.cs" />
@@ -406,6 +406,7 @@ public partial class Tests {
ClrNamespaces2,
ClrGenerics1,
ClrGenerics2,
+ ClrGenerics3,
ClrMethods1,
ClrMethods2,
ClrMethods3,
@@ -444,7 +445,9 @@ public partial class Tests {
ClrOverride1,
ClrOverride2,
ClrOverride3,
- //TODO: Fix ClrOverride4,
+ ClrOverride4,
+ ClrOverride5,
+ ClrOverride6,
ClrEventImpl1,
ClrDetachedVirtual1,
ClrConstructor1,
@@ -45,6 +45,19 @@ public class D : C {
public class D<T> : C<T> {
public override int Arity { get { return 11; } }
}
+
+ public interface J<T> {
+ void MethodOnJ();
+ }
+
+ public interface I<T> : J<T> {
+ void MethodOnI();
+ }
+
+ public class E<T> : I<T>, J<T> {
+ void I<T>.MethodOnI() { }
+ void J<T>.MethodOnJ() { }
+ }
}
namespace InteropTests.Namespaces2 {
@@ -1388,7 +1401,7 @@ p C.new.arity
#<ArgumentError: `InteropTests::Generics1::C[Fixnum]' is not a generic type definition>
");
- // C<T> instantiations are subclasses of C<>:
+ // C<> is a mixin for all its instantiations:
TestOutput(@"
include InteropTests::Generics1
C[1].class_eval do
@@ -1404,6 +1417,65 @@ p self.class
InteropTests::Generics1::C[Fixnum]
InteropTests::Generics1::C[String]
[InteropTests::Generics1::C[Float], InteropTests::Generics1::C[T], Object]
+");
+
+ // It is possible to include a generic type definition into another class. It behaves like a Ruby module.
+ // Besides inclusion of a generic interface instantiation transitively includes its generic type definition.
+ TestOutput(@"
+include InteropTests::Generics1
+
+class ClassA
+ include C[1]
+ include I[1]
+ p ancestors
+ new
+end
+
+class ClassB
+ include C[Fixnum] rescue p $!
+ include I[Fixnum]
+ p ancestors
+ new
+end
+", @"
+[ClassA, InteropTests::Generics1::I[T], InteropTests::Generics1::C[T], Object, InteropTests::Generics1, Kernel]
+#<TypeError: wrong argument type Class (expected Module)>
+[ClassB, InteropTests::Generics1::I[Fixnum], InteropTests::Generics1::I[T], Object, InteropTests::Generics1, Kernel]
+");
+
+ // generic type definitions cannot be instantiated and don't expose their methods:
+ TestOutput(@"
+include InteropTests::Generics1
+p C[Fixnum].new.method(:Arity)
+C[1].new rescue p $!
+C[1].instance_method(:Arity) rescue p $!
+", @"
+#<Method: InteropTests::Generics1::C[Fixnum]#Arity>
+#<NoMethodError: undefined method `new' for InteropTests::Generics1::C[T]:Module>
+#<NameError: undefined method `Arity' for module `InteropTests::Generics1::C[T]'>
+");
+ }
+
+ public class GenericClass1<T> {
+ public int Foo(T item) {
+ return 1;
+ }
+ }
+
+ public class GenericSubclass1<T> : GenericClass1<T> {
+ }
+
+ public void ClrGenerics2() {
+ Context.ObjectClass.SetConstant("T", Context.GetClass(GetType()));
+
+ // CLR methods with generic arguments defined on a generic type don't get duplicated:
+ // (C<T> inherits from C<> but the generic type definition should be ignored when looking for CLR method overloads):
+ TestOutput(@"
+p T::GenericClass1[Fixnum].new.foo(1)
+p T::GenericSubclass1[Fixnum].new.foo(1)
+", @"
+1
+1
");
}
@@ -1430,7 +1502,7 @@ public class C<T, S> {
}
}
- public void ClrGenerics2() {
+ public void ClrGenerics3() {
Context.ObjectClass.SetConstant("C1", Context.GetClass(typeof(ClassWithNestedGenericTypes1)));
Context.ObjectClass.SetConstant("C2", Context.GetClass(typeof(ClassWithNestedGenericTypes2)));
@@ -1765,6 +1837,126 @@ p E.new.virtual_method
");
}
+ public class ClassWithProperties {
+ private int _prop;
+ private int[] _values = new int[1];
+
+ public virtual int Prop {
+ get { return _prop; }
+ set { _prop = value; }
+ }
+
+ public virtual int this[int i] {
+ get { return _values[i]; }
+ set { _values[i] = value; }
+ }
+
+ public int[] Report() {
+ Prop = 10;
+ this[0] = 20;
+ return new int[] { Prop, _prop, this[0], _values[0] };
+ }
+ }
+
+ public void ClrOverride5() {
+ Context.ObjectClass.SetConstant("C", Context.GetClass(typeof(ClassWithProperties)));
+ TestOutput(@"
+class D < C
+end
+
+p D.new.report
+
+class D < C
+ def prop
+ 4
+ end
+
+ def prop= value
+ super(5)
+ end
+
+ def [] index
+ 6
+ end
+
+ def []= index, value
+ super(index, 7)
+ end
+end
+
+p D.new.report
+", @"
+[10, 10, 20, 20]
+[4, 5, 6, 7]
+");
+ }
+
+ public class ClassWithVirtuals1 {
+ public virtual int Foo() { return 1; }
+ public virtual int Goo() { return 20; }
+ protected int Prot() { return 1000; }
+
+ public virtual int Bar() { return 1; }
+ }
+
+ public class ClassWithVirtuals2 : ClassWithVirtuals1 {
+ public int Report() {
+ return Foo() + Goo();
+ }
+
+ public sealed override int Goo() { return 30; }
+
+ public override int Bar() { return 2; }
+ }
+
+ public class ClassWithVirtuals3 : ClassWithVirtuals2 {
+ public override int Bar() { return 3; }
+ }
+
+ public interface I1 { int f(); }
+ public interface I2 { int g(); }
+
+ public void ClrOverride6() {
+ Context.ObjectClass.SetConstant("C", Context.GetClass(typeof(ClassWithVirtuals2)));
+ Context.ObjectClass.SetConstant("I1", Context.GetModule(typeof(I1)));
+ Context.ObjectClass.SetConstant("I2", Context.GetModule(typeof(I2)));
+ TestOutput(@"
+class D < C
+ include I1
+end
+
+class E < D
+ include I2
+
+ def foo
+ super + 100
+ end
+
+ def goo
+ super + prot
+ end
+end
+
+p E.new.report
+p E.new.goo
+", @"
+131
+1030
+");
+
+ AssertOutput(() => CompilerTest(@"
+class C
+ def bar
+ super + 100
+ end
+end
+
+C.new.bar rescue p $!
+"), @"
+#<NoMethodError: Virtual CLR method `bar' called via super from *; Super calls to virtual CLR methods can only be used in a Ruby subclass of the class declaring the method>
+", OutputFlags.Match);
+ }
+
/// <summary>
/// See RubyMethodGroupBase.BuildCallNoFlow.
/// </summary>
Oops, something went wrong.

0 comments on commit 6b6e298

Please sign in to comment.