Fixes #1106. Use runtime check 'is int' VS 'is String' to check that runtime type is 'int', not 'dynamic'
diff --git a/LanguageFeatures/Constructor-tear-offs/function_tearoffs_A02_t01.dart b/LanguageFeatures/Constructor-tear-offs/function_tearoffs_A02_t01.dart
index ba4ce31..ffcf0ba 100644
--- a/LanguageFeatures/Constructor-tear-offs/function_tearoffs_A02_t01.dart
+++ b/LanguageFeatures/Constructor-tear-offs/function_tearoffs_A02_t01.dart
@@ -24,17 +24,17 @@
class C {
var x;
C() {
- x = instanceMethod<int>;
+ var x = instanceMethod<int>;
+ Expect.equals(42, x(42));
+ dynamic d1 = -42;
+ Expect.isTrue(x(d1) is int);
+ Expect.isFalse(x(d1) is String); // to check that returned type is not dynamic
+ dynamic d2 = 3.14;
+ Expect.throws(() {x(d2);});
}
T instanceMethod<T>(T t) => t;
}
main() {
- C c = new C();
- Expect.equals(42, c.x(42));
- dynamic d1 = -42;
- Expect.isTrue(c.x(d1) is int);
- Expect.isFalse(c.x(d1) is double); // to check that returned type is not dynamic
- dynamic d2 = 3.14;
- Expect.throws(() {c.x(d2);});
+ new C();
}
diff --git a/LanguageFeatures/Constructor-tear-offs/function_tearoffs_A02_t03.dart b/LanguageFeatures/Constructor-tear-offs/function_tearoffs_A02_t03.dart
index 65dd46f..d9c085e 100644
--- a/LanguageFeatures/Constructor-tear-offs/function_tearoffs_A02_t03.dart
+++ b/LanguageFeatures/Constructor-tear-offs/function_tearoffs_A02_t03.dart
@@ -22,19 +22,18 @@
import "../../Utils/expect.dart";
class C {
- var x;
C() {
- x = this.instanceMethod<int>;
+ var x = this.instanceMethod<int>;
+ Expect.equals(42, x(42));
+ dynamic d1 = -42;
+ Expect.isTrue(x(d1) is int);
+ Expect.isFalse(x(d1) is String); // to check that returned type is not dynamic
+ dynamic d2 = 3.14;
+ Expect.throws(() {x(d2);});
}
T instanceMethod<T>(T t) => t;
}
main() {
- C c = new C();
- Expect.equals(42, c.x(42));
- dynamic d1 = -42;
- Expect.isTrue(c.x(d1) is int);
- Expect.isFalse(c.x(d1) is double); // to check that returned type is not dynamic
- dynamic d2 = 3.14;
- Expect.throws(() {c.x(d2);});
+ new C();
}
diff --git a/LanguageFeatures/Constructor-tear-offs/function_tearoffs_A02_t05.dart b/LanguageFeatures/Constructor-tear-offs/function_tearoffs_A02_t05.dart
index e6cdbdd..1aeb96f 100644
--- a/LanguageFeatures/Constructor-tear-offs/function_tearoffs_A02_t05.dart
+++ b/LanguageFeatures/Constructor-tear-offs/function_tearoffs_A02_t05.dart
@@ -26,18 +26,17 @@
}
class C extends A {
- var x;
C() {
- x = instanceMethod<int>;
+ var x = instanceMethod<int>;
+ Expect.equals(42, x(42));
+ dynamic d1 = -42;
+ Expect.isTrue(x(d1) is int);
+ Expect.isFalse(x(d1) is String); // to check that returned type is not dynamic
+ dynamic d2 = 3.14;
+ Expect.throws(() {x(d2);});
}
}
main() {
- C c = new C();
- Expect.equals(42, c.x(42));
- dynamic d1 = -42;
- Expect.isTrue(c.x(d1) is int);
- Expect.isFalse(c.x(d1) is double); // to check that returned type is not dynamic
- dynamic d2 = 3.14;
- Expect.throws(() {c.x(d2);});
+ new C();
}
diff --git a/LanguageFeatures/Constructor-tear-offs/function_tearoffs_A02_t07.dart b/LanguageFeatures/Constructor-tear-offs/function_tearoffs_A02_t07.dart
index eb3fec6..d902408 100644
--- a/LanguageFeatures/Constructor-tear-offs/function_tearoffs_A02_t07.dart
+++ b/LanguageFeatures/Constructor-tear-offs/function_tearoffs_A02_t07.dart
@@ -27,18 +27,17 @@
}
class C extends A {
- var x;
C() {
- x = this.instanceMethod<int>;
+ var x = this.instanceMethod<int>;
+ Expect.equals(42, x(42));
+ dynamic d1 = -42;
+ Expect.isTrue(x(d1) is int);
+ Expect.isFalse(x(d1) is String); // to check that returned type is not dynamic
+ dynamic d2 = 3.14;
+ Expect.throws(() {x(d2);});
}
}
main() {
- C c = new C();
- Expect.equals(42, c.x(42));
- dynamic d1 = -42;
- Expect.isTrue(c.x(d1) is int);
- Expect.isFalse(c.x(d1) is double); // to check that returned type is not dynamic
- dynamic d2 = 3.14;
- Expect.throws(() {c.x(d2);});
+ new C();
}
diff --git a/LanguageFeatures/Constructor-tear-offs/function_tearoffs_A02_t09.dart b/LanguageFeatures/Constructor-tear-offs/function_tearoffs_A02_t09.dart
index 1bb3a1c..e929b4e 100644
--- a/LanguageFeatures/Constructor-tear-offs/function_tearoffs_A02_t09.dart
+++ b/LanguageFeatures/Constructor-tear-offs/function_tearoffs_A02_t09.dart
@@ -27,18 +27,17 @@
}
class C extends A {
- var x;
C() {
- x = super.instanceMethod<int>;
+ var x = super.instanceMethod<int>;
+ Expect.equals(42, x(42));
+ dynamic d1 = -42;
+ Expect.isTrue(x(d1) is int);
+ Expect.isFalse(x(d1) is String); // to check that returned type is not dynamic
+ dynamic d2 = 3.14;
+ Expect.throws(() {x(d2);});
}
}
main() {
- C c = new C();
- Expect.equals(42, c.x(42));
- dynamic d1 = -42;
- Expect.isTrue(c.x(d1) is int);
- Expect.isFalse(c.x(d1) is double); // to check that returned type is not dynamic
- dynamic d2 = 3.14;
- Expect.throws(() {c.x(d2);});
+ new C();
}
diff --git a/LanguageFeatures/Constructor-tear-offs/function_tearoffs_A02_t12.dart b/LanguageFeatures/Constructor-tear-offs/function_tearoffs_A02_t12.dart
index 7d4f6dc..53dbc6aa 100644
--- a/LanguageFeatures/Constructor-tear-offs/function_tearoffs_A02_t12.dart
+++ b/LanguageFeatures/Constructor-tear-offs/function_tearoffs_A02_t12.dart
@@ -30,7 +30,7 @@
Expect.equals(42, x(42));
dynamic d1 = -42;
Expect.isTrue(x(d1) is int);
- Expect.isFalse(x(d1) is double); // to check that returned type is not dynamic
+ Expect.isFalse(x(d1) is String); // to check that returned type is not dynamic
dynamic d2 = 3.14;
Expect.throws(() {x(d2);});
}