When an f-string follows any number of non-blank lines, an undefined name in the f-string is reported as an error on Line 1 rather than as an error on the line of the f-string itself.
Input
import re
f'{foo}'
Result
One error marker on Line 1, the error being:
flake8: F401 're' imported by unused / F821 undefined name 'foo', Line 1, Column 10
Expected Result
An error marker on Line 1 for the F401 error.
An error marker on Line 2 for the F821 error.
Problem
When an f-string follows any number of non-blank lines, an undefined name in the f-string is reported as an error on Line 1 rather than as an error on the line of the f-string itself.
Input
Result
One error marker on Line 1, the error being:
flake8: F401 're' imported by unused / F821 undefined name 'foo', Line 1, Column 10
Expected Result
An error marker on Line 1 for the F401 error. An error marker on Line 2 for the F821 error.