hy/tests/native_tests
Zack M. Davis 2ad2d5a418 fix keyword lambda values by retaining statements in Result
As reported in issue #748, there was a bug in which passing a lambda
as the value of a :keyword argument would fail—

$ hy --spy
hy 0.10.1 using CPython(default) 3.4.0 on Linux
=> (sorted (range 10) :key (fn [x] (- x)))
from hy.core.language import range
sorted(range(10), key=_hy_anon_fn_1)
Traceback (most recent call last):
  File "<input>", line 1, in <module>
NameError: name '_hy_anon_fn_1' is not defined

The function call would appear in the generated AST without being
preceded by the appropriate function definition corresponding to the
anonymous function argument value in the Hy source, causing either a
NameError (as in the example above), or erroneous reuse of whatever
function was already pointed to by the `_hy_anon_fn_` name referenced
in the list of keywords passed to `ast.Call`.

This commit aims to fix the problem by handling it in same way that
the expression/statement gap is bridged many other places in the
compiler, by adding the compiled value of the keyword argument to the
Result object being built during `_compile_collect`, with the
understanding that any Python statements implied by the argument value
will be appropriately preserved therein.
2015-04-26 15:57:08 -07:00
..
contrib anaphoric: fix first & last when conditions fail 2014-05-24 17:48:46 +05:30
__init__.hy ideas, ideas. 2013-03-05 18:39:34 -05:00
cons.hy Add a cons object and related mechanisms 2014-01-23 23:08:52 +01:00
core.hy Re-implemented last function so that it also supports iterators. Added a test to reflect this. 2015-04-07 10:30:52 +01:00
defclass.hy Add macro expansion in defclass 2014-12-07 11:52:09 +10:00
language.hy fix keyword lambda values by retaining statements in Result 2015-04-26 15:57:08 -07:00
mathematics.hy adds support for Python 3.5 infix matrix multiplication 2015-04-12 21:45:39 -07:00
native_macros.hy Test to ensure exception handling in yield-from works right 2014-11-20 20:48:15 -06:00
py3_only_tests.hy Implement yield-from in Python 2.x as a macro 2014-11-20 20:48:15 -06:00
quote.hy Remove HyLambdaListKeyword from the parser 2014-06-03 21:36:49 -04:00
reader_macros.hy Fix reader macros to actually be macros 2014-01-17 01:07:47 +01:00
shadow.hy Shadow '+' to handle string/list concatenation 2014-08-26 21:38:52 +12:00
unless.hy add nil as synonym for None 2013-12-27 13:50:19 -07:00
when.hy add nil as synonym for None 2013-12-27 13:50:19 -07:00
with_decorator.hy Added a fix for nested decorators. Fixes #752 2015-01-14 19:42:02 +00:00
with_test.hy added for and with macros 2013-12-29 16:50:21 +01:00