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

CFE sometimes doesn't properly perform downwards inference with spread. #36223

Markzipan opened this Issue Mar 14, 2019 · 1 comment


None yet
3 participants
Copy link

Markzipan commented Mar 14, 2019

For the following snippet:

import "expect.dart";

Map<K, V> expectIntStringMap<K, V>() {
  Expect.identical(int, K);
  Expect.identical(String, V);
  return {};

main() {
  var x = <int, String>{...expectIntStringMap()};

the CFE generates something like:

  static method main() → dynamic {
    core::Map<core::int, core::String> x = block {
      final core::Map<core::int, core::String> #t1 = <core::int, core::String>{};
      for (final core::MapEntry<core::int, core::String> #t2 in spr::expectIntStringMap<dynamic, dynamic>().{core::Map::entries})
        #t1.{core::Map::[]=}(#t2.{core::MapEntry::key}, #t2.{core::MapEntry::value});
    } =>#t1;

<K, V> is inferred as <dynamic, dynamic> but should be <int, String>.


This comment has been minimized.

Copy link

aartbik commented Mar 21, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.