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

Issue 8948001: Updates dartc to recognize 'default' keyword on interface and updated factory method syntax (Closed)

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

Description

Updates dartc to recognize 'default' keyword on interface and updated factory method syntax. Note: this does not have backwards compatibility for the old factory syntax and updates the tests. http://code.google.com/p/dart/issues/detail?id=417 Committed: https://code.google.com/p/dart/source/detail?r=2597

Patch Set 1 : Got rid of some problems. #

Total comments: 38

Patch Set 2 : revamp type parameter checking #

Patch Set 3 : Revise checking of interface type params vs. default class #

Total comments: 20

Patch Set 4 : Feedback from mmendez #

Unified diffs Side-by-side diffs Delta from patch set Stats (+920 lines, -587 lines) Patch
M compiler/java/com/google/dart/compiler/LibraryDepsVisitor.java View 1 2 3 3 chunks +12 lines, -1 line 0 comments Download
M compiler/java/com/google/dart/compiler/ast/DartClass.java View 1 5 chunks +7 lines, -5 lines 0 comments Download
M compiler/java/com/google/dart/compiler/ast/DartMethodDefinition.java View 4 chunks +6 lines, -16 lines 0 comments Download
M compiler/java/com/google/dart/compiler/ast/DartNodeTraverser.java View 1 1 chunk +1 line, -1 line 0 comments Download
D compiler/java/com/google/dart/compiler/ast/DartParameterizedNode.java View 1 1 chunk +0 lines, -53 lines 0 comments Download
A + compiler/java/com/google/dart/compiler/ast/DartParameterizedTypeNode.java View 1 2 3 2 chunks +28 lines, -11 lines 0 comments Download
M compiler/java/com/google/dart/compiler/ast/DartPlainVisitor.java View 1 1 chunk +1 line, -1 line 0 comments Download
M compiler/java/com/google/dart/compiler/ast/DartToSourceVisitor.java View 1 4 chunks +10 lines, -8 lines 0 comments Download
M compiler/java/com/google/dart/compiler/ast/DartTypeParameter.java View 1 2 3 3 chunks +20 lines, -1 line 0 comments Download
M compiler/java/com/google/dart/compiler/ast/DartVisitor.java View 1 2 chunks +2 lines, -2 lines 0 comments Download
M compiler/java/com/google/dart/compiler/ast/viz/BaseASTWriter.java View 1 2 chunks +2 lines, -2 lines 0 comments Download
M compiler/java/com/google/dart/compiler/backend/common/TypeHeuristicImplementation.java View 1 2 chunks +2 lines, -2 lines 0 comments Download
M compiler/java/com/google/dart/compiler/backend/js/GenerateJavascriptAST.java View 1 2 chunks +2 lines, -2 lines 0 comments Download
M compiler/java/com/google/dart/compiler/backend/js/Normalizer.java View 7 chunks +20 lines, -20 lines 0 comments Download
M compiler/java/com/google/dart/compiler/backend/js/RuntimeTypeInjector.java View 1 2 3 9 chunks +39 lines, -50 lines 0 comments Download
M compiler/java/com/google/dart/compiler/parser/DartParser.java View 1 11 chunks +29 lines, -35 lines 0 comments Download
M compiler/java/com/google/dart/compiler/parser/ParserErrorCode.java View 1 chunk +2 lines, -0 lines 0 comments Download
M compiler/java/com/google/dart/compiler/resolver/ClassElementImplementation.java View 1 chunk +1 line, -1 line 0 comments Download
M compiler/java/com/google/dart/compiler/resolver/CompileTimeConstantResolver.java View 1 chunk +4 lines, -0 lines 0 comments Download
M compiler/java/com/google/dart/compiler/resolver/Elements.java View 1 3 chunks +4 lines, -5 lines 0 comments Download
M compiler/java/com/google/dart/compiler/resolver/MemberBuilder.java View 1 2 3 13 chunks +32 lines, -14 lines 0 comments Download
M compiler/java/com/google/dart/compiler/resolver/ResolutionContext.java View 1 9 chunks +20 lines, -11 lines 0 comments Download
M compiler/java/com/google/dart/compiler/resolver/ResolveVisitor.java View 1 6 chunks +12 lines, -15 lines 0 comments Download
M compiler/java/com/google/dart/compiler/resolver/Resolver.java View 1 2 3 16 chunks +156 lines, -20 lines 0 comments Download
M compiler/java/com/google/dart/compiler/resolver/ResolverErrorCode.java View 1 4 chunks +13 lines, -6 lines 0 comments Download
M compiler/java/com/google/dart/compiler/resolver/SupertypeResolver.java View 1 2 3 3 chunks +9 lines, -6 lines 0 comments Download
M compiler/java/com/google/dart/compiler/resolver/SyntheticDefaultConstructorElement.java View 2 chunks +1 line, -3 lines 0 comments Download
M compiler/java/com/google/dart/compiler/resolver/TypeErrorCode.java View 1 chunk +2 lines, -2 lines 0 comments Download
M compiler/java/com/google/dart/compiler/type/DynamicTypeImplementation.java View 1 chunk +0 lines, -5 lines 0 comments Download
M compiler/java/com/google/dart/compiler/type/FunctionType.java View 1 chunk +0 lines, -2 lines 0 comments Download
M compiler/java/com/google/dart/compiler/type/FunctionTypeImplementation.java View 4 chunks +4 lines, -15 lines 0 comments Download
M compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java View 1 2 3 9 chunks +23 lines, -28 lines 0 comments Download
M compiler/java/com/google/dart/compiler/type/Types.java View 5 chunks +3 lines, -18 lines 0 comments Download
M compiler/javatests/com/google/dart/compiler/CompilerTestCase.java View 3 chunks +11 lines, -4 lines 0 comments Download
M compiler/javatests/com/google/dart/compiler/ast/DartToSourceVisitorTest.java View 1 2 chunks +12 lines, -2 lines 0 comments Download
M compiler/javatests/com/google/dart/compiler/backend/js/RttTest.java View 1 chunk +9 lines, -1 line 0 comments Download
M compiler/javatests/com/google/dart/compiler/backend/js/SnippetTestCase.java View 1 2 chunks +2 lines, -3 lines 0 comments Download
M compiler/javatests/com/google/dart/compiler/backend/js/testRuntimeTypes.dart View 1 3 chunks +17 lines, -9 lines 0 comments Download
M compiler/javatests/com/google/dart/compiler/end2end/inc/my.dart View 1 chunk +1 line, -1 line 0 comments Download
M compiler/javatests/com/google/dart/compiler/end2end/inc/my.no5ref.dart View 1 chunk +1 line, -1 line 0 comments Download
M compiler/javatests/com/google/dart/compiler/end2end/inc/some.dart View 1 chunk +1 line, -1 line 0 comments Download
M compiler/javatests/com/google/dart/compiler/end2end/inc/some.intfchange.dart View 1 chunk +1 line, -1 line 0 comments Download
M compiler/javatests/com/google/dart/compiler/end2end/inc/some.newmethod.dart View 1 chunk +1 line, -1 line 0 comments Download
M compiler/javatests/com/google/dart/compiler/end2end/inc/someimpl.dart View 1 chunk +1 line, -1 line 0 comments Download
M compiler/javatests/com/google/dart/compiler/end2end/inc/someimpl.bodychange.dart View 1 chunk +1 line, -1 line 0 comments Download
M compiler/javatests/com/google/dart/compiler/end2end/inc/someimpl.change.dart View 1 chunk +1 line, -1 line 0 comments Download
M compiler/javatests/com/google/dart/compiler/parser/DartASTValidator.java View 1 2 chunks +2 lines, -2 lines 0 comments Download
M compiler/javatests/com/google/dart/compiler/parser/ErrorMessageLocationTest.java View 1 2 chunks +2 lines, -2 lines 0 comments Download
M compiler/javatests/com/google/dart/compiler/parser/NegativeParserTest.java View 4 chunks +27 lines, -43 lines 0 comments Download
M compiler/javatests/com/google/dart/compiler/resolver/NegativeResolverTest.java View 1 1 chunk +1 line, -1 line 0 comments Download
M compiler/javatests/com/google/dart/compiler/resolver/RawTypesNegativeTest.dart View 1 1 chunk +1 line, -1 line 0 comments Download
M compiler/javatests/com/google/dart/compiler/resolver/ResolverCompilerTest.java View 4 chunks +10 lines, -10 lines 0 comments Download
M compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java View 1 2 5 chunks +242 lines, -54 lines 0 comments Download
M compiler/javatests/com/google/dart/compiler/resolver/ResolverTestCase.java View 1 3 chunks +6 lines, -1 line 0 comments Download
M compiler/javatests/com/google/dart/compiler/type/FunctionTypeTest.java View 1 chunk +2 lines, -3 lines 0 comments Download
M compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java View 2 chunks +1 line, -19 lines 0 comments Download
M compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerTest.java View 1 2 3 3 chunks +28 lines, -4 lines 0 comments Download
M compiler/javatests/com/google/dart/compiler/type/TypeTestCase.java View 5 chunks +9 lines, -10 lines 0 comments Download
M compiler/lib/implementation/array.dart View 2 chunks +3 lines, -3 lines 0 comments Download
M corelib/src/list.dart View 1 chunk +1 line, -1 line 0 comments Download
M tests/language/language.status View 1 2 chunks +1 line, -4 lines 0 comments Download
M tests/language/src/Factory2Test.dart View 1 chunk +1 line, -1 line 0 comments Download
M tests/language/src/Factory3Test.dart View 1 chunk +2 lines, -2 lines 0 comments Download
M tests/language/src/FactoryNegativeTest.dart View 1 1 chunk +6 lines, -9 lines 0 comments Download
M tests/language/src/NonParameterizedFactory2Test.dart View 1 1 chunk +4 lines, -4 lines 0 comments Download
M tests/language/src/NonParameterizedFactoryTest.dart View 1 1 chunk +4 lines, -4 lines 0 comments Download
M tests/language/src/TypeVariableBoundsTest.dart View 1 2 chunks +33 lines, -13 lines 0 comments Download
M tests/stub-generator/src/MintMakerFullyIsolatedTest.dart View 2 chunks +2 lines, -2 lines 0 comments Download
M tests/stub-generator/src/MintMakerFullyIsolatedTest-generatedTest.dart View 2 chunks +2 lines, -2 lines 0 comments Download
M tests/stub-generator/src/MintMakerPromiseWithStubsTest.dart View 2 chunks +2 lines, -2 lines 0 comments Download
M tests/stub-generator/src/MintMakerPromiseWithStubsTest-generatedTest.dart View 2 chunks +2 lines, -2 lines 0 comments Download

Messages

Total messages: 12 (0 generated)
zundel
@Peter, could you review the updates to the unit tests?
9 years ago (2011-12-15 00:18:26 UTC) #1
ahe
Hi Eric, There seems to be misunderstanding around whether or not factory clauses require type ...
9 years ago (2011-12-15 09:02:13 UTC) #2
zundel
http://codereview.chromium.org/8948001/diff/2001/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java File compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java (right): http://codereview.chromium.org/8948001/diff/2001/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java#newcode400 compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java:400: ResolverErrorCode.DEFAULT_CLASS_MUST_HAVE_SAME_TYPE_PARAMS); On 2011/12/15 09:02:13, ahe wrote: > This test ...
9 years ago (2011-12-15 14:12:50 UTC) #3
ahe
http://codereview.chromium.org/8948001/diff/2001/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java File compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java (right): http://codereview.chromium.org/8948001/diff/2001/compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java#newcode400 compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java:400: ResolverErrorCode.DEFAULT_CLASS_MUST_HAVE_SAME_TYPE_PARAMS); On 2011/12/15 14:12:50, zundel wrote: > On 2011/12/15 ...
9 years ago (2011-12-15 14:20:51 UTC) #4
mmendez
We talked at length about this at my desk so, I'll just send a summary. ...
9 years ago (2011-12-15 22:04:12 UTC) #5
zundel
Updated the tests and merged up to master. There is still something left to be ...
9 years ago (2011-12-16 21:36:29 UTC) #6
zundel
http://codereview.chromium.org/8948001/diff/15014/compiler/java/com/google/dart/compiler/resolver/Resolver.java File compiler/java/com/google/dart/compiler/resolver/Resolver.java (right): http://codereview.chromium.org/8948001/diff/15014/compiler/java/com/google/dart/compiler/resolver/Resolver.java#newcode887 compiler/java/com/google/dart/compiler/resolver/Resolver.java:887: Element element = context.resolveName(x.getExpression()); I know this needs rework, ...
9 years ago (2011-12-17 11:21:23 UTC) #7
zundel
http://codereview.chromium.org/8948001/diff/15014/compiler/java/com/google/dart/compiler/resolver/Resolver.java File compiler/java/com/google/dart/compiler/resolver/Resolver.java (right): http://codereview.chromium.org/8948001/diff/15014/compiler/java/com/google/dart/compiler/resolver/Resolver.java#newcode887 compiler/java/com/google/dart/compiler/resolver/Resolver.java:887: Element element = context.resolveName(x.getExpression()); On 2011/12/17 11:21:24, zundel wrote: ...
9 years ago (2011-12-17 17:56:11 UTC) #8
zundel
Updated patch and removed previous patch to avoid confusion
9 years ago (2011-12-18 02:13:07 UTC) #9
mmendez
- The following code produces an internal error but does not stop compilation. However substituting ...
9 years ago (2011-12-19 17:28:26 UTC) #10
zundel
New patch up. I fixed the problem with "internal error: type "String" is null" The ...
9 years ago (2011-12-19 20:17:49 UTC) #11
mmendez
9 years ago (2011-12-19 21:50:34 UTC) #12
LGTM, but please address the open issues from my comment above in subsequent
patches.

On 2011/12/19 20:17:49, zundel wrote:
> New patch up.
> 
> I fixed the problem with "internal error:  type "String" is null"
> 
> The other failing cases I'd like to deal with in a followon patch.
> 
>
http://codereview.chromium.org/8948001/diff/37001/compiler/java/com/google/da...
> File compiler/java/com/google/dart/compiler/ast/DartParameterizedTypeNode.java
> (right):
> 
>
http://codereview.chromium.org/8948001/diff/37001/compiler/java/com/google/da...
> compiler/java/com/google/dart/compiler/ast/DartParameterizedTypeNode.java:35:
> public Symbol getSymbol() {
> On 2011/12/19 17:28:26, mmendez wrote:
> > Tighten the return type here to ClassElement.
> 
> Remove get/setSybol().  now we use just the type on this node.  I think that
is
> more consistent with precedent in DartTypeNode
> 
>
http://codereview.chromium.org/8948001/diff/37001/compiler/java/com/google/da...
> compiler/java/com/google/dart/compiler/ast/DartParameterizedTypeNode.java:64:
> typeParameters = Collections.EMPTY_LIST;
> On 2011/12/19 17:28:26, mmendez wrote:
> > Nit: this should produce a warning about unchecked conversion.  You can
switch
> > it to Collections.emptyList() to get rid of the warning.
> 
> Done.
> 
>
http://codereview.chromium.org/8948001/diff/37001/compiler/java/com/google/da...
> File
compiler/java/com/google/dart/compiler/backend/js/RuntimeTypeInjector.java
> (right):
> 
>
http://codereview.chromium.org/8948001/diff/37001/compiler/java/com/google/da...
>
compiler/java/com/google/dart/compiler/backend/js/RuntimeTypeInjector.java:911:
> contextTypeArgs,
> On 2011/12/19 17:28:26, mmendez wrote:
> > Why is it safe to not clone here?
> 
> This was unintentional. reverted.
> 
>
http://codereview.chromium.org/8948001/diff/37001/compiler/java/com/google/da...
>
compiler/java/com/google/dart/compiler/backend/js/RuntimeTypeInjector.java:1138:
> private boolean inFactoryOrStatic(ClassElement containingClass) {
> On 2011/12/19 17:28:26, mmendez wrote:
> > It seems weird to continue to check that the member is a factory since the
> only
> > caller (inStaticNotFactory) already ensures that you are not in a factory.
> 
> Done.
> 
>
http://codereview.chromium.org/8948001/diff/37001/compiler/java/com/google/da...
> File compiler/java/com/google/dart/compiler/resolver/MemberBuilder.java
(right):
> 
>
http://codereview.chromium.org/8948001/diff/37001/compiler/java/com/google/da...
> compiler/java/com/google/dart/compiler/resolver/MemberBuilder.java:387:
private
> ElementKind getMethodKind(DartMethodDefinition method) {
> On 2011/12/19 17:28:26, mmendez wrote:
> > In this method, I don't understand how a method name could ever be a
> > DartParameterizedTypeNode.
> 
> Done.
> 
>
http://codereview.chromium.org/8948001/diff/37001/compiler/java/com/google/da...
> compiler/java/com/google/dart/compiler/resolver/MemberBuilder.java:397: if
(name
> instanceof DartParameterizedTypeNode) {
> On 2011/12/19 17:28:26, mmendez wrote:
> > What source code causes the name to be a DartParameterizedTypeNode?
> 
> Holdover from old factory method implementation that had type parameters. 
> Removed.
> 
>
http://codereview.chromium.org/8948001/diff/37001/compiler/java/com/google/da...
> File compiler/java/com/google/dart/compiler/resolver/Resolver.java (right):
> 
>
http://codereview.chromium.org/8948001/diff/37001/compiler/java/com/google/da...
> compiler/java/com/google/dart/compiler/resolver/Resolver.java:295:
> onError(defaultClassRef,
ResolverErrorCode.TYPE_PARAMETERS_MUST_MATCH_EXACTLY);
> On 2011/12/19 17:28:26, mmendez wrote:
> > Nit: might be nice to point out where the type param match failure starts.
> 
> I started to overhaul the logic, but it isn't quite so simple.  In the case
> where there are extra parameters on the end, there would be nothing to
highlight
> in the interface declaration other than the whole string.
> 
> Added TODO
> 
>
http://codereview.chromium.org/8948001/diff/37001/compiler/java/com/google/da...
> File compiler/java/com/google/dart/compiler/resolver/SupertypeResolver.java
> (right):
> 
>
http://codereview.chromium.org/8948001/diff/37001/compiler/java/com/google/da...
> compiler/java/com/google/dart/compiler/resolver/SupertypeResolver.java:73:
> node.getDefaultClass().setSymbol(defaultClassElement);
> On 2011/12/19 17:28:26, mmendez wrote:
> > Nit: can you add a comment about why you set the element and not the type on
> the
> > default class.
> 
> I just made it set the type.  Neither field is being used right now, I did it
> for use by the editor.
> 
>
http://codereview.chromium.org/8948001/diff/37001/compiler/java/com/google/da...
> File compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java (right):
> 
>
http://codereview.chromium.org/8948001/diff/37001/compiler/java/com/google/da...
> compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java:730: //
> TODO(zundel): validate the factory type (and parameters) exactly match the
> default
> On 2011/12/19 17:28:26, mmendez wrote:
> > Nit: maybe update the todo section to only call out that the bounds check is
> > what remains to be done.
> 
> I think the entire TODO is obsolete, so I removed it.
> 
>
http://codereview.chromium.org/8948001/diff/37001/compiler/java/com/google/da...
> compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java:1070: if
> (ifaceType.getElement().isInterface()) {
> On 2011/12/19 17:28:26, mmendez wrote:
> > Could you add a comment here explaining why the substitution is necessary?
> 
> Done.

Powered by Google App Engine
This is Rietveld 408576698