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

Fix null safety code generation and migrate to null safety #222

Closed
wants to merge 6 commits into from

Conversation

GZGavinZhao
Copy link

@GZGavinZhao GZGavinZhao commented Jan 9, 2022

This PR strives to achieve the following:

  1. Make pageloader usable with Dart SDK 2.14+ and AngularDart 7+
  2. To achieve 1, bump analyzer constraint (-> 2.8.0)
  3. Fix the erroneous code generation when writing null safety code after 2 is done. The main problem is that the $WhateverPo class is not generated at all. To see this, rerun build_runner build and choose "Delete conflicting files".

A few notes:

  1. I assume that before the null safety migration stopped for everything lib/src/generators was because the moment one changes the language version, the builder gets angry. The correct way to do this is to create a dummy project, copy the files under generators and api (the only thing generators depend on) over, bump the dependencies in the dummy project, and do the migration there.
  2. Right now it's technically migrated, however code generation still doesn't work. PRs and all other suggestions are welcome.
  3. There are a few places where I'm not sure what I'm supposed to do (e.g. DartType.displayName vs DartType.getDisplayString(withNullability: bool). All of these are marked with TODO(null-safety).

@GZGavinZhao
Copy link
Author

Current failures:

[SEVERE] pageloader:pageloader on test/src/findchain.dart (cached):

Bad state: No element
[SEVERE] pageloader:pageloader on test/examples/correct_null_safety/generics.dart (cached):

type 'TypeParameterTypeImpl' is not a subtype of type 'ParameterizedType' in type cast
[SEVERE] pageloader:pageloader on test/examples/correct/list.dart (cached):

Bad state: No element
[SEVERE] pageloader:pageloader on test/examples/correct/generics.dart (cached):

type 'TypeParameterTypeImpl' is not a subtype of type 'ParameterizedType' in type cast
[SEVERE] pageloader:pageloader on test/examples/correct/iterables.dart (cached):

Bad state: No element
[SEVERE] Failed after 102ms

@GZGavinZhao
Copy link
Author

GZGavinZhao commented Jan 9, 2022

The bad boy is analyzer 2.5.0, which is very strange because it has the most harmless CHANGELOG among all the versions!

@GZGavinZhao
Copy link
Author

Closing in favor of #223.

@GZGavinZhao GZGavinZhao closed this Jan 9, 2022
@GZGavinZhao GZGavinZhao deleted the master branch January 19, 2022 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant