[vm/kernel/bytecode] Fix instantiation of function types with parameterized result type

Fixes language_2/type_variable_function_type_test in bytecode mode.

Change-Id: I307083b4469a2eb8cac3c41ccc908f6f3199573a
Reviewed-on: https://dart-review.googlesource.com/71200
Reviewed-by: RĂ©gis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
diff --git a/pkg/vm/lib/bytecode/gen_bytecode.dart b/pkg/vm/lib/bytecode/gen_bytecode.dart
index cd7cc9a..932217b 100644
--- a/pkg/vm/lib/bytecode/gen_bytecode.dart
+++ b/pkg/vm/lib/bytecode/gen_bytecode.dart
@@ -2608,7 +2608,8 @@
     }
 
     final bool result = node.positionalParameters.any((t) => t.accept(this)) ||
-        node.namedParameters.any((p) => p.type.accept(this));
+        node.namedParameters.any((p) => p.type.accept(this)) ||
+        node.returnType.accept(this);
 
     if (node.typeParameters.isNotEmpty) {
       _declaredTypeParameters.removeAll(node.typeParameters);