[tests] Fix CompileTime error in implement_rectangle test.

Fixes: https://github.com/dart-lang/sdk/issues/41541
Change-Id: I46f069145990f548848e6efef9e8d4c9c939adf2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144942
Reviewed-by: Liam Appelbe <liama@google.com>
Reviewed-by: Riley Porter <rileyporter@google.com>
This commit is contained in:
William Hesse 2020-04-27 17:21:26 +00:00
parent c80ff5f5f7
commit 811cb746d3

View file

@ -25,9 +25,9 @@ class Rectangle<T extends num> implements math.MutableRectangle<T> {
Rectangle(this.left, this.top, this.width, this.height);
T get right => left + width;
T get right => (left + width) as T;
T get bottom => top + height;
T get bottom => (top + height) as T;
Point<T> get topLeft => new Point<T>(left, top);
@ -58,7 +58,8 @@ class Rectangle<T extends num> implements math.MutableRectangle<T> {
T rTop = min(top, other.top);
T rRight = max(right, other.right);
T rBottom = max(bottom, other.bottom);
return new Rectangle<T>(rLeft, rTop, rRight - rLeft, rBottom - rTop);
return new Rectangle<T>(
rLeft, rTop, (rRight - rLeft) as T, (rBottom - rTop) as T);
}
/// Tests whether `this` entirely contains [another].
@ -75,6 +76,7 @@ class Rectangle<T extends num> implements math.MutableRectangle<T> {
T rTop = max(top, rect.top);
T rRight = min(right, rect.right);
T rBottom = min(bottom, rect.bottom);
return new Rectangle<T>(rLeft, rTop, rRight - rLeft, rBottom - rTop);
return new Rectangle<T>(
rLeft, rTop, (rRight - rLeft) as T, (rBottom - rTop) as T);
}
}