Remove CTEC.MIXIN_OF_NON_MIXIN and MIXIN_WITH_NON_CLASS_SUPERCLASS. (issue 15029010)

6 views
Skip to first unread message

sche...@google.com

unread,
May 10, 2013, 6:07:14 PM5/10/13
to brianwi...@google.com, jw...@google.com, rev...@dartlang.org, lukee...@gmail.com
Reviewers: Brian Wilkerson, jwren,

Description:
Remove CTEC.MIXIN_OF_NON_MIXIN and MIXIN_WITH_NON_CLASS_SUPERCLASS.

I believe these codes are covered by the more specific
MIXIN_REFERENCES_SUPER,
MIXIN_DECLARES_CONSTRUCTOR and MIXIN_INHERITS_FROM_NOT_OBJECT.

R=brianwi...@google.com, jw...@google.com
BUG=

Please review this at https://codereview.chromium.org/15029010/

SVN Base: https://dart.googlecode.com/svn/branches/bleeding_edge/dart

Affected files:
M
editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/error/CompileTimeErrorCode.java
M
editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java


Index:
editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/error/CompileTimeErrorCode.java
diff --git
a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/error/CompileTimeErrorCode.java
b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/error/CompileTimeErrorCode.java
index
6e7b596f3491896b20f2cc55fc50c000afe439b5..e5623c0097578bbc52f41ef0166ae8220ce7c9d4
100644
---
a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/error/CompileTimeErrorCode.java
+++
b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/error/CompileTimeErrorCode.java
@@ -606,23 +606,11 @@ public enum CompileTimeErrorCode implements ErrorCode
{
MIXIN_OF_NON_CLASS("Classes can only mixin other classes"),

/**
- * 9.1 Mixin Application: If <i>M</i> is a class, it is a compile time
error if a well formed
- * mixin cannot be derived from <i>M</i>.
- */
- MIXIN_OF_NON_MIXIN(""), // TODO(brianwilkerson) This might be covered by
more specific errors.
-
- /**
* 9 Mixins: It is a compile-time error if a declared or derived mixin
refers to super.
*/
MIXIN_REFERENCES_SUPER("The class '%s' cannot be used as a mixin because
it references 'super'"),

/**
- * 9.1 Mixin Application: It is a compile-time error if <i>S</i> does
not denote a class available
- * in the immediately enclosing scope.
- */
- MIXIN_WITH_NON_CLASS_SUPERCLASS(""),
-
- /**
* 7.6.1 Generative Constructors: Let <i>k</i> be a generative
constructor. Then <i>k</i> may
* include at most one superinitializer in its initializer list or a
compile time error occurs.
*/
Index:
editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java
diff --git
a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java
b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java
index
24090c330ac0f38bbc478e6e6602f5117fcfd90e..764e30fa8965eae5c9dcae4abac8e8cd7ab709d9
100644
---
a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java
+++
b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/CompileTimeErrorCodeTest.java
@@ -187,36 +187,6 @@ public class CompileTimeErrorCodeTest extends
ResolverTestCase {
verify(source);
}

- public void fail_mixinOfNonClass() throws Exception {
- // TODO(brianwilkerson) Compare with MIXIN_WITH_NON_CLASS_SUPERCLASS.
- Source source = addSource(createSource(//
- "var A;",
- "class B extends Object mixin A {}"));
- resolve(source);
- assertErrors(CompileTimeErrorCode.MIXIN_OF_NON_CLASS);
- verify(source);
- }
-
- public void fail_mixinOfNonMixin() throws Exception {
- // TODO(brianwilkerson) This might be covered by more specific errors.
- Source source = addSource(createSource(//
- // TODO
- ));
- resolve(source);
- assertErrors(CompileTimeErrorCode.MIXIN_OF_NON_MIXIN);
- verify(source);
- }
-
- public void fail_mixinWithNonClassSuperclass() throws Exception {
- // TODO(brianwilkerson) Compare with MIXIN_OF_NON_CLASS.
- Source source = addSource(createSource(//
- "int A;",
- "class B extends Object mixin A {}"));
- resolve(source);
- assertErrors(CompileTimeErrorCode.MIXIN_WITH_NON_CLASS_SUPERCLASS);
- verify(source);
- }
-
public void fail_nonConstantDefaultValue_named() throws Exception {
Source source = addSource(createSource(//
"f({x : 2 + 3}) {}"));


brianwi...@google.com

unread,
May 10, 2013, 6:15:54 PM5/10/13
to sche...@google.com, jw...@google.com, rev...@dartlang.org, lukee...@gmail.com
I agree that MIXIN_OF_NON_MIXIN appears to be covered by the more specific
errors you mentioned, but I don't see how MIXIN_WITH_NON_CLASS_SUPERCLASS
is (or
should be) covered by them.

https://codereview.chromium.org/15029010/

sche...@google.com

unread,
May 10, 2013, 11:11:02 PM5/10/13
to brianwi...@google.com, jw...@google.com, rev...@dartlang.org, lukee...@gmail.com
On 2013/05/10 22:15:54, Brian Wilkerson wrote:
> I agree that MIXIN_OF_NON_MIXIN appears to be covered by the more specific
> errors you mentioned, but I don't see how MIXIN_WITH_NON_CLASS_SUPERCLASS
> is
(or
> should be) covered by them.

OK

int A;
class B {}
class C extends A with B {}

This source produces EXTENDS_NON_CLASS.
So, yes, actually we generate less specific error code than could.
I will make changes to generate MIXIN_WITH_NON_CLASS_SUPERCLASS.


https://codereview.chromium.org/15029010/

sche...@google.com

unread,
May 11, 2013, 1:33:50 AM5/11/13
to brianwi...@google.com, jw...@google.com, rev...@dartlang.org, lukee...@gmail.com

brianwi...@google.com

unread,
May 13, 2013, 9:37:59 AM5/13/13
to sche...@google.com, jw...@google.com, rev...@dartlang.org, lukee...@gmail.com

sche...@google.com

unread,
May 13, 2013, 11:18:23 AM5/13/13
to brianwi...@google.com, jw...@google.com, rev...@dartlang.org, lukee...@gmail.com
Committed patchset #2 manually as r22626 (presubmit successful).

https://codereview.chromium.org/15029010/
Reply all
Reply to author
Forward
0 new messages