edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/IronRuby.Tests/RubyTests.cs;C1044711
File: RubyTests.cs
===================================================================
--- $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/IronRuby.Tests/RubyTests.cs;C1044711  (server)    8/24/2009 9:28 AM
+++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/IronRuby.Tests/RubyTests.cs;NilBlocks
@@ -99,7 +99,6 @@
                 Scenario_RubySingletonConstants1,
                 Scenario_RubyMath1,
 
-                File1,
                 StringsPlus,
                 Strings0,
                 Strings1,
@@ -115,7 +114,9 @@
                 ToSConversion2,
                 Inspect1,
                 Inspect2,
-
+                File1,
+                File2,
+                
                 Regex1,
                 Regex2,
                 RegexTransform1,
===================================================================
edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/IronRuby.Tests/Runtime/ClrTests.cs;C1044711
File: ClrTests.cs
===================================================================
--- $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/IronRuby.Tests/Runtime/ClrTests.cs;C1044711  (server)    8/24/2009 9:28 AM
+++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/IronRuby.Tests/Runtime/ClrTests.cs;NilBlocks
@@ -1363,6 +1363,8 @@
 
             Engine.Execute<Action<int>>(@"System::Action[Fixnum].new { |x| $x = x + 1 }")(10);
             Assert((int)Context.GetGlobalVariable("x") == 11);
+
+            AssertExceptionThrown<LocalJumpError>(() => Engine.Execute(@"System::Action.new(&nil)"));
         }
 
         public void ClrEvents1() {
===================================================================
edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/IronRuby.Tests/Runtime/IoTests.cs;C1055652
File: IoTests.cs
===================================================================
--- $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/IronRuby.Tests/Runtime/IoTests.cs;C1055652  (server)    8/24/2009 9:28 AM
+++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/IronRuby.Tests/Runtime/IoTests.cs;NilBlocks
@@ -29,6 +29,15 @@
             Test_Read1();
         }
 
+        public void File2() {
+            TestOutput(@"
+stdout = IO.open(1, 'w', &nil) 
+stdout.puts('hello')
+", @"
+hello
+");
+        }
+
         private class TestStream : MemoryStream {
             private readonly bool _canSeek;
 
===================================================================
edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/IoOps.cs;C1068248
File: IoOps.cs
===================================================================
--- $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/IoOps.cs;C1068248  (server)    8/24/2009 9:28 AM
+++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/IoOps.cs;NilBlocks
@@ -144,7 +144,6 @@
                 targetClass.BuildObjectConstructionNoFlow(metaBuilder, args, name);
 
                 // TODO: initialize yields the block?
-                // TODO: null block check
                 if (args.Signature.HasBlock) {
                     // ignore flow builder set up so far, we need one that creates a BlockParam for library calls:
                     metaBuilder.ControlFlowBuilder = null;
@@ -167,7 +166,7 @@
         }
 
         [Emitted]
-        public static object InvokeOpenBlock(UnaryOpStorage/*!*/ closeStorage, BlockParam/*!*/ block, object obj) {
+        public static object InvokeOpenBlock(UnaryOpStorage/*!*/ closeStorage, BlockParam block, object obj) {
             object result = obj;
             if (!RubyOps.IsRetrySingleton(obj) && block != null) {
                 try {
===================================================================
edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/ProcOps.cs;C966724
File: ProcOps.cs
===================================================================
--- $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/ProcOps.cs;C966724  (server)    8/24/2009 9:28 AM
+++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/ProcOps.cs;NilBlocks
@@ -160,7 +160,7 @@
 
         [RubyMethod("new", RubyMethodAttributes.PublicSingleton)]
         public static Proc/*!*/ CreateNew(CallSiteStorage<Func<CallSite, Proc, Proc, object>>/*!*/ storage, 
-            BlockParam/*!*/ block, RubyClass/*!*/ self) {
+            BlockParam block, RubyClass/*!*/ self) {
 
             if (block == null) {
                 throw RubyExceptions.CreateArgumentError("tried to create Proc object without a block");
===================================================================
edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Builtins/RubyClass.cs;C1057011
File: RubyClass.cs
===================================================================
--- $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Builtins/RubyClass.cs;C1057011  (server)    8/24/2009 9:28 AM
+++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Builtins/RubyClass.cs;NilBlocks
@@ -1290,7 +1290,9 @@
                     metaBuilder.Result = MarkNewException(metaBuilder.Result);
 
                     // we need to handle break, which unwinds to a proc-converter that could be this method's frame:
-                    metaBuilder.ControlFlowBuilder = RubyMethodGroupInfo.RuleControlFlowBuilder;
+                    if (args.Signature.HasBlock) {
+                        metaBuilder.ControlFlowBuilder = RubyMethodGroupInfo.RuleControlFlowBuilder;
+                    }
                 }
             }
         }
===================================================================
edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyOps.cs;C1055652
File: RubyOps.cs
===================================================================
--- $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyOps.cs;C1055652  (server)    8/24/2009 9:28 AM
+++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyOps.cs;NilBlocks
@@ -1942,7 +1942,10 @@
         }
 
         [Emitted]
-        public static Delegate/*!*/ CreateDelegateFromProc(Type/*!*/ type, Proc/*!*/ proc) {
+        public static Delegate/*!*/ CreateDelegateFromProc(Type/*!*/ type, Proc proc) {
+            if (proc == null) {
+                throw RubyExceptions.NoBlockGiven();
+            }
             BlockParam bp = CreateBfcForProcCall(proc);
             return proc.LocalScope.RubyContext.GetDelegate(bp, type);
         }
===================================================================
edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/RubyMethodGroupBase.cs;C1040664
File: RubyMethodGroupBase.cs
===================================================================
--- $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/RubyMethodGroupBase.cs;C1040664  (server)    8/24/2009 9:28 AM
+++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/RubyMethodGroupBase.cs;NilBlocks
@@ -197,21 +197,8 @@
             
             // At runtime the BlockParam is created with a new RFC instance that identifies the library method frame as 
             // a proc-converter target of a method unwinder triggered by break from a block.
-            if (args.Signature.HasBlock) {
-                var metaBlock = args.GetMetaBlock();
-                if (metaBlock.Value != null && calleeHasBlockParam) {
-                    Debug.Assert(metaBuilder.BfcVariable != null);
-                    metaBuilder.ControlFlowBuilder = RuleControlFlowBuilder;
-                }
-
-                // Overload resolution might not need to distinguish between nil and non-nil block.
-                // However, we still do since we construct CF only for non-nil blocks.
-                if (metaBlock.Value == null) {
-                    metaBuilder.AddRestriction(Ast.Equal(metaBlock.Expression, AstUtils.Constant(null)));
-                } else {
-                    // don't need to test the exact type of the Proc since the code is subclass agnostic:
-                    metaBuilder.AddRestriction(Ast.NotEqual(metaBlock.Expression, AstUtils.Constant(null)));
-                }
+            if (args.Signature.HasBlock && calleeHasBlockParam) {
+                metaBuilder.ControlFlowBuilder = RuleControlFlowBuilder;
             }
 
             // add restrictions used for overload resolution:
@@ -267,43 +254,37 @@
                 return;
             }
 
-            Expression expression = metaBuilder.Result;
+            var metaBlock = args.GetMetaBlock();
+            Debug.Assert(metaBlock != null, "RuleControlFlowBuilder should only be used if the signature has a block");
+            
+            // We construct CF only for non-nil blocks thus we need a test for it:
+            if (metaBlock.Value == null) {
+                metaBuilder.AddRestriction(Ast.Equal(metaBlock.Expression, AstUtils.Constant(null)));
+                return;
+            }
+
+            // don't need to test the exact type of the Proc since the code is subclass agnostic:
+            metaBuilder.AddRestriction(Ast.NotEqual(metaBlock.Expression, AstUtils.Constant(null)));
             Expression bfcVariable = metaBuilder.BfcVariable;
-
+            Debug.Assert(bfcVariable != null);
+            
             // Method call with proc can invoke control flow that returns an arbitrary value from the call, so we need to type result to Object.
             // Otherwise, the result could only be result of targetExpression unless its return type is void.
-            Type resultType = (bfcVariable != null) ? typeof(object) : expression.Type;
+            Expression resultVariable = metaBuilder.GetTemporary(typeof(object), "#result");
+            ParameterExpression methodUnwinder = metaBuilder.GetTemporary(typeof(MethodUnwinder), "#unwinder");
 
-            Expression resultVariable;
-            if (resultType != typeof(void)) {
-                resultVariable = metaBuilder.GetTemporary(resultType, "#result");
-            } else {
-                resultVariable = AstUtils.Empty();
-            }
-
-            if (expression.Type != typeof(void)) {
-                expression = Ast.Assign(resultVariable, AstUtils.Convert(expression, resultType));
-            }
-
-            // a non-null proc is being passed to the callee:
-            if (bfcVariable != null) {
-                ParameterExpression methodUnwinder = metaBuilder.GetTemporary(typeof(MethodUnwinder), "#unwinder");
-
-                expression = AstFactory.Block(
-                    Ast.Assign(bfcVariable, Methods.CreateBfcForLibraryMethod.OpCall(AstUtils.Convert(args.GetBlockExpression(), typeof(Proc)))),
-                    AstUtils.Try(
-                        expression
-                    ).Filter(methodUnwinder, Methods.IsProcConverterTarget.OpCall(bfcVariable, methodUnwinder),
-                        Ast.Assign(resultVariable, Ast.Field(methodUnwinder, MethodUnwinder.ReturnValueField)),
-                        AstUtils.Default(expression.Type)
-                    ).Finally(
-                        Methods.LeaveProcConverter.OpCall(bfcVariable)
-                    ),
-                    resultVariable
-                );
-            }
-
-            metaBuilder.Result = expression;
+            metaBuilder.Result = AstFactory.Block(
+                Ast.Assign(bfcVariable, Methods.CreateBfcForLibraryMethod.OpCall(AstUtils.Convert(args.GetBlockExpression(), typeof(Proc)))),
+                AstUtils.Try(
+                    Ast.Assign(resultVariable, AstUtils.Convert(metaBuilder.Result, typeof(object)))
+                ).Filter(methodUnwinder, Methods.IsProcConverterTarget.OpCall(bfcVariable, methodUnwinder),
+                    Ast.Assign(resultVariable, Ast.Field(methodUnwinder, MethodUnwinder.ReturnValueField)),
+                    AstUtils.Default(typeof(object))
+                ).Finally(
+                    Methods.LeaveProcConverter.OpCall(bfcVariable)
+                ),
+                resultVariable
+            );
         }
 
         private static bool HasBlockParameter(MethodBase/*!*/ method) {
===================================================================
