Migrate block 163 to Dart 2.0.
Interesting tests requiring status file or other changes: type_variable_promotion_test type_variable_scope_test type_variable_static_context_negative_test - changed from negative to compile-time error unresolved_top_level_method_negative_test - changed from negative to compile-time error unary_plus_negative_test unhandled_exception_negative_test unbound_getter_test unresolved_in_factory_negative_test - unresolved_top_level_var_negative_test - changed from negative to compile-time error unresolved_top_level_method_negative_test - changed from negative to compile-time error vm/async_await_catch_stacktrace_test BUG= R=lrn@google.com Review-Url: https://codereview.chromium.org/3008723002 .
This commit is contained in:
@@ -65,7 +65,6 @@ redirecting_constructor_initializer_test: RuntimeError # Issue 23488
|
||||
generic_functions_test: Pass # Issue 25869
|
||||
|
||||
[ ($compiler == none || $compiler == precompiler || $compiler == app_jit) && ($runtime == vm || $runtime == dart_precompiled || $runtime == flutter) ]
|
||||
unicode_bom_test: Fail # Issue 16067
|
||||
vm/debug_break_enabled_vm_test/01: Crash, OK # Expected to hit breakpoint.
|
||||
|
||||
[ ($compiler == none || $compiler == precompiler || $compiler == app_jit) && $checked ]
|
||||
@@ -265,13 +264,6 @@ method_override2_test/01: CompileTimeError
|
||||
regress_22438_test: CompileTimeError
|
||||
regress_13462_1_test: CompileTimeError
|
||||
instance_creation_in_function_annotation_test: CompileTimeError
|
||||
type_variable_scope_test/none: CompileTimeError
|
||||
type_variable_scope_test/00: CompileTimeError
|
||||
type_variable_scope_test/01: CompileTimeError
|
||||
type_variable_scope_test/03: CompileTimeError
|
||||
type_variable_scope_test/02: CompileTimeError
|
||||
type_variable_scope_test/04: CompileTimeError
|
||||
type_variable_scope_test/05: CompileTimeError
|
||||
invocation_mirror_invoke_on_test: CompileTimeError
|
||||
method_override3_test/00: CompileTimeError
|
||||
method_override3_test/01: CompileTimeError
|
||||
@@ -385,7 +377,6 @@ check_method_override_test/02: CompileTimeError
|
||||
malformed_inheritance_test/02: CompileTimeError
|
||||
malformed_inheritance_test/04: CompileTimeError
|
||||
malformed_inheritance_test/06: CompileTimeError
|
||||
unicode_bom_test: CompileTimeError
|
||||
prefix16_test: CompileTimeError
|
||||
deferred_not_loaded_check_test: CompileTimeError
|
||||
regress_23408_test: CompileTimeError
|
||||
@@ -413,7 +404,6 @@ deferred_static_seperate_test: CompileTimeError
|
||||
default_factory_test/01: CompileTimeError
|
||||
internal_library_test/01: CompileTimeError
|
||||
internal_library_test/02: CompileTimeError
|
||||
type_variable_scope2_test: CompileTimeError
|
||||
mixin_super_bound_test: CompileTimeError
|
||||
invocation_mirror2_test: CompileTimeError
|
||||
deferred_inheritance_constraints_test/redirecting_constructor: CompileTimeError
|
||||
|
||||
@@ -65,7 +65,6 @@ interface_test/none: fail # Issue 11575
|
||||
syntax_test/none: fail # Issue 11575
|
||||
factory5_test/none: fail # Issue 11578
|
||||
type_variable_bounds_test/none: fail # Issue 11578
|
||||
type_variable_scope_test/none: fail # Issue 11578
|
||||
factory_implementation_test/none: fail # Issue 11578
|
||||
malbounded_redirecting_factory_test/none: fail # Issue 11578
|
||||
malbounded_redirecting_factory2_test/none: fail # Issue 11578
|
||||
@@ -84,9 +83,6 @@ prefix8_negative_test: fail # Issue 11964
|
||||
prefix11_negative_test: fail # Issue 11964
|
||||
static_call_wrong_argument_count_negative_test: fail # Issue 12156
|
||||
type_parameter_test/none: fail # Issue 12160
|
||||
type_variable_static_context_negative_test: fail # Issue 12161
|
||||
unresolved_in_factory_negative_test: fail # Issue 12163
|
||||
unresolved_top_level_var_negative_test: fail # Issue 12163
|
||||
prefix3_negative_test: fail # Issue 12191
|
||||
issue11724_test: fail # Issue 12381
|
||||
static_field_test/01: fail # Issue 12541
|
||||
@@ -344,17 +340,11 @@ test_negative_test: CompileTimeError
|
||||
try_catch4_test: StaticWarning
|
||||
try_catch5_test: StaticWarning
|
||||
type_argument_in_super_type_test: StaticWarning
|
||||
typed_selector2_test: StaticWarning
|
||||
type_variable_identifier_expression_test: StaticWarning
|
||||
type_variable_scope2_test: StaticWarning
|
||||
type_variable_conflict2_test/02: MissingCompileTimeError
|
||||
type_variable_conflict2_test/06: MissingCompileTimeError
|
||||
type_variable_conflict2_test/08: MissingCompileTimeError
|
||||
type_variable_conflict2_test/10: MissingCompileTimeError
|
||||
unary_plus_negative_test: CompileTimeError
|
||||
unbound_getter_test: StaticWarning
|
||||
unhandled_exception_negative_test: CompileTimeError
|
||||
unresolved_top_level_method_negative_test: StaticWarning
|
||||
vm/debug_break_vm_test/*: Skip
|
||||
vm/debug_break_enabled_vm_test: Skip
|
||||
vm/type_cast_vm_test: StaticWarning
|
||||
|
||||
@@ -1371,6 +1371,7 @@ syntax_test/30: Crash # 'package:front_end/src/fasta/kernel/kernel_class_builder
|
||||
syntax_test/31: Crash # 'package:front_end/src/fasta/kernel/kernel_class_builder.dart': Failed assertion: line 83 pos 12: 'arguments == null || cls.typeParameters.length == arguments.length': is not true.
|
||||
syntax_test/32: Crash # 'package:front_end/src/fasta/kernel/kernel_class_builder.dart': Failed assertion: line 83 pos 12: 'arguments == null || cls.typeParameters.length == arguments.length': is not true.
|
||||
syntax_test/33: Crash # 'package:front_end/src/fasta/kernel/kernel_class_builder.dart': Failed assertion: line 83 pos 12: 'arguments == null || cls.typeParameters.length == arguments.length': is not true.
|
||||
type_variable_initializer_test: Crash # 'file:*/pkg/compiler/lib/src/ssa/locals_handler.dart': Failed assertion: line 425 pos 12: '!isStoredInClosureField(local)': Local local(Maps.mapToString#first) is stored in a closure field.
|
||||
wrong_number_type_arguments_test/00: Crash
|
||||
wrong_number_type_arguments_test/02: Crash
|
||||
yieldstar_pause_test: Crash
|
||||
@@ -2209,7 +2210,6 @@ type_variable_conflict2_test/09: Crash
|
||||
type_variable_field_initializer_closure2_test: Crash
|
||||
type_variable_field_initializer_closure_test: Crash
|
||||
type_variable_function_type_test: RuntimeError
|
||||
type_variable_nested_test: Crash
|
||||
constructor12_test: RuntimeError
|
||||
constructor2_test: RuntimeError
|
||||
constructor3_test: RuntimeError
|
||||
@@ -2232,4 +2232,3 @@ positional_parameters_type_test/01: MissingRuntimeError
|
||||
positional_parameters_type_test/02: MissingRuntimeError
|
||||
super_test: RuntimeError
|
||||
yieldstar_pause_test: Crash
|
||||
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
// Copyright (c) 2012, 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";
|
||||
|
||||
// Test that malformed type arguments treated as dynamic in both production and
|
||||
// checked mode.
|
||||
|
||||
class Foo<T> {
|
||||
// T is not in scope for a static method.
|
||||
static Foo<T> m() {
|
||||
return new Foo();
|
||||
}
|
||||
}
|
||||
|
||||
main() {
|
||||
try {
|
||||
Expect.isTrue(Foo.m() is Foo);
|
||||
} on TypeError catch (error) {
|
||||
print(error);
|
||||
// No type error in production nor checked mode.
|
||||
Expect.fail();
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
// Copyright (c) 2012, 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.
|
||||
|
||||
// A type variable can't be referenced in a static class
|
||||
|
||||
class A<T> {
|
||||
static int method() {
|
||||
var foo =
|
||||
new T(); // error, can't reference a type variable in a static context
|
||||
}
|
||||
}
|
||||
|
||||
main() {
|
||||
A.method();
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
// Copyright (c) 2012, 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.
|
||||
|
||||
// There is no unary plus operator in Dart.
|
||||
|
||||
main() {
|
||||
var a = 1;
|
||||
var b = +a;
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
// Copyright (c) 2011, 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.
|
||||
// Verify that an unbound getter is properly resolved at runtime.
|
||||
|
||||
class A {
|
||||
const A();
|
||||
foo() {
|
||||
return y;
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
final y;
|
||||
const B(val)
|
||||
: super(),
|
||||
y = val;
|
||||
}
|
||||
|
||||
class UnboundGetterTest {
|
||||
static testMain() {
|
||||
var b = new B(1);
|
||||
print(b.foo());
|
||||
}
|
||||
}
|
||||
|
||||
main() {
|
||||
UnboundGetterTest.testMain();
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
// Copyright (c) 2011, 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.
|
||||
// Dart test program for testing unhandled exceptions.
|
||||
|
||||
class MyException {
|
||||
const MyException(String message = "") : message_ = message;
|
||||
String getMessage() { return message_; }
|
||||
final String message_;
|
||||
}
|
||||
|
||||
class Helper {
|
||||
static int f1(int i) {
|
||||
int j;
|
||||
j = i + 200;
|
||||
j = j + 300;
|
||||
throw new MyException("Unhandled Exception");
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
class UnhandledExceptionNegativeTest {
|
||||
static testMain() {
|
||||
Helper.f1(1);
|
||||
}
|
||||
}
|
||||
|
||||
main() {
|
||||
UnhandledExceptionNegativeTest.testMain();
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
// Copyright (c) 2014, 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.
|
||||
|
||||
// Test unresolved default constructor calls remain unresolved after dart2dart
|
||||
// translation.
|
||||
|
||||
import 'package:expect/expect.dart';
|
||||
|
||||
class A {
|
||||
A.named();
|
||||
static method() {}
|
||||
}
|
||||
|
||||
main() {
|
||||
A.method();
|
||||
Expect.throws(() => new A()); //# 01: static type warning
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
// Copyright (c) 2011, 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.
|
||||
|
||||
// Test that an unresolved method call at the top level does not crash
|
||||
// the parser.
|
||||
|
||||
var a = b();
|
||||
|
||||
main() {
|
||||
print(a);
|
||||
}
|
||||
@@ -238,6 +238,8 @@ generic_test: StaticWarning
|
||||
getter_setter_in_lib_test: Fail # Issue 23286
|
||||
getter_setter_in_lib_test: Fail # Issue 23286
|
||||
getter_declaration_negative_test: CompileTimeError
|
||||
type_variable_scope_test/none: fail # Issue 11578
|
||||
type_variable_static_context_negative_test: fail # Issue 12161
|
||||
|
||||
[ $strong && $compiler == dart2analyzer ]
|
||||
accessor_conflict_export2_test: CompileTimeError # Issue 25626
|
||||
@@ -395,6 +397,20 @@ if_null_assignment_static_test/42: MissingCompileTimeError
|
||||
if_null_precedence_test/06: MissingCompileTimeError
|
||||
if_null_precedence_test/07: MissingCompileTimeError
|
||||
multiple_interface_inheritance_test: StaticWarning # Issue 30552
|
||||
type_variable_scope_test/00: MissingCompileTimeError
|
||||
type_variable_scope_test/01: MissingCompileTimeError
|
||||
type_variable_scope_test/02: MissingCompileTimeError
|
||||
type_variable_scope_test/03: MissingCompileTimeError
|
||||
type_variable_scope_test/04: MissingCompileTimeError
|
||||
type_variable_scope_test/05: MissingCompileTimeError
|
||||
type_variable_scope2_test: MissingCompileTimeError
|
||||
type_variable_static_context_test: MissingCompileTimeError
|
||||
typed_selector2_test: MissingCompileTimeError
|
||||
unbound_getter_test: MissingCompileTimeError
|
||||
unresolved_default_constructor_test/01: MissingCompileTimeError
|
||||
unresolved_in_factory_test: MissingCompileTimeError
|
||||
unresolved_top_level_method_test: MissingCompileTimeError
|
||||
unresolved_top_level_var_test: MissingCompileTimeError
|
||||
|
||||
[ $compiler == dart2analyzer && $runtime == none ]
|
||||
assertion_initializer_const_error2_test/none: CompileTimeError
|
||||
|
||||
@@ -175,6 +175,23 @@ if_null_assignment_static_test/41: MissingCompileTimeError
|
||||
if_null_assignment_static_test/42: MissingCompileTimeError
|
||||
if_null_precedence_test/06: MissingCompileTimeError
|
||||
if_null_precedence_test/07: MissingCompileTimeError
|
||||
type_variable_nested_test/01: RuntimeError
|
||||
type_variable_promotion_test: RuntimeError
|
||||
type_variable_scope_test/00: MissingCompileTimeError
|
||||
type_variable_scope_test/01: MissingCompileTimeError
|
||||
type_variable_scope_test/02: MissingCompileTimeError
|
||||
type_variable_scope_test/03: MissingCompileTimeError
|
||||
type_variable_scope_test/04: MissingCompileTimeError
|
||||
type_variable_scope_test/05: MissingCompileTimeError
|
||||
type_variable_scope2_test: MissingCompileTimeError
|
||||
type_variable_static_context_test: MissingCompileTimeError
|
||||
typed_selector2_test: MissingCompileTimeError
|
||||
unbound_getter_test: MissingCompileTimeError
|
||||
unresolved_default_constructor_test/01: MissingCompileTimeError
|
||||
unresolved_in_factory_test: MissingCompileTimeError
|
||||
unresolved_top_level_method_test: MissingCompileTimeError
|
||||
unresolved_top_level_var_test: MissingCompileTimeError
|
||||
vm/async_await_catch_stacktrace_test: RuntimeError
|
||||
|
||||
[ $compiler == dart2js && !$minified && $runtime != d8]
|
||||
generic_methods_local_variable_declaration_test: RuntimeError
|
||||
@@ -556,6 +573,9 @@ if_null_assignment_static_test/06: Crash
|
||||
many_generic_instanceof_test: Crash
|
||||
regress_30339_test: Crash # 'file:*/pkg/compiler/lib/src/js_model/closure.dart': Failed assertion: line 197 pos 9: 'closure != null': Corresponding closure class not found for j:getter(Iterable.iterator). Closures found for (j:closure_call(Closure_fromTearOff_closure.call), j:closure_call(Maps_mapToString_closure.call), j:closure_call(main_closure.call), ..., j:closure_call(_awaitOnObject_closure.call), j:closure_call(_awaitOnObject_closure.call))
|
||||
typevariable_substitution2_test/02: RuntimeError
|
||||
type_variable_nested_test: Crash
|
||||
typecheck_multifield_declaration_test: Crash
|
||||
typedef_is_test: Crash
|
||||
|
||||
[ $compiler == dart2js && $dart2js_with_kernel && $minified ]
|
||||
abstract_exact_selector_test/none: Crash # NoSuchMethodError: The getter 'thisLocal' was called on null.
|
||||
@@ -745,6 +765,9 @@ if_null_assignment_static_test/06: Crash
|
||||
many_generic_instanceof_test: Crash
|
||||
regress_30339_test: Crash # NoSuchMethodError: The getter 'thisLocal' was called on null.
|
||||
typevariable_substitution2_test/02: RuntimeError
|
||||
type_variable_nested_test: Crash
|
||||
typecheck_multifield_declaration_test: Crash
|
||||
typedef_is_test: Crash
|
||||
|
||||
[ $compiler == dart2js && ! $dart2js_with_kernel && $runtime != none ]
|
||||
async_star_cancel_while_paused_test: RuntimeError # Issue 22853
|
||||
|
||||
@@ -38,6 +38,7 @@ generics_test: CompileTimeError
|
||||
get_set_syntax_test/none: CompileTimeError
|
||||
getter_setter_in_lib_test: CompileTimeError
|
||||
multiple_interface_inheritance_test: CompileTimeError # Issue 30552
|
||||
type_variable_scope_test/none: CompileTimeError
|
||||
|
||||
[ $strong && $compiler == dartdevc ]
|
||||
accessor_conflict_export2_test: CompileTimeError # Issue 25626
|
||||
@@ -111,6 +112,9 @@ call_closurization_test: RuntimeError # Issue 29920
|
||||
call_test: RuntimeError
|
||||
canonical_const2_test: RuntimeError # Ints and doubles are unified.
|
||||
canonical_const_test: RuntimeError # Ints and doubles are unified.
|
||||
compile_time_constant_a_test: RuntimeError # Issue 30526
|
||||
compile_time_constant_b_test: RuntimeError # Issue 29920
|
||||
compile_time_constant_d_test: RuntimeError # Issue 29920
|
||||
compile_time_constant10_test/none: RuntimeError
|
||||
covariant_subtyping_with_substitution_test: RuntimeError # Issue 30461
|
||||
function_subtype_inline2_test: RuntimeError
|
||||
@@ -124,7 +128,4 @@ generic_method_types_test/02: RuntimeError
|
||||
generic_method_types_test/03: RuntimeError
|
||||
generic_methods_new_test: RuntimeError
|
||||
getter_closure_execution_order_test: RuntimeError # Issue 29920
|
||||
compile_time_constant_a_test: RuntimeError # Issue 30526
|
||||
compile_time_constant_b_test: RuntimeError # Issue 29920
|
||||
compile_time_constant_d_test: RuntimeError # Issue 29920
|
||||
identical_closure2_test: RuntimeError # Issue 29920
|
||||
|
||||
@@ -19,6 +19,15 @@ call_constructor_on_unresolvable_class_test/02: CompileTimeError
|
||||
call_constructor_on_unresolvable_class_test/07: CompileTimeError
|
||||
class_keyword_test/02: CompileTimeError
|
||||
class_override_test/00: CompileTimeError
|
||||
type_variable_scope_test/none: CompileTimeError
|
||||
type_variable_scope_test/00: CompileTimeError
|
||||
type_variable_scope_test/01: CompileTimeError
|
||||
type_variable_scope_test/03: CompileTimeError
|
||||
type_variable_scope_test/02: CompileTimeError
|
||||
type_variable_scope_test/04: CompileTimeError
|
||||
type_variable_scope_test/05: CompileTimeError
|
||||
unicode_bom_test: CompileTimeError
|
||||
type_variable_scope2_test: CompileTimeError
|
||||
|
||||
# The VM doesn't enforce that potentially const expressions are actually
|
||||
# const expressions when the constructor is called with `const`.
|
||||
|
||||
@@ -167,6 +167,22 @@ if_null_precedence_test/06: MissingCompileTimeError
|
||||
if_null_precedence_test/07: MissingCompileTimeError
|
||||
if_null_precedence_test/none: RuntimeError
|
||||
many_generic_instanceof_test: RuntimeError
|
||||
type_variable_promotion_test: RuntimeError
|
||||
type_variable_nested_test/01: RuntimeError
|
||||
type_variable_scope_test/00: MissingCompileTimeError
|
||||
type_variable_scope_test/01: MissingCompileTimeError
|
||||
type_variable_scope_test/02: MissingCompileTimeError
|
||||
type_variable_scope_test/03: MissingCompileTimeError
|
||||
type_variable_scope_test/04: MissingCompileTimeError
|
||||
type_variable_scope_test/05: MissingCompileTimeError
|
||||
type_variable_scope2_test: MissingCompileTimeError
|
||||
type_variable_static_context_test: MissingCompileTimeError
|
||||
typed_selector2_test: MissingCompileTimeError
|
||||
unbound_getter_test: MissingCompileTimeError
|
||||
unresolved_default_constructor_test/01: MissingCompileTimeError
|
||||
unresolved_in_factory_test: MissingCompileTimeError
|
||||
unresolved_top_level_method_test: MissingCompileTimeError
|
||||
unresolved_top_level_var_test: MissingCompileTimeError
|
||||
|
||||
[ $compiler == precompiler && $runtime == dart_precompiled ]
|
||||
assertion_initializer_const_error2_test/cc01: Crash, MissingCompileTimeError
|
||||
@@ -236,6 +252,7 @@ generic_methods_recursive_bound_test/03: Crash, Pass
|
||||
|
||||
[ ($compiler == none || $compiler == precompiler || $compiler == app_jit) && ($runtime == vm || $runtime == dart_precompiled || $runtime == flutter) ]
|
||||
class_keyword_test/02: MissingCompileTimeError # Issue 13627
|
||||
unicode_bom_test: Fail # Issue 16067
|
||||
|
||||
[ ($compiler == none || $compiler == precompiler || $compiler == app_jit) && $checked ]
|
||||
generic_methods_function_type_test: Pass # Issue 25869
|
||||
|
||||
@@ -168,6 +168,22 @@ if_null_assignment_static_test/42: MissingCompileTimeError
|
||||
if_null_precedence_test/06: MissingCompileTimeError
|
||||
if_null_precedence_test/07: MissingCompileTimeError
|
||||
many_generic_instanceof_test: RuntimeError
|
||||
type_variable_nested_test/01: RuntimeError
|
||||
type_variable_promotion_test: RuntimeError
|
||||
type_variable_scope_test/00: MissingCompileTimeError
|
||||
type_variable_scope_test/01: MissingCompileTimeError
|
||||
type_variable_scope_test/02: MissingCompileTimeError
|
||||
type_variable_scope_test/03: MissingCompileTimeError
|
||||
type_variable_scope_test/04: MissingCompileTimeError
|
||||
type_variable_scope_test/05: MissingCompileTimeError
|
||||
type_variable_scope2_test: MissingCompileTimeError
|
||||
type_variable_static_context_test: MissingCompileTimeError
|
||||
typed_selector2_test: MissingCompileTimeError
|
||||
unbound_getter_test: MissingCompileTimeError
|
||||
unresolved_default_constructor_test/01: MissingCompileTimeError
|
||||
unresolved_in_factory_test: MissingCompileTimeError
|
||||
unresolved_top_level_method_test: MissingCompileTimeError
|
||||
unresolved_top_level_var_test: MissingCompileTimeError
|
||||
|
||||
[ $compiler == none && $runtime == vm ]
|
||||
generic_methods_bounds_test/02: MissingRuntimeError
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ main() {
|
||||
var a = new B();
|
||||
Expect.isFalse(a._copy is List<int>);
|
||||
Expect.isTrue(a._copy is List<A>);
|
||||
Expect.isTrue(a._copy is List<A<int>>);
|
||||
Expect.isFalse(a._copy is List<A<int>>); //# 01: ok
|
||||
|
||||
a = new B<String>();
|
||||
Expect.isFalse(a._copy is List<String>);
|
||||
+2
-2
@@ -30,6 +30,6 @@ class Foo<T extends A> {
|
||||
main() {
|
||||
var foo = new Foo<B>();
|
||||
var b = new B();
|
||||
Expect.equals(foo.foo(b), 'List<B>');
|
||||
Expect.listEquals(foo.bar(b), [b]);
|
||||
Expect.equals('List<B>', foo.foo(b));
|
||||
Expect.listEquals([b], foo.bar(b));
|
||||
}
|
||||
+7
-13
@@ -4,19 +4,13 @@
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
|
||||
getNonArray() => new A();
|
||||
// Test that malformed type arguments are treated as an error.
|
||||
|
||||
class A {
|
||||
operator [](index) => index;
|
||||
class Foo<T> {
|
||||
// T is not in scope for a static method.
|
||||
static Foo<T> m() { /*@compile-error=unspecified*/
|
||||
return new Foo();
|
||||
}
|
||||
}
|
||||
|
||||
main() {
|
||||
Expect.equals(42, () {
|
||||
var res;
|
||||
do {
|
||||
var a = getNonArray();
|
||||
res = a[42];
|
||||
} while (false);
|
||||
return res;
|
||||
}());
|
||||
}
|
||||
main() {}
|
||||
+6
-6
@@ -8,11 +8,11 @@ class Foo<T> {
|
||||
Foo() {}
|
||||
|
||||
static
|
||||
Foo<T> //# 00: static type warning
|
||||
Foo<T> //# 00: compile-time error
|
||||
m(
|
||||
Foo<T> //# 01: static type warning
|
||||
Foo<T> //# 01: compile-time error
|
||||
f) {
|
||||
Foo<T> x = new Foo<String>(); //# 02: static type warning
|
||||
Foo<T> x = new Foo<String>(); //# 02: compile-time error
|
||||
return new Foo<String>();
|
||||
}
|
||||
|
||||
@@ -22,16 +22,16 @@ class Foo<T> {
|
||||
}
|
||||
|
||||
// T is not in scope for a static field.
|
||||
static Foo<T> f1; //# 03: static type warning
|
||||
static Foo<T> f1; //# 03: compile-time error
|
||||
|
||||
static
|
||||
Foo<T> //# 04: static type warning
|
||||
Foo<T> //# 04: compile-time error
|
||||
get f {
|
||||
return new Foo<String>();
|
||||
}
|
||||
|
||||
static void set f(
|
||||
Foo<T> //# 05: static type warning
|
||||
Foo<T> //# 05: compile-time error
|
||||
value) {}
|
||||
}
|
||||
|
||||
+2
-1
@@ -6,8 +6,9 @@
|
||||
|
||||
class A<T> {
|
||||
static int method() {
|
||||
// error, can't reference a type variable in a static context
|
||||
var foo =
|
||||
new T(); // error, can't reference a type variable in a static context
|
||||
new T(); /*@compile-error=unspecified*/
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ main() {
|
||||
if (a(1, 2) != 42) {
|
||||
// This call used to crash dart2js because 'foo' was a typed
|
||||
// selector with a typedef as a receiver type.
|
||||
a.foo();
|
||||
a.foo(); /*@compile-error=unspecified*/
|
||||
}
|
||||
var b = new A();
|
||||
b.foo();
|
||||
+1
-1
@@ -6,5 +6,5 @@
|
||||
|
||||
main() {
|
||||
var a = 1;
|
||||
var b = +a;
|
||||
var b = +a; /*@compile-error=unspecified*/
|
||||
}
|
||||
+5
-6
@@ -1,16 +1,15 @@
|
||||
// Copyright (c) 2011, 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.
|
||||
|
||||
// Test that an unresolved method call in a factory is a resolution
|
||||
// error.
|
||||
// Verify that an unbound getter is properly resolved at runtime.
|
||||
|
||||
class A {
|
||||
factory A() {
|
||||
foo();
|
||||
const A();
|
||||
foo() {
|
||||
return y; /*@compile-error=unspecified*/
|
||||
}
|
||||
}
|
||||
|
||||
main() {
|
||||
new A();
|
||||
new A().foo();
|
||||
}
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
// Dart test program for testing unhandled exceptions.
|
||||
|
||||
class MyException {
|
||||
const MyException(String message = "") : message_ = message;
|
||||
const MyException(String message) : message_ = message;
|
||||
String getMessage() { return message_; }
|
||||
final String message_;
|
||||
}
|
||||
+2
-3
@@ -2,8 +2,7 @@
|
||||
// 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 unresolved default constructor calls remain unresolved after dart2dart
|
||||
// translation.
|
||||
// Test unresolved default constructor calls cause compilation errors.
|
||||
|
||||
import 'package:expect/expect.dart';
|
||||
|
||||
@@ -14,5 +13,5 @@ class A {
|
||||
|
||||
main() {
|
||||
A.method();
|
||||
Expect.throws(() => new A()); //# 01: static type warning
|
||||
Expect.throws(() => new A()); //# 01: compile-time error
|
||||
}
|
||||
+2
-3
@@ -2,12 +2,11 @@
|
||||
// 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 an unresolved method call in a factory is a resolution
|
||||
// error.
|
||||
// Test that an unresolved method call in a factory is a compile error.
|
||||
|
||||
class A {
|
||||
factory A() {
|
||||
foo();
|
||||
foo(); /*@compile-error=unspecified*/
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -2,10 +2,10 @@
|
||||
// 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 an unresolved identifier at the top level does not crash
|
||||
// the parser.
|
||||
// Test that an unresolved method call at the top level creates a compile-
|
||||
// time error.
|
||||
|
||||
var a = b;
|
||||
var a = b(); /*@compile-error=unspecified*/
|
||||
|
||||
main() {
|
||||
print(a);
|
||||
+4
-4
@@ -2,11 +2,11 @@
|
||||
// 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 an unresolved method call at the top level does not crash
|
||||
// the parser.
|
||||
// Test that an unresolved identifier at the top level causes a compile-time
|
||||
// error.
|
||||
|
||||
var a = b();
|
||||
var a = b; /*@compile-error=unspecified*/
|
||||
|
||||
main() {
|
||||
print(a);
|
||||
}
|
||||
}
|
||||
-2
@@ -10,14 +10,12 @@ class Base {
|
||||
}
|
||||
|
||||
class Sub1 extends Base {
|
||||
@override
|
||||
Future<int> method() async {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
class Sub2 extends Base {
|
||||
@override
|
||||
Future<int> method() async {
|
||||
return 2;
|
||||
}
|
||||
@@ -581,22 +581,6 @@ type_variable_conflict2_test: Skip
|
||||
type_variable_conflict_test: Skip
|
||||
type_variable_function_type_test: Skip
|
||||
type_variable_identifier_expression_test: Skip
|
||||
type_variable_scope2_test: Skip
|
||||
type_variable_scope3_test: Skip
|
||||
type_variable_scope_test: Skip
|
||||
type_variable_static_context_negative_test: Skip
|
||||
typed_selector2_test: Skip
|
||||
unary_plus_negative_test: Skip
|
||||
unbalanced_brace_test: Skip
|
||||
unbound_getter_test: Skip
|
||||
unhandled_exception_negative_test: Skip
|
||||
unresolved_default_constructor_test: Skip
|
||||
unresolved_in_factory_negative_test: Skip
|
||||
unresolved_top_level_method_negative_test: Skip
|
||||
unresolved_top_level_var_negative_test: Skip
|
||||
unsigned_right_shift_test: Skip
|
||||
unsupported_operators_test: Skip
|
||||
variable_declaration_metadata_test: Skip
|
||||
void_type_test: Skip
|
||||
wrong_number_type_arguments_test: Skip
|
||||
|
||||
@@ -720,7 +704,6 @@ switch_label_test: RuntimeError # Issue 29920
|
||||
switch_try_catch_test: RuntimeError # Issue 29920
|
||||
throwing_lazy_variable_test: RuntimeError # Issue 29920
|
||||
truncdiv_test: RuntimeError # Issue 29920
|
||||
type_variable_nested_test: RuntimeError # Issue 29920
|
||||
|
||||
# This test does not generate the expected compile time error, but it also does
|
||||
# not behave correctly at runtime. We cannot record this as "Fail" without
|
||||
|
||||
@@ -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.
|
||||
|
||||
// Regression test for
|
||||
// http://code.google.com/p/dart/issues/detail?id=9050.
|
||||
|
||||
import 'package:expect/expect.dart';
|
||||
|
||||
class A<T> {}
|
||||
|
||||
class B<T> {
|
||||
var _copy;
|
||||
B() {
|
||||
// We used to not register the dependency between List and B.
|
||||
_copy = new List<A<T>>();
|
||||
}
|
||||
}
|
||||
|
||||
main() {
|
||||
var a = new B();
|
||||
Expect.isFalse(a._copy is List<int>);
|
||||
Expect.isTrue(a._copy is List<A>);
|
||||
Expect.isTrue(a._copy is List<A<int>>);
|
||||
|
||||
a = new B<String>();
|
||||
Expect.isFalse(a._copy is List<String>);
|
||||
Expect.isTrue(a._copy is List<A>);
|
||||
Expect.isTrue(a._copy is List<A<String>>);
|
||||
Expect.isTrue(a._copy is List<A<Object>>);
|
||||
Expect.isFalse(a._copy is List<A<int>>);
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
// Copyright (c) 2012, 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";
|
||||
|
||||
// Test that malformed type arguments treated as dynamic in both production and
|
||||
// checked mode.
|
||||
|
||||
class Foo<T> {
|
||||
// T is not in scope for a static method.
|
||||
static Foo<T> m() {
|
||||
return new Foo();
|
||||
}
|
||||
}
|
||||
|
||||
main() {
|
||||
try {
|
||||
Expect.isTrue(Foo.m() is Foo);
|
||||
} on TypeError catch (error) {
|
||||
print(error);
|
||||
// No type error in production nor checked mode.
|
||||
Expect.fail();
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
// Copyright (c) 2012, 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.
|
||||
|
||||
// Test that a type parameter cannot be repeated.
|
||||
|
||||
class Foo<
|
||||
T
|
||||
, T // //# 00: compile-time error
|
||||
> {}
|
||||
|
||||
main() {
|
||||
new Foo<
|
||||
String
|
||||
, String // //# 00: continued
|
||||
>();
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
// Copyright (c) 2012, 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.
|
||||
|
||||
// Test that type variables referenced from within static members are malformed.
|
||||
|
||||
class Foo<T> {
|
||||
Foo() {}
|
||||
|
||||
static
|
||||
Foo<T> //# 00: static type warning
|
||||
m(
|
||||
Foo<T> //# 01: static type warning
|
||||
f) {
|
||||
Foo<T> x = new Foo<String>(); //# 02: static type warning
|
||||
return new Foo<String>();
|
||||
}
|
||||
|
||||
// T is in scope for a factory method.
|
||||
factory Foo.I(Foo<T> f) {
|
||||
Foo<T> x = f;
|
||||
}
|
||||
|
||||
// T is not in scope for a static field.
|
||||
static Foo<T> f1; //# 03: static type warning
|
||||
|
||||
static
|
||||
Foo<T> //# 04: static type warning
|
||||
get f {
|
||||
return new Foo<String>();
|
||||
}
|
||||
|
||||
static void set f(
|
||||
Foo<T> //# 05: static type warning
|
||||
value) {}
|
||||
}
|
||||
|
||||
abstract class I<T> {
|
||||
factory I(Foo<T> f) = Foo<T>.I;
|
||||
}
|
||||
|
||||
main() {
|
||||
Foo.m(new Foo<String>());
|
||||
new I(new Foo<String>());
|
||||
Foo.f1 = new Foo<String>(); //# 03: continued
|
||||
var x = Foo.f;
|
||||
Foo.f = x;
|
||||
}
|
||||
@@ -1,30 +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.
|
||||
|
||||
// Test that rti dependency registration takes type variables within typedefs
|
||||
// into account.
|
||||
|
||||
import 'package:expect/expect.dart';
|
||||
|
||||
typedef Foo<T>(T t);
|
||||
|
||||
class A<T> {
|
||||
m() => new B<Foo<T>>();
|
||||
}
|
||||
|
||||
class B<T> {
|
||||
m(o) => o is T;
|
||||
}
|
||||
|
||||
foo(int i) {}
|
||||
bar(String s) {}
|
||||
|
||||
void main() {
|
||||
Expect.isTrue(new A<int>().m().m(foo));
|
||||
Expect.isFalse(new A<int>().m().m(bar));
|
||||
Expect.isFalse(new A<String>().m().m(foo));
|
||||
Expect.isTrue(new A<String>().m().m(bar));
|
||||
Expect.isFalse(new A<double>().m().m(foo));
|
||||
Expect.isFalse(new A<double>().m().m(bar));
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
// Copyright (c) 2012, 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.
|
||||
|
||||
// Regression test for http://dartbug.com/6036. dart2js used to fail
|
||||
// this method because it was computing that intersecting type D with
|
||||
// type C is conflicting.
|
||||
|
||||
foo(a, b) {
|
||||
if (identical(a, b)) return;
|
||||
throw 'broken';
|
||||
}
|
||||
|
||||
class D {}
|
||||
|
||||
class C implements D {}
|
||||
|
||||
main() {
|
||||
var c = new C();
|
||||
foo(c, c as D);
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
// Copyright (c) 2012, 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.
|
||||
// Test for dart2js to handle a typed selector with a typedef as a
|
||||
// receiver type.
|
||||
|
||||
getComparator() => (a, b) => 42;
|
||||
|
||||
class A {
|
||||
foo() => 42;
|
||||
}
|
||||
|
||||
main() {
|
||||
Comparator a = getComparator();
|
||||
if (a(1, 2) != 42) {
|
||||
// This call used to crash dart2js because 'foo' was a typed
|
||||
// selector with a typedef as a receiver type.
|
||||
a.foo();
|
||||
}
|
||||
var b = new A();
|
||||
b.foo();
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
// Copyright (c) 2012, 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";
|
||||
|
||||
// Regression test for http://dartbug.com/6259. This test used to fail
|
||||
// on dart2js because class A does not know [A.document] is a target for
|
||||
// the call [:obj.document:] in the [main] method. Therefore, dart2js
|
||||
// would not compile [A.document].
|
||||
|
||||
class A {
|
||||
get document => 42;
|
||||
}
|
||||
|
||||
abstract class B {
|
||||
get document; // Abstract.
|
||||
}
|
||||
|
||||
class C extends A implements B {}
|
||||
|
||||
int inscrutable(int x) => x == 0 ? 0 : x | inscrutable(x & (x - 1));
|
||||
|
||||
void main() {
|
||||
var tab = [new Object(), new C()];
|
||||
var obj = tab[inscrutable(1)];
|
||||
int res = 0;
|
||||
if (obj is B) res = obj.document;
|
||||
Expect.equals(42, res);
|
||||
}
|
||||
@@ -1,125 +0,0 @@
|
||||
// Copyright (c) 2012, 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";
|
||||
|
||||
// Test is-test of typedefs with optional and named parameters.
|
||||
|
||||
typedef int Func1(int a);
|
||||
typedef int Func2(int a, [int b]);
|
||||
typedef int Func3(int a, [int b, int c]);
|
||||
typedef int Func4([int a, int b, int c]);
|
||||
typedef int Func5(int a, {int b});
|
||||
typedef int Func6(int a, {int b, int c});
|
||||
typedef int Func7({int a, int b, int c});
|
||||
|
||||
void main() {
|
||||
int func1(int i) {}
|
||||
Expect.isTrue(func1 is Func1);
|
||||
Expect.isFalse(func1 is Func2);
|
||||
Expect.isFalse(func1 is Func3);
|
||||
Expect.isFalse(func1 is Func4);
|
||||
Expect.isFalse(func1 is Func5);
|
||||
Expect.isFalse(func1 is Func6);
|
||||
Expect.isFalse(func1 is Func7);
|
||||
|
||||
int func2(int i, int j) {}
|
||||
Expect.isFalse(func2 is Func1);
|
||||
Expect.isFalse(func2 is Func2);
|
||||
Expect.isFalse(func2 is Func3);
|
||||
Expect.isFalse(func2 is Func4);
|
||||
Expect.isFalse(func2 is Func5);
|
||||
Expect.isFalse(func2 is Func6);
|
||||
Expect.isFalse(func2 is Func7);
|
||||
|
||||
int func3(int i, int j, int k) {}
|
||||
Expect.isFalse(func3 is Func1);
|
||||
Expect.isFalse(func3 is Func2);
|
||||
Expect.isFalse(func3 is Func3);
|
||||
Expect.isFalse(func3 is Func4);
|
||||
Expect.isFalse(func3 is Func5);
|
||||
Expect.isFalse(func3 is Func6);
|
||||
Expect.isFalse(func3 is Func7);
|
||||
|
||||
int func4(int i, [int j]) {}
|
||||
Expect.isTrue(func4 is Func1);
|
||||
Expect.isTrue(func4 is Func2);
|
||||
Expect.isFalse(func4 is Func3);
|
||||
Expect.isFalse(func4 is Func4);
|
||||
Expect.isFalse(func4 is Func5);
|
||||
Expect.isFalse(func4 is Func6);
|
||||
Expect.isFalse(func4 is Func7);
|
||||
|
||||
int func5(int i, [int j, int k]) {}
|
||||
Expect.isTrue(func5 is Func1);
|
||||
Expect.isTrue(func5 is Func2);
|
||||
Expect.isTrue(func5 is Func3);
|
||||
Expect.isFalse(func5 is Func4);
|
||||
Expect.isFalse(func5 is Func5);
|
||||
Expect.isFalse(func5 is Func6);
|
||||
Expect.isFalse(func5 is Func7);
|
||||
|
||||
int func6([int i, int j, int k]) {}
|
||||
Expect.isTrue(func6 is Func1);
|
||||
Expect.isTrue(func6 is Func2);
|
||||
Expect.isTrue(func6 is Func3);
|
||||
Expect.isTrue(func6 is Func4);
|
||||
Expect.isFalse(func6 is Func5);
|
||||
Expect.isFalse(func6 is Func6);
|
||||
Expect.isFalse(func6 is Func7);
|
||||
|
||||
int func7(int i, {int j}) {}
|
||||
Expect.isTrue(func7 is Func1);
|
||||
Expect.isFalse(func7 is Func2);
|
||||
Expect.isFalse(func7 is Func3);
|
||||
Expect.isFalse(func7 is Func4);
|
||||
Expect.isFalse(func7 is Func5);
|
||||
Expect.isFalse(func7 is Func6);
|
||||
Expect.isFalse(func7 is Func7);
|
||||
|
||||
int func8(int i, {int b}) {}
|
||||
Expect.isTrue(func8 is Func1);
|
||||
Expect.isFalse(func8 is Func2);
|
||||
Expect.isFalse(func8 is Func3);
|
||||
Expect.isFalse(func8 is Func4);
|
||||
Expect.isTrue(func8 is Func5);
|
||||
Expect.isFalse(func8 is Func6);
|
||||
Expect.isFalse(func8 is Func7);
|
||||
|
||||
int func9(int i, {int b, int c}) {}
|
||||
Expect.isTrue(func9 is Func1);
|
||||
Expect.isFalse(func9 is Func2);
|
||||
Expect.isFalse(func9 is Func3);
|
||||
Expect.isFalse(func9 is Func4);
|
||||
Expect.isTrue(func9 is Func5);
|
||||
Expect.isTrue(func9 is Func6);
|
||||
Expect.isFalse(func9 is Func7);
|
||||
|
||||
int func10(int i, {int c, int b}) {}
|
||||
Expect.isTrue(func10 is Func1);
|
||||
Expect.isFalse(func10 is Func2);
|
||||
Expect.isFalse(func10 is Func3);
|
||||
Expect.isFalse(func10 is Func4);
|
||||
Expect.isTrue(func10 is Func5);
|
||||
Expect.isTrue(func10 is Func6);
|
||||
Expect.isFalse(func10 is Func7);
|
||||
|
||||
int func11({int a, int b, int c}) {}
|
||||
Expect.isFalse(func11 is Func1);
|
||||
Expect.isFalse(func11 is Func2);
|
||||
Expect.isFalse(func11 is Func3);
|
||||
Expect.isFalse(func11 is Func4);
|
||||
Expect.isFalse(func11 is Func5);
|
||||
Expect.isFalse(func11 is Func6);
|
||||
Expect.isTrue(func11 is Func7);
|
||||
|
||||
int func12({int c, int a, int b}) {}
|
||||
Expect.isFalse(func12 is Func1);
|
||||
Expect.isFalse(func12 is Func2);
|
||||
Expect.isFalse(func12 is Func3);
|
||||
Expect.isFalse(func12 is Func4);
|
||||
Expect.isFalse(func12 is Func5);
|
||||
Expect.isFalse(func12 is Func6);
|
||||
Expect.isTrue(func12 is Func7);
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
// Copyright (c) 2012, 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.
|
||||
// Dart test for testing binary operations.
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
|
||||
class UnaryTest {
|
||||
static foo() {
|
||||
return -4;
|
||||
}
|
||||
|
||||
static moo() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
static testMain() {
|
||||
Expect.equals(1, (UnaryTest.foo() + UnaryTest.moo()));
|
||||
}
|
||||
}
|
||||
|
||||
main() {
|
||||
UnaryTest.testMain();
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
// Copyright (c) 2011, 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";
|
||||
|
||||
// Dart test for testing binary operations.
|
||||
|
||||
class UnaryTest {
|
||||
static foo() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
static moo() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
static testMain() {
|
||||
Expect.equals(9.0, (UnaryTest.foo() + UnaryTest.moo()));
|
||||
}
|
||||
}
|
||||
|
||||
main() {
|
||||
UnaryTest.testMain();
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
// Copyright (c) 2012, 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.
|
||||
|
||||
// Test syntax errors related to unterminated braces.
|
||||
|
||||
class A {
|
||||
m() {
|
||||
/* //# 01: compile-time error
|
||||
}
|
||||
// */
|
||||
|
||||
/* //# 02: compile-time error
|
||||
}
|
||||
// */
|
||||
|
||||
class B {}
|
||||
|
||||
main() {
|
||||
new A();
|
||||
new B();
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
// Copyright (c) 2011, 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.
|
||||
// Verify that an unbound getter is properly resolved at runtime.
|
||||
|
||||
class A {
|
||||
const A();
|
||||
foo() {
|
||||
return y;
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
final y;
|
||||
const B(val)
|
||||
: super(),
|
||||
y = val;
|
||||
}
|
||||
|
||||
class UnboundGetterTest {
|
||||
static testMain() {
|
||||
var b = new B(1);
|
||||
print(b.foo());
|
||||
}
|
||||
}
|
||||
|
||||
main() {
|
||||
UnboundGetterTest.testMain();
|
||||
}
|
||||
@@ -1,16 +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.
|
||||
|
||||
// Test to ensure that we get don't exceptions in the SSA verifier when
|
||||
// generating phi for the return value of an inlined function that contains a
|
||||
// loop that always breaks.
|
||||
doWhileBreak() {
|
||||
do {
|
||||
break;
|
||||
} while (true);
|
||||
}
|
||||
|
||||
main() {
|
||||
doWhileBreak();
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
// Copyright (c) 2011, 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";
|
||||
|
||||
int inscrutable(int x) => x == 0 ? 0 : x | inscrutable(x & (x - 1));
|
||||
|
||||
foo(x) {
|
||||
if (inscrutable(1999) == 1999) return x;
|
||||
return 499;
|
||||
}
|
||||
|
||||
main() {
|
||||
Expect.equals(3, "xx".length); // BOM character between the xs.
|
||||
Expect.equals(3, foo("xx").length); // BOM character between the xs.
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
// Copyright (c) 2011, 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.
|
||||
|
||||
// This file is saved with a BOM character (as first character). This character
|
||||
// should be ignored.
|
||||
// Tests that files with a BOM character are correctly handled.
|
||||
|
||||
main() {
|
||||
/* do nothing. */
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
// Copyright (c) 2011, 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";
|
||||
|
||||
main() {
|
||||
Expect.equals("\u{10412}", "𐐒"); // Second string is literal U+10412.
|
||||
Expect.equals("\u{10412}".hashCode, "𐐒".hashCode);
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
// Copyright (c) 2011, 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.
|
||||
// Dart test program to check that we can resolve unqualified identifiers
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
|
||||
class B {
|
||||
B(x, y) : b = y {}
|
||||
var b;
|
||||
|
||||
get_b() {
|
||||
// Resolving unqualified instance method.
|
||||
return really_really_get_it();
|
||||
}
|
||||
|
||||
really_really_get_it() {
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
|
||||
class UnqualNameTest {
|
||||
static eleven() {
|
||||
return 11;
|
||||
}
|
||||
|
||||
static testMain() {
|
||||
var o = new B(3, 5);
|
||||
Expect.equals(11, eleven()); // Unqualified static method call.
|
||||
Expect.equals(5, o.get_b());
|
||||
|
||||
// Check whether we handle variable initializers correctly.
|
||||
var a = 1, x, b = a + 3;
|
||||
Expect.equals(5, a + b);
|
||||
}
|
||||
}
|
||||
|
||||
main() {
|
||||
UnqualNameTest.testMain();
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
// Copyright (c) 2011, 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.
|
||||
|
||||
// Test that an unresolved identifier at the top level does not crash
|
||||
// the parser.
|
||||
|
||||
var a = b;
|
||||
|
||||
main() {
|
||||
print(a);
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
// Copyright (c) 2012, 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.
|
||||
|
||||
// The >>> operator is not supported in Dart
|
||||
|
||||
main() {
|
||||
var foo = -10
|
||||
>>> 1 //# 01: compile-time error
|
||||
;
|
||||
foo >>>= 1; //# 02: compile-time error
|
||||
}
|
||||
@@ -1,29 +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.
|
||||
|
||||
// Test handling of unsupported operators.
|
||||
|
||||
library unsupported_operators;
|
||||
|
||||
class C {
|
||||
m() {
|
||||
print(
|
||||
super === //# 01: compile-time error
|
||||
null);
|
||||
print(
|
||||
super !== //# 02: compile-time error
|
||||
null);
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
new C().m();
|
||||
new C().m();
|
||||
print(
|
||||
"foo" === //# 03: compile-time error
|
||||
null);
|
||||
print(
|
||||
"foo" !== //# 04: compile-time error
|
||||
null);
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
// Copyright (c) 2012, 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";
|
||||
|
||||
int inscrutable(int x) => x == 0 ? 0 : x | inscrutable(x & (x - 1));
|
||||
|
||||
foo() {
|
||||
int x = 0;
|
||||
if (inscrutable(0) == 0) x = -2; // x is now in range [-2 .. 0].
|
||||
int y = 2;
|
||||
if (inscrutable(0) == 0) y = 4; // y is now in range [2 .. 4].
|
||||
int i = y - x; // i should be in range [2 .. 6].
|
||||
i -= 4; // i should be in range [-2 .. 2]. Actual value: 2.
|
||||
var a = const [1];
|
||||
return a[i];
|
||||
}
|
||||
|
||||
main() {
|
||||
Expect.throws(() => foo(), (e) => e is RangeError);
|
||||
}
|
||||
@@ -1,18 +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 A {
|
||||
copy(array, index1, index2) {
|
||||
if (index1 < index2 + index2) {
|
||||
// dart2js used to remove the bounds check.
|
||||
return array[index1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
main() {
|
||||
Expect.throws(() => new A().copy(new List(0), 0, 1), (e) => e is RangeError);
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
// Copyright (c) 2012, 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";
|
||||
|
||||
int inscrutable(int x) => x == 0 ? 0 : x | inscrutable(x & (x - 1));
|
||||
|
||||
foo() {
|
||||
var x = 0x102;
|
||||
if (inscrutable(x) == 0) x = 0x0;
|
||||
if (inscrutable(10) == 10) x = 0x10; // x is in range [0 .. 0x102].
|
||||
x = x & 0xFF; // x should be in range [0 .. 0xFF]. Actual value: 0x10.
|
||||
var a = const [1, 2, 3];
|
||||
return a[x];
|
||||
}
|
||||
|
||||
main() {
|
||||
Expect.throws(() => foo(), (e) => e is RangeError);
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
// Copyright (c) 2011, 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.
|
||||
// Testing correct initialization of variables in scopes.
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
|
||||
class VarInitTest {
|
||||
static void testMain() {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
var x;
|
||||
Expect.equals(null, x);
|
||||
x = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
main() {
|
||||
VarInitTest.testMain();
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
// Copyright (c) 2015, 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.
|
||||
|
||||
// Verify that the individual variable declarations inside a variable
|
||||
// declaration list are not allowed to be annotated with metadata.
|
||||
|
||||
const annotation = null;
|
||||
|
||||
var
|
||||
@annotation //# 01: compile-time error
|
||||
v1,
|
||||
@annotation //# 02: compile-time error
|
||||
v2;
|
||||
|
||||
int
|
||||
@annotation //# 03: compile-time error
|
||||
v3,
|
||||
@annotation //# 04: compile-time error
|
||||
v4;
|
||||
|
||||
class C {
|
||||
var
|
||||
@annotation //# 05: compile-time error
|
||||
f1,
|
||||
@annotation //# 06: compile-time error
|
||||
f2;
|
||||
|
||||
int
|
||||
@annotation //# 07: compile-time error
|
||||
f3,
|
||||
@annotation //# 08: compile-time error
|
||||
f4;
|
||||
}
|
||||
|
||||
use(x) => x;
|
||||
|
||||
main() {
|
||||
use(v1);
|
||||
use(v2);
|
||||
use(v3);
|
||||
use(v4);
|
||||
|
||||
C c = new C();
|
||||
use(c.f1);
|
||||
use(c.f2);
|
||||
use(c.f3);
|
||||
use(c.f4);
|
||||
|
||||
var
|
||||
@annotation //# 09: compile-time error
|
||||
l1,
|
||||
@annotation //# 10: compile-time error
|
||||
l2;
|
||||
|
||||
int
|
||||
@annotation //# 11: compile-time error
|
||||
l3,
|
||||
@annotation //# 12: compile-time error
|
||||
l4;
|
||||
|
||||
use(l1);
|
||||
use(l2);
|
||||
use(l3);
|
||||
use(l4);
|
||||
|
||||
for (var
|
||||
@annotation //# 13: compile-time error
|
||||
i1 = 0,
|
||||
@annotation //# 14: compile-time error
|
||||
i2 = 0;;) {
|
||||
use(i1);
|
||||
use(i2);
|
||||
break;
|
||||
}
|
||||
|
||||
for (int
|
||||
@annotation //# 15: compile-time error
|
||||
i3 = 0,
|
||||
@annotation //# 16: compile-time error
|
||||
i4 = 0;;) {
|
||||
use(i3);
|
||||
use(i4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user