Fix #33415 no error for awaiting a void expression.

Bug:  33415
Change-Id: I4d4e81fef79a5bc5162e37ab07a8fe99e50c8dfc
Reviewed-on: https://dart-review.googlesource.com/60522
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index e82fa74..caff028 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -398,6 +398,7 @@
       _errorReporter.reportErrorForToken(
           CompileTimeErrorCode.AWAIT_IN_WRONG_CONTEXT, node.awaitKeyword);
     }
+    _checkForUseOfVoidResult(node.expression);
     return super.visitAwaitExpression(node);
   }
 
diff --git a/pkg/analyzer/test/generated/static_warning_code_kernel_test.dart b/pkg/analyzer/test/generated/static_warning_code_kernel_test.dart
index 92bc27e..f3c148e 100644
--- a/pkg/analyzer/test/generated/static_warning_code_kernel_test.dart
+++ b/pkg/analyzer/test/generated/static_warning_code_kernel_test.dart
@@ -1636,4 +1636,9 @@
   test_useOfVoidResult_variableDeclaration_method_ok() async {
     return super.test_useOfVoidResult_variableDeclaration_method_ok();
   }
+
+  @override
+  test_useOfVoidResult_await() async {
+    return super.test_useOfVoidResult_await();
+  }
 }
diff --git a/pkg/analyzer/test/generated/static_warning_code_test.dart b/pkg/analyzer/test/generated/static_warning_code_test.dart
index 222f88e..1417d23 100644
--- a/pkg/analyzer/test/generated/static_warning_code_test.dart
+++ b/pkg/analyzer/test/generated/static_warning_code_test.dart
@@ -4489,4 +4489,15 @@
     await computeAnalysisResult(source);
     assertNoErrors(source);
   }
+
+  test_useOfVoidResult_await() async {
+    Source source = addSource(r'''
+main() async {
+  void x;
+  await x;
+}''');
+    await computeAnalysisResult(source);
+    assertErrors(source, [StaticWarningCode.USE_OF_VOID_RESULT]);
+    verify([source]);
+  }
 }
diff --git a/pkg/async_helper/lib/async_helper.dart b/pkg/async_helper/lib/async_helper.dart
index 46360f9..961d1d6 100644
--- a/pkg/async_helper/lib/async_helper.dart
+++ b/pkg/async_helper/lib/async_helper.dart
@@ -23,6 +23,8 @@
 
 library async_helper;
 
+import 'dart:async';
+
 bool _initialized = false;
 int _asyncLevel = 0;
 
@@ -81,7 +83,7 @@
  *
  * [f] must return a [:Future:] for the test computation.
  */
-void asyncTest(f()) {
+Future<void> asyncTest(f()) {
   asyncStart();
-  f().then(asyncSuccess);
+  return f().then(asyncSuccess);
 }
diff --git a/pkg/front_end/test/incremental_dart2js_load_from_dill_test.dart b/pkg/front_end/test/incremental_dart2js_load_from_dill_test.dart
index d9a9cad..ea0190d 100644
--- a/pkg/front_end/test/incremental_dart2js_load_from_dill_test.dart
+++ b/pkg/front_end/test/incremental_dart2js_load_from_dill_test.dart
@@ -2,6 +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 'dart:async' show Future;
 import 'dart:io' show Directory, File;
 
 import 'package:expect/expect.dart' show Expect;
@@ -22,7 +23,7 @@
   }
 }
 
-void testDart2jsCompile() async {
+Future<void> testDart2jsCompile() async {
   final Uri dart2jsUrl = Uri.base.resolve("pkg/compiler/bin/dart2js.dart");
   final Uri invalidateUri = Uri.parse("package:compiler/src/filenames.dart");
   Uri normalDill = outDir.uri.resolve("dart2js.full.dill");
diff --git a/tests/co19_2/co19_2-analyzer.status b/tests/co19_2/co19_2-analyzer.status
index d94473f..bbb17dd 100644
--- a/tests/co19_2/co19_2-analyzer.status
+++ b/tests/co19_2/co19_2-analyzer.status
@@ -2782,6 +2782,9 @@
 LibTest/io/RandomAccessFile/writeString_A01_t03: CompileTimeError # Dart 1 constants, https://github.com/dart-lang/sdk/issues/33894
 LibTest/io/Stdin/readLineSync_A03_t01: CompileTimeError # Dart 1 constants, https://github.com/dart-lang/sdk/issues/33894
 LibTest/io/Stdin/readLineSync_A03_t02: CompileTimeError # Dart 1 constants, https://github.com/dart-lang/sdk/issues/33894
+LibTest/io/Stdin/readLineSync_A03_t03: CompileTimeError # Erroneously awaits void
+LibTest/io/Stdin/readLineSync_A03_t04: CompileTimeError # Erroneously awaits void
+LibTest/io/Stdin/readLineSync_A04_t01: CompileTimeError # Erroneously awaits void
 LibTest/io/Stdout/add_A02_t01: CompileTimeError # Dart 1 constants, https://github.com/dart-lang/sdk/issues/33894
 LibTest/io/Stdout/encoding_A01_t01: CompileTimeError # Dart 1 constants, https://github.com/dart-lang/sdk/issues/33894
 LibTest/io/Stdout/writeAll_A01_t02: CompileTimeError # Dart 1 constants, https://github.com/dart-lang/sdk/issues/33894
diff --git a/tools/patch_sdk.dart b/tools/patch_sdk.dart
index e32065c..b4ca60d 100644
--- a/tools/patch_sdk.dart
+++ b/tools/patch_sdk.dart
@@ -146,7 +146,7 @@
       throw "Unknown mode: $mode";
   }
 
-  await _writeSync(
+  _writeSync(
       librariesJson.toFilePath(),
       jsonEncode({
         mode: {"libraries": locations}