more fasta parser tests

Change-Id: I41f45835ca36fc5752ae537e67dce55299493e43
Reviewed-on: https://dart-review.googlesource.com/c/78260
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
diff --git a/pkg/front_end/testcases/compile.status b/pkg/front_end/testcases/compile.status
index ee5dcfb..fc3078a 100644
--- a/pkg/front_end/testcases/compile.status
+++ b/pkg/front_end/testcases/compile.status
@@ -11,6 +11,7 @@
 bug31124: RuntimeError # Test has no main method (and we shouldn't add one).
 call: Fail # Test can't run.
 constructor_const_inference: RuntimeError # Test exercises strong mode semantics.  See also Issue #33813.
+constructor_initializer_invalid: RuntimeError # Fails execution after recovery
 external_import: RuntimeError # Expected -- test uses import which doesn't exist.
 fallthrough: Fail # Missing FallThroughError.
 function_type_recovery: Fail
diff --git a/pkg/front_end/testcases/constructor_initializer_invalid.dart b/pkg/front_end/testcases/constructor_initializer_invalid.dart
new file mode 100644
index 0000000..3ce86d2
--- /dev/null
+++ b/pkg/front_end/testcases/constructor_initializer_invalid.dart
@@ -0,0 +1,17 @@
+// Copyright (c) 2018, the Dart project authors.  Please see the AUTHORS file
+// 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.
+
+class C1 { int f; C1() : ; }
+class C2 { int f; C2() : f; }
+class C3 { int f; C3() : f++; }
+
+main() {
+  var c1 = new C1();
+  c1.toString();
+  var c2 = new C2();
+  c2.toString();
+  var c3 = new C3();
+  c3.toString();
+}
+
diff --git a/pkg/front_end/testcases/constructor_initializer_invalid.dart.direct.expect b/pkg/front_end/testcases/constructor_initializer_invalid.dart.direct.expect
new file mode 100644
index 0000000..6b42a4b
--- /dev/null
+++ b/pkg/front_end/testcases/constructor_initializer_invalid.dart.direct.expect
@@ -0,0 +1,72 @@
+// Formatted problems:
+//
+// pkg/front_end/testcases/constructor_initializer_invalid.dart:5:24: Error: Expected an initializer.
+// class C1 { int f; C1() : ; }
+//                        ^
+//
+// pkg/front_end/testcases/constructor_initializer_invalid.dart:6:26: Error: Expected an assignment after the field name.
+// To initialize a field, use the syntax 'name = value'.
+// class C2 { int f; C2() : f; }
+//                          ^
+//
+// pkg/front_end/testcases/constructor_initializer_invalid.dart:7:26: Error: Expected an assignment after the field name.
+// To initialize a field, use the syntax 'name = value'.
+// class C3 { int f; C3() : f++; }
+//                          ^
+//
+// pkg/front_end/testcases/constructor_initializer_invalid.dart:7:26: Error: Can't access 'this' in a field initializer to read 'f'.
+// class C3 { int f; C3() : f++; }
+//                          ^
+
+// Unhandled errors:
+//
+// pkg/front_end/testcases/constructor_initializer_invalid.dart:5:24: Error: Expected an initializer.
+// class C1 { int f; C1() : ; }
+//                        ^
+//
+// pkg/front_end/testcases/constructor_initializer_invalid.dart:6:26: Error: Expected an assignment after the field name.
+// To initialize a field, use the syntax 'name = value'.
+// class C2 { int f; C2() : f; }
+//                          ^
+//
+// pkg/front_end/testcases/constructor_initializer_invalid.dart:7:26: Error: Expected an assignment after the field name.
+// To initialize a field, use the syntax 'name = value'.
+// class C3 { int f; C3() : f++; }
+//                          ^
+
+library;
+import self as self;
+import "dart:core" as core;
+
+class C1 extends core::Object {
+  field core::int f = null;
+  constructor •() → self::C1
+    : final dynamic #t1 = invalid-expression "pkg/front_end/testcases/constructor_initializer_invalid.dart:5:26: Error: This couldn't be parsed.
+class C1 { int f; C1() : ; }
+                         ^"
+    ;
+}
+class C2 extends core::Object {
+  field core::int f;
+  constructor •() → self::C2
+    : self::C2::f = invalid-expression "pkg/front_end/testcases/constructor_initializer_invalid.dart:6:27: Error: This couldn't be parsed.
+class C2 { int f; C2() : f; }
+                          ^", super core::Object::•()
+    ;
+}
+class C3 extends core::Object {
+  field core::int f = null;
+  constructor •() → self::C3
+    : final dynamic #t2 = invalid-expression "pkg/front_end/testcases/constructor_initializer_invalid.dart:7:26: Error: This couldn't be parsed.
+class C3 { int f; C3() : f++; }
+                         ^"
+    ;
+}
+static method main() → dynamic {
+  dynamic c1 = new self::C1::•();
+  c1.toString();
+  dynamic c2 = new self::C2::•();
+  c2.toString();
+  dynamic c3 = new self::C3::•();
+  c3.toString();
+}
diff --git a/pkg/front_end/testcases/constructor_initializer_invalid.dart.direct.transformed.expect b/pkg/front_end/testcases/constructor_initializer_invalid.dart.direct.transformed.expect
new file mode 100644
index 0000000..8d747d5
--- /dev/null
+++ b/pkg/front_end/testcases/constructor_initializer_invalid.dart.direct.transformed.expect
@@ -0,0 +1,52 @@
+// Unhandled errors:
+//
+// pkg/front_end/testcases/constructor_initializer_invalid.dart:5:24: Error: Expected an initializer.
+// class C1 { int f; C1() : ; }
+//                        ^
+//
+// pkg/front_end/testcases/constructor_initializer_invalid.dart:6:26: Error: Expected an assignment after the field name.
+// To initialize a field, use the syntax 'name = value'.
+// class C2 { int f; C2() : f; }
+//                          ^
+//
+// pkg/front_end/testcases/constructor_initializer_invalid.dart:7:26: Error: Expected an assignment after the field name.
+// To initialize a field, use the syntax 'name = value'.
+// class C3 { int f; C3() : f++; }
+//                          ^
+
+library;
+import self as self;
+import "dart:core" as core;
+
+class C1 extends core::Object {
+  field core::int f = null;
+  constructor •() → self::C1
+    : final dynamic #t1 = invalid-expression "pkg/front_end/testcases/constructor_initializer_invalid.dart:5:26: Error: This couldn't be parsed.
+class C1 { int f; C1() : ; }
+                         ^"
+    ;
+}
+class C2 extends core::Object {
+  field core::int f;
+  constructor •() → self::C2
+    : self::C2::f = invalid-expression "pkg/front_end/testcases/constructor_initializer_invalid.dart:6:27: Error: This couldn't be parsed.
+class C2 { int f; C2() : f; }
+                          ^", super core::Object::•()
+    ;
+}
+class C3 extends core::Object {
+  field core::int f = null;
+  constructor •() → self::C3
+    : final dynamic #t2 = invalid-expression "pkg/front_end/testcases/constructor_initializer_invalid.dart:7:26: Error: This couldn't be parsed.
+class C3 { int f; C3() : f++; }
+                         ^"
+    ;
+}
+static method main() → dynamic {
+  dynamic c1 = new self::C1::•();
+  c1.toString();
+  dynamic c2 = new self::C2::•();
+  c2.toString();
+  dynamic c3 = new self::C3::•();
+  c3.toString();
+}
diff --git a/pkg/front_end/testcases/constructor_initializer_invalid.dart.outline.expect b/pkg/front_end/testcases/constructor_initializer_invalid.dart.outline.expect
new file mode 100644
index 0000000..407b220
--- /dev/null
+++ b/pkg/front_end/testcases/constructor_initializer_invalid.dart.outline.expect
@@ -0,0 +1,37 @@
+// Formatted problems:
+//
+// pkg/front_end/testcases/constructor_initializer_invalid.dart:5:24: Error: Expected an initializer.
+// class C1 { int f; C1() : ; }
+//                        ^
+//
+// pkg/front_end/testcases/constructor_initializer_invalid.dart:6:26: Error: Expected an assignment after the field name.
+// To initialize a field, use the syntax 'name = value'.
+// class C2 { int f; C2() : f; }
+//                          ^
+//
+// pkg/front_end/testcases/constructor_initializer_invalid.dart:7:26: Error: Expected an assignment after the field name.
+// To initialize a field, use the syntax 'name = value'.
+// class C3 { int f; C3() : f++; }
+//                          ^
+
+library;
+import self as self;
+import "dart:core" as core;
+
+class C1 extends core::Object {
+  field core::int f;
+  constructor •() → self::C1
+    ;
+}
+class C2 extends core::Object {
+  field core::int f;
+  constructor •() → self::C2
+    ;
+}
+class C3 extends core::Object {
+  field core::int f;
+  constructor •() → self::C3
+    ;
+}
+static method main() → dynamic
+  ;
diff --git a/pkg/front_end/testcases/constructor_initializer_invalid.dart.strong.expect b/pkg/front_end/testcases/constructor_initializer_invalid.dart.strong.expect
new file mode 100644
index 0000000..5e45093
--- /dev/null
+++ b/pkg/front_end/testcases/constructor_initializer_invalid.dart.strong.expect
@@ -0,0 +1,72 @@
+// Formatted problems:
+//
+// pkg/front_end/testcases/constructor_initializer_invalid.dart:5:24: Error: Expected an initializer.
+// class C1 { int f; C1() : ; }
+//                        ^
+//
+// pkg/front_end/testcases/constructor_initializer_invalid.dart:6:26: Error: Expected an assignment after the field name.
+// To initialize a field, use the syntax 'name = value'.
+// class C2 { int f; C2() : f; }
+//                          ^
+//
+// pkg/front_end/testcases/constructor_initializer_invalid.dart:7:26: Error: Expected an assignment after the field name.
+// To initialize a field, use the syntax 'name = value'.
+// class C3 { int f; C3() : f++; }
+//                          ^
+//
+// pkg/front_end/testcases/constructor_initializer_invalid.dart:7:26: Error: Can't access 'this' in a field initializer to read 'f'.
+// class C3 { int f; C3() : f++; }
+//                          ^
+
+// Unhandled errors:
+//
+// pkg/front_end/testcases/constructor_initializer_invalid.dart:5:24: Error: Expected an initializer.
+// class C1 { int f; C1() : ; }
+//                        ^
+//
+// pkg/front_end/testcases/constructor_initializer_invalid.dart:6:26: Error: Expected an assignment after the field name.
+// To initialize a field, use the syntax 'name = value'.
+// class C2 { int f; C2() : f; }
+//                          ^
+//
+// pkg/front_end/testcases/constructor_initializer_invalid.dart:7:26: Error: Expected an assignment after the field name.
+// To initialize a field, use the syntax 'name = value'.
+// class C3 { int f; C3() : f++; }
+//                          ^
+
+library;
+import self as self;
+import "dart:core" as core;
+
+class C1 extends core::Object {
+  field core::int f = null;
+  constructor •() → self::C1
+    : final dynamic #t1 = invalid-expression "pkg/front_end/testcases/constructor_initializer_invalid.dart:5:26: Error: This couldn't be parsed.
+class C1 { int f; C1() : ; }
+                         ^"
+    ;
+}
+class C2 extends core::Object {
+  field core::int f;
+  constructor •() → self::C2
+    : self::C2::f = invalid-expression "pkg/front_end/testcases/constructor_initializer_invalid.dart:6:27: Error: This couldn't be parsed.
+class C2 { int f; C2() : f; }
+                          ^" as{TypeError} core::int, super core::Object::•()
+    ;
+}
+class C3 extends core::Object {
+  field core::int f = null;
+  constructor •() → self::C3
+    : final dynamic #t2 = invalid-expression "pkg/front_end/testcases/constructor_initializer_invalid.dart:7:26: Error: This couldn't be parsed.
+class C3 { int f; C3() : f++; }
+                         ^"
+    ;
+}
+static method main() → dynamic {
+  self::C1 c1 = new self::C1::•();
+  c1.{core::Object::toString}();
+  self::C2 c2 = new self::C2::•();
+  c2.{core::Object::toString}();
+  self::C3 c3 = new self::C3::•();
+  c3.{core::Object::toString}();
+}
diff --git a/pkg/front_end/testcases/constructor_initializer_invalid.dart.strong.transformed.expect b/pkg/front_end/testcases/constructor_initializer_invalid.dart.strong.transformed.expect
new file mode 100644
index 0000000..bfe868c
--- /dev/null
+++ b/pkg/front_end/testcases/constructor_initializer_invalid.dart.strong.transformed.expect
@@ -0,0 +1,52 @@
+// Unhandled errors:
+//
+// pkg/front_end/testcases/constructor_initializer_invalid.dart:5:24: Error: Expected an initializer.
+// class C1 { int f; C1() : ; }
+//                        ^
+//
+// pkg/front_end/testcases/constructor_initializer_invalid.dart:6:26: Error: Expected an assignment after the field name.
+// To initialize a field, use the syntax 'name = value'.
+// class C2 { int f; C2() : f; }
+//                          ^
+//
+// pkg/front_end/testcases/constructor_initializer_invalid.dart:7:26: Error: Expected an assignment after the field name.
+// To initialize a field, use the syntax 'name = value'.
+// class C3 { int f; C3() : f++; }
+//                          ^
+
+library;
+import self as self;
+import "dart:core" as core;
+
+class C1 extends core::Object {
+  field core::int f = null;
+  constructor •() → self::C1
+    : final dynamic #t1 = invalid-expression "pkg/front_end/testcases/constructor_initializer_invalid.dart:5:26: Error: This couldn't be parsed.
+class C1 { int f; C1() : ; }
+                         ^"
+    ;
+}
+class C2 extends core::Object {
+  field core::int f;
+  constructor •() → self::C2
+    : self::C2::f = invalid-expression "pkg/front_end/testcases/constructor_initializer_invalid.dart:6:27: Error: This couldn't be parsed.
+class C2 { int f; C2() : f; }
+                          ^" as{TypeError} core::int, super core::Object::•()
+    ;
+}
+class C3 extends core::Object {
+  field core::int f = null;
+  constructor •() → self::C3
+    : final dynamic #t2 = invalid-expression "pkg/front_end/testcases/constructor_initializer_invalid.dart:7:26: Error: This couldn't be parsed.
+class C3 { int f; C3() : f++; }
+                         ^"
+    ;
+}
+static method main() → dynamic {
+  self::C1 c1 = new self::C1::•();
+  c1.{core::Object::toString}();
+  self::C2 c2 = new self::C2::•();
+  c2.{core::Object::toString}();
+  self::C3 c3 = new self::C3::•();
+  c3.{core::Object::toString}();
+}
diff --git a/pkg/front_end/testcases/regress/issue_34614.dart b/pkg/front_end/testcases/regress/issue_34614.dart
new file mode 100644
index 0000000..aedbef3a
--- /dev/null
+++ b/pkg/front_end/testcases/regress/issue_34614.dart
@@ -0,0 +1,11 @@
+// Copyright (c) 2018, the Dart project authors.  Please see the AUTHORS file
+// 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.
+
+class C { C. }
+
+main() {
+  var c = new C();
+  c.toString();
+}
+
diff --git a/pkg/front_end/testcases/regress/issue_34614.dart.direct.expect b/pkg/front_end/testcases/regress/issue_34614.dart.direct.expect
new file mode 100644
index 0000000..004bcd9
--- /dev/null
+++ b/pkg/front_end/testcases/regress/issue_34614.dart.direct.expect
@@ -0,0 +1,43 @@
+// Formatted problems:
+//
+// pkg/front_end/testcases/regress/issue_34614.dart:5:14: Error: Expected an identifier, but got '}'.
+// class C { C. }
+//              ^
+//
+// pkg/front_end/testcases/regress/issue_34614.dart:5:11: Error: A method declaration needs an explicit list of parameters.
+// Try adding a parameter list to the method declaration.
+// class C { C. }
+//           ^
+//
+// pkg/front_end/testcases/regress/issue_34614.dart:5:14: Error: Expected '{' before this.
+// class C { C. }
+//              ^
+
+// Unhandled errors:
+//
+// pkg/front_end/testcases/regress/issue_34614.dart:5:14: Error: Expected an identifier, but got '}'.
+// class C { C. }
+//              ^
+//
+// pkg/front_end/testcases/regress/issue_34614.dart:5:11: Error: A method declaration needs an explicit list of parameters.
+// Try adding a parameter list to the method declaration.
+// class C { C. }
+//           ^
+//
+// pkg/front_end/testcases/regress/issue_34614.dart:5:14: Error: Expected '{' before this.
+// class C { C. }
+//              ^
+
+library;
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+  synthetic constructor •() → self::C
+    : super core::Object::•()
+    ;
+}
+static method main() → dynamic {
+  dynamic c = new self::C::•();
+  c.toString();
+}
diff --git a/pkg/front_end/testcases/regress/issue_34614.dart.direct.transformed.expect b/pkg/front_end/testcases/regress/issue_34614.dart.direct.transformed.expect
new file mode 100644
index 0000000..85f5296
--- /dev/null
+++ b/pkg/front_end/testcases/regress/issue_34614.dart.direct.transformed.expect
@@ -0,0 +1,28 @@
+// Unhandled errors:
+//
+// pkg/front_end/testcases/regress/issue_34614.dart:5:14: Error: Expected an identifier, but got '}'.
+// class C { C. }
+//              ^
+//
+// pkg/front_end/testcases/regress/issue_34614.dart:5:11: Error: A method declaration needs an explicit list of parameters.
+// Try adding a parameter list to the method declaration.
+// class C { C. }
+//           ^
+//
+// pkg/front_end/testcases/regress/issue_34614.dart:5:14: Error: Expected '{' before this.
+// class C { C. }
+//              ^
+
+library;
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+  synthetic constructor •() → self::C
+    : super core::Object::•()
+    ;
+}
+static method main() → dynamic {
+  dynamic c = new self::C::•();
+  c.toString();
+}
diff --git a/pkg/front_end/testcases/regress/issue_34614.dart.outline.expect b/pkg/front_end/testcases/regress/issue_34614.dart.outline.expect
new file mode 100644
index 0000000..6cd7c77
--- /dev/null
+++ b/pkg/front_end/testcases/regress/issue_34614.dart.outline.expect
@@ -0,0 +1,25 @@
+// Formatted problems:
+//
+// pkg/front_end/testcases/regress/issue_34614.dart:5:14: Error: Expected an identifier, but got '}'.
+// class C { C. }
+//              ^
+//
+// pkg/front_end/testcases/regress/issue_34614.dart:5:11: Error: A method declaration needs an explicit list of parameters.
+// Try adding a parameter list to the method declaration.
+// class C { C. }
+//           ^
+//
+// pkg/front_end/testcases/regress/issue_34614.dart:5:14: Error: Expected '{' before this.
+// class C { C. }
+//              ^
+
+library;
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+  synthetic constructor •() → self::C
+    ;
+}
+static method main() → dynamic
+  ;
diff --git a/pkg/front_end/testcases/regress/issue_34614.dart.strong.expect b/pkg/front_end/testcases/regress/issue_34614.dart.strong.expect
new file mode 100644
index 0000000..d36a30c
--- /dev/null
+++ b/pkg/front_end/testcases/regress/issue_34614.dart.strong.expect
@@ -0,0 +1,43 @@
+// Formatted problems:
+//
+// pkg/front_end/testcases/regress/issue_34614.dart:5:14: Error: Expected an identifier, but got '}'.
+// class C { C. }
+//              ^
+//
+// pkg/front_end/testcases/regress/issue_34614.dart:5:11: Error: A method declaration needs an explicit list of parameters.
+// Try adding a parameter list to the method declaration.
+// class C { C. }
+//           ^
+//
+// pkg/front_end/testcases/regress/issue_34614.dart:5:14: Error: Expected '{' before this.
+// class C { C. }
+//              ^
+
+// Unhandled errors:
+//
+// pkg/front_end/testcases/regress/issue_34614.dart:5:14: Error: Expected an identifier, but got '}'.
+// class C { C. }
+//              ^
+//
+// pkg/front_end/testcases/regress/issue_34614.dart:5:11: Error: A method declaration needs an explicit list of parameters.
+// Try adding a parameter list to the method declaration.
+// class C { C. }
+//           ^
+//
+// pkg/front_end/testcases/regress/issue_34614.dart:5:14: Error: Expected '{' before this.
+// class C { C. }
+//              ^
+
+library;
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+  synthetic constructor •() → self::C
+    : super core::Object::•()
+    ;
+}
+static method main() → dynamic {
+  self::C c = new self::C::•();
+  c.{core::Object::toString}();
+}
diff --git a/pkg/front_end/testcases/regress/issue_34614.dart.strong.transformed.expect b/pkg/front_end/testcases/regress/issue_34614.dart.strong.transformed.expect
new file mode 100644
index 0000000..225711f
--- /dev/null
+++ b/pkg/front_end/testcases/regress/issue_34614.dart.strong.transformed.expect
@@ -0,0 +1,28 @@
+// Unhandled errors:
+//
+// pkg/front_end/testcases/regress/issue_34614.dart:5:14: Error: Expected an identifier, but got '}'.
+// class C { C. }
+//              ^
+//
+// pkg/front_end/testcases/regress/issue_34614.dart:5:11: Error: A method declaration needs an explicit list of parameters.
+// Try adding a parameter list to the method declaration.
+// class C { C. }
+//           ^
+//
+// pkg/front_end/testcases/regress/issue_34614.dart:5:14: Error: Expected '{' before this.
+// class C { C. }
+//              ^
+
+library;
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+  synthetic constructor •() → self::C
+    : super core::Object::•()
+    ;
+}
+static method main() → dynamic {
+  self::C c = new self::C::•();
+  c.{core::Object::toString}();
+}
diff --git a/pkg/front_end/testcases/strong.status b/pkg/front_end/testcases/strong.status
index 321eb12..2e05e3e 100644
--- a/pkg/front_end/testcases/strong.status
+++ b/pkg/front_end/testcases/strong.status
@@ -21,6 +21,7 @@
 casts: Fail
 classes: Fail
 closure: Fail
+constructor_initializer_invalid: RuntimeError # Fails execution after recovery
 covariant_generic: Fail
 cycles: Fail
 default_values: Fail