| Index: compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java
|
| diff --git a/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java b/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java
|
| index 72188ed21b731815613ae7d6e77e746a1982d1ca..f4e0299f46a8437a1db8aafef509664ce2108014 100644
|
| --- a/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java
|
| +++ b/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java
|
| @@ -80,6 +80,7 @@ import com.google.dart.compiler.ast.DartStringInterpolation;
|
| import com.google.dart.compiler.ast.DartStringLiteral;
|
| import com.google.dart.compiler.ast.DartSuperConstructorInvocation;
|
| import com.google.dart.compiler.ast.DartSuperExpression;
|
| +import com.google.dart.compiler.ast.DartSwitchMember;
|
| import com.google.dart.compiler.ast.DartSwitchStatement;
|
| import com.google.dart.compiler.ast.DartSyntheticErrorExpression;
|
| import com.google.dart.compiler.ast.DartSyntheticErrorIdentifier;
|
| @@ -1813,7 +1814,20 @@ public class TypeAnalyzer implements DartCompilationPhase {
|
|
|
| @Override
|
| public Type visitSwitchStatement(DartSwitchStatement node) {
|
| - return typeAsVoid(node);
|
| + node.visitChildren(this);
|
| + // analyze "expression"
|
| + DartExpression expression = node.getExpression();
|
| + Type switchType = nonVoidTypeOf(expression);
|
| + // check "case" expressions compatibility
|
| + for (DartSwitchMember switchMember : node.getMembers()) {
|
| + if (switchMember instanceof DartCase) {
|
| + DartCase caseMember = (DartCase) switchMember;
|
| + DartExpression caseExpr = caseMember.getExpr();
|
| + Type caseType = nonVoidTypeOf(caseExpr);
|
| + checkAssignable(caseExpr, switchType, caseType);
|
| + }
|
| + }
|
| + return voidType;
|
| }
|
|
|
| @Override
|
|
|