Revert "Remove addCompileTimeError in favor of addProblem"

This reverts commit f872c17a85c309df54a680e63c71c2a52ed496d1.

Reason for revert: After the CQ was green someone else made changes which this CL is not compatible with. The CQ lands if the tests passed
and doesn't rebase before doing so. 


Original change's description:
> 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: I85a340168848cd3b4375b3f53cb0361251ed6e5d
> Reviewed-on: https://dart-review.googlesource.com/73100
> Commit-Queue: Peter von der Ahé <ahe@google.com>
> Reviewed-by: Jens Johansen <jensj@google.com>

TBR=ahe@google.com,jensj@google.com

Change-Id: I3ea736a9752805adb3bacc8b67e8eb1435c1bf69
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/73181
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
diff --git a/pkg/analyzer/lib/src/fasta/ast_builder.dart b/pkg/analyzer/lib/src/fasta/ast_builder.dart
index a7fbf40..c9587ff 100644
--- a/pkg/analyzer/lib/src/fasta/ast_builder.dart
+++ b/pkg/analyzer/lib/src/fasta/ast_builder.dart
@@ -30,7 +30,6 @@
 import 'package:front_end/src/fasta/problems.dart' show unhandled;
 import 'package:front_end/src/fasta/messages.dart'
     show
-        LocatedMessage,
         Message,
         messageConstConstructorWithBody,
         messageConstMethod,
@@ -2039,7 +2038,7 @@
     } else {
       int offset = startToken.offset;
       int length = endToken.end - offset;
-      addProblem(message, offset, length);
+      addCompileTimeError(message, offset, length);
     }
   }
 
@@ -2764,13 +2763,12 @@
   }
 
   @override
-  void addProblem(Message message, int charOffset, int length,
-      {bool wasHandled: false, List<LocatedMessage> context}) {
+  void addCompileTimeError(Message message, int offset, int length) {
     if (directives.isEmpty &&
         message.code.analyzerCode == 'NON_PART_OF_DIRECTIVE_IN_PART') {
       message = messageDirectiveAfterDeclaration;
     }
-    errorReporter.reportMessage(message, charOffset, length);
+    errorReporter.reportMessage(message, offset, 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 518a6c4..15fafd9 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 LocatedMessage, Message;
+import 'package:front_end/src/fasta/messages.dart' show Message;
 import 'package:front_end/src/fasta/parser.dart';
 import 'package:front_end/src/fasta/problems.dart'
     show internalProblem, unsupported;
@@ -147,9 +147,8 @@
   Uri get uri => null;
 
   @override
-  void addProblem(Message message, int charOffset, int length,
-      {bool wasHandled: false, List<LocatedMessage> context}) {
-    internalProblem(message, charOffset, uri);
+  void addCompileTimeError(Message message, int offset, int length) {
+    internalProblem(message, offset, 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 d2b9c0f..4f95542 100644
--- a/pkg/front_end/lib/src/fasta/builder/class_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/class_builder.dart
@@ -233,10 +233,15 @@
             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,
-      {bool wasHandled: false, List<LocatedMessage> context}) {
-    library.addProblem(message, charOffset, length, fileUri,
-        wasHandled: wasHandled, context: context);
+      {List<LocatedMessage> context}) {
+    library.addProblem(message, charOffset, length, fileUri, 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 2f29995..5b43657 100644
--- a/pkg/front_end/lib/src/fasta/builder/library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/library_builder.dart
@@ -20,8 +20,6 @@
         templateInternalProblemNotFoundIn,
         templateInternalProblemPrivateConstructorAccess;
 
-import '../severity.dart' show Severity;
-
 import 'builder.dart'
     show
         ClassBuilder,
@@ -80,19 +78,23 @@
     exporters.add(new Export(exporter, this, combinators, charOffset));
   }
 
-  /// Add a problem with a severity determined by the severity of the message.
+  /// See `Loader.addCompileTimeError` for an explanation of the
+  /// arguments passed to this method.
   ///
   /// If [fileUri] is null, it defaults to `this.fileUri`.
-  ///
-  /// See `Loader.addMessage` for an explanation of the
-  /// arguments passed to this method.
-  void addProblem(Message message, int charOffset, int length, Uri fileUri,
-      {bool wasHandled: false,
-      List<LocatedMessage> context,
-      Severity severity}) {
+  void addCompileTimeError(
+      Message message, int charOffset, int length, Uri fileUri,
+      {bool wasHandled: false, List<LocatedMessage> context}) {
     fileUri ??= this.fileUri;
-    loader.addProblem(message, charOffset, length, fileUri,
-        wasHandled: wasHandled, context: context, severity: severity);
+    loader.addCompileTimeError(message, charOffset, length, fileUri,
+        wasHandled: wasHandled, context: context);
+  }
+
+  /// Add a problem with a severity determined by the severity of the message.
+  void addProblem(Message message, int charOffset, int length, Uri fileUri,
+      {List<LocatedMessage> context}) {
+    fileUri ??= this.fileUri;
+    loader.addProblem(message, charOffset, length, fileUri, context: context);
   }
 
   /// 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 86067fb..1d0c9fa 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.addProblem` for those.
+/// `LibraryBuilder.addCompileTimeError` 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 f5c2da1..45cbf9a 100644
--- a/pkg/front_end/lib/src/fasta/fasta_codes.dart
+++ b/pkg/front_end/lib/src/fasta/fasta_codes.dart
@@ -27,8 +27,7 @@
 
   final Severity severity;
 
-  const Code(this.name, this.template,
-      {this.analyzerCode, this.severity: Severity.error});
+  const Code(this.name, this.template, {this.analyzerCode, this.severity});
 
   String toString() => name;
 }
@@ -59,10 +58,7 @@
   final String tip;
 
   const MessageCode(String name,
-      {String analyzerCode,
-      Severity severity: Severity.error,
-      this.message,
-      this.tip})
+      {String analyzerCode, Severity severity, 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 2acd18b..712912b 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");
+        analyzerCode: "AMBIGUOUS_SUPERTYPES", severity: Severity.error);
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsAmbiguousSupertypes(
@@ -272,7 +272,8 @@
     const Code<Message Function(String name, String name2)>(
         "BoundIssueViaCycleNonSimplicity",
         templateBoundIssueViaCycleNonSimplicity,
-        analyzerCode: "NOT_INSTANTIATED_BOUND");
+        analyzerCode: "NOT_INSTANTIATED_BOUND",
+        severity: Severity.error);
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsBoundIssueViaCycleNonSimplicity(
@@ -299,7 +300,7 @@
 const Code<Message Function(String name)> codeBoundIssueViaLoopNonSimplicity =
     const Code<Message Function(String name)>("BoundIssueViaLoopNonSimplicity",
         templateBoundIssueViaLoopNonSimplicity,
-        analyzerCode: "NOT_INSTANTIATED_BOUND");
+        analyzerCode: "NOT_INSTANTIATED_BOUND", severity: Severity.error);
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsBoundIssueViaLoopNonSimplicity(String name) {
@@ -325,7 +326,8 @@
     const Code<Message Function(String name)>(
         "BoundIssueViaRawTypeWithNonSimpleBounds",
         templateBoundIssueViaRawTypeWithNonSimpleBounds,
-        analyzerCode: "NOT_INSTANTIATED_BOUND");
+        analyzerCode: "NOT_INSTANTIATED_BOUND",
+        severity: Severity.error);
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsBoundIssueViaRawTypeWithNonSimpleBounds(String name) {
@@ -542,7 +544,8 @@
 const Code<Message Function(String string)> codeCantInferTypeDueToCircularity =
     const Code<Message Function(String string)>(
         "CantInferTypeDueToCircularity", templateCantInferTypeDueToCircularity,
-        analyzerCode: "RECURSIVE_COMPILE_TIME_CONSTANT");
+        analyzerCode: "RECURSIVE_COMPILE_TIME_CONSTANT",
+        severity: Severity.error);
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsCantInferTypeDueToCircularity(String string) {
@@ -568,7 +571,8 @@
     const Code<Message Function(String string)>(
         "CantInferTypeDueToInconsistentOverrides",
         templateCantInferTypeDueToInconsistentOverrides,
-        analyzerCode: "INVALID_METHOD_OVERRIDE");
+        analyzerCode: "INVALID_METHOD_OVERRIDE",
+        severity: Severity.error);
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsCantInferTypeDueToInconsistentOverrides(String string) {
@@ -596,7 +600,7 @@
 const Code<Message Function(Token token)> codeCantUseDeferredPrefixAsConstant =
     const Code<Message Function(Token token)>("CantUseDeferredPrefixAsConstant",
         templateCantUseDeferredPrefixAsConstant,
-        analyzerCode: "CONST_DEFERRED_CLASS");
+        analyzerCode: "CONST_DEFERRED_CLASS", severity: Severity.error);
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsCantUseDeferredPrefixAsConstant(Token token) {
@@ -617,6 +621,7 @@
 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.
@@ -627,6 +632,7 @@
 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.""");
 
@@ -645,9 +651,9 @@
 const Code<Message Function(DartType _type)>
     codeCantUseSuperBoundedTypeForInstanceCreation =
     const Code<Message Function(DartType _type)>(
-  "CantUseSuperBoundedTypeForInstanceCreation",
-  templateCantUseSuperBoundedTypeForInstanceCreation,
-);
+        "CantUseSuperBoundedTypeForInstanceCreation",
+        templateCantUseSuperBoundedTypeForInstanceCreation,
+        severity: Severity.error);
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsCantUseSuperBoundedTypeForInstanceCreation(
@@ -705,7 +711,7 @@
 const Code<Message Function(String name)> codeConflictsWithConstructor =
     const Code<Message Function(String name)>(
         "ConflictsWithConstructor", templateConflictsWithConstructor,
-        analyzerCode: "CONFLICTS_WITH_CONSTRUCTOR");
+        analyzerCode: "CONFLICTS_WITH_CONSTRUCTOR", severity: Severity.error);
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsConflictsWithConstructor(String name) {
@@ -723,9 +729,8 @@
 // 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,
-);
+        "ConflictsWithFactory", templateConflictsWithFactory,
+        severity: Severity.error);
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsConflictsWithFactory(String name) {
@@ -744,7 +749,7 @@
 const Code<Message Function(String name)> codeConflictsWithMember =
     const Code<Message Function(String name)>(
         "ConflictsWithMember", templateConflictsWithMember,
-        analyzerCode: "CONFLICTS_WITH_MEMBER");
+        analyzerCode: "CONFLICTS_WITH_MEMBER", severity: Severity.error);
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsConflictsWithMember(String name) {
@@ -784,7 +789,7 @@
 const Code<Message Function(String name)> codeConflictsWithSetter =
     const Code<Message Function(String name)>(
         "ConflictsWithSetter", templateConflictsWithSetter,
-        analyzerCode: "CONFLICTS_WITH_MEMBER");
+        analyzerCode: "CONFLICTS_WITH_MEMBER", severity: Severity.error);
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsConflictsWithSetter(String name) {
@@ -825,7 +830,8 @@
 const Code<Message Function(String name)> codeConflictsWithTypeVariable =
     const Code<Message Function(String name)>(
         "ConflictsWithTypeVariable", templateConflictsWithTypeVariable,
-        analyzerCode: "CONFLICTING_TYPE_VARIABLE_AND_MEMBER");
+        analyzerCode: "CONFLICTING_TYPE_VARIABLE_AND_MEMBER",
+        severity: Severity.error);
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsConflictsWithTypeVariable(String name) {
@@ -902,6 +908,7 @@
 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.
@@ -931,6 +938,7 @@
 // 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.""");
 
@@ -1334,6 +1342,7 @@
 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:
@@ -1393,6 +1402,7 @@
 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.""");
@@ -1446,6 +1456,7 @@
 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.""");
@@ -1458,6 +1469,7 @@
 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.
@@ -1467,6 +1479,7 @@
 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.""");
 
@@ -1650,7 +1663,8 @@
     codeCyclicClassHierarchy =
     const Code<Message Function(String name, String string)>(
         "CyclicClassHierarchy", templateCyclicClassHierarchy,
-        analyzerCode: "RECURSIVE_INTERFACE_INHERITANCE");
+        analyzerCode: "RECURSIVE_INTERFACE_INHERITANCE",
+        severity: Severity.error);
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsCyclicClassHierarchy(String name, String string) {
@@ -1672,7 +1686,8 @@
     const Code<Message Function(String name)>(
         "CyclicRedirectingFactoryConstructors",
         templateCyclicRedirectingFactoryConstructors,
-        analyzerCode: "RECURSIVE_FACTORY_REDIRECT");
+        analyzerCode: "RECURSIVE_FACTORY_REDIRECT",
+        severity: Severity.error);
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsCyclicRedirectingFactoryConstructors(String name) {
@@ -2084,7 +2099,7 @@
 const Code<Message Function(String name)> codeDuplicatedName =
     const Code<Message Function(String name)>(
         "DuplicatedName", templateDuplicatedName,
-        analyzerCode: "DUPLICATE_DEFINITION");
+        analyzerCode: "DUPLICATE_DEFINITION", severity: Severity.error);
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsDuplicatedName(String name) {
@@ -2126,7 +2141,8 @@
 const Code<Message Function(String name)> codeDuplicatedNamePreviouslyUsed =
     const Code<Message Function(String name)>(
         "DuplicatedNamePreviouslyUsed", templateDuplicatedNamePreviouslyUsed,
-        analyzerCode: "REFERENCED_BEFORE_DECLARATION");
+        analyzerCode: "REFERENCED_BEFORE_DECLARATION",
+        severity: Severity.error);
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsDuplicatedNamePreviouslyUsed(String name) {
@@ -2167,7 +2183,7 @@
 const Code<Message Function(String name)> codeDuplicatedNamedArgument =
     const Code<Message Function(String name)>(
         "DuplicatedNamedArgument", templateDuplicatedNamedArgument,
-        analyzerCode: "DUPLICATE_NAMED_ARGUMENT");
+        analyzerCode: "DUPLICATE_NAMED_ARGUMENT", severity: Severity.error);
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsDuplicatedNamedArgument(String name) {
@@ -2186,7 +2202,7 @@
 const Code<Message Function(String name)> codeDuplicatedParameterName =
     const Code<Message Function(String name)>(
         "DuplicatedParameterName", templateDuplicatedParameterName,
-        analyzerCode: "DUPLICATE_DEFINITION");
+        analyzerCode: "DUPLICATE_DEFINITION", severity: Severity.error);
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsDuplicatedParameterName(String name) {
@@ -2292,6 +2308,7 @@
 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.
@@ -2527,7 +2544,7 @@
 const Code<Message Function(Token token)> codeExpectedIdentifier =
     const Code<Message Function(Token token)>(
         "ExpectedIdentifier", templateExpectedIdentifier,
-        analyzerCode: "MISSING_IDENTIFIER");
+        analyzerCode: "MISSING_IDENTIFIER", severity: Severity.error);
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsExpectedIdentifier(Token token) {
@@ -2552,6 +2569,7 @@
 // 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.
@@ -2619,7 +2637,7 @@
 const Code<Message Function(Token token)> codeExpectedType =
     const Code<Message Function(Token token)>(
         "ExpectedType", templateExpectedType,
-        analyzerCode: "EXPECTED_TYPE_NAME");
+        analyzerCode: "EXPECTED_TYPE_NAME", severity: Severity.error);
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsExpectedType(Token token) {
@@ -2690,7 +2708,7 @@
 const Code<Message Function(String name)> codeExtendingEnum =
     const Code<Message Function(String name)>(
         "ExtendingEnum", templateExtendingEnum,
-        analyzerCode: "EXTENDS_ENUM");
+        analyzerCode: "EXTENDS_ENUM", severity: Severity.error);
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsExtendingEnum(String name) {
@@ -3020,7 +3038,7 @@
 const Code<Message Function(String name)> codeFinalFieldNotInitialized =
     const Code<Message Function(String name)>(
         "FinalFieldNotInitialized", templateFinalFieldNotInitialized,
-        analyzerCode: "FINAL_NOT_INITIALIZED");
+        analyzerCode: "FINAL_NOT_INITIALIZED", severity: Severity.error);
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsFinalFieldNotInitialized(String name) {
@@ -3049,7 +3067,8 @@
     const Code<Message Function(String name)>(
         "FinalFieldNotInitializedByConstructor",
         templateFinalFieldNotInitializedByConstructor,
-        analyzerCode: "FINAL_NOT_INITIALIZED_CONSTRUCTOR_1");
+        analyzerCode: "FINAL_NOT_INITIALIZED_CONSTRUCTOR_1",
+        severity: Severity.error);
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsFinalFieldNotInitializedByConstructor(String name) {
@@ -3183,6 +3202,7 @@
 // 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.
@@ -3191,6 +3211,7 @@
 // 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.""");
 
@@ -3280,6 +3301,7 @@
 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.""");
 
@@ -3330,6 +3352,7 @@
 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'.""");
 
@@ -3340,6 +3363,7 @@
 // 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'.""");
 
@@ -3350,6 +3374,7 @@
 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'.""");
 
@@ -3425,6 +3450,7 @@
 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'.""");
 
@@ -3435,6 +3461,7 @@
 // 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.
@@ -3473,6 +3500,7 @@
 // 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.
@@ -3539,7 +3567,7 @@
 const Code<Message Function(DartType _type)> codeImplicitCallOfNonMethod =
     const Code<Message Function(DartType _type)>(
         "ImplicitCallOfNonMethod", templateImplicitCallOfNonMethod,
-        analyzerCode: "IMPLICIT_CALL_OF_NON_METHOD");
+        analyzerCode: "IMPLICIT_CALL_OF_NON_METHOD", severity: Severity.error);
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsImplicitCallOfNonMethod(DartType _type) {
@@ -3942,6 +3970,27 @@
         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'.""",
@@ -4596,6 +4645,7 @@
 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'.""");
 
@@ -4690,6 +4740,7 @@
 // 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:
@@ -4706,7 +4757,7 @@
 const Code<Message Function(String name)> codeInvokeNonFunction =
     const Code<Message Function(String name)>(
         "InvokeNonFunction", templateInvokeNonFunction,
-        analyzerCode: "INVOCATION_OF_NON_FUNCTION");
+        analyzerCode: "INVOCATION_OF_NON_FUNCTION", severity: Severity.error);
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsInvokeNonFunction(String name) {
@@ -4898,6 +4949,7 @@
 // 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.
@@ -5148,7 +5200,8 @@
     codeMixinInferenceNoMatchingClass =
     const Code<Message Function(String name, String name2, DartType _type)>(
         "MixinInferenceNoMatchingClass", templateMixinInferenceNoMatchingClass,
-        analyzerCode: "MIXIN_INFERENCE_NO_POSSIBLE_SUBSTITUTION");
+        analyzerCode: "MIXIN_INFERENCE_NO_POSSIBLE_SUBSTITUTION",
+        severity: Severity.error);
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsMixinInferenceNoMatchingClass(
@@ -5173,6 +5226,7 @@
 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.
@@ -5365,6 +5419,7 @@
 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'.""");
@@ -5375,6 +5430,7 @@
 // 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'.""");
@@ -5453,6 +5509,7 @@
 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.
@@ -5922,7 +5979,7 @@
 const Code<Message Function(Uri uri_)> codePartOfInLibrary =
     const Code<Message Function(Uri uri_)>(
         "PartOfInLibrary", templatePartOfInLibrary,
-        analyzerCode: "IMPORT_OF_NON_LIBRARY");
+        analyzerCode: "IMPORT_OF_NON_LIBRARY", severity: Severity.error);
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsPartOfInLibrary(Uri uri_) {
@@ -5989,6 +6046,7 @@
 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.""");
@@ -6282,6 +6340,7 @@
 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.
@@ -6586,6 +6645,7 @@
 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.
@@ -6726,7 +6786,7 @@
 const Code<Message Function(String name)> codeSupertypeIsIllegal =
     const Code<Message Function(String name)>(
         "SupertypeIsIllegal", templateSupertypeIsIllegal,
-        analyzerCode: "EXTENDS_NON_CLASS");
+        analyzerCode: "EXTENDS_NON_CLASS", severity: Severity.error);
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsSupertypeIsIllegal(String name) {
@@ -6746,7 +6806,7 @@
 const Code<Message Function(String name)> codeSupertypeIsTypeVariable =
     const Code<Message Function(String name)>(
         "SupertypeIsTypeVariable", templateSupertypeIsTypeVariable,
-        analyzerCode: "EXTENDS_NON_CLASS");
+        analyzerCode: "EXTENDS_NON_CLASS", severity: Severity.error);
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsSupertypeIsTypeVariable(String name) {
@@ -6781,7 +6841,8 @@
     codeSwitchExpressionNotAssignable =
     const Code<Message Function(DartType _type, DartType _type2)>(
         "SwitchExpressionNotAssignable", templateSwitchExpressionNotAssignable,
-        analyzerCode: "SWITCH_EXPRESSION_NOT_ASSIGNABLE");
+        analyzerCode: "SWITCH_EXPRESSION_NOT_ASSIGNABLE",
+        severity: Severity.error);
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 Message _withArgumentsSwitchExpressionNotAssignable(
@@ -6864,6 +6925,7 @@
 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.
@@ -6873,6 +6935,7 @@
 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.
@@ -7071,6 +7134,7 @@
 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.
@@ -7423,6 +7487,7 @@
 // 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.
@@ -7442,9 +7507,9 @@
 const Code<Message Function(String string, String string2)>
     codeWebLiteralCannotBeRepresentedExactly =
     const Code<Message Function(String string, String string2)>(
-  "WebLiteralCannotBeRepresentedExactly",
-  templateWebLiteralCannotBeRepresentedExactly,
-);
+        "WebLiteralCannotBeRepresentedExactly",
+        templateWebLiteralCannotBeRepresentedExactly,
+        severity: Severity.error);
 
 // 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 b559fa4..60fb6cc 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 problemInTry;
+  Statement compileTimeErrorInTry;
 
-  Statement problemInLoopOrSwitch;
+  Statement compileTimeErrorInLoopOrSwitch;
 
   Scope switchScope;
 
@@ -302,10 +302,10 @@
     } else if (node is Expression) {
       return node;
     } else if (node is SuperInitializer) {
-      return buildProblem(
-          fasta.messageSuperAsExpression, node.fileOffset, noLength);
+      return new SyntheticExpressionJudgment(buildCompileTimeError(
+          fasta.messageSuperAsExpression, node.fileOffset, noLength));
     } else if (node is ProblemBuilder) {
-      return buildProblem(node.message, node.charOffset, noLength);
+      return buildProblemExpression(node, -1, noLength);
     } else {
       return unhandled("${node.runtimeType}", "toValue", -1, uri);
     }
@@ -362,7 +362,7 @@
           for (Statement statement in target.users) {
             statement.parent.replaceChild(
                 statement,
-                wrapInProblemStatement(statement,
+                wrapInCompileTimeErrorStatement(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 =
-          buildProblem(message, offset, name.length, context: context)
-            ..parent = variable;
+      variable.initializer = new SyntheticExpressionJudgment(
+          buildCompileTimeError(message, offset, name.length, context: context))
+        ..parent = variable;
     } else {
-      variable.initializer = wrapInLocatedProblem(
+      variable.initializer = wrapInLocatedCompileTimeError(
           variable.initializer, message.withLocation(uri, offset, name.length),
           context: context)
         ..parent = variable;
@@ -467,8 +467,8 @@
 
       ConstantContext savedConstantContext = pop();
       if (expression is! StaticAccessGenerator) {
-        push(wrapInProblem(
-            toValue(expression), fasta.messageExpressionNotMetadata, noLength));
+        push(wrapInCompileTimeError(
+            toValue(expression), fasta.messageExpressionNotMetadata));
       } else {
         push(toValue(expression));
       }
@@ -572,8 +572,10 @@
     if (member is KernelConstructorBuilder) {
       if (member.isConst &&
           (classBuilder.cls.superclass?.isMixinApplication ?? false)) {
-        addProblem(fasta.messageConstConstructorInSubclassOfMixinApplication,
-            member.charOffset, member.name.length);
+        addCompileTimeError(
+            fasta.messageConstConstructorInSubclassOfMixinApplication,
+            member.charOffset,
+            member.name.length);
       }
       if (member.formals != null) {
         for (KernelFormalParameterBuilder formal in member.formals) {
@@ -581,11 +583,10 @@
             Initializer initializer;
             if (member.isExternal) {
               initializer = buildInvalidInitializer(
-                  buildProblem(
-                          fasta.messageExternalConstructorWithFieldInitializers,
-                          formal.charOffset,
-                          formal.name.length)
-                      .desugared,
+                  buildCompileTimeError(
+                      fasta.messageExternalConstructorWithFieldInitializers,
+                      formal.charOffset,
+                      formal.name.length),
                   formal.charOffset);
             } else {
               initializer = buildFieldInitializer(true, formal.name,
@@ -650,7 +651,7 @@
       Expression value = toValue(node);
       if (node is! Throw) {
         value =
-            wrapInProblem(value, fasta.messageExpectedAnInitializer, noLength);
+            wrapInCompileTimeError(value, fasta.messageExpectedAnInitializer);
       }
       initializer = buildInvalidInitializer(node, token.charOffset);
     }
@@ -658,7 +659,7 @@
     if (member is KernelConstructorBuilder && !member.isExternal) {
       member.addInitializer(initializer, this);
     } else {
-      addProblem(
+      addCompileTimeError(
           fasta.templateInitializerOutsideConstructor
               .withArguments(member.name),
           token.charOffset,
@@ -796,7 +797,7 @@
           statements.add(body);
           body = forest.block(null, statements, null)..fileOffset = charOffset;
         }
-        body = wrapInProblemStatement(
+        body = wrapInCompileTimeErrorStatement(
             body, fasta.messageSetterWithWrongNumberOfFormals);
       }
     }
@@ -808,8 +809,8 @@
       builder.body = body;
     } else {
       if (body != null) {
-        builder.body =
-            wrapInProblemStatement(body, fasta.messageExternalMethodWithBody);
+        builder.body = wrapInCompileTimeErrorStatement(
+            body, fasta.messageExternalMethodWithBody);
       }
     }
     Member target = builder.target;
@@ -850,12 +851,11 @@
           name += ".${initialTarget.name.name}";
         }
         // TODO(dmitryas): Report this error earlier.
-        replacementNode = buildProblem(
-                fasta.templateCyclicRedirectingFactoryConstructors
-                    .withArguments(initialTarget.name.name),
-                initialTarget.fileOffset,
-                name.length)
-            .desugared;
+        replacementNode = buildCompileTimeError(
+            fasta.templateCyclicRedirectingFactoryConstructors
+                .withArguments(initialTarget.name.name),
+            initialTarget.fileOffset,
+            name.length);
       } else if (resolvedTarget is Constructor &&
           resolvedTarget.enclosingClass.isAbstract) {
         replacementNode = evaluateArgumentsBefore(
@@ -994,7 +994,7 @@
     Token eof = token.next;
 
     if (!eof.isEof) {
-      expression = wrapInLocatedProblem(
+      expression = wrapInLocatedCompileTimeError(
           expression,
           fasta.messageExpectedOneExpression
               .withLocation(uri, eof.charOffset, eof.length));
@@ -1027,7 +1027,8 @@
       // TODO(ahe): Change this to a null check.
       int offset = builder.body?.fileOffset ?? builder.charOffset;
       constructor.initializers.add(buildInvalidInitializer(
-          buildProblem(fasta.messageConstructorNotSync, offset, noLength),
+          buildCompileTimeErrorExpression(
+              fasta.messageConstructorNotSync, offset),
           offset));
     }
     if (needsImplicitSuperInitializer) {
@@ -1047,12 +1048,11 @@
           length = (constructor.parent as Class).name.length;
         }
         initializer = buildInvalidInitializer(
-            buildProblem(
-                    fasta.templateSuperclassHasNoDefaultConstructor
-                        .withArguments(superclass),
-                    builder.charOffset,
-                    length)
-                .desugared,
+            buildCompileTimeError(
+                fasta.templateSuperclassHasNoDefaultConstructor
+                    .withArguments(superclass),
+                builder.charOffset,
+                length),
             builder.charOffset);
       } else {
         initializer = buildSuperInitializer(
@@ -1094,8 +1094,9 @@
         if (i > firstNamedArgumentIndex) {
           arguments[i] = new NamedExpression(
               "#$i",
-              buildProblem(fasta.messageExpectedNamedArgument,
-                  forest.readOffset(argument), noLength))
+              buildCompileTimeErrorExpression(
+                  fasta.messageExpectedNamedArgument,
+                  forest.readOffset(argument)))
             ..fileOffset = beginToken.charOffset;
         }
       }
@@ -1245,8 +1246,9 @@
       negate = true;
     }
     if (!isBinaryOperator(operator) && !isMinusOperator(operator)) {
-      return buildProblem(fasta.templateInvalidOperator.withArguments(token),
-          token.charOffset, token.length);
+      return buildCompileTimeErrorExpression(
+          fasta.templateInvalidOperator.withArguments(token), token.charOffset,
+          length: token.length);
     } else {
       Expression result = buildMethodInvocation(a, new Name(operator),
           forest.arguments(<Expression>[b], noLocation), token.charOffset,
@@ -1292,8 +1294,9 @@
     } else {
       pop();
       token = token.next;
-      push(buildProblem(fasta.templateExpectedIdentifier.withArguments(token),
-          offsetForToken(token), lengthForToken(token)));
+      Message message = fasta.templateExpectedIdentifier.withArguments(token);
+      push(new SyntheticExpressionJudgment(buildCompileTimeError(
+          message, offsetForToken(token), lengthForToken(token))));
     }
   }
 
@@ -1305,8 +1308,9 @@
     } else {
       pop();
       token = token.next;
-      push(buildProblem(fasta.templateExpectedIdentifier.withArguments(token),
-          offsetForToken(token), lengthForToken(token)));
+      Message message = fasta.templateExpectedIdentifier.withArguments(token);
+      push(new SyntheticExpressionJudgment(buildCompileTimeError(
+          message, offsetForToken(token), lengthForToken(token))));
     }
   }
 
@@ -1370,8 +1374,8 @@
       // TODO(ahe): Use [error] below instead of building a compile-time error,
       // should be:
       //    return library.loader.throwCompileConstantError(error, charOffset);
-      return buildProblem(message, charOffset, noLength, context: context)
-          .desugared;
+      return buildCompileTimeError(message, charOffset, noLength,
+          context: context);
     } else {
       Expression error = library.loader.instantiateNoSuchMethodError(
           receiver, name, forest.castArguments(arguments), charOffset,
@@ -1561,7 +1565,7 @@
       }
     } else if (constantContext != ConstantContext.none &&
         !context.allowedInConstantExpression) {
-      addProblem(
+      addCompileTimeError(
           fasta.messageNotAConstantExpression, token.charOffset, token.length);
     }
     push(new Identifier(token));
@@ -1615,7 +1619,7 @@
       if (constantContext != ConstantContext.none &&
           declaration.isTypeVariable &&
           !member.isConstructor) {
-        addProblem(
+        addCompileTimeError(
             fasta.messageNotAConstantExpression, charOffset, token.length);
       }
       return new TypeUseGenerator(this, token, declaration, name);
@@ -1623,7 +1627,7 @@
       if (constantContext != ConstantContext.none &&
           !declaration.isConst &&
           !member.isConstructor) {
-        addProblem(
+        addCompileTimeError(
             fasta.messageNotAConstantExpression, charOffset, token.length);
       }
       // An initializing formal parameter might be final without its
@@ -1651,7 +1655,7 @@
           // semantics, such parameters introduces a new parameter with that
           // name that should be resolved here.
           !member.isConstructor) {
-        addProblem(
+        addCompileTimeError(
             fasta.messageNotAConstantExpression, charOffset, token.length);
       }
       Name n = new Name(name, library.library);
@@ -1692,7 +1696,7 @@
         if (!(readTarget is Field && readTarget.isConst ||
             // Static tear-offs are also compile time constants.
             readTarget is Procedure)) {
-          addProblem(
+          addCompileTimeError(
               fasta.messageNotAConstantExpression, charOffset, token.length);
         }
       }
@@ -1834,7 +1838,7 @@
     debugEvent("ReturnStatement");
     Expression expression = hasExpression ? popForValue() : null;
     if (expression != null && inConstructor) {
-      push(buildProblemStatement(
+      push(buildCompileTimeErrorStatement(
           fasta.messageConstructorWithReturnType, beginToken.charOffset));
     } else {
       push(forest.returnStatement(beginToken, expression, endToken));
@@ -1882,17 +1886,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 = buildProblem(
+        initializer = buildCompileTimeErrorExpression(
             fasta.templateConstFieldWithoutInitializer
                 .withArguments(token.lexeme),
             token.charOffset,
-            token.length);
+            length: token.length);
       } else if (isFinal) {
-        initializer = buildProblem(
+        initializer = buildCompileTimeErrorExpression(
             fasta.templateFinalFieldWithoutInitializer
                 .withArguments(token.lexeme),
             token.charOffset,
-            token.length);
+            length: token.length);
       }
     }
     pushNewLocalVariable(initializer);
@@ -2024,8 +2028,10 @@
     Expression value = popForValue();
     Object generator = pop();
     if (generator is! Generator) {
-      push(buildProblem(fasta.messageNotAnLvalue, offsetForToken(token),
-          lengthForToken(token)));
+      push(new SyntheticExpressionJudgment(buildCompileTimeError(
+          fasta.messageNotAnLvalue,
+          offsetForToken(token),
+          lengthForToken(token))));
     } else {
       push(new DelayedAssignment(
           this, token, generator, value, token.stringValue));
@@ -2045,9 +2051,9 @@
   }
 
   void exitLoopOrSwitch(Statement statement) {
-    if (problemInLoopOrSwitch != null) {
-      push(problemInLoopOrSwitch);
-      problemInLoopOrSwitch = null;
+    if (compileTimeErrorInLoopOrSwitch != null) {
+      push(compileTimeErrorInLoopOrSwitch);
+      compileTimeErrorInLoopOrSwitch = null;
     } else {
       push(statement);
     }
@@ -2320,10 +2326,12 @@
         if (existing == null) {
           scopeBuilder.addMember(name, builder);
         } else {
-          addProblem(fasta.templateDuplicatedName.withArguments(name),
+          addCompileTimeError(fasta.templateDuplicatedName.withArguments(name),
               builder.charOffset, name.length);
-          addProblem(fasta.templateDuplicatedNameCause.withArguments(name),
-              existing.charOffset, name.length);
+          addCompileTimeError(
+              fasta.templateDuplicatedNameCause.withArguments(name),
+              existing.charOffset,
+              name.length);
         }
       }
     }
@@ -2355,12 +2363,10 @@
     DartType type = pop();
     Expression expression = popForValue();
     if (constantContext != ConstantContext.none) {
-      push(buildProblem(
-              fasta.templateNotConstantExpression
-                  .withArguments('As expression'),
-              operator.charOffset,
-              operator.length)
-          .desugared);
+      push(buildCompileTimeError(
+          fasta.templateNotConstantExpression.withArguments('As expression'),
+          operator.charOffset,
+          operator.length));
     } else {
       push(forest.asExpression(expression, type, operator));
     }
@@ -2379,12 +2385,10 @@
           type, functionNestingLevel);
     }
     if (constantContext != ConstantContext.none) {
-      push(buildProblem(
-              fasta.templateNotConstantExpression
-                  .withArguments('Is expression'),
-              isOperator.charOffset,
-              isOperator.length)
-          .desugared);
+      push(buildCompileTimeError(
+          fasta.templateNotConstantExpression.withArguments('Is expression'),
+          isOperator.charOffset,
+          isOperator.length));
     } else {
       push(isExpression);
     }
@@ -2424,11 +2428,10 @@
 
     Expression error;
     if (constantContext != ConstantContext.none) {
-      error = buildProblem(
-              fasta.templateNotConstantExpression.withArguments('Throw'),
-              throwToken.offset,
-              throwToken.length)
-          .desugared;
+      error = buildCompileTimeError(
+          fasta.templateNotConstantExpression.withArguments('Throw'),
+          throwToken.offset,
+          throwToken.length);
     }
 
     push(new ThrowJudgment(tokensSaver?.throwTokens(throwToken), expression,
@@ -2480,7 +2483,7 @@
         if (member is KernelRedirectingFactoryBuilder &&
             name.initializer != null) {
           KernelRedirectingFactoryBuilder factory = member;
-          addProblem(
+          addCompileTimeError(
               fasta.templateDefaultValueInRedirectingFactoryConstructor
                   .withArguments(factory.redirectionTarget.fullNameForErrors),
               name.initializer.fileOffset,
@@ -2649,8 +2652,7 @@
               stackTrace, coreTypes.stackTraceClass.rawType);
         }
       } else {
-        // TODO(ahe): We're not storing this error in the AST.
-        buildProblem(fasta.messageInvalidCatchArguments,
+        buildCompileTimeError(fasta.messageInvalidCatchArguments,
             catchParameters.charOffset, catchParameters.charLength);
 
         var allFormals = <VariableDeclaration>[];
@@ -2681,12 +2683,12 @@
     Object catches = popList(
         catchCount, new List<Catch>.filled(catchCount, null, growable: true));
     Statement tryBlock = popStatement();
-    if (problemInTry == null) {
+    if (compileTimeErrorInTry == null) {
       push(forest.tryStatement(
           tryKeyword, tryBlock, catches, finallyKeyword, finallyBlock));
     } else {
-      push(problemInTry);
-      problemInTry = null;
+      push(compileTimeErrorInTry);
+      compileTimeErrorInTry = null;
     }
   }
 
@@ -2769,8 +2771,8 @@
       push(generator.buildPrefixIncrement(incrementOperator(token),
           offset: token.charOffset));
     } else {
-      push(wrapInProblem(
-          toValue(generator), fasta.messageNotAnLvalue, noLength));
+      push(
+          wrapInCompileTimeError(toValue(generator), fasta.messageNotAnLvalue));
     }
   }
 
@@ -2782,8 +2784,8 @@
       push(new DelayedPostfixIncrement(
           this, token, generator, incrementOperator(token), null));
     } else {
-      push(wrapInProblem(
-          toValue(generator), fasta.messageNotAnLvalue, noLength));
+      push(
+          wrapInCompileTimeError(toValue(generator), fasta.messageNotAnLvalue));
     }
   }
 
@@ -2909,12 +2911,10 @@
           isConst || constantContext != ConstantContext.none && target.isConst;
       if ((isConst || constantContext == ConstantContext.inferred) &&
           !target.isConst) {
+        var error = buildCompileTimeError(
+            fasta.messageNonConstConstructor, charOffset, charLength);
         return new InvalidConstructorInvocationJudgment(
-            buildProblem(
-                    fasta.messageNonConstConstructor, charOffset, charLength)
-                .desugared,
-            target,
-            arguments);
+            error, target, arguments);
       }
       return new ConstructorInvocationJudgment(
           target, forest.castArguments(arguments),
@@ -2927,11 +2927,10 @@
             constantContext != ConstantContext.none && procedure.isConst;
         if ((isConst || constantContext == ConstantContext.inferred) &&
             !procedure.isConst) {
+          var error = buildCompileTimeError(
+              fasta.messageNonConstFactory, charOffset, charLength);
           return new InvalidConstructorInvocationJudgment(
-              buildProblem(fasta.messageNonConstFactory, charOffset, charLength)
-                  .desugared,
-              target,
-              arguments);
+              error, target, arguments);
         }
         return new FactoryConstructorInvocationJudgment(
             target, forest.castArguments(arguments),
@@ -3043,7 +3042,7 @@
     debugEvent("beginNewExpression");
     super.push(constantContext);
     if (constantContext != ConstantContext.none) {
-      addProblem(
+      addCompileTimeError(
           fasta.templateNotConstantExpression.withArguments('New expression'),
           token.charOffset,
           token.length);
@@ -3128,8 +3127,9 @@
       int charOffset,
       Constness constness) {
     if (arguments == null) {
-      return buildProblem(fasta.messageMissingArgumentList,
-          nameToken.charOffset, nameToken.length);
+      return buildCompileTimeErrorExpression(
+          fasta.messageMissingArgumentList, nameToken.charOffset,
+          length: nameToken.length);
     }
 
     if (typeArguments != null) {
@@ -3140,8 +3140,9 @@
     String errorName;
     if (type is ClassBuilder<TypeBuilder, Object>) {
       if (type is EnumBuilder<TypeBuilder, Object>) {
-        return buildProblem(fasta.messageEnumInstantiation,
-            nameToken.charOffset, nameToken.length);
+        return buildCompileTimeErrorExpression(
+            fasta.messageEnumInstantiation, nameToken.charOffset,
+            length: nameToken.length);
       }
       Declaration b =
           type.findConstructorOrFactory(name, charOffset, uri, library);
@@ -3281,8 +3282,10 @@
         isLocalFunction: true)
       ..fileOffset = offsetForToken(nameToken);
     if (scope.local[variable.name] != null) {
-      addProblem(fasta.templateDuplicatedName.withArguments(variable.name),
-          offsetForToken(nameToken), nameToken.length);
+      addCompileTimeError(
+          fasta.templateDuplicatedName.withArguments(variable.name),
+          offsetForToken(nameToken),
+          nameToken.length);
     }
     push(new FunctionDeclarationJudgment(
         variable,
@@ -3438,8 +3441,9 @@
       ..fileOffset = beginToken.charOffset
       ..fileEndOffset = token.charOffset);
     if (constantContext != ConstantContext.none) {
-      push(buildProblem(fasta.messageNotAConstantExpression, formals.charOffset,
-          formals.charLength));
+      push(buildCompileTimeErrorExpression(
+          fasta.messageNotAConstantExpression, formals.charOffset,
+          length: formals.charLength));
     } else {
       push(new FunctionExpressionJudgment(function)
         ..fileOffset = offsetForToken(beginToken));
@@ -3502,8 +3506,8 @@
       declaresVariable = true;
       variable = lvalue;
       if (variable.isConst) {
-        addProblem(fasta.messageForInLoopWithConstVariable, variable.fileOffset,
-            variable.name.length);
+        addCompileTimeError(fasta.messageForInLoopWithConstVariable,
+            variable.fileOffset, variable.name.length);
       }
     } else if (lvalue is Generator) {
       /// We are in this case, where `lvalue` isn't a [VariableDeclaration]:
@@ -3531,7 +3535,8 @@
           : fasta.messageForInLoopNotAssignable;
       Token token = forToken.next.next;
       variable = new VariableDeclaration.forValue(
-          buildProblem(message, offsetForToken(token), lengthForToken(token)));
+          new SyntheticExpressionJudgment(buildCompileTimeError(
+              message, offsetForToken(token), lengthForToken(token))));
     }
     Statement result = new ForInJudgment(
         tokensSaver?.forInStatementTokens(awaitToken, forToken, leftParenthesis,
@@ -3600,9 +3605,8 @@
     debugEvent("RethrowStatement");
     var error = inCatchBlock
         ? null
-        : buildProblem(fasta.messageRethrowNotCatch,
-                offsetForToken(rethrowToken), lengthForToken(rethrowToken))
-            .desugared;
+        : buildCompileTimeError(fasta.messageRethrowNotCatch,
+            offsetForToken(rethrowToken), lengthForToken(rethrowToken));
     push(new ExpressionStatementJudgment(
         new RethrowJudgment(tokensSaver?.rethrowTokens(rethrowToken), error)
           ..fileOffset = offsetForToken(rethrowToken),
@@ -3665,8 +3669,9 @@
       case Assert.Expression:
         // The parser has already reported an error indicating that assert
         // cannot be used in an expression.
-        push(buildProblem(fasta.messageAssertAsExpression, assertKeyword.offset,
-            assertKeyword.length));
+        push(buildCompileTimeErrorExpression(
+            fasta.messageAssertAsExpression, assertKeyword.offset,
+            length: assertKeyword.length));
         break;
 
       case Assert.Initializer:
@@ -3713,7 +3718,7 @@
       if (scope.hasLocalLabel(labelName)) {
         // TODO(ahe): Should validate this is a goto target.
         if (!scope.claimLabel(labelName)) {
-          addProblem(
+          addCompileTimeError(
               fasta.templateDuplicateLabelInSwitchStatement
                   .withArguments(labelName),
               forest.getLabelOffset(label),
@@ -3846,19 +3851,19 @@
       target = scope.lookupLabel(name);
     }
     if (target == null && name == null) {
-      push(problemInLoopOrSwitch = buildProblemStatement(
+      push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement(
           fasta.messageBreakOutsideOfLoop, breakKeyword.charOffset));
     } else if (target == null ||
         target is! JumpTarget ||
         !target.isBreakTarget) {
       Token labelToken = breakKeyword.next;
-      push(problemInLoopOrSwitch = buildProblemStatement(
+      push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement(
           fasta.templateInvalidBreakTarget.withArguments(name),
           labelToken.charOffset,
           length: labelToken.length));
     } else if (target.functionNestingLevel != functionNestingLevel) {
       Token labelToken = breakKeyword.next;
-      push(problemInLoopOrSwitch = buildProblemStatement(
+      push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement(
           fasta.templateBreakTargetOutsideFunction.withArguments(name),
           labelToken.charOffset,
           length: labelToken.length));
@@ -3883,7 +3888,7 @@
       Declaration namedTarget = scope.lookupLabel(identifier.name);
       if (namedTarget != null && namedTarget is! JumpTarget) {
         Token labelToken = continueKeyword.next;
-        push(problemInLoopOrSwitch = buildProblemStatement(
+        push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement(
             fasta.messageContinueLabelNotTarget, labelToken.charOffset,
             length: labelToken.length));
         return;
@@ -3891,7 +3896,7 @@
       target = namedTarget;
       if (target == null) {
         if (switchScope == null) {
-          push(buildProblemStatement(
+          push(buildCompileTimeErrorStatement(
               fasta.templateLabelNotFound.withArguments(name),
               continueKeyword.next.charOffset));
           return;
@@ -3912,18 +3917,18 @@
       }
     }
     if (target == null) {
-      push(problemInLoopOrSwitch = buildProblemStatement(
+      push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement(
           fasta.messageContinueWithoutLabelInCase, continueKeyword.charOffset,
           length: continueKeyword.length));
     } else if (!target.isContinueTarget) {
       Token labelToken = continueKeyword.next;
-      push(problemInLoopOrSwitch = buildProblemStatement(
+      push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement(
           fasta.templateInvalidContinueTarget.withArguments(name),
           labelToken.charOffset,
           length: labelToken.length));
     } else if (target.functionNestingLevel != functionNestingLevel) {
       Token labelToken = continueKeyword.next;
-      push(problemInLoopOrSwitch = buildProblemStatement(
+      push(compileTimeErrorInLoopOrSwitch = buildCompileTimeErrorStatement(
           fasta.templateContinueTargetOutsideFunction.withArguments(name),
           labelToken.charOffset,
           length: labelToken.length));
@@ -4074,47 +4079,66 @@
   @override
   void handleInvalidStatement(Token token, Message message) {
     Statement statement = pop();
-    push(new InvalidStatementJudgment(
-        buildProblem(message, statement.fileOffset, noLength).desugared,
-        statement));
+    var error = buildCompileTimeError(message, statement.fileOffset, noLength);
+    push(new InvalidStatementJudgment(error, statement));
   }
 
   @override
-  SyntheticExpressionJudgment buildProblem(
-      Message message, int charOffset, int length,
+  Expression buildCompileTimeError(Message message, int charOffset, int length,
       {List<LocatedMessage> context}) {
-    addProblem(message, charOffset, length, wasHandled: true, context: context);
-    return new SyntheticExpressionJudgment(library.loader
-        .throwCompileConstantError(
-            library.loader.buildProblem(message, charOffset, length, uri)));
+    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);
   }
 
   @override
   Expression wrapInProblem(Expression expression, Message message, int length,
       {List<LocatedMessage> context}) {
-    int charOffset = forest.readOffset(expression);
+    int charOffset = expression.fileOffset;
     Severity severity = message.code.severity;
-    if (severity == Severity.error ||
+    if (severity == null) {
+      addCompileTimeError(message, charOffset, length, context: context);
+      internalProblem(
+          fasta.templateInternalProblemMissingSeverity
+              .withArguments(message.code.name),
+          charOffset,
+          uri);
+    } else if (severity == Severity.error ||
         severity == Severity.errorLegacyWarning &&
             library.loader.target.strongMode) {
-      return wrapInLocatedProblem(
-          expression, message.withLocation(uri, charOffset, length),
-          context: context);
+      return wrapInCompileTimeError(expression, message, context: context);
     } else {
       addProblem(message, charOffset, length, context: context);
-      return expression;
     }
+    return expression;
   }
 
   @override
-  Expression wrapInLocatedProblem(Expression expression, LocatedMessage message,
+  Expression wrapInLocatedCompileTimeError(
+      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(buildProblem(
-            message.messageObject, message.charOffset, message.length,
-            context: context))
+        new VariableDeclaration.forValue(new SyntheticExpressionJudgment(
+            buildCompileTimeError(
+                message.messageObject, message.charOffset, message.length,
+                context: context)))
           ..fileOffset = forest.readOffset(expression),
         new Let(
             new VariableDeclaration.forValue(expression)
@@ -4158,17 +4182,20 @@
         ], noLocation)));
   }
 
-  Statement buildProblemStatement(Message message, int charOffset,
+  Statement buildCompileTimeErrorStatement(Message message, int charOffset,
       {List<LocatedMessage> context, int length}) {
     return new ExpressionStatementJudgment(
-        buildProblem(message, charOffset, length ?? noLength, context: context),
+        new SyntheticExpressionJudgment(buildCompileTimeError(
+            message, charOffset, length ?? noLength,
+            context: context)),
         null);
   }
 
-  Statement wrapInProblemStatement(Statement statement, Message message) {
+  Statement wrapInCompileTimeErrorStatement(
+      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 buildProblemStatement(message, statement.fileOffset);
+    return buildCompileTimeErrorStatement(message, statement.fileOffset);
   }
 
   @override
@@ -4191,15 +4218,13 @@
 
   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(buildProblem(
-                fasta.templateFinalInstanceVariableAlreadyInitialized
-                    .withArguments(name),
-                offset,
-                noLength)
-            .desugared))
+        field, value, new VariableDeclaration.forValue(error))
       ..fileOffset = offset;
   }
 
@@ -4272,11 +4297,10 @@
       }
     } else {
       return buildInvalidInitializer(
-          buildProblem(
-                  fasta.templateInitializerForStaticField.withArguments(name),
-                  offset,
-                  name.length)
-              .desugared,
+          buildCompileTimeError(
+              fasta.templateInitializerForStaticField.withArguments(name),
+              offset,
+              name.length),
           offset);
     }
   }
@@ -4289,9 +4313,8 @@
       return buildInvalidSuperInitializer(
           constructor,
           forest.castArguments(arguments),
-          buildProblem(fasta.messageConstConstructorWithNonConstSuper,
-                  charOffset, constructor.name.name.length)
-              .desugared,
+          buildCompileTimeError(fasta.messageConstConstructorWithNonConstSuper,
+              charOffset, constructor.name.name.length),
           charOffset);
     }
     needsImplicitSuperInitializer = false;
@@ -4321,6 +4344,13 @@
   }
 
   @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));
@@ -4340,7 +4370,7 @@
       push(forest.block(
           token,
           <Statement>[
-            buildProblemStatement(
+            buildCompileTimeErrorStatement(
                 fasta.templateExpectedFunctionBody.withArguments(token),
                 token.charOffset,
                 length: token.length)
@@ -4356,7 +4386,7 @@
       Message message = fasta.messageTypeVariableInStaticContext;
       int length = type.parameter.name.length;
       if (nonInstanceAccessIsError) {
-        addProblem(message, offset, length, severity: Severity.error);
+        addCompileTimeError(message, offset, length);
       } else {
         addProblemErrorIfConst(message, offset, length);
       }
@@ -4398,12 +4428,11 @@
       bool isSuper: false,
       Member interfaceTarget}) {
     if (constantContext != ConstantContext.none && !isConstantExpression) {
-      error = buildProblem(
-              fasta.templateNotConstantExpression
-                  .withArguments('Method invocation'),
-              offset,
-              name.name.length)
-          .desugared;
+      error = buildCompileTimeError(
+          fasta.templateNotConstantExpression
+              .withArguments('Method invocation'),
+          offset,
+          name.name.length);
     }
     if (isSuper) {
       // We can ignore [isNullAware] on super sends.
@@ -4462,26 +4491,29 @@
   }
 
   @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,
-      {bool wasHandled: false,
-      List<LocatedMessage> context,
-      Severity severity}) {
-    library.addProblem(message, charOffset, length, uri,
-        wasHandled: wasHandled, context: context, severity: severity);
+      {List<LocatedMessage> context}) {
+    library.addProblem(message, charOffset, length, uri, context: context);
   }
 
   @override
   void addProblemErrorIfConst(Message message, int charOffset, int length,
-      {bool wasHandled: false, List<LocatedMessage> context}) {
+      {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) {
-      severity = Severity.error;
+      addCompileTimeError(message, charOffset, length, context: context);
+    } else {
+      library.addProblem(message, charOffset, length, uri, context: context);
     }
-    addProblem(message, charOffset, length,
-        wasHandled: wasHandled, context: context, severity: severity);
   }
 
   @override
@@ -4523,7 +4555,7 @@
       } else {
         nearest = '$asDouble';
       }
-      library.addProblem(
+      library.addCompileTimeError(
           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 7a06db1..d60a3a8 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(
-        helper.buildProblem(messageInvalidInitializer, offset,
-            lengthForToken(token)) /* TODO(ahe): Add .desugared here? */,
+        new SyntheticExpressionJudgment(helper.buildCompileTimeError(
+            messageInvalidInitializer, offset, lengthForToken(token))),
         offset);
   }
 
@@ -215,7 +215,7 @@
     } else {
       if (helper.constantContext != ConstantContext.none &&
           send.name != lengthName) {
-        helper.addProblem(
+        helper.addCompileTimeError(
             messageNotAConstantExpression, offsetForToken(token), token.length);
       }
       return PropertyAccessGenerator.make(helper, send.token, buildSimpleRead(),
@@ -714,10 +714,10 @@
   String get debugName => "LargeIntAccessGenerator";
 
   Expression buildError() {
-    return helper
-        .buildProblem(templateIntegerLiteralIsOutOfRange.withArguments(token),
-            offsetForToken(token), lengthForToken(token))
-        .desugared /* TODO(ahe): Remove `.desugared`? */;
+    return helper.buildCompileTimeError(
+        templateIntegerLiteralIsOutOfRange.withArguments(token),
+        offsetForToken(token),
+        lengthForToken(token));
   }
 
   @override
@@ -963,8 +963,9 @@
 
   @override
   Expression makeInvalidWrite(Expression value) {
-    return helper.buildProblem(messageIllegalAssignmentToNonAssignable,
-        offsetForToken(token), lengthForToken(token));
+    return helper.buildCompileTimeErrorExpression(
+        messageIllegalAssignmentToNonAssignable, offsetForToken(token),
+        length: token?.length);
   }
 }
 
@@ -994,8 +995,9 @@
 
   Expression handleAssignment(bool voidContext) {
     if (helper.constantContext != ConstantContext.none) {
-      return helper.buildProblem(
-          messageNotAConstantExpression, offsetForToken(token), token.length);
+      return helper.buildCompileTimeErrorExpression(
+          messageNotAConstantExpression, offsetForToken(token),
+          length: token.length);
     }
     if (identical("=", assignmentOperator)) {
       return generator.buildAssignment(value, voidContext: voidContext);
@@ -1134,7 +1136,7 @@
   @override
   /* Expression | Generator | Initializer */ doInvocation(
       int offset, Arguments arguments) {
-    var error = helper.wrapInLocatedProblem(
+    var error = helper.wrapInLocatedCompileTimeError(
         helper.evaluateArgumentsBefore(arguments, forest.literalNull(token)),
         messageCantUsePrefixAsExpression.withLocation(
             helper.uri, offsetForToken(token), lengthForToken(token)));
@@ -1157,7 +1159,7 @@
             offsetForToken(token));
       }
       if (isNullAware) {
-        result = helper.wrapInLocatedProblem(
+        result = helper.wrapInLocatedCompileTimeError(
             helper.toValue(result),
             messageCantUsePrefixWithNullAware.withLocation(
                 helper.uri, offsetForToken(token), lengthForToken(token)));
@@ -1170,8 +1172,10 @@
 
   @override
   Expression makeInvalidRead() {
-    return helper.buildProblem(messageCantUsePrefixAsExpression,
-        offsetForToken(token), lengthForToken(token));
+    return new SyntheticExpressionJudgment(helper.buildCompileTimeError(
+        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 339c43d..d50dd58 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 Scope;
+import '../scope.dart' show ProblemBuilder, Scope;
 
 import '../type_inference/inference_helper.dart' show InferenceHelper;
 
@@ -31,6 +31,7 @@
         DartType,
         Expression,
         FunctionNode,
+        FunctionType,
         Initializer,
         Member,
         Name,
@@ -71,6 +72,17 @@
 
   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(
@@ -88,6 +100,9 @@
   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,
@@ -100,6 +115,9 @@
   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(
@@ -129,6 +147,12 @@
   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});
@@ -139,7 +163,8 @@
 
   void warnTypeArgumentsMismatch(String name, int expected, int charOffset);
 
-  Expression wrapInLocatedProblem(Expression expression, LocatedMessage message,
+  Expression wrapInLocatedCompileTimeError(
+      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 e277db1..7211505 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) {
-            addProblem(
+            addCompileTimeError(
                 templateImplementsSuperClass.withArguments(interface.name),
                 charOffset,
                 noLength);
@@ -235,7 +235,7 @@
             problemsOffsets ??= new Map<ClassBuilder, int>();
             problemsOffsets[interface] ??= charOffset;
           } else if (interface.target == coreTypes.futureOrClass) {
-            addProblem(messageImplementsFutureOr, charOffset,
+            addCompileTimeError(messageImplementsFutureOr, charOffset,
                 interface.target.name.length);
           } else {
             implemented.add(interface);
@@ -245,7 +245,7 @@
     }
     if (problems != null) {
       problems.forEach((ClassBuilder interface, int repetitions) {
-        addProblem(
+        addCompileTimeError(
             templateImplementsRepeated.withArguments(
                 interface.name, repetitions),
             problemsOffsets[interface],
@@ -304,7 +304,7 @@
               var message = templateRedirectionTargetNotFound
                   .withArguments(redirectionTarget.fullNameForErrors);
               if (declaration.isConst) {
-                addProblem(message, declaration.charOffset, noLength);
+                addCompileTimeError(message, declaration.charOffset, noLength);
               } else {
                 addProblem(message, declaration.charOffset, noLength);
               }
@@ -877,12 +877,13 @@
             interfaceType);
         fileOffset = declaredParameter.fileOffset;
       }
-      library.addProblem(message, fileOffset, noLength, fileUri, context: [
-        templateOverriddenMethodCause
-            .withArguments(interfaceMember.name.name)
-            .withLocation(_getMemberUri(interfaceMember),
-                interfaceMember.fileOffset, noLength)
-      ]);
+      library.addCompileTimeError(message, fileOffset, noLength, fileUri,
+          context: [
+            templateOverriddenMethodCause
+                .withArguments(interfaceMember.name.name)
+                .withLocation(_getMemberUri(interfaceMember),
+                    interfaceMember.fileOffset, noLength)
+          ]);
       return true;
     }
     return false;
@@ -1128,7 +1129,7 @@
       int originLength = typeVariables?.length ?? 0;
       int patchLength = patch.typeVariables?.length ?? 0;
       if (originLength != patchLength) {
-        patch.addProblem(messagePatchClassTypeVariablesMismatch,
+        patch.addCompileTimeError(messagePatchClassTypeVariablesMismatch,
             patch.charOffset, noLength, context: [
           messagePatchClassOrigin.withLocation(fileUri, charOffset, noLength)
         ]);
@@ -1139,8 +1140,8 @@
         }
       }
     } else {
-      library.addProblem(messagePatchDeclarationMismatch, patch.charOffset,
-          noLength, patch.fileUri, context: [
+      library.addCompileTimeError(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 9cdc301..60288dd 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.addProblem(templateDuplicatedName.withArguments(name),
+        parent.addCompileTimeError(templateDuplicatedName.withArguments(name),
             charOffset, noLength, parent.fileUri);
         constantNamesAndOffsetsAndDocs[i + 1] = null;
         continue;
       }
       if (name == className) {
-        parent.addProblem(
+        parent.addCompileTimeError(
             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.
-      addProblem(messageNoUnnamedConstructorInObject, -1, noLength);
+      addCompileTimeError(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 9ecc44b..82944ef 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.addProblem(messageNotAConstantExpression, offset, 1);
+      helper.addCompileTimeError(messageNotAConstantExpression, offset, 1);
     }
     if (getter == null || isFieldOrGetter(getter)) {
       return helper.buildMethodInvocation(
@@ -1146,12 +1146,10 @@
     Expression error;
     if (helper.constantContext != ConstantContext.none &&
         !helper.isIdentical(readTarget)) {
-      error = helper
-          .buildProblem(
-              templateNotConstantExpression.withArguments('Method invocation'),
-              offset,
-              readTarget?.name?.name?.length ?? 0)
-          .desugared /* TODO(ahe): Remove `.desugared`? */;
+      error = helper.buildCompileTimeError(
+          templateNotConstantExpression.withArguments('Method invocation'),
+          offset,
+          readTarget?.name?.name?.length ?? 0);
     }
     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 e39f5d42..5905d5d 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,20 +36,22 @@
   Expression buildSimpleRead() {
     if (!isSuper) {
       if (inFieldInitializer) {
-        return buildFieldInitializerError(null);
+        return new SyntheticExpressionJudgment(
+            buildFieldInitializerError(null));
       } else {
         return forest.thisExpression(token);
       }
     } else {
-      return helper.buildProblem(messageSuperAsExpression,
-          offsetForToken(token), lengthForToken(token));
+      return new SyntheticExpressionJudgment(helper.buildCompileTimeError(
+          messageSuperAsExpression,
+          offsetForToken(token),
+          lengthForToken(token)));
     }
   }
 
-  SyntheticExpressionJudgment buildFieldInitializerError(
-      Map<String, int> initializedFields) {
+  Expression buildFieldInitializerError(Map<String, int> initializedFields) {
     String keyword = isSuper ? "super" : "this";
-    return helper.buildProblem(
+    return helper.buildCompileTimeError(
         templateThisOrSuperAccessInFieldInitializer.withArguments(keyword),
         offsetForToken(token),
         keyword.length);
@@ -57,7 +59,7 @@
 
   @override
   Initializer buildFieldInitializer(Map<String, int> initializedFields) {
-    Expression error = buildFieldInitializerError(initializedFields).desugared;
+    Expression error = buildFieldInitializerError(initializedFields);
     return helper.buildInvalidInitializer(error, error.fileOffset);
   }
 
@@ -68,13 +70,13 @@
     int offset = offsetForToken(send.token);
     if (isInitializer && send is SendAccessGenerator) {
       if (isNullAware) {
-        helper.addProblem(
+        helper.addCompileTimeError(
             messageInvalidUseOfNullAwareAccess, operatorOffset, 2);
       }
       return buildConstructorInitializer(offset, name, arguments);
     }
     if (inFieldInitializer && !isInitializer) {
-      return buildFieldInitializerError(null);
+      return new SyntheticExpressionJudgment(buildFieldInitializerError(null));
     }
     Member getter = helper.lookupInstanceMember(name, isSuper: isSuper);
     if (send is SendAccessGenerator) {
@@ -104,7 +106,8 @@
     if (isInitializer) {
       return buildConstructorInitializer(offset, new Name(""), arguments);
     } else if (isSuper) {
-      return helper.buildProblem(messageSuperAsExpression, offset, noLength);
+      return new SyntheticExpressionJudgment(helper.buildCompileTimeError(
+          messageSuperAsExpression, offset, noLength));
     } else {
       return helper.buildMethodInvocation(
           forest.thisExpression(null), callName, arguments, offset,
@@ -171,10 +174,10 @@
   }
 
   Expression buildAssignmentError() {
-    return helper
-        .buildProblem(isSuper ? messageCannotAssignToSuper : messageNotAnLvalue,
-            offsetForToken(token), token.length)
-        .desugared;
+    return helper.buildCompileTimeError(
+        isSuper ? messageCannotAssignToSuper : messageNotAnLvalue,
+        offsetForToken(token),
+        token.length);
   }
 
   @override
@@ -223,7 +226,7 @@
       offset = offsetForToken(token);
       length = lengthForToken(token);
     }
-    return helper.buildProblem(message, offset, length).desugared;
+    return helper.buildCompileTimeError(message, offset, length);
   }
 
   @override
@@ -392,11 +395,10 @@
   }
 
   Expression makeInvalidWrite(Expression value) {
-    return new InvalidWriteJudgment(
-        helper
-            .buildProblem(messageCannotAssignToParenthesizedExpression,
-                offsetForToken(token), lengthForToken(token))
-            .desugared,
-        expression);
+    var error = helper.buildCompileTimeError(
+        messageCannotAssignToParenthesizedExpression,
+        offsetForToken(token),
+        lengthForToken(token));
+    return new InvalidWriteJudgment(error, 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 b36a54e..fedd216 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.addProblem(templateCyclicTypedef.withArguments(name),
+        library.addCompileTimeError(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 edb9fcc..2dbf686 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.addProblem(
+    library.addCompileTimeError(
         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 0ae7b46..88a029a 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,8 +249,10 @@
       if (typeVariablesByName != null) {
         TypeVariableBuilder tv = typeVariablesByName[name];
         if (tv != null) {
-          cls.addProblem(templateConflictsWithTypeVariable.withArguments(name),
-              member.charOffset, name.length,
+          cls.addCompileTimeError(
+              templateConflictsWithTypeVariable.withArguments(name),
+              member.charOffset,
+              name.length,
               context: [
                 messageConflictsWithTypeVariableCause.withLocation(
                     tv.fileUri, tv.charOffset, name.length)
@@ -274,7 +276,7 @@
     for (TypeVariableBuilder tv in typeVariables) {
       TypeVariableBuilder existing = typeVariablesByName[tv.name];
       if (existing != null) {
-        addProblem(messageTypeVariableDuplicatedName, tv.charOffset,
+        addCompileTimeError(messageTypeVariableDuplicatedName, tv.charOffset,
             tv.name.length, fileUri,
             context: [
               templateTypeVariableDuplicatedNameCause
@@ -288,8 +290,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) {
-            addProblem(messageTypeVariableSameNameAsEnclosing, tv.charOffset,
-                tv.name.length, fileUri);
+            addCompileTimeError(messageTypeVariableSameNameAsEnclosing,
+                tv.charOffset, tv.name.length, fileUri);
           }
         }
       }
@@ -1282,7 +1284,7 @@
 
   void exportMemberFromPatch(String name, Declaration member) {
     if (uri.scheme != "dart" || !uri.path.startsWith("_")) {
-      addProblem(templatePatchInjectionFailed.withArguments(name, uri),
+      addCompileTimeError(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 b10ffcf..4c3e69c 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,8 +11,6 @@
 import '../messages.dart'
     show noLength, templateSupertypeIsIllegal, templateSupertypeIsTypeVariable;
 
-import '../severity.dart' show Severity;
-
 import 'kernel_builder.dart'
     show
         KernelClassBuilder,
@@ -42,9 +40,8 @@
     var template = declaration.isTypeVariable
         ? templateSupertypeIsTypeVariable
         : templateSupertypeIsIllegal;
-    library.addProblem(
-        template.withArguments("$name"), charOffset, noLength, fileUri,
-        severity: Severity.error);
+    library.addCompileTimeError(
+        template.withArguments("$name"), charOffset, noLength, fileUri);
     return null;
   }
 
@@ -58,12 +55,11 @@
     if (declaration is KernelClassBuilder) {
       return declaration.buildSupertype(library, arguments);
     } else if (declaration is KernelInvalidTypeBuilder) {
-      library.addProblem(
+      library.addCompileTimeError(
           declaration.message.messageObject,
           declaration.message.charOffset,
           declaration.message.length,
-          declaration.message.uri,
-          severity: Severity.error);
+          declaration.message.uri);
       return null;
     } else {
       return handleInvalidSupertype(library, charOffset, fileUri);
@@ -76,12 +72,11 @@
     if (declaration is KernelClassBuilder) {
       return declaration.buildMixedInType(library, arguments);
     } else if (declaration is KernelInvalidTypeBuilder) {
-      library.addProblem(
+      library.addCompileTimeError(
           declaration.message.messageObject,
           declaration.message.charOffset,
           declaration.message.length,
-          declaration.message.uri,
-          severity: Severity.error);
+          declaration.message.uri);
       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 c65c7b8..c9fd115 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.addProblem(
+      patch.library.addCompileTimeError(
           messagePatchNonExternal, patch.charOffset, noLength, patch.fileUri,
           context: [
             messagePatchDeclarationOrigin.withLocation(
@@ -245,8 +245,8 @@
   }
 
   void reportPatchMismatch(Declaration patch) {
-    library.addProblem(messagePatchDeclarationMismatch, patch.charOffset,
-        noLength, patch.fileUri, context: [
+    library.addCompileTimeError(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.buildProblem(message, charOffset, noLength).desugared,
+        helper.buildCompileTimeError(message, charOffset, noLength),
         charOffset);
     initializers.add(error..parent = constructor);
     initializers.add(lastInitializer);
@@ -518,10 +518,8 @@
       } else if (constructor.initializers.isNotEmpty) {
         Initializer first = constructor.initializers.first;
         Initializer error = helper.buildInvalidInitializer(
-            helper
-                .buildProblem(
-                    messageThisInitializerNotAlone, first.fileOffset, noLength)
-                .desugared,
+            helper.buildCompileTimeError(
+                messageThisInitializerNotAlone, first.fileOffset, noLength),
             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 86122bb..35f6e2a 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
@@ -657,8 +657,10 @@
       for (Initializer initializer in constructor.initializers) {
         if (initializer is RedirectingInitializer) {
           if (constructor.isConst && !initializer.target.isConst) {
-            builder.addProblem(messageConstConstructorRedirectionToNonConst,
-                initializer.fileOffset, initializer.target.name.name.length);
+            builder.addCompileTimeError(
+                messageConstConstructorRedirectionToNonConst,
+                initializer.fileOffset,
+                initializer.target.name.name.length);
           }
           isRedirecting = true;
           break;
@@ -672,7 +674,7 @@
           superTarget ??= defaultSuperConstructor(cls);
           Initializer initializer;
           if (superTarget == null) {
-            builder.addProblem(
+            builder.addCompileTimeError(
                 templateSuperclassHasNoDefaultConstructor
                     .withArguments(cls.superclass.name),
                 constructor.fileOffset,
@@ -712,7 +714,7 @@
         }
         constructorInitializedFields[constructor] = myInitializedFields;
         if (constructor.isConst && nonFinalFields.isNotEmpty) {
-          builder.addProblem(messageConstConstructorNonFinalField,
+          builder.addCompileTimeError(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 f1f9d5c..9c6044c 100644
--- a/pkg/front_end/lib/src/fasta/loader.dart
+++ b/pkg/front_end/lib/src/fasta/loader.dart
@@ -21,6 +21,7 @@
         Template,
         messagePlatformPrivateLibraryAccess,
         templateInternalProblemContextSeverity,
+        templateInternalProblemMissingSeverity,
         templateSourceBodySummary;
 
 import 'problems.dart' show internalProblem;
@@ -142,8 +143,8 @@
         !accessor.isPatch &&
         !target.backendTarget
             .allowPlatformPrivateLibraryAccess(accessor.uri, uri)) {
-      accessor.addProblem(messagePlatformPrivateLibraryAccess, charOffset,
-          noLength, accessor.fileUri);
+      accessor.addCompileTimeError(messagePlatformPrivateLibraryAccess,
+          charOffset, noLength, accessor.fileUri);
     }
     return builder;
   }
@@ -196,19 +197,37 @@
   /// 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,
-      {bool wasHandled: false,
-      List<LocatedMessage> context,
-      Severity severity}) {
-    severity ??= message.code.severity;
+      {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);
+    }
     if (severity == Severity.errorLegacyWarning) {
       severity =
           target.backendTarget.strongMode ? Severity.error : Severity.warning;
     }
     addMessage(message, charOffset, length, fileUri, severity,
-        wasHandled: wasHandled, context: context);
+        context: context);
   }
 
   /// All messages reported by the compiler (errors, warnings, etc.) are routed
@@ -217,10 +236,6 @@
   /// 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 1d0fa47..1a218f2 100644
--- a/pkg/front_end/lib/src/fasta/source/diet_listener.dart
+++ b/pkg/front_end/lib/src/fasta/source/diet_listener.dart
@@ -32,11 +32,7 @@
     show deprecated_InputError, deprecated_inputError;
 
 import '../fasta_codes.dart'
-    show
-        LocatedMessage,
-        Message,
-        messageExpectedBlockToSkip,
-        templateInternalProblemNotFound;
+    show Message, messageExpectedBlockToSkip, templateInternalProblemNotFound;
 
 import '../kernel/kernel_body_builder.dart' show KernelBodyBuilder;
 
@@ -847,10 +843,12 @@
   }
 
   @override
-  void addProblem(Message message, int charOffset, int length,
-      {bool wasHandled: false, List<LocatedMessage> context}) {
-    library.addProblem(message, charOffset, length, uri,
-        wasHandled: wasHandled, context: context);
+  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);
   }
 
   @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 d86dc3f..c3c9a85 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;
-      addProblem(messageInterpolationInUri, interpolationOffset, 1);
+      addCompileTimeError(messageInterpolationInUri, interpolationOffset, 1);
     }
   }
 
@@ -668,13 +668,14 @@
                 charOffset, uri);
         }
         String string = name;
-        addProblem(template.withArguments(name), charOffset, string.length);
+        addCompileTimeError(
+            template.withArguments(name), charOffset, string.length);
       } else {
         if (formals != null) {
           for (FormalParameterBuilder formal in formals) {
             if (!formal.isRequired) {
-              addProblem(messageOperatorWithOptionalFormals, formal.charOffset,
-                  formal.name.length);
+              addCompileTimeError(messageOperatorWithOptionalFormals,
+                  formal.charOffset, formal.name.length);
             }
           }
         }
@@ -709,7 +710,8 @@
             : library.computeAndValidateConstructorName(name, charOffset);
     if (constructorName != null) {
       if (isConst && bodyKind != MethodBody.Abstract) {
-        addProblem(messageConstConstructorWithBody, varFinalOrConstOffset, 5);
+        addCompileTimeError(
+            messageConstConstructorWithBody, varFinalOrConstOffset, 5);
         modifiers &= ~constMask;
       }
       if (returnType != null) {
@@ -736,7 +738,7 @@
           nativeMethodName);
     } else {
       if (isConst) {
-        addProblem(messageConstMethod, varFinalOrConstOffset, 5);
+        addCompileTimeError(messageConstMethod, varFinalOrConstOffset, 5);
         modifiers &= ~constMask;
       }
       final int startCharOffset =
@@ -925,7 +927,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) {
-          addProblem(
+          addCompileTimeError(
               templateDuplicatedParameterName.withArguments(formals[1].name),
               formals[1].charOffset,
               formals[1].name.length,
@@ -942,7 +944,7 @@
         for (FormalParameterBuilder formal in formals) {
           if (formal.name == null) continue;
           if (seenNames.containsKey(formal.name)) {
-            addProblem(
+            addCompileTimeError(
                 templateDuplicatedParameterName.withArguments(formal.name),
                 formal.charOffset,
                 formal.name.length,
@@ -1062,7 +1064,8 @@
         functionType = type;
       } else {
         // TODO(ahe): Improve this error message.
-        addProblem(messageTypedefNotFunction, equals.charOffset, equals.length);
+        addCompileTimeError(
+            messageTypedefNotFunction, equals.charOffset, equals.length);
       }
     }
     List<MetadataBuilder> metadata = pop();
@@ -1101,7 +1104,7 @@
     if (staticToken == null && modifiers & constMask != 0) {
       // It is a compile-time error if an instance variable is declared to be
       // constant.
-      addProblem(messageConstInstanceField, varFinalOrConst.charOffset,
+      addCompileTimeError(messageConstInstanceField, varFinalOrConst.charOffset,
           varFinalOrConst.length);
       modifiers &= ~constMask;
     }
@@ -1339,10 +1342,16 @@
     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,
-      {bool wasHandled: false, List<LocatedMessage> context}) {
-    library.addProblem(message, charOffset, length, uri,
-        wasHandled: wasHandled, context: context);
+      {List<LocatedMessage> context}) {
+    library.addProblem(message, charOffset, length, uri, 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 8df5e4a..6135e72 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.
-      addProblem(templateConflictsWithMember.withArguments(name),
+      addCompileTimeError(templateConflictsWithMember.withArguments(name),
           constructor.charOffset, noLength);
       if (constructor.isFactory) {
-        addProblem(
+        addCompileTimeError(
             templateConflictsWithFactory.withArguments("${this.name}.${name}"),
             member.charOffset,
             noLength);
       } else {
-        addProblem(
+        addCompileTimeError(
             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 37b6584..407394b 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) {
-      addProblem(messageExpectedUri, uriOffset, noLength, this.uri);
+      addCompileTimeError(messageExpectedUri, uriOffset, noLength, this.uri);
       return new Uri(scheme: MALFORMED_URI_SCHEME);
     }
     Uri parsedUri;
@@ -181,8 +181,11 @@
       // 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.)
-      addProblem(templateCouldNotParseUri.withArguments(uri, e.message),
-          uriOffset + 1 + (e.offset ?? -1), 1, this.uri);
+      addCompileTimeError(
+          templateCouldNotParseUri.withArguments(uri, e.message),
+          uriOffset + 1 + (e.offset ?? -1),
+          1,
+          this.uri);
       return new Uri(
           scheme: MALFORMED_URI_SCHEME, query: Uri.encodeQueryComponent(uri));
     }
@@ -473,7 +476,7 @@
     bool isConstructor = declaration is ProcedureBuilder &&
         (declaration.isConstructor || declaration.isFactory);
     if (!isConstructor && name == currentDeclaration.name) {
-      addProblem(
+      addCompileTimeError(
           messageMemberWithSameNameAsClass, charOffset, noLength, fileUri);
     }
     Map<String, Declaration> members = isConstructor
@@ -495,8 +498,11 @@
         other = declaration;
       }
       if (deferred != null) {
-        addProblem(templateDeferredPrefixDuplicated.withArguments(name),
-            deferred.charOffset, noLength, fileUri,
+        addCompileTimeError(
+            templateDeferredPrefixDuplicated.withArguments(name),
+            deferred.charOffset,
+            noLength,
+            fileUri,
             context: [
               templateDeferredPrefixDuplicatedCause
                   .withArguments(name)
@@ -510,8 +516,8 @@
               name, existing, member, charOffset);
         });
     } else if (isDuplicatedDefinition(existing, declaration)) {
-      addProblem(templateDuplicatedDefinition.withArguments(name), charOffset,
-          noLength, fileUri);
+      addCompileTimeError(templateDuplicatedDefinition.withArguments(name),
+          charOffset, noLength, fileUri);
     }
     return members[name] = declaration;
   }
@@ -558,10 +564,10 @@
     scope.setters.forEach((String name, Declaration setter) {
       Declaration member = scopeBuilder[name];
       if (member == null || !member.isField || member.isFinal) return;
-      addProblem(templateConflictsWithMember.withArguments(name),
+      addCompileTimeError(templateConflictsWithMember.withArguments(name),
           setter.charOffset, noLength, fileUri);
       // TODO(ahe): Context to previous message?
-      addProblem(templateConflictsWithSetter.withArguments(name),
+      addCompileTimeError(templateConflictsWithSetter.withArguments(name),
           member.charOffset, noLength, fileUri);
     });
 
@@ -594,7 +600,7 @@
     Set<Uri> seenParts = new Set<Uri>();
     for (SourceLibraryBuilder<T, R> part in parts) {
       if (part == this) {
-        addProblem(messagePartOfSelf, -1, noLength, fileUri);
+        addCompileTimeError(messagePartOfSelf, -1, noLength, fileUri);
       } else if (seenParts.add(part.fileUri)) {
         if (part.partOfLibrary != null) {
           addProblem(messagePartOfTwoLibraries, -1, noLength, part.fileUri,
@@ -608,8 +614,8 @@
           includePart(part);
         }
       } else {
-        addProblem(templatePartTwice.withArguments(part.fileUri), -1, noLength,
-            fileUri);
+        addCompileTimeError(templatePartTwice.withArguments(part.fileUri), -1,
+            noLength, fileUri);
       }
     }
   }
@@ -650,8 +656,8 @@
       // metadata annotations can be associated with it.
       assert(!part.isPart);
       if (uriIsValid(part.fileUri)) {
-        addProblem(templateMissingPartOf.withArguments(part.fileUri), -1,
-            noLength, fileUri);
+        addCompileTimeError(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 9f48ebd..a354e63 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.addProblem(error.assertionMessage, offsetForToken(token),
-            lengthForToken(token), uri);
+        library.addCompileTimeError(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].addProblem(
+        messages[message].addCompileTimeError(
             message.messageObject, message.charOffset, message.length);
       }
     }
@@ -561,11 +561,13 @@
       target.addDirectSupertype(cls, directSupertypes);
       for (ClassBuilder supertype in directSupertypes) {
         if (supertype is EnumBuilder) {
-          cls.addProblem(templateExtendingEnum.withArguments(supertype.name),
-              cls.charOffset, noLength);
+          cls.addCompileTimeError(
+              templateExtendingEnum.withArguments(supertype.name),
+              cls.charOffset,
+              noLength);
         } else if (!cls.library.mayImplementRestrictedTypes &&
             blackListedClasses.contains(supertype)) {
-          cls.addProblem(
+          cls.addCompileTimeError(
               templateExtendingRestricted.withArguments(supertype.name),
               cls.charOffset,
               noLength);
@@ -581,7 +583,7 @@
             for (Declaration constructory
                 in builder.constructors.local.values) {
               if (constructory.isConstructor && !constructory.isSynthetic) {
-                cls.addProblem(
+                cls.addCompileTimeError(
                     templateIllegalMixinDueToConstructors
                         .withArguments(builder.fullNameForErrors),
                     cls.charOffset,
@@ -597,7 +599,7 @@
           }
         }
         if (!isClassBuilder) {
-          cls.addProblem(
+          cls.addCompileTimeError(
               templateIllegalMixin.withArguments(mixedInType.fullNameForErrors),
               cls.charOffset,
               noLength);
@@ -875,7 +877,8 @@
     return target.backendTarget.throwCompileConstantError(coreTypes, error);
   }
 
-  Expression buildProblem(Message message, int offset, int length, Uri uri) {
+  Expression buildCompileTimeError(
+      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 bc7beda..c0a7db0 100644
--- a/pkg/front_end/lib/src/fasta/source/stack_listener.dart
+++ b/pkg/front_end/lib/src/fasta/source/stack_listener.dart
@@ -9,7 +9,6 @@
 
 import '../fasta_codes.dart'
     show
-        LocatedMessage,
         Message,
         messageNativeClauseShouldBeAnnotation,
         templateInternalProblemStackNotEmpty;
@@ -344,18 +343,17 @@
       return;
     }
     debugEvent("Error: ${message.message}");
-    addProblem(message, offsetForToken(startToken),
+    addCompileTimeError(message, offsetForToken(startToken),
         lengthOfSpan(startToken, endToken));
   }
 
   @override
   void handleUnescapeError(
       Message message, Token token, int stringOffset, int length) {
-    addProblem(message, token.charOffset + stringOffset, length);
+    addCompileTimeError(message, token.charOffset + stringOffset, length);
   }
 
-  void addProblem(Message message, int charOffset, int length,
-      {bool wasHandled: false, List<LocatedMessage> context});
+  void addCompileTimeError(Message message, int charOffset, int length);
 }
 
 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 22aa02d..e6d1901 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,18 +6,17 @@
 
 import '../fasta_codes.dart' show LocatedMessage, Message;
 
-import '../kernel/kernel_shadow_ast.dart' show SyntheticExpressionJudgment;
-
 abstract class InferenceHelper {
-  SyntheticExpressionJudgment buildProblem(
-      Message message, int charOffset, int length,
+  Expression wrapInCompileTimeError(Expression expression, Message message);
+
+  Expression buildCompileTimeError(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, bool wasHandled});
+      {List<LocatedMessage> context});
 
   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 362a67a..02395c0 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.addProblem(
+      _library.addCompileTimeError(
           templateCantInferTypeDueToCircularity.withArguments(_name),
           _offset,
           noLength,
@@ -704,7 +704,7 @@
         first = type;
       } else if (first != type) {
         // Types don't match.  Report an error.
-        library.addProblem(
+        library.addCompileTimeError(
             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 48d0b20..6e3610c 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.addProblem(
+          _library.addCompileTimeError(
               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 1d24bbd..f0a84d7 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,6 +105,7 @@
         ShadowClass,
         ShadowField,
         ShadowMember,
+        SyntheticExpressionJudgment,
         VariableDeclarationJudgment,
         getExplicitTypeArguments;
 
@@ -740,11 +741,10 @@
     if (!typeSchemaEnvironment.isSubtypeOf(expectedType, actualType)) {
       // Error: not assignable.  Perform error recovery.
       var parent = expression.parent;
-      var errorNode = helper.wrapInProblem(
+      var errorNode = helper.wrapInCompileTimeError(
           expression,
           (template ?? templateInvalidAssignment)
-              .withArguments(actualType, expectedType),
-          noLength);
+              .withArguments(actualType, expectedType));
       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.wrapInProblem(expression,
-            template.withArguments(actualType, expectedType), noLength);
+        var errorNode = helper.wrapInCompileTimeError(
+            expression, template.withArguments(actualType, expectedType));
         parent?.replaceChild(expression, errorNode);
         return errorNode;
       } else {
@@ -825,10 +825,10 @@
           new Let(
               new VariableDeclaration.forValue(receiver)
                 ..fileOffset = receiver.fileOffset,
-              helper.buildProblem(
+              new SyntheticExpressionJudgment(helper.buildCompileTimeError(
                   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
-            .buildProblem(templateDuplicatedNamedArgument.withArguments(name),
-                named[1].fileOffset, name.length)
-            .desugared;
+        var error = helper.buildCompileTimeError(
+            templateDuplicatedNamedArgument.withArguments(name),
+            named[1].fileOffset,
+            name.length);
         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
-              .buildProblem(templateDuplicatedNamedArgument.withArguments(name),
-                  expression.fileOffset, name.length)
-              .desugared
+          prevNamedExpression.value = helper.buildCompileTimeError(
+              templateDuplicatedNamedArgument.withArguments(name),
+              expression.fileOffset,
+              name.length)
             ..parent = prevNamedExpression;
           formalTypes.removeAt(namedTypeIndex);
           actualTypes.removeAt(namedTypeIndex);
@@ -1671,10 +1671,8 @@
           receiverType is! DynamicType &&
           receiverType != typeSchemaEnvironment.rawFunctionType) {
         var parent = expression.parent;
-        var errorNode = helper.wrapInProblem(
-            expression,
-            templateImplicitCallOfNonMethod.withArguments(receiverType),
-            noLength);
+        var errorNode = helper.wrapInCompileTimeError(expression,
+            templateImplicitCallOfNonMethod.withArguments(receiverType));
         parent?.replaceChild(expression, errorNode);
       }
       listener.methodInvocation(
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index 9387dbf..1f03eb8 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -126,6 +126,7 @@
 
 NotAConstantExpression:
   template: "Not a constant expression."
+  severity: ERROR
   analyzerCode: NOT_CONSTANT_EXPRESSION
 
 NonAsciiIdentifier:
@@ -306,6 +307,7 @@
 
 ImplementsFutureOr:
   template: "'FutureOr' can't be used in an 'implements' clause."
+  severity: ERROR
   script:
     - >-
       import 'dart:async';
@@ -340,6 +342,7 @@
 
 ExpectedIdentifier:
   template: "Expected an identifier, but got '#lexeme'."
+  severity: ERROR
   analyzerCode: MISSING_IDENTIFIER
   script: "do() {} main() {}"
 
@@ -364,6 +367,7 @@
 
 ExpectedType:
   template: "Expected a type, but got '#lexeme'."
+  severity: ERROR
   analyzerCode: EXPECTED_TYPE_NAME
 
 MissingExpressionInThrow:
@@ -480,6 +484,7 @@
 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:
     - >-
@@ -491,11 +496,13 @@
 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:
@@ -609,6 +616,7 @@
 
 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(); }"
@@ -618,6 +626,7 @@
 
 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(); }"
@@ -625,6 +634,7 @@
 
 SuperInitializerNotLast:
   template: "Can't have initializers after 'super'."
+  severity: ERROR
   analyzerCode: INVALID_SUPER_INVOCATION
   script:
     - "class C { int x; C.bad() : super(), x = 5; }"
@@ -793,6 +803,7 @@
 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() {}"
@@ -801,11 +812,13 @@
 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 {
@@ -815,6 +828,7 @@
 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 {
@@ -1138,6 +1152,7 @@
 
 ConstructorWithTypeParameters:
   template: "Constructors can't have type parameters."
+  severity: ERROR
   analyzerCode: TYPE_PARAMETER_ON_CONSTRUCTOR
   script:
     - "class C { C<T>() {} }"
@@ -1148,12 +1163,14 @@
 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() {} }"
@@ -1167,6 +1184,7 @@
 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(); }"
@@ -1222,6 +1240,7 @@
 
 MissingArgumentList:
   template: "Constructor invocations must have an argument list."
+  severity: ERROR
 
 TooFewArguments:
   template: "Too few positional arguments: #count required, #count2 given."
@@ -1246,6 +1265,7 @@
 
 EnumInstantiation:
   template: "Enums can't be instantiated."
+  severity: ERROR
   analyzerCode: INSTANTIATE_ENUM
 
 AbstractRedirectedClassInstantiation:
@@ -1461,6 +1481,10 @@
   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
@@ -1546,10 +1570,12 @@
 
 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:
@@ -1561,6 +1587,7 @@
 
 IllegalAsyncGeneratorReturnType:
   template: "Functions marked 'async*' must have a return type assignable to 'Stream'."
+  severity: ERROR
   analyzerCode: ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE
   script:
     - >-
@@ -1570,6 +1597,7 @@
 
 IllegalAsyncGeneratorVoidReturnType:
   template: "Functions marked 'async*' can't have return type 'void'."
+  severity: ERROR
   script:
     - >-
       void g() async* {
@@ -1577,6 +1605,7 @@
 
 IllegalAsyncReturnType:
   template: "Functions marked 'async' must have a return type assignable to 'Future'."
+  severity: ERROR
   analyzerCode: ILLEGAL_ASYNC_RETURN_TYPE
   script:
     - >-
@@ -1586,6 +1615,7 @@
 
 IllegalSyncGeneratorReturnType:
   template: "Functions marked 'sync*' must have a return type assignable to 'Iterable'."
+  severity: ERROR
   analyzerCode: ILLEGAL_SYNC_GENERATOR_RETURN_TYPE
   script:
     - >-
@@ -1595,6 +1625,7 @@
 
 IllegalSyncGeneratorVoidReturnType:
   template: "Functions marked 'sync*' can't have return type 'void'."
+  severity: ERROR
   script:
     - >-
       void g() sync* {
@@ -1610,13 +1641,16 @@
 
 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:
@@ -1626,6 +1660,7 @@
 
 ConflictsWithSetter:
   template: "Conflicts with setter '#name'."
+  severity: ERROR
   analyzerCode: CONFLICTS_WITH_MEMBER
 
 ConflictsWithSetterWarning:
@@ -1635,6 +1670,7 @@
 
 ConflictsWithTypeVariable:
   template: "Conflicts with type variable '#name'."
+  severity: ERROR
   analyzerCode: CONFLICTING_TYPE_VARIABLE_AND_MEMBER
 
 ConflictsWithTypeVariableCause:
@@ -1887,6 +1923,7 @@
 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';"
@@ -1951,6 +1988,7 @@
 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;"
@@ -1980,6 +2018,7 @@
 
 DuplicatedName:
   template: "'#name' is already declared in this scope."
+  severity: ERROR
   analyzerCode: DUPLICATE_DEFINITION
 
 DuplicatedNameCause:
@@ -1988,6 +2027,7 @@
 
 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; }"
@@ -1998,10 +2038,12 @@
 
 DuplicatedNamedArgument:
   template: "Duplicated named argument '#name'."
+  severity: ERROR
   analyzerCode: DUPLICATE_NAMED_ARGUMENT
 
 DuplicatedParameterName:
   template: "Duplicated parameter name '#name'."
+  severity: ERROR
   analyzerCode: DUPLICATE_DEFINITION
 
 DuplicatedParameterNameCause:
@@ -2048,10 +2090,12 @@
 
 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:
@@ -2100,6 +2144,7 @@
 
 ThisAsIdentifier:
   template: "Expected identifier, but got 'this'."
+  severity: ERROR
   analyzerCode: INVALID_REFERENCE_TO_THIS
 
 SuperAsIdentifier:
@@ -2113,6 +2158,7 @@
 
 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:
     - >-
@@ -2161,6 +2207,7 @@
 
 TypeVariableInConstantContext:
   template: "Type variables can't be used as constants."
+  severity: ERROR
   analyzerCode: TYPE_PARAMETER_IN_CONST_EXPRESSION
   declaration:
     - |
@@ -2215,10 +2262,12 @@
 
 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 {
@@ -2457,39 +2506,48 @@
 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:
@@ -2544,10 +2602,12 @@
 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>> {}
@@ -2560,6 +2620,7 @@
 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> {}
@@ -2567,6 +2628,7 @@
 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> {}
@@ -2586,6 +2648,7 @@
 
 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;
@@ -2597,6 +2660,7 @@
 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;
@@ -2613,6 +2677,7 @@
     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;
 
@@ -2623,6 +2688,7 @@
 CyclicRedirectingFactoryConstructors:
   template: "Cyclic definition of factory '#name'."
   analyzerCode: RECURSIVE_FACTORY_REDIRECT
+  severity: ERROR
   script: |
     class Foo {
       factory Foo.foo() = Foo.bar;
@@ -2633,11 +2699,13 @@
 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: |
     {
@@ -2647,6 +2715,7 @@
 
 ReturnFromVoidFunction:
   template: "Can't return a value from a void function."
+  severity: ERROR
   analyzerCode: RETURN_OF_INVALID_TYPE
   declaration: "void foo() { return 1; }"
 
@@ -2662,6 +2731,7 @@
 
 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 54290a5..0864ef9 100644
--- a/pkg/front_end/test/fasta/messages_test.dart
+++ b/pkg/front_end/test/fasta/messages_test.dart
@@ -92,7 +92,6 @@
       String analyzerCode;
       Severity severity;
       YamlNode badSeverity;
-      YamlNode unnecessarySeverity;
 
       for (String key in message.keys) {
         YamlNode node = message.nodes[key];
@@ -106,8 +105,6 @@
             severity = severityEnumValues[value];
             if (severity == null) {
               badSeverity = node;
-            } else if (severity == Severity.error) {
-              unnecessarySeverity = node;
             }
             break;
 
@@ -195,7 +192,7 @@
         if (problem != null) {
           String filename = relativize(uri);
           location ??= message.span.start;
-          int line = location.line + 1;
+          int line = location.line;
           int column = location.column;
           problem = "$filename:$line:$column: error:\n$problem";
         }
@@ -222,14 +219,6 @@
               : 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;
@@ -275,7 +264,7 @@
     buffer
       ..write(relativize(span.sourceUrl))
       ..write(":")
-      ..write(span.start.line + 1)
+      ..write(span.start.line)
       ..write(":")
       ..write(span.start.column)
       ..write(": error: ")