Version 1.25.0-dev.16.4
Cherry-pick 73c93a3a1380e78dc686ff2a6fca5ae482e4a0ee into dev
diff --git a/pkg/analyzer/lib/error/error.dart b/pkg/analyzer/lib/error/error.dart
index 21f1dca..0787c5d 100644
--- a/pkg/analyzer/lib/error/error.dart
+++ b/pkg/analyzer/lib/error/error.dart
@@ -82,8 +82,6 @@
CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER,
CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD,
CompileTimeErrorCode.CONST_DEFERRED_CLASS,
- CompileTimeErrorCode.CONST_EVAL_THROWS_ASSERT_FALSE,
- CompileTimeErrorCode.CONST_EVAL_THROWS_ASSERT_NOT_BOOL,
CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION,
CompileTimeErrorCode.CONST_EVAL_THROWS_IDBZE,
CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL,
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart
index 27e5d29..be8792e 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -92,7 +92,7 @@
/**
* The version of data format, should be incremented on every format change.
*/
- static const int DATA_VERSION = 42;
+ static const int DATA_VERSION = 43;
/**
* The number of exception contexts allowed to write. Once this field is
diff --git a/pkg/analyzer/lib/src/dart/constant/evaluation.dart b/pkg/analyzer/lib/src/dart/constant/evaluation.dart
index b0f6523..fc3ee08 100644
--- a/pkg/analyzer/lib/src/dart/constant/evaluation.dart
+++ b/pkg/analyzer/lib/src/dart/constant/evaluation.dart
@@ -706,24 +706,7 @@
String superName = null;
NodeList<Expression> superArguments = null;
for (ConstructorInitializer initializer in initializers) {
- if (initializer is AssertInitializer) {
- Expression condition = initializer.condition;
- DartObjectImpl conditionResult = condition?.accept(initializerVisitor);
- if (conditionResult != null) {
- if (conditionResult.isBool) {
- if (!conditionResult.toBoolValue()) {
- errorReporter.reportErrorForNode(
- CompileTimeErrorCode.CONST_EVAL_THROWS_ASSERT_FALSE, node);
- }
- } else {
- errorReporter.reportErrorForNode(
- CompileTimeErrorCode.CONST_EVAL_THROWS_ASSERT_NOT_BOOL, node);
- }
- } else {
- errorReporter.reportErrorForNode(
- CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION, node);
- }
- } else if (initializer is ConstructorFieldInitializer) {
+ if (initializer is ConstructorFieldInitializer) {
Expression initializerExpression = initializer.expression;
DartObjectImpl evaluationResult =
initializerExpression?.accept(initializerVisitor);
diff --git a/pkg/analyzer/lib/src/error/codes.dart b/pkg/analyzer/lib/src/error/codes.dart
index 58e844c..346daf9 100644
--- a/pkg/analyzer/lib/src/error/codes.dart
+++ b/pkg/analyzer/lib/src/error/codes.dart
@@ -640,36 +640,6 @@
"'num'.");
/**
- * https://github.com/dart-lang/sdk/blob/master/docs/language/informal/assert-in-initializer-list.md
- *
- * During a const constructor invocation (that is, when the `const`
- * constructor is invoked using the const prefix), if the assert fails,
- * either due to boolean conversion when `r` is not a boolean value or due to
- * assertion failure when `r` is `false`, it is treated like any other
- * compile-time throw in a compile-time constant expression, and it causes
- * a compile-time error.
- */
- static const CompileTimeErrorCode CONST_EVAL_THROWS_ASSERT_NOT_BOOL =
- const CompileTimeErrorCode(
- 'CONST_EVAL_THROWS_ASSERT_NOT_BOOL',
- "In constant constructors the value of the condition of an assert "
- "statement must be bool.");
-
- /**
- * https://github.com/dart-lang/sdk/blob/master/docs/language/informal/assert-in-initializer-list.md
- *
- * During a const constructor invocation (that is, when the `const`
- * constructor is invoked using the const prefix), if the assert fails,
- * either due to boolean conversion when `r` is not a boolean value or due to
- * assertion failure when `r` is `false`, it is treated like any other
- * compile-time throw in a compile-time constant expression, and it causes
- * a compile-time error.
- */
- static const CompileTimeErrorCode CONST_EVAL_THROWS_ASSERT_FALSE =
- const CompileTimeErrorCode('CONST_EVAL_THROWS_ASSERT_FALSE',
- "Evaluation of this constant expression throws an AssertionError.");
-
- /**
* 16.12.2 Const: It is a compile-time error if evaluation of a constant
* object results in an uncaught exception being thrown.
*/
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index 9cde7c1..aed62ae 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -1714,10 +1714,6 @@
AnalysisError data = errors[i];
ErrorCode dataErrorCode = data.errorCode;
if (identical(dataErrorCode,
- CompileTimeErrorCode.CONST_EVAL_THROWS_ASSERT_FALSE) ||
- identical(dataErrorCode,
- CompileTimeErrorCode.CONST_EVAL_THROWS_ASSERT_NOT_BOOL) ||
- identical(dataErrorCode,
CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION) ||
identical(
dataErrorCode, CompileTimeErrorCode.CONST_EVAL_THROWS_IDBZE) ||
diff --git a/pkg/analyzer/test/generated/compile_time_error_code_test.dart b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
index e8cc068..5158c90 100644
--- a/pkg/analyzer/test/generated/compile_time_error_code_test.dart
+++ b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
@@ -1120,35 +1120,6 @@
verify([source]);
}
- test_constEvalThrowsException_assertInitializer_false() async {
- resetWith(
- options: new AnalysisOptionsImpl()..enableAssertInitializer = true);
- Source source = addSource(r'''
-class A {
- const A(int p) : assert(p != 0);
-}
-const a = const A(0);
-''');
- await computeAnalysisResult(source);
- assertErrors(source, [CompileTimeErrorCode.CONST_EVAL_THROWS_ASSERT_FALSE]);
- verify([source]);
- }
-
- test_constEvalThrowsException_assertInitializer_notBool() async {
- resetWith(
- options: new AnalysisOptionsImpl()..enableAssertInitializer = true);
- Source source = addSource(r'''
-class A<T> {
- const A(T p) : assert(p);
-}
-const a = const A(0);
-''');
- await computeAnalysisResult(source);
- assertErrors(
- source, [CompileTimeErrorCode.CONST_EVAL_THROWS_ASSERT_NOT_BOOL]);
- verify([source]);
- }
-
test_constEvalThrowsException_binaryMinus_null() async {
await _check_constEvalThrowsException_binary_null("null - 5", false);
await _check_constEvalThrowsException_binary_null("5 - null", true);
diff --git a/pkg/analyzer/test/generated/non_error_resolver_test.dart b/pkg/analyzer/test/generated/non_error_resolver_test.dart
index fae2d4f..c518a0e 100644
--- a/pkg/analyzer/test/generated/non_error_resolver_test.dart
+++ b/pkg/analyzer/test/generated/non_error_resolver_test.dart
@@ -1456,34 +1456,6 @@
verify([source]);
}
- test_constEvalThrowsException_assertInitializer_notConst() async {
- resetWith(
- options: new AnalysisOptionsImpl()..enableAssertInitializer = true);
- Source source = addSource(r'''
-class A {
- A(int p) : assert(p != 0);
-}
-var a = new A(0);
-''');
- await computeAnalysisResult(source);
- assertNoErrors(source);
- verify([source]);
- }
-
- test_constEvalThrowsException_assertInitializer_true() async {
- resetWith(
- options: new AnalysisOptionsImpl()..enableAssertInitializer = true);
- Source source = addSource(r'''
-class A {
- const A(int p) : assert(p != 0);
-}
-const a = const A(1);
-''');
- await computeAnalysisResult(source);
- assertNoErrors(source);
- verify([source]);
- }
-
test_constEvalTypeBoolNumString_equal() async {
Source source = addSource(r'''
class A {
diff --git a/tools/VERSION b/tools/VERSION
index c9fa253..1648a92 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -28,4 +28,4 @@
MINOR 25
PATCH 0
PRERELEASE 16
-PRERELEASE_PATCH 3
+PRERELEASE_PATCH 4