Enable 'getter-setter-error' flag in 3.9
TEST=existing
Change-Id: Ic4a5735adda7cf8ef1565b9356ca277d9b62b064
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430720
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
diff --git a/pkg/_fe_analyzer_shared/lib/src/experiments/flags.dart b/pkg/_fe_analyzer_shared/lib/src/experiments/flags.dart
index 371ea6f..77ab717 100644
--- a/pkg/_fe_analyzer_shared/lib/src/experiments/flags.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/experiments/flags.dart
@@ -96,10 +96,10 @@
getterSetterError(
name: 'getter-setter-error',
- isEnabledByDefault: false,
+ isEnabledByDefault: true,
isExpired: false,
- experimentEnabledVersion: defaultLanguageVersion,
- experimentReleasedVersion: defaultLanguageVersion),
+ experimentEnabledVersion: const Version(3, 9),
+ experimentReleasedVersion: const Version(3, 9)),
inferenceUpdate1(
name: 'inference-update-1',
diff --git a/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart b/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart
index 8ded323e..6dc2640 100644
--- a/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart
@@ -326,7 +326,7 @@
documentation:
'Stop reporting errors about mismatching types in a getter/setter pair.',
experimentalReleaseVersion: null,
- releaseVersion: null,
+ releaseVersion: Version.parse('3.9.0'),
channels: ["stable", "beta", "dev", "main"],
);
@@ -663,7 +663,7 @@
static const bool generic_metadata = true;
/// Default state of the experiment "getter-setter-error"
- static const bool getter_setter_error = false;
+ static const bool getter_setter_error = true;
/// Default state of the experiment "inference-update-1"
static const bool inference_update_1 = true;
diff --git a/pkg/analyzer/test/src/dart/analysis/analysis_context_collection_test.dart b/pkg/analyzer/test/src/dart/analysis/analysis_context_collection_test.dart
index a8729c2..90249d7 100644
--- a/pkg/analyzer/test/src/dart/analysis/analysis_context_collection_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/analysis_context_collection_test.dart
@@ -406,6 +406,7 @@
enhanced-enums
extension-methods
generic-metadata
+ getter-setter-error
inference-update-1
inference-update-2
inference-update-3
@@ -486,6 +487,7 @@
enhanced-enums
extension-methods
generic-metadata
+ getter-setter-error
inference-update-1
inference-update-2
inference-update-3
diff --git a/pkg/analyzer/test/src/diagnostics/getter_not_subtype_setter_types_test.dart b/pkg/analyzer/test/src/diagnostics/getter_not_subtype_setter_types_test.dart
index 7e4aaa9..0c19da1 100644
--- a/pkg/analyzer/test/src/diagnostics/getter_not_subtype_setter_types_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/getter_not_subtype_setter_types_test.dart
@@ -4,6 +4,7 @@
import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/src/error/codes.dart';
+import 'package:analyzer_testing/experiments/experiments.dart';
import 'package:collection/collection.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -29,36 +30,26 @@
class GetterNotSubtypeSetterTypesTest_withoutGetterSetterErrorFeature
extends _GetterNotSubtypeSetterTypesTest {
@override
- List<String> get experiments => [];
+ List<String> get experiments => [...experimentsForTests];
}
class _GetterNotSubtypeSetterTypesTest extends PubPackageResolutionTest {
test_class_instance() async {
- await assertErrorsInCode(
- '''
+ await assertNoErrorsInCode('''
class C {
num get foo => 0;
set foo(int v) {}
}
-''',
- _filterGetterSetterTypeErrors([
- error(CompileTimeErrorCode.GETTER_NOT_SUBTYPE_SETTER_TYPES, 20, 3),
- ]),
- );
+''');
}
test_class_instance_dynamicGetter() async {
- await assertErrorsInCode(
- r'''
+ await assertNoErrorsInCode(r'''
class C {
get foo => 0;
set foo(String v) {}
}
-''',
- _filterGetterSetterTypeErrors([
- error(CompileTimeErrorCode.GETTER_NOT_SUBTYPE_SETTER_TYPES, 16, 3),
- ]),
- );
+''');
}
test_class_instance_dynamicSetter() async {
@@ -71,22 +62,16 @@
}
test_class_instance_field() async {
- await assertErrorsInCode(
- '''
+ await assertNoErrorsInCode('''
class C {
final num foo = 0;
set foo(int v) {}
}
-''',
- _filterGetterSetterTypeErrors([
- error(CompileTimeErrorCode.GETTER_NOT_SUBTYPE_SETTER_TYPES, 22, 3),
- ]),
- );
+''');
}
test_class_instance_interfaces() async {
- await assertErrorsInCode(
- r'''
+ await assertNoErrorsInCode(r'''
class A {
int get foo => 0;
}
@@ -96,11 +81,7 @@
}
abstract class X implements A, B {}
-''',
- _filterGetterSetterTypeErrors([
- error(CompileTimeErrorCode.GETTER_NOT_SUBTYPE_SETTER_TYPES, 84, 1),
- ]),
- );
+''');
}
test_class_instance_private_getter() async {
@@ -170,17 +151,12 @@
}
test_class_instance_sameClass() async {
- await assertErrorsInCode(
- r'''
+ await assertNoErrorsInCode(r'''
class C {
int get foo => 0;
set foo(String _) {}
}
-''',
- _filterGetterSetterTypeErrors([
- error(CompileTimeErrorCode.GETTER_NOT_SUBTYPE_SETTER_TYPES, 20, 3),
- ]),
- );
+''');
}
test_class_instance_sameTypes() async {
@@ -229,8 +205,7 @@
}
test_class_instance_superGetter() async {
- await assertErrorsInCode(
- r'''
+ await assertNoErrorsInCode(r'''
class A {
int get foo => 0;
}
@@ -238,16 +213,11 @@
class B extends A {
set foo(String _) {}
}
-''',
- _filterGetterSetterTypeErrors([
- error(CompileTimeErrorCode.GETTER_NOT_SUBTYPE_SETTER_TYPES, 59, 3),
- ]),
- );
+''');
}
test_class_instance_superSetter() async {
- await assertErrorsInCode(
- r'''
+ await assertNoErrorsInCode(r'''
class A {
set foo(String _) {}
}
@@ -255,39 +225,25 @@
class B extends A {
int get foo => 0;
}
-''',
- _filterGetterSetterTypeErrors([
- error(CompileTimeErrorCode.GETTER_NOT_SUBTYPE_SETTER_TYPES, 66, 3),
- ]),
- );
+''');
}
test_class_static() async {
- await assertErrorsInCode(
- '''
+ await assertNoErrorsInCode('''
class C {
static num get foo => 0;
static set foo(int v) {}
}
-''',
- _filterGetterSetterTypeErrors([
- error(CompileTimeErrorCode.GETTER_NOT_SUBTYPE_SETTER_TYPES, 27, 3),
- ]),
- );
+''');
}
test_class_static_field() async {
- await assertErrorsInCode(
- '''
+ await assertNoErrorsInCode('''
class C {
static final num foo = 0;
static set foo(int v) {}
}
-''',
- _filterGetterSetterTypeErrors([
- error(CompileTimeErrorCode.GETTER_NOT_SUBTYPE_SETTER_TYPES, 29, 3),
- ]),
- );
+''');
}
test_class_static_sameTypes() async {
@@ -300,8 +256,7 @@
}
test_enum_instance_mixinGetter_mixinSetter() async {
- await assertErrorsInCode(
- '''
+ await assertNoErrorsInCode('''
mixin M1 {
num get foo => 0;
}
@@ -313,16 +268,11 @@
enum E with M1, M2 {
v
}
-''',
- _filterGetterSetterTypeErrors([
- error(CompileTimeErrorCode.GETTER_NOT_SUBTYPE_SETTER_TYPES, 73, 1),
- ]),
- );
+''');
}
test_enum_instance_mixinGetter_thisSetter() async {
- await assertErrorsInCode(
- '''
+ await assertNoErrorsInCode('''
mixin M {
num get foo => 0;
}
@@ -331,159 +281,104 @@
v;
set foo(int v) {}
}
-''',
- _filterGetterSetterTypeErrors([
- error(CompileTimeErrorCode.GETTER_NOT_SUBTYPE_SETTER_TYPES, 60, 3),
- ]),
- );
+''');
}
test_enum_instance_superGetter_thisSetter_index() async {
- await assertErrorsInCode(
- '''
+ await assertNoErrorsInCode('''
enum E {
v;
set index(String _) {}
}
-''',
- _filterGetterSetterTypeErrors([
- error(CompileTimeErrorCode.GETTER_NOT_SUBTYPE_SETTER_TYPES, 20, 5),
- ]),
- );
+''');
}
test_enum_instance_thisField_thisSetter() async {
- await assertErrorsInCode(
- '''
+ await assertNoErrorsInCode('''
enum E {
v;
final num foo = 0;
set foo(int v) {}
}
-''',
- _filterGetterSetterTypeErrors([
- error(CompileTimeErrorCode.GETTER_NOT_SUBTYPE_SETTER_TYPES, 26, 3),
- ]),
- );
+''');
}
test_enum_instance_thisGetter_thisSetter() async {
- await assertErrorsInCode(
- '''
+ await assertNoErrorsInCode('''
enum E {
v;
num get foo => 0;
set foo(int v) {}
}
-''',
- _filterGetterSetterTypeErrors([
- error(CompileTimeErrorCode.GETTER_NOT_SUBTYPE_SETTER_TYPES, 24, 3),
- ]),
- );
+''');
}
test_enum_static() async {
- await assertErrorsInCode(
- '''
+ await assertNoErrorsInCode('''
enum E {
v;
static num get foo => 0;
static set foo(int v) {}
}
-''',
- _filterGetterSetterTypeErrors([
- error(CompileTimeErrorCode.GETTER_NOT_SUBTYPE_SETTER_TYPES, 31, 3),
- ]),
- );
+''');
}
test_enum_static_field() async {
- await assertErrorsInCode(
- '''
+ await assertNoErrorsInCode('''
enum E {
foo;
static set foo(int v) {}
}
-''',
- _filterGetterSetterTypeErrors([
- error(CompileTimeErrorCode.GETTER_NOT_SUBTYPE_SETTER_TYPES, 11, 3),
- ]),
- );
+''');
}
test_enum_static_generatedGetter_thisSetter_index() async {
- await assertErrorsInCode(
- '''
+ await assertNoErrorsInCode('''
enum E {
v;
static set values(int _) {}
}
-''',
- _filterGetterSetterTypeErrors([
- error(CompileTimeErrorCode.GETTER_NOT_SUBTYPE_SETTER_TYPES, 5, 1),
- ]),
- );
+''');
}
test_extension_instance() async {
- await assertErrorsInCode(
- '''
+ await assertNoErrorsInCode('''
extension E on Object {
int get foo => 0;
set foo(String v) {}
}
-''',
- _filterGetterSetterTypeErrors([
- error(CompileTimeErrorCode.GETTER_NOT_SUBTYPE_SETTER_TYPES, 34, 3),
- ]),
- );
+''');
}
test_extension_static() async {
- await assertErrorsInCode(
- '''
+ await assertNoErrorsInCode('''
extension E on Object {
static int get foo => 0;
static set foo(String v) {}
}
-''',
- _filterGetterSetterTypeErrors([
- error(CompileTimeErrorCode.GETTER_NOT_SUBTYPE_SETTER_TYPES, 41, 3),
- ]),
- );
+''');
}
test_extension_static_field() async {
- await assertErrorsInCode(
- '''
+ await assertNoErrorsInCode('''
extension E on Object {
static final int foo = 0;
static set foo(String v) {}
}
-''',
- _filterGetterSetterTypeErrors([
- error(CompileTimeErrorCode.GETTER_NOT_SUBTYPE_SETTER_TYPES, 43, 3),
- ]),
- );
+''');
}
test_extensionType_instance() async {
- await assertErrorsInCode(
- '''
+ await assertNoErrorsInCode('''
extension type A(int it) {
int get foo => 0;
void set foo(String _) {}
}
-''',
- _filterGetterSetterTypeErrors([
- error(CompileTimeErrorCode.GETTER_NOT_SUBTYPE_SETTER_TYPES, 37, 3),
- ]),
- );
+''');
}
test_extensionType_instance_fromImplements() async {
- await assertErrorsInCode(
- '''
+ await assertNoErrorsInCode('''
extension type A(int it) {
void set foo(String _) {}
}
@@ -491,76 +386,47 @@
extension type B(int it) implements A {
int get foo => 0;
}
-''',
- _filterGetterSetterTypeErrors([
- error(CompileTimeErrorCode.GETTER_NOT_SUBTYPE_SETTER_TYPES, 108, 3),
- ]),
- );
+''');
}
test_extensionType_instance_representationField() async {
- await assertErrorsInCode(
- '''
+ await assertNoErrorsInCode('''
extension type A(int it) {
void set it(String _) {}
}
-''',
- _filterGetterSetterTypeErrors([
- error(CompileTimeErrorCode.GETTER_NOT_SUBTYPE_SETTER_TYPES, 38, 2),
- ]),
- );
+''');
}
test_extensionType_static() async {
- await assertErrorsInCode(
- '''
+ await assertNoErrorsInCode('''
extension type A(int it) {
static int get foo => 0;
static set foo(String v) {}
}
-''',
- _filterGetterSetterTypeErrors([
- error(CompileTimeErrorCode.GETTER_NOT_SUBTYPE_SETTER_TYPES, 44, 3),
- ]),
- );
+''');
}
test_extensionType_static_field() async {
- await assertErrorsInCode(
- '''
+ await assertNoErrorsInCode('''
extension type A(int it) {
static final int foo = 0;
static set foo(String v) {}
}
-''',
- _filterGetterSetterTypeErrors([
- error(CompileTimeErrorCode.GETTER_NOT_SUBTYPE_SETTER_TYPES, 46, 3),
- ]),
- );
+''');
}
test_topLevel() async {
- await assertErrorsInCode(
- '''
+ await assertNoErrorsInCode('''
int get foo => 0;
set foo(String v) {}
-''',
- _filterGetterSetterTypeErrors([
- error(CompileTimeErrorCode.GETTER_NOT_SUBTYPE_SETTER_TYPES, 8, 3),
- ]),
- );
+''');
}
test_topLevel_dynamicGetter() async {
- await assertErrorsInCode(
- r'''
+ await assertNoErrorsInCode(r'''
get foo => 0;
set foo(int v) {}
-''',
- _filterGetterSetterTypeErrors([
- error(CompileTimeErrorCode.GETTER_NOT_SUBTYPE_SETTER_TYPES, 4, 3),
- ]),
- );
+''');
}
test_topLevel_dynamicSetter() async {
@@ -578,15 +444,10 @@
}
test_topLevel_variable() async {
- await assertErrorsInCode(
- '''
+ await assertNoErrorsInCode('''
final int foo = 0;
set foo(String v) {}
-''',
- _filterGetterSetterTypeErrors([
- error(CompileTimeErrorCode.GETTER_NOT_SUBTYPE_SETTER_TYPES, 10, 3),
- ]),
- );
+''');
}
List<ExpectedError> _filterGetterSetterTypeErrors(
diff --git a/pkg/analyzer_testing/lib/experiments/experiments.dart b/pkg/analyzer_testing/lib/experiments/experiments.dart
index f7d1aef..b0a86a3 100644
--- a/pkg/analyzer_testing/lib/experiments/experiments.dart
+++ b/pkg/analyzer_testing/lib/experiments/experiments.dart
@@ -18,6 +18,5 @@
Feature.augmentations.enableString,
Feature.dot_shorthands.enableString,
Feature.enhanced_parts.enableString,
- Feature.getter_setter_error.enableString,
Feature.macros.enableString,
];
diff --git a/pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart b/pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart
index cc31fd4..728ffd1 100644
--- a/pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart
+++ b/pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart
@@ -157,11 +157,11 @@
static const ExperimentalFlag getterSetterError = const ExperimentalFlag(
name: 'getter-setter-error',
- isEnabledByDefault: false,
+ isEnabledByDefault: true,
isExpired: false,
- enabledVersion: defaultLanguageVersion,
- experimentEnabledVersion: defaultLanguageVersion,
- experimentReleasedVersion: defaultLanguageVersion);
+ enabledVersion: const Version(3, 9),
+ experimentEnabledVersion: const Version(3, 9),
+ experimentReleasedVersion: const Version(3, 9));
static const ExperimentalFlag inferenceUpdate1 = const ExperimentalFlag(
name: 'inference-update-1',
diff --git a/pkg/front_end/messages.status b/pkg/front_end/messages.status
index 0662d11..9d1826e 100644
--- a/pkg/front_end/messages.status
+++ b/pkg/front_end/messages.status
@@ -569,12 +569,26 @@
InvalidExtensionTypeSuperExtensionType/analyzerCode: Fail
InvalidExtensionTypeSuperInterface/analyzerCode: Fail
InvalidGetterSetterType/analyzerCode: Fail
+InvalidGetterSetterType/part_wrapped_script: Fail
+InvalidGetterSetterType/script: Fail
InvalidGetterSetterTypeBothInheritedField/analyzerCode: Fail
+InvalidGetterSetterTypeBothInheritedField/part_wrapped_script: Fail
+InvalidGetterSetterTypeBothInheritedField/script: Fail
InvalidGetterSetterTypeBothInheritedGetter/analyzerCode: Fail
+InvalidGetterSetterTypeBothInheritedGetter/part_wrapped_script: Fail
+InvalidGetterSetterTypeBothInheritedGetter/script: Fail
InvalidGetterSetterTypeFieldInherited/analyzerCode: Fail
+InvalidGetterSetterTypeFieldInherited/part_wrapped_script: Fail
+InvalidGetterSetterTypeFieldInherited/script: Fail
InvalidGetterSetterTypeGetterInherited/analyzerCode: Fail
+InvalidGetterSetterTypeGetterInherited/part_wrapped_script: Fail
+InvalidGetterSetterTypeGetterInherited/script: Fail
InvalidGetterSetterTypeSetterInheritedField/analyzerCode: Fail
+InvalidGetterSetterTypeSetterInheritedField/part_wrapped_script: Fail
+InvalidGetterSetterTypeSetterInheritedField/script: Fail
InvalidGetterSetterTypeSetterInheritedGetter/analyzerCode: Fail
+InvalidGetterSetterTypeSetterInheritedGetter/part_wrapped_script: Fail
+InvalidGetterSetterTypeSetterInheritedGetter/script: Fail
InvalidInitializer/example: Fail
InvalidMacroApplicationTarget/analyzerCode: Fail
InvalidMacroApplicationTarget/example: Fail
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_16.yaml.world.1.expect b/pkg/front_end/testcases/incremental/no_outline_change_16.yaml.world.1.expect
index 613f470..f93b71ea 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_16.yaml.world.1.expect
+++ b/pkg/front_end/testcases/incremental/no_outline_change_16.yaml.world.1.expect
@@ -36,14 +36,14 @@
method noSuchMethod(dart.core::Invocation msg) → dynamic {
dart.core::print("noSouchMethod!");
}
- synthetic no-such-method-forwarder get field() → dart.core::bool
- return this.{main::Foo2::noSuchMethod}(new dart.core::_InvocationMirror::_withType(#C7, 1, #C2, #C3, dart.core::Map::unmodifiable<dart.core::Symbol, dynamic>(#C4))){(dart.core::Invocation) → dynamic} as{TypeError,ForDynamic} dart.core::bool;
- synthetic no-such-method-forwarder set field(dart.core::bool value) → void
- return this.{main::Foo2::noSuchMethod}(new dart.core::_InvocationMirror::_withType(#C8, 2, #C2, dart.core::List::unmodifiable<dynamic>(dart.core::_GrowableList::_literal1<dynamic>(value)), dart.core::Map::unmodifiable<dart.core::Symbol, dynamic>(#C4))){(dart.core::Invocation) → dynamic};
synthetic no-such-method-forwarder method method() → void
return this.{main::Foo2::noSuchMethod}(new dart.core::_InvocationMirror::_withType(#C1, 0, #C2, #C3, dart.core::Map::unmodifiable<dart.core::Symbol, dynamic>(#C4))){(dart.core::Invocation) → dynamic};
synthetic no-such-method-forwarder get getter() → dart.core::bool
return this.{main::Foo2::noSuchMethod}(new dart.core::_InvocationMirror::_withType(#C5, 1, #C2, #C3, dart.core::Map::unmodifiable<dart.core::Symbol, dynamic>(#C4))){(dart.core::Invocation) → dynamic} as{TypeError,ForDynamic} dart.core::bool;
+ synthetic no-such-method-forwarder get field() → dart.core::bool
+ return this.{main::Foo2::noSuchMethod}(new dart.core::_InvocationMirror::_withType(#C7, 1, #C2, #C3, dart.core::Map::unmodifiable<dart.core::Symbol, dynamic>(#C4))){(dart.core::Invocation) → dynamic} as{TypeError,ForDynamic} dart.core::bool;
+ synthetic no-such-method-forwarder set field(dart.core::bool value) → void
+ return this.{main::Foo2::noSuchMethod}(new dart.core::_InvocationMirror::_withType(#C8, 2, #C2, dart.core::List::unmodifiable<dynamic>(dart.core::_GrowableList::_literal1<dynamic>(value)), dart.core::Map::unmodifiable<dart.core::Symbol, dynamic>(#C4))){(dart.core::Invocation) → dynamic};
synthetic no-such-method-forwarder set setter(dart.core::bool b) → void
return this.{main::Foo2::noSuchMethod}(new dart.core::_InvocationMirror::_withType(#C6, 2, #C2, dart.core::List::unmodifiable<dynamic>(dart.core::_GrowableList::_literal1<dynamic>(b)), dart.core::Map::unmodifiable<dart.core::Symbol, dynamic>(#C4))){(dart.core::Invocation) → dynamic};
}
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_16.yaml.world.2.expect b/pkg/front_end/testcases/incremental/no_outline_change_16.yaml.world.2.expect
index 8fa4085..d220680 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_16.yaml.world.2.expect
+++ b/pkg/front_end/testcases/incremental/no_outline_change_16.yaml.world.2.expect
@@ -36,14 +36,14 @@
method noSuchMethod(dart.core::Invocation msg) → dynamic {
dart.core::print("noSouchMethod!!");
}
- synthetic no-such-method-forwarder get field() → dart.core::bool
- return this.{main::Foo2::noSuchMethod}(new dart.core::_InvocationMirror::_withType(#C7, 1, #C2, #C3, dart.core::Map::unmodifiable<dart.core::Symbol, dynamic>(#C4))){(dart.core::Invocation) → dynamic} as{TypeError,ForDynamic} dart.core::bool;
- synthetic no-such-method-forwarder set field(dart.core::bool value) → void
- return this.{main::Foo2::noSuchMethod}(new dart.core::_InvocationMirror::_withType(#C8, 2, #C2, dart.core::List::unmodifiable<dynamic>(dart.core::_GrowableList::_literal1<dynamic>(value)), dart.core::Map::unmodifiable<dart.core::Symbol, dynamic>(#C4))){(dart.core::Invocation) → dynamic};
synthetic no-such-method-forwarder method method() → void
return this.{main::Foo2::noSuchMethod}(new dart.core::_InvocationMirror::_withType(#C1, 0, #C2, #C3, dart.core::Map::unmodifiable<dart.core::Symbol, dynamic>(#C4))){(dart.core::Invocation) → dynamic};
synthetic no-such-method-forwarder get getter() → dart.core::bool
return this.{main::Foo2::noSuchMethod}(new dart.core::_InvocationMirror::_withType(#C5, 1, #C2, #C3, dart.core::Map::unmodifiable<dart.core::Symbol, dynamic>(#C4))){(dart.core::Invocation) → dynamic} as{TypeError,ForDynamic} dart.core::bool;
+ synthetic no-such-method-forwarder get field() → dart.core::bool
+ return this.{main::Foo2::noSuchMethod}(new dart.core::_InvocationMirror::_withType(#C7, 1, #C2, #C3, dart.core::Map::unmodifiable<dart.core::Symbol, dynamic>(#C4))){(dart.core::Invocation) → dynamic} as{TypeError,ForDynamic} dart.core::bool;
+ synthetic no-such-method-forwarder set field(dart.core::bool value) → void
+ return this.{main::Foo2::noSuchMethod}(new dart.core::_InvocationMirror::_withType(#C8, 2, #C2, dart.core::List::unmodifiable<dynamic>(dart.core::_GrowableList::_literal1<dynamic>(value)), dart.core::Map::unmodifiable<dart.core::Symbol, dynamic>(#C4))){(dart.core::Invocation) → dynamic};
synthetic no-such-method-forwarder set setter(dart.core::bool b) → void
return this.{main::Foo2::noSuchMethod}(new dart.core::_InvocationMirror::_withType(#C6, 2, #C2, dart.core::List::unmodifiable<dynamic>(dart.core::_GrowableList::_literal1<dynamic>(b)), dart.core::Map::unmodifiable<dart.core::Symbol, dynamic>(#C4))){(dart.core::Invocation) → dynamic};
}
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_22.yaml.world.1.expect b/pkg/front_end/testcases/incremental/no_outline_change_22.yaml.world.1.expect
index 811a25f..7bf4d64 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_22.yaml.world.1.expect
+++ b/pkg/front_end/testcases/incremental/no_outline_change_22.yaml.world.1.expect
@@ -17,26 +17,6 @@
const synthetic constructor •() → main::_WithListMixin&Object&ListMixin
: super dart.core::Object::•()
;
- get /* from org-dartlang-sdk:///sdk/lib/collection/list.dart */ first() → dart.core::int {
- if(this.{dart.core::List::length}{dart.core::int} =={dart.core::num::==}{(dart.core::Object) → dart.core::bool} 0)
- throw dart._internal::IterableElementError::noElement();
- return this.{dart.core::List::[]}(0){(dart.core::int) → dart.core::int};
- }
- set /* from org-dartlang-sdk:///sdk/lib/collection/list.dart */ first(covariant-by-class dart.core::int value) → void {
- if(this.{dart.core::List::length}{dart.core::int} =={dart.core::num::==}{(dart.core::Object) → dart.core::bool} 0)
- throw dart._internal::IterableElementError::noElement();
- this.{dart.core::List::[]=}(0, value){(dart.core::int, dart.core::int) → void};
- }
- get /* from org-dartlang-sdk:///sdk/lib/collection/list.dart */ last() → dart.core::int {
- if(this.{dart.core::List::length}{dart.core::int} =={dart.core::num::==}{(dart.core::Object) → dart.core::bool} 0)
- throw dart._internal::IterableElementError::noElement();
- return this.{dart.core::List::[]}(this.{dart.core::List::length}{dart.core::int}.{dart.core::num::-}(1){(dart.core::num) → dart.core::int}){(dart.core::int) → dart.core::int};
- }
- set /* from org-dartlang-sdk:///sdk/lib/collection/list.dart */ last(covariant-by-class dart.core::int value) → void {
- if(this.{dart.core::List::length}{dart.core::int} =={dart.core::num::==}{(dart.core::Object) → dart.core::bool} 0)
- throw dart._internal::IterableElementError::noElement();
- this.{dart.core::List::[]=}(this.{dart.core::List::length}{dart.core::int}.{dart.core::num::-}(1){(dart.core::num) → dart.core::int}, value){(dart.core::int, dart.core::int) → void};
- }
@#C3
get /* from org-dartlang-sdk:///sdk/lib/collection/list.dart */ iterator() → dart.core::Iterator<dart.core::int>
return new dart._internal::ListIterator::•<dart.core::int>(this);
@@ -58,6 +38,26 @@
return this.{dart.core::List::length}{dart.core::int} =={dart.core::num::==}{(dart.core::Object) → dart.core::bool} 0;
get /* from org-dartlang-sdk:///sdk/lib/collection/list.dart */ isNotEmpty() → dart.core::bool
return !this.{dart.collection::ListBase::isEmpty}{dart.core::bool};
+ get /* from org-dartlang-sdk:///sdk/lib/collection/list.dart */ first() → dart.core::int {
+ if(this.{dart.core::List::length}{dart.core::int} =={dart.core::num::==}{(dart.core::Object) → dart.core::bool} 0)
+ throw dart._internal::IterableElementError::noElement();
+ return this.{dart.core::List::[]}(0){(dart.core::int) → dart.core::int};
+ }
+ set /* from org-dartlang-sdk:///sdk/lib/collection/list.dart */ first(covariant-by-class dart.core::int value) → void {
+ if(this.{dart.core::List::length}{dart.core::int} =={dart.core::num::==}{(dart.core::Object) → dart.core::bool} 0)
+ throw dart._internal::IterableElementError::noElement();
+ this.{dart.core::List::[]=}(0, value){(dart.core::int, dart.core::int) → void};
+ }
+ get /* from org-dartlang-sdk:///sdk/lib/collection/list.dart */ last() → dart.core::int {
+ if(this.{dart.core::List::length}{dart.core::int} =={dart.core::num::==}{(dart.core::Object) → dart.core::bool} 0)
+ throw dart._internal::IterableElementError::noElement();
+ return this.{dart.core::List::[]}(this.{dart.core::List::length}{dart.core::int}.{dart.core::num::-}(1){(dart.core::num) → dart.core::int}){(dart.core::int) → dart.core::int};
+ }
+ set /* from org-dartlang-sdk:///sdk/lib/collection/list.dart */ last(covariant-by-class dart.core::int value) → void {
+ if(this.{dart.core::List::length}{dart.core::int} =={dart.core::num::==}{(dart.core::Object) → dart.core::bool} 0)
+ throw dart._internal::IterableElementError::noElement();
+ this.{dart.core::List::[]=}(this.{dart.core::List::length}{dart.core::int}.{dart.core::num::-}(1){(dart.core::num) → dart.core::int}, value){(dart.core::int, dart.core::int) → void};
+ }
get /* from org-dartlang-sdk:///sdk/lib/collection/list.dart */ single() → dart.core::int {
if(this.{dart.core::List::length}{dart.core::int} =={dart.core::num::==}{(dart.core::Object) → dart.core::bool} 0)
throw dart._internal::IterableElementError::noElement();
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_22.yaml.world.2.expect b/pkg/front_end/testcases/incremental/no_outline_change_22.yaml.world.2.expect
index 811a25f..7bf4d64 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_22.yaml.world.2.expect
+++ b/pkg/front_end/testcases/incremental/no_outline_change_22.yaml.world.2.expect
@@ -17,26 +17,6 @@
const synthetic constructor •() → main::_WithListMixin&Object&ListMixin
: super dart.core::Object::•()
;
- get /* from org-dartlang-sdk:///sdk/lib/collection/list.dart */ first() → dart.core::int {
- if(this.{dart.core::List::length}{dart.core::int} =={dart.core::num::==}{(dart.core::Object) → dart.core::bool} 0)
- throw dart._internal::IterableElementError::noElement();
- return this.{dart.core::List::[]}(0){(dart.core::int) → dart.core::int};
- }
- set /* from org-dartlang-sdk:///sdk/lib/collection/list.dart */ first(covariant-by-class dart.core::int value) → void {
- if(this.{dart.core::List::length}{dart.core::int} =={dart.core::num::==}{(dart.core::Object) → dart.core::bool} 0)
- throw dart._internal::IterableElementError::noElement();
- this.{dart.core::List::[]=}(0, value){(dart.core::int, dart.core::int) → void};
- }
- get /* from org-dartlang-sdk:///sdk/lib/collection/list.dart */ last() → dart.core::int {
- if(this.{dart.core::List::length}{dart.core::int} =={dart.core::num::==}{(dart.core::Object) → dart.core::bool} 0)
- throw dart._internal::IterableElementError::noElement();
- return this.{dart.core::List::[]}(this.{dart.core::List::length}{dart.core::int}.{dart.core::num::-}(1){(dart.core::num) → dart.core::int}){(dart.core::int) → dart.core::int};
- }
- set /* from org-dartlang-sdk:///sdk/lib/collection/list.dart */ last(covariant-by-class dart.core::int value) → void {
- if(this.{dart.core::List::length}{dart.core::int} =={dart.core::num::==}{(dart.core::Object) → dart.core::bool} 0)
- throw dart._internal::IterableElementError::noElement();
- this.{dart.core::List::[]=}(this.{dart.core::List::length}{dart.core::int}.{dart.core::num::-}(1){(dart.core::num) → dart.core::int}, value){(dart.core::int, dart.core::int) → void};
- }
@#C3
get /* from org-dartlang-sdk:///sdk/lib/collection/list.dart */ iterator() → dart.core::Iterator<dart.core::int>
return new dart._internal::ListIterator::•<dart.core::int>(this);
@@ -58,6 +38,26 @@
return this.{dart.core::List::length}{dart.core::int} =={dart.core::num::==}{(dart.core::Object) → dart.core::bool} 0;
get /* from org-dartlang-sdk:///sdk/lib/collection/list.dart */ isNotEmpty() → dart.core::bool
return !this.{dart.collection::ListBase::isEmpty}{dart.core::bool};
+ get /* from org-dartlang-sdk:///sdk/lib/collection/list.dart */ first() → dart.core::int {
+ if(this.{dart.core::List::length}{dart.core::int} =={dart.core::num::==}{(dart.core::Object) → dart.core::bool} 0)
+ throw dart._internal::IterableElementError::noElement();
+ return this.{dart.core::List::[]}(0){(dart.core::int) → dart.core::int};
+ }
+ set /* from org-dartlang-sdk:///sdk/lib/collection/list.dart */ first(covariant-by-class dart.core::int value) → void {
+ if(this.{dart.core::List::length}{dart.core::int} =={dart.core::num::==}{(dart.core::Object) → dart.core::bool} 0)
+ throw dart._internal::IterableElementError::noElement();
+ this.{dart.core::List::[]=}(0, value){(dart.core::int, dart.core::int) → void};
+ }
+ get /* from org-dartlang-sdk:///sdk/lib/collection/list.dart */ last() → dart.core::int {
+ if(this.{dart.core::List::length}{dart.core::int} =={dart.core::num::==}{(dart.core::Object) → dart.core::bool} 0)
+ throw dart._internal::IterableElementError::noElement();
+ return this.{dart.core::List::[]}(this.{dart.core::List::length}{dart.core::int}.{dart.core::num::-}(1){(dart.core::num) → dart.core::int}){(dart.core::int) → dart.core::int};
+ }
+ set /* from org-dartlang-sdk:///sdk/lib/collection/list.dart */ last(covariant-by-class dart.core::int value) → void {
+ if(this.{dart.core::List::length}{dart.core::int} =={dart.core::num::==}{(dart.core::Object) → dart.core::bool} 0)
+ throw dart._internal::IterableElementError::noElement();
+ this.{dart.core::List::[]=}(this.{dart.core::List::length}{dart.core::int}.{dart.core::num::-}(1){(dart.core::num) → dart.core::int}, value){(dart.core::int, dart.core::int) → void};
+ }
get /* from org-dartlang-sdk:///sdk/lib/collection/list.dart */ single() → dart.core::int {
if(this.{dart.core::List::length}{dart.core::int} =={dart.core::num::==}{(dart.core::Object) → dart.core::bool} 0)
throw dart._internal::IterableElementError::noElement();
diff --git a/runtime/vm/experimental_features.cc b/runtime/vm/experimental_features.cc
index 6486e6c..4147e23 100644
--- a/runtime/vm/experimental_features.cc
+++ b/runtime/vm/experimental_features.cc
@@ -16,8 +16,8 @@
bool GetExperimentalFeatureDefault(ExperimentalFeature feature) {
constexpr bool kFeatureValues[] = {
- true, true, true, true, true, true, true, true, true,
- true, true, true, true, true, true, true, true, true,
+ true, true, true, true, true, true, true, true, true, true,
+ true, true, true, true, true, true, true, true, true, true,
true, true, true, true, true, true, true, true, true,
};
ASSERT(static_cast<size_t>(feature) < ARRAY_SIZE(kFeatureValues));
@@ -26,6 +26,8 @@
const char* GetExperimentalFeatureName(ExperimentalFeature feature) {
constexpr const char* kFeatureNames[] = {
+ "native-assets",
+ "getter-setter-error",
"sound-flow-analysis",
"null-aware-elements",
"inference-using-bounds",
diff --git a/runtime/vm/experimental_features.h b/runtime/vm/experimental_features.h
index fa8b6ba..c7b2ac8 100644
--- a/runtime/vm/experimental_features.h
+++ b/runtime/vm/experimental_features.h
@@ -12,6 +12,8 @@
namespace dart {
enum class ExperimentalFeature {
+ native_assets,
+ getter_setter_error,
sound_flow_analysis,
null_aware_elements,
inference_using_bounds,
diff --git a/tests/language/enum/enhanced_enums_error_test.dart b/tests/language/enum/enhanced_enums_error_test.dart
index 795996c..617bc26 100644
--- a/tests/language/enum/enhanced_enums_error_test.dart
+++ b/tests/language/enum/enhanced_enums_error_test.dart
@@ -78,6 +78,8 @@
// [analyzer] COMPILE_TIME_ERROR.CONFLICTING_STATIC_AND_INSTANCE
// [cfe] This static member conflicts with an instance member.
int foo() => 37;
+ // ^
+ // [cfe] The declaration conflicts with setter 'foo'.
}
enum ConflictStaticInstanceProperty2 {
@@ -86,6 +88,7 @@
static void set foo(int _) {}
// ^^^
// [analyzer] COMPILE_TIME_ERROR.CONFLICTING_STATIC_AND_INSTANCE
+ // [cfe] Static property 'foo' conflicts with instance property of the same name.
// [cfe] This static member conflicts with an instance member.
}
@@ -98,6 +101,8 @@
// [analyzer] COMPILE_TIME_ERROR.CONFLICTING_STATIC_AND_INSTANCE
// [cfe] This static member conflicts with an instance member.
void set foo(int _) {}
+ // ^
+ // [cfe] Instance property 'foo' conflicts with static property of the same name.
}
@@ -172,14 +177,14 @@
toString;
//^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.CONFLICTING_STATIC_AND_INSTANCE
-// [cfe] 'toString' is already declared in this scope.
+// [cfe] Can't declare a member that conflicts with an inherited one.
}
enum ConflictEnumValueImplicitValues {
values;
//^^^^^^
// [analyzer] COMPILE_TIME_ERROR.VALUES_DECLARATION_IN_ENUM
-// [cfe] 'values' is already declared in this scope.
+// [cfe] An enum can't declare a member named 'values'.
}
enum ConflictEnumValueInheritedFoo with MethodFoo {
@@ -192,9 +197,6 @@
enum ConflictClassGetterSetterTypeInstance {
e1;
num get foo => 42;
- // ^^^
- // [analyzer] COMPILE_TIME_ERROR.GETTER_NOT_SUBTYPE_SETTER_TYPES
- // [cfe] The type 'num' of the getter 'ConflictClassGetterSetterTypeInstance.foo' is not a subtype of the type 'int' of the setter 'ConflictClassGetterSetterTypeInstance.foo'.
// Type of setter parameter must be subtype of type of getter.
void set foo(int _) {}
@@ -203,9 +205,6 @@
enum ConflictClassGetterSetterTypeStatic {
e1;
static num get foo => 42;
- // ^^^
- // [analyzer] COMPILE_TIME_ERROR.GETTER_NOT_SUBTYPE_SETTER_TYPES
- // [cfe] The type 'num' of the getter 'ConflictClassGetterSetterTypeStatic.foo' is not a subtype of the type 'int' of the setter 'ConflictClassGetterSetterTypeStatic.foo'.
// Type of setter parameter must be subtype of type of getter.
static void set foo(int _) {}
@@ -219,9 +218,6 @@
enum ConflictClassEnumValueStaticSetterType {
e1;
-//^^
-// [analyzer] COMPILE_TIME_ERROR.GETTER_NOT_SUBTYPE_SETTER_TYPES
-// [cfe] The type 'ConflictClassEnumValueStaticSetterType' of the getter 'ConflictClassEnumValueStaticSetterType.e1' is not a subtype of the type 'int' of the setter 'ConflictClassEnumValueStaticSetterType.e1'.
// Type of setter parameter must be subtype of type of getter.
static void set e1(int _) {}
@@ -332,22 +328,18 @@
enum ConflictConstructorNameStatic {
e1.foo();
const ConflictConstructorNameStatic.foo();
- // ^
- // [cfe] Conflicts with member 'foo'.
// ^^^
// [analyzer] COMPILE_TIME_ERROR.CONFLICTING_CONSTRUCTOR_AND_STATIC_MEMBER
static int get foo => 42;
// ^
- // [cfe] Conflicts with constructor 'ConflictConstructorNameStatic.foo'.
+ // [cfe] The member conflicts with constructor 'ConflictConstructorNameStatic.foo'.
}
enum ConflictConstructorNameStaticEnumValue {
e1.e1();
-//^
-// [cfe] Conflicts with constructor 'ConflictConstructorNameStaticEnumValue.e1'.
const ConflictConstructorNameStaticEnumValue.e1();
// ^
- // [cfe] Conflicts with member 'e1'.
+ // [cfe] The constructor conflicts with member 'e1'.
// ^^
// [analyzer] COMPILE_TIME_ERROR.CONFLICTING_CONSTRUCTOR_AND_STATIC_MEMBER
}
@@ -397,8 +389,7 @@
ConflictClassEnumValue;
//^^^^^^^^^^^^^^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.ENUM_CONSTANT_SAME_NAME_AS_ENCLOSING
-// [cfe] Name of enum constant 'ConflictClassEnumValue' can't be the same as the enum's own name.
-// ^
+// [cfe] A class member can't have the same name as the enclosing class.
// [cfe] Couldn't find constructor 'ConflictClassEnumValue'.
}
@@ -652,8 +643,6 @@
// Cannot have cyclic references between constants.
enum CyclicReference {
-// ^
-// [cfe] Constant evaluation error:
e1(e2),
//^^
// [analyzer] COMPILE_TIME_ERROR.RECURSIVE_COMPILE_TIME_CONSTANT
diff --git a/tests/language/extension_methods/static_extension_setter_getter_assignability_error_test.dart b/tests/language/extension_methods/static_extension_setter_getter_assignability_error_test.dart
index 38cd8c0..14bcfa6 100644
--- a/tests/language/extension_methods/static_extension_setter_getter_assignability_error_test.dart
+++ b/tests/language/extension_methods/static_extension_setter_getter_assignability_error_test.dart
@@ -7,14 +7,8 @@
// of the setter.
extension E1 on int {
static int get property => 1;
- // ^^^^^^^^
- // [analyzer] COMPILE_TIME_ERROR.GETTER_NOT_SUBTYPE_SETTER_TYPES
- // [cfe] The type 'int' of the getter 'property' is not a subtype of the type 'String' of the setter 'property'.
static void set property(String value) {}
int get property2 => 1;
- // ^^^^^^^^^
- // [analyzer] COMPILE_TIME_ERROR.GETTER_NOT_SUBTYPE_SETTER_TYPES
- // [cfe] The type 'int' of the getter 'property2' is not a subtype of the type 'String' of the setter 'property2'.
void set property2(String x) {}
}
diff --git a/tests/language/field/field1_test.dart b/tests/language/field/field1_test.dart
index 54d5af4..f427264 100644
--- a/tests/language/field/field1_test.dart
+++ b/tests/language/field/field1_test.dart
@@ -11,7 +11,6 @@
get a {
//^
// [analyzer] COMPILE_TIME_ERROR.DUPLICATE_DEFINITION
- // [analyzer] COMPILE_TIME_ERROR.GETTER_NOT_SUBTYPE_SETTER_TYPES
// [cfe] 'a' is already declared in this scope.
return 1;
}
diff --git a/tests/language/getter/setter2_test.dart b/tests/language/getter/setter2_test.dart
index 04d4aa0..20568b6 100644
--- a/tests/language/getter/setter2_test.dart
+++ b/tests/language/getter/setter2_test.dart
@@ -23,9 +23,6 @@
class T1 {
late A getterField;
A get field {
- // ^^^^^
- // [analyzer] COMPILE_TIME_ERROR.GETTER_NOT_SUBTYPE_SETTER_TYPES
- // [cfe] The type 'A' of the getter 'T1.field' is not a subtype of the type 'B' of the setter 'T1.field'.
return getterField;
}
@@ -38,9 +35,6 @@
late A getterField;
late C setterField;
A get field {
- // ^^^^^
- // [analyzer] COMPILE_TIME_ERROR.GETTER_NOT_SUBTYPE_SETTER_TYPES
- // [cfe] The type 'A' of the getter 'T2.field' is not a subtype of the type 'C' of the setter 'T2.field'.
return getterField;
}
diff --git a/tests/language/getter/setter_type_test.dart b/tests/language/getter/setter_type_test.dart
index 24c34f5..c4f04b8 100644
--- a/tests/language/getter/setter_type_test.dart
+++ b/tests/language/getter/setter_type_test.dart
@@ -7,9 +7,6 @@
int bar = 499;
int get foo => bar;
-// ^^^
-// [analyzer] COMPILE_TIME_ERROR.GETTER_NOT_SUBTYPE_SETTER_TYPES
-// [cfe] The type 'int' of the getter 'foo' is not a subtype of the type 'String' of the setter 'foo'.
void set foo(String str) {
bar = str.length;
diff --git a/tests/language/override/inheritance_field_test.dart b/tests/language/override/inheritance_field_test.dart
index b7c3a65..fea4028 100644
--- a/tests/language/override/inheritance_field_test.dart
+++ b/tests/language/override/inheritance_field_test.dart
@@ -41,7 +41,7 @@
void set field12(int _) {} //# 52: ok
num field13 = 0; //# 53: compile-time error
set field14(num _) {} //# 54: compile-time error
- num field15 = 0; //# 55: compile-time error
+ num field15 = 0; //# 55: ok
}
class B extends A {
diff --git a/tests/language/override/inheritance_setter_test.dart b/tests/language/override/inheritance_setter_test.dart
index 518109f..696ac28 100644
--- a/tests/language/override/inheritance_setter_test.dart
+++ b/tests/language/override/inheritance_setter_test.dart
@@ -16,7 +16,7 @@
void set setter4(num x) {} //# 004: compile-time error
void set setter5(num x) {} //# 005: ok
void set setter6(num x) {} //# 006: compile-time error
- void set setter7(num x) {} //# 007: compile-time error
+ void set setter7(num x) {} //# 007: ok
}
class B extends A {
diff --git a/tests/language/setter/declaration_test.dart b/tests/language/setter/declaration_test.dart
index a89958a..2f0e37c 100644
--- a/tests/language/setter/declaration_test.dart
+++ b/tests/language/setter/declaration_test.dart
@@ -34,27 +34,15 @@
// [cfe] The return type of the setter must be 'void' or absent.
int get nonSubtypes1 => 1;
-// ^^^^^^^^^^^^
-// [analyzer] COMPILE_TIME_ERROR.GETTER_NOT_SUBTYPE_SETTER_TYPES
-// [cfe] The type 'int' of the getter 'nonSubtypes1' is not a subtype of the type 'String' of the setter 'nonSubtypes1'.
set nonSubtypes1(String _) {}
int? get nonSubtypes2 => 1;
-// ^^^^^^^^^^^^
-// [analyzer] COMPILE_TIME_ERROR.GETTER_NOT_SUBTYPE_SETTER_TYPES
-// [cfe] The type 'int?' of the getter 'nonSubtypes2' is not a subtype of the type 'int' of the setter 'nonSubtypes2'.
set nonSubtypes2(int _) {}
FutureOr<int> get nonSubtypes3 => 1;
-// ^^^^^^^^^^^^
-// [analyzer] COMPILE_TIME_ERROR.GETTER_NOT_SUBTYPE_SETTER_TYPES
-// [cfe] The type 'FutureOr<int>' of the getter 'nonSubtypes3' is not a subtype of the type 'int' of the setter 'nonSubtypes3'.
set nonSubtypes3(int _) {}
dynamic get nonSubtypes4 => 1;
-// ^^^^^^^^^^^^
-// [analyzer] COMPILE_TIME_ERROR.GETTER_NOT_SUBTYPE_SETTER_TYPES
-// [cfe] The type 'dynamic' of the getter 'nonSubtypes4' is not a subtype of the type 'int' of the setter 'nonSubtypes4'.
set nonSubtypes4(int _) {}
class C {
@@ -89,51 +77,27 @@
// [cfe] The return type of the setter must be 'void' or absent.
static int get staticNonSubtypes1 => 1;
- // ^^^^^^^^^^^^^^^^^^
- // [analyzer] COMPILE_TIME_ERROR.GETTER_NOT_SUBTYPE_SETTER_TYPES
- // [cfe] The type 'int' of the getter 'C.staticNonSubtypes1' is not a subtype of the type 'String' of the setter 'C.staticNonSubtypes1'.
static set staticNonSubtypes1(String _) {}
static int? get staticNonSubtypes2 => 1;
- // ^^^^^^^^^^^^^^^^^^
- // [analyzer] COMPILE_TIME_ERROR.GETTER_NOT_SUBTYPE_SETTER_TYPES
- // [cfe] The type 'int?' of the getter 'C.staticNonSubtypes2' is not a subtype of the type 'int' of the setter 'C.staticNonSubtypes2'.
static set staticNonSubtypes2(int _) {}
static FutureOr<int> get staticNonSubtypes3 => 1;
- // ^^^^^^^^^^^^^^^^^^
- // [analyzer] COMPILE_TIME_ERROR.GETTER_NOT_SUBTYPE_SETTER_TYPES
- // [cfe] The type 'FutureOr<int>' of the getter 'C.staticNonSubtypes3' is not a subtype of the type 'int' of the setter 'C.staticNonSubtypes3'.
static set staticNonSubtypes3(int _) {}
static dynamic get staticNonSubtypes4 => 1;
- // ^^^^^^^^^^^^^^^^^^
- // [analyzer] COMPILE_TIME_ERROR.GETTER_NOT_SUBTYPE_SETTER_TYPES
- // [cfe] The type 'dynamic' of the getter 'C.staticNonSubtypes4' is not a subtype of the type 'int' of the setter 'C.staticNonSubtypes4'.
static set staticNonSubtypes4(int _) {}
int get nonSubtypes1 => 1;
- // ^^^^^^^^^^^^
- // [analyzer] COMPILE_TIME_ERROR.GETTER_NOT_SUBTYPE_SETTER_TYPES
- // [cfe] The type 'int' of the getter 'C.nonSubtypes1' is not a subtype of the type 'String' of the setter 'C.nonSubtypes1'.
set nonSubtypes1(String _) {}
int? get nonSubtypes2 => 1;
- // ^^^^^^^^^^^^
- // [analyzer] COMPILE_TIME_ERROR.GETTER_NOT_SUBTYPE_SETTER_TYPES
- // [cfe] The type 'int?' of the getter 'C.nonSubtypes2' is not a subtype of the type 'int' of the setter 'C.nonSubtypes2'.
set nonSubtypes2(int _) {}
FutureOr<int> get nonSubtypes3 => 1;
- // ^^^^^^^^^^^^
- // [analyzer] COMPILE_TIME_ERROR.GETTER_NOT_SUBTYPE_SETTER_TYPES
- // [cfe] The type 'FutureOr<int>' of the getter 'C.nonSubtypes3' is not a subtype of the type 'int' of the setter 'C.nonSubtypes3'.
set nonSubtypes3(int _) {}
dynamic get nonSubtypes4 => 1;
- // ^^^^^^^^^^^^
- // [analyzer] COMPILE_TIME_ERROR.GETTER_NOT_SUBTYPE_SETTER_TYPES
- // [cfe] The type 'dynamic' of the getter 'C.nonSubtypes4' is not a subtype of the type 'int' of the setter 'C.nonSubtypes4'.
set nonSubtypes4(int _) {}
}
diff --git a/tools/experimental_features.yaml b/tools/experimental_features.yaml
index c02b6f0..c3ac6fe 100644
--- a/tools/experimental_features.yaml
+++ b/tools/experimental_features.yaml
@@ -149,9 +149,6 @@
dot-shorthands:
help: "Shorter dot syntax for static accesses."
- getter-setter-error:
- help: "Stop reporting errors about mismatching types in a getter/setter pair."
-
# Experiment flag only used for testing.
test-experiment:
help: >-
@@ -165,6 +162,21 @@
# Shipped flags should be marked retired the following stable release.
#
+
+ getter-setter-error:
+ enabledIn: '3.9.0'
+ validation: |
+ class A {
+ String get foo => 'feature enabled';
+ void set foo(int value) {}
+ }
+ main() {
+ A a = new A();
+ a.foo = 0;
+ print(a.foo);
+ }
+ help: "Stop reporting errors about mismatching types in a getter/setter pair."
+
sound-flow-analysis:
enabledIn: '3.9.0'
validation: |