Files
openide/python/testData/highlighting/async.py
Dmitry Trofimov 210bf9b175 Unify stubs for all Python language levels (PY-26392)
The cause of the problem was the difference in parsing for different
language levels.

This commit improves error recovery and adds support for stubs for
syntax elements unavailable in older Python versions.
Cases that are covered are necessary for stubs generation
for Python 3.6 standard library. They are discovered by automatic
validation executed by stubs generator in StubsGenerator.kt.

Those are the cases that were fixed:
* A stub for single star argument in Py2 was absent
* Type annotations in Py2 were absent
* Print with end argument in Py2 broke parser
* Exec function as argument in Py2 broke parser
* Async keyword after decorator broke parser

All the cases are listed as test cases in PyUnifiedStubsTest

P.S. It is possible though that more cases will be revealed in future.
2017-10-09 21:23:29 +02:00

29 lines
943 B
Python

<info descr="null">async</info> def <info descr="PY.FUNC_DEFINITION">foo</info>():
pass
async = 1
<info descr="null">async</info> def <info descr="PY.FUNC_DEFINITION">bar</info>():
pass
<info descr="null">async</info> def<error descr="'(' expected"><error descr="Identifier expected"> </error></error> # Incomplete<EOLError descr="':' expected"></EOLError>
<error descr="Indent expected">d</error>ef <info descr="PY.FUNC_DEFINITION">regular</info>(<info descr="PY.PARAMETER">xs</info>):
<info descr="null">async</info> def <info descr="PY.FUNC_DEFINITION">quux</info>():
<info descr="null">async</info> for x in xs:
pass
<info descr="null">async</info> with xs:
pass
<info descr="null">async</info> for x in xs:
pass
<error descr="'async' keyword is not expected here">async</error> with <info descr="PY.PARAMETER">xs</info>:
pass
return async