Remove addCompileTimeError in favor of addProblem

Replace most methods with names containing CompileTimeError with corresponding
Problem methods.

Also make Severity.error the default severity.

Change-Id: I4f47bf71dec02347407f2ce4ccfdb04730daf51b
Reviewed-on: https://dart-review.googlesource.com/73221
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
diff --git a/pkg/analyzer/lib/src/fasta/ast_builder.dart b/pkg/analyzer/lib/src/fasta/ast_builder.dart
index 7a6c045..68906df 100644
--- a/pkg/analyzer/lib/src/fasta/ast_builder.dart
+++ b/pkg/analyzer/lib/src/fasta/ast_builder.dart
@@ -30,6 +30,7 @@
 import 'package:front_end/src/fasta/problems.dart' show unhandled;
 import 'package:front_end/src/fasta/messages.dart'
     show
+        LocatedMessage,
         Message,
         messageConstConstructorWithBody,
         messageConstMethod,
@@ -2041,7 +2042,7 @@
     } else {
       int offset = startToken.offset;
       int length = endToken.end - offset;
-      addCompileTimeError(message, offset, length);
+      addProblem(message, offset, length);
     }
   }
 
@@ -2766,12 +2767,13 @@
   }
 
   @override
-  void addCompileTimeError(Message message, int offset, int length) {
+  void addProblem(Message message, int charOffset, int length,
+      {bool wasHandled: false, List<LocatedMessage> context}) {
     if (directives.isEmpty &&
         message.code.analyzerCode == 'NON_PART_OF_DIRECTIVE_IN_PART') {
       message = messageDirectiveAfterDeclaration;
     }
-    errorReporter.reportMessage(message, offset, length);
+    errorReporter.reportMessage(message, charOffset, length);
   }
 
   /// Return `true` if [token] is either `null` or is the symbol or keyword
diff --git a/pkg/analyzer/tool/summary/mini_ast.dart b/pkg/analyzer/tool/summary/mini_ast.dart
index 15fafd9..518a6c4 100644
--- a/pkg/analyzer/tool/summary/mini_ast.dart
+++ b/pkg/analyzer/tool/summary/mini_ast.dart
@@ -2,7 +2,7 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-import 'package:front_end/src/fasta/messages.dart' show Message;
+import 'package:front_end/src/fasta/messages.dart' show LocatedMessage, Message;
 import 'package:front_end/src/fasta/parser.dart';
 import 'package:front_end/src/fasta/problems.dart'
     show internalProblem, unsupported;
@@ -147,8 +147,9 @@
   Uri get uri => null;
 
   @override
-  void addCompileTimeError(Message message, int offset, int length) {
-    internalProblem(message, offset, uri);
+  void addProblem(Message message, int charOffset, int length,
+      {bool wasHandled: false, List<LocatedMessage> context}) {
+    internalProblem(message, charOffset, uri);
   }
 
   @override
diff --git a/pkg/front_end/lib/src/fasta/builder/class_builder.dart b/pkg/front_end/lib/src/fasta/builder/class_builder.dart
index 4f95542..d2b9c0f 100644
--- a/pkg/front_end/lib/src/fasta/builder/class_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/class_builder.dart
@@ -233,15 +233,10 @@
             null);
   }
 
-  void addCompileTimeError(Message message, int charOffset, int length,
-      {List<LocatedMessage> context}) {
-    library.addCompileTimeError(message, charOffset, length, fileUri,
-        context: context);
-  }
-
   void addProblem(Message message, int charOffset, int length,
-      {List<LocatedMessage> context}) {
-    library.addProblem(message, charOffset, length, fileUri, context: context);
+      {bool wasHandled: false, List<LocatedMessage> context}) {
+    library.addProblem(message, charOffset, length, fileUri,
+        wasHandled: wasHandled, context: context);
   }
 
   void prepareTopLevelInference() {}
diff --git a/pkg/front_end/lib/src/fasta/builder/library_builder.dart b/pkg/front_end/lib/src/fasta/builder/library_builder.dart
index 5b43657..2f29995 100644
--- a/pkg/front_end/lib/src/fasta/builder/library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/library_builder.dart
@@ -20,6 +20,8 @@
         templateInternalProblemNotFoundIn,
         templateInternalProblemPrivateConstructorAccess;
 
+import '../severity.dart' show Severity;
+
 import 'builder.dart'
     show
         ClassBuilder,
@@ -78,23 +80,19 @@
     exporters.add(new Export(exporter, this, combinators, charOffset));
   }
 
-  /// See `Loader.addCompileTimeError` for an explanation of the
-  /// arguments passed to this method.
+  /// Add a problem with a severity determined by the severity of the message.
   ///
   /// If [fileUri] is null, it defaults to `this.fileUri`.
-  void addCompileTimeError(
-      Message message, int charOffset, int length, Uri fileUri,
-      {bool wasHandled: false, List<LocatedMessage> context}) {
-    fileUri ??= this.fileUri;
-    loader.addCompileTimeError(message, charOffset, length, fileUri,
-        wasHandled: wasHandled, context: context);
-  }
-
-  /// Add a problem with a severity determined by the severity of the message.
+  ///
+  /// See `Loader.addMessage` for an explanation of the
+  /// arguments passed to this method.
   void addProblem(Message message, int charOffset, int length, Uri fileUri,
-      {List<LocatedMessage> context}) {
+      {bool wasHandled: false,
+      List<LocatedMessage> context,
+      Severity severity}) {
     fileUri ??= this.fileUri;
-    loader.addProblem(message, charOffset, length, fileUri, context: context);
+    loader.addProblem(message, charOffset, length, fileUri,
+        wasHandled: wasHandled, context: context, severity: severity);
   }
 
   /// Returns true if the export scope was modified.
diff --git a/pkg/front_end/lib/src/fasta/deprecated_problems.dart b/pkg/front_end/lib/src/fasta/deprecated_problems.dart
index 1d0c9fa..86067fb7 100644
--- a/pkg/front_end/lib/src/fasta/deprecated_problems.dart
+++ b/pkg/front_end/lib/src/fasta/deprecated_problems.dart
@@ -25,7 +25,7 @@
 /// Used to report an error in input.
 ///
 /// Avoid using this for reporting compile-time errors, instead use
-/// `LibraryBuilder.addCompileTimeError` for those.
+/// `LibraryBuilder.addProblem` for those.
 ///
 /// An input error is any error that isn't an internal error. We use the term
 /// "input error" in favor of "user error". This way, if an input error isn't
diff --git a/pkg/front_end/lib/src/fasta/fasta_codes.dart b/pkg/front_end/lib/src/fasta/fasta_codes.dart
index 45cbf9a..f5c2da1 100644
--- a/pkg/front_end/lib/src/fasta/fasta_codes.dart
+++ b/pkg/front_end/lib/src/fasta/fasta_codes.dart
@@ -27,7 +27,8 @@
 
   final Severity severity;
 
-  const Code(this.name, this.template, {this.analyzerCode, this.severity});
+  const Code(this.name, this.template,
+      {this.analyzerCode, this.severity: Severity.error});
 
   String toString() => name;
 }
@@ -58,7 +59,10 @@
   final String tip;
 
   const MessageCode(String name,
-      {String analyzerCode, Severity severity, this.message, this.tip})
+      {String analyzerCode,
+      Severity severity: Severity.error,
+      this.message,
+      this.tip})
       : super(name, null, analyzerCode: analyzerCode, severity: severity);
 
   Map<String, dynamic> get arguments => const <String, dynamic>{};
diff --git a/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart b/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
index 712912b..4d57271 100644
--- a/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
+++ b/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
@@ -109,7 +109,7 @@
     codeAmbiguousSupertypes =
     const Code<Message Function(String name, DartType _type, DartType _type2)>(
         "AmbiguousSupertypes", templateAmbiguousSupertypes,
-        analyzerCode: "AMBIGUOUS_SUPERTYPES", severity: Severity.error);
+        analyzerCode: "AMBIGUOUS_SUPERTYPES");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsAmbiguousSupertypes(
@@ -272,8 +272,7 @@
     const Code<Message Function(String name, String name2)>(
         "BoundIssueViaCycleNonSimplicity",
         templateBoundIssueViaCycleNonSimplicity,
-        analyzerCode: "NOT_INSTANTIATED_BOUND",
-        severity: Severity.error);
+        analyzerCode: "NOT_INSTANTIATED_BOUND");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsBoundIssueViaCycleNonSimplicity(
@@ -300,7 +299,7 @@
 const Code<Message Function(String name)> codeBoundIssueViaLoopNonSimplicity =
     const Code<Message Function(String name)>("BoundIssueViaLoopNonSimplicity",
         templateBoundIssueViaLoopNonSimplicity,
-        analyzerCode: "NOT_INSTANTIATED_BOUND", severity: Severity.error);
+        analyzerCode: "NOT_INSTANTIATED_BOUND");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsBoundIssueViaLoopNonSimplicity(String name) {
@@ -326,8 +325,7 @@
     const Code<Message Function(String name)>(
         "BoundIssueViaRawTypeWithNonSimpleBounds",
         templateBoundIssueViaRawTypeWithNonSimpleBounds,
-        analyzerCode: "NOT_INSTANTIATED_BOUND",
-        severity: Severity.error);
+        analyzerCode: "NOT_INSTANTIATED_BOUND");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsBoundIssueViaRawTypeWithNonSimpleBounds(String name) {
@@ -544,8 +542,7 @@
 const Code<Message Function(String string)> codeCantInferTypeDueToCircularity =
     const Code<Message Function(String string)>(
         "CantInferTypeDueToCircularity", templateCantInferTypeDueToCircularity,
-        analyzerCode: "RECURSIVE_COMPILE_TIME_CONSTANT",
-        severity: Severity.error);
+        analyzerCode: "RECURSIVE_COMPILE_TIME_CONSTANT");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsCantInferTypeDueToCircularity(String string) {
@@ -571,8 +568,7 @@
     const Code<Message Function(String string)>(
         "CantInferTypeDueToInconsistentOverrides",
         templateCantInferTypeDueToInconsistentOverrides,
-        analyzerCode: "INVALID_METHOD_OVERRIDE",
-        severity: Severity.error);
+        analyzerCode: "INVALID_METHOD_OVERRIDE");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsCantInferTypeDueToInconsistentOverrides(String string) {
@@ -600,7 +596,7 @@
 const Code<Message Function(Token token)> codeCantUseDeferredPrefixAsConstant =
     const Code<Message Function(Token token)>("CantUseDeferredPrefixAsConstant",
         templateCantUseDeferredPrefixAsConstant,
-        analyzerCode: "CONST_DEFERRED_CLASS", severity: Severity.error);
+        analyzerCode: "CONST_DEFERRED_CLASS");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsCantUseDeferredPrefixAsConstant(Token token) {
@@ -621,7 +617,6 @@
 const MessageCode messageCantUsePrefixAsExpression = const MessageCode(
     "CantUsePrefixAsExpression",
     analyzerCode: "PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT",
-    severity: Severity.error,
     message: r"""A prefix can't be used as an expression.""");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -632,7 +627,6 @@
 const MessageCode messageCantUsePrefixWithNullAware = const MessageCode(
     "CantUsePrefixWithNullAware",
     analyzerCode: "PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT",
-    severity: Severity.error,
     message: r"""A prefix can't be used with null-aware operators.""",
     tip: r"""It should be safe to remove the '?' as a prefix is never null.""");
 
@@ -651,9 +645,9 @@
 const Code<Message Function(DartType _type)>
     codeCantUseSuperBoundedTypeForInstanceCreation =
     const Code<Message Function(DartType _type)>(
-        "CantUseSuperBoundedTypeForInstanceCreation",
-        templateCantUseSuperBoundedTypeForInstanceCreation,
-        severity: Severity.error);
+  "CantUseSuperBoundedTypeForInstanceCreation",
+  templateCantUseSuperBoundedTypeForInstanceCreation,
+);
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsCantUseSuperBoundedTypeForInstanceCreation(
@@ -711,7 +705,7 @@
 const Code<Message Function(String name)> codeConflictsWithConstructor =
     const Code<Message Function(String name)>(
         "ConflictsWithConstructor", templateConflictsWithConstructor,
-        analyzerCode: "CONFLICTS_WITH_CONSTRUCTOR", severity: Severity.error);
+        analyzerCode: "CONFLICTS_WITH_CONSTRUCTOR");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsConflictsWithConstructor(String name) {
@@ -729,8 +723,9 @@
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 const Code<Message Function(String name)> codeConflictsWithFactory =
     const Code<Message Function(String name)>(
-        "ConflictsWithFactory", templateConflictsWithFactory,
-        severity: Severity.error);
+  "ConflictsWithFactory",
+  templateConflictsWithFactory,
+);
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsConflictsWithFactory(String name) {
@@ -749,7 +744,7 @@
 const Code<Message Function(String name)> codeConflictsWithMember =
     const Code<Message Function(String name)>(
         "ConflictsWithMember", templateConflictsWithMember,
-        analyzerCode: "CONFLICTS_WITH_MEMBER", severity: Severity.error);
+        analyzerCode: "CONFLICTS_WITH_MEMBER");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsConflictsWithMember(String name) {
@@ -789,7 +784,7 @@
 const Code<Message Function(String name)> codeConflictsWithSetter =
     const Code<Message Function(String name)>(
         "ConflictsWithSetter", templateConflictsWithSetter,
-        analyzerCode: "CONFLICTS_WITH_MEMBER", severity: Severity.error);
+        analyzerCode: "CONFLICTS_WITH_MEMBER");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsConflictsWithSetter(String name) {
@@ -830,8 +825,7 @@
 const Code<Message Function(String name)> codeConflictsWithTypeVariable =
     const Code<Message Function(String name)>(
         "ConflictsWithTypeVariable", templateConflictsWithTypeVariable,
-        analyzerCode: "CONFLICTING_TYPE_VARIABLE_AND_MEMBER",
-        severity: Severity.error);
+        analyzerCode: "CONFLICTING_TYPE_VARIABLE_AND_MEMBER");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsConflictsWithTypeVariable(String name) {
@@ -908,7 +902,6 @@
 const MessageCode messageConstConstructorInSubclassOfMixinApplication =
     const MessageCode("ConstConstructorInSubclassOfMixinApplication",
         analyzerCode: "CONST_CONSTRUCTOR_IN_SUBCLASS_OF_MIXIN_APPLICATION",
-        severity: Severity.error,
         message: r"""Can't extend a mixin application and be 'const'.""");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -938,7 +931,6 @@
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 const MessageCode messageConstConstructorRedirectionToNonConst =
     const MessageCode("ConstConstructorRedirectionToNonConst",
-        severity: Severity.error,
         message:
             r"""A constant constructor can't call a non-constant constructor.""");
 
@@ -1342,7 +1334,6 @@
 const MessageCode messageConstFactoryRedirectionToNonConst = const MessageCode(
     "ConstFactoryRedirectionToNonConst",
     analyzerCode: "REDIRECT_TO_NON_CONST_CONSTRUCTOR",
-    severity: Severity.error,
     message:
         r"""Constant factory constructor can't delegate to a non-constant constructor.""",
     tip:
@@ -1402,7 +1393,6 @@
 const MessageCode messageConstructorCyclic = const MessageCode(
     "ConstructorCyclic",
     analyzerCode: "RECURSIVE_CONSTRUCTOR_REDIRECT",
-    severity: Severity.error,
     message: r"""Redirecting constructers can't be cyclic.""",
     tip:
         r"""Try to have all constructors eventually redirect to a non-redirecting constructor.""");
@@ -1456,7 +1446,6 @@
 const MessageCode messageConstructorWithTypeArguments = const MessageCode(
     "ConstructorWithTypeArguments",
     analyzerCode: "UNDEFINED_CLASS",
-    severity: Severity.error,
     message:
         r"""A constructor invocation can't have type arguments on the constructor name.""",
     tip: r"""Try to place the type arguments on the class name.""");
@@ -1469,7 +1458,6 @@
 const MessageCode messageConstructorWithTypeParameters = const MessageCode(
     "ConstructorWithTypeParameters",
     analyzerCode: "TYPE_PARAMETER_ON_CONSTRUCTOR",
-    severity: Severity.error,
     message: r"""Constructors can't have type parameters.""");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -1479,7 +1467,6 @@
 const MessageCode messageConstructorWithWrongName = const MessageCode(
     "ConstructorWithWrongName",
     analyzerCode: "INVALID_CONSTRUCTOR_NAME",
-    severity: Severity.error,
     message:
         r"""The name of a constructor must match the name of the enclosing class.""");
 
@@ -1639,8 +1626,7 @@
     codeCycleInTypeVariables =
     const Code<Message Function(String name, String string)>(
         "CycleInTypeVariables", templateCycleInTypeVariables,
-        analyzerCode: "TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND",
-        severity: Severity.error);
+        analyzerCode: "TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsCycleInTypeVariables(String name, String string) {
@@ -1663,8 +1649,7 @@
     codeCyclicClassHierarchy =
     const Code<Message Function(String name, String string)>(
         "CyclicClassHierarchy", templateCyclicClassHierarchy,
-        analyzerCode: "RECURSIVE_INTERFACE_INHERITANCE",
-        severity: Severity.error);
+        analyzerCode: "RECURSIVE_INTERFACE_INHERITANCE");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsCyclicClassHierarchy(String name, String string) {
@@ -1686,8 +1671,7 @@
     const Code<Message Function(String name)>(
         "CyclicRedirectingFactoryConstructors",
         templateCyclicRedirectingFactoryConstructors,
-        analyzerCode: "RECURSIVE_FACTORY_REDIRECT",
-        severity: Severity.error);
+        analyzerCode: "RECURSIVE_FACTORY_REDIRECT");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsCyclicRedirectingFactoryConstructors(String name) {
@@ -2099,7 +2083,7 @@
 const Code<Message Function(String name)> codeDuplicatedName =
     const Code<Message Function(String name)>(
         "DuplicatedName", templateDuplicatedName,
-        analyzerCode: "DUPLICATE_DEFINITION", severity: Severity.error);
+        analyzerCode: "DUPLICATE_DEFINITION");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsDuplicatedName(String name) {
@@ -2141,8 +2125,7 @@
 const Code<Message Function(String name)> codeDuplicatedNamePreviouslyUsed =
     const Code<Message Function(String name)>(
         "DuplicatedNamePreviouslyUsed", templateDuplicatedNamePreviouslyUsed,
-        analyzerCode: "REFERENCED_BEFORE_DECLARATION",
-        severity: Severity.error);
+        analyzerCode: "REFERENCED_BEFORE_DECLARATION");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsDuplicatedNamePreviouslyUsed(String name) {
@@ -2183,7 +2166,7 @@
 const Code<Message Function(String name)> codeDuplicatedNamedArgument =
     const Code<Message Function(String name)>(
         "DuplicatedNamedArgument", templateDuplicatedNamedArgument,
-        analyzerCode: "DUPLICATE_NAMED_ARGUMENT", severity: Severity.error);
+        analyzerCode: "DUPLICATE_NAMED_ARGUMENT");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsDuplicatedNamedArgument(String name) {
@@ -2202,7 +2185,7 @@
 const Code<Message Function(String name)> codeDuplicatedParameterName =
     const Code<Message Function(String name)>(
         "DuplicatedParameterName", templateDuplicatedParameterName,
-        analyzerCode: "DUPLICATE_DEFINITION", severity: Severity.error);
+        analyzerCode: "DUPLICATE_DEFINITION");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsDuplicatedParameterName(String name) {
@@ -2308,7 +2291,6 @@
 const MessageCode messageEnumInstantiation = const MessageCode(
     "EnumInstantiation",
     analyzerCode: "INSTANTIATE_ENUM",
-    severity: Severity.error,
     message: r"""Enums can't be instantiated.""");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -2544,7 +2526,7 @@
 const Code<Message Function(Token token)> codeExpectedIdentifier =
     const Code<Message Function(Token token)>(
         "ExpectedIdentifier", templateExpectedIdentifier,
-        analyzerCode: "MISSING_IDENTIFIER", severity: Severity.error);
+        analyzerCode: "MISSING_IDENTIFIER");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsExpectedIdentifier(Token token) {
@@ -2569,7 +2551,6 @@
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 const MessageCode messageExpectedOneExpression = const MessageCode(
     "ExpectedOneExpression",
-    severity: Severity.error,
     message: r"""Expected one expression, but found additional input.""");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -2637,7 +2618,7 @@
 const Code<Message Function(Token token)> codeExpectedType =
     const Code<Message Function(Token token)>(
         "ExpectedType", templateExpectedType,
-        analyzerCode: "EXPECTED_TYPE_NAME", severity: Severity.error);
+        analyzerCode: "EXPECTED_TYPE_NAME");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsExpectedType(Token token) {
@@ -2708,7 +2689,7 @@
 const Code<Message Function(String name)> codeExtendingEnum =
     const Code<Message Function(String name)>(
         "ExtendingEnum", templateExtendingEnum,
-        analyzerCode: "EXTENDS_ENUM", severity: Severity.error);
+        analyzerCode: "EXTENDS_ENUM");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsExtendingEnum(String name) {
@@ -3038,7 +3019,7 @@
 const Code<Message Function(String name)> codeFinalFieldNotInitialized =
     const Code<Message Function(String name)>(
         "FinalFieldNotInitialized", templateFinalFieldNotInitialized,
-        analyzerCode: "FINAL_NOT_INITIALIZED", severity: Severity.error);
+        analyzerCode: "FINAL_NOT_INITIALIZED");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsFinalFieldNotInitialized(String name) {
@@ -3067,8 +3048,7 @@
     const Code<Message Function(String name)>(
         "FinalFieldNotInitializedByConstructor",
         templateFinalFieldNotInitializedByConstructor,
-        analyzerCode: "FINAL_NOT_INITIALIZED_CONSTRUCTOR_1",
-        severity: Severity.error);
+        analyzerCode: "FINAL_NOT_INITIALIZED_CONSTRUCTOR_1");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsFinalFieldNotInitializedByConstructor(String name) {
@@ -3202,7 +3182,6 @@
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 const MessageCode messageForInLoopExactlyOneVariable = const MessageCode(
     "ForInLoopExactlyOneVariable",
-    severity: Severity.error,
     message: r"""A for-in loop can't have more than one loop variable.""");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -3211,7 +3190,6 @@
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 const MessageCode messageForInLoopNotAssignable = const MessageCode(
     "ForInLoopNotAssignable",
-    severity: Severity.error,
     message:
         r"""Can't assign to this, so it can't be used in a for-in loop.""");
 
@@ -3301,7 +3279,6 @@
 const MessageCode messageGenericFunctionTypeInBound = const MessageCode(
     "GenericFunctionTypeInBound",
     analyzerCode: "GENERIC_FUNCTION_TYPE_CANNOT_BE_BOUND",
-    severity: Severity.error,
     message:
         r"""Type variables can't have generic function types in their bounds.""");
 
@@ -3352,7 +3329,6 @@
 const MessageCode messageIllegalAsyncGeneratorReturnType = const MessageCode(
     "IllegalAsyncGeneratorReturnType",
     analyzerCode: "ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE",
-    severity: Severity.error,
     message:
         r"""Functions marked 'async*' must have a return type assignable to 'Stream'.""");
 
@@ -3363,7 +3339,6 @@
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 const MessageCode messageIllegalAsyncGeneratorVoidReturnType =
     const MessageCode("IllegalAsyncGeneratorVoidReturnType",
-        severity: Severity.error,
         message:
             r"""Functions marked 'async*' can't have return type 'void'.""");
 
@@ -3374,7 +3349,6 @@
 const MessageCode messageIllegalAsyncReturnType = const MessageCode(
     "IllegalAsyncReturnType",
     analyzerCode: "ILLEGAL_ASYNC_RETURN_TYPE",
-    severity: Severity.error,
     message:
         r"""Functions marked 'async' must have a return type assignable to 'Future'.""");
 
@@ -3450,7 +3424,6 @@
 const MessageCode messageIllegalSyncGeneratorReturnType = const MessageCode(
     "IllegalSyncGeneratorReturnType",
     analyzerCode: "ILLEGAL_SYNC_GENERATOR_RETURN_TYPE",
-    severity: Severity.error,
     message:
         r"""Functions marked 'sync*' must have a return type assignable to 'Iterable'.""");
 
@@ -3461,7 +3434,6 @@
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 const MessageCode messageIllegalSyncGeneratorVoidReturnType = const MessageCode(
     "IllegalSyncGeneratorVoidReturnType",
-    severity: Severity.error,
     message: r"""Functions marked 'sync*' can't have return type 'void'.""");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -3500,7 +3472,6 @@
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 const MessageCode messageImplementsFutureOr = const MessageCode(
     "ImplementsFutureOr",
-    severity: Severity.error,
     message: r"""'FutureOr' can't be used in an 'implements' clause.""");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -3567,7 +3538,7 @@
 const Code<Message Function(DartType _type)> codeImplicitCallOfNonMethod =
     const Code<Message Function(DartType _type)>(
         "ImplicitCallOfNonMethod", templateImplicitCallOfNonMethod,
-        analyzerCode: "IMPLICIT_CALL_OF_NON_METHOD", severity: Severity.error);
+        analyzerCode: "IMPLICIT_CALL_OF_NON_METHOD");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsImplicitCallOfNonMethod(DartType _type) {
@@ -3970,27 +3941,6 @@
         r"""Are calls to the compiler wrapped in CompilerContext.runInContext?""");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-const Template<Message Function(String string)>
-    templateInternalProblemMissingSeverity =
-    const Template<Message Function(String string)>(
-        messageTemplate: r"""Message code missing severity: #string""",
-        withArguments: _withArgumentsInternalProblemMissingSeverity);
-
-// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-const Code<Message Function(String string)> codeInternalProblemMissingSeverity =
-    const Code<Message Function(String string)>(
-        "InternalProblemMissingSeverity",
-        templateInternalProblemMissingSeverity,
-        severity: Severity.internalProblem);
-
-// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-Message _withArgumentsInternalProblemMissingSeverity(String string) {
-  return new Message(codeInternalProblemMissingSeverity,
-      message: """Message code missing severity: ${string}""",
-      arguments: {'string': string});
-}
-
-// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 const Template<Message Function(String name)> templateInternalProblemNotFound =
     const Template<Message Function(String name)>(
         messageTemplate: r"""Couldn't find '#name'.""",
@@ -4645,7 +4595,6 @@
 const MessageCode messageInvalidInitializer = const MessageCode(
     "InvalidInitializer",
     analyzerCode: "INVALID_INITIALIZER",
-    severity: Severity.error,
     message: r"""Not a valid initializer.""",
     tip: r"""To initialize a field, use the syntax 'name = value'.""");
 
@@ -4740,7 +4689,6 @@
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 const MessageCode messageInvalidVoid = const MessageCode("InvalidVoid",
     analyzerCode: "INVALID_USE_OF_VOID",
-    severity: Severity.error,
     message:
         r"""Type 'void' can't be used here because it isn't a return type.""",
     tip:
@@ -4757,7 +4705,7 @@
 const Code<Message Function(String name)> codeInvokeNonFunction =
     const Code<Message Function(String name)>(
         "InvokeNonFunction", templateInvokeNonFunction,
-        analyzerCode: "INVOCATION_OF_NON_FUNCTION", severity: Severity.error);
+        analyzerCode: "INVOCATION_OF_NON_FUNCTION");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsInvokeNonFunction(String name) {
@@ -4949,7 +4897,6 @@
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 const MessageCode messageMissingArgumentList = const MessageCode(
     "MissingArgumentList",
-    severity: Severity.error,
     message: r"""Constructor invocations must have an argument list.""");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -5200,8 +5147,7 @@
     codeMixinInferenceNoMatchingClass =
     const Code<Message Function(String name, String name2, DartType _type)>(
         "MixinInferenceNoMatchingClass", templateMixinInferenceNoMatchingClass,
-        analyzerCode: "MIXIN_INFERENCE_NO_POSSIBLE_SUBSTITUTION",
-        severity: Severity.error);
+        analyzerCode: "MIXIN_INFERENCE_NO_POSSIBLE_SUBSTITUTION");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsMixinInferenceNoMatchingClass(
@@ -5226,7 +5172,6 @@
 const MessageCode messageMoreThanOneSuperOrThisInitializer = const MessageCode(
     "MoreThanOneSuperOrThisInitializer",
     analyzerCode: "SUPER_IN_REDIRECTING_CONSTRUCTOR",
-    severity: Severity.error,
     message: r"""Can't have more than one 'super' or 'this' initializer.""");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -5419,7 +5364,6 @@
 const MessageCode messageNonConstConstructor = const MessageCode(
     "NonConstConstructor",
     analyzerCode: "NOT_CONSTANT_EXPRESSION",
-    severity: Severity.error,
     message:
         r"""Cannot invoke a non-'const' constructor where a const expression is expected.""",
     tip: r"""Try using a constructor or factory that is 'const'.""");
@@ -5430,7 +5374,6 @@
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 const MessageCode messageNonConstFactory = const MessageCode("NonConstFactory",
     analyzerCode: "NOT_CONSTANT_EXPRESSION",
-    severity: Severity.error,
     message:
         r"""Cannot invoke a non-'const' factory where a const expression is expected.""",
     tip: r"""Try using a constructor or factory that is 'const'.""");
@@ -5509,7 +5452,6 @@
 const MessageCode messageNotAConstantExpression = const MessageCode(
     "NotAConstantExpression",
     analyzerCode: "NOT_CONSTANT_EXPRESSION",
-    severity: Severity.error,
     message: r"""Not a constant expression.""");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -5979,7 +5921,7 @@
 const Code<Message Function(Uri uri_)> codePartOfInLibrary =
     const Code<Message Function(Uri uri_)>(
         "PartOfInLibrary", templatePartOfInLibrary,
-        analyzerCode: "IMPORT_OF_NON_LIBRARY", severity: Severity.error);
+        analyzerCode: "IMPORT_OF_NON_LIBRARY");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsPartOfInLibrary(Uri uri_) {
@@ -6046,7 +5988,6 @@
 const MessageCode messagePartOfTwoLibraries = const MessageCode(
     "PartOfTwoLibraries",
     analyzerCode: "PART_OF_DIFFERENT_LIBRARY",
-    severity: Severity.error,
     message: r"""A file can't be part of more than one library.""",
     tip:
         r"""Try moving the shared declarations into the libraries, or into a new library.""");
@@ -6340,7 +6281,6 @@
 const MessageCode messageReturnFromVoidFunction = const MessageCode(
     "ReturnFromVoidFunction",
     analyzerCode: "RETURN_OF_INVALID_TYPE",
-    severity: Severity.error,
     message: r"""Can't return a value from a void function.""");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -6645,7 +6585,6 @@
 const MessageCode messageSuperInitializerNotLast = const MessageCode(
     "SuperInitializerNotLast",
     analyzerCode: "INVALID_SUPER_INVOCATION",
-    severity: Severity.error,
     message: r"""Can't have initializers after 'super'.""");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -6786,7 +6725,7 @@
 const Code<Message Function(String name)> codeSupertypeIsIllegal =
     const Code<Message Function(String name)>(
         "SupertypeIsIllegal", templateSupertypeIsIllegal,
-        analyzerCode: "EXTENDS_NON_CLASS", severity: Severity.error);
+        analyzerCode: "EXTENDS_NON_CLASS");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsSupertypeIsIllegal(String name) {
@@ -6806,7 +6745,7 @@
 const Code<Message Function(String name)> codeSupertypeIsTypeVariable =
     const Code<Message Function(String name)>(
         "SupertypeIsTypeVariable", templateSupertypeIsTypeVariable,
-        analyzerCode: "EXTENDS_NON_CLASS", severity: Severity.error);
+        analyzerCode: "EXTENDS_NON_CLASS");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsSupertypeIsTypeVariable(String name) {
@@ -6841,8 +6780,7 @@
     codeSwitchExpressionNotAssignable =
     const Code<Message Function(DartType _type, DartType _type2)>(
         "SwitchExpressionNotAssignable", templateSwitchExpressionNotAssignable,
-        analyzerCode: "SWITCH_EXPRESSION_NOT_ASSIGNABLE",
-        severity: Severity.error);
+        analyzerCode: "SWITCH_EXPRESSION_NOT_ASSIGNABLE");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsSwitchExpressionNotAssignable(
@@ -6925,7 +6863,6 @@
 const MessageCode messageThisAsIdentifier = const MessageCode(
     "ThisAsIdentifier",
     analyzerCode: "INVALID_REFERENCE_TO_THIS",
-    severity: Severity.error,
     message: r"""Expected identifier, but got 'this'.""");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -6935,7 +6872,6 @@
 const MessageCode messageThisInitializerNotAlone = const MessageCode(
     "ThisInitializerNotAlone",
     analyzerCode: "FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR",
-    severity: Severity.error,
     message: r"""Can't have other initializers together with 'this'.""");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -7134,7 +7070,6 @@
 const MessageCode messageTypeVariableInConstantContext = const MessageCode(
     "TypeVariableInConstantContext",
     analyzerCode: "TYPE_PARAMETER_IN_CONST_EXPRESSION",
-    severity: Severity.error,
     message: r"""Type variables can't be used as constants.""");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -7487,7 +7422,6 @@
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 const MessageCode messageVoidExpression = const MessageCode("VoidExpression",
     analyzerCode: "USE_OF_VOID_RESULT",
-    severity: Severity.error,
     message: r"""This expression has type 'void' and can't be used.""");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -7507,9 +7441,9 @@
 const Code<Message Function(String string, String string2)>
     codeWebLiteralCannotBeRepresentedExactly =
     const Code<Message Function(String string, String string2)>(
-        "WebLiteralCannotBeRepresentedExactly",
-        templateWebLiteralCannotBeRepresentedExactly,
-        severity: Severity.error);
+  "WebLiteralCannotBeRepresentedExactly",
+  templateWebLiteralCannotBeRepresentedExactly,
+);
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsWebLiteralCannotBeRepresentedExactly(
diff --git a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
index 60fb6cc..b559fa4 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -201,9 +201,9 @@
 
   int functionNestingLevel = 0;
 
-  Statement compileTimeErrorInTry;
+  Statement problemInTry;
 
-  Statement compileTimeErrorInLoopOrSwitch;
+  Statement problemInLoopOrSwitch;
 
   Scope switchScope;
 
@@ -302,10 +302,10 @@
     } else if (node is Expression) {
       return node;
     } else if (node is SuperInitializer) {
-      return new SyntheticExpressionJudgment(buildCompileTimeError(
-          fasta.messageSuperAsExpression, node.fileOffset, noLength));
+      return buildProblem(
+          fasta.messageSuperAsExpression, node.fileOffset, noLength);
     } else if (node is ProblemBuilder) {
-      return buildProblemExpression(node, -1, noLength);
+      return buildProblem(node.message, node.charOffset, noLength);
     } else {
       return unhandled("${node.runtimeType}", "toValue", -1, uri);
     }
@@ -362,7 +362,7 @@
           for (Statement statement in target.users) {
             statement.parent.replaceChild(
                 statement,
-                wrapInCompileTimeErrorStatement(statement,
+                wrapInProblemStatement(statement,
                     fasta.templateLabelNotFound.withArguments(name)));
           }
         } else {
@@ -381,11 +381,11 @@
     int offset = variable.fileOffset;
     Message message = template.withArguments(name);
     if (variable.initializer == null) {
-      variable.initializer = new SyntheticExpressionJudgment(
-          buildCompileTimeError(message, offset, name.length, context: context))
-        ..parent = variable;
+      variable.initializer =
+          buildProblem(message, offset, name.length, context: context)
+            ..parent = variable;
     } else {
-      variable.initializer = wrapInLocatedCompileTimeError(
+      variable.initializer = wrapInLocatedProblem(
           variable.initializer, message.withLocation(uri, offset, name.length),
           context: context)
         ..parent = variable;
@@ -467,8 +467,8 @@
 
       ConstantContext savedConstantContext = pop();
       if (expression is! StaticAccessGenerator) {
-        push(wrapInCompileTimeError(
-            toValue(expression), fasta.messageExpressionNotMetadata));
+        push(wrapInProblem(
+            toValue(expression), fasta.messageExpressionNotMetadata, noLength));
       } else {
         push(toValue(expression));
       }
@@ -572,10 +572,8 @@
     if (member is KernelConstructorBuilder) {
       if (member.isConst &&
           (classBuilder.cls.superclass?.isMixinApplication ?? false)) {
-        addCompileTimeError(
-            fasta.messageConstConstructorInSubclassOfMixinApplication,
-            member.charOffset,
-            member.name.length);
+        addProblem(fasta.messageConstConstructorInSubclassOfMixinApplication,
+            member.charOffset, member.name.length);
       }
       if (member.formals != null) {
         for (KernelFormalParameterBuilder formal in member.formals) {
@@ -583,10 +581,11 @@
             Initializer initializer;
             if (member.isExternal) {
               initializer = buildInvalidInitializer(
-                  buildCompileTimeError(
-                      fasta.messageExternalConstructorWithFieldInitializers,
-                      formal.charOffset,
-                      formal.name.length),
+                  buildProblem(
+                          fasta.messageExternalConstructorWithFieldInitializers,
+                          formal.charOffset,
+                          formal.name.length)
+                      .desugared,
                   formal.charOffset);
             } else {
               initializer = buildFieldInitializer(true, formal.name,
@@ -651,7 +650,7 @@
       Expression value = toValue(node);
       if (node is! Throw) {
         value =
-            wrapInCompileTimeError(value, fasta.messageExpectedAnInitializer);
+            wrapInProblem(value, fasta.messageExpectedAnInitializer, noLength);
       }
       initializer = buildInvalidInitializer(node, token.charOffset);
     }
@@ -659,7 +658,7 @@
     if (member is KernelConstructorBuilder && !member.isExternal) {
       member.addInitializer(initializer, this);
     } else {
-      addCompileTimeError(
+      addProblem(
           fasta.templateInitializerOutsideConstructor
               .withArguments(member.name),
           token.charOffset,
@@ -797,7 +796,7 @@
           statements.add(body);
           body = forest.block(null, statements, null)..fileOffset = charOffset;
         }
-        body = wrapInCompileTimeErrorStatement(
+        body = wrapInProblemStatement(
             body, fasta.messageSetterWithWrongNumberOfFormals);
       }
     }
@@ -809,8 +808,8 @@
       builder.body = body;
     } else {
       if (body != null) {
-        builder.body = wrapInCompileTimeErrorStatement(
-            body, fasta.messageExternalMethodWithBody);
+        builder.body =
+            wrapInProblemStatement(body, fasta.messageExternalMethodWithBody);
       }
     }
     Member target = builder.target;
@@ -851,11 +850,12 @@
           name += ".${initialTarget.name.name}";
         }
         // TODO(dmitryas): Report this error earlier.
-        replacementNode = buildCompileTimeError(
-            fasta.templateCyclicRedirectingFactoryConstructors
-                .withArguments(initialTarget.name.name),
-            initialTarget.fileOffset,
-            name.length);
+        replacementNode = buildProblem(
+                fasta.templateCyclicRedirectingFactoryConstructors
+                    .withArguments(initialTarget.name.name),
+                initialTarget.fileOffset,
+                name.length)
+            .desugared;
       } else if (resolvedTarget is Constructor &&
           resolvedTarget.enclosingClass.isAbstract) {
         replacementNode = evaluateArgumentsBefore(
@@ -994,7 +994,7 @@
     Token eof = token.next;
 
     if (!eof.isEof) {
-      expression = wrapInLocatedCompileTimeError(
+      expression = wrapInLocatedProblem(
           expression,
           fasta.messageExpectedOneExpression
               .withLocation(uri, eof.charOffset, eof.length));
@@ -1027,8 +1027,7 @@
       // TODO(ahe): Change this to a null check.
       int offset = builder.body?.fileOffset ?? builder.charOffset;
       constructor.initializers.add(buildInvalidInitializer(
-          buildCompileTimeErrorExpression(
-              fasta.messageConstructorNotSync, offset),
+          buildProblem(fasta.messageConstructorNotSync, offset, noLength),
           offset));
     }
     if (needsImplicitSuperInitializer) {
@@ -1048,11 +1047,12 @@
           length = (constructor.parent as Class).name.length;
         }
         initializer = buildInvalidInitializer(
-            buildCompileTimeError(
-                fasta.templateSuperclassHasNoDefaultConstructor
-                    .withArguments(superclass),
-                builder.charOffset,
-                length),
+            buildProblem(
+                    fasta.templateSuperclassHasNoDefaultConstructor
+                        .withArguments(superclass),
+                    builder.charOffset,
+                    length)
+                .desugared,
             builder.charOffset);
       } else {
         initializer = buildSuperInitializer(
@@ -1094,9 +1094,8 @@
         if (i > firstNamedArgumentIndex) {
           arguments[i] = new NamedExpression(
               "#$i",
-              buildCompileTimeErrorExpression(
-                  fasta.messageExpectedNamedArgument,
-                  forest.readOffset(argument)))
+              buildProblem(fasta.messageExpectedNamedArgument,
+                  forest.readOffset(argument), noLength))
             ..fileOffset = beginToken.charOffset;
         }
       }
@@ -1246,9 +1245,8 @@
       negate = true;
     }
     if (!isBinaryOperator(operator) && !isMinusOperator(operator)) {
-      return buildCompileTimeErrorExpression(
-          fasta.templateInvalidOperator.withArguments(token), token.charOffset,
-          length: token.length);
+      return buildProblem(fasta.templateInvalidOperator.withArguments(token),
+          token.charOffset, token.length);
     } else {
       Expression result = buildMethodInvocation(a, new Name(operator),
           forest.arguments(<Expression>[b], noLocation), token.charOffset,
@@ -1294,9 +1292,8 @@
     } else {
       pop();
       token = token.next;
-      Message message = fasta.templateExpectedIdentifier.withArguments(token);
-      push(new SyntheticExpressionJudgment(buildCompileTimeError(
-          message, offsetForToken(token), lengthForToken(token))));
+      push(buildProblem(fasta.templateExpectedIdentifier.withArguments(token),
+          offsetForToken(token), lengthForToken(token)));
     }
   }
 
@@ -1308,9 +1305,8 @@
     } else {
       pop();
       token = token.next;
-      Message message = fasta.templateExpectedIdentifier.withArguments(token);
-      push(new SyntheticExpressionJudgment(buildCompileTimeError(
-          message, offsetForToken(token), lengthForToken(token))));
+      push(buildProblem(fasta.templateExpectedIdentifier.withArguments(token),
+          offsetForToken(token), lengthForToken(token)));
     }
   }
 
@@ -1374,8 +1370,8 @@
       // TODO(ahe): Use [error] below instead of building a compile-time error,
       // should be:
       //    return library.loader.throwCompileConstantError(error, charOffset);
-      return buildCompileTimeError(message, charOffset, noLength,
-          context: context);
+      return buildProblem(message, charOffset, noLength, context: context)
+          .desugared;
     } else {
       Expression error = library.loader.instantiateNoSuchMethodError(
           receiver, name, forest.castArguments(arguments), charOffset,
@@ -1565,7 +1561,7 @@
       }
     } else if (constantContext != ConstantContext.none &&
         !context.allowedInConstantExpression) {
-      addCompileTimeError(
+      addProblem(
           fasta.messageNotAConstantExpression, token.charOffset, token.length);
     }
     push(new Identifier(token));
@@ -1619,7 +1615,7 @@
       if (constantContext != ConstantContext.none &&
           declaration.isTypeVariable &&
           !member.isConstructor) {
-        addCompileTimeError(
+        addProblem(
             fasta.messageNotAConstantExpression, charOffset, token.length);
       }
       return new TypeUseGenerator(this, token, declaration, name);
@@ -1627,7 +1623,7 @@
       if (constantContext != ConstantContext.none &&
           !declaration.isConst &&
           !member.isConstructor) {
-        addCompileTimeError(
+        addProblem(
             fasta.messageNotAConstantExpression, charOffset, token.length);
       }
       // An initializing formal parameter might be final without its
@@ -1655,7 +1651,7 @@
           // semantics, such parameters introduces a new parameter with that
           // name that should be resolved here.
           !member.isConstructor) {
-        addCompileTimeError(
+        addProblem(
             fasta.messageNotAConstantExpression, charOffset, token.length);
       }
       Name n = new Name(name, library.library);
@@ -1696,7 +1692,7 @@
         if (!(readTarget is Field && readTarget.isConst ||
             // Static tear-offs are also compile time constants.
             readTarget is Procedure)) {
-          addCompileTimeError(
+          addProblem(
               fasta.messageNotAConstantExpression, charOffset, token.length);
         }
       }
@@ -1838,7 +1834,7 @@
     debugEvent("ReturnStatement");
     Expression expression = hasExpression ? popForValue() : null;
     if (expression != null && inConstructor) {
-      push(buildCompileTimeErrorStatement(
+      push(buildProblemStatement(
           fasta.messageConstructorWithReturnType, beginToken.charOffset));
     } else {
       push(forest.returnStatement(beginToken, expression, endToken));
@@ -1886,17 +1882,17 @@
       // silent if the next token is `in`. Since a for-in loop can only have
       // one variable it must be followed by `in`.
       if (isConst) {
-        initializer = buildCompileTimeErrorExpression(
+        initializer = buildProblem(
             fasta.templateConstFieldWithoutInitializer
                 .withArguments(token.lexeme),
             token.charOffset,
-            length: token.length);
+            token.length);
       } else if (isFinal) {
-        initializer = buildCompileTimeErrorExpression(
+        initializer = buildProblem(
             fasta.templateFinalFieldWithoutInitializer
                 .withArguments(token.lexeme),
             token.charOffset,
-            length: token.length);
+            token.length);
       }
     }
     pushNewLocalVariable(initializer);
@@ -2028,10 +2024,8 @@
     Expression value = popForValue();
     Object generator = pop();
     if (generator is! Generator) {
-      push(new SyntheticExpressionJudgment(buildCompileTimeError(
-          fasta.messageNotAnLvalue,
-          offsetForToken(token),
-          lengthForToken(token))));
+      push(buildProblem(fasta.messageNotAnLvalue, offsetForToken(token),
+          lengthForToken(token)));
     } else {
       push(new DelayedAssignment(
           this, token, generator, value, token.stringValue));
@@ -2051,9 +2045,9 @@
   }
 
   void exitLoopOrSwitch(Statement statement) {
-    if (compileTimeErrorInLoopOrSwitch != null) {
-      push(compileTimeErrorInLoopOrSwitch);
-      compileTimeErrorInLoopOrSwitch = null;
+    if (problemInLoopOrSwitch != null) {
+      push(problemInLoopOrSwitch);
+      problemInLoopOrSwitch = null;
     } else {
       push(statement);
     }
@@ -2326,12 +2320,10 @@
         if (existing == null) {
           scopeBuilder.addMember(name, builder);
         } else {
-          addCompileTimeError(fasta.templateDuplicatedName.withArguments(name),
+          addProblem(fasta.templateDuplicatedName.withArguments(name),
               builder.charOffset, name.length);
-          addCompileTimeError(
-              fasta.templateDuplicatedNameCause.withArguments(name),
-              existing.charOffset,
-              name.length);
+          addProblem(fasta.templateDuplicatedNameCause.withArguments(name),
+              existing.charOffset, name.length);
         }
       }
     }
@@ -2363,10 +2355,12 @@
     DartType type = pop();
     Expression expression = popForValue();
     if (constantContext != ConstantContext.none) {
-      push(buildCompileTimeError(
-          fasta.templateNotConstantExpression.withArguments('As expression'),
-          operator.charOffset,
-          operator.length));
+      push(buildProblem(
+              fasta.templateNotConstantExpression
+                  .withArguments('As expression'),
+              operator.charOffset,
+              operator.length)
+          .desugared);
     } else {
       push(forest.asExpression(expression, type, operator));
     }
@@ -2385,10 +2379,12 @@
           type, functionNestingLevel);
     }
     if (constantContext != ConstantContext.none) {
-      push(buildCompileTimeError(
-          fasta.templateNotConstantExpression.withArguments('Is expression'),
-          isOperator.charOffset,
-          isOperator.length));
+      push(buildProblem(
+              fasta.templateNotConstantExpression
+                  .withArguments('Is expression'),
+              isOperator.charOffset,
+              isOperator.length)
+          .desugared);
     } else {
       push(isExpression);
     }
@@ -2428,10 +2424,11 @@
 
     Expression error;
     if (constantContext != ConstantContext.none) {
-      error = buildCompileTimeError(
-          fasta.templateNotConstantExpression.withArguments('Throw'),
-          throwToken.offset,
-          throwToken.length);
+      error = buildProblem(
+              fasta.templateNotConstantExpression.withArguments('Throw'),
+              throwToken.offset,
+              throwToken.length)
+          .desugared;
     }
 
     push(new ThrowJudgment(tokensSaver?.throwTokens(throwToken), expression,
@@ -2483,7 +2480,7 @@
         if (member is KernelRedirectingFactoryBuilder &&
             name.initializer != null) {
           KernelRedirectingFactoryBuilder factory = member;
-          addCompileTimeError(
+          addProblem(
               fasta.templateDefaultValueInRedirectingFactoryConstructor
                   .withArguments(factory.redirectionTarget.fullNameForErrors),
               name.initializer.fileOffset,
@@ -2652,7 +2649,8 @@
               stackTrace, coreTypes.stackTraceClass.rawType);
         }
       } else {
-        buildCompileTimeError(fasta.messageInvalidCatchArguments,
+        // TODO(ahe): We're not storing this error in the AST.
+        buildProblem(fasta.messageInvalidCatchArguments,
             catchParameters.charOffset, catchParameters.charLength);
 
         var allFormals = <VariableDeclaration>[];
@@ -2683,12 +2681,12 @@
     Object catches = popList(
         catchCount, new List<Catch>.filled(catchCount, null, growable: true));
     Statement tryBlock = popStatement();
-    if (compileTimeErrorInTry == null) {
+    if (problemInTry == null) {
       push(forest.tryStatement(
           tryKeyword, tryBlock, catches, finallyKeyword, finallyBlock));
     } else {
-      push(compileTimeErrorInTry);
-      compileTimeErrorInTry = null;
+      push(problemInTry);
+      problemInTry = null;
     }
   }
 
@@ -2771,8 +2769,8 @@
       push(generator.buildPrefixIncrement(incrementOperator(token),
           offset: token.charOffset));
     } else {
-      push(
-          wrapInCompileTimeError(toValue(generator), fasta.messageNotAnLvalue));
+      push(wrapInProblem(
+          toValue(generator), fasta.messageNotAnLvalue, noLength));
     }
   }
 
@@ -2784,8 +2782,8 @@
       push(new DelayedPostfixIncrement(
           this, token, generator, incrementOperator(token), null));
     } else {
-      push(
-          wrapInCompileTimeError(toValue(generator), fasta.messageNotAnLvalue));
+      push(wrapInProblem(
+          toValue(generator), fasta.messageNotAnLvalue, noLength));
     }
   }
 
@@ -2911,10 +2909,12 @@
           isConst || constantContext != ConstantContext.none && target.isConst;
       if ((isConst || constantContext == ConstantContext.inferred) &&
           !target.isConst) {
-        var error = buildCompileTimeError(
-            fasta.messageNonConstConstructor, charOffset, charLength);
         return new InvalidConstructorInvocationJudgment(
-            error, target, arguments);
+            buildProblem(
+                    fasta.messageNonConstConstructor, charOffset, charLength)
+                .desugared,
+            target,
+            arguments);
       }
       return new ConstructorInvocationJudgment(
           target, forest.castArguments(arguments),
@@ -2927,10 +2927,11 @@
             constantContext != ConstantContext.none && procedure.isConst;
         if ((isConst || constantContext == ConstantContext.inferred) &&
             !procedure.isConst) {
-          var error = buildCompileTimeError(
-              fasta.messageNonConstFactory, charOffset, charLength);
           return new InvalidConstructorInvocationJudgment(
-              error, target, arguments);
+              buildProblem(fasta.messageNonConstFactory, charOffset, charLength)
+                  .desugared,
+              target,
+              arguments);
         }
         return new FactoryConstructorInvocationJudgment(
             target, forest.castArguments(arguments),
@@ -3042,7 +3043,7 @@
     debugEvent("beginNewExpression");
     super.push(constantContext);
     if (constantContext != ConstantContext.none) {
-      addCompileTimeError(
+      addProblem(
           fasta.templateNotConstantExpression.withArguments('New expression'),
           token.charOffset,
           token.length);
@@ -3127,9 +3128,8 @@
       int charOffset,
       Constness constness) {
     if (arguments == null) {
-      return buildCompileTimeErrorExpression(
-          fasta.messageMissingArgumentList, nameToken.charOffset,
-          length: nameToken.length);
+      return buildProblem(fasta.messageMissingArgumentList,
+          nameToken.charOffset, nameToken.length);
     }
 
     if (typeArguments != null) {
@@ -3140,9 +3140,8 @@
     String errorName;
     if (type is ClassBuilder<TypeBuilder, Object>) {
       if (type is EnumBuilder<TypeBuilder, Object>) {
-        return buildCompileTimeErrorExpression(
-            fasta.messageEnumInstantiation, nameToken.charOffset,
-            length: nameToken.length);
+        return buildProblem(fasta.messageEnumInstantiation,
+            nameToken.charOffset, nameToken.length);
       }
       Declaration b =
           type.findConstructorOrFactory(name, charOffset, uri, library);
@@ -3282,10 +3281,8 @@
         isLocalFunction: true)
       ..fileOffset = offsetForToken(nameToken);
     if (scope.local[variable.name] != null) {
-      addCompileTimeError(
-          fasta.templateDuplicatedName.withArguments(variable.name),
-          offsetForToken(nameToken),
-          nameToken.length);
+      addProblem(fasta.templateDuplicatedName.withArguments(variable.name),
+          offsetForToken(nameToken), nameToken.length);
     }
     push(new FunctionDeclarationJudgment(
         variable,
@@ -3441,9 +3438,8 @@
       ..fileOffset = beginToken.charOffset
       ..fileEndOffset = token.charOffset);
     if (constantContext != ConstantContext.none) {
-      push(buildCompileTimeErrorExpression(
-          fasta.messageNotAConstantExpression, formals.charOffset,
-          length: formals.charLength));
+      push(buildProblem(fasta.messageNotAConstantExpression, formals.charOffset,
+          formals.charLength));
     } else {
       push(new FunctionExpressionJudgment(function)
         ..fileOffset = offsetForToken(beginToken));
@@ -3506,8 +3502,8 @@
       declaresVariable = true;
       variable = lvalue;
       if (variable.isConst) {
-        addCompileTimeError(fasta.messageForInLoopWithConstVariable,
-            variable.fileOffset, variable.name.length);
+        addProblem(fasta.messageForInLoopWithConstVariable, variable.fileOffset,
+            variable.name.length);
       }
     } else if (lvalue is Generator) {
       /// We are in this case, where `lvalue` isn't a [VariableDeclaration]:
@@ -3535,8 +3531,7 @@
           : fasta.messageForInLoopNotAssignable;
       Token token = forToken.next.next;
       variable = new VariableDeclaration.forValue(
-          new SyntheticExpressionJudgment(buildCompileTimeError(
-              message, offsetForToken(token), lengthForToken(token))));
+          buildProblem(message, offsetForToken(token), lengthForToken(token)));
     }
     Statement result = new ForInJudgment(
         tokensSaver?.forInStatementTokens(awaitToken, forToken, leftParenthesis,
@@ -3605,8 +3600,9 @@
     debugEvent("RethrowStatement");
     var error = inCatchBlock
         ? null
-        : buildCompileTimeError(fasta.messageRethrowNotCatch,
-            offsetForToken(rethrowToken), lengthForToken(rethrowToken));
+        : buildProblem(fasta.messageRethrowNotCatch,
+                offsetForToken(rethrowToken), lengthForToken(rethrowToken))
+            .desugared;
     push(new ExpressionStatementJudgment(
         new RethrowJudgment(tokensSaver?.rethrowTokens(rethrowToken), error)
           ..fileOffset = offsetForToken(rethrowToken),
@@ -3669,9 +3665,8 @@
       case Assert.Expression:
         // The parser has already reported an error indicating that assert
         // cannot be used in an expression.
-        push(buildCompileTimeErrorExpression(
-            fasta.messageAssertAsExpression, assertKeyword.offset,
-            length: assertKeyword.length));
+        push(buildProblem(fasta.messageAssertAsExpression, assertKeyword.offset,
+            assertKeyword.length));
         break;
 
       case Assert.Initializer:
@@ -3718,7 +3713,7 @@
       if (scope.hasLocalLabel(labelName)) {
         // TODO(ahe): Should validate this is a goto target.
         if (!scope.claimLabel(labelName)) {
-          addCompileTimeError(
+          addProblem(
               fasta.templateDuplicateLabelInSwitchStatement
                   .withArguments(labelName),
               forest.getLabelOffset(label),
@@ -3851,19 +3846,19 @@
       target = scope.lookupLabel(name);
     }
     if (target == null && name == null) {
-      push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement(
+      push(problemInLoopOrSwitch = buildProblemStatement(
           fasta.messageBreakOutsideOfLoop, breakKeyword.charOffset));
     } else if (target == null ||
         target is! JumpTarget ||
         !target.isBreakTarget) {
       Token labelToken = breakKeyword.next;
-      push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement(
+      push(problemInLoopOrSwitch = buildProblemStatement(
           fasta.templateInvalidBreakTarget.withArguments(name),
           labelToken.charOffset,
           length: labelToken.length));
     } else if (target.functionNestingLevel != functionNestingLevel) {
       Token labelToken = breakKeyword.next;
-      push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement(
+      push(problemInLoopOrSwitch = buildProblemStatement(
           fasta.templateBreakTargetOutsideFunction.withArguments(name),
           labelToken.charOffset,
           length: labelToken.length));
@@ -3888,7 +3883,7 @@
       Declaration namedTarget = scope.lookupLabel(identifier.name);
       if (namedTarget != null && namedTarget is! JumpTarget) {
         Token labelToken = continueKeyword.next;
-        push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement(
+        push(problemInLoopOrSwitch = buildProblemStatement(
             fasta.messageContinueLabelNotTarget, labelToken.charOffset,
             length: labelToken.length));
         return;
@@ -3896,7 +3891,7 @@
       target = namedTarget;
       if (target == null) {
         if (switchScope == null) {
-          push(buildCompileTimeErrorStatement(
+          push(buildProblemStatement(
               fasta.templateLabelNotFound.withArguments(name),
               continueKeyword.next.charOffset));
           return;
@@ -3917,18 +3912,18 @@
       }
     }
     if (target == null) {
-      push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement(
+      push(problemInLoopOrSwitch = buildProblemStatement(
           fasta.messageContinueWithoutLabelInCase, continueKeyword.charOffset,
           length: continueKeyword.length));
     } else if (!target.isContinueTarget) {
       Token labelToken = continueKeyword.next;
-      push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement(
+      push(problemInLoopOrSwitch = buildProblemStatement(
           fasta.templateInvalidContinueTarget.withArguments(name),
           labelToken.charOffset,
           length: labelToken.length));
     } else if (target.functionNestingLevel != functionNestingLevel) {
       Token labelToken = continueKeyword.next;
-      push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement(
+      push(problemInLoopOrSwitch = buildProblemStatement(
           fasta.templateContinueTargetOutsideFunction.withArguments(name),
           labelToken.charOffset,
           length: labelToken.length));
@@ -4079,66 +4074,47 @@
   @override
   void handleInvalidStatement(Token token, Message message) {
     Statement statement = pop();
-    var error = buildCompileTimeError(message, statement.fileOffset, noLength);
-    push(new InvalidStatementJudgment(error, statement));
+    push(new InvalidStatementJudgment(
+        buildProblem(message, statement.fileOffset, noLength).desugared,
+        statement));
   }
 
   @override
-  Expression buildCompileTimeError(Message message, int charOffset, int length,
+  SyntheticExpressionJudgment buildProblem(
+      Message message, int charOffset, int length,
       {List<LocatedMessage> context}) {
-    library.addCompileTimeError(message, charOffset, length, uri,
-        wasHandled: true, context: context);
-    return library.loader.throwCompileConstantError(
-        library.loader.buildCompileTimeError(message, charOffset, length, uri));
-  }
-
-  @override
-  Expression buildCompileTimeErrorExpression(Message message, int offset,
-      {int length}) {
-    return new SyntheticExpressionJudgment(
-        buildCompileTimeError(message, offset, length ?? noLength));
-  }
-
-  Expression wrapInCompileTimeError(Expression expression, Message message,
-      {List<LocatedMessage> context}) {
-    return wrapInLocatedCompileTimeError(expression,
-        message.withLocation(uri, forest.readOffset(expression), noLength),
-        context: context);
+    addProblem(message, charOffset, length, wasHandled: true, context: context);
+    return new SyntheticExpressionJudgment(library.loader
+        .throwCompileConstantError(
+            library.loader.buildProblem(message, charOffset, length, uri)));
   }
 
   @override
   Expression wrapInProblem(Expression expression, Message message, int length,
       {List<LocatedMessage> context}) {
-    int charOffset = expression.fileOffset;
+    int charOffset = forest.readOffset(expression);
     Severity severity = message.code.severity;
-    if (severity == null) {
-      addCompileTimeError(message, charOffset, length, context: context);
-      internalProblem(
-          fasta.templateInternalProblemMissingSeverity
-              .withArguments(message.code.name),
-          charOffset,
-          uri);
-    } else if (severity == Severity.error ||
+    if (severity == Severity.error ||
         severity == Severity.errorLegacyWarning &&
             library.loader.target.strongMode) {
-      return wrapInCompileTimeError(expression, message, context: context);
+      return wrapInLocatedProblem(
+          expression, message.withLocation(uri, charOffset, length),
+          context: context);
     } else {
       addProblem(message, charOffset, length, context: context);
+      return expression;
     }
-    return expression;
   }
 
   @override
-  Expression wrapInLocatedCompileTimeError(
-      Expression expression, LocatedMessage message,
+  Expression wrapInLocatedProblem(Expression expression, LocatedMessage message,
       {List<LocatedMessage> context}) {
     // TODO(askesc): Produce explicit error expression wrapping the original.
     // See [issue 29717](https://github.com/dart-lang/sdk/issues/29717)
     return new SyntheticExpressionJudgment(new Let(
-        new VariableDeclaration.forValue(new SyntheticExpressionJudgment(
-            buildCompileTimeError(
-                message.messageObject, message.charOffset, message.length,
-                context: context)))
+        new VariableDeclaration.forValue(buildProblem(
+            message.messageObject, message.charOffset, message.length,
+            context: context))
           ..fileOffset = forest.readOffset(expression),
         new Let(
             new VariableDeclaration.forValue(expression)
@@ -4182,20 +4158,17 @@
         ], noLocation)));
   }
 
-  Statement buildCompileTimeErrorStatement(Message message, int charOffset,
+  Statement buildProblemStatement(Message message, int charOffset,
       {List<LocatedMessage> context, int length}) {
     return new ExpressionStatementJudgment(
-        new SyntheticExpressionJudgment(buildCompileTimeError(
-            message, charOffset, length ?? noLength,
-            context: context)),
+        buildProblem(message, charOffset, length ?? noLength, context: context),
         null);
   }
 
-  Statement wrapInCompileTimeErrorStatement(
-      Statement statement, Message message) {
+  Statement wrapInProblemStatement(Statement statement, Message message) {
     // TODO(askesc): Produce explicit error statement wrapping the original.
     // See [issue 29717](https://github.com/dart-lang/sdk/issues/29717)
-    return buildCompileTimeErrorStatement(message, statement.fileOffset);
+    return buildProblemStatement(message, statement.fileOffset);
   }
 
   @override
@@ -4218,13 +4191,15 @@
 
   Initializer buildDuplicatedInitializer(Field field, Expression value,
       String name, int offset, int previousInitializerOffset) {
-    var error = buildCompileTimeError(
-        fasta.templateFinalInstanceVariableAlreadyInitialized
-            .withArguments(name),
-        offset,
-        noLength);
     return new ShadowInvalidFieldInitializer(
-        field, value, new VariableDeclaration.forValue(error))
+        field,
+        value,
+        new VariableDeclaration.forValue(buildProblem(
+                fasta.templateFinalInstanceVariableAlreadyInitialized
+                    .withArguments(name),
+                offset,
+                noLength)
+            .desugared))
       ..fileOffset = offset;
   }
 
@@ -4297,10 +4272,11 @@
       }
     } else {
       return buildInvalidInitializer(
-          buildCompileTimeError(
-              fasta.templateInitializerForStaticField.withArguments(name),
-              offset,
-              name.length),
+          buildProblem(
+                  fasta.templateInitializerForStaticField.withArguments(name),
+                  offset,
+                  name.length)
+              .desugared,
           offset);
     }
   }
@@ -4313,8 +4289,9 @@
       return buildInvalidSuperInitializer(
           constructor,
           forest.castArguments(arguments),
-          buildCompileTimeError(fasta.messageConstConstructorWithNonConstSuper,
-              charOffset, constructor.name.name.length),
+          buildProblem(fasta.messageConstConstructorWithNonConstSuper,
+                  charOffset, constructor.name.name.length)
+              .desugared,
           charOffset);
     }
     needsImplicitSuperInitializer = false;
@@ -4344,13 +4321,6 @@
   }
 
   @override
-  Expression buildProblemExpression(
-      ProblemBuilder builder, int charOffset, int length) {
-    return new SyntheticExpressionJudgment(
-        buildCompileTimeError(builder.message, charOffset, length));
-  }
-
-  @override
   void handleOperator(Token token) {
     debugEvent("Operator");
     push(new Operator(token, token.charOffset));
@@ -4370,7 +4340,7 @@
       push(forest.block(
           token,
           <Statement>[
-            buildCompileTimeErrorStatement(
+            buildProblemStatement(
                 fasta.templateExpectedFunctionBody.withArguments(token),
                 token.charOffset,
                 length: token.length)
@@ -4386,7 +4356,7 @@
       Message message = fasta.messageTypeVariableInStaticContext;
       int length = type.parameter.name.length;
       if (nonInstanceAccessIsError) {
-        addCompileTimeError(message, offset, length);
+        addProblem(message, offset, length, severity: Severity.error);
       } else {
         addProblemErrorIfConst(message, offset, length);
       }
@@ -4428,11 +4398,12 @@
       bool isSuper: false,
       Member interfaceTarget}) {
     if (constantContext != ConstantContext.none && !isConstantExpression) {
-      error = buildCompileTimeError(
-          fasta.templateNotConstantExpression
-              .withArguments('Method invocation'),
-          offset,
-          name.name.length);
+      error = buildProblem(
+              fasta.templateNotConstantExpression
+                  .withArguments('Method invocation'),
+              offset,
+              name.name.length)
+          .desugared;
     }
     if (isSuper) {
       // We can ignore [isNullAware] on super sends.
@@ -4491,29 +4462,26 @@
   }
 
   @override
-  void addCompileTimeError(Message message, int charOffset, int length,
-      {List<LocatedMessage> context}) {
-    library.addCompileTimeError(message, charOffset, length, uri,
-        context: context);
-  }
-
-  @override
   void addProblem(Message message, int charOffset, int length,
-      {List<LocatedMessage> context}) {
-    library.addProblem(message, charOffset, length, uri, context: context);
+      {bool wasHandled: false,
+      List<LocatedMessage> context,
+      Severity severity}) {
+    library.addProblem(message, charOffset, length, uri,
+        wasHandled: wasHandled, context: context, severity: severity);
   }
 
   @override
   void addProblemErrorIfConst(Message message, int charOffset, int length,
-      {List<LocatedMessage> context}) {
+      {bool wasHandled: false, List<LocatedMessage> context}) {
     // TODO(askesc): Instead of deciding on the severity, this method should
     // take two messages: one to use when a constant expression is
     // required and one to use otherwise.
+    Severity severity = message.code.severity;
     if (constantContext != ConstantContext.none) {
-      addCompileTimeError(message, charOffset, length, context: context);
-    } else {
-      library.addProblem(message, charOffset, length, uri, context: context);
+      severity = Severity.error;
     }
+    addProblem(message, charOffset, length,
+        wasHandled: wasHandled, context: context, severity: severity);
   }
 
   @override
@@ -4555,7 +4523,7 @@
       } else {
         nearest = '$asDouble';
       }
-      library.addCompileTimeError(
+      library.addProblem(
           fasta.templateWebLiteralCannotBeRepresentedExactly
               .withArguments(token.lexeme, nearest),
           token.charOffset,
diff --git a/pkg/front_end/lib/src/fasta/kernel/expression_generator.dart b/pkg/front_end/lib/src/fasta/kernel/expression_generator.dart
index d60a3a8..7a06db1 100644
--- a/pkg/front_end/lib/src/fasta/kernel/expression_generator.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/expression_generator.dart
@@ -195,8 +195,8 @@
   Initializer buildFieldInitializer(Map<String, int> initializedFields) {
     int offset = offsetForToken(token);
     return helper.buildInvalidInitializer(
-        new SyntheticExpressionJudgment(helper.buildCompileTimeError(
-            messageInvalidInitializer, offset, lengthForToken(token))),
+        helper.buildProblem(messageInvalidInitializer, offset,
+            lengthForToken(token)) /* TODO(ahe): Add .desugared here? */,
         offset);
   }
 
@@ -215,7 +215,7 @@
     } else {
       if (helper.constantContext != ConstantContext.none &&
           send.name != lengthName) {
-        helper.addCompileTimeError(
+        helper.addProblem(
             messageNotAConstantExpression, offsetForToken(token), token.length);
       }
       return PropertyAccessGenerator.make(helper, send.token, buildSimpleRead(),
@@ -714,10 +714,10 @@
   String get debugName => "LargeIntAccessGenerator";
 
   Expression buildError() {
-    return helper.buildCompileTimeError(
-        templateIntegerLiteralIsOutOfRange.withArguments(token),
-        offsetForToken(token),
-        lengthForToken(token));
+    return helper
+        .buildProblem(templateIntegerLiteralIsOutOfRange.withArguments(token),
+            offsetForToken(token), lengthForToken(token))
+        .desugared /* TODO(ahe): Remove `.desugared`? */;
   }
 
   @override
@@ -963,9 +963,8 @@
 
   @override
   Expression makeInvalidWrite(Expression value) {
-    return helper.buildCompileTimeErrorExpression(
-        messageIllegalAssignmentToNonAssignable, offsetForToken(token),
-        length: token?.length);
+    return helper.buildProblem(messageIllegalAssignmentToNonAssignable,
+        offsetForToken(token), lengthForToken(token));
   }
 }
 
@@ -995,9 +994,8 @@
 
   Expression handleAssignment(bool voidContext) {
     if (helper.constantContext != ConstantContext.none) {
-      return helper.buildCompileTimeErrorExpression(
-          messageNotAConstantExpression, offsetForToken(token),
-          length: token.length);
+      return helper.buildProblem(
+          messageNotAConstantExpression, offsetForToken(token), token.length);
     }
     if (identical("=", assignmentOperator)) {
       return generator.buildAssignment(value, voidContext: voidContext);
@@ -1136,7 +1134,7 @@
   @override
   /* Expression | Generator | Initializer */ doInvocation(
       int offset, Arguments arguments) {
-    var error = helper.wrapInLocatedCompileTimeError(
+    var error = helper.wrapInLocatedProblem(
         helper.evaluateArgumentsBefore(arguments, forest.literalNull(token)),
         messageCantUsePrefixAsExpression.withLocation(
             helper.uri, offsetForToken(token), lengthForToken(token)));
@@ -1159,7 +1157,7 @@
             offsetForToken(token));
       }
       if (isNullAware) {
-        result = helper.wrapInLocatedCompileTimeError(
+        result = helper.wrapInLocatedProblem(
             helper.toValue(result),
             messageCantUsePrefixWithNullAware.withLocation(
                 helper.uri, offsetForToken(token), lengthForToken(token)));
@@ -1172,10 +1170,8 @@
 
   @override
   Expression makeInvalidRead() {
-    return new SyntheticExpressionJudgment(helper.buildCompileTimeError(
-        messageCantUsePrefixAsExpression,
-        offsetForToken(token),
-        lengthForToken(token)));
+    return helper.buildProblem(messageCantUsePrefixAsExpression,
+        offsetForToken(token), lengthForToken(token));
   }
 
   @override
diff --git a/pkg/front_end/lib/src/fasta/kernel/expression_generator_helper.dart b/pkg/front_end/lib/src/fasta/kernel/expression_generator_helper.dart
index d50dd58..339c43d 100644
--- a/pkg/front_end/lib/src/fasta/kernel/expression_generator_helper.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/expression_generator_helper.dart
@@ -12,7 +12,7 @@
 
 import '../messages.dart' show Message;
 
-import '../scope.dart' show ProblemBuilder, Scope;
+import '../scope.dart' show Scope;
 
 import '../type_inference/inference_helper.dart' show InferenceHelper;
 
@@ -31,7 +31,6 @@
         DartType,
         Expression,
         FunctionNode,
-        FunctionType,
         Initializer,
         Member,
         Name,
@@ -72,17 +71,6 @@
 
   finishSend(Object receiver, Arguments arguments, int offset);
 
-  Expression buildCompileTimeError(Message message, int charOffset, int length,
-      {List<LocatedMessage> context});
-
-  Expression buildCompileTimeErrorExpression(Message message, int offset,
-      {int length});
-
-  Expression wrapInCompileTimeError(Expression expression, Message message);
-
-  Expression wrapInProblem(Expression expression, Message message, int length,
-      {List<LocatedMessage> context});
-
   Initializer buildInvalidInitializer(Expression expression, [int offset]);
 
   Initializer buildFieldInitializer(
@@ -100,9 +88,6 @@
   Expression buildStaticInvocation(Procedure target, Arguments arguments,
       {Constness constness, int charOffset, Expression error});
 
-  Expression buildProblemExpression(
-      ProblemBuilder builder, int offset, int length);
-
   Expression throwNoSuchMethodError(
       Expression receiver, String name, Arguments arguments, int offset,
       {Member candidate,
@@ -115,9 +100,6 @@
   LocatedMessage checkArgumentsForFunction(FunctionNode function,
       Arguments arguments, int offset, List<TypeParameter> typeParameters);
 
-  LocatedMessage checkArgumentsForType(
-      FunctionType function, Arguments arguments, int offset);
-
   StaticGet makeStaticGet(Member readTarget, Token token);
 
   Expression wrapInDeferredCheck(
@@ -147,12 +129,6 @@
   DartType validatedTypeVariableUse(
       TypeParameterType type, int offset, bool nonInstanceAccessIsError);
 
-  void addCompileTimeError(Message message, int charOffset, int length,
-      {List<LocatedMessage> context});
-
-  void addProblem(Message message, int charOffset, int length,
-      {List<LocatedMessage> context});
-
   void addProblemErrorIfConst(Message message, int charOffset, int length);
 
   Message warnUnresolvedGet(Name name, int charOffset, {bool isSuper});
@@ -163,8 +139,7 @@
 
   void warnTypeArgumentsMismatch(String name, int expected, int charOffset);
 
-  Expression wrapInLocatedCompileTimeError(
-      Expression expression, LocatedMessage message,
+  Expression wrapInLocatedProblem(Expression expression, LocatedMessage message,
       {List<LocatedMessage> context});
 
   Expression evaluateArgumentsBefore(
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_class_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_class_builder.dart
index 7211505..e277db1 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_class_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_class_builder.dart
@@ -222,7 +222,7 @@
         if (decl is ClassBuilder) {
           ClassBuilder interface = decl;
           if (superClass == interface) {
-            addCompileTimeError(
+            addProblem(
                 templateImplementsSuperClass.withArguments(interface.name),
                 charOffset,
                 noLength);
@@ -235,7 +235,7 @@
             problemsOffsets ??= new Map<ClassBuilder, int>();
             problemsOffsets[interface] ??= charOffset;
           } else if (interface.target == coreTypes.futureOrClass) {
-            addCompileTimeError(messageImplementsFutureOr, charOffset,
+            addProblem(messageImplementsFutureOr, charOffset,
                 interface.target.name.length);
           } else {
             implemented.add(interface);
@@ -245,7 +245,7 @@
     }
     if (problems != null) {
       problems.forEach((ClassBuilder interface, int repetitions) {
-        addCompileTimeError(
+        addProblem(
             templateImplementsRepeated.withArguments(
                 interface.name, repetitions),
             problemsOffsets[interface],
@@ -304,7 +304,7 @@
               var message = templateRedirectionTargetNotFound
                   .withArguments(redirectionTarget.fullNameForErrors);
               if (declaration.isConst) {
-                addCompileTimeError(message, declaration.charOffset, noLength);
+                addProblem(message, declaration.charOffset, noLength);
               } else {
                 addProblem(message, declaration.charOffset, noLength);
               }
@@ -877,13 +877,12 @@
             interfaceType);
         fileOffset = declaredParameter.fileOffset;
       }
-      library.addCompileTimeError(message, fileOffset, noLength, fileUri,
-          context: [
-            templateOverriddenMethodCause
-                .withArguments(interfaceMember.name.name)
-                .withLocation(_getMemberUri(interfaceMember),
-                    interfaceMember.fileOffset, noLength)
-          ]);
+      library.addProblem(message, fileOffset, noLength, fileUri, context: [
+        templateOverriddenMethodCause
+            .withArguments(interfaceMember.name.name)
+            .withLocation(_getMemberUri(interfaceMember),
+                interfaceMember.fileOffset, noLength)
+      ]);
       return true;
     }
     return false;
@@ -1129,7 +1128,7 @@
       int originLength = typeVariables?.length ?? 0;
       int patchLength = patch.typeVariables?.length ?? 0;
       if (originLength != patchLength) {
-        patch.addCompileTimeError(messagePatchClassTypeVariablesMismatch,
+        patch.addProblem(messagePatchClassTypeVariablesMismatch,
             patch.charOffset, noLength, context: [
           messagePatchClassOrigin.withLocation(fileUri, charOffset, noLength)
         ]);
@@ -1140,8 +1139,8 @@
         }
       }
     } else {
-      library.addCompileTimeError(messagePatchDeclarationMismatch,
-          patch.charOffset, noLength, patch.fileUri, context: [
+      library.addProblem(messagePatchDeclarationMismatch, patch.charOffset,
+          noLength, patch.fileUri, context: [
         messagePatchDeclarationOrigin.withLocation(
             fileUri, charOffset, noLength)
       ]);
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_enum_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_enum_builder.dart
index 60288dd..9cdc301 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_enum_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_enum_builder.dart
@@ -167,13 +167,13 @@
       int charOffset = constantNamesAndOffsetsAndDocs[i + 2];
       String documentationComment = constantNamesAndOffsetsAndDocs[i + 3];
       if (members.containsKey(name)) {
-        parent.addCompileTimeError(templateDuplicatedName.withArguments(name),
+        parent.addProblem(templateDuplicatedName.withArguments(name),
             charOffset, noLength, parent.fileUri);
         constantNamesAndOffsetsAndDocs[i + 1] = null;
         continue;
       }
       if (name == className) {
-        parent.addCompileTimeError(
+        parent.addProblem(
             templateEnumConstantSameNameAsEnclosing.withArguments(name),
             charOffset,
             noLength,
@@ -281,7 +281,7 @@
       // unnamed constructor requires no arguments. But that information isn't
       // always available at this point, and it's not really a situation that
       // can happen unless you start modifying the SDK sources.
-      addCompileTimeError(messageNoUnnamedConstructorInObject, -1, noLength);
+      addProblem(messageNoUnnamedConstructorInObject, -1, noLength);
     } else {
       constructor.initializers.add(
           new SuperInitializer(superConstructor.target, new Arguments.empty())
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_expression_generator.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_expression_generator.dart
index 82944ef..9ecc44b 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_expression_generator.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_expression_generator.dart
@@ -656,7 +656,7 @@
   Expression doInvocation(int offset, Arguments arguments) {
     if (helper.constantContext != ConstantContext.none) {
       // TODO(brianwilkerson) Fix the length
-      helper.addCompileTimeError(messageNotAConstantExpression, offset, 1);
+      helper.addProblem(messageNotAConstantExpression, offset, 1);
     }
     if (getter == null || isFieldOrGetter(getter)) {
       return helper.buildMethodInvocation(
@@ -1146,10 +1146,12 @@
     Expression error;
     if (helper.constantContext != ConstantContext.none &&
         !helper.isIdentical(readTarget)) {
-      error = helper.buildCompileTimeError(
-          templateNotConstantExpression.withArguments('Method invocation'),
-          offset,
-          readTarget?.name?.name?.length ?? 0);
+      error = helper
+          .buildProblem(
+              templateNotConstantExpression.withArguments('Method invocation'),
+              offset,
+              readTarget?.name?.name?.length ?? 0)
+          .desugared /* TODO(ahe): Remove `.desugared`? */;
     }
     if (readTarget == null || isFieldOrGetter(readTarget)) {
       return helper.buildMethodInvocation(buildSimpleRead(), callName,
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_expression_generator_impl.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_expression_generator_impl.dart
index 5905d5d..e39f5d42 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_expression_generator_impl.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_expression_generator_impl.dart
@@ -36,22 +36,20 @@
   Expression buildSimpleRead() {
     if (!isSuper) {
       if (inFieldInitializer) {
-        return new SyntheticExpressionJudgment(
-            buildFieldInitializerError(null));
+        return buildFieldInitializerError(null);
       } else {
         return forest.thisExpression(token);
       }
     } else {
-      return new SyntheticExpressionJudgment(helper.buildCompileTimeError(
-          messageSuperAsExpression,
-          offsetForToken(token),
-          lengthForToken(token)));
+      return helper.buildProblem(messageSuperAsExpression,
+          offsetForToken(token), lengthForToken(token));
     }
   }
 
-  Expression buildFieldInitializerError(Map<String, int> initializedFields) {
+  SyntheticExpressionJudgment buildFieldInitializerError(
+      Map<String, int> initializedFields) {
     String keyword = isSuper ? "super" : "this";
-    return helper.buildCompileTimeError(
+    return helper.buildProblem(
         templateThisOrSuperAccessInFieldInitializer.withArguments(keyword),
         offsetForToken(token),
         keyword.length);
@@ -59,7 +57,7 @@
 
   @override
   Initializer buildFieldInitializer(Map<String, int> initializedFields) {
-    Expression error = buildFieldInitializerError(initializedFields);
+    Expression error = buildFieldInitializerError(initializedFields).desugared;
     return helper.buildInvalidInitializer(error, error.fileOffset);
   }
 
@@ -70,13 +68,13 @@
     int offset = offsetForToken(send.token);
     if (isInitializer && send is SendAccessGenerator) {
       if (isNullAware) {
-        helper.addCompileTimeError(
+        helper.addProblem(
             messageInvalidUseOfNullAwareAccess, operatorOffset, 2);
       }
       return buildConstructorInitializer(offset, name, arguments);
     }
     if (inFieldInitializer && !isInitializer) {
-      return new SyntheticExpressionJudgment(buildFieldInitializerError(null));
+      return buildFieldInitializerError(null);
     }
     Member getter = helper.lookupInstanceMember(name, isSuper: isSuper);
     if (send is SendAccessGenerator) {
@@ -106,8 +104,7 @@
     if (isInitializer) {
       return buildConstructorInitializer(offset, new Name(""), arguments);
     } else if (isSuper) {
-      return new SyntheticExpressionJudgment(helper.buildCompileTimeError(
-          messageSuperAsExpression, offset, noLength));
+      return helper.buildProblem(messageSuperAsExpression, offset, noLength);
     } else {
       return helper.buildMethodInvocation(
           forest.thisExpression(null), callName, arguments, offset,
@@ -174,10 +171,10 @@
   }
 
   Expression buildAssignmentError() {
-    return helper.buildCompileTimeError(
-        isSuper ? messageCannotAssignToSuper : messageNotAnLvalue,
-        offsetForToken(token),
-        token.length);
+    return helper
+        .buildProblem(isSuper ? messageCannotAssignToSuper : messageNotAnLvalue,
+            offsetForToken(token), token.length)
+        .desugared;
   }
 
   @override
@@ -226,7 +223,7 @@
       offset = offsetForToken(token);
       length = lengthForToken(token);
     }
-    return helper.buildCompileTimeError(message, offset, length);
+    return helper.buildProblem(message, offset, length).desugared;
   }
 
   @override
@@ -395,10 +392,11 @@
   }
 
   Expression makeInvalidWrite(Expression value) {
-    var error = helper.buildCompileTimeError(
-        messageCannotAssignToParenthesizedExpression,
-        offsetForToken(token),
-        lengthForToken(token));
-    return new InvalidWriteJudgment(error, expression);
+    return new InvalidWriteJudgment(
+        helper
+            .buildProblem(messageCannotAssignToParenthesizedExpression,
+                offsetForToken(token), lengthForToken(token))
+            .desugared,
+        expression);
   }
 }
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_function_type_alias_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_function_type_alias_builder.dart
index fedd216..b36a54e 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_function_type_alias_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_function_type_alias_builder.dart
@@ -86,7 +86,7 @@
   DartType buildThisType(LibraryBuilder library) {
     if (thisType != null) {
       if (const InvalidType() == thisType) {
-        library.addCompileTimeError(templateCyclicTypedef.withArguments(name),
+        library.addProblem(templateCyclicTypedef.withArguments(name),
             charOffset, noLength, fileUri);
         return const DynamicType();
       }
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_function_type_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_function_type_builder.dart
index 2dbf686..edb9fcc 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_function_type_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_function_type_builder.dart
@@ -72,7 +72,7 @@
 
   Supertype buildSupertype(
       LibraryBuilder library, int charOffset, Uri fileUri) {
-    library.addCompileTimeError(
+    library.addProblem(
         messageSupertypeIsFunction, charOffset, noLength, fileUri);
     return null;
   }
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
index 88a029a..0ae7b46 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
@@ -249,10 +249,8 @@
       if (typeVariablesByName != null) {
         TypeVariableBuilder tv = typeVariablesByName[name];
         if (tv != null) {
-          cls.addCompileTimeError(
-              templateConflictsWithTypeVariable.withArguments(name),
-              member.charOffset,
-              name.length,
+          cls.addProblem(templateConflictsWithTypeVariable.withArguments(name),
+              member.charOffset, name.length,
               context: [
                 messageConflictsWithTypeVariableCause.withLocation(
                     tv.fileUri, tv.charOffset, name.length)
@@ -276,7 +274,7 @@
     for (TypeVariableBuilder tv in typeVariables) {
       TypeVariableBuilder existing = typeVariablesByName[tv.name];
       if (existing != null) {
-        addCompileTimeError(messageTypeVariableDuplicatedName, tv.charOffset,
+        addProblem(messageTypeVariableDuplicatedName, tv.charOffset,
             tv.name.length, fileUri,
             context: [
               templateTypeVariableDuplicatedNameCause
@@ -290,8 +288,8 @@
           // Only classes and type variables can't have the same name. See
           // [#29555](https://github.com/dart-lang/sdk/issues/29555).
           if (tv.name == owner.name) {
-            addCompileTimeError(messageTypeVariableSameNameAsEnclosing,
-                tv.charOffset, tv.name.length, fileUri);
+            addProblem(messageTypeVariableSameNameAsEnclosing, tv.charOffset,
+                tv.name.length, fileUri);
           }
         }
       }
@@ -1284,7 +1282,7 @@
 
   void exportMemberFromPatch(String name, Declaration member) {
     if (uri.scheme != "dart" || !uri.path.startsWith("_")) {
-      addCompileTimeError(templatePatchInjectionFailed.withArguments(name, uri),
+      addProblem(templatePatchInjectionFailed.withArguments(name, uri),
           member.charOffset, noLength, member.fileUri);
     }
     // Platform-private libraries, such as "dart:_internal" have special
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_named_type_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_named_type_builder.dart
index 4c3e69c..b10ffcf 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_named_type_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_named_type_builder.dart
@@ -11,6 +11,8 @@
 import '../messages.dart'
     show noLength, templateSupertypeIsIllegal, templateSupertypeIsTypeVariable;
 
+import '../severity.dart' show Severity;
+
 import 'kernel_builder.dart'
     show
         KernelClassBuilder,
@@ -40,8 +42,9 @@
     var template = declaration.isTypeVariable
         ? templateSupertypeIsTypeVariable
         : templateSupertypeIsIllegal;
-    library.addCompileTimeError(
-        template.withArguments("$name"), charOffset, noLength, fileUri);
+    library.addProblem(
+        template.withArguments("$name"), charOffset, noLength, fileUri,
+        severity: Severity.error);
     return null;
   }
 
@@ -55,11 +58,12 @@
     if (declaration is KernelClassBuilder) {
       return declaration.buildSupertype(library, arguments);
     } else if (declaration is KernelInvalidTypeBuilder) {
-      library.addCompileTimeError(
+      library.addProblem(
           declaration.message.messageObject,
           declaration.message.charOffset,
           declaration.message.length,
-          declaration.message.uri);
+          declaration.message.uri,
+          severity: Severity.error);
       return null;
     } else {
       return handleInvalidSupertype(library, charOffset, fileUri);
@@ -72,11 +76,12 @@
     if (declaration is KernelClassBuilder) {
       return declaration.buildMixedInType(library, arguments);
     } else if (declaration is KernelInvalidTypeBuilder) {
-      library.addCompileTimeError(
+      library.addProblem(
           declaration.message.messageObject,
           declaration.message.charOffset,
           declaration.message.length,
-          declaration.message.uri);
+          declaration.message.uri,
+          severity: Severity.error);
       return null;
     } else {
       return handleInvalidSupertype(library, charOffset, fileUri);
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart
index c9fd115..c65c7b8 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart
@@ -233,7 +233,7 @@
 
   bool checkPatch(KernelFunctionBuilder patch) {
     if (!isExternal) {
-      patch.library.addCompileTimeError(
+      patch.library.addProblem(
           messagePatchNonExternal, patch.charOffset, noLength, patch.fileUri,
           context: [
             messagePatchDeclarationOrigin.withLocation(
@@ -245,8 +245,8 @@
   }
 
   void reportPatchMismatch(Declaration patch) {
-    library.addCompileTimeError(messagePatchDeclarationMismatch,
-        patch.charOffset, noLength, patch.fileUri, context: [
+    library.addProblem(messagePatchDeclarationMismatch, patch.charOffset,
+        noLength, patch.fileUri, context: [
       messagePatchDeclarationOrigin.withLocation(fileUri, charOffset, noLength)
     ]);
   }
@@ -494,7 +494,7 @@
     assert(lastInitializer == superInitializer ||
         lastInitializer == redirectingInitializer);
     Initializer error = helper.buildInvalidInitializer(
-        helper.buildCompileTimeError(message, charOffset, noLength),
+        helper.buildProblem(message, charOffset, noLength).desugared,
         charOffset);
     initializers.add(error..parent = constructor);
     initializers.add(lastInitializer);
@@ -518,8 +518,10 @@
       } else if (constructor.initializers.isNotEmpty) {
         Initializer first = constructor.initializers.first;
         Initializer error = helper.buildInvalidInitializer(
-            helper.buildCompileTimeError(
-                messageThisInitializerNotAlone, first.fileOffset, noLength),
+            helper
+                .buildProblem(
+                    messageThisInitializerNotAlone, first.fileOffset, noLength)
+                .desugared,
             first.fileOffset);
         initializers.add(error..parent = constructor);
       } else {
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
index 35f6e2a..86122bb 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
@@ -657,10 +657,8 @@
       for (Initializer initializer in constructor.initializers) {
         if (initializer is RedirectingInitializer) {
           if (constructor.isConst && !initializer.target.isConst) {
-            builder.addCompileTimeError(
-                messageConstConstructorRedirectionToNonConst,
-                initializer.fileOffset,
-                initializer.target.name.name.length);
+            builder.addProblem(messageConstConstructorRedirectionToNonConst,
+                initializer.fileOffset, initializer.target.name.name.length);
           }
           isRedirecting = true;
           break;
@@ -674,7 +672,7 @@
           superTarget ??= defaultSuperConstructor(cls);
           Initializer initializer;
           if (superTarget == null) {
-            builder.addCompileTimeError(
+            builder.addProblem(
                 templateSuperclassHasNoDefaultConstructor
                     .withArguments(cls.superclass.name),
                 constructor.fileOffset,
@@ -714,7 +712,7 @@
         }
         constructorInitializedFields[constructor] = myInitializedFields;
         if (constructor.isConst && nonFinalFields.isNotEmpty) {
-          builder.addCompileTimeError(messageConstConstructorNonFinalField,
+          builder.addProblem(messageConstConstructorNonFinalField,
               constructor.fileOffset, noLength,
               context: nonFinalFields
                   .map((field) => messageConstConstructorNonFinalFieldCause
diff --git a/pkg/front_end/lib/src/fasta/loader.dart b/pkg/front_end/lib/src/fasta/loader.dart
index 9c6044c..f1f9d5c 100644
--- a/pkg/front_end/lib/src/fasta/loader.dart
+++ b/pkg/front_end/lib/src/fasta/loader.dart
@@ -21,7 +21,6 @@
         Template,
         messagePlatformPrivateLibraryAccess,
         templateInternalProblemContextSeverity,
-        templateInternalProblemMissingSeverity,
         templateSourceBodySummary;
 
 import 'problems.dart' show internalProblem;
@@ -143,8 +142,8 @@
         !accessor.isPatch &&
         !target.backendTarget
             .allowPlatformPrivateLibraryAccess(accessor.uri, uri)) {
-      accessor.addCompileTimeError(messagePlatformPrivateLibraryAccess,
-          charOffset, noLength, accessor.fileUri);
+      accessor.addProblem(messagePlatformPrivateLibraryAccess, charOffset,
+          noLength, accessor.fileUri);
     }
     return builder;
   }
@@ -197,37 +196,19 @@
   /// Builds all the method bodies found in the given [library].
   Future<Null> buildBody(covariant LibraryBuilder library);
 
-  /// Register [message] as a compile-time error.
-  ///
-  /// If [wasHandled] is true, this error is added to [handledErrors],
-  /// otherwise it is added to [unhandledErrors].
-  void addCompileTimeError(
-      Message message, int charOffset, int length, Uri fileUri,
-      {bool wasHandled: false, List<LocatedMessage> context}) {
-    addMessage(message, charOffset, length, fileUri, Severity.error,
-        wasHandled: wasHandled, context: context);
-  }
-
   /// Register [message] as a problem with a severity determined by the
   /// intrinsic severity of the message.
   void addProblem(Message message, int charOffset, int length, Uri fileUri,
-      {List<LocatedMessage> context}) {
-    Severity severity = message.code.severity;
-    if (severity == null) {
-      addMessage(message, charOffset, length, fileUri, Severity.error,
-          context: context);
-      internalProblem(
-          templateInternalProblemMissingSeverity
-              .withArguments(message.code.name),
-          charOffset,
-          fileUri);
-    }
+      {bool wasHandled: false,
+      List<LocatedMessage> context,
+      Severity severity}) {
+    severity ??= message.code.severity;
     if (severity == Severity.errorLegacyWarning) {
       severity =
           target.backendTarget.strongMode ? Severity.error : Severity.warning;
     }
     addMessage(message, charOffset, length, fileUri, severity,
-        context: context);
+        wasHandled: wasHandled, context: context);
   }
 
   /// All messages reported by the compiler (errors, warnings, etc.) are routed
@@ -236,6 +217,10 @@
   /// Returns true if the message is new, that is, not previously
   /// reported. This is important as some parser errors may be reported up to
   /// three times by `OutlineBuilder`, `DietListener`, and `BodyBuilder`.
+  ///
+  /// If [severity] is `Severity.error`, the message is added to
+  /// [handledErrors] if [wasHandled] is true or to [unhandledErrors] if
+  /// [wasHandled] is false.
   bool addMessage(Message message, int charOffset, int length, Uri fileUri,
       Severity severity,
       {bool wasHandled: false, List<LocatedMessage> context}) {
diff --git a/pkg/front_end/lib/src/fasta/source/diet_listener.dart b/pkg/front_end/lib/src/fasta/source/diet_listener.dart
index 1a218f2..1d0fa47 100644
--- a/pkg/front_end/lib/src/fasta/source/diet_listener.dart
+++ b/pkg/front_end/lib/src/fasta/source/diet_listener.dart
@@ -32,7 +32,11 @@
     show deprecated_InputError, deprecated_inputError;
 
 import '../fasta_codes.dart'
-    show Message, messageExpectedBlockToSkip, templateInternalProblemNotFound;
+    show
+        LocatedMessage,
+        Message,
+        messageExpectedBlockToSkip,
+        templateInternalProblemNotFound;
 
 import '../kernel/kernel_body_builder.dart' show KernelBodyBuilder;
 
@@ -843,12 +847,10 @@
   }
 
   @override
-  void addCompileTimeError(Message message, int charOffset, int length) {
-    library.addCompileTimeError(message, charOffset, length, uri);
-  }
-
-  void addProblem(Message message, int charOffset, int length) {
-    library.addProblem(message, charOffset, length, uri);
+  void addProblem(Message message, int charOffset, int length,
+      {bool wasHandled: false, List<LocatedMessage> context}) {
+    library.addProblem(message, charOffset, length, uri,
+        wasHandled: wasHandled, context: context);
   }
 
   @override
diff --git a/pkg/front_end/lib/src/fasta/source/outline_builder.dart b/pkg/front_end/lib/src/fasta/source/outline_builder.dart
index be91582..de663b7 100644
--- a/pkg/front_end/lib/src/fasta/source/outline_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/outline_builder.dart
@@ -336,7 +336,7 @@
       push(charOffset);
       // Point to dollar sign
       int interpolationOffset = charOffset + beginToken.lexeme.length;
-      addCompileTimeError(messageInterpolationInUri, interpolationOffset, 1);
+      addProblem(messageInterpolationInUri, interpolationOffset, 1);
     }
   }
 
@@ -669,14 +669,13 @@
                 charOffset, uri);
         }
         String string = name;
-        addCompileTimeError(
-            template.withArguments(name), charOffset, string.length);
+        addProblem(template.withArguments(name), charOffset, string.length);
       } else {
         if (formals != null) {
           for (FormalParameterBuilder formal in formals) {
             if (!formal.isRequired) {
-              addCompileTimeError(messageOperatorWithOptionalFormals,
-                  formal.charOffset, formal.name.length);
+              addProblem(messageOperatorWithOptionalFormals, formal.charOffset,
+                  formal.name.length);
             }
           }
         }
@@ -711,8 +710,7 @@
             : library.computeAndValidateConstructorName(name, charOffset);
     if (constructorName != null) {
       if (isConst && bodyKind != MethodBody.Abstract) {
-        addCompileTimeError(
-            messageConstConstructorWithBody, varFinalOrConstOffset, 5);
+        addProblem(messageConstConstructorWithBody, varFinalOrConstOffset, 5);
         modifiers &= ~constMask;
       }
       if (returnType != null) {
@@ -739,7 +737,7 @@
           nativeMethodName);
     } else {
       if (isConst) {
-        addCompileTimeError(messageConstMethod, varFinalOrConstOffset, 5);
+        addProblem(messageConstMethod, varFinalOrConstOffset, 5);
         modifiers &= ~constMask;
       }
       final int startCharOffset =
@@ -928,7 +926,7 @@
       if (formals.length == 2) {
         // The name may be null for generalized function types.
         if (formals[0].name != null && formals[0].name == formals[1].name) {
-          addCompileTimeError(
+          addProblem(
               templateDuplicatedParameterName.withArguments(formals[1].name),
               formals[1].charOffset,
               formals[1].name.length,
@@ -945,7 +943,7 @@
         for (FormalParameterBuilder formal in formals) {
           if (formal.name == null) continue;
           if (seenNames.containsKey(formal.name)) {
-            addCompileTimeError(
+            addProblem(
                 templateDuplicatedParameterName.withArguments(formal.name),
                 formal.charOffset,
                 formal.name.length,
@@ -1065,8 +1063,7 @@
         functionType = type;
       } else {
         // TODO(ahe): Improve this error message.
-        addCompileTimeError(
-            messageTypedefNotFunction, equals.charOffset, equals.length);
+        addProblem(messageTypedefNotFunction, equals.charOffset, equals.length);
       }
     }
     List<MetadataBuilder> metadata = pop();
@@ -1105,7 +1102,7 @@
     if (staticToken == null && modifiers & constMask != 0) {
       // It is a compile-time error if an instance variable is declared to be
       // constant.
-      addCompileTimeError(messageConstInstanceField, varFinalOrConst.charOffset,
+      addProblem(messageConstInstanceField, varFinalOrConst.charOffset,
           varFinalOrConst.length);
       modifiers &= ~constMask;
     }
@@ -1186,7 +1183,7 @@
             bound = typeVariablesByName[bound.bound.name];
           }
           String involvedString = via.join("', '");
-          addCompileTimeError(
+          addProblem(
               templateCycleInTypeVariables.withArguments(
                   builder.name, involvedString),
               builder.charOffset,
@@ -1343,16 +1340,10 @@
     debugEvent("AsyncModifier");
   }
 
-  @override
-  void addCompileTimeError(Message message, int charOffset, int length,
-      {List<LocatedMessage> context}) {
-    library.addCompileTimeError(message, charOffset, length, uri,
-        context: context);
-  }
-
   void addProblem(Message message, int charOffset, int length,
-      {List<LocatedMessage> context}) {
-    library.addProblem(message, charOffset, length, uri, context: context);
+      {bool wasHandled: false, List<LocatedMessage> context}) {
+    library.addProblem(message, charOffset, length, uri,
+        wasHandled: wasHandled, context: context);
   }
 
   /// Return the documentation comment for the entity that starts at the
diff --git a/pkg/front_end/lib/src/fasta/source/source_class_builder.dart b/pkg/front_end/lib/src/fasta/source/source_class_builder.dart
index 6135e72..8df5e4a 100644
--- a/pkg/front_end/lib/src/fasta/source/source_class_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_class_builder.dart
@@ -161,15 +161,15 @@
       if (!member.isStatic) return;
       // TODO(ahe): Revisit these messages. It seems like the last two should
       // be `context` parameter to this message.
-      addCompileTimeError(templateConflictsWithMember.withArguments(name),
+      addProblem(templateConflictsWithMember.withArguments(name),
           constructor.charOffset, noLength);
       if (constructor.isFactory) {
-        addCompileTimeError(
+        addProblem(
             templateConflictsWithFactory.withArguments("${this.name}.${name}"),
             member.charOffset,
             noLength);
       } else {
-        addCompileTimeError(
+        addProblem(
             templateConflictsWithConstructor
                 .withArguments("${this.name}.${name}"),
             member.charOffset,
diff --git a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
index 407394b..37b6584 100644
--- a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
@@ -171,7 +171,7 @@
 
   Uri resolve(Uri baseUri, String uri, int uriOffset, {isPart: false}) {
     if (uri == null) {
-      addCompileTimeError(messageExpectedUri, uriOffset, noLength, this.uri);
+      addProblem(messageExpectedUri, uriOffset, noLength, this.uri);
       return new Uri(scheme: MALFORMED_URI_SCHEME);
     }
     Uri parsedUri;
@@ -181,11 +181,8 @@
       // Point to position in string indicated by the exception,
       // or to the initial quote if no position is given.
       // (Assumes the directive is using a single-line string.)
-      addCompileTimeError(
-          templateCouldNotParseUri.withArguments(uri, e.message),
-          uriOffset + 1 + (e.offset ?? -1),
-          1,
-          this.uri);
+      addProblem(templateCouldNotParseUri.withArguments(uri, e.message),
+          uriOffset + 1 + (e.offset ?? -1), 1, this.uri);
       return new Uri(
           scheme: MALFORMED_URI_SCHEME, query: Uri.encodeQueryComponent(uri));
     }
@@ -476,7 +473,7 @@
     bool isConstructor = declaration is ProcedureBuilder &&
         (declaration.isConstructor || declaration.isFactory);
     if (!isConstructor && name == currentDeclaration.name) {
-      addCompileTimeError(
+      addProblem(
           messageMemberWithSameNameAsClass, charOffset, noLength, fileUri);
     }
     Map<String, Declaration> members = isConstructor
@@ -498,11 +495,8 @@
         other = declaration;
       }
       if (deferred != null) {
-        addCompileTimeError(
-            templateDeferredPrefixDuplicated.withArguments(name),
-            deferred.charOffset,
-            noLength,
-            fileUri,
+        addProblem(templateDeferredPrefixDuplicated.withArguments(name),
+            deferred.charOffset, noLength, fileUri,
             context: [
               templateDeferredPrefixDuplicatedCause
                   .withArguments(name)
@@ -516,8 +510,8 @@
               name, existing, member, charOffset);
         });
     } else if (isDuplicatedDefinition(existing, declaration)) {
-      addCompileTimeError(templateDuplicatedDefinition.withArguments(name),
-          charOffset, noLength, fileUri);
+      addProblem(templateDuplicatedDefinition.withArguments(name), charOffset,
+          noLength, fileUri);
     }
     return members[name] = declaration;
   }
@@ -564,10 +558,10 @@
     scope.setters.forEach((String name, Declaration setter) {
       Declaration member = scopeBuilder[name];
       if (member == null || !member.isField || member.isFinal) return;
-      addCompileTimeError(templateConflictsWithMember.withArguments(name),
+      addProblem(templateConflictsWithMember.withArguments(name),
           setter.charOffset, noLength, fileUri);
       // TODO(ahe): Context to previous message?
-      addCompileTimeError(templateConflictsWithSetter.withArguments(name),
+      addProblem(templateConflictsWithSetter.withArguments(name),
           member.charOffset, noLength, fileUri);
     });
 
@@ -600,7 +594,7 @@
     Set<Uri> seenParts = new Set<Uri>();
     for (SourceLibraryBuilder<T, R> part in parts) {
       if (part == this) {
-        addCompileTimeError(messagePartOfSelf, -1, noLength, fileUri);
+        addProblem(messagePartOfSelf, -1, noLength, fileUri);
       } else if (seenParts.add(part.fileUri)) {
         if (part.partOfLibrary != null) {
           addProblem(messagePartOfTwoLibraries, -1, noLength, part.fileUri,
@@ -614,8 +608,8 @@
           includePart(part);
         }
       } else {
-        addCompileTimeError(templatePartTwice.withArguments(part.fileUri), -1,
-            noLength, fileUri);
+        addProblem(templatePartTwice.withArguments(part.fileUri), -1, noLength,
+            fileUri);
       }
     }
   }
@@ -656,8 +650,8 @@
       // metadata annotations can be associated with it.
       assert(!part.isPart);
       if (uriIsValid(part.fileUri)) {
-        addCompileTimeError(templateMissingPartOf.withArguments(part.fileUri),
-            -1, noLength, fileUri);
+        addProblem(templateMissingPartOf.withArguments(part.fileUri), -1,
+            noLength, fileUri);
       }
     }
     part.forEach((String name, Declaration declaration) {
diff --git a/pkg/front_end/lib/src/fasta/source/source_loader.dart b/pkg/front_end/lib/src/fasta/source/source_loader.dart
index a354e63..9f48ebd 100644
--- a/pkg/front_end/lib/src/fasta/source/source_loader.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_loader.dart
@@ -178,8 +178,8 @@
     while (token is ErrorToken) {
       if (!suppressLexicalErrors) {
         ErrorToken error = token;
-        library.addCompileTimeError(error.assertionMessage,
-            offsetForToken(token), lengthForToken(token), uri);
+        library.addProblem(error.assertionMessage, offsetForToken(token),
+            lengthForToken(token), uri);
       }
       token = token.next;
     }
@@ -542,7 +542,7 @@
       // [cyclicCandidates] is sensitive to if the platform (or other modules)
       // are included in [classes].
       for (LocatedMessage message in messages.keys.toList()..sort()) {
-        messages[message].addCompileTimeError(
+        messages[message].addProblem(
             message.messageObject, message.charOffset, message.length);
       }
     }
@@ -561,13 +561,11 @@
       target.addDirectSupertype(cls, directSupertypes);
       for (ClassBuilder supertype in directSupertypes) {
         if (supertype is EnumBuilder) {
-          cls.addCompileTimeError(
-              templateExtendingEnum.withArguments(supertype.name),
-              cls.charOffset,
-              noLength);
+          cls.addProblem(templateExtendingEnum.withArguments(supertype.name),
+              cls.charOffset, noLength);
         } else if (!cls.library.mayImplementRestrictedTypes &&
             blackListedClasses.contains(supertype)) {
-          cls.addCompileTimeError(
+          cls.addProblem(
               templateExtendingRestricted.withArguments(supertype.name),
               cls.charOffset,
               noLength);
@@ -583,7 +581,7 @@
             for (Declaration constructory
                 in builder.constructors.local.values) {
               if (constructory.isConstructor && !constructory.isSynthetic) {
-                cls.addCompileTimeError(
+                cls.addProblem(
                     templateIllegalMixinDueToConstructors
                         .withArguments(builder.fullNameForErrors),
                     cls.charOffset,
@@ -599,7 +597,7 @@
           }
         }
         if (!isClassBuilder) {
-          cls.addCompileTimeError(
+          cls.addProblem(
               templateIllegalMixin.withArguments(mixedInType.fullNameForErrors),
               cls.charOffset,
               noLength);
@@ -877,8 +875,7 @@
     return target.backendTarget.throwCompileConstantError(coreTypes, error);
   }
 
-  Expression buildCompileTimeError(
-      Message message, int offset, int length, Uri uri) {
+  Expression buildProblem(Message message, int offset, int length, Uri uri) {
     String text = target.context
         .format(message.withLocation(uri, offset, length), Severity.error);
     return target.backendTarget.buildCompileTimeError(coreTypes, text, offset);
diff --git a/pkg/front_end/lib/src/fasta/source/stack_listener.dart b/pkg/front_end/lib/src/fasta/source/stack_listener.dart
index c0a7db0..bc7beda 100644
--- a/pkg/front_end/lib/src/fasta/source/stack_listener.dart
+++ b/pkg/front_end/lib/src/fasta/source/stack_listener.dart
@@ -9,6 +9,7 @@
 
 import '../fasta_codes.dart'
     show
+        LocatedMessage,
         Message,
         messageNativeClauseShouldBeAnnotation,
         templateInternalProblemStackNotEmpty;
@@ -343,17 +344,18 @@
       return;
     }
     debugEvent("Error: ${message.message}");
-    addCompileTimeError(message, offsetForToken(startToken),
+    addProblem(message, offsetForToken(startToken),
         lengthOfSpan(startToken, endToken));
   }
 
   @override
   void handleUnescapeError(
       Message message, Token token, int stringOffset, int length) {
-    addCompileTimeError(message, token.charOffset + stringOffset, length);
+    addProblem(message, token.charOffset + stringOffset, length);
   }
 
-  void addCompileTimeError(Message message, int charOffset, int length);
+  void addProblem(Message message, int charOffset, int length,
+      {bool wasHandled: false, List<LocatedMessage> context});
 }
 
 class Stack {
diff --git a/pkg/front_end/lib/src/fasta/type_inference/inference_helper.dart b/pkg/front_end/lib/src/fasta/type_inference/inference_helper.dart
index e6d1901..22aa02d 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/inference_helper.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/inference_helper.dart
@@ -6,17 +6,18 @@
 
 import '../fasta_codes.dart' show LocatedMessage, Message;
 
-abstract class InferenceHelper {
-  Expression wrapInCompileTimeError(Expression expression, Message message);
+import '../kernel/kernel_shadow_ast.dart' show SyntheticExpressionJudgment;
 
-  Expression buildCompileTimeError(Message message, int charOffset, int length,
+abstract class InferenceHelper {
+  SyntheticExpressionJudgment buildProblem(
+      Message message, int charOffset, int length,
       {List<LocatedMessage> context});
 
   LocatedMessage checkArgumentsForType(
       FunctionType function, Arguments arguments, int offset);
 
   void addProblem(Message message, int charOffset, int length,
-      {List<LocatedMessage> context});
+      {List<LocatedMessage> context, bool wasHandled});
 
   Expression wrapInProblem(Expression expression, Message message, int length,
       {List<LocatedMessage> context});
diff --git a/pkg/front_end/lib/src/fasta/type_inference/interface_resolver.dart b/pkg/front_end/lib/src/fasta/type_inference/interface_resolver.dart
index 02395c0..362a67a 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/interface_resolver.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/interface_resolver.dart
@@ -129,7 +129,7 @@
     var kind = declaredMethod.kind;
     var overriddenTypes = _computeAccessorOverriddenTypes();
     if (isCircular) {
-      _library.addCompileTimeError(
+      _library.addProblem(
           templateCantInferTypeDueToCircularity.withArguments(_name),
           _offset,
           noLength,
@@ -704,7 +704,7 @@
         first = type;
       } else if (first != type) {
         // Types don't match.  Report an error.
-        library.addCompileTimeError(
+        library.addProblem(
             templateCantInferTypeDueToInconsistentOverrides.withArguments(name),
             charOffset,
             noLength,
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_inference_engine.dart b/pkg/front_end/lib/src/fasta/type_inference/type_inference_engine.dart
index 6e3610c..48d0b20 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_inference_engine.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_inference_engine.dart
@@ -59,7 +59,7 @@
             .inferDeclarationType(typeInferrer.inferFieldTopLevel(field, true));
         if (isCircular) {
           // Report the appropriate error.
-          _library.addCompileTimeError(
+          _library.addProblem(
               templateCantInferTypeDueToCircularity
                   .withArguments(field.name.name),
               field.fileOffset,
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
index f0a84d7..1d24bbd 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
@@ -105,7 +105,6 @@
         ShadowClass,
         ShadowField,
         ShadowMember,
-        SyntheticExpressionJudgment,
         VariableDeclarationJudgment,
         getExplicitTypeArguments;
 
@@ -741,10 +740,11 @@
     if (!typeSchemaEnvironment.isSubtypeOf(expectedType, actualType)) {
       // Error: not assignable.  Perform error recovery.
       var parent = expression.parent;
-      var errorNode = helper.wrapInCompileTimeError(
+      var errorNode = helper.wrapInProblem(
           expression,
           (template ?? templateInvalidAssignment)
-              .withArguments(actualType, expectedType));
+              .withArguments(actualType, expectedType),
+          noLength);
       parent?.replaceChild(expression, errorNode);
       return errorNode;
     } else {
@@ -753,8 +753,8 @@
         // The type of the expression is known precisely, so an implicit
         // downcast is guaranteed to fail.  Insert a compile-time error.
         var parent = expression.parent;
-        var errorNode = helper.wrapInCompileTimeError(
-            expression, template.withArguments(actualType, expectedType));
+        var errorNode = helper.wrapInProblem(expression,
+            template.withArguments(actualType, expectedType), noLength);
         parent?.replaceChild(expression, errorNode);
         return errorNode;
       } else {
@@ -825,10 +825,10 @@
           new Let(
               new VariableDeclaration.forValue(receiver)
                 ..fileOffset = receiver.fileOffset,
-              new SyntheticExpressionJudgment(helper.buildCompileTimeError(
+              helper.buildProblem(
                   errorTemplate.withArguments(name.name, receiverType),
                   fileOffset,
-                  noLength)))
+                  noLength))
             ..fileOffset = fileOffset);
     }
     return interfaceMember;
@@ -1334,10 +1334,10 @@
     if (named.length == 2) {
       if (named[0].name == named[1].name) {
         var name = named[1].name;
-        var error = helper.buildCompileTimeError(
-            templateDuplicatedNamedArgument.withArguments(name),
-            named[1].fileOffset,
-            name.length);
+        var error = helper
+            .buildProblem(templateDuplicatedNamedArgument.withArguments(name),
+                named[1].fileOffset, name.length)
+            .desugared;
         arguments.named = [new kernel.NamedExpression(named[1].name, error)];
         formalTypes.removeLast();
         actualTypes.removeLast();
@@ -1352,10 +1352,10 @@
         if (seenNames.containsKey(name)) {
           hasProblem = true;
           var prevNamedExpression = seenNames[name];
-          prevNamedExpression.value = helper.buildCompileTimeError(
-              templateDuplicatedNamedArgument.withArguments(name),
-              expression.fileOffset,
-              name.length)
+          prevNamedExpression.value = helper
+              .buildProblem(templateDuplicatedNamedArgument.withArguments(name),
+                  expression.fileOffset, name.length)
+              .desugared
             ..parent = prevNamedExpression;
           formalTypes.removeAt(namedTypeIndex);
           actualTypes.removeAt(namedTypeIndex);
@@ -1671,8 +1671,10 @@
           receiverType is! DynamicType &&
           receiverType != typeSchemaEnvironment.rawFunctionType) {
         var parent = expression.parent;
-        var errorNode = helper.wrapInCompileTimeError(expression,
-            templateImplicitCallOfNonMethod.withArguments(receiverType));
+        var errorNode = helper.wrapInProblem(
+            expression,
+            templateImplicitCallOfNonMethod.withArguments(receiverType),
+            noLength);
         parent?.replaceChild(expression, errorNode);
       }
       listener.methodInvocation(
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index 1f03eb8..dc20f85 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -126,7 +126,6 @@
 
 NotAConstantExpression:
   template: "Not a constant expression."
-  severity: ERROR
   analyzerCode: NOT_CONSTANT_EXPRESSION
 
 NonAsciiIdentifier:
@@ -307,7 +306,6 @@
 
 ImplementsFutureOr:
   template: "'FutureOr' can't be used in an 'implements' clause."
-  severity: ERROR
   script:
     - >-
       import 'dart:async';
@@ -342,7 +340,6 @@
 
 ExpectedIdentifier:
   template: "Expected an identifier, but got '#lexeme'."
-  severity: ERROR
   analyzerCode: MISSING_IDENTIFIER
   script: "do() {} main() {}"
 
@@ -367,7 +364,6 @@
 
 ExpectedType:
   template: "Expected a type, but got '#lexeme'."
-  severity: ERROR
   analyzerCode: EXPECTED_TYPE_NAME
 
 MissingExpressionInThrow:
@@ -484,7 +480,6 @@
 ConstFactoryRedirectionToNonConst:
   template: "Constant factory constructor can't delegate to a non-constant constructor."
   tip: "Try redirecting to a different constructor or marking the target constructor 'const'."
-  severity: ERROR
   analyzerCode: REDIRECT_TO_NON_CONST_CONSTRUCTOR
   script:
     - >-
@@ -496,13 +491,11 @@
 NonConstFactory:
   template: "Cannot invoke a non-'const' factory where a const expression is expected."
   tip: "Try using a constructor or factory that is 'const'."
-  severity: ERROR
   analyzerCode: NOT_CONSTANT_EXPRESSION
 
 NonConstConstructor:
   template: "Cannot invoke a non-'const' constructor where a const expression is expected."
   tip: "Try using a constructor or factory that is 'const'."
-  severity: ERROR
   analyzerCode: NOT_CONSTANT_EXPRESSION
 
 ConstAfterFactory:
@@ -616,7 +609,6 @@
 
 MoreThanOneSuperOrThisInitializer:
   template: "Can't have more than one 'super' or 'this' initializer."
-  severity: ERROR
   analyzerCode: SUPER_IN_REDIRECTING_CONSTRUCTOR
   script:
     - "class C { C.bad() : super(), super(); }"
@@ -626,7 +618,6 @@
 
 ThisInitializerNotAlone:
   template: "Can't have other initializers together with 'this'."
-  severity: ERROR
   analyzerCode: FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR
   script:
     - "class C { int x; C(); C.bad() : x = 5, this(); }"
@@ -634,7 +625,6 @@
 
 SuperInitializerNotLast:
   template: "Can't have initializers after 'super'."
-  severity: ERROR
   analyzerCode: INVALID_SUPER_INVOCATION
   script:
     - "class C { int x; C.bad() : super(), x = 5; }"
@@ -803,7 +793,6 @@
 InvalidVoid:
   template: "Type 'void' can't be used here because it isn't a return type."
   tip: "Try removing 'void' keyword or replace it with 'var', 'final', or a type."
-  severity: ERROR
   analyzerCode: INVALID_USE_OF_VOID
   script:
     - "void x; main() {}"
@@ -812,13 +801,11 @@
 InvalidInitializer:
   template: "Not a valid initializer."
   tip: "To initialize a field, use the syntax 'name = value'."
-  severity: ERROR
   analyzerCode: INVALID_INITIALIZER
 
 FinalFieldNotInitialized:
   template: "Final field '#name' is not initialized."
   tip: "Try to initialize the field in the declaration or in every constructor."
-  severity: ERROR
   analyzerCode: FINAL_NOT_INITIALIZED
   script: >
     class C {
@@ -828,7 +815,6 @@
 FinalFieldNotInitializedByConstructor:
   template: "Final field '#name' is not initialized by this constructor."
   tip: "Try to initialize the field using an initializing formal or a field initializer."
-  severity: ERROR
   analyzerCode: FINAL_NOT_INITIALIZED_CONSTRUCTOR_1
   script: >
     class C {
@@ -1152,7 +1138,6 @@
 
 ConstructorWithTypeParameters:
   template: "Constructors can't have type parameters."
-  severity: ERROR
   analyzerCode: TYPE_PARAMETER_ON_CONSTRUCTOR
   script:
     - "class C { C<T>() {} }"
@@ -1163,14 +1148,12 @@
 ConstructorWithTypeArguments:
   template: "A constructor invocation can't have type arguments on the constructor name."
   tip: "Try to place the type arguments on the class name."
-  severity: ERROR
   analyzerCode: UNDEFINED_CLASS
   script:
     - "class C<X> { C.foo(); } bar() { new C.foo<int>(); }"
 
 ConstructorWithWrongName:
   template: "The name of a constructor must match the name of the enclosing class."
-  severity: ERROR
   analyzerCode: INVALID_CONSTRUCTOR_NAME
   script:
     - "class A { B.foo() {} }"
@@ -1184,7 +1167,6 @@
 ConstructorCyclic:
   template: "Redirecting constructers can't be cyclic."
   tip: "Try to have all constructors eventually redirect to a non-redirecting constructor."
-  severity: ERROR
   analyzerCode: RECURSIVE_CONSTRUCTOR_REDIRECT
   script:
     - "class C { C.foo() : this.bar(); C.bar() : this.foo(); }"
@@ -1240,7 +1222,6 @@
 
 MissingArgumentList:
   template: "Constructor invocations must have an argument list."
-  severity: ERROR
 
 TooFewArguments:
   template: "Too few positional arguments: #count required, #count2 given."
@@ -1265,7 +1246,6 @@
 
 EnumInstantiation:
   template: "Enums can't be instantiated."
-  severity: ERROR
   analyzerCode: INSTANTIATE_ENUM
 
 AbstractRedirectedClassInstantiation:
@@ -1481,10 +1461,6 @@
   template: "The URI '#uri' has no scheme."
   severity: INTERNAL_PROBLEM
 
-InternalProblemMissingSeverity:
-  template: "Message code missing severity: #string"
-  severity: INTERNAL_PROBLEM
-
 InternalProblemContextSeverity:
   template: "Non-context message has context severity: #string"
   severity: INTERNAL_PROBLEM
@@ -1570,12 +1546,10 @@
 
 CyclicClassHierarchy:
   template: "'#name' is a supertype of itself via '#string'."
-  severity: ERROR
   analyzerCode: RECURSIVE_INTERFACE_INHERITANCE
 
 ExtendingEnum:
   template: "'#name' is an enum and can't be extended or implemented."
-  severity: ERROR
   analyzerCode: EXTENDS_ENUM
 
 ExtendingRestricted:
@@ -1587,7 +1561,6 @@
 
 IllegalAsyncGeneratorReturnType:
   template: "Functions marked 'async*' must have a return type assignable to 'Stream'."
-  severity: ERROR
   analyzerCode: ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE
   script:
     - >-
@@ -1597,7 +1570,6 @@
 
 IllegalAsyncGeneratorVoidReturnType:
   template: "Functions marked 'async*' can't have return type 'void'."
-  severity: ERROR
   script:
     - >-
       void g() async* {
@@ -1605,7 +1577,6 @@
 
 IllegalAsyncReturnType:
   template: "Functions marked 'async' must have a return type assignable to 'Future'."
-  severity: ERROR
   analyzerCode: ILLEGAL_ASYNC_RETURN_TYPE
   script:
     - >-
@@ -1615,7 +1586,6 @@
 
 IllegalSyncGeneratorReturnType:
   template: "Functions marked 'sync*' must have a return type assignable to 'Iterable'."
-  severity: ERROR
   analyzerCode: ILLEGAL_SYNC_GENERATOR_RETURN_TYPE
   script:
     - >-
@@ -1625,7 +1595,6 @@
 
 IllegalSyncGeneratorVoidReturnType:
   template: "Functions marked 'sync*' can't have return type 'void'."
-  severity: ERROR
   script:
     - >-
       void g() sync* {
@@ -1641,16 +1610,13 @@
 
 ConflictsWithConstructor:
   template: "Conflicts with constructor '#name'."
-  severity: ERROR
   analyzerCode: CONFLICTS_WITH_CONSTRUCTOR
 
 ConflictsWithFactory:
   template: "Conflicts with factory '#name'."
-  severity: ERROR
 
 ConflictsWithMember:
   template: "Conflicts with member '#name'."
-  severity: ERROR
   analyzerCode: CONFLICTS_WITH_MEMBER
 
 ConflictsWithMemberWarning:
@@ -1660,7 +1626,6 @@
 
 ConflictsWithSetter:
   template: "Conflicts with setter '#name'."
-  severity: ERROR
   analyzerCode: CONFLICTS_WITH_MEMBER
 
 ConflictsWithSetterWarning:
@@ -1670,7 +1635,6 @@
 
 ConflictsWithTypeVariable:
   template: "Conflicts with type variable '#name'."
-  severity: ERROR
   analyzerCode: CONFLICTING_TYPE_VARIABLE_AND_MEMBER
 
 ConflictsWithTypeVariableCause:
@@ -1923,7 +1887,6 @@
 PartOfTwoLibraries:
   template: "A file can't be part of more than one library."
   tip: "Try moving the shared declarations into the libraries, or into a new library."
-  severity: ERROR
   analyzerCode: PART_OF_DIFFERENT_LIBRARY
   script:
     main.dart: "library lib; import 'lib.dart'; part 'part.dart';"
@@ -1988,7 +1951,6 @@
 PartOfInLibrary:
   template: "Can't import '#uri', because it has a 'part of' declaration."
   tip: "Try removing the 'part of' declaration, or using '#uri' as a part."
-  severity: ERROR
   analyzerCode: IMPORT_OF_NON_LIBRARY
   script:
     part.dart: "part of mainlib;"
@@ -2018,7 +1980,6 @@
 
 DuplicatedName:
   template: "'#name' is already declared in this scope."
-  severity: ERROR
   analyzerCode: DUPLICATE_DEFINITION
 
 DuplicatedNameCause:
@@ -2027,7 +1988,6 @@
 
 DuplicatedNamePreviouslyUsed:
   template: "Can't declare '#name' because it was already used in this scope."
-  severity: ERROR
   analyzerCode: REFERENCED_BEFORE_DECLARATION
   script:
     - "main(arguments) { arguments; var arguments; }"
@@ -2038,12 +1998,10 @@
 
 DuplicatedNamedArgument:
   template: "Duplicated named argument '#name'."
-  severity: ERROR
   analyzerCode: DUPLICATE_NAMED_ARGUMENT
 
 DuplicatedParameterName:
   template: "Duplicated parameter name '#name'."
-  severity: ERROR
   analyzerCode: DUPLICATE_DEFINITION
 
 DuplicatedParameterNameCause:
@@ -2090,12 +2048,10 @@
 
 SupertypeIsIllegal:
   template: "The type '#name' can't be used as supertype."
-  severity: ERROR
   analyzerCode: EXTENDS_NON_CLASS
 
 SupertypeIsTypeVariable:
   template: "The type variable '#name' can't be used as supertype."
-  severity: ERROR
   analyzerCode: EXTENDS_NON_CLASS
 
 PartOfLibraryNameMismatch:
@@ -2144,7 +2100,6 @@
 
 ThisAsIdentifier:
   template: "Expected identifier, but got 'this'."
-  severity: ERROR
   analyzerCode: INVALID_REFERENCE_TO_THIS
 
 SuperAsIdentifier:
@@ -2158,7 +2113,6 @@
 
 SwitchExpressionNotAssignable:
   template: "Type '#type' of the switch expression isn't assignable to the type '#type2' of this case expression."
-  severity: ERROR
   analyzerCode: SWITCH_EXPRESSION_NOT_ASSIGNABLE
   script:
     - >-
@@ -2207,7 +2161,6 @@
 
 TypeVariableInConstantContext:
   template: "Type variables can't be used as constants."
-  severity: ERROR
   analyzerCode: TYPE_PARAMETER_IN_CONST_EXPRESSION
   declaration:
     - |
@@ -2262,12 +2215,10 @@
 
 ConstConstructorInSubclassOfMixinApplication:
   template: "Can't extend a mixin application and be 'const'."
-  severity: ERROR
   analyzerCode: CONST_CONSTRUCTOR_IN_SUBCLASS_OF_MIXIN_APPLICATION
 
 ConstConstructorRedirectionToNonConst:
   template: "A constant constructor can't call a non-constant constructor."
-  severity: ERROR
   script:
     - >-
       class A {
@@ -2506,48 +2457,39 @@
 CantInferTypeDueToInconsistentOverrides:
   template: "Can't infer the type of '#string': overridden members must all have the same type."
   tip: "Specify the type explicitly."
-  severity: ERROR
   analyzerCode: INVALID_METHOD_OVERRIDE
 
 CantInferTypeDueToCircularity:
   template: "Can't infer the type of '#string': circularity found during type inference."
   tip: "Specify the type explicitly."
   analyzerCode: RECURSIVE_COMPILE_TIME_CONSTANT
-  severity: ERROR
 
 AmbiguousSupertypes:
   template: "'#name' can't implement both '#type' and '#type2'"
-  severity: ERROR
   analyzerCode: AMBIGUOUS_SUPERTYPES
 
 CantUseSuperBoundedTypeForInstanceCreation:
   template: "Can't use a super-bounded type for instance creation. Got '#type'."
   tip: "Specify a regular-bounded type instead of the super-bounded type. Note that the latter may be due to type inference."
-  severity: ERROR
 
 MixinInferenceNoMatchingClass:
   template: "Type parameters could not be inferred for the mixin '#name' because '#name2' does not implement the mixin's supertype constraint '#type'."
-  severity: ERROR
   analyzerCode: MIXIN_INFERENCE_NO_POSSIBLE_SUBSTITUTION
 
 ImplicitCallOfNonMethod:
   template: "Cannot invoke an instance of '#type' because it declares 'call' to be something other than a method."
   tip: "Try changing 'call' to a method or explicitly invoke 'call'."
-  severity: ERROR
   analyzerCode: IMPLICIT_CALL_OF_NON_METHOD
 
 ExpectedOneExpression:
   template: "Expected one expression, but found additional input."
-  severity: ERROR
 
 ForInLoopNotAssignable:
   template: "Can't assign to this, so it can't be used in a for-in loop."
-  severity: ERROR
   statement: "for (1 in []) {}"
 
 ForInLoopExactlyOneVariable:
   template: "A for-in loop can't have more than one loop variable."
-  severity: ERROR
   statement: "for (var x, y in []) {}"
 
 ForInLoopWithConstVariable:
@@ -2602,12 +2544,10 @@
 WebLiteralCannotBeRepresentedExactly:
   template: "The integer literal #string can't be represented exactly in JavaScript."
   tip: "Try changing the literal to something that can be represented in Javascript. In Javascript #string2 is the nearest value that can be represented exactly."
-  severity: ERROR
 
 BoundIssueViaRawTypeWithNonSimpleBounds:
   template: "Generic type '#name' can't be used without type arguments in a type variable bound."
   tip: "Try providing type arguments to '#name' here."
-  severity: ERROR
   analyzerCode: NOT_INSTANTIATED_BOUND
   script: >
     class Hest<X extends Hest<X>> {}
@@ -2620,7 +2560,6 @@
 BoundIssueViaLoopNonSimplicity:
   template: "Generic type '#name' can't be used without type arguments in the bounds of its own type variables."
   tip: "Try providing type arguments to '#name' here."
-  severity: ERROR
   analyzerCode: NOT_INSTANTIATED_BOUND
   script: >
     class Hest<X extends Hest> {}
@@ -2628,7 +2567,6 @@
 BoundIssueViaCycleNonSimplicity:
   template: "Generic type '#name' can't be used without type arguments in the bounds of its own type variables. It is referenced indirectly through '#name2'."
   tip: "Try providing type arguments to '#name2' here or to some other raw types in the bounds along the reference chain."
-  severity: ERROR
   analyzerCode: NOT_INSTANTIATED_BOUND
   script: >
     class Hest<X extends Fisk> {}
@@ -2641,14 +2579,12 @@
 CycleInTypeVariables:
   template: "Type '#name' is a bound of itself via '#string'."
   tip: "Try breaking the cycle by removing at least on of the 'extends' clauses in the cycle."
-  severity: ERROR
   analyzerCode: TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND
   script:
     - "foo<A extends A>() {}"
 
 CantUsePrefixAsExpression:
   template: "A prefix can't be used as an expression."
-  severity: ERROR
   analyzerCode: PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT
   script: |
     import "dart:core" as prefix;
@@ -2660,7 +2596,6 @@
 CantUsePrefixWithNullAware:
   template: "A prefix can't be used with null-aware operators."
   tip: "It should be safe to remove the '?' as a prefix is never null."
-  severity: ERROR
   analyzerCode: PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT
   script: |
     import "dart:core" as prefix;
@@ -2677,7 +2612,6 @@
     Try moving the constant from the deferred library, or removing 'deferred'
     from the import.
   analyzerCode: CONST_DEFERRED_CLASS
-  severity: ERROR
   script: |
     import "dart:core" deferred as prefix;
 
@@ -2688,7 +2622,6 @@
 CyclicRedirectingFactoryConstructors:
   template: "Cyclic definition of factory '#name'."
   analyzerCode: RECURSIVE_FACTORY_REDIRECT
-  severity: ERROR
   script: |
     class Foo {
       factory Foo.foo() = Foo.bar;
@@ -2699,13 +2632,11 @@
 GenericFunctionTypeInBound:
   template: "Type variables can't have generic function types in their bounds."
   analyzerCode: GENERIC_FUNCTION_TYPE_CANNOT_BE_BOUND
-  severity: ERROR
   script: |
     class Hest<X extends Y Function<Y>(Y)> {}
 
 VoidExpression:
   template: "This expression has type 'void' and can't be used."
-  severity: ERROR
   analyzerCode: USE_OF_VOID_RESULT
   statement: |
     {
@@ -2715,7 +2646,6 @@
 
 ReturnFromVoidFunction:
   template: "Can't return a value from a void function."
-  severity: ERROR
   analyzerCode: RETURN_OF_INVALID_TYPE
   declaration: "void foo() { return 1; }"
 
@@ -2731,7 +2661,6 @@
 
 InvokeNonFunction:
   template: "'#name' isn't a function or method and can't be invoked."
-  severity: ERROR
   analyzerCode: INVOCATION_OF_NON_FUNCTION
   script: |
     class Foo {
diff --git a/pkg/front_end/test/fasta/messages_test.dart b/pkg/front_end/test/fasta/messages_test.dart
index 0864ef9..54290a5 100644
--- a/pkg/front_end/test/fasta/messages_test.dart
+++ b/pkg/front_end/test/fasta/messages_test.dart
@@ -92,6 +92,7 @@
       String analyzerCode;
       Severity severity;
       YamlNode badSeverity;
+      YamlNode unnecessarySeverity;
 
       for (String key in message.keys) {
         YamlNode node = message.nodes[key];
@@ -105,6 +106,8 @@
             severity = severityEnumValues[value];
             if (severity == null) {
               badSeverity = node;
+            } else if (severity == Severity.error) {
+              unnecessarySeverity = node;
             }
             break;
 
@@ -192,7 +195,7 @@
         if (problem != null) {
           String filename = relativize(uri);
           location ??= message.span.start;
-          int line = location.line;
+          int line = location.line + 1;
           int column = location.column;
           problem = "$filename:$line:$column: error:\n$problem";
         }
@@ -219,6 +222,14 @@
               : null,
           location: badSeverity?.span?.start);
 
+      yield createDescription(
+          "unnecessarySeverity",
+          null,
+          unnecessarySeverity != null
+              ? "The 'ERROR' severity is the default and not necessary."
+              : null,
+          location: unnecessarySeverity?.span?.start);
+
       bool exampleAndAnalyzerCodeRequired = severity != Severity.context &&
           severity != Severity.internalProblem &&
           severity != Severity.ignored;
@@ -264,7 +275,7 @@
     buffer
       ..write(relativize(span.sourceUrl))
       ..write(":")
-      ..write(span.start.line)
+      ..write(span.start.line + 1)
       ..write(":")
       ..write(span.start.column)
       ..write(": error: ")