syntax error warning for type hinting annotation with pycharm


I'm writing a code for type hinting annotation with pycharm such like 

    def run() -> list:

In my env, this is warned for a syntax error with a comment

"illegal target for variable annotation"

However, it is able to run and the syntax seems correct.

How to suppress this warning?


My pycharm is 2017.1.
My python env is the anaconda env with python 3.6 on windows 10,


Hello, thank you for the report.

Could you please attach a screenshot that shows the problem?


I'm seeing a similar issue.

The entire function call for setup() is highlighted with the "Illegal target for variable annotation" warning.


I'm very sorry for not responding.

However, I met this problem again. 

The interpreter is Python 3.7 and turned editor>inspections>python>code compatibility inspection off. 

Do you have any idea to solve it?




Hi @Yatzhash

I suggest reporting it to issue tracker (, providing the minimal code snippet to reproduce>


Please sign in to leave a comment.