Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Issue 26772002: Mirror tests for type bounds. (Closed)

Created:
7 years, 2 months ago by rmacnak
Modified:
7 years, 2 months ago
Reviewers:
regis, gbracha, ahe
CC:
reviews_dartlang.org, zarah
Visibility:
Public.

Description

Patch Set 1 #

Total comments: 1

Patch Set 2 : #

Total comments: 12
Unified diffs Side-by-side diffs Delta from patch set Stats (+221 lines, -0 lines) Patch
M tests/lib/lib.status View 1 4 chunks +29 lines, -0 lines 0 comments Download
A tests/lib/mirrors/generic_bounded_by_type_parameter_test.dart View 1 1 chunk +69 lines, -0 lines 10 comments Download
A tests/lib/mirrors/generic_bounded_test.dart View 1 1 chunk +65 lines, -0 lines 2 comments Download
A tests/lib/mirrors/generic_f_bounded_test.dart View 1 chunk +58 lines, -0 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
rmacnak
7 years, 2 months ago (2013-10-09 23:06:19 UTC) #1
regis
LGTM
7 years, 2 months ago (2013-10-09 23:21:11 UTC) #2
gbracha
https://codereview.chromium.org/26772002/diff/1/tests/lib/mirrors/generic_bounded_by_type_parameter_test.dart File tests/lib/mirrors/generic_bounded_by_type_parameter_test.dart (right): https://codereview.chromium.org/26772002/diff/1/tests/lib/mirrors/generic_bounded_by_type_parameter_test.dart#newcode26 tests/lib/mirrors/generic_bounded_by_type_parameter_test.dart:26: ClassMirror genericOfNumAndBool = reflect(new Generic<num, bool>()).type; /// 01: continued ...
7 years, 2 months ago (2013-10-09 23:28:30 UTC) #3
rmacnak
Marked instantiation of malbounded type as error in checked mode.
7 years, 2 months ago (2013-10-10 00:01:35 UTC) #4
gbracha
lgtm
7 years, 2 months ago (2013-10-10 00:18:34 UTC) #5
rmacnak
Committed patchset #2 manually as r28435 (presubmit successful).
7 years, 2 months ago (2013-10-10 00:34:23 UTC) #6
ahe
7 years, 2 months ago (2013-10-10 15:22:51 UTC) #7
Message was sent while issue was closed.
LGTM! I like the semantics: we preserve the type arguments that the user has
written.

Mostly nits below.

https://codereview.chromium.org/26772002/diff/7001/tests/lib/mirrors/generic_...
File tests/lib/mirrors/generic_bounded_by_type_parameter_test.dart (right):

https://codereview.chromium.org/26772002/diff/7001/tests/lib/mirrors/generic_...
tests/lib/mirrors/generic_bounded_by_type_parameter_test.dart:17: class
Malbounded extends Super<num, String> {} /// 01: static type warning
The problem here is <num, String>, so I think this would be clearer:

class Malbounded extends Super
<num, String> /// 01: static type warning
{}

https://codereview.chromium.org/26772002/diff/7001/tests/lib/mirrors/generic_...
tests/lib/mirrors/generic_bounded_by_type_parameter_test.dart:26: ClassMirror
genericOfNumAndBool = reflect(new Generic<num, bool>()).type;  /// 02: static
type warning, dynamic type error
This is a long line, and it is hard to see what the problem is. I suggest you
re-format it to:

ClassMirror genericOfNumAndBool = reflect(new Generic
    <num, bool> /// 02: static type warning, dynamic type error
    ()).type;

https://codereview.chromium.org/26772002/diff/7001/tests/lib/mirrors/generic_...
tests/lib/mirrors/generic_bounded_by_type_parameter_test.dart:27: ClassMirror
superOfNumAndBool = genericOfNumAndBool.superclass;  /// 02: continued
Then you don't need continued here.

https://codereview.chromium.org/26772002/diff/7001/tests/lib/mirrors/generic_...
tests/lib/mirrors/generic_bounded_by_type_parameter_test.dart:28: ClassMirror
superOfNumAndString = reflectClass(Malbounded).superclass;  /// 01: continued
Ditto.

https://codereview.chromium.org/26772002/diff/7001/tests/lib/mirrors/generic_...
tests/lib/mirrors/generic_bounded_by_type_parameter_test.dart:38:
Expect.isFalse(superOfNumAndString.isOriginalDeclaration);  /// 01: continued
The three "continued" comments above are not needed.

https://codereview.chromium.org/26772002/diff/7001/tests/lib/mirrors/generic_...
tests/lib/mirrors/generic_bounded_by_type_parameter_test.dart:58:
typeParameters(superOfNumAndString, [#T, #R]);  /// 01: continued
Ditto.

https://codereview.chromium.org/26772002/diff/7001/tests/lib/mirrors/generic_...
tests/lib/mirrors/generic_bounded_by_type_parameter_test.dart:64:
typeArguments(genericOfNumAndDouble, [reflectClass(num), reflectClass(double)]);
Long line.

https://codereview.chromium.org/26772002/diff/7001/tests/lib/mirrors/generic_...
tests/lib/mirrors/generic_bounded_by_type_parameter_test.dart:66:
typeArguments(genericOfNumAndBool, [reflectClass(num), reflectClass(bool)]); 
/// 02: continued
Long line. Also, I feel this would give better test coverage:

var arg1 = reflectClass(dynamic);
arg1 = reflectClass(num); /// 02: continued
var arg2 = reflectClass(dynamic);
arg2 = reflectClass(bool); /// 02: continued
typeArguments(genericOfNumAndBool, [arg1, arg2]);

https://codereview.chromium.org/26772002/diff/7001/tests/lib/mirrors/generic_...
tests/lib/mirrors/generic_bounded_by_type_parameter_test.dart:67:
typeArguments(superOfNumAndBool, [reflectClass(num), reflectClass(bool)]);  ///
02: continued
Ditto.

https://codereview.chromium.org/26772002/diff/7001/tests/lib/mirrors/generic_...
tests/lib/mirrors/generic_bounded_by_type_parameter_test.dart:68:
typeArguments(superOfNumAndString, [reflectClass(num), reflectClass(String)]); 
/// 01: continued
Ditto.

https://codereview.chromium.org/26772002/diff/7001/tests/lib/mirrors/generic_...
File tests/lib/mirrors/generic_bounded_test.dart (right):

https://codereview.chromium.org/26772002/diff/7001/tests/lib/mirrors/generic_...
tests/lib/mirrors/generic_bounded_test.dart:17: class Malbounded extends
Super<String> {} /// 01: static type warning
See my comments in the previous file. Most of them apply here as well.

https://codereview.chromium.org/26772002/diff/7001/tests/lib/mirrors/generic_...
tests/lib/mirrors/generic_bounded_test.dart:21: ClassMirror superOfInt =
reflectClass(Fixed).superclass;
I'd call this superOfFixed.

Powered by Google App Engine
This is Rietveld 408576698