Skip to content

Type parameter bounds can be marked "exact nullable" if upcast. #40551

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

Closed
MichaelRFairhurst opened this issue Feb 9, 2020 · 2 comments
Closed
Labels
area-migration (deprecated) Deprecated: this label is no longer actively used (was: issues with the `dart migrate` tool). NNBD Issues related to NNBD Release nnbd-migration-correctness-example Concrete examples of the migration engine producing an incorrect result on a phase 1 package P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@MichaelRFairhurst
Copy link
Contributor

class B<T extends Object> {                                                      
  void f(T t) {                                                                  
    // Create an edge from the bound to some type                                
    List<dynamic> x = [t];                                                       
    // and make that type exact nullable                                         
    x[0] = null;                                                                 
  }                                                                              
}

This migration should produce no source edits.

Currently, the assignment from List<T> to List<dynamic> results in an edge from the bound of T to the dynamic type argument in List<dynamic>. This is correct.

But it has an unfortunate consequence, it means that when dynamic is marked exact nullable (by assigning null to the list index), that exact nullability is propagated upstream, and that is currently not stopped in any way from marking the bound of T as exact nullable.

We therefore get T extends Object? whis is unnecessary.

This occurs in package:async.

@MichaelRFairhurst MichaelRFairhurst added legacy-area-analyzer Use area-devexp instead. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) analyzer-nnbd-migration NNBD Issues related to NNBD Release nnbd-migration-correctness-example Concrete examples of the migration engine producing an incorrect result on a phase 1 package labels Feb 9, 2020
@MichaelRFairhurst
Copy link
Contributor Author

Related to #40552

@srawlins srawlins added the P2 A bug or feature request we're likely to work on label Sep 8, 2020
@srawlins srawlins added P3 A lower priority bug or feature request and removed P2 A bug or feature request we're likely to work on labels Oct 5, 2020
@stereotype441 stereotype441 added area-migration (deprecated) Deprecated: this label is no longer actively used (was: issues with the `dart migrate` tool). and removed analyzer-nnbd-migration legacy-area-analyzer Use area-devexp instead. labels Nov 16, 2020
@stereotype441
Copy link
Member

As of 1c7fe71, the null safety migration tool has been removed from active development and retired. No further work on the tool is planned.

If you still need help, or you believe this issue has been closed in error, please feel free to reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-migration (deprecated) Deprecated: this label is no longer actively used (was: issues with the `dart migrate` tool). NNBD Issues related to NNBD Release nnbd-migration-correctness-example Concrete examples of the migration engine producing an incorrect result on a phase 1 package P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

3 participants