File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed
test/query-tests/Imports/unused Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -64,9 +64,11 @@ private string doctest_in_scope(Scope scope) {
6464pragma [ noinline]
6565private string typehint_annotation_in_file ( File file ) {
6666 exists ( StrConst annotation |
67- annotation = any ( Arguments a ) .getAnAnnotation ( )
67+ annotation = any ( Arguments a ) .getAnAnnotation ( ) . getASubExpression * ( )
6868 or
69- annotation = any ( AnnAssign a ) .getAnnotation ( )
69+ annotation = any ( AnnAssign a ) .getAnnotation ( ) .getASubExpression * ( )
70+ or
71+ annotation = any ( FunctionExpr f ) .getReturns ( ) .getASubExpression * ( )
7072 |
7173 annotation .pointsTo ( Value:: forString ( result ) ) and
7274 file = annotation .getLocation ( ) .getFile ( )
Original file line number Diff line number Diff line change @@ -90,3 +90,24 @@ def func(x: 'Optional[only_used_in_parameter_annotation]'):
9090import only_used_in_annotated_assignment
9191
9292var : 'Optional[only_used_in_annotated_assignment]' = 5
93+
94+ import used_in_return_type
95+
96+ def look_at_my_return_type () -> 'Optional[used_in_return_type]' :
97+ pass
98+
99+ # Uses inside strings appearing as subexpressions of an annotation:
100+
101+ import subexpression_parameter_annotation
102+
103+ def bar (x : Optional ['subexpression_parameter_annotation' ]):
104+ pass
105+
106+ import subexpression_assignment_annotation
107+
108+ var3 : Optional ['subexpression_assignment_annotation' ] = None
109+
110+ import subexpression_return_type
111+
112+ def baz () -> Optional ['subexpression_return_type' ]:
113+ pass
You can’t perform that action at this time.
0 commit comments