blob: 9c492c75f31b5a04a8fae74f43722a5f68b98430 [file] [log] [blame]
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:9:7: Error: 'instanceMethod' is already declared in this scope.
// int instanceMethod() => 2;
// ^^^^^^^^^^^^^^
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:8:7: Context: Previous declaration of 'instanceMethod'.
// int instanceMethod() => 1;
// ^^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:12:11: Error: 'instanceGetter' is already declared in this scope.
// int get instanceGetter => 2;
// ^^^^^^^^^^^^^^
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:11:11: Context: Previous declaration of 'instanceGetter'.
// int get instanceGetter => 1;
// ^^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:18:12: Error: 'instanceSetter' is already declared in this scope.
// void set instanceSetter(value) {
// ^^^^^^^^^^^^^^
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:14:12: Context: Previous declaration of 'instanceSetter'.
// void set instanceSetter(value) {
// ^^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:23:7: Error: 'instanceField' is already declared in this scope.
// int instanceField = 2;
// ^^^^^^^^^^^^^
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:22:7: Context: Previous declaration of 'instanceField'.
// int instanceField = 1;
// ^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:48:13: Error: 'instanceDuplicateFieldAndSetter' is already declared in this scope.
// final int instanceDuplicateFieldAndSetter = 2;
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:47:13: Context: Previous declaration of 'instanceDuplicateFieldAndSetter'.
// final int instanceDuplicateFieldAndSetter = 1;
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:58:12: Error: 'instanceFieldAndDuplicateSetter' is already declared in this scope.
// void set instanceFieldAndDuplicateSetter(int value) {
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:54:12: Context: Previous declaration of 'instanceFieldAndDuplicateSetter'.
// void set instanceFieldAndDuplicateSetter(int value) {
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:63:13: Error: 'instanceDuplicateFieldAndDuplicateSetter' is already declared in this scope.
// final int instanceDuplicateFieldAndDuplicateSetter = 2;
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:62:13: Context: Previous declaration of 'instanceDuplicateFieldAndDuplicateSetter'.
// final int instanceDuplicateFieldAndDuplicateSetter = 1;
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:68:12: Error: 'instanceDuplicateFieldAndDuplicateSetter' is already declared in this scope.
// void set instanceDuplicateFieldAndDuplicateSetter(int value) {
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:64:12: Context: Previous declaration of 'instanceDuplicateFieldAndDuplicateSetter'.
// void set instanceDuplicateFieldAndDuplicateSetter(int value) {
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:26:12: Error: Conflicts with the implicit setter of the field 'instanceFieldAndSetter1'.
// void set instanceFieldAndSetter1(int value) {
// ^
//
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:25:7: Error: Conflicts with setter 'instanceFieldAndSetter1'.
// int instanceFieldAndSetter1 = 1;
// ^
//
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:30:12: Error: Conflicts with the implicit setter of the field 'instanceFieldAndSetter2'.
// void set instanceFieldAndSetter2(int value) {
// ^
//
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:34:7: Error: Conflicts with setter 'instanceFieldAndSetter2'.
// int instanceFieldAndSetter2 = 1;
// ^
//
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:37:12: Error: Conflicts with the implicit setter of the field 'instanceLateFinalFieldAndSetter1'.
// void set instanceLateFinalFieldAndSetter1(int value) {
// ^
//
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:36:18: Error: Conflicts with setter 'instanceLateFinalFieldAndSetter1'.
// late final int instanceLateFinalFieldAndSetter1;
// ^
//
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:41:12: Error: Conflicts with the implicit setter of the field 'instanceLateFinalFieldAndSetter2'.
// void set instanceLateFinalFieldAndSetter2(int value) {
// ^
//
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:45:18: Error: Conflicts with setter 'instanceLateFinalFieldAndSetter2'.
// late final int instanceLateFinalFieldAndSetter2;
// ^
//
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:73:12: Error: 'instanceMethodAndSetter1' is already declared in this scope.
// void set instanceMethodAndSetter1(int value) {
// ^^^^^^^^^^^^^^^^^^^^^^^^
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:72:7: Context: Previous declaration of 'instanceMethodAndSetter1'.
// int instanceMethodAndSetter1() => 1;
// ^^^^^^^^^^^^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:81:7: Error: 'instanceMethodAndSetter2' is already declared in this scope.
// int instanceMethodAndSetter2() => 1;
// ^^^^^^^^^^^^^^^^^^^^^^^^
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:77:12: Context: Previous declaration of 'instanceMethodAndSetter2'.
// void set instanceMethodAndSetter2(int value) {
// ^^^^^^^^^^^^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:86:5: Error: Can't use 'instanceMethod' because it is declared more than once.
// c.instanceMethod();
// ^^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:86:5: Error: The method 'instanceMethod' isn't defined for the class 'Class'.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/duplicates_instance.dart'.
// Try correcting the name to the name of an existing method, or defining a method named 'instanceMethod'.
// c.instanceMethod();
// ^^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:87:6: Error: Can't use 'instanceMethod' because it is declared more than once.
// (c.instanceMethod)();
// ^^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:87:6: Error: The getter 'instanceMethod' isn't defined for the class 'Class'.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/duplicates_instance.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'instanceMethod'.
// (c.instanceMethod)();
// ^^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:88:5: Error: Can't use 'instanceGetter' because it is declared more than once.
// c.instanceGetter;
// ^^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:88:5: Error: The getter 'instanceGetter' isn't defined for the class 'Class'.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/duplicates_instance.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'instanceGetter'.
// c.instanceGetter;
// ^^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:89:5: Error: Can't use 'instanceSetter' because it is declared more than once.
// c.instanceSetter = 0;
// ^^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:89:5: Error: The setter 'instanceSetter' isn't defined for the class 'Class'.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/duplicates_instance.dart'.
// Try correcting the name to the name of an existing setter, or defining a setter or field named 'instanceSetter'.
// c.instanceSetter = 0;
// ^^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:90:5: Error: Can't use 'instanceField' because it is declared more than once.
// c.instanceField;
// ^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:90:5: Error: The getter 'instanceField' isn't defined for the class 'Class'.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/duplicates_instance.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'instanceField'.
// c.instanceField;
// ^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:91:5: Error: Can't use 'instanceField' because it is declared more than once.
// c.instanceField = 0;
// ^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:91:5: Error: The setter 'instanceField' isn't defined for the class 'Class'.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/duplicates_instance.dart'.
// Try correcting the name to the name of an existing setter, or defining a setter or field named 'instanceField'.
// c.instanceField = 0;
// ^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:92:5: Error: Can't use 'instanceDuplicateFieldAndSetter' because it is declared more than once.
// c.instanceDuplicateFieldAndSetter;
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:92:5: Error: The getter 'instanceDuplicateFieldAndSetter' isn't defined for the class 'Class'.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/duplicates_instance.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'instanceDuplicateFieldAndSetter'.
// c.instanceDuplicateFieldAndSetter;
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:95:5: Error: Can't use 'instanceFieldAndDuplicateSetter' because it is declared more than once.
// c.instanceFieldAndDuplicateSetter = 0;
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:95:5: Error: The setter 'instanceFieldAndDuplicateSetter' isn't defined for the class 'Class'.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/duplicates_instance.dart'.
// Try correcting the name to the name of an existing setter, or defining a setter or field named 'instanceFieldAndDuplicateSetter'.
// c.instanceFieldAndDuplicateSetter = 0;
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:96:5: Error: Can't use 'instanceDuplicateFieldAndDuplicateSetter' because it is declared more than once.
// c.instanceDuplicateFieldAndDuplicateSetter;
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:96:5: Error: The getter 'instanceDuplicateFieldAndDuplicateSetter' isn't defined for the class 'Class'.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/duplicates_instance.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'instanceDuplicateFieldAndDuplicateSetter'.
// c.instanceDuplicateFieldAndDuplicateSetter;
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:97:5: Error: Can't use 'instanceDuplicateFieldAndDuplicateSetter' because it is declared more than once.
// c.instanceDuplicateFieldAndDuplicateSetter = 0;
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//
// pkg/front_end/testcases/nnbd/duplicates_instance.dart:97:5: Error: The setter 'instanceDuplicateFieldAndDuplicateSetter' isn't defined for the class 'Class'.
// - 'Class' is from 'pkg/front_end/testcases/nnbd/duplicates_instance.dart'.
// Try correcting the name to the name of an existing setter, or defining a setter or field named 'instanceDuplicateFieldAndDuplicateSetter'.
// c.instanceDuplicateFieldAndDuplicateSetter = 0;
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//
import self as self;
import "dart:core" as core;
class Class extends core::Object {
field core::int instanceField = null;
field core::int instanceFieldAndSetter1 = 1;
field core::int instanceFieldAndSetter2 = 1;
late final [setter] field core::int instanceLateFinalFieldAndSetter1;
late final [setter] field core::int instanceLateFinalFieldAndSetter2;
final field core::int instanceDuplicateFieldAndSetter = null;
final field core::int instanceFieldAndDuplicateSetter = 1;
final field core::int instanceDuplicateFieldAndDuplicateSetter = null;
synthetic constructor •() self::Class
: super core::Object::•()
;
method instanceMethod() core::int
return 1;
get instanceGetter() core::int
return 1;
set instanceSetter(dynamic value) void {
self::result = 1;
}
set instanceDuplicateFieldAndSetter(core::int value) void {
self::result = 3;
}
set instanceFieldAndDuplicateSetter(core::int value) void {
self::result = 2;
}
set instanceDuplicateFieldAndDuplicateSetter(core::int value) void {
self::result = 3;
}
method instanceMethodAndSetter1() core::int
return 1;
set instanceMethodAndSetter1(core::int value) void {
self::result = 2;
}
set instanceMethodAndSetter2(core::int value) void {
self::result = 2;
}
method instanceMethodAndSetter2() core::int
return 1;
}
static field dynamic result;
static method test() dynamic {
self::Class c = new self::Class::•();
invalid-expression "pkg/front_end/testcases/nnbd/duplicates_instance.dart:86:5: Error: The method 'instanceMethod' isn't defined for the class 'Class'.
- 'Class' is from 'pkg/front_end/testcases/nnbd/duplicates_instance.dart'.
Try correcting the name to the name of an existing method, or defining a method named 'instanceMethod'.
c.instanceMethod();
^^^^^^^^^^^^^^";
invalid-expression "pkg/front_end/testcases/nnbd/duplicates_instance.dart:87:6: Error: The getter 'instanceMethod' isn't defined for the class 'Class'.
- 'Class' is from 'pkg/front_end/testcases/nnbd/duplicates_instance.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'instanceMethod'.
(c.instanceMethod)();
^^^^^^^^^^^^^^"{dynamic}.call();
invalid-expression "pkg/front_end/testcases/nnbd/duplicates_instance.dart:88:5: Error: The getter 'instanceGetter' isn't defined for the class 'Class'.
- 'Class' is from 'pkg/front_end/testcases/nnbd/duplicates_instance.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'instanceGetter'.
c.instanceGetter;
^^^^^^^^^^^^^^";
invalid-expression "pkg/front_end/testcases/nnbd/duplicates_instance.dart:89:5: Error: The setter 'instanceSetter' isn't defined for the class 'Class'.
- 'Class' is from 'pkg/front_end/testcases/nnbd/duplicates_instance.dart'.
Try correcting the name to the name of an existing setter, or defining a setter or field named 'instanceSetter'.
c.instanceSetter = 0;
^^^^^^^^^^^^^^";
invalid-expression "pkg/front_end/testcases/nnbd/duplicates_instance.dart:90:5: Error: The getter 'instanceField' isn't defined for the class 'Class'.
- 'Class' is from 'pkg/front_end/testcases/nnbd/duplicates_instance.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'instanceField'.
c.instanceField;
^^^^^^^^^^^^^";
invalid-expression "pkg/front_end/testcases/nnbd/duplicates_instance.dart:91:5: Error: The setter 'instanceField' isn't defined for the class 'Class'.
- 'Class' is from 'pkg/front_end/testcases/nnbd/duplicates_instance.dart'.
Try correcting the name to the name of an existing setter, or defining a setter or field named 'instanceField'.
c.instanceField = 0;
^^^^^^^^^^^^^";
invalid-expression "pkg/front_end/testcases/nnbd/duplicates_instance.dart:92:5: Error: The getter 'instanceDuplicateFieldAndSetter' isn't defined for the class 'Class'.
- 'Class' is from 'pkg/front_end/testcases/nnbd/duplicates_instance.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'instanceDuplicateFieldAndSetter'.
c.instanceDuplicateFieldAndSetter;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^";
c.{self::Class::instanceDuplicateFieldAndSetter} = 0;
c.{self::Class::instanceFieldAndDuplicateSetter}{core::int};
invalid-expression "pkg/front_end/testcases/nnbd/duplicates_instance.dart:95:5: Error: The setter 'instanceFieldAndDuplicateSetter' isn't defined for the class 'Class'.
- 'Class' is from 'pkg/front_end/testcases/nnbd/duplicates_instance.dart'.
Try correcting the name to the name of an existing setter, or defining a setter or field named 'instanceFieldAndDuplicateSetter'.
c.instanceFieldAndDuplicateSetter = 0;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^";
invalid-expression "pkg/front_end/testcases/nnbd/duplicates_instance.dart:96:5: Error: The getter 'instanceDuplicateFieldAndDuplicateSetter' isn't defined for the class 'Class'.
- 'Class' is from 'pkg/front_end/testcases/nnbd/duplicates_instance.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'instanceDuplicateFieldAndDuplicateSetter'.
c.instanceDuplicateFieldAndDuplicateSetter;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^";
invalid-expression "pkg/front_end/testcases/nnbd/duplicates_instance.dart:97:5: Error: The setter 'instanceDuplicateFieldAndDuplicateSetter' isn't defined for the class 'Class'.
- 'Class' is from 'pkg/front_end/testcases/nnbd/duplicates_instance.dart'.
Try correcting the name to the name of an existing setter, or defining a setter or field named 'instanceDuplicateFieldAndDuplicateSetter'.
c.instanceDuplicateFieldAndDuplicateSetter = 0;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^";
}
static method main() dynamic {
self::Class c = new self::Class::•();
c.{self::Class::instanceFieldAndSetter1} = 0;
self::expect(null, self::result);
self::expect(0, c.{self::Class::instanceFieldAndSetter1}{core::int});
self::result = null;
c.{self::Class::instanceFieldAndSetter2} = 0;
self::expect(null, self::result);
self::expect(0, c.{self::Class::instanceFieldAndSetter2}{core::int});
self::result = null;
c.{self::Class::instanceLateFinalFieldAndSetter1} = 0;
self::expect(null, self::result);
self::expect(0, c.{self::Class::instanceLateFinalFieldAndSetter1}{core::int});
self::result = null;
c.{self::Class::instanceLateFinalFieldAndSetter2} = 0;
self::expect(null, self::result);
self::expect(0, c.{self::Class::instanceLateFinalFieldAndSetter2}{core::int});
self::result = null;
self::expect(1, c.{self::Class::instanceMethodAndSetter1}(){() core::int});
c.{self::Class::instanceMethodAndSetter1} = 0;
self::expect(2, self::result);
self::result = null;
self::expect(1, c.{self::Class::instanceMethodAndSetter2}(){() core::int});
c.{self::Class::instanceMethodAndSetter2} = 0;
self::expect(2, self::result);
}
static method expect(dynamic expected, dynamic actual) dynamic {
if(!(expected =={core::Object::==}{(core::Object) core::bool} actual))
throw "Expected ${expected}, actual ${actual}";
}
static method throws(() dynamic f) dynamic {
try {
f(){() dynamic};
}
on core::Object catch(final core::Object e) {
core::print(e);
return;
}
throw "Expected exception.";
}