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

Issue 8632020: Make method overrides with differing parameters a compile-time error (Closed)

Created:
9 years, 1 month ago by zundel
Modified:
9 years ago
Reviewers:
mmendez, scheglov, ahe
CC:
reviews_dartlang.org, ahe
Visibility:
Public.

Description

This adds a check to the resolver to detect when an override has different number of parameters than in its superinterface. Committed: https://code.google.com/p/dart/source/detail?r=2354

Patch Set 1 #

Patch Set 2 : Fixes ClassOverrideNegativeTest #

Total comments: 9

Patch Set 3 : Report on function name, not entire function! #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+164 lines, -27 lines) Patch
M compiler/java/com/google/dart/compiler/resolver/Elements.java View 1 1 chunk +10 lines, -0 lines 0 comments Download
M compiler/java/com/google/dart/compiler/resolver/Resolver.java View 1 2 2 chunks +65 lines, -0 lines 1 comment Download
M compiler/java/com/google/dart/compiler/resolver/ResolverErrorCode.java View 1 2 1 chunk +6 lines, -0 lines 0 comments Download
M compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java View 1 2 chunks +14 lines, -11 lines 0 comments Download
M compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java View 1 1 chunk +60 lines, -0 lines 0 comments Download
M compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerTest.java View 1 3 chunks +4 lines, -4 lines 0 comments Download
M tests/co19/co19-compiler.status View 1 2 1 chunk +0 lines, -3 lines 0 comments Download
M tests/language/language.status View 1 2 1 chunk +0 lines, -1 line 0 comments Download
M tests/language/src/ClassOverrideNegativeTest.dart View 1 2 chunks +5 lines, -8 lines 0 comments Download

Messages

Total messages: 8 (0 generated)
zundel
9 years, 1 month ago (2011-11-22 18:42:52 UTC) #1
zundel
@Peter, would you mind taking look at the updated test? I removed the VMOptions setting ...
9 years ago (2011-12-08 23:29:30 UTC) #2
ahe
http://codereview.chromium.org/8632020/diff/3001/tests/language/src/ClassOverrideNegativeTest.dart File tests/language/src/ClassOverrideNegativeTest.dart (right): http://codereview.chromium.org/8632020/diff/3001/tests/language/src/ClassOverrideNegativeTest.dart#newcode6 tests/language/src/ClassOverrideNegativeTest.dart:6: // an interface method m2 and has a different ...
9 years ago (2011-12-09 09:00:44 UTC) #3
scheglov
LGTM http://codereview.chromium.org/8632020/diff/3001/compiler/java/com/google/dart/compiler/resolver/Resolver.java File compiler/java/com/google/dart/compiler/resolver/Resolver.java (right): http://codereview.chromium.org/8632020/diff/3001/compiler/java/com/google/dart/compiler/resolver/Resolver.java#newcode415 compiler/java/com/google/dart/compiler/resolver/Resolver.java:415: onError(functionNode, May be highlight only name of method. ...
9 years ago (2011-12-09 16:49:51 UTC) #4
mmendez
http://codereview.chromium.org/8632020/diff/3001/compiler/java/com/google/dart/compiler/resolver/Resolver.java File compiler/java/com/google/dart/compiler/resolver/Resolver.java (right): http://codereview.chromium.org/8632020/diff/3001/compiler/java/com/google/dart/compiler/resolver/Resolver.java#newcode393 compiler/java/com/google/dart/compiler/resolver/Resolver.java:393: if (ElementKind.of(currentHolder).equals(ElementKind.CLASS)) { We should discuss offline, but I ...
9 years ago (2011-12-09 18:38:10 UTC) #5
mmendez
LGTM with one nit about where the check should occur. On 2011/12/09 18:38:10, mmendez wrote: ...
9 years ago (2011-12-09 21:09:38 UTC) #6
mmendez
Still LGTM, but I'm not sure why this comment was not included with the previous ...
9 years ago (2011-12-09 21:10:32 UTC) #7
zundel
9 years ago (2011-12-12 22:42:29 UTC) #8
I committed this with the check still in the resolver.

Trying to move the checks into the TypeAnalyzerTest reveals a weakness in our
test infrastructure - there is currently no way to test for resovler errors in
the TypeAnalyzer test. When I tried to turn them on I got lots of errors
reported for the existing tests, so its going to require some rework.

http://codereview.chromium.org/8632020/diff/3001/compiler/java/com/google/dar...
File compiler/java/com/google/dart/compiler/resolver/Resolver.java (right):

http://codereview.chromium.org/8632020/diff/3001/compiler/java/com/google/dar...
compiler/java/com/google/dart/compiler/resolver/Resolver.java:393: if
(ElementKind.of(currentHolder).equals(ElementKind.CLASS)) {
On 2011/12/09 18:38:10, mmendez wrote:
> We should discuss offline, but I was wondering why this check did not happen
as
> part of the checks that the TypeAnalyzer performs?  I thought that it has some
> override checking already.

It does, but those are type errors, these are compile time errors, so I thought
it best to add them here.  These checks have nothing to do with the types of the
methods.

http://codereview.chromium.org/8632020/diff/3001/compiler/java/com/google/dar...
compiler/java/com/google/dart/compiler/resolver/Resolver.java:415:
onError(functionNode,
On 2011/12/09 16:49:52, scheglov wrote:
> May be highlight only name of method.

Done.

http://codereview.chromium.org/8632020/diff/3001/compiler/java/com/google/dar...
compiler/java/com/google/dart/compiler/resolver/Resolver.java:433:
onError(functionNode,
On 2011/12/09 16:49:52, scheglov wrote:
> May be highlight only name of method.

Done.

Powered by Google App Engine
This is Rietveld 408576698