Version 2.1.1-dev.0.1
* Cherry-pick 4914fe57ea9e034b948ef3ab5a4e7e511991f845 to dev
* Cherry-pick 5a8ec419829337b60d705cabe0b3b1ab5d0d0883 to dev
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 54f3532..4e01f11 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,8 @@
+## 2.1.1-dev.0.1
+
+* Cherry-pick 4914fe57ea9e034b948ef3ab5a4e7e511991f845 to dev
+* Cherry-pick 5a8ec419829337b60d705cabe0b3b1ab5d0d0883 to dev
+
## 2.1.1-dev.0.0
* Cherry-pick f8a680e5116493f8795c148a52dbecf8a84e4536 to dev
diff --git a/pkg/compiler/lib/src/inferrer/typemasks/union_type_mask.dart b/pkg/compiler/lib/src/inferrer/typemasks/union_type_mask.dart
index aba7ea6..c409d07 100644
--- a/pkg/compiler/lib/src/inferrer/typemasks/union_type_mask.dart
+++ b/pkg/compiler/lib/src/inferrer/typemasks/union_type_mask.dart
@@ -16,7 +16,7 @@
// helpful in debugging.
static const bool PERFORM_EXTRA_CONTAINS_CHECK = false;
- final Iterable<FlatTypeMask> disjointMasks;
+ final List<FlatTypeMask> disjointMasks;
UnionTypeMask._internal(this.disjointMasks) {
assert(disjointMasks.length > 1);
@@ -216,7 +216,7 @@
Iterable<FlatTypeMask> newIterable = disjointMasks.map((e) {
FlatTypeMask r = e.nonNullable();
return r;
- });
+ }).toList();
return new UnionTypeMask._internal(newIterable);
}
diff --git a/runtime/lib/mirrors.cc b/runtime/lib/mirrors.cc
index 86ed771..02437d3 100644
--- a/runtime/lib/mirrors.cc
+++ b/runtime/lib/mirrors.cc
@@ -1434,13 +1434,6 @@
InvocationMirror::kMethod);
UNREACHABLE();
}
- const Object& type_error =
- Object::Handle(redirected_constructor.DoArgumentTypesMatch(
- args, args_descriptor, type_arguments));
- if (!type_error.IsNull()) {
- Exceptions::PropagateError(Error::Cast(type_error));
- UNREACHABLE();
- }
Instance& new_object = Instance::Handle();
if (redirected_constructor.IsGenerativeConstructor()) {
diff --git a/runtime/vm/dart_api_impl_test.cc b/runtime/vm/dart_api_impl_test.cc
index 3a3c425..d959a93 100644
--- a/runtime/vm/dart_api_impl_test.cc
+++ b/runtime/vm/dart_api_impl_test.cc
@@ -4233,16 +4233,6 @@
EXPECT_STREQ("myerror", Dart_GetError(result));
}
-TEST_CASE(DartAPI_SetField_BadType) {
- const char* kScriptChars = "int foo;\n";
- Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
- Dart_Handle name = NewString("foo");
- Dart_Handle result = Dart_SetField(lib, name, Dart_True());
- EXPECT(Dart_IsError(result));
- EXPECT_SUBSTRING("type 'bool' is not a subtype of type 'int' of 'foo'",
- Dart_GetError(result));
-}
-
void NativeFieldLookup(Dart_NativeArguments args) {
UNREACHABLE();
}
@@ -5227,88 +5217,6 @@
EXPECT_STREQ("myerror", Dart_GetError(result));
}
-TEST_CASE(DartAPI_Invoke_BadArgs) {
- const char* kScriptChars =
- "class BaseMethods {\n"
- " inheritedMethod(int arg) => 'inherited $arg';\n"
- " static nonInheritedMethod(int arg) => 'noninherited $arg';\n"
- "}\n"
- "\n"
- "class Methods extends BaseMethods {\n"
- " instanceMethod(int arg) => 'instance $arg';\n"
- " _instanceMethod(int arg) => 'hidden instance $arg';\n"
- " static staticMethod(int arg) => 'static $arg';\n"
- " static _staticMethod(int arg) => 'hidden static $arg';\n"
- "}\n"
- "\n"
- "topMethod(int arg) => 'top $arg';\n"
- "_topMethod(int arg) => 'hidden top $arg';\n"
- "\n"
- "Methods test() {\n"
- " return new Methods();\n"
- "}\n";
-
-#if defined(PRODUCT)
- const char* error_msg =
- "type '_OneByteString' is not a subtype of type 'int' of 'arg'";
-#else
- const char* error_msg =
- "type 'String' is not a subtype of type 'int' of 'arg'";
-#endif // defined(PRODUCT)
-
- // Shared setup.
- Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
- Dart_Handle type = Dart_GetType(lib, NewString("Methods"), 0, NULL);
- EXPECT_VALID(type);
- Dart_Handle instance = Dart_Invoke(lib, NewString("test"), 0, NULL);
- EXPECT_VALID(instance);
- Dart_Handle args[1];
- args[0] = NewString("!!!");
- Dart_Handle result;
- Dart_Handle name;
-
- // Instance method.
- name = NewString("instanceMethod");
- result = Dart_Invoke(instance, name, 1, args);
- EXPECT(Dart_IsError(result));
- EXPECT_SUBSTRING(error_msg, Dart_GetError(result));
-
- name = PrivateLibName(lib, "_instanceMethod");
- result = Dart_Invoke(instance, name, 1, args);
- EXPECT(Dart_IsError(result));
- EXPECT_SUBSTRING(error_msg, Dart_GetError(result));
-
- // Inherited method.
- name = NewString("inheritedMethod");
- result = Dart_Invoke(instance, name, 1, args);
- EXPECT(Dart_IsError(result));
- EXPECT_SUBSTRING(error_msg, Dart_GetError(result));
-
- // Static method.
- name = NewString("staticMethod");
- result = Dart_Invoke(type, name, 1, args);
- EXPECT(Dart_IsError(result));
- EXPECT_SUBSTRING(error_msg, Dart_GetError(result));
-
- // Hidden static method.
- name = NewString("_staticMethod");
- result = Dart_Invoke(type, name, 1, args);
- EXPECT(Dart_IsError(result));
- EXPECT_SUBSTRING(error_msg, Dart_GetError(result));
-
- // Top-Level method.
- name = NewString("topMethod");
- result = Dart_Invoke(lib, name, 1, args);
- EXPECT(Dart_IsError(result));
- EXPECT_SUBSTRING(error_msg, Dart_GetError(result));
-
- // Hidden top-level method.
- name = NewString("_topMethod");
- result = Dart_Invoke(lib, name, 1, args);
- EXPECT(Dart_IsError(result));
- EXPECT_SUBSTRING(error_msg, Dart_GetError(result));
-}
-
TEST_CASE(DartAPI_Invoke_Null) {
Dart_Handle result = Dart_Invoke(Dart_Null(), NewString("toString"), 0, NULL);
EXPECT_VALID(result);
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index c3e8d86..f10702a 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -3398,26 +3398,6 @@
return DartEntry::InvokeFunction(throwNew, args);
}
-static RawObject* ThrowTypeError(const TokenPosition token_pos,
- const Instance& src_value,
- const AbstractType& dst_type,
- const String& dst_name) {
- const Array& args = Array::Handle(Array::New(5));
- const Smi& pos = Smi::Handle(Smi::New(token_pos.value()));
- args.SetAt(0, pos);
- args.SetAt(1, src_value);
- args.SetAt(2, dst_type);
- args.SetAt(3, dst_name);
- args.SetAt(4, String::Handle()); // bound error message
-
- const Library& libcore = Library::Handle(Library::CoreLibrary());
- const Class& TypeError =
- Class::Handle(libcore.LookupClassAllowPrivate(Symbols::TypeError()));
- const Function& throwNew = Function::Handle(
- TypeError.LookupFunctionAllowPrivate(Symbols::ThrowNew()));
- return DartEntry::InvokeFunction(throwNew, args);
-}
-
RawObject* Class::InvokeGetter(const String& getter_name,
bool throw_nsm_if_absent,
bool respect_reflectable) const {
@@ -3482,31 +3462,21 @@
const String& internal_setter_name =
String::Handle(zone, Field::SetterName(setter_name));
- AbstractType& parameter_type = AbstractType::Handle(zone);
- AbstractType& argument_type =
- AbstractType::Handle(zone, value.GetType(Heap::kOld));
-
if (field.IsNull()) {
const Function& setter =
Function::Handle(zone, LookupStaticFunction(internal_setter_name));
+
const int kNumArgs = 1;
const Array& args = Array::Handle(zone, Array::New(kNumArgs));
args.SetAt(0, value);
+
if (setter.IsNull() || (respect_reflectable && !setter.is_reflectable())) {
return ThrowNoSuchMethod(AbstractType::Handle(zone, RareType()),
internal_setter_name, args, Object::null_array(),
InvocationMirror::kStatic,
InvocationMirror::kSetter);
}
- parameter_type ^= setter.ParameterTypeAt(0);
- if (!argument_type.IsNullType() && !parameter_type.IsDynamicType() &&
- !value.IsInstanceOf(parameter_type, Object::null_type_arguments(),
- Object::null_type_arguments(), NULL)) {
- const String& argument_name =
- String::Handle(zone, setter.ParameterNameAt(0));
- return ThrowTypeError(setter.token_pos(), value, parameter_type,
- argument_name);
- }
+
// Invoke the setter and return the result.
return DartEntry::InvokeFunction(setter, args);
}
@@ -3515,20 +3485,13 @@
const int kNumArgs = 1;
const Array& args = Array::Handle(zone, Array::New(kNumArgs));
args.SetAt(0, value);
+
return ThrowNoSuchMethod(AbstractType::Handle(zone, RareType()),
internal_setter_name, args, Object::null_array(),
InvocationMirror::kStatic,
InvocationMirror::kSetter);
}
- parameter_type ^= field.type();
- if (!argument_type.IsNullType() && !parameter_type.IsDynamicType() &&
- !value.IsInstanceOf(parameter_type, Object::null_type_arguments(),
- Object::null_type_arguments(), NULL)) {
- const String& argument_name = String::Handle(zone, field.name());
- return ThrowTypeError(field.token_pos(), value, parameter_type,
- argument_name);
- }
field.SetStaticValue(value);
return value.raw();
}
@@ -3578,21 +3541,19 @@
return DartEntry::InvokeClosure(call_args, call_args_descriptor_array);
}
}
+
const Array& args_descriptor_array = Array::Handle(
zone, ArgumentsDescriptor::New(kTypeArgsLen, args.Length(), arg_names));
+
ArgumentsDescriptor args_descriptor(args_descriptor_array);
- const TypeArguments& type_args = Object::null_type_arguments();
+
if (function.IsNull() || !function.AreValidArguments(args_descriptor, NULL) ||
(respect_reflectable && !function.is_reflectable())) {
return ThrowNoSuchMethod(
AbstractType::Handle(zone, RareType()), function_name, args, arg_names,
InvocationMirror::kStatic, InvocationMirror::kMethod);
}
- RawObject* type_error =
- function.DoArgumentTypesMatch(args, args_descriptor, type_args);
- if (type_error != Error::null()) {
- return type_error;
- }
+
return DartEntry::InvokeFunction(function, args, args_descriptor_array);
}
@@ -6942,87 +6903,6 @@
return true;
}
-RawObject* Function::DoArgumentTypesMatch(
- const Array& args,
- const ArgumentsDescriptor& args_desc,
- const TypeArguments& instantiator_type_args) const {
- Thread* thread = Thread::Current();
- Zone* zone = thread->zone();
- Function& instantiated_func = Function::Handle(zone, raw());
-
- if (!HasInstantiatedSignature()) {
- instantiated_func ^= InstantiateSignatureFrom(instantiator_type_args,
- Object::null_type_arguments(),
- kAllFree, Heap::kOld);
- }
- AbstractType& argument_type = AbstractType::Handle(zone);
- AbstractType& parameter_type = AbstractType::Handle(zone);
- Instance& argument = Instance::Handle(zone);
-
- // Check types of the provided arguments against the expected parameter types.
- for (intptr_t i = args_desc.FirstArgIndex(); i < args_desc.PositionalCount();
- ++i) {
- argument ^= args.At(i);
- argument_type ^= argument.GetType(Heap::kOld);
- parameter_type ^= instantiated_func.ParameterTypeAt(i);
-
- // If the argument type is dynamic or the parameter is null, move on.
- if (parameter_type.IsDynamicType() || argument_type.IsNullType()) {
- continue;
- }
- if (!argument.IsInstanceOf(parameter_type, instantiator_type_args,
- Object::null_type_arguments(), NULL)) {
- String& argument_name = String::Handle(zone, ParameterNameAt(i));
- return ThrowTypeError(token_pos(), argument, parameter_type,
- argument_name);
- }
- }
-
- const intptr_t num_arguments = args_desc.Count();
- const intptr_t num_named_arguments = args_desc.NamedCount();
- if (num_named_arguments == 0) {
- return Error::null();
- }
-
- String& argument_name = String::Handle(zone);
- String& parameter_name = String::Handle(zone);
-
- // Check types of named arguments against expected parameter type.
- for (intptr_t i = 0; i < num_named_arguments; i++) {
- argument_name ^= args_desc.NameAt(i);
- ASSERT(argument_name.IsSymbol());
- bool found = false;
- const intptr_t num_positional_args = num_arguments - num_named_arguments;
- const int num_parameters = NumParameters();
-
- // Try to find the named parameter that matches the provided argument.
- for (intptr_t j = num_positional_args; !found && (j < num_parameters);
- j++) {
- parameter_name = ParameterNameAt(j);
- ASSERT(argument_name.IsSymbol());
- if (argument_name.Equals(parameter_name)) {
- found = true;
- argument ^= args.At(args_desc.PositionAt(i));
- argument_type ^= argument.GetType(Heap::kOld);
- parameter_type ^= instantiated_func.ParameterTypeAt(j);
-
- // If the argument type is dynamic or the parameter is null, move on.
- if (parameter_type.IsDynamicType() || argument_type.IsNullType()) {
- continue;
- }
- if (!argument.IsInstanceOf(parameter_type, instantiator_type_args,
- Object::null_type_arguments(), NULL)) {
- String& argument_name = String::Handle(zone, ParameterNameAt(i));
- return ThrowTypeError(token_pos(), argument, parameter_type,
- argument_name);
- }
- }
- }
- ASSERT(found);
- }
- return Error::null();
-}
-
// Helper allocating a C string buffer in the zone, printing the fully qualified
// name of a function in it, and replacing ':' by '_' to make sure the
// constructed name is a valid C++ identifier for debugging purpose.
@@ -11161,14 +11041,12 @@
}
// Invoke the function, or noSuchMethod if it is null.
-static RawObject* InvokeInstanceFunction(
- const Instance& receiver,
- const Function& function,
- const String& target_name,
- const Array& args,
- const Array& args_descriptor_array,
- bool respect_reflectable,
- const TypeArguments& instantiator_type_args) {
+static RawObject* InvokeInstanceFunction(const Instance& receiver,
+ const Function& function,
+ const String& target_name,
+ const Array& args,
+ const Array& args_descriptor_array,
+ bool respect_reflectable) {
// Note "args" is already the internal arguments with the receiver as the
// first element.
ArgumentsDescriptor args_descriptor(args_descriptor_array);
@@ -11177,11 +11055,6 @@
return DartEntry::InvokeNoSuchMethod(receiver, target_name, args,
args_descriptor_array);
}
- RawObject* type_error = function.DoArgumentTypesMatch(args, args_descriptor,
- instantiator_type_args);
- if (type_error != Error::null()) {
- return type_error;
- }
return DartEntry::InvokeFunction(function, args, args_descriptor_array);
}
@@ -11243,16 +11116,9 @@
Object& obj = Object::Handle(LookupLocalOrReExportObject(setter_name));
const String& internal_setter_name =
String::Handle(Field::SetterName(setter_name));
- AbstractType& setter_type = AbstractType::Handle();
- AbstractType& argument_type = AbstractType::Handle(value.GetType(Heap::kOld));
+
if (obj.IsField()) {
const Field& field = Field::Cast(obj);
- setter_type ^= field.type();
- if (!argument_type.IsNullType() && !setter_type.IsDynamicType() &&
- !value.IsInstanceOf(setter_type, Object::null_type_arguments(),
- Object::null_type_arguments(), NULL)) {
- return ThrowTypeError(field.token_pos(), value, setter_type, setter_name);
- }
if (field.is_final() || (respect_reflectable && !field.is_reflectable())) {
const int kNumArgs = 1;
const Array& args = Array::Handle(Array::New(kNumArgs));
@@ -11283,13 +11149,6 @@
InvocationMirror::kTopLevel, InvocationMirror::kSetter);
}
- setter_type ^= setter.ParameterTypeAt(0);
- if (!argument_type.IsNullType() && !setter_type.IsDynamicType() &&
- !value.IsInstanceOf(setter_type, Object::null_type_arguments(),
- Object::null_type_arguments(), NULL)) {
- return ThrowTypeError(setter.token_pos(), value, setter_type, setter_name);
- }
-
return DartEntry::InvokeFunction(setter, args);
}
@@ -11331,7 +11190,7 @@
const Array& args_descriptor_array = Array::Handle(
ArgumentsDescriptor::New(kTypeArgsLen, args.Length(), arg_names));
ArgumentsDescriptor args_descriptor(args_descriptor_array);
- const TypeArguments& type_args = Object::null_type_arguments();
+
if (function.IsNull() || !function.AreValidArguments(args_descriptor, NULL) ||
(respect_reflectable && !function.is_reflectable())) {
return ThrowNoSuchMethod(
@@ -11339,11 +11198,7 @@
function_name, args, arg_names, InvocationMirror::kTopLevel,
InvocationMirror::kMethod);
}
- RawObject* type_error =
- function.DoArgumentTypesMatch(args, args_descriptor, type_args);
- if (type_error != Error::null()) {
- return type_error;
- }
+
return DartEntry::InvokeFunction(function, args, args_descriptor_array);
}
@@ -15983,10 +15838,6 @@
Zone* zone = Thread::Current()->zone();
Class& klass = Class::Handle(zone, clazz());
- TypeArguments& type_args = TypeArguments::Handle(zone);
- if (klass.NumTypeArguments() > 0) {
- type_args ^= GetTypeArguments();
- }
const String& internal_getter_name =
String::Handle(zone, Field::GetterName(getter_name));
@@ -16011,8 +15862,7 @@
zone, ArgumentsDescriptor::New(kTypeArgsLen, args.Length()));
return InvokeInstanceFunction(*this, function, internal_getter_name, args,
- args_descriptor, respect_reflectable,
- type_args);
+ args_descriptor, respect_reflectable);
}
RawObject* Instance::InvokeSetter(const String& setter_name,
@@ -16021,11 +15871,6 @@
Zone* zone = Thread::Current()->zone();
const Class& klass = Class::Handle(zone, clazz());
- TypeArguments& type_args = TypeArguments::Handle(zone);
- if (klass.NumTypeArguments() > 0) {
- type_args ^= GetTypeArguments();
- }
-
const String& internal_setter_name =
String::Handle(zone, Field::SetterName(setter_name));
const Function& setter = Function::Handle(
@@ -16040,8 +15885,7 @@
zone, ArgumentsDescriptor::New(kTypeArgsLen, args.Length()));
return InvokeInstanceFunction(*this, setter, internal_setter_name, args,
- args_descriptor, respect_reflectable,
- type_args);
+ args_descriptor, respect_reflectable);
}
RawObject* Instance::Invoke(const String& function_name,
@@ -16058,11 +15902,6 @@
const Array& args_descriptor = Array::Handle(
zone, ArgumentsDescriptor::New(kTypeArgsLen, args.Length(), arg_names));
- TypeArguments& type_args = TypeArguments::Handle(zone);
- if (klass.NumTypeArguments() > 0) {
- type_args ^= GetTypeArguments();
- }
-
if (function.IsNull()) {
// Didn't find a method: try to find a getter and invoke call on its result.
const String& getter_name =
@@ -16077,9 +15916,9 @@
const Array& getter_args_descriptor = Array::Handle(
zone, ArgumentsDescriptor::New(kTypeArgsLen, getter_args.Length()));
const Object& getter_result = Object::Handle(
- zone, InvokeInstanceFunction(*this, function, getter_name,
- getter_args, getter_args_descriptor,
- respect_reflectable, type_args));
+ zone,
+ InvokeInstanceFunction(*this, function, getter_name, getter_args,
+ getter_args_descriptor, respect_reflectable));
if (getter_result.IsError()) {
return getter_result.raw();
}
@@ -16092,8 +15931,7 @@
// Found an ordinary method.
return InvokeInstanceFunction(*this, function, function_name, args,
- args_descriptor, respect_reflectable,
- type_args);
+ args_descriptor, respect_reflectable);
}
RawObject* Instance::EvaluateCompiledExpression(
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index b0c2f2d..796913f 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -2635,13 +2635,6 @@
intptr_t num_named_arguments,
String* error_message) const;
- // Returns a TypeError if the provided arguments don't match the function
- // parameter types, NULL otherwise. Assumes AreValidArguments is called first.
- RawObject* DoArgumentTypesMatch(
- const Array& args,
- const ArgumentsDescriptor& arg_names,
- const TypeArguments& instantiator_type_args) const;
-
// Returns true if the type argument count, total argument count and the names
// of optional arguments are valid for calling this function.
// Otherwise, it returns false and the reason (if error_message is not NULL).
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
index c534dea..d51dad6 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -2413,6 +2413,7 @@
// We don't use Instance::Cast here because it doesn't allow null.
Instance& instance = Instance::Handle(zone);
instance ^= receiver.raw();
+
const Object& result =
Object::Handle(zone, instance.Invoke(selector, args, arg_names));
result.PrintJSON(js, true);
diff --git a/tests/lib_2/mirrors/bad_argument_types_test.dart b/tests/lib_2/mirrors/bad_argument_types_test.dart
deleted file mode 100644
index 8063803..0000000
--- a/tests/lib_2/mirrors/bad_argument_types_test.dart
+++ /dev/null
@@ -1,157 +0,0 @@
-// Copyright (c) 2018, 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 'dart:io';
-import 'dart:mirrors';
-
-import 'package:expect/expect.dart';
-
-int foobar = 1;
-
-set foobaz(int x) {
- foobar = x;
-}
-
-void foo(Map<String, String> m) {
- print(m);
- print(m['bar']);
-}
-
-void bar<T extends num>(T a) {
- print(a);
-}
-
-class Foo {
- Map<String, String> bork;
- static Map<String, String> bark;
- static set woof(Map<String, String> x) {
- bark = x;
- }
-
- Foo(Map<String, String> m) {
- print(m);
- }
-
- Foo.a();
-
- static void baz(Map<String, String> m, {String bar}) {
- print('baz');
- print(m['bar']);
- print(bar);
- }
-
- void bar(Map<String, String> m) {
- print('bar');
- print(m.runtimeType);
- }
-}
-
-class FooBar<T extends num> {
- T bar;
- FooBar(this.bar) {
- print(bar);
- }
-
- set barz(T x) {
- bar = x;
- }
-
- factory FooBar.baz(T bar) {
- print(bar);
- return FooBar(bar);
- }
-
- void foobar<S>(T a, S b) {
- print(a);
- print(b);
- }
-}
-
-void badClassStaticInvoke() {
- Map<String, String> map = Map<String, String>();
- map['bar'] = 'Hello world!';
- final cm = reflectClass(Foo);
- Expect.throwsTypeError(() => cm.invoke(#baz, [
- map
- ], {
- #bar: {'boo': 'bah'}
- }));
-}
-
-void badStaticInvoke() {
- final ClosureMirror im = reflect(foo);
- Expect.throwsTypeError(() => im.apply(['Hello world!']));
-}
-
-void badInstanceInvoke() {
- final fooCls = Foo.a();
- final im = reflect(fooCls);
- Expect.throwsTypeError(() => im.invoke(#bar, ['Hello World!']));
-}
-
-void badConstructorInvoke() {
- final cm = reflectClass(Foo);
- Expect.throwsTypeError(() => cm.newInstance(Symbol(''), ['Hello World!']));
-}
-
-void badSetterInvoke() {
- final fooCls = Foo.a();
- final im = reflect(fooCls);
- Expect.throwsTypeError(() => im.setField(#bork, 'Hello World!'));
-}
-
-void badStaticSetterInvoke() {
- final cm = reflectClass(Foo);
- Expect.throwsTypeError(() => cm.setField(#bark, 'Hello World!'));
- Expect.throwsTypeError(() => cm.setField(#woof, 'Hello World!'));
-}
-
-void badGenericConstructorInvoke() {
- final cm = reflectType(FooBar, [int]) as ClassMirror;
- Expect.throwsTypeError(() => cm.newInstance(Symbol(''), ['Hello World!']));
-}
-
-void badGenericClassStaticInvoke() {
- final cm = reflectType(FooBar, [int]) as ClassMirror;
- final im = cm.newInstance(Symbol(''), [1]);
- Expect.throwsTypeError(() => im.invoke(#foobar, ['Hello', 'World']));
-}
-
-void badGenericFactoryInvoke() {
- final cm = reflectType(FooBar, [int]) as ClassMirror;
- Expect.throwsTypeError(() => cm.newInstance(Symbol('baz'), ['Hello World!']));
-}
-
-void badGenericStaticInvoke() {
- final ClosureMirror im = reflect(bar);
- Expect.throwsTypeError(() => im.apply(['Hello world!']));
-}
-
-void badGenericSetterInvoke() {
- final cm = reflectType(FooBar, [int]) as ClassMirror;
- final im = cm.newInstance(Symbol(''), [0]);
- Expect.throwsTypeError(() => im.setField(#bar, 'Hello world!'));
- Expect.throwsTypeError(() => im.setField(#barz, 'Hello world!'));
-}
-
-void badLibrarySetterInvoke() {
- final lm = currentMirrorSystem().findLibrary(Symbol(''));
- Expect.throwsTypeError(() => lm.setField(#foobar, 'Foobaz'));
- Expect.throwsTypeError(() => lm.setField(#foobaz, 'Foobaz'));
-}
-
-void main() {
- badClassStaticInvoke();
- badStaticInvoke();
- badInstanceInvoke();
- badConstructorInvoke();
- badSetterInvoke();
- badStaticSetterInvoke();
- badGenericConstructorInvoke();
- badGenericClassStaticInvoke();
- badGenericFactoryInvoke();
- badGenericStaticInvoke();
- badGenericSetterInvoke();
- badLibrarySetterInvoke();
-}
diff --git a/tools/VERSION b/tools/VERSION
index 3677e8b..3fe9a57 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -28,4 +28,4 @@
MINOR 1
PATCH 1
PRERELEASE 0
-PRERELEASE_PATCH 0
+PRERELEASE_PATCH 1