New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CFE isn't using instantiate-to-bounds for raw types #31566

Closed
vsmenon opened this Issue Dec 6, 2017 · 4 comments

Comments

5 participants
@vsmenon
Member

vsmenon commented Dec 6, 2017

The CFE is giving an incorrect error on the following snippet of code:

  ElementStream<BeforeUnloadEvent> _forElementList(ElementList e,
      {bool useCapture: false}) {
    // Specify the generic type for _ElementEventStreamImpl only in dart2js to                                                               
    // avoid checked mode errors in dartium.                                                                                                 
    return new _ElementListEventStreamImpl<BeforeUnloadEvent>(
        e, _eventType, useCapture);
  }

The error is:

gen/patched_sdk/lib/html/dart2js/html_dart2js.dart:39020:9: Error: A value of type 'dart.dom.html::ElementList<dynamic>' can't be assigned to a variable of type 'dart.core::Iterable<dart.dom.html::Element>'.
Try changing the type of the left hand side, or casting the right hand side to 'dart.core::Iterable<dart.dom.html::Element>'.
        e, _eventType, useCapture);

ElementList is declared with bound Element - the raw ElementList should be instantiated to ElementList<Element> automatically.

@vsmenon

This comment has been minimized.

Show comment
Hide comment
@vsmenon

vsmenon Dec 6, 2017

Member

FYI - @stereotype441 @kmillikin @stefantsov

I'll work around in dart:html for now.

Member

vsmenon commented Dec 6, 2017

FYI - @stereotype441 @kmillikin @stefantsov

I'll work around in dart:html for now.

@vsmenon

This comment has been minimized.

Show comment
Hide comment
Member

vsmenon commented Dec 6, 2017

whesse pushed a commit that referenced this issue Dec 6, 2017

Workaround CFE instantiate-to-bounds bug
This avoids #31566 for now.

Change-Id: I5f2ea0cf0ad15a534c1c62182bdca36fc3b0b103
Reviewed-on: https://dart-review.googlesource.com/26760
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Vijay Menon <vsm@google.com>

@kmillikin kmillikin added this to Incoming in Dart Front End Jan 3, 2018

@a-siva a-siva added this to the 2.0-alpha milestone Jan 4, 2018

@kmillikin kmillikin moved this from Incoming Untriaged to In Progress in Dart Front End Jan 4, 2018

@kmillikin kmillikin added the p2-medium label Jan 4, 2018

@kmillikin

This comment has been minimized.

Show comment
Hide comment
@kmillikin

kmillikin Jan 4, 2018

Member

This should be fixed by 1f3b493.

class Element {}
class ElementList<T extends Element> {}
class ElementStream<T> {}
class BeforeUnloadEvent {}
class _ElementListEventStreamImpl<T> implements ElementStream<T> {
  _ElementListEventStreamImpl(x, y, z);
}
var _eventType;

ElementStream<BeforeUnloadEvent> _forElementList(ElementList e,
      {bool useCapture: false}) {
    // Specify the generic type for _ElementEventStreamImpl only in dart2js to
    // avoid checked mode errors in dartium.
    return new _ElementListEventStreamImpl<BeforeUnloadEvent>(
        e, _eventType, useCapture);
}

compiles to Kernel:

static method _forElementList(self::ElementList<self::Element> e,
                              {core::bool useCapture = false})
        → self::ElementStream<self::BeforeUnloadEvent> {
  return new self::_ElementListEventStreamImpl::<self::BeforeUnloadEvent>(
    e, self::_eventType, useCapture);
}

Please verify (and remove the workaround).

Member

kmillikin commented Jan 4, 2018

This should be fixed by 1f3b493.

class Element {}
class ElementList<T extends Element> {}
class ElementStream<T> {}
class BeforeUnloadEvent {}
class _ElementListEventStreamImpl<T> implements ElementStream<T> {
  _ElementListEventStreamImpl(x, y, z);
}
var _eventType;

ElementStream<BeforeUnloadEvent> _forElementList(ElementList e,
      {bool useCapture: false}) {
    // Specify the generic type for _ElementEventStreamImpl only in dart2js to
    // avoid checked mode errors in dartium.
    return new _ElementListEventStreamImpl<BeforeUnloadEvent>(
        e, _eventType, useCapture);
}

compiles to Kernel:

static method _forElementList(self::ElementList<self::Element> e,
                              {core::bool useCapture = false})
        → self::ElementStream<self::BeforeUnloadEvent> {
  return new self::_ElementListEventStreamImpl::<self::BeforeUnloadEvent>(
    e, self::_eventType, useCapture);
}

Please verify (and remove the workaround).

@kmillikin kmillikin moved this from In Progress to Verify Fixed in Dart Front End Jan 4, 2018

@dgrove

This comment has been minimized.

Show comment
Hide comment
@dgrove

dgrove Feb 23, 2018

Member

@vsmenon can this be closed?

Member

dgrove commented Feb 23, 2018

@vsmenon can this be closed?

@vsmenon vsmenon closed this Mar 19, 2018

@kmillikin kmillikin moved this from Verify Fixed to Done in Dart Front End Apr 23, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment