Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

task mode: field initializer inference is overriding explicit LHS type #350

Description

@jmesserly

From @vsmenon's comment:

For the field type inference issue, we're seeing extra casts like:

Zone._current = dart.as(zone, _RootZone);

even though _current is declared in Dart as:

  static Zone _current = _ROOT_ZONE;

It appears that the rhs expression type is incorrectly overriding the lhs declared type.

I've also seen this in 'casts in constant contexts' in checker test:

          class A {
            static const num n = 3.0;
            static const int i = /*info:AssignmentCast*/n;
            final int fi;
            const A(num a) : this.fi = /*info:DownCastImplicit*/a;
          }
          class B extends A {
            const B(Object a) : super(/*info:DownCastImplicit*/a);
          }
          void foo(Object o) {
            var a = const A(/*info:DownCastImplicit*/o);
          }

The i = n initializer fails with a static type error because it thinks n is double instead of num like it should be.

Activity

  1. jmesserly commented on Sep 26, 2015

    @jmesserly
    ContributorAuthor

    @vsmenon and I confirmed this is fixed by https://codereview.chromium.org/1370793002/

  2. leafpetersen commented on Sep 28, 2015

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions