Index: pkg/compiler/lib/src/compile_time_constants.dart |
diff --git a/pkg/compiler/lib/src/compile_time_constants.dart b/pkg/compiler/lib/src/compile_time_constants.dart |
index 9a52c3ec1154f6b0ca83ba5f8ddbca372869ec7c..c2d39d4e9ba59dca9a28a7bcaf3194c3f41c3b89 100644 |
--- a/pkg/compiler/lib/src/compile_time_constants.dart |
+++ b/pkg/compiler/lib/src/compile_time_constants.dart |
@@ -246,9 +246,17 @@ abstract class ConstantCompilerBase implements ConstantCompiler { |
ConstantValue value = getConstantValue(expression); |
if (elementType.isMalformed && !value.isNull) { |
if (isConst) { |
- ErroneousElement element = elementType.element; |
- reporter.reportErrorMessage( |
- node, element.messageKind, element.messageArguments); |
+ // TODO(johnniwinther): Check that it is possible to reach this |
+ // point in a situation where `elementType is! MalformedType`. |
+ if (elementType is MalformedType) { |
+ ErroneousElement element = elementType.element; |
+ reporter.reportErrorMessage( |
+ node, element.messageKind, element.messageArguments); |
+ } else { |
+ assert(elementType is MethodTypeVariableType); |
+ reporter.reportErrorMessage( |
+ node, MessageKind.TYPE_VARIABLE_FROM_METHOD_NOT_REIFIED); |
+ } |
} else { |
// We need to throw an exception at runtime. |
expression = null; |