| Index: pkg/analysis_server/lib/src/services/refactoring/extract_method.dart
|
| diff --git a/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart b/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart
|
| index 40cad52155906b859cf90c9a53a674fd6d05c1cf..79dad5975f6f39f32742992a0383d8ae01cbb2b5 100644
|
| --- a/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart
|
| +++ b/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart
|
| @@ -1107,17 +1107,24 @@ class _ReturnTypeComputer extends RecursiveAstVisitor {
|
|
|
| @override
|
| visitReturnStatement(ReturnStatement node) {
|
| + // prepare expression
|
| Expression expression = node.expression;
|
| - if (expression != null) {
|
| - DartType type = expression.bestType;
|
| - if (returnType == null) {
|
| - returnType = type;
|
| + if (expression == null) {
|
| + return;
|
| + }
|
| + // prepare type
|
| + DartType type = expression.bestType;
|
| + if (type.isBottom) {
|
| + return;
|
| + }
|
| + // combine types
|
| + if (returnType == null) {
|
| + returnType = type;
|
| + } else {
|
| + if (returnType is InterfaceType && type is InterfaceType) {
|
| + returnType = InterfaceType.getSmartLeastUpperBound(returnType, type);
|
| } else {
|
| - if (returnType is InterfaceType && type is InterfaceType) {
|
| - returnType = InterfaceType.getSmartLeastUpperBound(returnType, type);
|
| - } else {
|
| - returnType = returnType.getLeastUpperBound(type);
|
| - }
|
| + returnType = returnType.getLeastUpperBound(type);
|
| }
|
| }
|
| }
|
|
|