@@ -606,11 +606,7 @@ abstract class FunctionValue extends CallableValue {
606
606
}
607
607
608
608
/** Gets a class that this function may return */
609
- ClassValue getAnInferredReturnType ( ) {
610
- result = TBuiltinClassObject ( this .( BuiltinFunctionObjectInternal ) .getReturnType ( ) )
611
- or
612
- result = TBuiltinClassObject ( this .( BuiltinMethodObjectInternal ) .getReturnType ( ) )
613
- }
609
+ abstract ClassValue getAnInferredReturnType ( ) ;
614
610
}
615
611
616
612
/** Class representing Python functions */
@@ -639,6 +635,10 @@ class PythonFunctionValue extends FunctionValue {
639
635
640
636
/** Gets a control flow node corresponding to a return statement in this function */
641
637
ControlFlowNode getAReturnedNode ( ) { result = this .getScope ( ) .getAReturnValueFlowNode ( ) }
638
+
639
+ override ClassValue getAnInferredReturnType ( ) {
640
+ result = this .getAReturnedNode ( ) .pointsTo ( ) .getClass ( )
641
+ }
642
642
}
643
643
644
644
/** Class representing builtin functions, such as `len` or `print` */
@@ -650,6 +650,10 @@ class BuiltinFunctionValue extends FunctionValue {
650
650
override int minParameters ( ) { none ( ) }
651
651
652
652
override int maxParameters ( ) { none ( ) }
653
+
654
+ override ClassValue getAnInferredReturnType ( ) {
655
+ result = TBuiltinClassObject ( this .( BuiltinFunctionObjectInternal ) .getReturnType ( ) )
656
+ }
653
657
}
654
658
655
659
/** Class representing builtin methods, such as `list.append` or `set.add` */
@@ -667,6 +671,10 @@ class BuiltinMethodValue extends FunctionValue {
667
671
override int minParameters ( ) { none ( ) }
668
672
669
673
override int maxParameters ( ) { none ( ) }
674
+
675
+ override ClassValue getAnInferredReturnType ( ) {
676
+ result = TBuiltinClassObject ( this .( BuiltinMethodObjectInternal ) .getReturnType ( ) )
677
+ }
670
678
}
671
679
672
680
/**
0 commit comments