Skip to content
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

Type-check error on calling LinkedHashMap.keys #7754

Closed
blois opened this issue Jan 7, 2013 · 12 comments
Closed

Type-check error on calling LinkedHashMap.keys #7754

blois opened this issue Jan 7, 2013 · 12 comments
Assignees
Labels
P1 A high priority bug; for example, a single project is unusable or has many test failures web-dart2js
Milestone

Comments

@blois
Copy link

blois commented Jan 7, 2013

Calling LinkedHashMap.keys in dart2js checked mode throws a type-check error.

Repro:
var keys = new LinkedHashMap<int, int>().keys;

Error:
type '_LinkedHashMapImpl_keys_anon' is not a subtype of type '_Transformation'

@blois
Copy link
Author

blois commented Jan 7, 2013

Note that this started failing with the experimental merge.

Related (I believe):

This throws a type check in dart2js as well:
new Future.immediate(true).then((bool complete) {});

While this does not:
new Future.immediate(true).then((complete) {});

@rakudrama
Copy link
Member

This is showing up now because lib_v2 uses parameterized typedefs.

What is needed immediately is for checked mode type assertions to be 'optimistic'.
Longer term the assertions should be accurate.

Smaller example:

typedef T Transformation<S, T>(S value);

main() {
  Transformation<String, int> f;
  f = (x) => 123;
  f = (String s) => 321;
}


o.js:230: type 'main_anon0' is not a subtype of type 'Transformation'
  throw jsError;
        ^
type 'main_anon0' is not a subtype of type 'Transformation'
    at . $throw (o.js:225:13)
    at $.propertyTypeError (o.js:270:11)
    at $.propertyTypeCheck (o.js:278:5)
    at $.main (o.js:160:5)
    at o.js:378:7


$.main = function() {
  $.propertyTypeCheck(new $.main_anon(), "is$Transformation");
  $.propertyTypeCheck(new $.main_anon0(), "is$Transformation");
};

$$.main_anon = {"": "Closure;",
  call$1: function(x) {
    return 123;
  },
  is$Function: true,
  is$Transformation: true
};

$$.main_anon0 = {"": "Closure;",
  call$1: function(s) {
    $.stringTypeCheck(s);
    return 321;
  },
  is$Function: true // is$Transformation missing.
};



cc @karlklose.

@karlklose
Copy link
Contributor

Set owner to @karlklose.
Added Accepted label.

@anders-sandholm
Copy link
Contributor

Removed this from the M3 milestone.
Added this to the M4 milestone.

@anders-sandholm
Copy link
Contributor

Karl, is this still a critical unfixed issue?
If so, should it be blocking M4?

@karlklose
Copy link
Contributor

Johnni is working on function typechecks with type variables.

I don't think it should block M4 because the libraries do not currently use type variables.


cc @johnniwinther.

@kasperl
Copy link

kasperl commented Apr 22, 2013

Removed this from the M4 milestone.
Added this to the M5 milestone.

@kasperl
Copy link

kasperl commented May 23, 2013

Added TriageForM5 label.

@kasperl
Copy link

kasperl commented May 28, 2013

Sounds like this is on Johnni's plate.


cc @lrhn.
Set owner to @johnniwinther.
Removed TriageForM5 label.

@kasperl
Copy link

kasperl commented May 31, 2013

Removed Priority-Critical label.
Added Priority-High label.

@johnniwinther
Copy link
Member

Removed this from the M5 milestone.
Added this to the M6 milestone.

@johnniwinther
Copy link
Member

Fixed by https://codereview.chromium.org/12334070/.


Added Fixed label.

@blois blois added Type-Defect P1 A high priority bug; for example, a single project is unusable or has many test failures web-dart2js labels Jul 12, 2013
@blois blois added this to the M6 milestone Jul 12, 2013
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 A high priority bug; for example, a single project is unusable or has many test failures web-dart2js
Projects
None yet
Development

No branches or pull requests

6 participants