@@ -606,11 +606,7 @@ abstract class FunctionValue extends CallableValue {
606606 }
607607
608608 /** 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 ( ) ;
614610}
615611
616612/** Class representing Python functions */
@@ -639,6 +635,10 @@ class PythonFunctionValue extends FunctionValue {
639635
640636 /** Gets a control flow node corresponding to a return statement in this function */
641637 ControlFlowNode getAReturnedNode ( ) { result = this .getScope ( ) .getAReturnValueFlowNode ( ) }
638+
639+ override ClassValue getAnInferredReturnType ( ) {
640+ result = this .getAReturnedNode ( ) .pointsTo ( ) .getClass ( )
641+ }
642642}
643643
644644/** Class representing builtin functions, such as `len` or `print` */
@@ -650,6 +650,10 @@ class BuiltinFunctionValue extends FunctionValue {
650650 override int minParameters ( ) { none ( ) }
651651
652652 override int maxParameters ( ) { none ( ) }
653+
654+ override ClassValue getAnInferredReturnType ( ) {
655+ result = TBuiltinClassObject ( this .( BuiltinFunctionObjectInternal ) .getReturnType ( ) )
656+ }
653657}
654658
655659/** Class representing builtin methods, such as `list.append` or `set.add` */
@@ -667,6 +671,10 @@ class BuiltinMethodValue extends FunctionValue {
667671 override int minParameters ( ) { none ( ) }
668672
669673 override int maxParameters ( ) { none ( ) }
674+
675+ override ClassValue getAnInferredReturnType ( ) {
676+ result = TBuiltinClassObject ( this .( BuiltinMethodObjectInternal ) .getReturnType ( ) )
677+ }
670678}
671679
672680/**
0 commit comments