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

Issue 9153006: A class/interface cannot implement/extend a type parameter (issues 886 and 887). (Closed)

Created:
8 years, 11 months ago by regis
Modified:
8 years, 11 months ago
Reviewers:
hausner
CC:
reviews_dartlang.org
Visibility:
Public.

Description

A class/interface cannot implement/extend a type parameter (issues 886 and 887). Added tests. Committed: https://code.google.com/p/dart/source/detail?r=3122

Patch Set 1 #

Total comments: 6

Patch Set 2 : '' #

Patch Set 3 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+62 lines, -3 lines) Patch
M runtime/vm/parser.cc View 1 2 2 chunks +24 lines, -2 lines 0 comments Download
M tests/language/language.status View 1 2 1 chunk +3 lines, -1 line 0 comments Download
A tests/language/src/ExtendTypeParameter2NegativeTest.dart View 1 1 chunk +13 lines, -0 lines 0 comments Download
A tests/language/src/ExtendTypeParameterNegativeTest.dart View 1 1 chunk +11 lines, -0 lines 0 comments Download
A tests/language/src/ImplementTypeParameterNegativeTest.dart View 1 1 chunk +11 lines, -0 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
regis
8 years, 11 months ago (2012-01-09 18:11:25 UTC) #1
hausner
LGTM with comments. http://codereview.chromium.org/9153006/diff/1/runtime/vm/parser.cc File runtime/vm/parser.cc (right): http://codereview.chromium.org/9153006/diff/1/runtime/vm/parser.cc#newcode2517 runtime/vm/parser.cc:2517: ErrorMsg("class '%s' may not extend type ...
8 years, 11 months ago (2012-01-09 18:54:49 UTC) #2
regis
8 years, 11 months ago (2012-01-09 19:19:30 UTC) #3
Thanks!

http://codereview.chromium.org/9153006/diff/1/runtime/vm/parser.cc
File runtime/vm/parser.cc (right):

http://codereview.chromium.org/9153006/diff/1/runtime/vm/parser.cc#newcode2517
runtime/vm/parser.cc:2517: ErrorMsg("class '%s' may not extend type parameter
'%s'",
On 2012/01/09 18:54:49, hausner wrote:
> I would print the error at the actual text position of the type. You can
> remember the token position after consuming the 'extends' token.

Done here and on line 2523 below.

http://codereview.chromium.org/9153006/diff/1/runtime/vm/parser.cc#newcode3015
runtime/vm/parser.cc:3015: ErrorMsg("interface '%s' may not extend type
parameter '%s'",
On 2012/01/09 18:54:49, hausner wrote:
> Would be nice if these error messages were pointing to the actual interface
name
> that causes the error. At least though I would print the error at
interface_pos,
> like in the error message at line 3028.

We should definitely store the position in each type. For now, I use
interface_pos, as you suggested.

http://codereview.chromium.org/9153006/diff/1/tests/language/src/ImplementTyp...
File tests/language/src/ImplementTypeParameterNegativeTest.dart (right):

http://codereview.chromium.org/9153006/diff/1/tests/language/src/ImplementTyp...
tests/language/src/ImplementTypeParameterNegativeTest.dart:5: class A<T>
implements T { }
On 2012/01/09 18:54:49, hausner wrote:
> Could you add a short comment why this code is supposed to fail? (In the other
> tests as well.)

Done.

Powered by Google App Engine
This is Rietveld 408576698