mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 08:24:39 +00:00
Fix the const assertion test.
Dart 2 has no notion of "checked mode", so a failed assertion in a const constructor should always be a compile error. Change-Id: I02227c03613346918de1e3a7f7c70d209a940b90 Reviewed-on: https://dart-review.googlesource.com/37647 Reviewed-by: Leaf Petersen <leafp@google.com>
This commit is contained in:
parent
0916cca7d2
commit
85faacc23c
|
@ -10,38 +10,38 @@ class C {
|
|||
final int x;
|
||||
// Const constructors.
|
||||
const C.cc01(this.x, y)
|
||||
: assert(x < y) //# cc01: checked mode compile-time error
|
||||
: assert(x < y) //# cc01: compile-time error
|
||||
;
|
||||
const C.cc02(x, y) : x = x
|
||||
, assert(x < y) //# cc02: checked mode compile-time error
|
||||
, assert(x < y) //# cc02: compile-time error
|
||||
;
|
||||
const C.cc03(x, y) :
|
||||
assert(x < y), //# cc03: checked mode compile-time error
|
||||
assert(x < y), //# cc03: compile-time error
|
||||
x = x;
|
||||
const C.cc05(this.x, y) :
|
||||
assert(x < y), //# cc05: checked mode compile-time error
|
||||
assert(x < y), //# cc05: compile-time error
|
||||
super();
|
||||
const C.cc06(x, y) : x = x
|
||||
, assert(x < y) //# cc06: checked mode compile-time error
|
||||
, assert(x < y) //# cc06: compile-time error
|
||||
, super()
|
||||
;
|
||||
const C.cc07(x, y) :
|
||||
assert(x < y), //# cc07: checked mode compile-time error
|
||||
assert(x < y), //# cc07: compile-time error
|
||||
x = x, super();
|
||||
const C.cc08(x, y) :
|
||||
assert(x < y), //# cc08: checked mode compile-time error
|
||||
assert(x < y), //# cc08: compile-time error
|
||||
x = x
|
||||
, assert(y > x) //# cc08: continued
|
||||
, super()
|
||||
;
|
||||
const C.cc09(this.x, y)
|
||||
: assert(x < y, "$x < $y") //# cc09: checked mode compile-time error
|
||||
: assert(x < y, "$x < $y") //# cc09: compile-time error
|
||||
;
|
||||
const C.cc10(this.x, y)
|
||||
: assert(x < y,) //# cc10: checked mode compile-time error
|
||||
: assert(x < y,) //# cc10: compile-time error
|
||||
;
|
||||
const C.cc11(this.x, y)
|
||||
: assert(x < y, "$x < $y",) //# cc11: checked mode compile-time error
|
||||
: assert(x < y, "$x < $y",) //# cc11: compile-time error
|
||||
;
|
||||
}
|
||||
|
||||
|
|
|
@ -759,17 +759,22 @@ type_variable_identifier_expression_test: MissingCompileTimeError
|
|||
type_variable_static_context_test: MissingCompileTimeError
|
||||
unresolved_in_factory_test: MissingCompileTimeError
|
||||
|
||||
[ $compiler == dart2analyzer && !$checked && $strong ]
|
||||
assertion_initializer_const_error2_test/*: CompileTimeError
|
||||
assertion_initializer_const_error2_test/none: Pass
|
||||
|
||||
[ $compiler == dart2analyzer && !$checked && !$strong ]
|
||||
abstract_beats_arguments_test: MissingCompileTimeError
|
||||
abstract_exact_selector_test/01: MissingCompileTimeError
|
||||
abstract_factory_constructor_test/00: MissingCompileTimeError
|
||||
abstract_getter_test/01: MissingCompileTimeError
|
||||
abstract_syntax_test/00: MissingCompileTimeError
|
||||
assertion_initializer_const_error2_test/*: Pass
|
||||
assertion_initializer_const_error2_test/cc01: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
assertion_initializer_const_error2_test/cc02: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
assertion_initializer_const_error2_test/cc03: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
assertion_initializer_const_error2_test/cc05: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
assertion_initializer_const_error2_test/cc06: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
assertion_initializer_const_error2_test/cc07: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
assertion_initializer_const_error2_test/cc08: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
assertion_initializer_const_error2_test/cc09: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
assertion_initializer_const_error2_test/cc10: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
assertion_initializer_const_error2_test/cc11: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
assign_static_type_test/01: MissingCompileTimeError
|
||||
assign_static_type_test/02: MissingCompileTimeError
|
||||
assign_static_type_test/03: MissingCompileTimeError
|
||||
|
|
|
@ -759,8 +759,16 @@ recursive_mixin_test: RuntimeError # no check without --checked
|
|||
type_argument_in_super_type_test: RuntimeError
|
||||
|
||||
[ $compiler == dart2js && !$checked && $dart2js_with_kernel ]
|
||||
assertion_initializer_const_error2_test/*: CompileTimeError # Issue #31321
|
||||
assertion_initializer_const_error2_test/none: Pass
|
||||
assertion_initializer_const_error2_test/cc01: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
assertion_initializer_const_error2_test/cc02: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
assertion_initializer_const_error2_test/cc03: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
assertion_initializer_const_error2_test/cc05: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
assertion_initializer_const_error2_test/cc06: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
assertion_initializer_const_error2_test/cc07: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
assertion_initializer_const_error2_test/cc08: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
assertion_initializer_const_error2_test/cc09: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
assertion_initializer_const_error2_test/cc10: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
assertion_initializer_const_error2_test/cc11: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
cascaded_forwarding_stubs_generic_test: RuntimeError
|
||||
cascaded_forwarding_stubs_test: RuntimeError
|
||||
checked_setter3_test: RuntimeError # Issue 31128
|
||||
|
|
|
@ -949,6 +949,16 @@ wrong_number_type_arguments_test/none: Pass
|
|||
ct_const2_test: Fail
|
||||
|
||||
[ $compiler == dartk && $strong ]
|
||||
assertion_initializer_const_error2_test/cc01: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
assertion_initializer_const_error2_test/cc02: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
assertion_initializer_const_error2_test/cc03: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
assertion_initializer_const_error2_test/cc05: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
assertion_initializer_const_error2_test/cc06: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
assertion_initializer_const_error2_test/cc07: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
assertion_initializer_const_error2_test/cc08: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
assertion_initializer_const_error2_test/cc09: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
assertion_initializer_const_error2_test/cc10: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
assertion_initializer_const_error2_test/cc11: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
cha_deopt2_test: CompileTimeError, DartkCrash # KernelVM bug: Deferred loading kernel issue 28335.
|
||||
cha_deopt3_test: CompileTimeError, DartkCrash # KernelVM bug: Deferred loading kernel issue 28335.
|
||||
hello_dart_test: Crash
|
||||
|
|
|
@ -4,6 +4,16 @@
|
|||
# Sections in this file should contain "$runtime == vm".
|
||||
|
||||
[ $compiler == dartkp ]
|
||||
assertion_initializer_const_error2_test/cc01: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
assertion_initializer_const_error2_test/cc02: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
assertion_initializer_const_error2_test/cc03: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
assertion_initializer_const_error2_test/cc05: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
assertion_initializer_const_error2_test/cc06: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
assertion_initializer_const_error2_test/cc07: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
assertion_initializer_const_error2_test/cc08: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
assertion_initializer_const_error2_test/cc09: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
assertion_initializer_const_error2_test/cc10: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
assertion_initializer_const_error2_test/cc11: MissingCompileTimeError # Not reporting failed assert() at compile time.
|
||||
implicit_creation/implicit_new_or_const_composite_test: RuntimeError
|
||||
implicit_creation/implicit_new_or_const_test: RuntimeError
|
||||
|
||||
|
|
|
@ -1410,7 +1410,7 @@ class StandardTestSuite extends TestSuite {
|
|||
|
||||
List<String> singleListOfOptions(String name) {
|
||||
var matches = new RegExp('// $name=(.*)').allMatches(contents);
|
||||
var options;
|
||||
List<String> options;
|
||||
for (var match in matches) {
|
||||
if (options != null) {
|
||||
throw new Exception(
|
||||
|
|
Loading…
Reference in a new issue