Migrate test block 129.

Change-Id: I36f6a3f007862a7c5d2e8f304cb6730cdc9b4610
Reviewed-on: https://dart-review.googlesource.com/12289
Commit-Queue: Florian Loitsch <floitsch@google.com>
Reviewed-by: Jakob Roland Andersen <jakobr@google.com>
This commit is contained in:
Florian Loitsch
2017-10-11 08:59:49 +00:00
committed by commit-bot@chromium.org
parent e1ff03c947
commit e92c759e0b
25 changed files with 634 additions and 389 deletions
@@ -161,6 +161,7 @@ if_null_precedence_test/07: MissingCompileTimeError
is_not_class2_test/*: MissingCompileTimeError
library_ambiguous_test/04: MissingCompileTimeError
list_literal1_test/01: MissingCompileTimeError
malformed2_test/00: MissingCompileTimeError
method_override2_test/00: MissingCompileTimeError
method_override2_test/01: MissingCompileTimeError
method_override2_test/02: MissingCompileTimeError
@@ -892,6 +893,7 @@ generic_test: CompileTimeError
generics_test: CompileTimeError
import_core_prefix_test: CompileTimeError # "dynamic" should be defined in core.
interceptor6_test: CompileTimeError
malformed2_test: Pass, MissingCompileTimeError # Issue 31056.
mixin_super_2_test/01: MissingCompileTimeError
mixin_super_2_test/03: MissingCompileTimeError
mixin_supertype_subclass_test/02: MissingCompileTimeError
@@ -1131,6 +1133,61 @@ library_ambiguous_test/01: MissingCompileTimeError
library_ambiguous_test/02: MissingCompileTimeError
library_ambiguous_test/03: MissingCompileTimeError
library_ambiguous_test/04: MissingCompileTimeError
malbounded_type_cast_test/00: MissingCompileTimeError
malbounded_type_cast_test/01: MissingCompileTimeError
malbounded_type_cast_test/02: MissingCompileTimeError
malbounded_type_cast_test/none: Pass
malbounded_type_literal_test/00: MissingCompileTimeError
malbounded_type_literal_test/none: Pass
malbounded_type_test2_test/00: MissingCompileTimeError
malbounded_type_test2_test/none: Pass
malbounded_type_test_test/00: MissingCompileTimeError
malbounded_type_test_test/01: MissingCompileTimeError
malbounded_type_test_test/02: MissingCompileTimeError
malformed2_test/01: MissingCompileTimeError
malformed2_test/02: MissingCompileTimeError
malformed2_test/03: MissingCompileTimeError
malformed2_test/04: MissingCompileTimeError
malformed2_test/05: MissingCompileTimeError
malformed2_test/06: MissingCompileTimeError
malformed2_test/07: MissingCompileTimeError
malformed2_test/08: MissingCompileTimeError
malformed2_test/09: MissingCompileTimeError
malformed2_test/10: MissingCompileTimeError
malformed2_test/11: MissingCompileTimeError
malformed2_test/12: MissingCompileTimeError
malformed2_test/13: MissingCompileTimeError
malformed_bound_test/00: MissingCompileTimeError
malformed_bound_test/01: MissingCompileTimeError
malformed_inheritance_test/01: MissingCompileTimeError
malformed_inheritance_test/03: MissingCompileTimeError
malformed_inheritance_test/05: MissingCompileTimeError
malformed_test/00: MissingCompileTimeError
malformed_test/01: MissingCompileTimeError
malformed_test/02: MissingCompileTimeError
malformed_test/03: MissingCompileTimeError
malformed_test/04: MissingCompileTimeError
malformed_test/05: MissingCompileTimeError
malformed_test/06: MissingCompileTimeError
malformed_test/07: MissingCompileTimeError
malformed_test/08: MissingCompileTimeError
malformed_test/09: MissingCompileTimeError
malformed_test/10: MissingCompileTimeError
malformed_test/11: MissingCompileTimeError
malformed_test/12: MissingCompileTimeError
malformed_test/13: MissingCompileTimeError
malformed_test/14: MissingCompileTimeError
malformed_test/15: MissingCompileTimeError
malformed_test/16: MissingCompileTimeError
malformed_test/17: MissingCompileTimeError
malformed_test/18: MissingCompileTimeError
malformed_test/19: MissingCompileTimeError
malformed_test/20: MissingCompileTimeError
malformed_test/21: MissingCompileTimeError
malformed_test/22: MissingCompileTimeError
malformed_test/23: MissingCompileTimeError
malformed_test/24: MissingCompileTimeError
malformed_type_test: MissingCompileTimeError
multiple_interface_inheritance_test: StaticWarning # Issue 30552
named_parameters_test/01: MissingCompileTimeError
named_parameters_test/02: MissingCompileTimeError
@@ -247,6 +247,60 @@ library_ambiguous_test/01: MissingCompileTimeError
library_ambiguous_test/02: MissingCompileTimeError
library_ambiguous_test/03: MissingCompileTimeError
library_ambiguous_test/04: MissingCompileTimeError
malbounded_type_cast_test/00: MissingCompileTimeError
malbounded_type_cast_test/01: MissingCompileTimeError
malbounded_type_cast_test/02: MissingCompileTimeError
malbounded_type_cast_test/none: RuntimeError
malbounded_type_literal_test/00: MissingCompileTimeError
malbounded_type_test2_test/00: MissingCompileTimeError
malbounded_type_test_test/00: MissingCompileTimeError
malbounded_type_test_test/01: MissingCompileTimeError
malbounded_type_test_test/02: MissingCompileTimeError
malbounded_type_test_test/none: RuntimeError
malformed2_test/01: MissingCompileTimeError
malformed2_test/02: MissingCompileTimeError
malformed2_test/03: MissingCompileTimeError
malformed2_test/04: MissingCompileTimeError
malformed2_test/05: MissingCompileTimeError
malformed2_test/06: MissingCompileTimeError
malformed2_test/07: MissingCompileTimeError
malformed2_test/08: MissingCompileTimeError
malformed2_test/09: MissingCompileTimeError
malformed2_test/10: MissingCompileTimeError
malformed2_test/11: MissingCompileTimeError
malformed2_test/12: MissingCompileTimeError
malformed2_test/13: MissingCompileTimeError
malformed_bound_test/00: MissingCompileTimeError
malformed_bound_test/01: MissingCompileTimeError
malformed_inheritance_test/01: MissingCompileTimeError
malformed_inheritance_test/03: MissingCompileTimeError
malformed_inheritance_test/05: MissingCompileTimeError
malformed_test/00: MissingCompileTimeError
malformed_test/01: MissingCompileTimeError
malformed_test/02: MissingCompileTimeError
malformed_test/03: MissingCompileTimeError
malformed_test/04: MissingCompileTimeError
malformed_test/05: MissingCompileTimeError
malformed_test/06: MissingCompileTimeError
malformed_test/07: MissingCompileTimeError
malformed_test/08: MissingCompileTimeError
malformed_test/09: MissingCompileTimeError
malformed_test/10: MissingCompileTimeError
malformed_test/11: MissingCompileTimeError
malformed_test/12: MissingCompileTimeError
malformed_test/13: MissingCompileTimeError
malformed_test/14: MissingCompileTimeError
malformed_test/15: MissingCompileTimeError
malformed_test/16: MissingCompileTimeError
malformed_test/17: MissingCompileTimeError
malformed_test/18: MissingCompileTimeError
malformed_test/19: MissingCompileTimeError
malformed_test/20: MissingCompileTimeError
malformed_test/21: MissingCompileTimeError
malformed_test/22: MissingCompileTimeError
malformed_test/23: MissingCompileTimeError
malformed_test/24: MissingCompileTimeError
malformed_type_test: MissingCompileTimeError
method_name_test: Pass
method_override2_test/none: Pass
method_override2_test/*: MissingCompileTimeError
@@ -823,6 +877,7 @@ getters_setters2_test/01: RuntimeError
getters_setters2_test/none: RuntimeError
if_null_precedence_test/none: RuntimeError
inferrer_synthesized_constructor_test: RuntimeError
malformed2_test/00: MissingCompileTimeError
typevariable_substitution2_test/02: RuntimeError
[ $compiler == dart2js && !$checked && !$enable_asserts && !$dart2js_with_kernel && $runtime != none ]
@@ -1623,6 +1678,9 @@ async_return_types_test/wrongTypeParameter: Fail # Issue 26429
covariant_subtyping_test: CompileTimeError
default_factory2_test/01: Fail # Issue 14121
regress_26133_test: RuntimeError # Issue 26429
malbounded_type_cast_test: Fail # Issue 14121
malbounded_type_test_test/03: Fail # Issue 14121
malbounded_type_test_test/04: Fail # Issue 14121
[ $compiler == dart2js && !$checked && !$dart2js_with_kernel ]
bool_check_test: RuntimeError # Issue 29647
@@ -278,6 +278,15 @@ no_such_method_test: CompileTimeError
try_catch_on_syntax_test/07: CompileTimeError
regress_28255_test: CompileTimeError
regress_23408_test: CompileTimeError
malformed_test/none: CompileTimeError
malbounded_type_test_test/02: CompileTimeError
malformed_type_test: CompileTimeError
malformed_inheritance_test/02: CompileTimeError
malformed_inheritance_test/04: CompileTimeError
malformed_inheritance_test/06: CompileTimeError
malformed2_test/00: CompileTimeError
malbounded_type_literal_test: CompileTimeError
malbounded_type_cast_test: CompileTimeError
private_access_test/03: CompileTimeError
private_access_test/04: CompileTimeError
list_literal_syntax_test/03: CompileTimeError
+62
View File
@@ -160,6 +160,62 @@ if_null_evaluation_order_test: Pass
if_null_precedence_test/06: MissingCompileTimeError
if_null_precedence_test/07: MissingCompileTimeError
if_null_precedence_test/none: RuntimeError
malbounded_type_cast_test/00: MissingCompileTimeError
malbounded_type_cast_test/01: MissingCompileTimeError
malbounded_type_cast_test/02: MissingCompileTimeError
malbounded_type_cast_test/none: RuntimeError
malbounded_type_literal_test/00: MissingCompileTimeError
malbounded_type_test2_test/00: MissingCompileTimeError
malbounded_type_test_test/00: MissingCompileTimeError
malbounded_type_test_test/01: MissingCompileTimeError
malbounded_type_test_test/02: MissingCompileTimeError
malbounded_type_test_test/none: RuntimeError
malformed2_test/00: MissingCompileTimeError
malformed2_test/01: MissingCompileTimeError
malformed2_test/02: MissingCompileTimeError
malformed2_test/03: MissingCompileTimeError
malformed2_test/04: MissingCompileTimeError
malformed2_test/05: MissingCompileTimeError
malformed2_test/06: MissingCompileTimeError
malformed2_test/07: MissingCompileTimeError
malformed2_test/08: MissingCompileTimeError
malformed2_test/09: MissingCompileTimeError
malformed2_test/10: MissingCompileTimeError
malformed2_test/11: MissingCompileTimeError
malformed2_test/12: MissingCompileTimeError
malformed2_test/13: MissingCompileTimeError
malformed_bound_test/00: MissingCompileTimeError
malformed_bound_test/01: MissingCompileTimeError
malformed_inheritance_test/01: MissingCompileTimeError
malformed_inheritance_test/03: MissingCompileTimeError
malformed_inheritance_test/05: MissingCompileTimeError
malformed_test/00: MissingCompileTimeError
malformed_test/01: MissingCompileTimeError
malformed_test/02: MissingCompileTimeError
malformed_test/03: MissingCompileTimeError
malformed_test/04: MissingCompileTimeError
malformed_test/05: MissingCompileTimeError
malformed_test/06: MissingCompileTimeError
malformed_test/07: MissingCompileTimeError
malformed_test/08: MissingCompileTimeError
malformed_test/09: MissingCompileTimeError
malformed_test/10: MissingCompileTimeError
malformed_test/11: MissingCompileTimeError
malformed_test/12: MissingCompileTimeError
malformed_test/13: MissingCompileTimeError
malformed_test/14: MissingCompileTimeError
malformed_test/15: MissingCompileTimeError
malformed_test/16: MissingCompileTimeError
malformed_test/17: MissingCompileTimeError
malformed_test/18: MissingCompileTimeError
malformed_test/19: MissingCompileTimeError
malformed_test/20: MissingCompileTimeError
malformed_test/21: MissingCompileTimeError
malformed_test/22: MissingCompileTimeError
malformed_test/23: MissingCompileTimeError
malformed_test/24: MissingCompileTimeError
malformed_type_test: MissingCompileTimeError
malformed_test/17: MissingCompileTimeError
initializing_formal_final_test: MissingCompileTimeError
initializing_formal_type_test: MissingCompileTimeError
issue_1751477_test: RuntimeError
@@ -254,6 +310,11 @@ type_parameter_test/none: RuntimeError
type_variable_bounds4_test/01: RuntimeError
regress_22728_test: RuntimeError
regress_26133_test: RuntimeError
malbounded_type_cast_test: RuntimeError
malbounded_type_test_test/03: Fail
malbounded_type_test_test/04: Fail
malformed2_test/00: RuntimeError
malformed2_test/01: MissingCompileTimeError
factory_redirection_test/08: Fail
factory_redirection_test/09: Fail
factory_redirection_test/10: Fail
@@ -521,5 +582,6 @@ async_star_test/01: Pass
regress_22728_test: Fail # Dartk Issue 28498
[ $compiler == dartkp && $mode == debug ]
malbounded_type_cast_test: Crash
external_test/13: Crash
final_syntax_test/09: Crash
@@ -266,6 +266,61 @@ library_ambiguous_test/04: MissingCompileTimeError
many_generic_instanceof_test: RuntimeError
many_overridden_no_such_method_test: SkipByDesign
map_literal8_test: RuntimeError
malbounded_type_cast_test/00: MissingCompileTimeError
malbounded_type_cast_test/01: MissingCompileTimeError
malbounded_type_cast_test/02: MissingCompileTimeError
malbounded_type_cast_test/none: RuntimeError
malbounded_type_literal_test/00: MissingCompileTimeError
malbounded_type_test2_test/00: MissingCompileTimeError
malbounded_type_test_test/00: MissingCompileTimeError
malbounded_type_test_test/01: MissingCompileTimeError
malbounded_type_test_test/02: MissingCompileTimeError
malbounded_type_test_test/none: RuntimeError
malformed2_test/00: MissingCompileTimeError
malformed2_test/01: MissingCompileTimeError
malformed2_test/02: MissingCompileTimeError
malformed2_test/03: MissingCompileTimeError
malformed2_test/04: MissingCompileTimeError
malformed2_test/05: MissingCompileTimeError
malformed2_test/06: MissingCompileTimeError
malformed2_test/07: MissingCompileTimeError
malformed2_test/08: MissingCompileTimeError
malformed2_test/09: MissingCompileTimeError
malformed2_test/10: MissingCompileTimeError
malformed2_test/11: MissingCompileTimeError
malformed2_test/12: MissingCompileTimeError
malformed2_test/13: MissingCompileTimeError
malformed_bound_test/00: MissingCompileTimeError
malformed_bound_test/01: MissingCompileTimeError
malformed_inheritance_test/01: MissingCompileTimeError
malformed_inheritance_test/03: MissingCompileTimeError
malformed_inheritance_test/05: MissingCompileTimeError
malformed_test/00: MissingCompileTimeError
malformed_test/01: MissingCompileTimeError
malformed_test/02: MissingCompileTimeError
malformed_test/03: MissingCompileTimeError
malformed_test/04: MissingCompileTimeError
malformed_test/05: MissingCompileTimeError
malformed_test/06: MissingCompileTimeError
malformed_test/07: MissingCompileTimeError
malformed_test/08: MissingCompileTimeError
malformed_test/09: MissingCompileTimeError
malformed_test/10: MissingCompileTimeError
malformed_test/11: MissingCompileTimeError
malformed_test/12: MissingCompileTimeError
malformed_test/13: MissingCompileTimeError
malformed_test/14: MissingCompileTimeError
malformed_test/15: MissingCompileTimeError
malformed_test/16: MissingCompileTimeError
malformed_test/17: MissingCompileTimeError
malformed_test/18: MissingCompileTimeError
malformed_test/19: MissingCompileTimeError
malformed_test/20: MissingCompileTimeError
malformed_test/21: MissingCompileTimeError
malformed_test/22: MissingCompileTimeError
malformed_test/23: MissingCompileTimeError
malformed_test/24: MissingCompileTimeError
malformed_type_test: MissingCompileTimeError
method_override2_test/*: MissingCompileTimeError
method_override2_test/none: Pass
method_override2_test/none: Pass
+55
View File
@@ -253,6 +253,60 @@ library_ambiguous_test/01: MissingCompileTimeError
library_ambiguous_test/02: MissingCompileTimeError
library_ambiguous_test/03: MissingCompileTimeError
library_ambiguous_test/04: MissingCompileTimeError
malbounded_type_cast_test/00: MissingCompileTimeError
malbounded_type_cast_test/01: MissingCompileTimeError
malbounded_type_cast_test/02: MissingCompileTimeError
malbounded_type_cast_test/none: RuntimeError
malbounded_type_literal_test/00: MissingCompileTimeError
malbounded_type_test2_test/00: MissingCompileTimeError
malbounded_type_test_test/00: MissingCompileTimeError
malbounded_type_test_test/01: MissingCompileTimeError
malbounded_type_test_test/02: MissingCompileTimeError
malbounded_type_test_test/none: RuntimeError
malformed2_test/01: MissingCompileTimeError
malformed2_test/02: MissingCompileTimeError
malformed2_test/03: MissingCompileTimeError
malformed2_test/04: MissingCompileTimeError
malformed2_test/05: MissingCompileTimeError
malformed2_test/06: MissingCompileTimeError
malformed2_test/07: MissingCompileTimeError
malformed2_test/08: MissingCompileTimeError
malformed2_test/09: MissingCompileTimeError
malformed2_test/10: MissingCompileTimeError
malformed2_test/11: MissingCompileTimeError
malformed2_test/12: MissingCompileTimeError
malformed2_test/13: MissingCompileTimeError
malformed_bound_test/00: MissingCompileTimeError
malformed_bound_test/01: MissingCompileTimeError
malformed_inheritance_test/01: MissingCompileTimeError
malformed_inheritance_test/03: MissingCompileTimeError
malformed_inheritance_test/05: MissingCompileTimeError
malformed_test/00: MissingCompileTimeError
malformed_test/01: MissingCompileTimeError
malformed_test/02: MissingCompileTimeError
malformed_test/03: MissingCompileTimeError
malformed_test/04: MissingCompileTimeError
malformed_test/05: MissingCompileTimeError
malformed_test/06: MissingCompileTimeError
malformed_test/07: MissingCompileTimeError
malformed_test/08: MissingCompileTimeError
malformed_test/09: MissingCompileTimeError
malformed_test/10: MissingCompileTimeError
malformed_test/11: MissingCompileTimeError
malformed_test/12: MissingCompileTimeError
malformed_test/13: MissingCompileTimeError
malformed_test/14: MissingCompileTimeError
malformed_test/15: MissingCompileTimeError
malformed_test/16: MissingCompileTimeError
malformed_test/17: MissingCompileTimeError
malformed_test/18: MissingCompileTimeError
malformed_test/19: MissingCompileTimeError
malformed_test/20: MissingCompileTimeError
malformed_test/21: MissingCompileTimeError
malformed_test/22: MissingCompileTimeError
malformed_test/23: MissingCompileTimeError
malformed_test/24: MissingCompileTimeError
malformed_type_test: MissingCompileTimeError
many_generic_instanceof_test: RuntimeError
map_literal8_test: RuntimeError
method_override2_test/00: MissingCompileTimeError
@@ -830,6 +884,7 @@ getters_setters2_test/01: RuntimeError
getters_setters2_test/none: RuntimeError
if_null_precedence_test/none: RuntimeError
inferrer_synthesized_constructor_test: RuntimeError
malformed2_test/00: MissingCompileTimeError
type_check_const_function_typedef2_test: MissingCompileTimeError
type_argument_in_super_type_test: RuntimeError
typevariable_substitution2_test/02: RuntimeError
@@ -0,0 +1,24 @@
// Copyright (c) 2013, 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.
import 'package:expect/expect.dart';
class Super<T extends num> {}
class Malbounded1 implements Super
<String> //# 00: compile-time error
{}
class Malbounded2 extends Super
<String> //# 01: compile-time error
{}
main() {
var m = new Malbounded1();
Expect.throws(() => m as Super<int>, (e) => e is CastError);
var s = new Super<int>();
Expect.throws(() => s as Malbounded1, (e) => e is CastError);
Expect.throws(() => s as Malbounded2, (e) => e is CastError);
s as Super
<String> //# 02: compile-time error
;
}
@@ -6,7 +6,9 @@ import 'package:expect/expect.dart';
class Super<T extends num> {}
class Malbounded extends Super<String> {}
class Malbounded extends Super
<String> //# 00: compile-time error
{}
main() {
Type t = Malbounded;
@@ -4,29 +4,17 @@
import "package:expect/expect.dart";
isCheckedMode() {
try {
var i = 1;
String s = i;
return false;
} catch (e) {
return true;
}
}
class A<T extends num> {}
class B<T> {
test() {
new A() is A<T>; // //# static type warning
new A() is A
<T> //# 00: compile-time error
;
}
}
main() {
var b = new B<String>();
if (isCheckedMode()) {
Expect.throws(() => b.test(), (e) => e is TypeError);
} else {
b.test();
}
b.test();
}
@@ -0,0 +1,26 @@
// Copyright (c) 2013, 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.
import 'package:expect/expect.dart';
class Super<T extends num> {}
class Malbounded1 implements Super
<String> //# 00: compile-time error
{}
class Malbounded2 extends Super
<String> //# 01: compile-time error
{}
main() {
var m = new Malbounded1();
Expect.isFalse(m is Super<int>);
var s = new Super<int>();
Expect.isFalse(s is Malbounded1);
Expect.isFalse(s is Malbounded2);
Expect.isTrue(s is Super
<String> //# 02: compile-time error
);
}
+53
View File
@@ -0,0 +1,53 @@
// Copyright (c) 2013, 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.
part of malformed_test;
void testValue(var o) {
o is Unresolved1;
o is List<Unresolved2>;
o is! Unresolved3;
o is! List<Unresolved4>;
try {
o as Unresolved5;
} catch (e) {
}
try {
o as List<Unresolved6>;
} catch (e) {
}
try {
} on Unresolved7 catch (e) {
} catch (e) {
}
try {
throw o;
} on Unresolved8 catch (e) {
} catch (e) {
}
try {
throw o;
} on List<String> catch (e) {
} on NullThrownError catch (e) {
} on Unresolved9 catch (e) {
} catch (e) {
}
try {
throw o;
} on List<Unresolved10> catch (e) {
} on NullThrownError catch (e) {
} on Unresolved11 catch (e) {
} catch (e) {
}
Unresolved12 u = o;
List<Unresolved13> u2 = o;
}
+57
View File
@@ -0,0 +1,57 @@
// Copyright (c) 2013, 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.
library malformed_test;
// This part includes the actual tests.
part 'malformed2_lib.dart';
// The part-file cannot contain error markers.
// Therefore we create a fresh class for each test.
/* //# 01: compile-time error
class Unresolved1 {}
*/ //# 01: continued
/* //# 02: compile-time error
class Unresolved2 {}
*/ //# 02: continued
/* //# 03: compile-time error
class Unresolved3 {}
*/ //# 03: continued
/* //# 04: compile-time error
class Unresolved4 {}
*/ //# 04: continued
/* //# 05: compile-time error
class Unresolved5 {}
*/ //# 05: continued
/* //# 06: compile-time error
class Unresolved6 {}
*/ //# 06: continued
/* //# 07: compile-time error
class Unresolved7 {}
*/ //# 07: continued
/* //# 08: compile-time error
class Unresolved8 {}
*/ //# 08: continued
/* //# 09: compile-time error
class Unresolved9 {}
*/ //# 09: continued
/* //# 10: compile-time error
class Unresolved10 {}
*/ //# 10: continued
/* //# 11: compile-time error
class Unresolved11 {}
*/ //# 11: continued
/* //# 12: compile-time error
class Unresolved12 {}
*/ //# 12: continued
/* //# 13: compile-time error
class Unresolved13 {}
*/ //# 13: continued
const Unresolved c1 = 0; //# 00: compile-time error
void main() {
print(c1); //# 00: continued
testValue(null);
}
@@ -2,17 +2,14 @@
// 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.
// Test that a malformed type variable bound is treated as dynamic.
class C<
T
extends Malformed //# 01: static type warning, runtime error
class C<T
extends Malformed //# 00: compile-time error
> {
f(T t) => t.foo; //# 01: continued
f(T t) => t
.foo //# 01: compile-time error
;
}
main() {
new C<int>()
.f(1) //# 01: continued
;
new C<int>().f(1);
}
@@ -0,0 +1,83 @@
// Copyright (c) 2013, 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.
// Tests that malformed types used in extends, implements, and with clauses
// cause compile-time errors.
class A<T> {}
class C
extends Unresolved //# 00: compile-time error
{
}
class C1
extends A<Unresolved> //# 01: compile-time error
{
}
class C2
extends Object with Unresolved //# 02: compile-time error
{
}
class C3
extends Object with A<Unresolved> //# 03: compile-time error
{
}
class C4
implements Unresolved //# 04: compile-time error
{
}
class C5
implements A<Unresolved> //# 05: compile-time error
{
}
class C6<A>
extends A<int> //# 06: compile-time error
{
}
class C7<A>
extends A<Unresolved> //# 07: compile-time error
{
}
class C8<A>
extends Object with A<int> //# 08: compile-time error
{
}
class C9<A>
extends Object with A<Unresolved> //# 09: compile-time error
{
}
class C10<A>
implements A<int> //# 10: compile-time error
{
}
class C11<A>
implements A<Unresolved> //# 11: compile-time error
{
}
void main() {
new C();
new C1();
new C2();
new C3();
new C4();
new C5();
new C6<Object>();
new C7<Object>();
new C8<Object>();
new C9<Object>();
new C10<Object>();
new C11<Object>();
}
+81
View File
@@ -0,0 +1,81 @@
// Copyright (c) 2013, 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.
import 'package:expect/expect.dart';
import 'package:expect/expect.dart' as prefix; // Define 'prefix'.
checkIsUnresolved(var v) {
v is Unresolved; //# 00: compile-time error
v is Unresolved<int>; //# 01: compile-time error
v is prefix.Unresolved; //# 02: compile-time error
v is prefix.Unresolved<int>; //# 03: compile-time error
}
checkIsListUnresolved(var v) {
v is List<Unresolved>; //# 04: compile-time error
v is List<Unresolved<int>>; //# 05: compile-time error
v is List<prefix.Unresolved>; //# 06: compile-time error
v is List<prefix.Unresolved<int>>; //# 07: compile-time error
v is List<int, String>; //# 08: compile-time error
}
checkAsUnresolved(var v) {
v as Unresolved; //# 09: compile-time error
v as Unresolved<int>; //# 10: compile-time error
v as prefix.Unresolved; //# 11: compile-time error
v as prefix.Unresolved<int>; //# 12: compile-time error
}
checkAsListUnresolved(var v) {
v as List<Unresolved>; //# 13: compile-time error
v as List<Unresolved<int>>; //# 14: compile-time error
v as List<prefix.Unresolved>; //# 15: compile-time error
v as List<prefix.Unresolved<int>>; //# 16: compile-time error
v as List<int, String>; //# 17: compile-time error
}
void main() {
checkIsUnresolved('');
checkAsUnresolved('');
checkIsListUnresolved(new List());
checkAsListUnresolved(new List());
new undeclared_prefix.Unresolved(); //# 18: compile-time error
new undeclared_prefix.Unresolved<int>(); //# 19: compile-time error
try {
throw 'foo';
}
on Unresolved //# 20: compile-time error
catch (e) {
}
try {
throw 'foo';
}
on Unresolved<int> //# 21: compile-time error
catch (e) {
}
try {
throw 'foo';
}
on prefix.Unresolved //# 22: compile-time error
catch (e) {
}
try {
throw 'foo';
}
on prefix.Unresolved<int> //# 23: compile-time error
catch (e) {
}
try {
throw 'foo';
}
on undeclared_prefix.Unresolved<int> // //# 24: compile-time error
catch (e) {
}
}
@@ -2,10 +2,8 @@
// 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.
// Regression test for issue 11792.
null_() => null;
final Undeclared x = null_(); // null is assignable to x of malformed type.
final Undeclared/*@compile-error=unspecified*/ x = null_();
main() {
print(x);
@@ -153,15 +153,6 @@ malbounded_instantiation_test: Skip
malbounded_redirecting_factory2_test: Skip
malbounded_redirecting_factory_test: Skip
malbounded_type_cast2_test: Skip
malbounded_type_cast_test: Skip
malbounded_type_literal_test: Skip
malbounded_type_test2_test: Skip
malbounded_type_test_test: Skip
malformed2_test: Skip
malformed_bound_test: Skip
malformed_inheritance_test: Skip
malformed_test: Skip
malformed_type_test: Skip
missing_const_constructor_test: Skip
missing_part_of_tag_test: Skip
mixin_black_listed_test: Skip
@@ -1,32 +0,0 @@
// Copyright (c) 2013, 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.
import 'package:expect/expect.dart';
class Super<T extends num> {}
class Malbounded1 implements Super<String> {} // //# static type warning
class Malbounded2 extends Super<String> {} // //# static type warning
main() {
bool inCheckedMode = false;
try {
String a = 42; //# static type warning
} catch (e) {
inCheckedMode = true;
}
var expectedError;
if (inCheckedMode) {
expectedError = (e) => e is TypeError;
} else {
expectedError = (e) => e is CastError;
}
var m = new Malbounded1();
Expect.throws(() => m as Super<int>, expectedError);
var s = new Super<int>();
Expect.throws(() => s as Malbounded1, (e) => e is CastError);
Expect.throws(() => s as Malbounded2, expectedError);
Expect.throws(() => s as Super<String>, expectedError); //# static type warning
}
@@ -1,19 +0,0 @@
// Copyright (c) 2013, 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.
import 'package:expect/expect.dart';
class Super<T extends num> {}
class Malbounded1 implements Super<String> {} // //# 01: static type warning, dynamic type error
class Malbounded1 implements Super<String> {} // //# 02: static type warning
class Malbounded2 extends Super<String> {} // //# 03: static type warning, dynamic type error
main() {
var m = new Malbounded1(); // //# 01: continued
Expect.isFalse(m is Super<int>); // //# 01: continued
var s = new Super<int>();
Expect.isFalse(s is Malbounded1); // //# 02: continued
Expect.isFalse(s is Malbounded2); // //# 03: continued
Expect.isFalse(s is Super<String>); // //# 04: static type warning, dynamic type error
}
-46
View File
@@ -1,46 +0,0 @@
// Copyright (c) 2013, 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.
part of malformed_test;
/// [o] is either `null` or `new List<String>()`.
void testValue(var o) {
assert(o == null || o is List<String>);
test(true, () => o is Unresolved, "$o is Unresolved");
test(false, () => o is List<Unresolved>, "$o is List<Unresolved>");
test(true, () => o is! Unresolved, "$o is! Unresolved");
test(false, () => o is! List<Unresolved>, "$o is List<Unresolved>");
test(true, () => o as Unresolved, "$o as Unresolved");
test(false, () => o as List<Unresolved>, "$o as List<Unresolved>");
test(false, () {
try {} on Unresolved catch (e) {} catch (e) {}
}, "on Unresolved catch: Nothing thrown.");
test(true, () {
try {
throw o;
} on Unresolved catch (e) {} catch (e) {}
}, "on Unresolved catch ($o)");
test(false, () {
try {
throw o;
} on List<
String> catch (e) {} on NullThrownError catch (e) {} on Unresolved catch (e) {} catch (e) {}
}, "on List<String>/NullThrowError catch ($o)");
test(false, () {
try {
throw o;
} on List<
Unresolved> catch (e) {} on NullThrownError catch (e) {} on Unresolved catch (e) {} catch (e) {}
}, "on List<Unresolved>/NullThrowError catch ($o)");
test(o != null && inCheckedMode(), () {
Unresolved u = o;
}, "Unresolved u = $o;");
test(false, () {
List<Unresolved> u = o;
}, "List<Unresolved> u = $o;");
}
@@ -1,59 +0,0 @@
// Copyright (c) 2013, 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.
library malformed_test;
// This part includes the actual tests.
part 'malformed2_lib.dart'; //# 00: static type warning
bool inCheckedMode() {
try {
var i = 42;
String s = i;
} on TypeError catch (e) {
return true;
}
return false;
}
bool hasFailed = false;
void fail(String message) {
try {
throw message;
} catch (e, s) {
print(e);
print(s);
}
hasFailed = true;
}
void checkFailures() {
if (hasFailed) throw 'Test failed.';
}
test(bool expectTypeError, f(), [String message]) {
message = message != null ? ' for $message' : '';
try {
f();
if (expectTypeError) {
fail('Missing type error$message.');
}
} on TypeError catch (e) {
if (expectTypeError) {
print('Type error$message: $e');
} else {
fail('Unexpected type error$message: $e');
}
}
}
const Unresolved c1 = 0; //# 01: static type warning, checked mode compile-time error
void main() {
print(c1); //# 01: continued
testValue(new List<String>()); //# 00: continued
testValue(null); //# 00: continued
checkFailures();
}
@@ -1,32 +0,0 @@
// Copyright (c) 2013, 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.
// Tests that malformed types used in extends, implements, and with clauses
// cause compile-time errors.
import 'package:expect/expect.dart';
class A<T> {}
class C
extends Unresolved //# 01: compile-time error
extends A<Unresolved> //# 02: static type warning
extends Object with Unresolved //# 03: compile-time error
extends Object with A<Unresolved> //# 04: static type warning
implements Unresolved //# 05: compile-time error
implements A<Unresolved> //# 06: static type warning
<A> extends A<int> //# 07: compile-time error
<A> extends A<Unresolved> //# 08: compile-time error
<A> extends Object with A<int> //# 09: compile-time error
<A> extends Object with A<Unresolved> //# 10: compile-time error
<A> implements A<int> //# 11: compile-time error
<A> implements A<Unresolved> //# 12: compile-time error
{}
void main() {
new C();
Expect.isTrue(new C() is A<String> && new C() is A<int>); //# 02: continued
Expect.isTrue(new C() is A<String> && new C() is A<int>); //# 04: continued
Expect.isTrue(new C() is A<String> && new C() is A<int>); //# 06: continued
}
-163
View File
@@ -1,163 +0,0 @@
// Copyright (c) 2013, 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.
// Tests that malformed types are handled as dynamic, and that types with the
// wrong number of type arguments are handled as raw types.
import 'package:expect/expect.dart';
import 'package:expect/expect.dart' as prefix; // Define 'prefix'.
checkIsUnresolved(var v) {
Expect.throws(() => v is Unresolved, (e) => e is TypeError);
Expect.throws(() => v is Unresolved<int>, (e) => e is TypeError);
Expect.throws(() => v is prefix.Unresolved, (e) => e is TypeError);
Expect.throws(() => v is prefix.Unresolved<int>, (e) => e is TypeError);
}
checkIsListUnresolved(bool expect, var v) {
Expect.equals(expect, v is List<Unresolved>);
Expect.equals(expect, v is List<Unresolved<int>>);
Expect.equals(expect, v is List<prefix.Unresolved>);
Expect.equals(expect, v is List<prefix.Unresolved<int>>);
Expect.equals(expect, v is List<int, String>);
}
checkIsListDynamic(bool expect, var v) {
checkIsListUnresolved(true, v);
Expect.equals(expect, v is List<int> && v is List<String>);
}
checkAsUnresolved(var v) {
Expect.throws(() => v as Unresolved, (e) => e is TypeError);
Expect.throws(() => v as Unresolved<int>, (e) => e is TypeError);
Expect.throws(() => v as prefix.Unresolved, (e) => e is TypeError);
Expect.throws(() => v as prefix.Unresolved<int>, (e) => e is TypeError);
}
checkAsListUnresolved(bool expect, var v) {
if (expect) {
Expect.equals(v, v as List<Unresolved>);
Expect.equals(v, v as List<Unresolved<int>>);
Expect.equals(v, v as List<prefix.Unresolved>);
Expect.equals(v, v as List<prefix.Unresolved<int>>);
Expect.equals(v, v as List<int, String>);
} else {
Expect.throws(() => v as List<Unresolved>, (e) => e is CastError);
Expect.throws(() => v as List<Unresolved<int>>, (e) => e is CastError);
Expect.throws(() => v as List<prefix.Unresolved>, (e) => e is CastError);
Expect.throws(
() => v as List<prefix.Unresolved<int>>, (e) => e is CastError);
Expect.throws(() => v as List<int, String>, (e) => e is CastError);
}
}
checkIsMapDynamic(bool first, bool second, var v) {
Expect.equals(first, v is Map<String, Object> && v is Map<int, Object>);
Expect.equals(second, v is Map<Object, int> && v is Map<Object, String>);
}
void main() {
checkIsUnresolved('');
checkIsUnresolved(0);
checkIsListUnresolved(false, '');
checkIsListUnresolved(true, new List());
checkIsListUnresolved(true, new List<int>());
checkIsListUnresolved(true, new List<String>());
checkIsListUnresolved(true, new List<int, String>());
checkAsUnresolved('');
checkAsUnresolved(0);
checkAsListUnresolved(false, '');
checkAsListUnresolved(true, new List());
checkAsListUnresolved(true, new List<int>());
checkAsListUnresolved(true, new List<String>());
checkAsListUnresolved(true, new List<int, String>());
checkIsListDynamic(true, []);
checkIsListDynamic(true, <>[]); //# 01: compile-time error
checkIsListDynamic(false, <int>[]);
checkIsListDynamic(true, <Unresolved>[]);
checkIsListDynamic(true, <Unresolved<int>>[]);
checkIsListDynamic(true, <prefix.Unresolved>[]);
checkIsListDynamic(true, <prefix.Unresolved<int>>[]);
checkIsListDynamic(true, <int, String>[]);
checkIsListDynamic(true, new List());
checkIsListDynamic(true, new List<>()); //# 02: compile-time error
checkIsListDynamic(true, new List<Unresolved>());
checkIsListDynamic(true, new List<Unresolved<int>>());
checkIsListDynamic(true, new List<prefix.Unresolved>());
checkIsListDynamic(true, new List<prefix.Unresolved<int>>());
checkIsListDynamic(true, new List<int, String>());
checkIsMapDynamic(true, true, <dynamic, dynamic>{});
checkIsMapDynamic(true, true, {});
checkIsMapDynamic(true, true, <>{}); //# 03: compile-time error
checkIsMapDynamic(true, true, <int>{});
checkIsMapDynamic(false, false, <String, int>{});
checkIsMapDynamic(true, true, <String, int, String>{});
checkIsMapDynamic(true, false, <Unresolved, int>{});
checkIsMapDynamic(false, true, <String, Unresolved<int>>{});
checkIsMapDynamic(true, false, <prefix.Unresolved, int>{});
checkIsMapDynamic(false, true, <String, prefix.Unresolved<int>>{});
checkIsMapDynamic(true, true, new Map());
checkIsMapDynamic(true, true, new Map<>); //# 04: compile-time error
checkIsMapDynamic(true, true, new Map<int>());
checkIsMapDynamic(false, false, new Map<String, int>());
checkIsMapDynamic(true, true, new Map<String, int, String>());
checkIsMapDynamic(true, false, new Map<Unresolved, int>());
checkIsMapDynamic(false, true, new Map<String, Unresolved<int>>());
checkIsMapDynamic(true, false, new Map<prefix.Unresolved, int>());
checkIsMapDynamic(false, true, new Map<String, prefix.Unresolved<int>>());
Expect.throws(() => new Unresolved(), (e) => true);
Expect.throws(() => new Unresolved<int>(), (e) => true);
Expect.throws(() => new prefix.Unresolved(), (e) => true);
Expect.throws(() => new prefix.Unresolved<int>(), (e) => true);
// The expression 'undeclared_prefix.Unresolved()' is parsed as the invocation
// of the named constructor 'Unresolved' on the type 'undeclared_prefix'.
Expect.throws(() => new undeclared_prefix.Unresolved(), (e) => true);
// The expression 'undeclared_prefix.Unresolved<int>' is a malformed type.
Expect.throws(() => new undeclared_prefix.Unresolved<int>(), (e) => true);
try {
try {
throw 'foo';
} on Unresolved catch (e) {
Expect.fail("This code shouldn't be executed");
}
Expect.fail("This code shouldn't be executed");
} on TypeError catch (e) {}
try {
try {
throw 'foo';
} on Unresolved<int> catch (e) {
Expect.fail("This code shouldn't be executed");
}
Expect.fail("This code shouldn't be executed");
} on TypeError catch (e) {}
try {
try {
throw 'foo';
} on prefix.Unresolved catch (e) {
Expect.fail("This code shouldn't be executed");
}
Expect.fail("This code shouldn't be executed");
} on TypeError catch (e) {}
try {
try {
throw 'foo';
} on prefix.Unresolved<int> catch (e) {
Expect.fail("This code shouldn't be executed");
}
Expect.fail("This code shouldn't be executed");
} on TypeError catch (e) {}
try {
throw 'foo';
}
on undeclared_prefix.Unresolved<int> // //# 06: runtime error
catch (e) {}
}