Add frontend testcases for part with part(s) in it

Currently there's at least two issues:
* We can crash
* We can add metadata to things they weren't meant for

Change-Id: I4e277ea614ce9faa25b2bf1c5a16a5e877df225b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106640
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
This commit is contained in:
Jens Johansen 2019-06-19 10:56:55 +00:00 committed by commit-bot@chromium.org
parent 16eee4a141
commit a878514cf5
15 changed files with 180 additions and 0 deletions

View file

@ -0,0 +1,8 @@
@Foo
part 'having_part_with_part_and_annotation_lib1.dart';
const int Foo = 42;
void fromMain() {}
main() {}

View file

@ -0,0 +1,21 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/having_part_with_part_and_annotation_lib1.dart:4:6: Error: A file that's a part of a library can't have parts itself.
// Try moving the 'part' declaration to the containing library.
// part 'having_part_with_part_and_annotation_lib2.dart';
// ^
// pkg/front_end/testcases/having_part_with_part_and_annotation.dart: Context: This is the containing library.
//
import self as self;
import "dart:core" as core;
@self::Foo
@self::Bar
part having_part_with_part_and_annotation_lib1.dart;
static const field core::int Foo = 42;
static const field core::int Bar = 43 /* from org-dartlang-testcase:///having_part_with_part_and_annotation_lib1.dart */;
static method fromMain() → void {}
static method main() → dynamic {}
static method /* from org-dartlang-testcase:///having_part_with_part_and_annotation_lib1.dart */ fromLib1() → void {}

View file

@ -0,0 +1,21 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/having_part_with_part_and_annotation_lib1.dart:4:6: Error: A file that's a part of a library can't have parts itself.
// Try moving the 'part' declaration to the containing library.
// part 'having_part_with_part_and_annotation_lib2.dart';
// ^
// pkg/front_end/testcases/having_part_with_part_and_annotation.dart: Context: This is the containing library.
//
import self as self;
import "dart:core" as core;
@self::Foo
@self::Bar
part having_part_with_part_and_annotation_lib1.dart;
static const field core::int Foo = 42;
static const field core::int Bar = 43 /* from org-dartlang-testcase:///having_part_with_part_and_annotation_lib1.dart */;
static method fromMain() → void {}
static method main() → dynamic {}
static method /* from org-dartlang-testcase:///having_part_with_part_and_annotation_lib1.dart */ fromLib1() → void {}

View file

@ -0,0 +1,22 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/having_part_with_part_and_annotation_lib1.dart:4:6: Error: A file that's a part of a library can't have parts itself.
// Try moving the 'part' declaration to the containing library.
// part 'having_part_with_part_and_annotation_lib2.dart';
// ^
// pkg/front_end/testcases/having_part_with_part_and_annotation.dart: Context: This is the containing library.
//
import self as self;
import "dart:core" as core;
part having_part_with_part_and_annotation_lib1.dart;
static const field core::int Foo = 42;
static const field core::int Bar = 43 /* from org-dartlang-testcase:///having_part_with_part_and_annotation_lib1.dart */;
static method fromMain() → void
;
static method main() → dynamic
;
static method /* from org-dartlang-testcase:///having_part_with_part_and_annotation_lib1.dart */ fromLib1() → void
;

View file

@ -0,0 +1,21 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/having_part_with_part_and_annotation_lib1.dart:4:6: Error: A file that's a part of a library can't have parts itself.
// Try moving the 'part' declaration to the containing library.
// part 'having_part_with_part_and_annotation_lib2.dart';
// ^
// pkg/front_end/testcases/having_part_with_part_and_annotation.dart: Context: This is the containing library.
//
import self as self;
import "dart:core" as core;
@self::Foo
@self::Bar
part having_part_with_part_and_annotation_lib1.dart;
static const field core::int Foo = 42;
static const field core::int Bar = 43 /* from org-dartlang-testcase:///having_part_with_part_and_annotation_lib1.dart */;
static method fromMain() → void {}
static method main() → dynamic {}
static method /* from org-dartlang-testcase:///having_part_with_part_and_annotation_lib1.dart */ fromLib1() → void {}

View file

@ -0,0 +1,21 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/having_part_with_part_and_annotation_lib1.dart:4:6: Error: A file that's a part of a library can't have parts itself.
// Try moving the 'part' declaration to the containing library.
// part 'having_part_with_part_and_annotation_lib2.dart';
// ^
// pkg/front_end/testcases/having_part_with_part_and_annotation.dart: Context: This is the containing library.
//
import self as self;
import "dart:core" as core;
@self::Foo
@self::Bar
part having_part_with_part_and_annotation_lib1.dart;
static const field core::int Foo = 42;
static const field core::int Bar = 43 /* from org-dartlang-testcase:///having_part_with_part_and_annotation_lib1.dart */;
static method fromMain() → void {}
static method main() → dynamic {}
static method /* from org-dartlang-testcase:///having_part_with_part_and_annotation_lib1.dart */ fromLib1() → void {}

View file

@ -0,0 +1,8 @@
part of 'having_part_with_part_and_annotation.dart';
@Bar
part 'having_part_with_part_and_annotation_lib2.dart';
const int Bar = 43;
void fromLib1() {}

View file

@ -0,0 +1,3 @@
part of 'having_part_with_part_and_annotation_lib1.dart';
void fromLib2() {}

View file

@ -0,0 +1,8 @@
@Foo
part 'having_part_with_parts_and_annotation_lib1.dart';
const int Foo = 42;
void fromMain() {}
main() {}

View file

@ -0,0 +1,29 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/having_part_with_parts_and_annotation_lib1.dart:4:6: Error: A file that's a part of a library can't have parts itself.
// Try moving the 'part' declaration to the containing library.
// part 'having_part_with_parts_and_annotation_lib2.dart';
// ^
// pkg/front_end/testcases/having_part_with_parts_and_annotation.dart: Context: This is the containing library.
//
// pkg/front_end/testcases/having_part_with_parts_and_annotation_lib1.dart:6:6: Error: A file that's a part of a library can't have parts itself.
// Try moving the 'part' declaration to the containing library.
// part 'having_part_with_parts_and_annotation_lib2.dart';
// ^
// pkg/front_end/testcases/having_part_with_parts_and_annotation.dart: Context: This is the containing library.
//
import self as self;
import "dart:core" as core;
part having_part_with_parts_and_annotation_lib1.dart;
static const field core::int Foo = 42;
static const field core::int Bar = 43 /* from org-dartlang-testcase:///having_part_with_parts_and_annotation_lib1.dart */;
static const field core::int Baz = 44 /* from org-dartlang-testcase:///having_part_with_parts_and_annotation_lib1.dart */;
static method fromMain() → void
;
static method main() → dynamic
;
static method /* from org-dartlang-testcase:///having_part_with_parts_and_annotation_lib1.dart */ fromLib1() → void
;

View file

@ -0,0 +1,11 @@
part of 'having_part_with_parts_and_annotation.dart';
@Bar
part 'having_part_with_parts_and_annotation_lib2.dart';
@Baz
part 'having_part_with_parts_and_annotation_lib2.dart';
const int Bar = 43;
const int Baz = 44;
void fromLib1() {}

View file

@ -0,0 +1,3 @@
part of 'having_part_with_parts_and_annotation_lib1.dart';
void fromLib2() {}

View file

@ -16,6 +16,7 @@ duplicated_field_initializer: RuntimeError
external_import: RuntimeError # Expected -- test uses import which doesn't exist.
fallthrough: Fail # Missing FallThroughError.
function_type_recovery: Fail
having_part_with_parts_and_annotation: Crash
incomplete_field_formal_parameter: Fail # Fasta doesn't recover well
inference/bug31436: RuntimeError # Test exercises Dart 2.0 semantics
inference/constructors_too_many_positional_arguments: Fail

View file

@ -24,6 +24,7 @@ dynamic_and_void: InstrumentationMismatch # Test assumes Dart 1.0 semantics
expressions: RuntimeError
external_import: RuntimeError # The native extension to import doesn't exist. This is ok.
fallthrough: ExpectationFileMismatch
having_part_with_parts_and_annotation: Crash
incomplete_field_formal_parameter: RuntimeError
inference/abstract_class_instantiation: InstrumentationMismatch # Issue #30040
inference/conflicting_fields: TypeCheckError

View file

@ -104,6 +104,8 @@ function_type_recovery: TextSerializationFailure # Was: Pass
functions: TextSerializationFailure # Was: Pass
future_or_test: TextSerializationFailure # Was: Pass
hello: TextSerializationFailure # Was: Pass
having_part_with_part_and_annotation: TextSerializationFailure
having_part_with_parts_and_annotation: Crash
illegal_named_function_expression: TextSerializationFailure # Was: Pass
illegal_named_function_expression_scope: TextSerializationFailure # Was: Pass
implicit_const_with_static_fields: TextSerializationFailure # Was: Pass