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

Issue 1070443002: Rework type assignability, subtype, and "more specific than" checking. (Closed)

Created:
5 years, 8 months ago by Paul Berry
Modified:
5 years, 8 months ago
Reviewers:
Brian Wilkerson
CC:
reviews_dartlang.org
Target Ref:
refs/remotes/git-svn
Visibility:
Public.

Description

Rework type assignability, subtype, and "more specific than" checking. The key change in this CL is to change the technique for avoiding infinite recursion in the presence of illegal code. Rather than track type pairs, we track (a) the function typedef elements that have been expanded while examining the LHS and RHS, and (b) the class and type parameter elements that have been visited while exploring the class hierarchy. If a function typedef is encountered while expanding itself, or a class or type parameter element is encountered while searching its own class hierarchy, then it is skipped. Since both class hierarchy loops and self-referential function typedefs are prohibited by the spec, this ensures that the checks to avoid recursion will only trigger in the presence of compile errors, so analyzer will produce correct warnings in the absence of compile errors. As a consequence of the new technique, bugs 21912 and 22976 are fixed. In addition, there are a few other improvements: - Optional arguments are used to keep track of elements already visited, so it's not necessary to have separate functions isAssignableTo2, isSubtypeOf2, and isMoreSpecificThan2, nor do we need "internal" versions of those functions. - InterfaceTypeImpl no longer needs a special implementation of isSubtypeOf. It's now implemented in the same way it's defined (in terms of isMoreSpecificThan). - Some flaws were discovered in the co19 tests. I've filed a co19 bug for these, and updated the co19-analyzer2 status file. R=brianwilkerson@google.com Committed: https://code.google.com/p/dart/source/detail?r=44965

Patch Set 1 #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+467 lines, -596 lines) Patch
M pkg/analyzer/lib/src/generated/element.dart View 17 chunks +430 lines, -588 lines 2 comments Download
M pkg/analyzer/test/generated/compile_time_error_code_test.dart View 1 chunk +1 line, -2 lines 0 comments Download
M pkg/analyzer/test/generated/element_test.dart View 1 chunk +2 lines, -1 line 0 comments Download
M tests/co19/co19-analyzer2.status View 1 chunk +3 lines, -0 lines 0 comments Download
M tests/language/language_analyzer.status View 1 chunk +3 lines, -0 lines 0 comments Download
A tests/language/regress_21912_test.dart View 1 chunk +22 lines, -0 lines 0 comments Download
A + tests/language/regress_22976_test.dart View 1 chunk +6 lines, -5 lines 0 comments Download

Messages

Total messages: 5 (1 generated)
Paul Berry
5 years, 8 months ago (2015-04-07 21:57:19 UTC) #2
Brian Wilkerson
LGTM https://codereview.chromium.org/1070443002/diff/1/pkg/analyzer/lib/src/generated/element.dart File pkg/analyzer/lib/src/generated/element.dart (right): https://codereview.chromium.org/1070443002/diff/1/pkg/analyzer/lib/src/generated/element.dart#newcode9406 pkg/analyzer/lib/src/generated/element.dart:9406: * subtype of any type (as though "dynamic" ...
5 years, 8 months ago (2015-04-08 02:58:08 UTC) #3
Paul Berry
https://codereview.chromium.org/1070443002/diff/1/pkg/analyzer/lib/src/generated/element.dart File pkg/analyzer/lib/src/generated/element.dart (right): https://codereview.chromium.org/1070443002/diff/1/pkg/analyzer/lib/src/generated/element.dart#newcode9406 pkg/analyzer/lib/src/generated/element.dart:9406: * subtype of any type (as though "dynamic" had ...
5 years, 8 months ago (2015-04-08 13:00:31 UTC) #4
Paul Berry
5 years, 8 months ago (2015-04-08 13:01:36 UTC) #5
Message was sent while issue was closed.
Committed patchset #1 (id:1) manually as 44965 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698