Create test which demonstrates issues 35558 and 35559
Change-Id: I521ea3f7cf8d02f9e23edc1a9775fbd65bf64e4a
Reviewed-on: https://dart-review.googlesource.com/c/90180
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
diff --git a/pkg/front_end/testcases/sdk_diagnostic.dart b/pkg/front_end/testcases/sdk_diagnostic.dart
new file mode 100644
index 0000000..f8f4723
--- /dev/null
+++ b/pkg/front_end/testcases/sdk_diagnostic.dart
@@ -0,0 +1,15 @@
+// Copyright (c) 2019, 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 extends Iterable<Object> {
+ // Missing implementation of [iterator] leads to diagnostic which refers to
+ // the SDK. This test is intended to test that such references are displayed
+ // correctly.
+}
+
+test() {
+ print(incorrectArgument: "fisk");
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/sdk_diagnostic.dart.hierarchy.expect b/pkg/front_end/testcases/sdk_diagnostic.dart.hierarchy.expect
new file mode 100644
index 0000000..e93765a
--- /dev/null
+++ b/pkg/front_end/testcases/sdk_diagnostic.dart.hierarchy.expect
@@ -0,0 +1,115 @@
+Object:
+ superclasses:
+ interfaces:
+ classMembers:
+ Object._haveSameRuntimeType
+ Object.toString
+ Object.runtimeType
+ Object._toString
+ Object._simpleInstanceOf
+ Object._hashCodeRnd
+ Object._instanceOf
+ Object.noSuchMethod
+ Object._objectHashCode
+ Object._identityHashCode
+ Object.hashCode
+ Object._simpleInstanceOfFalse
+ Object._simpleInstanceOfTrue
+ Object.==
+ classSetters:
+
+Iterable:
+ superclasses:
+ Object
+ interfaces:
+ classMembers:
+ Iterable.iterator
+ Iterable.map
+ Iterable.cast
+ Iterable.skip
+ Iterable.join
+ Iterable.toSet
+ Iterable.toString
+ Iterable.forEach
+ Iterable.length
+ Iterable.firstWhere
+ Object.runtimeType
+ Object._simpleInstanceOf
+ Iterable.isEmpty
+ Iterable.take
+ Iterable.any
+ Iterable.isNotEmpty
+ Iterable.whereType
+ Iterable.where
+ Object._instanceOf
+ Iterable.skipWhile
+ Iterable.castFrom
+ Iterable.toList
+ Object.noSuchMethod
+ Iterable.fold
+ Iterable.elementAt
+ Iterable.expand
+ Iterable.takeWhile
+ Iterable.first
+ Object._identityHashCode
+ Object.hashCode
+ Iterable.reduce
+ Iterable.lastWhere
+ Iterable.last
+ Object._simpleInstanceOfFalse
+ Iterable.single
+ Iterable.every
+ Iterable.contains
+ Object._simpleInstanceOfTrue
+ Object.==
+ Iterable.followedBy
+ Iterable.singleWhere
+ classSetters:
+
+C:
+ superclasses:
+ Object
+ -> Iterable<Object>
+ interfaces:
+ classMembers:
+ Iterable.iterator
+ Iterable.map
+ Iterable.cast
+ Iterable.skip
+ Iterable.join
+ Iterable.toSet
+ Iterable.toString
+ Iterable.forEach
+ Iterable.length
+ Iterable.firstWhere
+ Object.runtimeType
+ Object._simpleInstanceOf
+ Iterable.isEmpty
+ Iterable.take
+ Iterable.any
+ Iterable.isNotEmpty
+ Iterable.whereType
+ Iterable.where
+ Object._instanceOf
+ Iterable.skipWhile
+ Iterable.toList
+ Object.noSuchMethod
+ Iterable.fold
+ Iterable.elementAt
+ Iterable.expand
+ Iterable.takeWhile
+ Iterable.first
+ Object._identityHashCode
+ Object.hashCode
+ Iterable.reduce
+ Iterable.lastWhere
+ Iterable.last
+ Object._simpleInstanceOfFalse
+ Iterable.single
+ Iterable.every
+ Iterable.contains
+ Object._simpleInstanceOfTrue
+ Object.==
+ Iterable.followedBy
+ Iterable.singleWhere
+ classSetters:
diff --git a/pkg/front_end/testcases/sdk_diagnostic.dart.legacy.expect b/pkg/front_end/testcases/sdk_diagnostic.dart.legacy.expect
new file mode 100644
index 0000000..f5f28d0
--- /dev/null
+++ b/pkg/front_end/testcases/sdk_diagnostic.dart.legacy.expect
@@ -0,0 +1,35 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/sdk_diagnostic.dart:5:7: Error: The non-abstract class 'C' is missing implementations for these members:
+// - Iterable.iterator
+// Try to either
+// - provide an implementation,
+// - inherit an implementation from a superclass or mixin,
+// - mark the class as abstract, or
+// - provide a 'noSuchMethod' implementation.
+//
+// class C extends Iterable<Object> {
+// ^
+// dart:core:1: Context: 'Iterable.iterator' is defined here.
+//
+// pkg/front_end/testcases/sdk_diagnostic.dart:12:8: Warning: Too few positional arguments: 1 required, 0 given.
+// print(incorrectArgument: "fisk");
+// ^
+// org-dartlang-sdk:///sdk/lib/core/print.dart:8:6: Context: Found this candidate, but the arguments don't match.
+// void print(Object object) {
+// ^^^^^
+//
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Iterable<core::Object> {
+ synthetic constructor •() → self::C
+ : super core::Iterable::•()
+ ;
+}
+static method test() → dynamic {
+ throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#print, 32, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#incorrectArgument: "fisk"})));
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/sdk_diagnostic.dart.legacy.transformed.expect b/pkg/front_end/testcases/sdk_diagnostic.dart.legacy.transformed.expect
new file mode 100644
index 0000000..f5f28d0
--- /dev/null
+++ b/pkg/front_end/testcases/sdk_diagnostic.dart.legacy.transformed.expect
@@ -0,0 +1,35 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/sdk_diagnostic.dart:5:7: Error: The non-abstract class 'C' is missing implementations for these members:
+// - Iterable.iterator
+// Try to either
+// - provide an implementation,
+// - inherit an implementation from a superclass or mixin,
+// - mark the class as abstract, or
+// - provide a 'noSuchMethod' implementation.
+//
+// class C extends Iterable<Object> {
+// ^
+// dart:core:1: Context: 'Iterable.iterator' is defined here.
+//
+// pkg/front_end/testcases/sdk_diagnostic.dart:12:8: Warning: Too few positional arguments: 1 required, 0 given.
+// print(incorrectArgument: "fisk");
+// ^
+// org-dartlang-sdk:///sdk/lib/core/print.dart:8:6: Context: Found this candidate, but the arguments don't match.
+// void print(Object object) {
+// ^^^^^
+//
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Iterable<core::Object> {
+ synthetic constructor •() → self::C
+ : super core::Iterable::•()
+ ;
+}
+static method test() → dynamic {
+ throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#print, 32, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(<core::Symbol, dynamic>{#incorrectArgument: "fisk"})));
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/sdk_diagnostic.dart.outline.expect b/pkg/front_end/testcases/sdk_diagnostic.dart.outline.expect
new file mode 100644
index 0000000..9431005
--- /dev/null
+++ b/pkg/front_end/testcases/sdk_diagnostic.dart.outline.expect
@@ -0,0 +1,27 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/sdk_diagnostic.dart:5:7: Error: The non-abstract class 'C' is missing implementations for these members:
+// - Iterable.iterator
+// Try to either
+// - provide an implementation,
+// - inherit an implementation from a superclass or mixin,
+// - mark the class as abstract, or
+// - provide a 'noSuchMethod' implementation.
+//
+// class C extends Iterable<Object> {
+// ^
+// dart:core:1: Context: 'Iterable.iterator' is defined here.
+//
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Iterable<core::Object> {
+ synthetic constructor •() → self::C
+ ;
+}
+static method test() → dynamic
+ ;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/sdk_diagnostic.dart.strong.expect b/pkg/front_end/testcases/sdk_diagnostic.dart.strong.expect
new file mode 100644
index 0000000..957c7d9
--- /dev/null
+++ b/pkg/front_end/testcases/sdk_diagnostic.dart.strong.expect
@@ -0,0 +1,35 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/sdk_diagnostic.dart:5:7: Error: The non-abstract class 'C' is missing implementations for these members:
+// - Iterable.iterator
+// Try to either
+// - provide an implementation,
+// - inherit an implementation from a superclass or mixin,
+// - mark the class as abstract, or
+// - provide a 'noSuchMethod' implementation.
+//
+// class C extends Iterable<Object> {
+// ^
+// dart:core:1: Context: 'Iterable.iterator' is defined here.
+//
+// pkg/front_end/testcases/sdk_diagnostic.dart:12:8: Error: Too few positional arguments: 1 required, 0 given.
+// print(incorrectArgument: "fisk");
+// ^
+// org-dartlang-sdk:///sdk/lib/core/print.dart:8:6: Context: Found this candidate, but the arguments don't match.
+//
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Iterable<core::Object> {
+ synthetic constructor •() → self::C
+ : super core::Iterable::•()
+ ;
+}
+static method test() → dynamic {
+ invalid-expression "pkg/front_end/testcases/sdk_diagnostic.dart:12:8: Error: Too few positional arguments: 1 required, 0 given.
+ print(incorrectArgument: \"fisk\");
+ ^";
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/sdk_diagnostic.dart.strong.transformed.expect b/pkg/front_end/testcases/sdk_diagnostic.dart.strong.transformed.expect
new file mode 100644
index 0000000..957c7d9
--- /dev/null
+++ b/pkg/front_end/testcases/sdk_diagnostic.dart.strong.transformed.expect
@@ -0,0 +1,35 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/sdk_diagnostic.dart:5:7: Error: The non-abstract class 'C' is missing implementations for these members:
+// - Iterable.iterator
+// Try to either
+// - provide an implementation,
+// - inherit an implementation from a superclass or mixin,
+// - mark the class as abstract, or
+// - provide a 'noSuchMethod' implementation.
+//
+// class C extends Iterable<Object> {
+// ^
+// dart:core:1: Context: 'Iterable.iterator' is defined here.
+//
+// pkg/front_end/testcases/sdk_diagnostic.dart:12:8: Error: Too few positional arguments: 1 required, 0 given.
+// print(incorrectArgument: "fisk");
+// ^
+// org-dartlang-sdk:///sdk/lib/core/print.dart:8:6: Context: Found this candidate, but the arguments don't match.
+//
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Iterable<core::Object> {
+ synthetic constructor •() → self::C
+ : super core::Iterable::•()
+ ;
+}
+static method test() → dynamic {
+ invalid-expression "pkg/front_end/testcases/sdk_diagnostic.dart:12:8: Error: Too few positional arguments: 1 required, 0 given.
+ print(incorrectArgument: \"fisk\");
+ ^";
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/text_serialization.status b/pkg/front_end/testcases/text_serialization.status
index aebb6da..7fd6716 100644
--- a/pkg/front_end/testcases/text_serialization.status
+++ b/pkg/front_end/testcases/text_serialization.status
@@ -952,6 +952,7 @@
runtime_checks_new/stub_from_interface_covariantImpl_from_interface: TextSerializationFailure # Was: Pass
runtime_checks_new/stub_from_interface_covariantImpl_from_super: TextSerializationFailure # Was: Pass
runtime_checks_new/stub_from_interface_covariantInterface_from_class: TextSerializationFailure # Was: Pass
+sdk_diagnostic: TextSerializationFailure
set_literals/disambiguation_rule: TextSerializationFailure # Was: RuntimeError
spread_collection: TextSerializationFailure # Should be fixed as part of implementing spread collection support
statements: Crash