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

Issue 10162026: Report warnings and non-fatal errors for shadowing declaration and usage. (Closed)

Created:
8 years, 8 months ago by scheglov
Modified:
8 years, 8 months ago
Reviewers:
messick
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Report warnings and non-fatal errors for shadowing declaration and usage. Fix for Type references in declaration. Make Back a default button if there is Error in refactoring status. R=messick@google.com BUG= TEST= Committed: https://code.google.com/p/dart/source/detail?r=6859

Patch Set 1 #

Total comments: 7

Patch Set 2 : Tweaks for review comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+2013 lines, -1118 lines) Patch
M compiler/java/com/google/dart/compiler/ast/DartParameterizedTypeNode.java View 1 chunk +1 line, -1 line 0 comments Download
M editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/internal/corext/refactoring/Checks.java View 3 chunks +9 lines, -1 line 0 comments Download
M editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/internal/corext/refactoring/RefactoringCoreMessages.java View 2 chunks +11 lines, -6 lines 0 comments Download
M editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/internal/corext/refactoring/RefactoringCoreMessages.properties View 2 chunks +14 lines, -5 lines 0 comments Download
M editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/internal/corext/refactoring/base/DartStatusContext.java View 4 chunks +36 lines, -3 lines 0 comments Download
M editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/internal/corext/refactoring/rename/RenameAnalyzeUtil.java View 1 4 chunks +39 lines, -126 lines 0 comments Download
M editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/internal/corext/refactoring/rename/RenameFieldProcessor.java View 2 chunks +5 lines, -226 lines 0 comments Download
M editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/internal/corext/refactoring/rename/RenameLocalVariableProcessor.java View 7 chunks +74 lines, -23 lines 0 comments Download
M editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/internal/corext/refactoring/rename/RenameMethodProcessor.java View 2 chunks +5 lines, -224 lines 0 comments Download
M editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/internal/corext/refactoring/rename/RenameTopLevelProcessor.java View 1 7 chunks +108 lines, -32 lines 0 comments Download
A editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/internal/corext/refactoring/rename/RenameTypeMemberProcessor.java View 1 1 chunk +412 lines, -0 lines 0 comments Download
M editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/refactoring/RefactoringTest.java View 3 chunks +8 lines, -2 lines 0 comments Download
M editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/refactoring/RenameAnalyzeUtilTest.java View 3 chunks +145 lines, -0 lines 0 comments Download
M editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/refactoring/RenameFieldProcessorTest.java View 12 chunks +111 lines, -101 lines 0 comments Download
M editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/refactoring/RenameFunctionProcessorTest.java View 1 12 chunks +197 lines, -49 lines 0 comments Download
M editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/refactoring/RenameFunctionTypeAliasProcessorTest.java View 1 10 chunks +201 lines, -53 lines 0 comments Download
M editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/refactoring/RenameGlobalVariableProcessorTest.java View 1 12 chunks +197 lines, -49 lines 0 comments Download
M editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/refactoring/RenameLocalVariableProcessorTest.java View 11 chunks +74 lines, -8 lines 0 comments Download
M editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/refactoring/RenameMethodProcessorTest.java View 28 chunks +170 lines, -159 lines 0 comments Download
M editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/refactoring/RenameTypeProcessorTest.java View 1 12 chunks +197 lines, -51 lines 0 comments Download
M third_party/eclipse/3.7.0/plugins/org.eclipse.ltk.ui.refactoring_3.6.0.v20110928-1453.jar View 0 chunks +-1 lines, --1 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
scheglov
8 years, 8 months ago (2012-04-22 18:12:13 UTC) #1
messick
LGTM with one caveat: I'm not sure one error message is correct. https://chromiumcodereview.appspot.com/10162026/diff/1/compiler/java/com/google/dart/compiler/ast/DartParameterizedTypeNode.java File compiler/java/com/google/dart/compiler/ast/DartParameterizedTypeNode.java ...
8 years, 8 months ago (2012-04-23 15:30:53 UTC) #2
scheglov
https://chromiumcodereview.appspot.com/10162026/diff/1/compiler/java/com/google/dart/compiler/ast/DartParameterizedTypeNode.java File compiler/java/com/google/dart/compiler/ast/DartParameterizedTypeNode.java (right): https://chromiumcodereview.appspot.com/10162026/diff/1/compiler/java/com/google/dart/compiler/ast/DartParameterizedTypeNode.java#newcode40 compiler/java/com/google/dart/compiler/ast/DartParameterizedTypeNode.java:40: this.expression = expression; On 2012/04/23 15:30:53, messick wrote: > ...
8 years, 8 months ago (2012-04-23 17:53:01 UTC) #3
messick
8 years, 8 months ago (2012-04-23 18:30:44 UTC) #4
On 2012/04/23 17:53:01, scheglov wrote:
>
https://chromiumcodereview.appspot.com/10162026/diff/1/compiler/java/com/goog...
> File compiler/java/com/google/dart/compiler/ast/DartParameterizedTypeNode.java
> (right):
> 
>
https://chromiumcodereview.appspot.com/10162026/diff/1/compiler/java/com/goog...
> compiler/java/com/google/dart/compiler/ast/DartParameterizedTypeNode.java:40:
> this.expression = expression;
> On 2012/04/23 15:30:53, messick wrote:
> > Please explain why this is needed.
> 
> DartParameterizedTypeNode is hack.
> It is used to wrap type name and type parameters, and created in
> ClassElementImplementation.
> It should not take ownership of Name, because DartClass returns name as child,
> and at same time parent of Name is not DartClass, but
DartParameterizedTypeNode,
> which itself has no parent...
> 
> We need to have this structure sane to check in
>
com.google.dart.tools.core.internal.index.contributor.IndexContributor.isNameInDeclaration(DartIdentifier)
> that Name is part of declaration, or is reference on Type.
> 
>
https://chromiumcodereview.appspot.com/10162026/diff/1/editor/tools/plugins/c...
> File
>
editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/internal/corext/refactoring/rename/RenameAnalyzeUtil.java
> (right):
> 
>
https://chromiumcodereview.appspot.com/10162026/diff/1/editor/tools/plugins/c...
>
editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/internal/corext/refactoring/rename/RenameAnalyzeUtil.java:197:
> * @return the references on the given {@link DartElement}, may be empty {@link
> List}, but not
> On 2012/04/23 15:30:53, messick wrote:
> > on => to
> 
> Done.
> 
>
https://chromiumcodereview.appspot.com/10162026/diff/1/editor/tools/plugins/c...
> File
>
editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/refactoring/RenameFieldProcessorTest.java
> (right):
> 
>
https://chromiumcodereview.appspot.com/10162026/diff/1/editor/tools/plugins/c...
>
editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/refactoring/RenameFieldProcessorTest.java:498:
> "Usage of field 'A.test' will be shadowed by top-level type 'newName' from
> 'Test/Test.dart' in library 'Test'",
> On 2012/04/23 15:30:53, messick wrote:
> > I mentioned this error message in the file that defines it. I think this is
> > backward; inner scope names shadow outer scope names. If this is defined
> > differently in the spec please point me to it.
> 
> Short answer: it depends.
> In the class which defines field, this field will shadow top-level.
> In the class which inherits from class which defines field, top-level will
> shadow field.
> 
> http://code.google.com/p/dart/issues/detail?id=1598
> http://code.google.com/p/dart/issues/detail?id=1180

I think it is worth adding a comment with a link to
http://code.google.com/p/dart/issues/detail?id=1180
somewhere in the code, as this situation is confusing.
Thanks for the follow-up!

LGTM-er

Powered by Google App Engine
This is Rietveld 408576698