Skip to content
Snippets Groups Projects
  • Bob Nystrom's avatar
    Fix a couple of strong mode runtime cast errors. (#733) · 26db9616
    Bob Nystrom authored
    Fix a couple of strong mode runtime cast errors.
    
    In strong mode, a generic type instantiated with dynamic is not a
    subtype of all types. You can't pass a List<dynamic> to something
    expecting, say, List<int>.
    
    These errors are usually detected statically, and most of those have
    been fixed. However, sometimes this becomes a runtime cast, as in:
    
    main() {
      // Store a List<dynamic> in a variable of type dynamic.
      dynamic d = [];
    
      // Implicit runtime downcast from dynamic to List<String>.
      List<String> s = d;
    }
    
    In order to ease the migration to strong mode, DDC has been ignoring
    these cast failures when they involve certain commonly used types. We
    are now in the process of actively fixing those errors.
    
    More context: https://github.com/dart-lang/sdk/issues/27223
    26db9616
To find the state of this project's repository at the time of any of these versions, check out the tags.