Commit Graph

2433 Commits

Author SHA1 Message Date
Kodi Arfer
b7e5c5f17a Allow while with an empty body 2018-04-29 19:51:00 -07:00
Kodi Arfer
1eccd10d24
Merge pull request #1583 from Kodiologist/update-test_preprocessor_exceptions
Update test_preprocessor_exceptions
2018-04-29 19:50:30 -07:00
Kodi Arfer
a8fe95c5b6 Update test_preprocessor_exceptions
This test has been passing since b023ebd0b5, so I removed the xfail. I also rewrote the test to use pytest.raises.
2018-04-29 19:29:17 -07:00
Kodi Arfer
e5c55d08c9
Merge pull request #1582 from Kodiologist/hysequence
Don't let HyExpression etc. inherit from HyList
2018-04-29 19:26:55 -07:00
Kodi Arfer
87aced2370 Don't let HyExpression etc. inherit from HyList
This means the compiler no longer allows e.g. `(fn (x) ...)` in place of `(fn [x] ...)`.
2018-04-29 19:17:47 -07:00
Simon Gomizelj
032247e380
Merge pull request #1588 from Kodiologist/no-amp-key
Remove &key
2018-04-27 00:21:11 -04:00
Ryan Gonzalez
fbeff8d25c
Merge pull request #1587 from Kodiologist/no-empty-catchers
Ban `(except)`
2018-04-23 21:50:56 -05:00
Kodi Arfer
e3d21118c0
Merge pull request #1575 from Kodiologist/fix-macroexpand-nan
Fix bug in macro-expanding NaN
2018-04-21 12:34:51 -07:00
Kodi Arfer
c1a487cdf7 Move logic from macroexpand_1 to macroexpand
By ending macro-expansion immediately when appropriate, this change fixes a bug arising from the fact that NaN != NaN.
2018-04-21 12:25:29 -07:00
Kodi Arfer
026316ebef Refactor macroexpand_1 2018-04-21 12:25:29 -07:00
Kodi Arfer
116d7fa6ec Copy in compile_atom instead of macroexpand_1
This copying is what keeps all the mutating code in the compiler methods (e.g., `expr.pop(0)`) from breaking cases in which Hy model objects are compiled more than once or inspected after compilation.
2018-04-21 12:25:29 -07:00
Kodi Arfer
4a6b633ad2 Add some missing imports 2018-04-21 12:25:29 -07:00
Kodi Arfer
1f95da2b0b Avoid using a core function name as a variable 2018-04-21 12:25:29 -07:00
Kodi Arfer
a605936651 Remove &key
It's redundant with &optional.
2018-04-19 09:26:02 -07:00
Kodi Arfer
7bf2901364 Ban (except)
It's rarely useful, because it catches all exceptions, but it doesn't let you do anything other than return `None`. You can still get the same effect with `(except [])`.
2018-04-16 19:34:50 -07:00
Kodi Arfer
80bece497a
Merge pull request #1558 from vodik/fix-tests-under-pipenv
Fix unit tests when run with PYTHONDONTWRITEBYTECODE
2018-04-14 12:40:40 -07:00
Simon Gomizelj
fa54884131 Fix unit tests when run with PYTHONDONTWRITEBYTECODE
When set, it will conflict with any tests that generate bytecode
because they don't expect it to be set.

Fixable by sanitize the environment before forking, but we can't do
anything about import tests.

This is a pipenv default, and possibly a sane flag to set while doing
Hy development, so lets not let it be a hazard for developers to trip
over.
2018-04-14 12:12:01 -07:00
Kodi Arfer
cef105edcd
Merge pull request #1580 from Kodiologist/nocons
Burninate HyCons
2018-04-12 16:59:15 -07:00
Kodi Arfer
bbf669d407 Update docs and NEWS for HyCons removal 2018-04-12 16:45:17 -07:00
Kodi Arfer
c93a60ede0 Remove support for cons cells 2018-04-12 16:45:17 -07:00
Kodi Arfer
097647bf6f Remove tests of cons cells 2018-04-12 16:45:17 -07:00
Kodi Arfer
736426fc12
Merge pull request #1547 from Kodiologist/hy2py-testing
Improve testing of hy2py
2018-04-08 20:46:17 -07:00
Kodi Arfer
f332ad2eae Improve testing of hy2py
Instead of just checking that hy2py outputs a nonempty string and doesn't crash, we check that a hy2py-generated Python program works the same as the original Hy program.

This test suggests my plan to make hy2py output real Python has succeeded, so I updated NEWS accordingly.
2018-04-08 15:35:57 -07:00
Kodi Arfer
096aac244f
Merge pull request #1543 from vodik/keywords-as-objects
Make HyKeyword a first class objects
2018-04-07 22:37:48 -07:00
Simon Gomizelj
69202df23d Update documentation and add a NEW entry 2018-04-07 22:29:20 -07:00
Simon Gomizelj
291847af15 Make HyKeyword constructor consistent
The colon is now only part of its string representation and no longer
accepted as part of the constructor:

  :foobar == HyKeyword("foobar")
2018-04-07 22:29:20 -07:00
Simon Gomizelj
1b7dfd2839 Make HyKeyword a first class objects
HyKeywords are no longer an instances of string with a particular
prefix, but a completely separate object.

This means keywords no longer trip isinstance str checks, adding a
little bit of type safety to the compiler.

It also means that HyKeywords evaluate to themselves.

Closes #1352
2018-04-07 22:29:20 -07:00
Kodi Arfer
2ad3401b36
Merge pull request #1572 from waigx/fix/hystring
Raise LexException when codec can't decode some bytes
2018-04-07 11:54:52 -07:00
Yigong Wang
564c030950 Raise LexException when codec can't decode some bytes 2018-04-07 11:47:06 -07:00
Simon Gomizelj
4d98cde663
Merge pull request #1560 from waigx/feat/results-shortcuts
Add recent REPL results globals *i and most recent error *e
2018-04-04 19:27:35 -04:00
Kodi Arfer
69b96872a3
Merge pull request #1570 from waigx/chore/authors
Add Yigong Wang to AUTHORS
2018-04-04 16:16:11 -07:00
Yigong Wang
966bbc3121 Add Yigong Wang to AUTHORS 2018-04-04 19:00:07 -04:00
Simon Gomizelj
512b032652
Merge pull request #1567 from Kodiologist/mangle-x-py3
Use `X` as the mangle delimiter on Python 3
2018-04-04 17:51:55 -04:00
gilch
be06741e03
Fix indent 2018-04-04 12:04:34 -06:00
Kodi Arfer
474de9e4c3 Fix a typo in the mangling documentation 2018-04-04 10:51:03 -07:00
Kodi Arfer
f17a21be63 Use X as the mangle delimiter on Python 3 2018-04-04 10:50:33 -07:00
Yigong Wang
be8537c0cf Add recent REPL results globals *i and most recent error *e
This comment add *1, *2, *3 as globals for recent REPL results.
*e global is also added for the most recent error object.
2018-04-02 00:21:13 -04:00
Kodi Arfer
7822e7d8a8
Merge pull request #1561 from waigx/chore/gitignore
Update .gitignore to exclude pytest cache folder
2018-04-01 11:43:15 -07:00
Yigong Wang
bbf2f9c942 Update .gitignore to exclude pytest cache folder
.pytest folder will be generated after running unit tests locally.
This commit excludes the folder and updates vim temporary files
exclusion rules.
2018-03-31 23:54:44 -04:00
Kodi Arfer
6c25fc23df
Merge pull request #1557 from waigx/feat/E-arg
Add -E support for Hy REPL
2018-03-31 15:17:31 -07:00
Yigong Wang
4073c78069 Add -E support for Hy REPL
This commit adds -E support for Hy. Similar to Python, hy will ignore
all PYTHON* environment variables, e.g. PYTHONPATH and PYTHONHOME,
that might be set.
2018-03-31 15:16:40 -07:00
Kodi Arfer
39587e6f23
Merge pull request #1536 from vodik/fix-defclass
Fix `defclass`
2018-03-31 12:58:32 -07:00
Simon Gomizelj
258a1f5748 Fix PY37 docstring generation 2018-03-31 03:07:26 -04:00
Simon Gomizelj
b27cdfed69 Fix defclass construction
Python Class AST expects a body which is a list of ast.Expr. Force
every entry to be stored as a statement. This means we'll preserve
print statements.

Python also doesn't construct docstrings in classes by setting a
__doc__ attribute, it does it by inspecting the first ast.Expr node of
the class. But this means we can remove the special handler for it.
2018-03-31 02:43:53 -04:00
Simon Gomizelj
84e1c65bcd Improve checks inside defclass
We need to make sure we're looking at HyExpression when trying to
determine if we're rewriting an __init__ expression.

Fixes #1533
2018-03-31 02:43:53 -04:00
Simon Gomizelj
cf11e81c93 Remove unused imports 2018-03-31 02:43:53 -04:00
gilch
074a4bb75f
Merge pull request #1556 from waigx/chore/hy-help-msg
Prettify hy command helping message
2018-03-30 11:21:00 -06:00
Kodi Arfer
cce8b87483
Merge pull request #1552 from waigx/fix/ucs2
Fix `mangle` for Pythons compiled with UCS-2
2018-03-30 07:24:26 -07:00
Yigong Wang
5ae6875e88 Fix mangle for Pythons compiled with UCS-2 2018-03-30 07:23:32 -07:00
Yigong Wang
57064d38dd Prettify hy command helping message 2018-03-29 23:04:22 -04:00