ruby-core

Mailing list archive

[ruby-core:66773] [ruby-trunk - Bug #10586] [Open] function wrongly returns nil in eval()

From: dkoba.tmpvar@...
Date: 2014-12-11 04:22:20 UTC
List: ruby-core #66773
Issue #10586 has been reported by Daisuke Kobayashi.

----------------------------------------
Bug #10586: function wrongly returns nil in eval()
https://bugs.ruby-lang.org/issues/10586

* Author: Daisuke Kobayashi
* Status: Open
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
* ruby -v: ruby 2.0.0p598 (2014-11-13) [x86_64-cygwin]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
In the following code, function returns nil in eval().
Getting rid of the last line, it returns 1 as we expect.
------------------
def foo; 1; end
p foo #=> 1
eval 'p foo' #=> nil (NG,expect=1)
foo=1 #<- bug trigger
------------------


---Files--------------------------------
code1.rb (244 Bytes)
code2.rb (126 Bytes)


-- 
https://bugs.ruby-lang.org/

In This Thread

Prev Next