Commit Graph

2603 Commits

Author SHA1 Message Date
Kodi Arfer
f22195dfbc
Merge pull request #1626 from Kodiologist/newcomp3
Fancier `for` and comprehensions
2018-06-16 14:16:41 -07:00
Kodi Arfer
da754c0e5d Update NEWS and docs for the new comprehensions 2018-06-13 17:31:08 -07:00
Kodi Arfer
76b80bad81 Remove support for the old comprehension forms 2018-06-13 17:31:08 -07:00
Kodi Arfer
14979edcab Remove tests of the old comprehension forms 2018-06-13 17:31:08 -07:00
Kodi Arfer
cf0dafef9b Update uses of the old comprehension forms 2018-06-13 17:31:08 -07:00
Kodi Arfer
df4e49ec94 Test comprehension scoping 2018-06-13 17:31:08 -07:00
Kodi Arfer
4754b152a9 Allow comprehensions with no looping parts 2018-06-13 17:31:08 -07:00
Kodi Arfer
e1972c535f Remove for/a, for*, and for/a* 2018-06-13 17:31:08 -07:00
Kodi Arfer
3256932b13 Add a version of for parallel to lfor etc. 2018-06-13 17:31:08 -07:00
Kodi Arfer
ba1dc55e96 Implement lfor, sfor, gfor, dfor 2018-06-13 17:31:08 -07:00
Kodi Arfer
7a40561db8 Add tagged model patterns 2018-06-13 17:31:08 -07:00
Kodi Arfer
5ffbb4b0eb Add Result.lineno and Result.col_offset 2018-06-13 17:31:08 -07:00
Kodi Arfer
844256b99b Make Asty use static rather than instance methods
This ensures `asty.Pass is asty.Pass`.
2018-06-13 17:31:08 -07:00
Kodi Arfer
d3bd7c1017
Merge pull request #1625 from Kodiologist/potpourri
Miscellaneous small changes
2018-06-13 17:30:14 -07:00
Kodi Arfer
d621d7c3ab Update defmacro(/g)! tests for mangling 2018-06-11 21:05:29 -07:00
Kodi Arfer
498a54e770 Fix discovery of tests with mangled names 2018-06-11 21:05:29 -07:00
Kodi Arfer
65e620ed55 Remove an obsolete bug workaround in a test 2018-06-11 21:05:29 -07:00
Kodi Arfer
c3d4c7aa82 Clean up else compilation in while 2018-06-11 21:05:29 -07:00
Kodi Arfer
ea899471af Remove an unused compiler function 2018-06-11 21:05:29 -07:00
gilch
29130212f0
Merge pull request #1631 from Kodiologist/py37-updates
Get  Travis and Python 3.7 working again
2018-06-11 20:53:51 -06:00
Kodi Arfer
79bd4b019c
Merge pull request #1623 from Kodiologist/model-pattern-docs
Add tests and docs for model patterns
2018-06-11 16:35:02 -07:00
Kodi Arfer
16ec46a473 Update docstring handling for Python 3.7
See https://github.com/python/cpython/pull/7121 .
2018-06-05 17:35:48 -07:00
Kodi Arfer
bc2a5a2747 Don't test on Travis's outdated Python 3.7
See https://github.com/travis-ci/travis-ci/issues/9069 .
2018-06-05 17:32:48 -07:00
Kodi Arfer
3e943209fe
Merge pull request #1616 from Kodiologist/autopromotion-update
Streamline auto-promotion and position spoofing
2018-06-05 10:29:57 -07:00
Kodi Arfer
74bf3e9e81 Work around a scoping bug in multi.defn (#1630) 2018-06-05 10:23:32 -07:00
Kodi Arfer
3204a9e8a3 Streamline auto-promotion and position spoofing
Auto-promotion now occurs in only two cases: when we start the compiler and when we expand a macro. It's fully recursive so even a non-model nested in a model will be promoted.

This change fixes some regressions induced by the stricter type checks of the pattern-matching compiler.
2018-06-05 09:23:21 -07:00
Kodi Arfer
aae1f8718c
Merge pull request #1613 from Kodiologist/modname-mangle-bug
Fix a regression with mangling module names
2018-06-03 15:44:40 -07:00
Kodi Arfer
a38c948ed2 Fix a regression with mangling module names 2018-06-03 15:38:49 -07:00
Kodi Arfer
d16a0bb395
Merge pull request #1608 from Kodiologist/astor-update
Re-enable tests that were stymied by an astor bug
2018-05-29 09:27:03 -07:00
Kodi Arfer
6458f2d66f Re-enable tests that were stymied by an astor bug 2018-05-29 09:18:42 -07:00
Kodi Arfer
8296a36e12 Add tests and docs for model patterns 2018-05-28 16:15:47 -07:00
Ryan Gonzalez
e66743c976
Merge pull request #1615 from Kodiologist/no-parser-cache
Disable the parser cache
2018-05-27 16:28:00 -05:00
Ryan Gonzalez
e9e27c7a4f
Merge pull request #1619 from Kodiologist/stdlib-fix
Fix the management of _stdlib
2018-05-27 16:26:57 -05:00
Kodi Arfer
81035878dd Bump rply version 2018-05-26 09:33:06 -07:00
Kodi Arfer
e344ac1fd6 Fix the management of _stdlib
_stdlib is a global variable, so core modules could use it, contrary to our intention, so long as they happened to be compiled after a non-core module. I've added a compiler attribute to track whether we can use _stdlib.

This fix exposed some cases where hy.core.shadow tried to use a core function, so I fixed those.

I've also added an `if not _stdlib` to `load_stdlib` so that we only bother to actually load _stdlib once.
2018-05-24 17:51:21 -07:00
Kodi Arfer
1732ddec4d Disable the parser cache
I wasn't able to observe a meaningful performance improvement from it, and it requires some file I/O. Here are the times, in seconds, I observed on my ThinkPad T450s with Python 3.6 and Ubuntu 18.04:

                test 1  test 2
    master       8.96    2.59
    this change  8.88    2.62

Test 1 is the total time from:

$ time dash -c 'git clean -dfx && pip install -e . && pytest --ignore tests/test_bin.py'

Test 2 is pytest's reported total time from a subsequent:

$ pytest --ignore tests/test_bin.py
2018-05-21 09:22:49 -07:00
Kodi Arfer
370563567a
Merge pull request #1593 from Kodiologist/compiler-pattern-matching
Pattern-matching compiler
2018-05-20 14:24:24 -07:00
Kodi Arfer
9f454f0228 Test complex numbers in test_hy2py 2018-05-20 14:11:35 -07:00
Kodi Arfer
0a5bc21fcf Simplify compile_numeric_literal for new astor 2018-05-20 14:11:35 -07:00
Kodi Arfer
906b470499 Move test assertions into a test function 2018-05-20 14:11:35 -07:00
Kodi Arfer
38fdcc2114 Don't let HySymbol inherit from HyString 2018-05-20 14:11:35 -07:00
Kodi Arfer
210086c7ca Clean up the decorators used in the compiler 2018-05-20 14:11:35 -07:00
Kodi Arfer
98fbdcfc50 Move @builds(HyExpression) next to other @builds 2018-05-20 14:11:35 -07:00
Kodi Arfer
a933646bdd Use model patterns for the remaining special forms 2018-05-20 14:11:35 -07:00
Kodi Arfer
8b2733e921 Use model patterns for comprehensions
I haven't bothered to refine the patterns for these since I intend to completely overhaul the comprehension forms in the near future.
2018-05-20 14:11:35 -07:00
Kodi Arfer
41d3f26001 Use model patterns for comparison and math ops 2018-05-20 14:11:35 -07:00
Kodi Arfer
57b5fa49b1 Unify illegal special forms 2018-05-20 14:11:31 -07:00
Kodi Arfer
45e8783997 Use model patterns for fn 2018-05-20 14:07:44 -07:00
Kodi Arfer
3ebff987e0 Use model patterns for defclass 2018-05-20 14:07:44 -07:00
Kodi Arfer
9368e4bc4e Use model patterns for import and require
In the process, I've banned the syntax `(import [foo])` in favor of `(import foo)`.
2018-05-20 14:07:44 -07:00